diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index c1a30bb05..306bea98e 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -1119,6 +1119,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](simple-cw-node/simple-cw-node.d.ts) [simple-cw-node](https://github.com/astronaughts/simple-cw-node) by [vvakame](https://github.com/vvakame) * [:link:](simplebar/simplebar.d.ts) [simplebar.js](https://github.com/Grsmto/simplebar) by [Gregor Woiwode](https://github.com/gregonnet) * [:link:](jquery.simplemodal/jquery.simplemodal.d.ts) [SimpleModal](http://www.ericmmartin.com/projects/simplemodal) by [Friedrich von Never](https://github.com/ForNeVeR) +* [:link:](simpleStorage/simplestorage.js.d.ts) [simpleStorage](https://github.com/andris9/simpleStorage) by [Áxel Costas Pena](https://github.com/axelcostaspena) * [:link:](sinon/sinon.d.ts) [Sinon](http://sinonjs.org) by [William Sears](https://github.com/mrbigdog2u) * [:link:](sinon-chai/sinon-chai.d.ts) [sinon-chai](https://github.com/domenic/sinon-chai) by [Kazi Manzur Rashid](https://github.com/kazimanzurrashid), [Jed Mao](https://github.com/jedmao) * [:link:](sinon-chrome/sinon-chrome.d.ts) [Sinon-Chrome](https://github.com/vitalets/sinon-chrome) by [Tim Perry](https://github.com/pimterry) diff --git a/amqplib/amqplib-tests.ts b/amqplib/amqplib-tests.ts index 7a1f51200..f99a3bde1 100644 --- a/amqplib/amqplib-tests.ts +++ b/amqplib/amqplib-tests.ts @@ -1,5 +1,6 @@ /// +// promise api tests import amqp = require("amqplib"); var msg = "Hello World"; @@ -19,3 +20,34 @@ amqp.connect("amqp://localhost") .then(channel => channel.consume("myQueue", newMsg => console.log("New Message: " + newMsg.content.toString()))) .ensure(() => connection.close()); }); + +// callback api tests +import amqpcb = require("amqplib/callback_api"); + +amqpcb.connect("amqp://localhost", (err, connection) => { + if(!err) { + connection.createChannel((err, channel) => { + if (!err) { + channel.assertQueue("myQueue", {}, (err, ok) => { + if(!err) { + channel.sendToQueue("myQueue", new Buffer(msg)); + } + }); + } + }); + } +}); + +amqpcb.connect("amqp://localhost", (err, connection) => { + if(!err) { + connection.createChannel((err, channel) => { + if (!err) { + channel.assertQueue("myQueue", {}, (err, ok) => { + if(!err) { + channel.consume("myQueue", newMsg => console.log("New Message: " + newMsg.content.toString())); + } + }); + } + }); + } +}); diff --git a/amqplib/amqplib.d.ts b/amqplib/amqplib.d.ts index 0c7f0720a..f125aaa07 100644 --- a/amqplib/amqplib.d.ts +++ b/amqplib/amqplib.d.ts @@ -1,22 +1,12 @@ // Type definitions for amqplib 0.3.x // Project: https://github.com/squaremo/amqp.node -// Definitions by: Michael Nahkies +// Definitions by: Michael Nahkies , Ab Reitsma // Definitions: https://github.com/borisyankov/DefinitelyTyped /// /// -declare module "amqplib" { - - import events = require("events"); - import when = require("when"); - - interface Connection extends events.EventEmitter { - close(): when.Promise; - createChannel(): when.Promise; - createConfirmChannel(): when.Promise; - } - +declare module "amqplib/properties" { module Replies { interface Empty { } @@ -25,6 +15,9 @@ declare module "amqplib" { messageCount: number; consumerCount: number; } + interface PurgeQueue { + messageCount: number; + } interface DeleteQueue { messageCount: number; } @@ -100,6 +93,22 @@ declare module "amqplib" { fields: Object; properties: Object; } +} + +declare module "amqplib" { + + import events = require("events"); + import when = require("when"); + import shared = require("amqplib/properties") + import Replies = shared.Replies; + import Options = shared.Options; + import Message = shared.Message; + + interface Connection extends events.EventEmitter { + close(): when.Promise; + createChannel(): when.Promise; + createConfirmChannel(): when.Promise; + } interface Channel extends events.EventEmitter { close(): when.Promise; @@ -108,7 +117,7 @@ declare module "amqplib" { checkQueue(queue: string): when.Promise; deleteQueue(queue: string, options?: Options.DeleteQueue): when.Promise; - purgeQueue(queue: string): when.Promise; + purgeQueue(queue: string): when.Promise; bindQueue(queue: string, source: string, pattern: string, args?: any): when.Promise; unbindQueue(queue: string, source: string, pattern: string, args?: any): when.Promise; @@ -142,3 +151,68 @@ declare module "amqplib" { function connect(url: string, socketOptions?: any): when.Promise; } + +declare module "amqplib/callback_api" { + + import events = require("events"); + import shared = require("amqplib/properties") + import Replies = shared.Replies; + import Options = shared.Options; + import Message = shared.Message; + + interface Connection extends events.EventEmitter { + close(callback?: (err: any) => void): void; + createChannel(callback: (err: any, channel: Channel) => void): void; + createConfirmChannel(callback: (err: any, confirmChannel: ConfirmChannel) => void): void; + } + + interface Channel extends events.EventEmitter { + close(callback: (err: any) => void): void; + + assertQueue(queue?: string, options?: Options.AssertQueue, callback?: (err:any, ok: Replies.AssertQueue) => void): void; + checkQueue(queue: string, callback?: (err: any, ok: Replies.AssertQueue) => void): void; + + deleteQueue(queue: string, options?: Options.DeleteQueue, callback?: (err:any, ok: Replies.DeleteQueue) => void): void; + purgeQueue(queue: string, callback?: (err:any, ok: Replies.PurgeQueue) => void): void; + + bindQueue(queue: string, source: string, pattern: string, args?: any, callback?: (err: any, ok: Replies.Empty) => void): void; + unbindQueue(queue: string, source: string, pattern: string, args?: any, callback?: (err: any, ok: Replies.Empty) => void): void; + + assertExchange(exchange: string, type: string, options?: Options.AssertExchange, callback?: (err: any, ok: Replies.AssertExchange) => void): void; + checkExchange(exchange: string, callback?: (err: any, ok: Replies.Empty) => void): void; + + deleteExchange(exchange: string, options?: Options.DeleteExchange, callback?: (err: any, ok: Replies.Empty) => void): void; + + bindExchange(destination: string, source: string, pattern: string, args?: any, callback?: (err: any, ok: Replies.Empty) => void): void; + unbindExchange(destination: string, source: string, pattern: string, args?: any, callback?: (err: any, ok: Replies.Empty) => void): void; + + publish(exchange: string, routingKey: string, content: Buffer, options?: Options.Publish): boolean; + sendToQueue(queue: string, content: Buffer, options?: Options.Publish): boolean; + + consume(queue: string, onMessage: (msg: Message) => any, options?: Options.Consume, callback?: (err: any, ok: Replies.Consume) => void): void; + + cancel(consumerTag: string, callback?: (err: any, ok: Replies.Empty) => void): void; + get(queue: string, options?: Options.Get, callback?: (err: any, ok: Message | boolean) => void): void; + + ack(message: Message, allUpTo?: boolean): void; + ackAll(): void; + + nack(message: Message, allUpTo?: boolean, requeue?: boolean): void; + nackAll(requeue?: boolean): void; + reject(message: Message, requeue?: boolean): void; + + prefetch(count: number, global?: boolean): void; + recover(callback?: (err: any, ok: Replies.Empty) => void): void; + } + + interface ConfirmChannel extends Channel { + publish(exchange: string, routingKey: string, content: Buffer, options?: Options.Publish, callback?: (err: any, ok: Replies.Empty) => void): boolean; + sendToQueue(queue: string, content: Buffer, options?: Options.Publish, callback?: (err: any, ok: Replies.Empty) => void): boolean; + + waitForConfirms(callback?: (err: any) => void): void; + } + + function connect(callback: (err: any, connection: Connection) => void): void; + function connect(url: string, callback: (err: any, connection: Connection) => void): void; + function connect(url: string, socketOptions: any, callback: (err: any, connection: Connection) => void): void; +} diff --git a/async/async.d.ts b/async/async.d.ts index 6054e9a47..418f5539b 100644 --- a/async/async.d.ts +++ b/async/async.d.ts @@ -76,11 +76,11 @@ interface Async { each(arr: T[], iterator: AsyncIterator, callback?: ErrorCallback): void; eachSeries(arr: T[], iterator: AsyncIterator, callback?: ErrorCallback): void; eachLimit(arr: T[], limit: number, iterator: AsyncIterator, callback?: ErrorCallback): void; - forEachOf(obj: any, iterator: (item: any, key: [string|number], callback?: ErrorCallback) => void, callback: ErrorCallback): void; + forEachOf(obj: any, iterator: (item: any, key: string|number, callback?: ErrorCallback) => void, callback: ErrorCallback): void; forEachOf(obj: T[], iterator: AsyncForEachOfIterator, callback?: ErrorCallback): void; - forEachOfSeries(obj: any, iterator: (item: any, key: [string|number], callback?: ErrorCallback) => void, callback: ErrorCallback): void; + forEachOfSeries(obj: any, iterator: (item: any, key: string|number, callback?: ErrorCallback) => void, callback: ErrorCallback): void; forEachOfSeries(obj: T[], iterator: AsyncForEachOfIterator, callback?: ErrorCallback): void; - forEachOfLimit(obj: any, limit: number, iterator: (item: any, key: [string|number], callback?: ErrorCallback) => void, callback: ErrorCallback): void; + forEachOfLimit(obj: any, limit: number, iterator: (item: any, key: string|number, callback?: ErrorCallback) => void, callback: ErrorCallback): void; forEachOfLimit(obj: T[], limit: number, iterator: AsyncForEachOfIterator, callback?: ErrorCallback): void; map(arr: T[], iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): any; mapSeries(arr: T[], iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): any; diff --git a/closure-compiler/closure-compiler-tests.ts b/closure-compiler/closure-compiler-tests.ts new file mode 100644 index 000000000..e0bd650a3 --- /dev/null +++ b/closure-compiler/closure-compiler-tests.ts @@ -0,0 +1,17 @@ +/// +import {compile} from 'closure-compiler'; + +compile('some.source()', {'check-only': null}, + (err: Error, stdout: string, stderr: string): void => { + console.log('Got', err, 'stdout', stdout, 'stderr', stderr); + }); + +// No options, Callback wins. +compile('some.source()', (err: Error, stdout: string, stderr: string): void => { + console.log('Got', err, 'stdout', stdout, 'stderr', stderr); +}); + +compile(null, {'js': ['a/f.js', 'a/f2.js'], 'check-only': null}, + (err: Error, stdout: string, stderr: string): void => { + console.log('Got', err, 'stdout', stdout, 'stderr', stderr); + }); diff --git a/closure-compiler/closure-compiler.d.ts b/closure-compiler/closure-compiler.d.ts new file mode 100644 index 000000000..0d1aba741 --- /dev/null +++ b/closure-compiler/closure-compiler.d.ts @@ -0,0 +1,11 @@ +// Type definitions for closure-compiler +// Project: https://github.com/tim-smart/node-closure/ +// Definitions by: Martin Probst +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module 'closure-compiler' { + type Callback = (err: Error, stdout: string, stderr: string) => any; + function compile(src: string, callback: Callback): void; + function compile(src: string, options: {[k: string]: string | string[]}, + callback: Callback): void; +} diff --git a/connect/connect-tests.ts b/connect/connect-tests.ts new file mode 100644 index 000000000..e8665f8f9 --- /dev/null +++ b/connect/connect-tests.ts @@ -0,0 +1,32 @@ +/// + +import * as http from "http"; +import * as connect from "connect"; + +const app = connect(); + +// log all requests +app.use((req: http.IncomingMessage, res: http.ServerResponse, next: Function) => { + console.log(req, res); + next(); +}); + +// Stop on errors +app.use((err: Error, req: http.IncomingMessage, res: http.ServerResponse, next: Function) => { + if (err) { + return res.end(`Error: ${err}`); + } + + next(); +}); + +// respond to all requests +app.use((req: http.IncomingMessage, res: http.ServerResponse) => { + res.end("Hello from Connect!\n"); +}); + +//create node.js http server and listen on port +http.createServer(app).listen(3000); + +//create node.js http server and listen on port using connect shortcut +app.listen(3000); diff --git a/connect/connect.d.ts b/connect/connect.d.ts new file mode 100644 index 000000000..575a341b6 --- /dev/null +++ b/connect/connect.d.ts @@ -0,0 +1,92 @@ +// Type definitions for connect v3.4.0 +// Project: https://github.com/senchalabs/connect +// Definitions by: Maxime LUCE +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "connect" { + import * as http from "http"; + + /** + * Create a new connect server. + * @public + */ + function createServer(): createServer.Server; + + module createServer { + export type ServerHandle = HandleFunction | http.Server; + + export type SimpleHandleFunction = (req: http.IncomingMessage, res: http.ServerResponse) => void; + export type NextHandleFunction = (req: http.IncomingMessage, res: http.ServerResponse, next: Function) => void; + export type ErrorHandleFunction = (err: Error, req: http.IncomingMessage, res: http.ServerResponse, next: Function) => void; + export type HandleFunction = SimpleHandleFunction | NextHandleFunction | ErrorHandleFunction; + + export interface ServerStackItem { + route: string; + handle: ServerHandle; + } + + export interface Server extends NodeJS.EventEmitter { + (req: http.IncomingMessage, res: http.ServerResponse, next?: Function): void; + + route: string; + stack: ServerStackItem[]; + + /** + * Utilize the given middleware `handle` to the given `route`, + * defaulting to _/_. This "route" is the mount-point for the + * middleware, when given a value other than _/_ the middleware + * is only effective when that segment is present in the request's + * pathname. + * + * For example if we were to mount a function at _/admin_, it would + * be invoked on _/admin_, and _/admin/settings_, however it would + * not be invoked for _/_, or _/posts_. + * + * @public + */ + use(fn: HandleFunction): Server; + use(route: string, fn: HandleFunction): Server; + + /** + * Handle server requests, punting them down + * the middleware stack. + * + * @private + */ + handle(req: http.IncomingMessage, res: http.ServerResponse, next: Function): void; + + /** + * Listen for connections. + * + * This method takes the same arguments + * as node's `http.Server#listen()`. + * + * HTTP and HTTPS: + * + * If you run your application both as HTTP + * and HTTPS you may wrap them individually, + * since your Connect "server" is really just + * a JavaScript `Function`. + * + * var connect = require('connect') + * , http = require('http') + * , https = require('https'); + * + * var app = connect(); + * + * http.createServer(app).listen(80); + * https.createServer(options, app).listen(443); + * + * @api public + */ + listen(port: number, hostname?: string, backlog?: number, callback?: Function): http.Server; + listen(port: number, hostname?: string, callback?: Function): http.Server; + listen(path: string, callback?: Function): http.Server; + listen(handle: any, listeningListener?: Function): http.Server; + } + } + + export = createServer; +} diff --git a/faker/faker.d.ts b/faker/faker.d.ts index 6397dd993..01ce203ea 100644 --- a/faker/faker.d.ts +++ b/faker/faker.d.ts @@ -171,6 +171,8 @@ declare module Faker { uuid(): string; boolean(): boolean; }; + + seed(value: number): void; } interface Card { diff --git a/finalhandler/finalhandler-tests.ts b/finalhandler/finalhandler-tests.ts new file mode 100644 index 000000000..cb8dc053d --- /dev/null +++ b/finalhandler/finalhandler-tests.ts @@ -0,0 +1,17 @@ +/// + +import {ServerRequest, ServerResponse} from "http"; +import finalHandler from "finalhandler"; + +let req: ServerRequest; +let res: ServerResponse; +let options: { + onerror: (err: any, req: ServerRequest, res: ServerResponse) => void; + message: boolean|((err: any, status: number) => string); + stacktrace: boolean; +}; + +let result: (err: any) => void; + +result = finalHandler(req, res); +result = finalHandler(req, res, options); diff --git a/finalhandler/finalhandler.d.ts b/finalhandler/finalhandler.d.ts new file mode 100644 index 000000000..37e931718 --- /dev/null +++ b/finalhandler/finalhandler.d.ts @@ -0,0 +1,20 @@ +// Type definitions for finalhandler +// Project: https://github.com/pillarjs/finalhandler +// Definitions by: Ilya Mochalov +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "finalhandler" { + import {ServerRequest, ServerResponse} from "http"; + + export interface Options { + message?: boolean|((err: any, status: number) => string); + onerror?: (err: any, req: ServerRequest, res: ServerResponse) => void; + stacktrace?: boolean; + } + + function finalHandler(req: ServerRequest, res: ServerResponse, options?: Options): (err: any) => void; + + export default finalHandler; +} diff --git a/flat/flat-tests.ts b/flat/flat-tests.ts new file mode 100644 index 000000000..b6909cdb1 --- /dev/null +++ b/flat/flat-tests.ts @@ -0,0 +1,57 @@ +/// + +import {flatten, unflatten} from "flat"; + +module TestFlatten { + let options: { + delimiter?: string; + safe?: boolean; + maxDepth?: number; + }; + + type Target = { + a: { + b: number; + }, + c: boolean[][]; + }; + + let target: Target; + + type Result = { + 'a.b': number; + 'c.0.0': boolean; + }; + + let result: Result; + + result = flatten(target); + result = flatten(target, options); +} + +module TestUnflatten { + let options: { + delimiter?: string; + object?: boolean; + overwrite?: boolean; + }; + + type Target = { + 'a.b': number; + 'c.0.0': boolean; + }; + + let target: Target; + + type Result = { + a: { + b: number; + }, + c: boolean[][]; + }; + + let result: Result; + + result = unflatten(target); + result = unflatten(target, options); +} diff --git a/flat/flat.d.ts b/flat/flat.d.ts new file mode 100644 index 000000000..f3698f125 --- /dev/null +++ b/flat/flat.d.ts @@ -0,0 +1,41 @@ +// Type definitions for flat +// Project: https://github.com/hughsk/flat +// Definitions by: Ilya Mochalov +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module FlatTypes { + interface FlattenOptions { + delimiter?: string; + safe?: boolean; + maxDepth?: number; + } + + interface Flatten { + ( + target: TTarget, + options?: FlattenOptions + ): TResult; + + flatten: Flatten; + unflatten: Unflatten; + } + + interface UnflattenOptions { + delimiter?: string; + object?: boolean; + overwrite?: boolean; + } + + interface Unflatten { + ( + target: TTarget, + options?: UnflattenOptions + ): TResult; + } +} + +declare module "flat" { + var flatten: FlatTypes.Flatten; + + export = flatten; +} diff --git a/gruntjs/gruntjs.d.ts b/gruntjs/gruntjs.d.ts index 850d0b226..e503cb572 100644 --- a/gruntjs/gruntjs.d.ts +++ b/gruntjs/gruntjs.d.ts @@ -192,6 +192,12 @@ declare module grunt { */ requires(prop: string, ...andProps: string[]): void requires(prop: string[], ...andProps: string[][]): void + + /** + * Recursively merges properties of the specified configObject into the current project configuration. + * You can use this method to append configuration options, targets, etc., to already defined tasks. + */ + merge(configObject: T): void; } } diff --git a/gulp-inject/gulp-inject.d.ts b/gulp-inject/gulp-inject.d.ts index 42f5fb348..fb2668a1f 100644 --- a/gulp-inject/gulp-inject.d.ts +++ b/gulp-inject/gulp-inject.d.ts @@ -22,8 +22,11 @@ declare module "gulp-inject" { ignorePath?: string | string[]; relative?: boolean; addPrefix?: string; + addSuffix?: string; addRootSlash?: boolean; name?: string; + removeTags?: boolean; + empty?: boolean; starttag?: string | ITagFunction; endtag?: string | ITagFunction; transform?: ITransformFunction; diff --git a/iniparser/iniparser-tests.ts b/iniparser/iniparser-tests.ts new file mode 100644 index 000000000..8558766df --- /dev/null +++ b/iniparser/iniparser-tests.ts @@ -0,0 +1,21 @@ +/// + +import * as iniparser from 'iniparser'; + +type Result = {section: {param: string}}; + +let file: string; + +{ + let callback: (err: any, data: Result) => void; + let result: void; + + iniparser.parse(file, callback); +} + +{ + let result: Result; + + result = iniparser.parseSync(file); + result = iniparser.parseString(''); +} diff --git a/iniparser/iniparser.d.ts b/iniparser/iniparser.d.ts new file mode 100644 index 000000000..81fd07377 --- /dev/null +++ b/iniparser/iniparser.d.ts @@ -0,0 +1,15 @@ +// Type definitions for iniparser +// Project: https://github.com/shockie/node-iniparser +// Definitions by: Ilya Mochalov +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "iniparser" { + export function parse( + file: string, + callback: (err: any, data: T) => void + ): void; + + export function parseSync(file: string): T; + + export function parseString(data: string): T; +} diff --git a/jest/jest.d.ts b/jest/jest.d.ts index d500525b6..2ee765728 100644 --- a/jest/jest.d.ts +++ b/jest/jest.d.ts @@ -40,6 +40,7 @@ declare module jest { toBeFalsy(): boolean; toBeTruthy(): boolean; toBeNull(): boolean; + toBeDefined(): boolean; toBeUndefined(): boolean; toMatch(expected: RegExp): boolean; toContain(expected: string): boolean; diff --git a/jquery.pnotify/jquery.pnotify.d.ts b/jquery.pnotify/jquery.pnotify.d.ts index 6e3e67cd3..a21416f84 100644 --- a/jquery.pnotify/jquery.pnotify.d.ts +++ b/jquery.pnotify/jquery.pnotify.d.ts @@ -11,6 +11,8 @@ interface PNotifyStack { push?: string; spacing1?: number; spacing2?: number; + firstpos1?: number; + firstpos2?: number; context?: JQuery } diff --git a/knex/knex-test.ts b/knex/knex-test.ts index 081f98867..1d468b260 100644 --- a/knex/knex-test.ts +++ b/knex/knex-test.ts @@ -12,6 +12,7 @@ var knex = Knex({ }); var knex = Knex({ + debug: true, client: 'mysql', connection: { socketPath : '/path/to/socket.sock', @@ -32,7 +33,13 @@ var knex = Knex({ }, pool: { min: 0, - max: 7 + max: 7, + afterCreate: (connection: any, callback: Function) => { + return callback(null, connection); + }, + beforeDestroy: (connection: any, callback: Function) => { + return callback(null, connection); + } } }); diff --git a/knex/knex.d.ts b/knex/knex.d.ts index 82c26cfec..d2afc4aa8 100644 --- a/knex/knex.d.ts +++ b/knex/knex.d.ts @@ -135,6 +135,8 @@ declare module "knex" { transacting(trx: Transaction): QueryBuilder; connection(connection: any): QueryBuilder; + + clone(): QueryBuilder; } interface As { @@ -394,6 +396,7 @@ declare module "knex" { } interface Config { + debug?: boolean; client?: string; dialect?: string; connection: string|ConnectionConfig| @@ -427,7 +430,9 @@ declare module "knex" { interface PoolConfig { name?: string; create?: Function; + afterCreate?: Function; destroy?: Function; + beforeDestroy?: Function; min?: number; max?: number; refreshIdle?: boolean; diff --git a/ko.plus/ko.plus-tests.ts b/ko.plus/ko.plus-tests.ts index 7dd1053b2..bff291d83 100644 --- a/ko.plus/ko.plus-tests.ts +++ b/ko.plus/ko.plus-tests.ts @@ -11,6 +11,9 @@ Version 1.1 - added test for makeEditable + Version 1.2 - amended callback on commmand.fail() method - accepts response, + status and message values + Note: Typescript version 1.4 or higher is required for union types and type declarations */ @@ -29,8 +32,13 @@ function CommandTests() { .done((data: any) => { alert("success"); }) - .fail((error: string) => { - alert(error); + .fail((response) => { + // dummy + return false; + }) + .fail((response, status, message) => { + // fail has response, error and text + alert(status + message); }); // initialize command with options (action only) diff --git a/ko.plus/ko.plus.d.ts b/ko.plus/ko.plus.d.ts index dacf6121f..4c9299aee 100644 --- a/ko.plus/ko.plus.d.ts +++ b/ko.plus/ko.plus.d.ts @@ -1,8 +1,9 @@ -// Type definitions for ko.plus v0.0.21 +// Type definitions for ko.plus v0.0.24 // Project: https://github.com/stevegreatrex/ko.plus // Definitions by: Howard Richards // Definitions: https://github.com/borisyankov/DefinitelyTyped +/// /// /** @@ -16,6 +17,9 @@ * * Version 1.1 - fixed bug - makeEditable is now a function on .editable * also refactored how the Editable classes inherit to simplify + * + * Version 1.2 - amended callback on commmand.fail() method - accepts response, + * status and message values */ // @@ -87,7 +91,7 @@ declare module KoPlus { // done: (callback: (data: any) => void) => Command; - fail: (callback: (error: string) => void) => Command; + fail: (callback: (response: any, status?: string, statusText?:string) => void) => Command; always: (callback: Function) => Command; diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 974d0b966..c083edd4c 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -104,46 +104,43 @@ result = <(key: string) => any>testMapCache.get; result = <(key: string) => boolean>testMapCache.has; result = <(key: string, value: any) => _.Dictionary>testMapCache.set; -/************* - * Chaining * - *************/ -result = <_.LoDashWrapper>_('test'); -result = <_.LoDashWrapper>_(1); -result = <_.LoDashWrapper>_(true); -result = <_.LoDashArrayWrapper>_(['test1', 'test2']); -// Appears to be a change in the compiler, if the type explicity implements the object indexer. -// Looking at: https://typescript.codeplex.com/wikipage?title=Known%20breaking%20changes%20between%200.8%20and%200.9&referringTitle=Documentation -// "The ‘noimplicitany’ option now warns on the use of the hidden default indexer" -result = <_.LoDashObjectWrapper<_.Dictionary>>_(<{ [index: string]: string; }>{ 'key1': 'test1', 'key2': 'test2' }); +// _ +module TestWrapper { + { + let result: _.LoDashImplicitWrapper; + result = _(''); + } -result = <_.LoDashWrapper>_.chain('test'); -result = <_.LoDashWrapper>_('test').chain(); -result = <_.LoDashWrapper>_.chain(1); -result = <_.LoDashWrapper>_(1).chain(); -result = <_.LoDashWrapper>_.chain(true); -result = <_.LoDashWrapper>_(true).chain(); -result = <_.LoDashArrayWrapper>_.chain(['test1', 'test2']); -result = <_.LoDashArrayWrapper>_(['test1', 'test2']).chain(); -result = <_.LoDashObjectWrapper<_.Dictionary>>_.chain(<{ [index: string]: string; }>{ 'key1': 'test1', 'key2': 'test2' }); -result = <_.LoDashObjectWrapper<_.Dictionary>>_(<{ [index: string]: string; }>{ 'key1': 'test1', 'key2': 'test2' }).chain(); + { + let result: _.LoDashImplicitWrapper; + result = _(42); + } + + { + let result: _.LoDashImplicitWrapper; + result = _(true); + } + + { + let result: _.LoDashImplicitArrayWrapper; + result = _(['']); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: string}>; + result = _<{a: string}>({a: ''}); + } +} //Wrapped array shortcut methods -result = <_.LoDashArrayWrapper>_([1, 2, 3, 4]).concat(5, 6); -result = <_.LoDashArrayWrapper>_([1, 2, 3, 4]).concat([5, 6]); result = _([1, 2, 3, 4]).join(','); result = _([1, 2, 3, 4]).pop(); -result = <_.LoDashArrayWrapper>_([1, 2, 3, 4]).push(5, 6, 7); -result = <_.LoDashArrayWrapper>_([1, 2, 3, 4]).reverse(); +result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).push(5, 6, 7); result = _([1, 2, 3, 4]).shift(); -result = <_.LoDashArrayWrapper>_([1, 2, 3, 4]).sort((a, b) => 1); -result = <_.LoDashArrayWrapper>_([1, 2, 3, 4]).splice(1); -result = <_.LoDashArrayWrapper>_([1, 2, 3, 4]).splice(1, 2, 5, 6); -result = <_.LoDashArrayWrapper>_([1, 2, 3, 4]).unshift(5, 6); - -result = _.tap([1, 2, 3, 4], function (array) { console.log(array); }); -result = <_.LoDashWrapper>_('test').tap(function (value) { console.log(value); }); -result = <_.LoDashArrayWrapper>_([1, 2, 3, 4]).tap(function (array) { console.log(array); }); -result = <_.LoDashObjectWrapper<_.Dictionary>>_(<{ [index: string]: string; }>{ 'key1': 'test1', 'key2': 'test2' }).tap(function (array) { console.log(array); }); +result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).sort((a, b) => 1); +result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).splice(1); +result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).splice(1, 2, 5, 6); +result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).unshift(5, 6); result = _('test').toString(); result = _([1, 2, 3]).toString(); @@ -412,10 +409,10 @@ result = >_.flatten([1, [2], [[3]]], true); result = >_.flatten([1, [2], [3, [[4]]]], true); result = >_.flatten([1, [2], [3, [[false]]]], true); -result = <_.LoDashArrayWrapper>_([[1, 2], [3, 4], 5, 6]).flatten(); -result = <_.LoDashArrayWrapper>>>_([1, [2], [3, [[4]]]]).flatten(); +result = <_.LoDashImplicitArrayWrapper>_([[1, 2], [3, 4], 5, 6]).flatten(); +result = <_.LoDashImplicitArrayWrapper>>>_([1, [2], [3, [[4]]]]).flatten(); -result = <_.LoDashArrayWrapper>_([1, [2], [3, [[4]]]]).flatten(true); +result = <_.LoDashImplicitArrayWrapper>_([1, [2], [3, [[4]]]]).flatten(true); // _.flattenDeep module TestFlattenDeep { @@ -1053,76 +1050,417 @@ result = _([1, 2]).zipWith([1, 2], [1, 2], [1, 2], [1, 2], [1, * Chain * *********/ +// _.chain +module TestChain { + { + let result: _.LoDashExplicitWrapper; + + result = _.chain(''); + result = _('').chain(); + + result = _.chain('').chain(); + result = _('').chain().chain(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _.chain(42); + result = _(42).chain(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _.chain(true); + result = _(true).chain(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _.chain(['']); + result = _(['']).chain(); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: string}>; + + result = _.chain<{a: string}>({a: ''}); + result = _<{a: string}>({a: ''}).chain(); + } +} + +// _.tap +module TestTap { + { + let interceptor: (value: string) => void; + let result: string; + + _.tap('', interceptor); + _.tap('', interceptor, any); + } + + { + let interceptor: (value: string[]) => void; + let result: _.LoDashImplicitArrayWrapper; + + _.tap([''], interceptor); + _.tap([''], interceptor, any); + } + + { + let interceptor: (value: {a: string}) => void; + let result: _.LoDashImplicitObjectWrapper<{a: string}>; + + _.tap({a: ''}, interceptor); + _.tap({a: ''}, interceptor, any); + } + + { + let interceptor: (value: string) => void; + let result: _.LoDashImplicitWrapper; + + _.chain('').tap(interceptor, any); + _.chain('').tap(interceptor, any); + + _('').tap(interceptor); + _('').tap(interceptor, any); + } + + { + let interceptor: (value: string[]) => void; + let result: _.LoDashImplicitArrayWrapper; + + _.chain(['']).tap(interceptor); + _.chain(['']).tap(interceptor, any); + + _(['']).tap(interceptor); + _(['']).tap(interceptor, any); + } + + { + let interceptor: (value: {a: string}) => void; + let result: _.LoDashImplicitObjectWrapper<{a: string}>; + + _.chain({a: ''}).tap(interceptor); + _.chain({a: ''}).tap(interceptor, any); + + _({a: ''}).tap(interceptor); + _({a: ''}).tap(interceptor, any); + } + + { + let interceptor: (value: string) => void; + let result: _.LoDashExplicitWrapper; + + _.chain('').tap(interceptor, any); + _.chain('').tap(interceptor, any); + + _('').chain().tap(interceptor); + _('').chain().tap(interceptor, any); + } + + { + let interceptor: (value: string[]) => void; + let result: _.LoDashExplicitArrayWrapper; + + _.chain(['']).tap(interceptor); + _.chain(['']).tap(interceptor, any); + + _(['']).chain().tap(interceptor); + _(['']).chain().tap(interceptor, any); + } + + { + let interceptor: (value: {a: string}) => void; + let result: _.LoDashExplicitObjectWrapper<{a: string}>; + + _.chain({a: ''}).tap(interceptor); + _.chain({a: ''}).tap(interceptor, any); + + _({a: ''}).chain().tap(interceptor); + _({a: ''}).chain().tap(interceptor, any); + } +} + // _.thru -{ - let result: number; - result = _.thru(1, (value: number) => value); - result = _.thru(1, (value: number) => value, any); -} -{ - let result: _.LoDashWrapper; - result = _(1).thru((value: number) => value); - result = _(1).thru((value: number) => value, any); -} -{ - let result: _.LoDashWrapper; - result = _('').thru((value: string) => value); - result = _('').thru((value: string) => value, any); -} -{ - let result: _.LoDashWrapper; - result = _(true).thru((value: boolean) => value); - result = _(true).thru((value: boolean) => value, any); -} -{ - let result: _.LoDashObjectWrapper; - result = _({}).thru((value: Object) => value); - result = _({}).thru((value: Object) => value, any); -} -{ - let result: _.LoDashArrayWrapper; - result = _([1, 2, 3]).thru((value: number[]) => value); - result = _([1, 2, 3]).thru((value: number[]) => value, any); +module TestThru { + interface Interceptor { + (value: T): T; + } + + { + let interceptor: Interceptor; + let result: number; + + result = _.thru(1, interceptor); + result = _.thru(1, interceptor, any); + } + + { + let interceptor: Interceptor; + let result: _.LoDashImplicitWrapper; + + result = _(1).thru(interceptor); + result = _(1).thru(interceptor, any); + } + + { + let interceptor: Interceptor; + let result: _.LoDashImplicitWrapper; + + result = _('').thru(interceptor); + result = _('').thru(interceptor, any); + } + + { + let interceptor: Interceptor; + let result: _.LoDashImplicitWrapper; + + result = _(true).thru(interceptor); + result = _(true).thru(interceptor, any); + } + + { + let interceptor: Interceptor<{a: string}>; + let result: _.LoDashImplicitObjectWrapper<{a: string}>; + + result = _({a: ''}).thru<{a: string}>(interceptor); + result = _({a: ''}).thru<{a: string}>(interceptor, any); + } + + { + let interceptor: Interceptor; + let result: _.LoDashImplicitArrayWrapper; + + result = _([1, 2, 3]).thru(interceptor); + result = _([1, 2, 3]).thru(interceptor, any); + } + + { + let interceptor: Interceptor; + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().thru(interceptor); + result = _(1).chain().thru(interceptor, any); + } + + { + let interceptor: Interceptor; + let result: _.LoDashExplicitWrapper; + + result = _('').chain().thru(interceptor); + result = _('').chain().thru(interceptor, any); + } + + { + let interceptor: Interceptor; + let result: _.LoDashExplicitWrapper; + + result = _(true).chain().thru(interceptor); + result = _(true).chain().thru(interceptor, any); + } + + { + let interceptor: Interceptor<{a: string}>; + let result: _.LoDashExplicitObjectWrapper<{a: string}>; + + result = _({a: ''}).chain().thru<{a: string}>(interceptor); + result = _({a: ''}).chain().thru<{a: string}>(interceptor, any); + } + + { + let interceptor: Interceptor; + let result: _.LoDashExplicitArrayWrapper; + + result = _([1, 2, 3]).chain().thru(interceptor); + result = _([1, 2, 3]).chain().thru(interceptor, any); + } } // _.prototype.commit -{ - let result: _.LoDashWrapper; - result = _(42).commit(); +module TestCommit { + { + let result: _.LoDashImplicitWrapper; + result = _(42).commit(); + } + + { + let result: _.LoDashImplicitArrayWrapper; + result = _([]).commit(); + } + + { + let result: _.LoDashImplicitObjectWrapper; + result = _({}).commit(); + } + + { + let result: _.LoDashExplicitWrapper; + result = _(42).chain().commit(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + result = _([]).chain().commit(); + } + + { + let result: _.LoDashExplicitObjectWrapper; + result = _({}).chain().commit(); + } } -{ - let result: _.LoDashArrayWrapper; - result = _([]).commit(); -} -{ - let result: _.LoDashObjectWrapper; - result = _({}).commit(); + +// _.prototype.concat +module TestConcat { + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(1).concat(2); + result = _(1).concat(2, 3); + result = _(1).concat(2, 3, 4); + + result = _(1).concat(2); + result = _(1).concat(2, 3); + result = _(1).concat(2, 3, 4); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(['']).concat(['']); + result = _(['']).concat([''], ['']); + result = _(['']).concat([''], [''], ['']); + + result = _(['']).concat(['']); + result = _(['']).concat([''], ['']); + result = _(['']).concat([''], [''], ['']); + } + + { + let result: _.LoDashImplicitArrayWrapper<{a: string}>; + + result = _({a: ''}).concat<{a: string}>({a: ''}); + result = _({a: ''}).concat<{a: string}>({a: ''}, {a: ''}); + result = _({a: ''}).concat<{a: string}>({a: ''}, {a: ''}, {a: ''}); + + result = _({a: ''}).concat({a: ''}); + result = _({a: ''}).concat({a: ''}, {a: ''}); + result = _({a: ''}).concat({a: ''}, {a: ''}, {a: ''}); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(1).chain().concat(2); + result = _(1).chain().concat(2, 3); + result = _(1).chain().concat(2, 3, 4); + + result = _(1).chain().concat(2); + result = _(1).chain().concat(2, 3); + result = _(1).chain().concat(2, 3, 4); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(['']).chain().concat(['']); + result = _(['']).chain().concat([''], ['']); + result = _(['']).chain().concat([''], [''], ['']); + + result = _(['']).chain().concat(['']); + result = _(['']).chain().concat([''], ['']); + result = _(['']).chain().concat([''], [''], ['']); + } + + { + let result: _.LoDashExplicitArrayWrapper<{a: string}>; + + result = _({a: ''}).chain().concat<{a: string}>({a: ''}); + result = _({a: ''}).chain().concat<{a: string}>({a: ''}, {a: ''}); + result = _({a: ''}).chain().concat<{a: string}>({a: ''}, {a: ''}, {a: ''}); + + result = _({a: ''}).chain().concat({a: ''}); + result = _({a: ''}).chain().concat({a: ''}, {a: ''}); + result = _({a: ''}).chain().concat({a: ''}, {a: ''}, {a: ''}); + } } // _.prototype.plant -{ - let result: _.LoDashWrapper; - result = _(any).plant(42); +module TestPlant { + { + let result: _.LoDashImplicitWrapper; + result = _(any).plant(42); + } + + { + let result: _.LoDashImplicitStringWrapper; + result = _(any).plant(''); + } + + { + let result: _.LoDashImplicitWrapper; + result = _(any).plant(true); + } + + { + let result: _.LoDashImplicitNumberArrayWrapper; + result = _(any).plant([42]); + } + + { + let result: _.LoDashImplicitArrayWrapper; + result = _(any).plant([]); + } + + { + let result: _.LoDashImplicitObjectWrapper<{}>; + result = _(any).plant<{}>({}); + } + + { + let result: _.LoDashExplicitWrapper; + result = _(any).chain().plant(42); + } + + { + let result: _.LoDashExplicitStringWrapper; + result = _(any).chain().plant(''); + } + + { + let result: _.LoDashExplicitWrapper; + result = _(any).chain().plant(true); + } + + { + let result: _.LoDashExplicitNumberArrayWrapper; + result = _(any).chain().plant([42]); + } + + { + let result: _.LoDashExplicitArrayWrapper; + result = _(any).chain().plant([]); + } + + { + let result: _.LoDashExplicitObjectWrapper<{}>; + result = _(any).chain().plant<{}>({}); + } } -{ - let result: _.LoDashStringWrapper; - result = _(any).plant(''); -} -{ - let result: _.LoDashWrapper; - result = _(any).plant(true); -} -{ - let result: _.LoDashNumberArrayWrapper; - result = _(any).plant([42]); -} -{ - let result: _.LoDashArrayWrapper; - result = _(any).plant([]); -} -{ - let result: _.LoDashObjectWrapper<{}>; - result = _(any).plant<{}>({}); + +// _.prototype.reverse +module TestReverse { + { + let result: _.LoDashImplicitArrayWrapper; + result: _([42]).reverse(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + result: _([42]).chain().reverse(); + } } /************** @@ -1318,9 +1656,9 @@ result = <_.Dictionary>_.countBy([4.3, 6.1, 6.4], function (num) { retur result = <_.Dictionary>_.countBy([4.3, 6.1, 6.4], function (num) { return this.floor(num); }, Math); result = <_.Dictionary>_.countBy(['one', 'two', 'three'], 'length'); -result = <_.LoDashObjectWrapper<_.Dictionary>>_([4.3, 6.1, 6.4]).countBy(function (num) { return Math.floor(num); }); -result = <_.LoDashObjectWrapper<_.Dictionary>>_([4.3, 6.1, 6.4]).countBy(function (num) { return this.floor(num); }, Math); -result = <_.LoDashObjectWrapper<_.Dictionary>>_(['one', 'two', 'three']).countBy('length'); +result = <_.LoDashImplicitObjectWrapper<_.Dictionary>>_([4.3, 6.1, 6.4]).countBy(function (num) { return Math.floor(num); }); +result = <_.LoDashImplicitObjectWrapper<_.Dictionary>>_([4.3, 6.1, 6.4]).countBy(function (num) { return this.floor(num); }, Math); +result = <_.LoDashImplicitObjectWrapper<_.Dictionary>>_(['one', 'two', 'three']).countBy('length'); // _.detect module TestDetect { @@ -1509,11 +1847,11 @@ result = _.each([1, 2, 3], function (num) { console.log(num); }); result = <_.Dictionary>_.each({ 'one': 1, 'two': 2, 'three': 3 }, function (num) { console.log(num); }); result = _.each({ name: 'apple', type: 'fruit' }, function (value, key) { console.log(value, key) }); -result = <_.LoDashArrayWrapper>_([1, 2, 3]).forEach(function (num) { console.log(num); }); -result = <_.LoDashObjectWrapper<_.Dictionary>>_(<{ [index: string]: number; }>{ 'one': 1, 'two': 2, 'three': 3 }).forEach(function (num) { console.log(num); }); +result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3]).forEach(function (num) { console.log(num); }); +result = <_.LoDashImplicitObjectWrapper<_.Dictionary>>_(<{ [index: string]: number; }>{ 'one': 1, 'two': 2, 'three': 3 }).forEach(function (num) { console.log(num); }); -result = <_.LoDashArrayWrapper>_([1, 2, 3]).each(function (num) { console.log(num); }); -result = <_.LoDashObjectWrapper<_.Dictionary>>_(<{ [index: string]: number; }>{ 'one': 1, 'two': 2, 'three': 3 }).each(function (num) { console.log(num); }); +result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3]).each(function (num) { console.log(num); }); +result = <_.LoDashImplicitObjectWrapper<_.Dictionary>>_(<{ [index: string]: number; }>{ 'one': 1, 'two': 2, 'three': 3 }).each(function (num) { console.log(num); }); result = _.forEachRight([1, 2, 3], function (num) { console.log(num); }); result = <_.Dictionary>_.forEachRight({ 'one': 1, 'two': 2, 'three': 3 }, function (num) { console.log(num); }); @@ -1521,11 +1859,11 @@ result = <_.Dictionary>_.forEachRight({ 'one': 1, 'two': 2, 'three': 3 } result = _.eachRight([1, 2, 3], function (num) { console.log(num); }); result = <_.Dictionary>_.eachRight({ 'one': 1, 'two': 2, 'three': 3 }, function (num) { console.log(num); }); -result = <_.LoDashArrayWrapper>_([1, 2, 3]).forEachRight(function (num) { console.log(num); }); -result = <_.LoDashObjectWrapper<_.Dictionary>>_(<{ [index: string]: number; }>{ 'one': 1, 'two': 2, 'three': 3 }).forEachRight(function (num) { console.log(num); }); +result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3]).forEachRight(function (num) { console.log(num); }); +result = <_.LoDashImplicitObjectWrapper<_.Dictionary>>_(<{ [index: string]: number; }>{ 'one': 1, 'two': 2, 'three': 3 }).forEachRight(function (num) { console.log(num); }); -result = <_.LoDashArrayWrapper>_([1, 2, 3]).eachRight(function (num) { console.log(num); }); -result = <_.LoDashObjectWrapper<_.Dictionary>>_(<{ [index: string]: number; }>{ 'one': 1, 'two': 2, 'three': 3 }).eachRight(function (num) { console.log(num); }); +result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3]).eachRight(function (num) { console.log(num); }); +result = <_.LoDashImplicitObjectWrapper<_.Dictionary>>_(<{ [index: string]: number; }>{ 'one': 1, 'two': 2, 'three': 3 }).eachRight(function (num) { console.log(num); }); result = <_.Dictionary>_.groupBy([4.2, 6.1, 6.4], function (num) { return Math.floor(num); }); result = <_.Dictionary>_.groupBy([4.2, 6.1, 6.4], function (num) { return this.floor(num); }, Math); @@ -1764,14 +2102,14 @@ result = _(foodsCombined).reject({ 'type': 'fruit' }).value(); result = _.sample([1, 2, 3, 4]); result = _.sample([1, 2, 3, 4], 2); -result = <_.LoDashWrapper>_([1, 2, 3, 4]).sample(); -result = <_.LoDashArrayWrapper>_([1, 2, 3, 4]).sample(2); +result = <_.LoDashImplicitWrapper>_([1, 2, 3, 4]).sample(); +result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).sample(2); result = _([1, 2, 3, 4]).sample().value(); result = _([1, 2, 3, 4]).sample(2).value(); result = _.shuffle([1, 2, 3, 4, 5, 6]); -result = <_.LoDashArrayWrapper>_([1, 2, 3]).shuffle(); -result = <_.LoDashArrayWrapper<_.Dictionary>>_(<{ [index: string]: string; }>{ 'key1': 'test1', 'key2': 'test2' }).shuffle(); +result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3]).shuffle(); +result = <_.LoDashImplicitArrayWrapper<_.Dictionary>>_(<{ [index: string]: string; }>{ 'key1': 'test1', 'key2': 'test2' }).shuffle(); result = _.size([1, 2]); result = _([1, 2]).size(); @@ -1860,7 +2198,24 @@ result = _(stoogesCombined).where({ 'quotes': ['Poifect!'] } * Date * ********/ -result = _.now(); +module TestNow { + { + let result: number; + + result = _.now(); + result = _(42).now(); + result = _([]).now(); + result = _({}).now(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(42).chain().now(); + result = _([]).chain().now(); + result = _({}).chain().now(); + } +} /************* * Functions * @@ -1963,8 +2318,8 @@ result = _(testComposeSquareFn).compose<(n: number, m: number) => number var createCallbackObj: { [index: string]: string; } = { name: 'Joe' }; result = <() => any>_.createCallback('name'); result = <() => boolean>_.createCallback(createCallbackObj); -result = <_.LoDashObjectWrapper<() => any>>_('name').createCallback(); -result = <_.LoDashObjectWrapper<() => boolean>>_(createCallbackObj).createCallback(); +result = <_.LoDashImplicitObjectWrapper<() => any>>_('name').createCallback(); +result = <_.LoDashImplicitObjectWrapper<() => boolean>>_(createCallbackObj).createCallback(); // _.curry var testCurryFn = (a: number, b: number, c: number) => [a, b, c]; @@ -2028,14 +2383,14 @@ source.addEventListener('message', _.debounce(function () { }, 250, { 'maxWait': 1000 }), false); -result = <_.LoDashObjectWrapper>_(function () { }).debounce(150); +result = <_.LoDashImplicitObjectWrapper>_(function () { }).debounce(150); -jQuery('#postbox').on('click', <_.LoDashObjectWrapper>_(function () { }).debounce(300, { +jQuery('#postbox').on('click', <_.LoDashImplicitObjectWrapper>_(function () { }).debounce(300, { 'leading': true, 'trailing': false })); -source.addEventListener('message', <_.LoDashObjectWrapper>_(function () { }).debounce(250, { +source.addEventListener('message', <_.LoDashImplicitObjectWrapper>_(function () { }).debounce(250, { 'maxWait': 1000 }), false); @@ -2043,11 +2398,11 @@ var returnedDebounce = _.throttle(function (a: any) { return a * 5; }, 5); returnedThrottled(4); result = _.defer(function () { console.log('deferred'); }); -result = <_.LoDashWrapper>_(function () { console.log('deferred'); }).defer(); +result = <_.LoDashImplicitWrapper>_(function () { console.log('deferred'); }).defer(); var log = _.bind(console.log, console); result = _.delay(log, 1000, 'logged later'); -result = <_.LoDashWrapper>_(log).delay(1000, 'logged later'); +result = <_.LoDashImplicitWrapper>_(log).delay(1000, 'logged later'); // _.flow var testFlowSquareFn = (n: number) => n * n; @@ -2644,8 +2999,8 @@ result = _.assign({ 'name': 'moe' }, { 'age': 40 }, function (a, b) { return typeof a == 'undefined' ? b : a; }); -result = <_.LoDashObjectWrapper>_({ 'name': 'moe' }).assign({ 'age': 40 }); -result = <_.LoDashObjectWrapper>_({ 'name': 'moe' }).assign({ 'age': 40 }, function (a, b) { +result = <_.LoDashImplicitObjectWrapper>_({ 'name': 'moe' }).assign({ 'age': 40 }); +result = <_.LoDashImplicitObjectWrapper>_({ 'name': 'moe' }).assign({ 'age': 40 }, function (a, b) { return typeof a == 'undefined' ? b : a; }); @@ -2654,8 +3009,8 @@ result = _.extend({ 'name': 'moe' }, { 'age': 40 }, function (a, b) { return typeof a == 'undefined' ? b : a; }); -result = <_.LoDashObjectWrapper>_({ 'name': 'moe' }).extend({ 'age': 40 }); -result = <_.LoDashObjectWrapper>_({ 'name': 'moe' }).extend({ 'age': 40 }, function (a, b) { +result = <_.LoDashImplicitObjectWrapper>_({ 'name': 'moe' }).extend({ 'age': 40 }); +result = <_.LoDashImplicitObjectWrapper>_({ 'name': 'moe' }).extend({ 'age': 40 }, function (a, b) { return typeof a == 'undefined' ? b : a; }); @@ -2684,7 +3039,7 @@ interface Food { } var foodDefaults = { 'name': 'apple' }; result = _.defaults(foodDefaults, { 'name': 'banana', 'type': 'fruit' }); -result = <_.LoDashObjectWrapper>_(foodDefaults).defaults({ 'name': 'banana', 'type': 'fruit' }); +result = <_.LoDashImplicitObjectWrapper>_(foodDefaults).defaults({ 'name': 'banana', 'type': 'fruit' }); //_.defaultsDeep interface DefaultsDeepResult { @@ -2784,7 +3139,7 @@ result = _.forIn(new Dog('Dagny'), function (value, key) { console.log(key); }); -result = <_.LoDashObjectWrapper>_(new Dog('Dagny')).forIn(function (value, key) { +result = <_.LoDashImplicitObjectWrapper>_(new Dog('Dagny')).forIn(function (value, key) { console.log(key); }); @@ -2792,7 +3147,7 @@ result = _.forInRight(new Dog('Dagny'), function (value, key) { console.log(key); }); -result = <_.LoDashObjectWrapper>_(new Dog('Dagny')).forInRight(function (value, key) { +result = <_.LoDashImplicitObjectWrapper>_(new Dog('Dagny')).forInRight(function (value, key) { console.log(key); }); @@ -2806,7 +3161,7 @@ result = _.forOwn({ '0': 'zero', '1': 'one', 'one': '2' }, fun console.log(key); }); -result = <_.LoDashObjectWrapper>_({ '0': 'zero', '1': 'one', 'length': 2 }).forOwn(function (num, key) { +result = <_.LoDashImplicitObjectWrapper>_({ '0': 'zero', '1': 'one', 'length': 2 }).forOwn(function (num, key) { console.log(key); }); @@ -2814,15 +3169,15 @@ result = _.forOwnRight({ '0': 'zero', '1': 'one', 'length': 2 }, function ( console.log(key); }); -result = <_.LoDashObjectWrapper>_({ '0': 'zero', '1': 'one', 'length': 2 }).forOwnRight(function (num, key) { +result = <_.LoDashImplicitObjectWrapper>_({ '0': 'zero', '1': 'one', 'length': 2 }).forOwnRight(function (num, key) { console.log(key); }); result = _.functions(_); result = _.methods(_); -result = <_.LoDashArrayWrapper>_(_).functions(); -result = <_.LoDashArrayWrapper>_(_).methods(); +result = <_.LoDashImplicitArrayWrapper>_(_).functions(); +result = <_.LoDashImplicitArrayWrapper>_(_).methods(); // _.get result = _.get({ 'a': [{ 'b': { 'c': 3 } }] }, 'a[0].b.c'); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index c07cfd0e3..881124328 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -38,13 +38,13 @@ declare module _ { * * Explicit chaining can be enabled by using the _.chain method. **/ - (value: number): LoDashWrapper; - (value: string): LoDashStringWrapper; - (value: boolean): LoDashWrapper; - (value: Array): LoDashNumberArrayWrapper; - (value: Array): LoDashArrayWrapper; - (value: T): LoDashObjectWrapper; - (value: any): LoDashWrapper; + (value: number): LoDashImplicitWrapper; + (value: string): LoDashImplicitStringWrapper; + (value: boolean): LoDashImplicitWrapper; + (value: Array): LoDashImplicitNumberArrayWrapper; + (value: Array): LoDashImplicitArrayWrapper; + (value: T): LoDashImplicitObjectWrapper; + (value: any): LoDashImplicitWrapper; /** * The semantic version number. @@ -211,101 +211,40 @@ declare module _ { unindexedChars: boolean; } - interface LoDashWrapperBase { - /** - * Produces the toString result of the wrapped value. - * @return Returns the string result. - **/ - toString(): string; + interface LoDashWrapperBase { } - /** - * Executes the chained sequence to extract the unwrapped value. - * @return Returns the resolved unwrapped value. - **/ - value(): T; + interface LoDashImplicitWrapperBase extends LoDashWrapperBase { } - /** - * @see _.value - **/ - run(): T; + interface LoDashExplicitWrapperBase extends LoDashWrapperBase { } - /** - * @see _.value - **/ - toJSON(): T; + interface LoDashImplicitWrapper extends LoDashImplicitWrapperBase> { } - /** - * @see _.value - **/ - valueOf(): T; - } + interface LoDashExplicitWrapper extends LoDashExplicitWrapperBase> { } - interface LoDashWrapper extends LoDashWrapperBase> { } + interface LoDashImplicitStringWrapper extends LoDashImplicitWrapper { } - interface LoDashStringWrapper extends LoDashWrapper { } + interface LoDashExplicitStringWrapper extends LoDashExplicitWrapper { } - interface LoDashObjectWrapper extends LoDashWrapperBase> { } + interface LoDashImplicitObjectWrapper extends LoDashImplicitWrapperBase> { } - interface LoDashArrayWrapper extends LoDashWrapperBase> { - concat(...items: Array>): LoDashArrayWrapper; + interface LoDashExplicitObjectWrapper extends LoDashExplicitWrapperBase> { } + + interface LoDashImplicitArrayWrapper extends LoDashImplicitWrapperBase> { join(seperator?: string): string; pop(): T; - push(...items: T[]): LoDashArrayWrapper; - reverse(): LoDashArrayWrapper; + push(...items: T[]): LoDashImplicitArrayWrapper; shift(): T; - sort(compareFn?: (a: T, b: T) => number): LoDashArrayWrapper; - splice(start: number): LoDashArrayWrapper; - splice(start: number, deleteCount: number, ...items: any[]): LoDashArrayWrapper; - unshift(...items: T[]): LoDashArrayWrapper; + sort(compareFn?: (a: T, b: T) => number): LoDashImplicitArrayWrapper; + splice(start: number): LoDashImplicitArrayWrapper; + splice(start: number, deleteCount: number, ...items: any[]): LoDashImplicitArrayWrapper; + unshift(...items: T[]): LoDashImplicitArrayWrapper; } - interface LoDashNumberArrayWrapper extends LoDashArrayWrapper { } + interface LoDashExplicitArrayWrapper extends LoDashExplicitWrapperBase> { } - //_.chain - interface LoDashStatic { - /** - * Creates a lodash object that wraps the given value with explicit method chaining enabled. - * @param value The value to wrap. - * @return The wrapper object. - **/ - chain(value: number): LoDashWrapper; - chain(value: string): LoDashWrapper; - chain(value: boolean): LoDashWrapper; - chain(value: Array): LoDashArrayWrapper; - chain(value: T): LoDashObjectWrapper; - chain(value: any): LoDashWrapper; - } + interface LoDashImplicitNumberArrayWrapper extends LoDashImplicitArrayWrapper { } - interface LoDashWrapperBase { - /** - * Enables explicit method chaining on the wrapper object. - * @see _.chain - * @return The wrapper object. - **/ - chain(): TWrapper; - } - - //_.tap - interface LoDashStatic { - /** - * Invokes interceptor with the value as the first argument and then returns value. The - * purpose of this method is to "tap into" a method chain in order to perform operations on - * intermediate results within the chain. - * @param value The value to provide to interceptor - * @param interceptor The function to invoke. - * @return value - **/ - tap( - value: T, - interceptor: (value: T) => void): T; - } - - interface LoDashWrapperBase { - /** - * @see _.tap - **/ - tap(interceptor: (value: T) => void): TWrapper; - } + interface LoDashExplicitNumberArrayWrapper extends LoDashExplicitArrayWrapper { } /********* * Array * @@ -327,18 +266,18 @@ declare module _ { ): T[][]; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.chunk */ - chunk(size?: number): LoDashArrayWrapper; + chunk(size?: number): LoDashImplicitArrayWrapper; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.chunk */ - chunk(size?: number): LoDashArrayWrapper; + chunk(size?: number): LoDashImplicitArrayWrapper; } //_.compact @@ -353,18 +292,18 @@ declare module _ { compact(array?: List): T[]; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.compact */ - compact(): LoDashArrayWrapper; + compact(): LoDashImplicitArrayWrapper; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.compact */ - compact(): LoDashArrayWrapper; + compact(): LoDashImplicitArrayWrapper; } //_.difference @@ -383,18 +322,18 @@ declare module _ { ): T[]; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.difference */ - difference(...values: (T[]|List)[]): LoDashArrayWrapper; + difference(...values: (T[]|List)[]): LoDashImplicitArrayWrapper; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.difference */ - difference(...values: (TValue[]|List)[]): LoDashArrayWrapper; + difference(...values: (TValue[]|List)[]): LoDashImplicitArrayWrapper; } //_.drop @@ -409,18 +348,18 @@ declare module _ { drop(array: T[]|List, n?: number): T[]; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.drop */ - drop(n?: number): LoDashArrayWrapper; + drop(n?: number): LoDashImplicitArrayWrapper; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.drop */ - drop(n?: number): LoDashArrayWrapper; + drop(n?: number): LoDashImplicitArrayWrapper; } //_.dropRight @@ -438,18 +377,18 @@ declare module _ { ): T[]; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.dropRight */ - dropRight(n?: number): LoDashArrayWrapper; + dropRight(n?: number): LoDashImplicitArrayWrapper; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.dropRight */ - dropRight(n?: number): LoDashArrayWrapper; + dropRight(n?: number): LoDashImplicitArrayWrapper; } //_.dropRightWhile @@ -496,14 +435,14 @@ declare module _ { ): TValue[]; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.dropRightWhile */ dropRightWhile( predicate?: ListIterator, thisArg?: any - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; /** * @see _.dropRightWhile @@ -511,24 +450,24 @@ declare module _ { dropRightWhile( predicate?: string, thisArg?: any - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; /** * @see _.dropRightWhile */ dropRightWhile( predicate?: TWhere - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.dropRightWhile */ dropRightWhile( predicate?: ListIterator, thisArg?: any - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; /** * @see _.dropRightWhile @@ -536,14 +475,14 @@ declare module _ { dropRightWhile( predicate?: string, thisArg?: any - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; /** * @see _.dropRightWhile */ dropRightWhile( predicate?: TWhere - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; } //_.dropWhile @@ -590,14 +529,14 @@ declare module _ { ): TValue[]; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.dropWhile */ dropWhile( predicate?: ListIterator, thisArg?: any - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; /** * @see _.dropWhile @@ -605,24 +544,24 @@ declare module _ { dropWhile( predicate?: string, thisArg?: any - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; /** * @see _.dropWhile */ dropWhile( predicate?: TWhere - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.dropWhile */ dropWhile( predicate?: ListIterator, thisArg?: any - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; /** * @see _.dropWhile @@ -630,14 +569,14 @@ declare module _ { dropWhile( predicate?: string, thisArg?: any - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; /** * @see _.dropWhile */ dropWhile( predicate?: TWhere - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; } //_.findIndex @@ -684,7 +623,7 @@ declare module _ { ): number; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.findIndex */ @@ -709,7 +648,7 @@ declare module _ { ): number; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.findIndex */ @@ -777,7 +716,7 @@ declare module _ { ): number; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.findLastIndex */ @@ -802,7 +741,7 @@ declare module _ { ): number; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.findLastIndex */ @@ -840,14 +779,14 @@ declare module _ { first(array: List): T; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.first */ first(): T; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.first */ @@ -885,16 +824,16 @@ declare module _ { flatten(array: RecursiveList, isDeep: boolean): List | RecursiveList; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.flatten **/ - flatten(): LoDashArrayWrapper; + flatten(): LoDashImplicitArrayWrapper; /** * @see _.flatten **/ - flatten(isShallow: boolean): LoDashArrayWrapper; + flatten(isShallow: boolean): LoDashImplicitArrayWrapper; } //_.flattenDeep @@ -918,18 +857,18 @@ declare module _ { flattenDeep(array: RecursiveList): any[]; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.flattenDeep */ - flattenDeep(): LoDashArrayWrapper; + flattenDeep(): LoDashImplicitArrayWrapper; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.flattenDeep */ - flattenDeep(): LoDashArrayWrapper; + flattenDeep(): LoDashImplicitArrayWrapper; } //_.head @@ -940,14 +879,14 @@ declare module _ { head(array: List): T; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.first */ head(): T; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.first */ @@ -973,7 +912,7 @@ declare module _ { ): number; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.indexOf */ @@ -983,7 +922,7 @@ declare module _ { ): number; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.indexOf */ @@ -1004,18 +943,18 @@ declare module _ { initial(array: T[]|List): T[]; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.initial */ - initial(): LoDashArrayWrapper; + initial(): LoDashImplicitArrayWrapper; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.initial */ - initial(): LoDashArrayWrapper; + initial(): LoDashImplicitArrayWrapper; } //_.intersection @@ -1030,18 +969,18 @@ declare module _ { intersection(...arrays: (T[]|List)[]): T[]; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.intersection */ - intersection(...arrays: (TResult[]|List)[]): LoDashArrayWrapper; + intersection(...arrays: (TResult[]|List)[]): LoDashImplicitArrayWrapper; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.intersection */ - intersection(...arrays: (TResult[]|List)[]): LoDashArrayWrapper; + intersection(...arrays: (TResult[]|List)[]): LoDashImplicitArrayWrapper; } //_.last @@ -1055,14 +994,14 @@ declare module _ { last(array: List): T; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.last */ last(): T; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.last */ @@ -1086,7 +1025,7 @@ declare module _ { ): number; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.lastIndexOf */ @@ -1096,7 +1035,7 @@ declare module _ { ): number; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.lastIndexOf */ @@ -1133,50 +1072,50 @@ declare module _ { ): _.Dictionary; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.zipObject */ object( values?: List - ): _.LoDashObjectWrapper; + ): _.LoDashImplicitObjectWrapper; /** * @see _.zipObject */ object( values?: List - ): _.LoDashObjectWrapper; + ): _.LoDashImplicitObjectWrapper; /** * @see _.zipObject */ object( values?: List - ): _.LoDashObjectWrapper<_.Dictionary>; + ): _.LoDashImplicitObjectWrapper<_.Dictionary>; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.zipObject */ object( values?: List - ): _.LoDashObjectWrapper; + ): _.LoDashImplicitObjectWrapper; /** * @see _.zipObject */ object( values?: List - ): _.LoDashObjectWrapper; + ): _.LoDashImplicitObjectWrapper; /** * @see _.zipObject */ object( values?: List - ): _.LoDashObjectWrapper<_.Dictionary>; + ): _.LoDashImplicitObjectWrapper<_.Dictionary>; } //_.pull @@ -1204,18 +1143,18 @@ declare module _ { ): List; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.pull */ - pull(...values: T[]): LoDashArrayWrapper; + pull(...values: T[]): LoDashImplicitArrayWrapper; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.pull */ - pull(...values: TValue[]): LoDashObjectWrapper>; + pull(...values: TValue[]): LoDashImplicitObjectWrapper>; } //_.pullAt @@ -1236,18 +1175,18 @@ declare module _ { ): T[]; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.pullAt */ - pullAt(...indexes: (number|number[])[]): LoDashArrayWrapper; + pullAt(...indexes: (number|number[])[]): LoDashImplicitArrayWrapper; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.pullAt */ - pullAt(...indexes: (number|number[])[]): LoDashArrayWrapper; + pullAt(...indexes: (number|number[])[]): LoDashImplicitArrayWrapper; } //_.remove @@ -1296,14 +1235,14 @@ declare module _ { ): T[]; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.remove */ remove( predicate?: ListIterator, thisArg?: any - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; /** * @see _.remove @@ -1311,24 +1250,24 @@ declare module _ { remove( predicate?: string, thisArg?: any - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; /** * @see _.remove */ remove( predicate?: W - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.remove */ remove( predicate?: ListIterator, thisArg?: any - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; /** * @see _.remove @@ -1336,14 +1275,14 @@ declare module _ { remove( predicate?: string, thisArg?: any - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; /** * @see _.remove */ remove( predicate?: W - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; } //_.rest @@ -1359,18 +1298,18 @@ declare module _ { rest(array: List): T[]; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.rest */ - rest(): LoDashArrayWrapper; + rest(): LoDashImplicitArrayWrapper; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.rest */ - rest(): LoDashArrayWrapper; + rest(): LoDashImplicitArrayWrapper; } //_.slice @@ -1390,14 +1329,14 @@ declare module _ { ): T[]; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.slice */ slice( start?: number, end?: number - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; } //_.sortedIndex @@ -1478,18 +1417,18 @@ declare module _ { tail(array: List): T[]; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.rest */ - tail(): LoDashArrayWrapper; + tail(): LoDashImplicitArrayWrapper; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.rest */ - tail(): LoDashArrayWrapper; + tail(): LoDashImplicitArrayWrapper; } //_.take @@ -1507,18 +1446,18 @@ declare module _ { ): T[]; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.take */ - take(n?: number): LoDashArrayWrapper; + take(n?: number): LoDashImplicitArrayWrapper; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.take */ - take(n?: number): LoDashArrayWrapper; + take(n?: number): LoDashImplicitArrayWrapper; } //_.takeRight @@ -1536,18 +1475,18 @@ declare module _ { ): T[]; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.takeRight */ - takeRight(n?: number): LoDashArrayWrapper; + takeRight(n?: number): LoDashImplicitArrayWrapper; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.takeRight */ - takeRight(n?: number): LoDashArrayWrapper; + takeRight(n?: number): LoDashImplicitArrayWrapper; } //_.takeRightWhile @@ -1594,14 +1533,14 @@ declare module _ { ): TValue[]; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.takeRightWhile */ takeRightWhile( predicate?: ListIterator, thisArg?: any - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; /** * @see _.takeRightWhile @@ -1609,24 +1548,24 @@ declare module _ { takeRightWhile( predicate?: string, thisArg?: any - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; /** * @see _.takeRightWhile */ takeRightWhile( predicate?: TWhere - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.takeRightWhile */ takeRightWhile( predicate?: ListIterator, thisArg?: any - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; /** * @see _.takeRightWhile @@ -1634,14 +1573,14 @@ declare module _ { takeRightWhile( predicate?: string, thisArg?: any - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; /** * @see _.takeRightWhile */ takeRightWhile( predicate?: TWhere - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; } //_.takeWhile @@ -1688,14 +1627,14 @@ declare module _ { ): TValue[]; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.takeWhile */ takeWhile( predicate?: ListIterator, thisArg?: any - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; /** * @see _.takeWhile @@ -1703,24 +1642,24 @@ declare module _ { takeWhile( predicate?: string, thisArg?: any - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; /** * @see _.takeWhile */ takeWhile( predicate?: TWhere - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.takeWhile */ takeWhile( predicate?: ListIterator, thisArg?: any - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; /** * @see _.takeWhile @@ -1728,14 +1667,14 @@ declare module _ { takeWhile( predicate?: string, thisArg?: any - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; /** * @see _.takeWhile */ takeWhile( predicate?: TWhere - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; } //_.union @@ -1750,23 +1689,23 @@ declare module _ { union(...arrays: List[]): T[]; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.union */ - union(...arrays: List[]): LoDashArrayWrapper; + union(...arrays: List[]): LoDashImplicitArrayWrapper; /** * @see _.union */ - union(...arrays: List[]): LoDashArrayWrapper; + union(...arrays: List[]): LoDashImplicitArrayWrapper; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.union */ - union(...arrays: List[]): LoDashArrayWrapper; + union(...arrays: List[]): LoDashImplicitArrayWrapper; } //_.uniq @@ -2011,11 +1950,11 @@ declare module _ { whereValue?: W): T[]; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.uniq **/ - uniq(isSorted?: boolean): LoDashArrayWrapper; + uniq(isSorted?: boolean): LoDashImplicitArrayWrapper; /** * @see _.uniq @@ -2023,14 +1962,14 @@ declare module _ { uniq( isSorted: boolean, callback: ListIterator, - thisArg?: any): LoDashArrayWrapper; + thisArg?: any): LoDashImplicitArrayWrapper; /** * @see _.uniq **/ uniq( callback: ListIterator, - thisArg?: any): LoDashArrayWrapper; + thisArg?: any): LoDashImplicitArrayWrapper; /** * @see _.uniq @@ -2038,13 +1977,13 @@ declare module _ { **/ uniq( isSorted: boolean, - pluckValue: string): LoDashArrayWrapper; + pluckValue: string): LoDashImplicitArrayWrapper; /** * @see _.uniq * @param pluckValue _.pluck style callback **/ - uniq(pluckValue: string): LoDashArrayWrapper; + uniq(pluckValue: string): LoDashImplicitArrayWrapper; /** * @see _.uniq @@ -2052,19 +1991,19 @@ declare module _ { **/ uniq( isSorted: boolean, - whereValue: W): LoDashArrayWrapper; + whereValue: W): LoDashImplicitArrayWrapper; /** * @see _.uniq * @param whereValue _.where style callback **/ uniq( - whereValue: W): LoDashArrayWrapper; + whereValue: W): LoDashImplicitArrayWrapper; /** * @see _.uniq **/ - unique(isSorted?: boolean): LoDashArrayWrapper; + unique(isSorted?: boolean): LoDashImplicitArrayWrapper; /** * @see _.uniq @@ -2072,14 +2011,14 @@ declare module _ { unique( isSorted: boolean, callback: ListIterator, - thisArg?: any): LoDashArrayWrapper; + thisArg?: any): LoDashImplicitArrayWrapper; /** * @see _.uniq **/ unique( callback: ListIterator, - thisArg?: any): LoDashArrayWrapper; + thisArg?: any): LoDashImplicitArrayWrapper; /** * @see _.uniq @@ -2087,13 +2026,13 @@ declare module _ { **/ unique( isSorted: boolean, - pluckValue: string): LoDashArrayWrapper; + pluckValue: string): LoDashImplicitArrayWrapper; /** * @see _.uniq * @param pluckValue _.pluck style callback **/ - unique(pluckValue: string): LoDashArrayWrapper; + unique(pluckValue: string): LoDashImplicitArrayWrapper; /** * @see _.uniq @@ -2101,14 +2040,14 @@ declare module _ { **/ unique( isSorted: boolean, - whereValue: W): LoDashArrayWrapper; + whereValue: W): LoDashImplicitArrayWrapper; /** * @see _.uniq * @param whereValue _.where style callback **/ unique( - whereValue: W): LoDashArrayWrapper; + whereValue: W): LoDashImplicitArrayWrapper; } //_.unzipWith @@ -2130,24 +2069,24 @@ declare module _ { ): TResult[]; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.unzipWith */ unzipWith( iteratee?: MemoIterator, thisArg?: any - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.unzipWith */ unzipWith( iteratee?: MemoIterator, thisArg?: any - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; } //_.without @@ -2165,18 +2104,18 @@ declare module _ { ): T[]; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.without */ - without(...values: T[]): LoDashArrayWrapper; + without(...values: T[]): LoDashImplicitArrayWrapper; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.without */ - without(...values: TValue[]): LoDashArrayWrapper; + without(...values: TValue[]): LoDashImplicitArrayWrapper; } //_.xor @@ -2190,18 +2129,18 @@ declare module _ { xor(...arrays: List[]): T[]; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.xor */ - xor(...arrays: List[]): LoDashArrayWrapper; + xor(...arrays: List[]): LoDashImplicitArrayWrapper; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.xor */ - xor(...arrays: List[]): LoDashArrayWrapper; + xor(...arrays: List[]): LoDashImplicitArrayWrapper; } //_.zip @@ -2231,16 +2170,16 @@ declare module _ { unzip(...arrays: any[]): any[]; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.zip **/ - zip(...arrays: any[][]): _.LoDashArrayWrapper; + zip(...arrays: any[][]): _.LoDashImplicitArrayWrapper; /** * @see _.zip **/ - unzip(...arrays: any[]): _.LoDashArrayWrapper; + unzip(...arrays: any[]): _.LoDashImplicitArrayWrapper; } //_.zipObject @@ -2278,50 +2217,50 @@ declare module _ { ): _.Dictionary; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.zipObject */ zipObject( values?: List - ): _.LoDashObjectWrapper; + ): _.LoDashImplicitObjectWrapper; /** * @see _.zipObject */ zipObject( values?: List - ): _.LoDashObjectWrapper; + ): _.LoDashImplicitObjectWrapper; /** * @see _.zipObject */ zipObject( values?: List - ): _.LoDashObjectWrapper<_.Dictionary>; + ): _.LoDashImplicitObjectWrapper<_.Dictionary>; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.zipObject */ zipObject( values?: List - ): _.LoDashObjectWrapper; + ): _.LoDashImplicitObjectWrapper; /** * @see _.zipObject */ zipObject( values?: List - ): _.LoDashObjectWrapper; + ): _.LoDashImplicitObjectWrapper; /** * @see _.zipObject */ zipObject( values?: List - ): _.LoDashObjectWrapper<_.Dictionary>; + ): _.LoDashImplicitObjectWrapper<_.Dictionary>; } //_.zipWith @@ -2338,21 +2277,105 @@ declare module _ { zipWith(...args: any[]): TResult[]; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.zipWith */ - zipWith(...args: any[]): LoDashArrayWrapper; + zipWith(...args: any[]): LoDashImplicitArrayWrapper; } /********* * Chain * *********/ + //_.chain + interface LoDashStatic { + /** + * Creates a lodash object that wraps value with explicit method chaining enabled. + * + * @param value The value to wrap. + * @return Returns the new lodash wrapper instance. + */ + chain(value: number): LoDashExplicitWrapper; + chain(value: string): LoDashExplicitWrapper; + chain(value: boolean): LoDashExplicitWrapper; + chain(value: T[]): LoDashExplicitArrayWrapper; + chain(value: T): LoDashExplicitObjectWrapper; + chain(value: any): LoDashExplicitWrapper; + } + + interface LoDashImplicitWrapper { + /** + * @see _.chain + */ + chain(): LoDashExplicitWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.chain + */ + chain(): LoDashExplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.chain + */ + chain(): LoDashExplicitObjectWrapper; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.chain + */ + chain(): TWrapper; + } + + //_.tap + interface LoDashStatic { + /** + * This method invokes interceptor and returns value. The interceptor is bound to thisArg and invoked with one + * argument; (value). The purpose of this method is to "tap into" a method chain in order to perform operations + * on intermediate results within the chain. + * + * @param value The value to provide to interceptor. + * @param interceptor The function to invoke. + * @parem thisArg The this binding of interceptor. + * @return Returns value. + **/ + tap( + value: T, + interceptor: (value: T) => void, + thisArg?: any + ): T; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.tap + */ + tap( + interceptor: (value: T) => void, + thisArg?: any + ): TWrapper; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.tap + */ + tap( + interceptor: (value: T) => void, + thisArg?: any + ): TWrapper; + } + //_.thru interface LoDashStatic { /** * This method is like _.tap except that it returns the result of interceptor. + * * @param value The value to provide to interceptor. * @param interceptor The function to invoke. * @param thisArg The this binding of interceptor. @@ -2361,48 +2384,91 @@ declare module _ { thru( value: T, interceptor: (value: T) => TResult, - thisArg?: any): TResult; + thisArg?: any + ): TResult; } - interface LoDashWrapperBase { + interface LoDashImplicitWrapperBase { /** * @see _.thru */ thru( interceptor: (value: T) => TResult, - thisArg?: any): LoDashWrapper; + thisArg?: any): LoDashImplicitWrapper; /** * @see _.thru */ thru( interceptor: (value: T) => TResult, - thisArg?: any): LoDashWrapper; + thisArg?: any): LoDashImplicitWrapper; /** * @see _.thru */ thru( interceptor: (value: T) => TResult, - thisArg?: any): LoDashWrapper; + thisArg?: any): LoDashImplicitWrapper; /** * @see _.thru */ - thru( + thru( interceptor: (value: T) => TResult, - thisArg?: any): LoDashObjectWrapper; + thisArg?: any): LoDashImplicitObjectWrapper; /** * @see _.thru */ thru( interceptor: (value: T) => TResult[], - thisArg?: any): LoDashArrayWrapper; + thisArg?: any): LoDashImplicitArrayWrapper; } - // _.prototype.commit - interface LoDashWrapperBase { + interface LoDashExplicitWrapperBase { + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult[], + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + //_.prototype.commit + interface LoDashImplicitWrapperBase { /** * Executes the chained sequence and returns the wrapped result. * @@ -2411,44 +2477,181 @@ declare module _ { commit(): TWrapper; } + interface LoDashExplicitWrapperBase { + /** + * @see _.commit + */ + commit(): TWrapper; + } + + //_.prototype.concat + interface LoDashImplicitWrapperBase { + /** + * Creates a new array joining a wrapped array with any additional arrays and/or values. + * + * @param items + * @return Returns the new concatenated array. + */ + concat(...items: Array>): LoDashImplicitArrayWrapper; + + /** + * @see _.concat + */ + concat(...items: Array>): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.concat + */ + concat(...items: Array>): LoDashExplicitArrayWrapper; + + /** + * @see _.concat + */ + concat(...items: Array>): LoDashExplicitArrayWrapper; + } + //_.prototype.plant - interface LoDashWrapperBase { + interface LoDashImplicitWrapperBase { /** * Creates a clone of the chained sequence planting value as the wrapped value. * @param value The value to plant as the wrapped value. * @return Returns the new lodash wrapper instance. */ - plant(value: number): LoDashWrapper; + plant(value: number): LoDashImplicitWrapper; /** * @see _.plant */ - plant(value: string): LoDashStringWrapper; + plant(value: string): LoDashImplicitStringWrapper; /** * @see _.plant */ - plant(value: boolean): LoDashWrapper; + plant(value: boolean): LoDashImplicitWrapper; /** * @see _.plant */ - plant(value: number[]): LoDashNumberArrayWrapper; + plant(value: number[]): LoDashImplicitNumberArrayWrapper; /** * @see _.plant */ - plant(value: T[]): LoDashArrayWrapper; + plant(value: T[]): LoDashImplicitArrayWrapper; /** * @see _.plant */ - plant(value: T): LoDashObjectWrapper; + plant(value: T): LoDashImplicitObjectWrapper; /** * @see _.plant */ - plant(value: any): LoDashWrapper; + plant(value: any): LoDashImplicitWrapper; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.plant + */ + plant(value: number): LoDashExplicitWrapper; + + /** + * @see _.plant + */ + plant(value: string): LoDashExplicitStringWrapper; + + /** + * @see _.plant + */ + plant(value: boolean): LoDashExplicitWrapper; + + /** + * @see _.plant + */ + plant(value: number[]): LoDashExplicitNumberArrayWrapper; + + /** + * @see _.plant + */ + plant(value: T[]): LoDashExplicitArrayWrapper; + + /** + * @see _.plant + */ + plant(value: T): LoDashExplicitObjectWrapper; + + /** + * @see _.plant + */ + plant(value: any): LoDashExplicitWrapper; + } + + //_.prototype.reverse + interface LoDashImplicitArrayWrapper { + /** + * Reverses the wrapped array so the first element becomes the last, the second element becomes the second to + * last, and so on. + * + * Note: This method mutates the wrapped array. + * + * @return Returns the new reversed lodash wrapper instance. + */ + reverse(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.reverse + */ + reverse(): LoDashExplicitArrayWrapper; + } + + // _.run + interface LoDashWrapperBase { + /** + * @see _.value + */ + run(): T; + } + + // _.toJSON + interface LoDashWrapperBase { + /** + * @see _.value + */ + toJSON(): T; + } + + interface LoDashWrapperBase { + /** + * Produces the result of coercing the unwrapped value to a string. + * + * @return Returns the coerced string value. + */ + toString(): string; + } + + // _.value + interface LoDashWrapperBase { + /** + * Executes the chained sequence to extract the unwrapped value. + * + * @alias _.run, _.toJSON, _.valueOf + * + * @return Returns the resolved unwrapped value. + */ + value(): T; + } + + // _.valueOf + interface LoDashWrapperBase { + /** + * @see _.value + */ + valueOf(): T; } /************** @@ -2493,7 +2696,7 @@ declare module _ { ): boolean; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.every */ @@ -2518,7 +2721,7 @@ declare module _ { ): boolean; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.every */ @@ -2581,7 +2784,7 @@ declare module _ { ): boolean; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.some */ @@ -2606,7 +2809,7 @@ declare module _ { ): boolean; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.some */ @@ -2647,18 +2850,18 @@ declare module _ { ): T[]; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.at */ - at(...props: Array>): LoDashArrayWrapper; + at(...props: Array>): LoDashImplicitArrayWrapper; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.at */ - at(...props: Array>): LoDashArrayWrapper; + at(...props: Array>): LoDashImplicitArrayWrapper; } //_.collect @@ -2714,52 +2917,52 @@ declare module _ { ): boolean[]; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.map */ collect( iteratee?: ListIterator, thisArg?: any - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; /** * @see _.map */ collect( iteratee?: string - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; /** * @see _.map */ collect( iteratee?: TObject - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.map */ collect( iteratee?: ListIterator|DictionaryIterator, thisArg?: any - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; /** * @see _.map */ collect( iteratee?: string - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; /** * @see _.map */ collect( iteratee?: TObject - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; } //_.contains @@ -2870,7 +3073,7 @@ declare module _ { fromIndex?: number): boolean; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.contains **/ @@ -2887,7 +3090,7 @@ declare module _ { includes(target: T, fromIndex?: number): boolean; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.contains **/ @@ -2904,7 +3107,7 @@ declare module _ { includes(target: TValue, fromIndex?: number): boolean; } - interface LoDashStringWrapper { + interface LoDashImplicitStringWrapper { /** * @see _.contains **/ @@ -2990,13 +3193,13 @@ declare module _ { thisArg?: any): Dictionary; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.countBy **/ countBy( callback?: ListIterator, - thisArg?: any): LoDashObjectWrapper>; + thisArg?: any): LoDashImplicitObjectWrapper>; /** * @see _.countBy @@ -3004,7 +3207,7 @@ declare module _ { **/ countBy( callback: string, - thisArg?: any): LoDashObjectWrapper>; + thisArg?: any): LoDashImplicitObjectWrapper>; } //_.detect @@ -3045,7 +3248,7 @@ declare module _ { ): T; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.find */ @@ -3070,7 +3273,7 @@ declare module _ { ): T; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.find */ @@ -3150,7 +3353,7 @@ declare module _ { ): boolean; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.every */ @@ -3175,7 +3378,7 @@ declare module _ { ): boolean; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.every */ @@ -3229,24 +3432,24 @@ declare module _ { end?: number): List; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.fill */ fill( value: TResult, start?: number, - end?: number): LoDashArrayWrapper; + end?: number): LoDashImplicitArrayWrapper; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.fill */ fill( value: TResult, start?: number, - end?: number): LoDashObjectWrapper>; + end?: number): LoDashImplicitObjectWrapper>; } //_.filter @@ -3418,62 +3621,62 @@ declare module _ { whereValue: W): T[]; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.filter **/ - filter(): LoDashArrayWrapper; + filter(): LoDashImplicitArrayWrapper; /** * @see _.filter **/ filter( callback: ListIterator, - thisArg?: any): LoDashArrayWrapper; + thisArg?: any): LoDashImplicitArrayWrapper; /** * @see _.filter * @param pluckValue _.pluck style callback **/ filter( - pluckValue: string): LoDashArrayWrapper; + pluckValue: string): LoDashImplicitArrayWrapper; /** * @see _.filter * @param pluckValue _.pluck style callback **/ filter( - whereValue: W): LoDashArrayWrapper; + whereValue: W): LoDashImplicitArrayWrapper; /** * @see _.filter **/ select( callback: ListIterator, - thisArg?: any): LoDashArrayWrapper; + thisArg?: any): LoDashImplicitArrayWrapper; /** * @see _.filter * @param pluckValue _.pluck style callback **/ select( - pluckValue: string): LoDashArrayWrapper; + pluckValue: string): LoDashImplicitArrayWrapper; /** * @see _.filter * @param pluckValue _.pluck style callback **/ select( - whereValue: W): LoDashArrayWrapper; + whereValue: W): LoDashImplicitArrayWrapper; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.filter **/ filter( callback: ObjectIterator, - thisArg?: any): LoDashObjectWrapper; + thisArg?: any): LoDashImplicitObjectWrapper; } //_.find @@ -3531,7 +3734,7 @@ declare module _ { ): T; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.find */ @@ -3556,7 +3759,7 @@ declare module _ { ): T; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.find */ @@ -3736,7 +3939,7 @@ declare module _ { pluckValue: string): T; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.findLast */ @@ -3833,36 +4036,36 @@ declare module _ { thisArg?: any): T } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.forEach **/ forEach( callback: ListIterator, - thisArg?: any): LoDashArrayWrapper; + thisArg?: any): LoDashImplicitArrayWrapper; /** * @see _.forEach **/ each( callback: ListIterator, - thisArg?: any): LoDashArrayWrapper; + thisArg?: any): LoDashImplicitArrayWrapper; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.forEach **/ forEach( callback: ObjectIterator, - thisArg?: any): LoDashObjectWrapper; + thisArg?: any): LoDashImplicitObjectWrapper; /** * @see _.forEach **/ each( callback: ObjectIterator, - thisArg?: any): LoDashObjectWrapper; + thisArg?: any): LoDashImplicitObjectWrapper; } //_.forEachRight @@ -3923,29 +4126,29 @@ declare module _ { thisArg?: any): Dictionary; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.forEachRight **/ forEachRight( callback: ListIterator, - thisArg?: any): LoDashArrayWrapper; + thisArg?: any): LoDashImplicitArrayWrapper; /** * @see _.forEachRight **/ eachRight( callback: ListIterator, - thisArg?: any): LoDashArrayWrapper; + thisArg?: any): LoDashImplicitArrayWrapper; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.forEachRight **/ forEachRight( callback: ObjectIterator, - thisArg?: any): LoDashObjectWrapper>; + thisArg?: any): LoDashImplicitObjectWrapper>; /** * @see _.forEachRight @@ -3955,7 +4158,7 @@ declare module _ { **/ eachRight( callback: ObjectIterator, - thisArg?: any): LoDashObjectWrapper>; + thisArg?: any): LoDashImplicitObjectWrapper>; } //_.groupBy @@ -4045,46 +4248,46 @@ declare module _ { whereValue: W): Dictionary; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.groupBy **/ groupBy( callback: ListIterator, - thisArg?: any): _.LoDashObjectWrapper<_.Dictionary>; + thisArg?: any): _.LoDashImplicitObjectWrapper<_.Dictionary>; /** * @see _.groupBy **/ groupBy( - pluckValue: string): _.LoDashObjectWrapper<_.Dictionary>; + pluckValue: string): _.LoDashImplicitObjectWrapper<_.Dictionary>; /** * @see _.groupBy **/ groupBy( - whereValue: W): _.LoDashObjectWrapper<_.Dictionary>; + whereValue: W): _.LoDashImplicitObjectWrapper<_.Dictionary>; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.groupBy **/ groupBy( callback: ListIterator, - thisArg?: any): _.LoDashObjectWrapper<_.Dictionary>; + thisArg?: any): _.LoDashImplicitObjectWrapper<_.Dictionary>; /** * @see _.groupBy **/ groupBy( - pluckValue: string): _.LoDashObjectWrapper<_.Dictionary>; + pluckValue: string): _.LoDashImplicitObjectWrapper<_.Dictionary>; /** * @see _.groupBy **/ groupBy( - whereValue: W): _.LoDashObjectWrapper<_.Dictionary>; + whereValue: W): _.LoDashImplicitObjectWrapper<_.Dictionary>; } //_.indexBy @@ -4286,52 +4489,52 @@ declare module _ { ): boolean[]; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.map */ map( iteratee?: ListIterator, thisArg?: any - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; /** * @see _.map */ map( iteratee?: string - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; /** * @see _.map */ map( iteratee?: TObject - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.map */ map( iteratee?: ListIterator|DictionaryIterator, thisArg?: any - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; /** * @see _.map */ map( iteratee?: string - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; /** * @see _.map */ map( iteratee?: TObject - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; } //_.ceil @@ -4345,7 +4548,7 @@ declare module _ { ceil(n: number, precision?: number): number; } - interface LoDashWrapper { + interface LoDashImplicitWrapper { /** * @see _.ceil */ @@ -4363,7 +4566,7 @@ declare module _ { floor(n: number, precision?: number): number; } - interface LoDashWrapper { + interface LoDashImplicitWrapper { /** * @see _.floor */ @@ -4381,7 +4584,7 @@ declare module _ { round(n: number, precision?: number): number; } - interface LoDashWrapper { + interface LoDashImplicitWrapper { /** * @see _.round */ @@ -4462,7 +4665,7 @@ declare module _ { property: string): number; } - interface LoDashNumberArrayWrapper { + interface LoDashImplicitNumberArrayWrapper { /** * @see _.sum **/ @@ -4476,7 +4679,7 @@ declare module _ { thisArg?: any): number; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.sum **/ @@ -4497,7 +4700,7 @@ declare module _ { property: string): number; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.sum **/ @@ -4545,20 +4748,20 @@ declare module _ { property: string|string[]): any[]; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.pluck **/ pluck( - property: string): LoDashArrayWrapper; + property: string): LoDashImplicitArrayWrapper; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.pluck **/ pluck( - property: string): LoDashArrayWrapper; + property: string): LoDashImplicitArrayWrapper; } //_.partition @@ -4640,73 +4843,73 @@ declare module _ { pluckValue: string): T[][]; } - interface LoDashStringWrapper { + interface LoDashImplicitStringWrapper { /** * @see _.partition */ partition( callback: ListIterator, - thisArg?: any): LoDashArrayWrapper; + thisArg?: any): LoDashImplicitArrayWrapper; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.partition */ partition( callback: ListIterator, - thisArg?: any): LoDashArrayWrapper; + thisArg?: any): LoDashImplicitArrayWrapper; /** * @see _.partition */ partition( - whereValue: W): LoDashArrayWrapper; + whereValue: W): LoDashImplicitArrayWrapper; /** * @see _.partition */ partition( path: string, - srcValue: any): LoDashArrayWrapper; + srcValue: any): LoDashImplicitArrayWrapper; /** * @see _.partition */ partition( - pluckValue: string): LoDashArrayWrapper; + pluckValue: string): LoDashImplicitArrayWrapper; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.partition */ partition( callback: ListIterator, - thisArg?: any): LoDashArrayWrapper; + thisArg?: any): LoDashImplicitArrayWrapper; /** * @see _.partition */ partition( callback: DictionaryIterator, - thisArg?: any): LoDashArrayWrapper; + thisArg?: any): LoDashImplicitArrayWrapper; /** * @see _.partition */ partition( - whereValue: W): LoDashArrayWrapper; + whereValue: W): LoDashImplicitArrayWrapper; /** * @see _.partition */ partition( path: string, - srcValue: any): LoDashArrayWrapper; + srcValue: any): LoDashImplicitArrayWrapper; /** * @see _.partition */ partition( - pluckValue: string): LoDashArrayWrapper; + pluckValue: string): LoDashImplicitArrayWrapper; } //_.reduce @@ -4874,7 +5077,7 @@ declare module _ { thisArg?: any): TResult; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.reduce **/ @@ -4921,7 +5124,7 @@ declare module _ { thisArg?: any): TResult; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.reduce **/ @@ -5165,25 +5368,25 @@ declare module _ { whereValue: W): T[]; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.reject **/ reject( callback: ListIterator, - thisArg?: any): LoDashArrayWrapper; + thisArg?: any): LoDashImplicitArrayWrapper; /** * @see _.reject * @param pluckValue _.pluck style callback **/ - reject(pluckValue: string): LoDashArrayWrapper; + reject(pluckValue: string): LoDashImplicitArrayWrapper; /** * @see _.reject * @param whereValue _.where style callback **/ - reject(whereValue: W): LoDashArrayWrapper; + reject(whereValue: W): LoDashImplicitArrayWrapper; } //_.sample @@ -5224,16 +5427,16 @@ declare module _ { sample(collection: Dictionary, n: number): T[]; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.sample **/ - sample(n: number): LoDashArrayWrapper; + sample(n: number): LoDashImplicitArrayWrapper; /** * @see _.sample **/ - sample(): LoDashWrapper; + sample(): LoDashImplicitWrapper; } //_.shuffle @@ -5257,18 +5460,18 @@ declare module _ { shuffle(collection: Dictionary): T[]; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.shuffle **/ - shuffle(): LoDashArrayWrapper; + shuffle(): LoDashImplicitArrayWrapper; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.shuffle **/ - shuffle(): LoDashArrayWrapper; + shuffle(): LoDashImplicitArrayWrapper; } //_.size @@ -5301,14 +5504,14 @@ declare module _ { size(aString: string): number; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.size **/ size(): number; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.size **/ @@ -5371,7 +5574,7 @@ declare module _ { ): boolean; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.some */ @@ -5396,7 +5599,7 @@ declare module _ { ): boolean; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.some */ @@ -5497,31 +5700,31 @@ declare module _ { ): T[]; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.sortBy **/ sortBy( iteratee?: ListIterator, - thisArg?: any): LoDashArrayWrapper; + thisArg?: any): LoDashImplicitArrayWrapper; /** * @see _.sortBy * @param pluckValue _.pluck style callback **/ - sortBy(pluckValue: string): LoDashArrayWrapper; + sortBy(pluckValue: string): LoDashImplicitArrayWrapper; /** * @see _.sortBy * @param whereValue _.where style callback **/ - sortBy(whereValue: W): LoDashArrayWrapper; + sortBy(whereValue: W): LoDashImplicitArrayWrapper; /** * Sorts by all the given arguments, using either ListIterator, pluckValue, or whereValue foramts * @param args The rules by which to sort */ - sortByAll(...args: (ListIterator|Object|string)[]): LoDashArrayWrapper; + sortByAll(...args: (ListIterator|Object|string)[]): LoDashImplicitArrayWrapper; } //_.sortByAll @@ -5570,18 +5773,18 @@ declare module _ { ...iteratees: (ListIterator|string|Object)[]): T[]; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.sortByAll **/ sortByAll( - iteratees: (ListIterator|string|Object)[]): LoDashArrayWrapper; + iteratees: (ListIterator|string|Object)[]): LoDashImplicitArrayWrapper; /** * @see _.sortByAll **/ sortByAll( - ...iteratees: (ListIterator|string|Object)[]): LoDashArrayWrapper; + ...iteratees: (ListIterator|string|Object)[]): LoDashImplicitArrayWrapper; } //_.sortByOrder @@ -5633,20 +5836,20 @@ declare module _ { orders?: string[]): T[]; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.sortByOrder **/ sortByOrder( iteratees: (ListIterator|string|Object)[], - orders?: boolean[]): LoDashArrayWrapper; + orders?: boolean[]): LoDashImplicitArrayWrapper; /** * @see _.sortByOrder **/ sortByOrder( iteratees: (ListIterator|string|Object)[], - orders?: string[]): LoDashArrayWrapper; + orders?: string[]): LoDashImplicitArrayWrapper; } //_.where @@ -5677,11 +5880,11 @@ declare module _ { properties: U): T[]; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.where **/ - where(properties: U): LoDashArrayWrapper; + where(properties: U): LoDashImplicitArrayWrapper; } /******** @@ -5691,13 +5894,27 @@ declare module _ { //_.now interface LoDashStatic { /** - * Gets the number of milliseconds that have elapsed since the Unix epoch - * (1 January 1970 00:00:00 UTC). - * @return The number of milliseconds. - **/ + * Gets the number of milliseconds that have elapsed since the Unix epoch (1 January 1970 00:00:00 UTC). + * + * @return The number of milliseconds. + */ now(): number; } + interface LoDashImplicitWrapperBase { + /** + * @see _.now + */ + now(): number; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.now + */ + now(): LoDashExplicitWrapper; + } + /************* * Functions * *************/ @@ -5716,11 +5933,11 @@ declare module _ { func: Function): Function; } - interface LoDashWrapper { + interface LoDashImplicitWrapper { /** * @see _.after **/ - after(func: Function): LoDashObjectWrapper; + after(func: Function): LoDashImplicitObjectWrapper; } //_.ary @@ -5735,11 +5952,11 @@ declare module _ { ary(func: Function, n?: number, guard?: Object): TResult; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.ary */ - ary(n?: number, guard?: Object): LoDashObjectWrapper; + ary(n?: number, guard?: Object): LoDashImplicitObjectWrapper; } //_.backflow @@ -5750,11 +5967,11 @@ declare module _ { backflow(...funcs: Function[]): TResult; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.flowRight **/ - backflow(...funcs: Function[]): LoDashObjectWrapper; + backflow(...funcs: Function[]): LoDashImplicitObjectWrapper; } //_.before @@ -5770,7 +5987,7 @@ declare module _ { before(n: number, func: TFunc): TFunc; } - interface LoDashWrapper { + interface LoDashImplicitWrapper { /** * @sed _.before */ @@ -5793,13 +6010,13 @@ declare module _ { ...args: any[]): (...args: any[]) => any; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.bind **/ bind( thisArg: any, - ...args: any[]): LoDashObjectWrapper<(...args: any[]) => any>; + ...args: any[]): LoDashImplicitObjectWrapper<(...args: any[]) => any>; } //_.bindAll @@ -5818,11 +6035,11 @@ declare module _ { ...methodNames: string[]): T; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.bindAll **/ - bindAll(...methodNames: string[]): LoDashWrapper; + bindAll(...methodNames: string[]): LoDashImplicitWrapper; } //_.bindKey @@ -5843,13 +6060,13 @@ declare module _ { ...args: any[]): Function; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.bindKey **/ bindKey( key: string, - ...args: any[]): LoDashObjectWrapper; + ...args: any[]): LoDashImplicitObjectWrapper; } //_.compose @@ -5860,11 +6077,11 @@ declare module _ { compose(...funcs: Function[]): TResult; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.flowRight */ - compose(...funcs: Function[]): LoDashObjectWrapper; + compose(...funcs: Function[]): LoDashImplicitObjectWrapper; } //_.createCallback @@ -5893,22 +6110,22 @@ declare module _ { argCount?: number): () => boolean; } - interface LoDashWrapper { + interface LoDashImplicitWrapper { /** * @see _.createCallback **/ createCallback( thisArg?: any, - argCount?: number): LoDashObjectWrapper<() => any>; + argCount?: number): LoDashImplicitObjectWrapper<() => any>; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.createCallback **/ createCallback( thisArg?: any, - argCount?: number): LoDashObjectWrapper<() => any>; + argCount?: number): LoDashImplicitObjectWrapper<() => any>; } //_.curry @@ -6006,11 +6223,11 @@ declare module _ { (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5): R; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.curry **/ - curry(arity?: number): LoDashObjectWrapper; + curry(arity?: number): LoDashImplicitObjectWrapper; } //_.curryRight @@ -6067,11 +6284,11 @@ declare module _ { arity?: number): TResult; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.curryRight **/ - curryRight(arity?: number): LoDashObjectWrapper; + curryRight(arity?: number): LoDashImplicitObjectWrapper; } //_.debounce @@ -6099,13 +6316,13 @@ declare module _ { options?: DebounceSettings): T; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.debounce **/ debounce( wait: number, - options?: DebounceSettings): LoDashObjectWrapper; + options?: DebounceSettings): LoDashImplicitObjectWrapper; } interface DebounceSettings { @@ -6139,11 +6356,11 @@ declare module _ { ...args: any[]): number; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.defer **/ - defer(...args: any[]): LoDashWrapper; + defer(...args: any[]): LoDashImplicitWrapper; } //_.delay @@ -6162,13 +6379,13 @@ declare module _ { ...args: any[]): number; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.delay **/ delay( wait: number, - ...args: any[]): LoDashWrapper; + ...args: any[]): LoDashImplicitWrapper; } //_.flow @@ -6182,11 +6399,11 @@ declare module _ { flow(...funcs: Function[]): TResult; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.flow **/ - flow(...funcs: Function[]): LoDashObjectWrapper; + flow(...funcs: Function[]): LoDashImplicitObjectWrapper; } //_.flowRight @@ -6200,11 +6417,11 @@ declare module _ { flowRight(...funcs: Function[]): TResult; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.flowRight **/ - flowRight(...funcs: Function[]): LoDashObjectWrapper; + flowRight(...funcs: Function[]): LoDashImplicitObjectWrapper; } //_.memoize @@ -6227,11 +6444,11 @@ declare module _ { resolver?: Function): TResult; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.memoize */ - memoize(resolver?: Function): LoDashObjectWrapper; + memoize(resolver?: Function): LoDashImplicitObjectWrapper; } //_.modArgs @@ -6257,16 +6474,16 @@ declare module _ { ): TResult; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.modArgs */ - modArgs(...transforms: Function[]): LoDashObjectWrapper; + modArgs(...transforms: Function[]): LoDashImplicitObjectWrapper; /** * @see _.modArgs */ - modArgs(transforms: Function[]): LoDashObjectWrapper; + modArgs(transforms: Function[]): LoDashImplicitObjectWrapper; } //_.negate @@ -6285,16 +6502,16 @@ declare module _ { negate(predicate: T): TResult; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.negate */ - negate(): LoDashObjectWrapper<(...args: any[]) => boolean>; + negate(): LoDashImplicitObjectWrapper<(...args: any[]) => boolean>; /** * @see _.negate */ - negate(): LoDashObjectWrapper; + negate(): LoDashImplicitObjectWrapper; } //_.once @@ -6309,11 +6526,11 @@ declare module _ { once(func: T): T; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.once */ - once(): LoDashObjectWrapper; + once(): LoDashImplicitObjectWrapper; } //_.partial @@ -6363,16 +6580,16 @@ declare module _ { rearg(func: Function, ...indexes: number[]): TResult; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.rearg */ - rearg(indexes: number[]): LoDashObjectWrapper; + rearg(indexes: number[]): LoDashImplicitObjectWrapper; /** * @see _.rearg */ - rearg(...indexes: number[]): LoDashObjectWrapper; + rearg(...indexes: number[]): LoDashImplicitObjectWrapper; } //_.restParam @@ -6392,11 +6609,11 @@ declare module _ { restParam(func: TFunc, start?: number): TResult; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.restParam */ - restParam(start?: number): LoDashObjectWrapper; + restParam(start?: number): LoDashImplicitObjectWrapper; } //_.spread @@ -6410,11 +6627,11 @@ declare module _ { spread(func: Function): TResult; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.spread */ - spread(): LoDashObjectWrapper; + spread(): LoDashImplicitObjectWrapper; } @@ -6504,7 +6721,7 @@ declare module _ { thisArg?: any): T; } - interface LoDashWrapper { + interface LoDashImplicitWrapper { /** * @see _.clone */ @@ -6521,7 +6738,7 @@ declare module _ { thisArg?: any): T; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.clone */ @@ -6538,7 +6755,7 @@ declare module _ { thisArg?: any): T[]; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.clone */ @@ -6575,7 +6792,7 @@ declare module _ { thisArg?: any): T; } - interface LoDashWrapper { + interface LoDashImplicitWrapper { /** * @see _.cloneDeep */ @@ -6584,7 +6801,7 @@ declare module _ { thisArg?: any): T; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.cloneDeep */ @@ -6593,7 +6810,7 @@ declare module _ { thisArg?: any): T[]; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.cloneDeep */ @@ -6615,7 +6832,7 @@ declare module _ { ): boolean; } - interface LoDashWrapperBase { + interface LoDashImplicitWrapperBase { /** * @see _.isEqual */ @@ -6637,7 +6854,7 @@ declare module _ { gt(value: any, other: any): boolean; } - interface LoDashWrapperBase { + interface LoDashImplicitWrapperBase { /** * @see _.gt */ @@ -6655,7 +6872,7 @@ declare module _ { gte(value: any, other: any): boolean; } - interface LoDashWrapperBase { + interface LoDashImplicitWrapperBase { /** * @see _.gte */ @@ -6672,7 +6889,7 @@ declare module _ { isArguments(value?: any): boolean; } - interface LoDashWrapperBase { + interface LoDashImplicitWrapperBase { /** * @see _.isArguments */ @@ -6689,7 +6906,7 @@ declare module _ { isArray(value?: any): boolean; } - interface LoDashWrapperBase { + interface LoDashImplicitWrapperBase { /** * @see _.isArray */ @@ -6706,7 +6923,7 @@ declare module _ { isBoolean(value?: any): boolean; } - interface LoDashWrapperBase { + interface LoDashImplicitWrapperBase { /** * @see _.isBoolean */ @@ -6723,7 +6940,7 @@ declare module _ { isDate(value?: any): boolean; } - interface LoDashWrapperBase { + interface LoDashImplicitWrapperBase { /** * @see _.isDate */ @@ -6740,7 +6957,7 @@ declare module _ { isElement(value?: any): boolean; } - interface LoDashWrapperBase { + interface LoDashImplicitWrapperBase { /** * @see _.isElement */ @@ -6758,7 +6975,7 @@ declare module _ { isEmpty(value?: any[]|Dictionary|string|any): boolean; } - interface LoDashWrapperBase { + interface LoDashImplicitWrapperBase { /** * @see _.isEmpty */ @@ -6797,7 +7014,7 @@ declare module _ { ): boolean; } - interface LoDashWrapperBase { + interface LoDashImplicitWrapperBase { /** * @see _.isEqual */ @@ -6819,7 +7036,7 @@ declare module _ { isError(value: any): boolean; } - interface LoDashWrapperBase { + interface LoDashImplicitWrapperBase { /** * @see _.isError */ @@ -6837,7 +7054,7 @@ declare module _ { isFinite(value?: any): boolean; } - interface LoDashWrapperBase { + interface LoDashImplicitWrapperBase { /** * @see _.isFinite */ @@ -6854,7 +7071,7 @@ declare module _ { isFunction(value?: any): boolean; } - interface LoDashWrapperBase { + interface LoDashImplicitWrapperBase { /** * @see _.isFunction */ @@ -6881,7 +7098,7 @@ declare module _ { isMatch(object: Object, source: Object, customizer?: isMatchCustomizer, thisArg?: any): boolean; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.isMatch */ @@ -6899,7 +7116,7 @@ declare module _ { isNaN(value?: any): boolean; } - interface LoDashWrapperBase { + interface LoDashImplicitWrapperBase { /** * @see _.isNaN */ @@ -6916,7 +7133,7 @@ declare module _ { isNative(value: any): boolean; } - interface LoDashWrapperBase { + interface LoDashImplicitWrapperBase { /** * see _.isNative */ @@ -6933,7 +7150,7 @@ declare module _ { isNull(value?: any): boolean; } - interface LoDashWrapperBase { + interface LoDashImplicitWrapperBase { /** * see _.isNull */ @@ -6951,7 +7168,7 @@ declare module _ { isNumber(value?: any): boolean; } - interface LoDashWrapperBase { + interface LoDashImplicitWrapperBase { /** * see _.isNumber */ @@ -6969,7 +7186,7 @@ declare module _ { isObject(value?: any): boolean; } - interface LoDashWrapperBase { + interface LoDashImplicitWrapperBase { /** * see _.isObject */ @@ -6990,7 +7207,7 @@ declare module _ { isPlainObject(value?: any): boolean; } - interface LoDashWrapperBase { + interface LoDashImplicitWrapperBase { /** * see _.isPlainObject */ @@ -7007,7 +7224,7 @@ declare module _ { isRegExp(value?: any): boolean; } - interface LoDashWrapperBase { + interface LoDashImplicitWrapperBase { /** * see _.isRegExp */ @@ -7024,7 +7241,7 @@ declare module _ { isString(value?: any): boolean; } - interface LoDashWrapperBase { + interface LoDashImplicitWrapperBase { /** * see _.isString */ @@ -7041,7 +7258,7 @@ declare module _ { isTypedArray(value: any): boolean; } - interface LoDashWrapperBase { + interface LoDashImplicitWrapperBase { /** * see _.isTypedArray */ @@ -7058,7 +7275,7 @@ declare module _ { isUndefined(value: any): boolean; } - interface LoDashWrapperBase { + interface LoDashImplicitWrapperBase { /** * see _.isUndefined */ @@ -7076,7 +7293,7 @@ declare module _ { lt(value: any, other: any): boolean; } - interface LoDashWrapperBase { + interface LoDashImplicitWrapperBase { /** * @see _.lt */ @@ -7094,7 +7311,7 @@ declare module _ { lte(value: any, other: any): boolean; } - interface LoDashWrapperBase { + interface LoDashImplicitWrapperBase { /** * @see _.lte */ @@ -7132,25 +7349,25 @@ declare module _ { toArray(value?: any): any[]; } - interface LoDashWrapper { + interface LoDashImplicitWrapper { /** * @see _.toArray */ - toArray(): LoDashArrayWrapper; + toArray(): LoDashImplicitArrayWrapper; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.toArray */ - toArray(): LoDashArrayWrapper; + toArray(): LoDashImplicitArrayWrapper; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.toArray */ - toArray(): LoDashArrayWrapper; + toArray(): LoDashImplicitArrayWrapper; } //_.toPlainObject @@ -7165,11 +7382,11 @@ declare module _ { toPlainObject(value?: any): TResult; } - interface LoDashWrapperBase { + interface LoDashImplicitWrapperBase { /** * @see _.toPlainObject */ - toPlainObject(): LoDashObjectWrapper; + toPlainObject(): LoDashImplicitObjectWrapper; } /******** @@ -7187,7 +7404,7 @@ declare module _ { add(augend: number, addend: number): number; } - interface LoDashWrapper { + interface LoDashImplicitWrapper { /** * @see _.add */ @@ -7248,7 +7465,7 @@ declare module _ { ): T; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.max */ @@ -7273,7 +7490,7 @@ declare module _ { ): T; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.max */ @@ -7352,7 +7569,7 @@ declare module _ { ): T; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.min */ @@ -7377,7 +7594,7 @@ declare module _ { ): T; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.min */ @@ -7425,7 +7642,7 @@ declare module _ { inRange(n: number, end: number): boolean; } - interface LoDashWrapper { + interface LoDashImplicitWrapper { /** * @see _.inRange */ @@ -7469,7 +7686,7 @@ declare module _ { random(floating?: boolean): number; } - interface LoDashWrapper { + interface LoDashImplicitWrapper { /** * @see _.random */ @@ -7583,7 +7800,7 @@ declare module _ { thisArg?: any): Result; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.assign **/ @@ -7692,11 +7909,11 @@ declare module _ { create(prototype: Object, properties?: Object): TResult; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.create */ - create(properties?: Object): LoDashObjectWrapper; + create(properties?: Object): LoDashImplicitObjectWrapper; } //_.defaults @@ -7714,11 +7931,11 @@ declare module _ { ...sources: any[]): TResult; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.defaults **/ - defaults(...sources: any[]): LoDashObjectWrapper + defaults(...sources: any[]): LoDashImplicitObjectWrapper } //_.defaultsDeep @@ -7734,11 +7951,11 @@ declare module _ { ...sources: any[]): TResult; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.defaultsDeep **/ - defaultsDeep(...sources: any[]): LoDashObjectWrapper + defaultsDeep(...sources: any[]): LoDashImplicitObjectWrapper } //_.findKey @@ -7794,7 +8011,7 @@ declare module _ { ): string; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.findKey */ @@ -7879,7 +8096,7 @@ declare module _ { ): string; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.findLastKey */ @@ -7937,13 +8154,13 @@ declare module _ { thisArg?: any): T; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.forIn **/ forIn( callback: ObjectIterator, - thisArg?: any): _.LoDashObjectWrapper; + thisArg?: any): _.LoDashImplicitObjectWrapper; } //_.forInRight @@ -7970,13 +8187,13 @@ declare module _ { thisArg?: any): T; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.forInRight **/ forInRight( callback: ObjectIterator, - thisArg?: any): _.LoDashObjectWrapper; + thisArg?: any): _.LoDashImplicitObjectWrapper; } //_.forOwn @@ -8004,13 +8221,13 @@ declare module _ { thisArg?: any): T; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.forOwn **/ forOwn( callback: ObjectIterator, - thisArg?: any): _.LoDashObjectWrapper; + thisArg?: any): _.LoDashImplicitObjectWrapper; } //_.forOwnRight @@ -8036,13 +8253,13 @@ declare module _ { thisArg?: any): T; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.forOwnRight **/ forOwnRight( callback: ObjectIterator, - thisArg?: any): _.LoDashObjectWrapper; + thisArg?: any): _.LoDashImplicitObjectWrapper; } //_.functions @@ -8061,16 +8278,16 @@ declare module _ { methods(object: any): string[]; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.functions **/ - functions(): _.LoDashArrayWrapper; + functions(): _.LoDashImplicitArrayWrapper; /** * @see _.functions **/ - methods(): _.LoDashArrayWrapper; + methods(): _.LoDashImplicitArrayWrapper; } //_.get @@ -8089,7 +8306,7 @@ declare module _ { ): TResult; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.get **/ @@ -8110,7 +8327,7 @@ declare module _ { has(object: any, path: string|number|boolean|Array): boolean; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.has */ @@ -8130,11 +8347,11 @@ declare module _ { invert(object: T, multiValue?: boolean): TResult; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.invert */ - invert(multiValue?: boolean): LoDashObjectWrapper; + invert(multiValue?: boolean): LoDashImplicitObjectWrapper; } //_.keys @@ -8147,11 +8364,11 @@ declare module _ { keys(object?: any): string[]; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.keys **/ - keys(): LoDashArrayWrapper + keys(): LoDashImplicitArrayWrapper } //_.keysIn @@ -8164,11 +8381,11 @@ declare module _ { keysIn(object?: any): string[]; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.keysIn **/ - keysIn(): LoDashArrayWrapper + keysIn(): LoDashImplicitArrayWrapper } //_.mapKeys @@ -8214,52 +8431,52 @@ declare module _ { ): Dictionary; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.mapKeys */ mapKeys( iteratee?: ListIterator, thisArg?: any - ): LoDashObjectWrapper>; + ): LoDashImplicitObjectWrapper>; /** * @see _.mapKeys */ mapKeys( iteratee?: TObject - ): LoDashObjectWrapper>; + ): LoDashImplicitObjectWrapper>; /** * @see _.mapKeys */ mapKeys( iteratee?: string - ): LoDashObjectWrapper>; + ): LoDashImplicitObjectWrapper>; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.mapKeys */ mapKeys( iteratee?: ListIterator|DictionaryIterator, thisArg?: any - ): LoDashObjectWrapper>; + ): LoDashImplicitObjectWrapper>; /** * @see _.mapKeys */ mapKeys( iteratee?: TObject - ): LoDashObjectWrapper>; + ): LoDashImplicitObjectWrapper>; /** * @see _.mapKeys */ mapKeys( iteratee?: string - ): LoDashObjectWrapper>; + ): LoDashImplicitObjectWrapper>; } //_.mapValues @@ -8289,34 +8506,34 @@ declare module _ { mapValues(obj: T, callback: ObjectIterator, thisArg?: any): T; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.mapValues * TValue is the type of the property values of T. * TResult is the type output by the ObjectIterator function */ - mapValues(callback: ObjectIterator, thisArg?: any): LoDashObjectWrapper>; + mapValues(callback: ObjectIterator, thisArg?: any): LoDashImplicitObjectWrapper>; /** * @see _.mapValues * TResult is the type of the property specified by pluck. * T should be a Dictionary> */ - mapValues(pluck: string): LoDashObjectWrapper>; + mapValues(pluck: string): LoDashImplicitObjectWrapper>; /** * @see _.mapValues * TResult is the type of the properties on the object specified by pluck. * T should be a Dictionary>> */ - mapValues(pluck: string, where: Dictionary): LoDashArrayWrapper>; + mapValues(pluck: string, where: Dictionary): LoDashImplicitArrayWrapper>; /** * @see _.mapValues * TResult is the type of the properties of each object in the values of T * T should be a Dictionary> */ - mapValues(where: Dictionary): LoDashArrayWrapper; + mapValues(where: Dictionary): LoDashImplicitArrayWrapper; } //_.merge @@ -8390,7 +8607,7 @@ declare module _ { ): TResult; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.merge */ @@ -8398,7 +8615,7 @@ declare module _ { source: TSource, customizer?: MergeCustomizer, thisArg?: any - ): LoDashObjectWrapper; + ): LoDashImplicitObjectWrapper; /** * @see _.merge @@ -8408,7 +8625,7 @@ declare module _ { source2: TSource2, customizer?: MergeCustomizer, thisArg?: any - ): LoDashObjectWrapper; + ): LoDashImplicitObjectWrapper; /** * @see _.merge @@ -8419,7 +8636,7 @@ declare module _ { source3: TSource3, customizer?: MergeCustomizer, thisArg?: any - ): LoDashObjectWrapper; + ): LoDashImplicitObjectWrapper; /** * @see _.merge @@ -8431,14 +8648,14 @@ declare module _ { source4: TSource4, customizer?: MergeCustomizer, thisArg?: any - ): LoDashObjectWrapper; + ): LoDashImplicitObjectWrapper; /** * @see _.merge */ merge( ...otherArgs: any[] - ): LoDashObjectWrapper; + ): LoDashImplicitObjectWrapper; } //_.omit @@ -8473,25 +8690,25 @@ declare module _ { thisArg?: any): Omitted; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.omit **/ omit( - ...keys: string[]): LoDashObjectWrapper; + ...keys: string[]): LoDashImplicitObjectWrapper; /** * @see _.omit **/ omit( - keys: string[]): LoDashObjectWrapper; + keys: string[]): LoDashImplicitObjectWrapper; /** * @see _.omit **/ omit( callback: ObjectIterator, - thisArg?: any): LoDashObjectWrapper; + thisArg?: any): LoDashImplicitObjectWrapper; } //_.pairs @@ -8505,11 +8722,11 @@ declare module _ { pairs(object?: any): any[][]; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.pairs **/ - pairs(): LoDashArrayWrapper; + pairs(): LoDashImplicitArrayWrapper; } //_.pick @@ -8541,21 +8758,21 @@ declare module _ { ): TResult; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.pick */ pick( predicate: ObjectIterator, thisArg?: any - ): LoDashObjectWrapper; + ): LoDashImplicitObjectWrapper; /** * @see _.pick */ pick( ...predicate: Array> - ): LoDashObjectWrapper; + ): LoDashImplicitObjectWrapper; } //_.result @@ -8576,7 +8793,7 @@ declare module _ { ): TResult; } - interface LoDashWrapperBase { + interface LoDashImplicitWrapperBase { /** * @see _.result */ @@ -8603,14 +8820,14 @@ declare module _ { ): T; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.set */ set( path: StringRepresentable|StringRepresentable[], value: any - ): LoDashObjectWrapper; + ): LoDashImplicitObjectWrapper; } //_.transform @@ -8665,7 +8882,7 @@ declare module _ { ): TResult[]; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.transform */ @@ -8673,7 +8890,7 @@ declare module _ { iteratee?: MemoVoidArrayIterator, accumulator?: TResult[], thisArg?: any - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; /** * @see _.transform @@ -8682,10 +8899,10 @@ declare module _ { iteratee?: MemoVoidArrayIterator>, accumulator?: Dictionary, thisArg?: any - ): LoDashObjectWrapper>; + ): LoDashImplicitObjectWrapper>; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.transform */ @@ -8693,7 +8910,7 @@ declare module _ { iteratee?: MemoVoidDictionaryIterator>, accumulator?: Dictionary, thisArg?: any - ): LoDashObjectWrapper>; + ): LoDashImplicitObjectWrapper>; /** * @see _.transform @@ -8702,7 +8919,7 @@ declare module _ { iteratee?: MemoVoidDictionaryIterator, accumulator?: TResult[], thisArg?: any - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; } //_.values @@ -8715,11 +8932,11 @@ declare module _ { values(object?: any): T[]; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.values **/ - values(): LoDashObjectWrapper; + values(): LoDashImplicitObjectWrapper; } //_.valuesIn @@ -8732,11 +8949,11 @@ declare module _ { valuesIn(object?: any): T[]; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.valuesIn **/ - valuesIn(): LoDashObjectWrapper; + valuesIn(): LoDashImplicitObjectWrapper; } /********** @@ -8753,7 +8970,7 @@ declare module _ { camelCase(string?: string): string; } - interface LoDashWrapper { + interface LoDashImplicitWrapper { /** * @see _.camelCase */ @@ -8765,7 +8982,7 @@ declare module _ { capitalize(string?: string): string; } - interface LoDashWrapper { + interface LoDashImplicitWrapper { /** * @see _.capitalize */ @@ -8783,7 +9000,7 @@ declare module _ { deburr(string?: string): string; } - interface LoDashWrapper { + interface LoDashImplicitWrapper { /** * @see _.deburr */ @@ -8802,7 +9019,7 @@ declare module _ { endsWith(string?: string, target?: string, position?: number): boolean; } - interface LoDashWrapper { + interface LoDashImplicitWrapper { /** * @see _.endsWith */ @@ -8819,7 +9036,7 @@ declare module _ { escape(string?: string): string; } - interface LoDashWrapper { + interface LoDashImplicitWrapper { /** * @see _.escape */ @@ -8837,7 +9054,7 @@ declare module _ { escapeRegExp(string?: string): string; } - interface LoDashWrapper { + interface LoDashImplicitWrapper { /** * @see _.escapeRegExp */ @@ -8854,7 +9071,7 @@ declare module _ { kebabCase(string?: string): string; } - interface LoDashWrapper { + interface LoDashImplicitWrapper { /** * @see _.kebabCase */ @@ -8873,7 +9090,7 @@ declare module _ { } //_.pad - interface LoDashWrapper { + interface LoDashImplicitWrapper { /** * @see _.pad */ @@ -8894,7 +9111,7 @@ declare module _ { } //_.padLeft - interface LoDashWrapper { + interface LoDashImplicitWrapper { /** * @see _.padLeft */ @@ -8915,7 +9132,7 @@ declare module _ { } //_.padRight - interface LoDashWrapper { + interface LoDashImplicitWrapper { /** * @see _.padRight */ @@ -8935,7 +9152,7 @@ declare module _ { parseInt(string: string, radix?: number): number; } - interface LoDashWrapper { + interface LoDashImplicitWrapper { /** * @see _.parseInt */ @@ -8953,7 +9170,7 @@ declare module _ { repeat(string?: string, n?: number): string; } - interface LoDashWrapper { + interface LoDashImplicitWrapper { /** * @see _.repeat */ @@ -8970,7 +9187,7 @@ declare module _ { snakeCase(string?: string): string; } - interface LoDashWrapper { + interface LoDashImplicitWrapper { /** * @see _.snakeCase */ @@ -8987,7 +9204,7 @@ declare module _ { startCase(string?: string): string; } - interface LoDashWrapper { + interface LoDashImplicitWrapper { /** * @see _.startCase */ @@ -9006,7 +9223,7 @@ declare module _ { startsWith(string?: string, target?: string, position?: number): boolean; } - interface LoDashWrapper { + interface LoDashImplicitWrapper { /** * @see _.startsWith */ @@ -9050,7 +9267,7 @@ declare module _ { options?: TemplateSettings): TemplateExecutor; } - interface LoDashWrapper { + interface LoDashImplicitWrapper { /** * @see _.template */ @@ -9068,7 +9285,7 @@ declare module _ { trim(string?: string, chars?: string): string; } - interface LoDashWrapper { + interface LoDashImplicitWrapper { /** * @see _.trim */ @@ -9086,7 +9303,7 @@ declare module _ { trimLeft(string?: string, chars?: string): string; } - interface LoDashWrapper { + interface LoDashImplicitWrapper { /** * @see _.trimLeft */ @@ -9104,7 +9321,7 @@ declare module _ { trimRight(string?: string, chars?: string): string; } - interface LoDashWrapper { + interface LoDashImplicitWrapper { /** * @see _.trimRight */ @@ -9132,7 +9349,7 @@ declare module _ { trunc(string?: string, options?: TruncOptions|number): string; } - interface LoDashWrapper { + interface LoDashImplicitWrapper { /** * @see _.trunc */ @@ -9150,7 +9367,7 @@ declare module _ { unescape(string?: string): string; } - interface LoDashWrapper { + interface LoDashImplicitWrapper { /** * @see _.unescape */ @@ -9168,7 +9385,7 @@ declare module _ { words(string?: string, pattern?: string|RegExp): string[]; } - interface LoDashWrapper { + interface LoDashImplicitWrapper { /** * @see _.words */ @@ -9190,7 +9407,7 @@ declare module _ { attempt(func: (...args: any[]) => TResult): TResult|Error; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.attempt */ @@ -9236,23 +9453,23 @@ declare module _ { callback(): (value: TResult) => TResult; } - interface LoDashWrapper { + interface LoDashImplicitWrapper { /** * @see _.callback */ - callback(thisArg?: any): LoDashObjectWrapper<(object: any) => TResult>; + callback(thisArg?: any): LoDashImplicitObjectWrapper<(object: any) => TResult>; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.callback */ - callback(thisArg?: any): LoDashObjectWrapper<(object: any) => boolean>; + callback(thisArg?: any): LoDashImplicitObjectWrapper<(object: any) => boolean>; /** * @see _.callback */ - callback(thisArg?: any): LoDashObjectWrapper<(...args: any[]) => TResult>; + callback(thisArg?: any): LoDashImplicitObjectWrapper<(...args: any[]) => TResult>; } //_.identity @@ -9265,21 +9482,21 @@ declare module _ { identity(value?: T): T; } - interface LoDashWrapper { + interface LoDashImplicitWrapper { /** * @see _.identity */ identity(): T; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.identity */ identity(): T[]; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.identity */ @@ -9318,23 +9535,23 @@ declare module _ { iteratee(): (value: TResult) => TResult; } - interface LoDashWrapper { + interface LoDashImplicitWrapper { /** * @see _.callback */ - iteratee(thisArg?: any): LoDashObjectWrapper<(object: any) => TResult>; + iteratee(thisArg?: any): LoDashImplicitObjectWrapper<(object: any) => TResult>; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.callback */ - iteratee(thisArg?: any): LoDashObjectWrapper<(object: any) => boolean>; + iteratee(thisArg?: any): LoDashImplicitObjectWrapper<(object: any) => boolean>; /** * @see _.callback */ - iteratee(thisArg?: any): LoDashObjectWrapper<(...args: any[]) => TResult>; + iteratee(thisArg?: any): LoDashImplicitObjectWrapper<(...args: any[]) => TResult>; } //_.matches @@ -9362,11 +9579,11 @@ declare module _ { ): (value: V) => boolean; } - interface LoDashWrapperBase { + interface LoDashImplicitWrapperBase { /** * @see _.matches */ - matches(): LoDashObjectWrapper<(value: V) => boolean>; + matches(): LoDashImplicitObjectWrapper<(value: V) => boolean>; } //_.matchesProperty @@ -9395,20 +9612,20 @@ declare module _ { ): (value: V) => boolean; } - interface LoDashWrapperBase { + interface LoDashImplicitWrapperBase { /** * @see _.matchesProperty */ matchesProperty( srcValue: SrcValue - ): LoDashObjectWrapper<(value: any) => boolean>; + ): LoDashImplicitObjectWrapper<(value: any) => boolean>; /** * @see _.matchesProperty */ matchesProperty( srcValue: SrcValue - ): LoDashObjectWrapper<(value: Value) => boolean>; + ): LoDashImplicitObjectWrapper<(value: Value) => boolean>; } //_.method @@ -9428,28 +9645,28 @@ declare module _ { method(path: any[], ...args: any[]): (object: any) => TResult; } - interface LoDashWrapper { + interface LoDashImplicitWrapper { /** * @see _.method */ - method(...args: any[]): LoDashWrapper<(object: any) => TResult>; + method(...args: any[]): LoDashImplicitWrapper<(object: any) => TResult>; /** * @see _.method */ - method(...args: any[]): LoDashWrapper<(object: any) => TResult>; + method(...args: any[]): LoDashImplicitWrapper<(object: any) => TResult>; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.method */ - method(...args: any[]): LoDashWrapper<(object: any) => TResult>; + method(...args: any[]): LoDashImplicitWrapper<(object: any) => TResult>; /** * @see _.method */ - method(...args: any[]): LoDashWrapper<(object: any) => TResult>; + method(...args: any[]): LoDashImplicitWrapper<(object: any) => TResult>; } //_.methodOf @@ -9464,11 +9681,11 @@ declare module _ { methodOf(object: Object, ...args: any[]): (path: string | any[]) => TResult; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.methodOf */ - methodOf(...args: any[]): LoDashObjectWrapper<(path: string | any[]) => TResult>; + methodOf(...args: any[]): LoDashImplicitObjectWrapper<(path: string | any[]) => TResult>; } //_.mixin @@ -9505,21 +9722,21 @@ declare module _ { ): TResult; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.mixin */ mixin( source: Dictionary, options?: MixinOptions - ): LoDashObjectWrapper; + ): LoDashImplicitObjectWrapper; /** * @see _.mixin */ mixin( options?: MixinOptions - ): LoDashObjectWrapper; + ): LoDashImplicitObjectWrapper; } //_.noConflict @@ -9532,7 +9749,7 @@ declare module _ { noConflict(): typeof _; } - interface LoDashWrapperBase { + interface LoDashImplicitWrapperBase { /** * @see _.noConflict */ @@ -9548,7 +9765,7 @@ declare module _ { noop(...args: any[]): void; } - interface LoDashWrapperBase { + interface LoDashImplicitWrapperBase { /** * @see _.noop */ @@ -9565,18 +9782,18 @@ declare module _ { property(path: string|string[]): (obj: TObj) => TResult; } - interface LoDashStringWrapper { + interface LoDashImplicitStringWrapper { /** * @see _.property */ - property(): LoDashObjectWrapper<(obj: TObj) => TResult>; + property(): LoDashImplicitObjectWrapper<(obj: TObj) => TResult>; } - interface LoDashArrayWrapper { + interface LoDashImplicitArrayWrapper { /** * @see _.property */ - property(): LoDashObjectWrapper<(obj: TObj) => TResult>; + property(): LoDashImplicitObjectWrapper<(obj: TObj) => TResult>; } //_.propertyOf @@ -9590,11 +9807,11 @@ declare module _ { propertyOf(object: T): (path: string|string[]) => any; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.propertyOf */ - propertyOf(): LoDashObjectWrapper<(path: string|string[]) => any>; + propertyOf(): LoDashImplicitObjectWrapper<(path: string|string[]) => any>; } //_.range @@ -9621,13 +9838,13 @@ declare module _ { step?: number): number[]; } - interface LoDashWrapper { + interface LoDashImplicitWrapper { /** * @see _.range */ range( end?: number, - step?: number): LoDashArrayWrapper; + step?: number): LoDashImplicitArrayWrapper; } //_.runInContext @@ -9641,7 +9858,7 @@ declare module _ { runInContext(context?: Object): typeof _; } - interface LoDashObjectWrapper { + interface LoDashImplicitObjectWrapper { /** * @see _.runInContext */ @@ -9671,19 +9888,19 @@ declare module _ { times(n: number): number[]; } - interface LoDashWrapper { + interface LoDashImplicitWrapper { /** * @see _.times */ times( iteratee: (num: number) => TResult, thisArgs?: any - ): LoDashArrayWrapper; + ): LoDashImplicitArrayWrapper; /** * @see _.times */ - times(): LoDashArrayWrapper; + times(): LoDashImplicitArrayWrapper; } //_.uniqueId @@ -9696,7 +9913,7 @@ declare module _ { uniqueId(prefix?: string): string; } - interface LoDashWrapper { + interface LoDashImplicitWrapper { /** * @see _.uniqueId */ @@ -9713,7 +9930,7 @@ declare module _ { constant(value: T): () => T; } - interface LoDashWrapperBase { + interface LoDashImplicitWrapperBase { /** * @see _.constant */ diff --git a/moment/moment-external-tests.ts b/moment/moment-external-tests.ts index ed3e1e2a8..c8108d1b9 100644 --- a/moment/moment-external-tests.ts +++ b/moment/moment-external-tests.ts @@ -255,6 +255,7 @@ moment.locale('en', { weekdaysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], weekdaysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], longDateFormat: { + LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D YYYY", @@ -376,6 +377,7 @@ moment.locale('en', { moment.locale('en', { longDateFormat : { + LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", l: "M/D/YYYY", @@ -390,6 +392,7 @@ moment.locale('en', { moment.locale('en', { longDateFormat : { + LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM Do YYYY", diff --git a/moment/moment-node.d.ts b/moment/moment-node.d.ts index c67b4f742..babde41c9 100644 --- a/moment/moment-node.d.ts +++ b/moment/moment-node.d.ts @@ -19,7 +19,7 @@ declare module moment { month?: number; /** Month */ M?: number; - + /** Week */ weeks?: number; /** Week */ @@ -346,11 +346,13 @@ declare module moment { LLL: string; LLLL: string; LT: string; + LTS: string; l?: string; ll?: string; lll?: string; llll?: string; lt?: string; + lts?: string; } interface MomentRelativeTime { diff --git a/moment/moment-tests.ts b/moment/moment-tests.ts index 28fedc65e..14e58c612 100644 --- a/moment/moment-tests.ts +++ b/moment/moment-tests.ts @@ -266,6 +266,7 @@ moment.locale('en', { weekdaysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], weekdaysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], longDateFormat: { + LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D YYYY", @@ -387,6 +388,7 @@ moment.locale('en', { moment.locale('en', { longDateFormat : { + LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", l: "M/D/YYYY", @@ -401,6 +403,7 @@ moment.locale('en', { moment.locale('en', { longDateFormat : { + LTS: "h:mm A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM Do YYYY", diff --git a/mongodb/mongodb.d.ts b/mongodb/mongodb.d.ts index 2fc3f0227..38037f003 100644 --- a/mongodb/mongodb.d.ts +++ b/mongodb/mongodb.d.ts @@ -127,6 +127,14 @@ declare module "mongodb" { // Creates an ObjectID from a hex string representation of an ObjectID. // hexString – create a ObjectID from a passed in 24 byte hexstring. public static createFromHexString(hexString: string): ObjectID; + + // Checks if a value is a valid bson ObjectId + // id - Value to be checked + public static isValid(id: string): Boolean; + + // Generate a 12 byte id string used in ObjectID's + // time - optional parameter allowing to pass in a second based timestamp + public generate(time?: number): string; } // Class documentation : http://mongodb.github.io/node-mongodb-native/api-bson-generated/binary.html diff --git a/polymer/polymer.d.ts b/polymer/polymer.d.ts index 9117301af..c346de8b3 100644 --- a/polymer/polymer.d.ts +++ b/polymer/polymer.d.ts @@ -1,4 +1,4 @@ -// Type definitions for polymer v1.1.2 +// Type definitions for polymer v1.1.5 // Project: https://github.com/Polymer/polymer // Definitions by: Louis Grignon , Suguru Inatomi // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -161,7 +161,7 @@ declare module polymer { getContentChildren?(selector: string): HTMLElement[]; - fire?(type: string, detail?: Object, options?: Object): CustomEvent; + fire?(type: string, detail?: any, options?: Object): CustomEvent; async?(callback: ()=>void, waitTime?: number): number; @@ -177,6 +177,10 @@ declare module polymer { create?(tag: string, props: Object): Element; + isLightDescendant?(node: HTMLElement): boolean; + + isLocalDescendant?(node: HTMLElement): boolean + // XStyling updateStyles?(): void; diff --git a/react-redux/react-redux-tests.tsx b/react-redux/react-redux-tests.tsx index 9bd662295..abbacabef 100644 --- a/react-redux/react-redux-tests.tsx +++ b/react-redux/react-redux-tests.tsx @@ -4,7 +4,7 @@ /// /// -import { Component } from 'react'; +import { Component, ReactElement } from 'react'; import * as React from 'react'; import * as Router from 'react-router'; import { Route, RouterState } from 'react-router'; @@ -23,13 +23,13 @@ interface CounterState { declare var increment: Function; class Counter extends Component { - render() { - return ( - - ); - } + render() { + return ( + + ); + } } function mapStateToProps(state: CounterState) { @@ -242,3 +242,37 @@ connect(mapStateToProps2, actionCreators, mergeProps)(TodoApp); + + +interface TestProp { + property1: number; + someOtherProperty?: string; +} +interface TestState { + isLoaded: boolean; + state1: number; +} +class TestComponent extends Component { } +const WrappedTestComponent = connect()(TestComponent); + +// return value of the connect()(TestComponent) is of the type TestComponent +let ATestComponent: typeof TestComponent = null; +ATestComponent = TestComponent; +ATestComponent = WrappedTestComponent; + +let anElement: ReactElement; +; +; +; + +class NonComponent {} +// this doesn't compile +//connect()(NonComponent); + +// connect()(SomeClass) has the same constructor as SomeClass itself +class SomeClass extends Component { + constructor(public foo: string) { super() } + public bar: number; +} +let bar: number = new (connect()(SomeClass))("foo").bar; + diff --git a/react-redux/react-redux.d.ts b/react-redux/react-redux.d.ts index f1ef5458e..767b6b109 100644 --- a/react-redux/react-redux.d.ts +++ b/react-redux/react-redux.d.ts @@ -10,8 +10,9 @@ declare module "react-redux" { import { Component } from 'react'; import { Store, Dispatch, ActionCreator } from 'redux'; + export class ElementClass extends Component { } export interface ClassDecorator { - (target: TFunction): TFunction|void; + (component: T): T } /** diff --git a/reflux/reflux-tests.ts b/reflux/reflux-tests.ts new file mode 100644 index 000000000..afebd1a81 --- /dev/null +++ b/reflux/reflux-tests.ts @@ -0,0 +1,59 @@ +/// +/// + +import Reflux = require("reflux"); +import React = require("react"); + +var syncActions = Reflux.createActions([ + "statusUpdate", + "statusEdited", + "statusAdded" +]); + + +var asyncActions = Reflux.createActions({ + fireBall: {asyncResult: true} +}); + +asyncActions.fireBall.listen(function () { + // Trigger async action + setTimeout(() => this.completed(true), 1000); +}); + + +// Creates a DataStore +var statusStore = Reflux.createStore({ + + // Initial setup + init: function () { + + // Register statusUpdate action + this.listenTo(asyncActions.fireBall, this.onFireBall); + }, + // Callback + onFireBall: function (flag: boolean) { + var status = flag ? 'ONLINE' : 'OFFLINE'; + + // Pass on to listeners + this.trigger(status); + } +}); + +Reflux.createAction({ + children: ["progressed", "completed", "failed"] +}); + + +var actions = Reflux.createActions(["fireBall", "magicMissile"]); + +var Store = Reflux.createStore({ + init: function () { + this.listenToMany(actions); + }, + onFireBall: function () { + // whoooosh! + }, + onMagicMissile: function () { + // bzzzzapp! + } +}); diff --git a/reflux/reflux.d.ts b/reflux/reflux.d.ts new file mode 100644 index 000000000..035bca7f3 --- /dev/null +++ b/reflux/reflux.d.ts @@ -0,0 +1,62 @@ +// Type definitions for RefluxJS +// Project: https://github.com/reflux/refluxjs +// Definitions by: Maurice de Beijer +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module RefluxCore { + + interface StoreDefinition { + listenables?: any[], + init?: Function, + getInitialState?: Function, + [propertyName: string]: any; + } + + interface ListenFn { + (...params: any[]):any, + completed: Function, + failed: Function + } + interface Listenable { + listen: ListenFn + } + + interface Subscription { + stop: Function, + listenable: Listenable + } + + interface Store { + hasListener(listenable: Listenable): boolean, + listenToMany(listenables: Listenable[]): void, + validateListening(listenable: Listenable): string, + listenTo(listenable: Listenable, callback: Function, defaultCallback?: Function): Subscription, + stopListeningTo(listenable: Listenable): boolean, + stopListeningToAll(): void, + fetchInitialState(listenable: Listenable, defaultCallback: Function): void, + trigger(state: any):void; + } + + interface ActionsDefinition { + [index: string]:any + } + + interface Actions { + [index: string]: Listenable + } + + function createStore(definition: StoreDefinition): Store; + + function createAction(definition: ActionsDefinition): any; + + function createActions(definition: ActionsDefinition): any; + function createActions(definitions: string[]): any; + + function listenTo(store: Store, handler: string):void; + function setState(state: any):void; +} + +declare module "reflux" { + export = RefluxCore; +} + diff --git a/request/request.d.ts b/request/request.d.ts index 4827bc7a6..d3bbd5704 100644 --- a/request/request.d.ts +++ b/request/request.d.ts @@ -79,7 +79,7 @@ declare module 'request' { method?: string; headers?: Headers; body?: any; - followRedirect?: boolean; + followRedirect?: boolean|((response: http.IncomingMessage) => boolean); followAllRedirects?: boolean; maxRedirects?: number; encoding?: string; diff --git a/requirejs/require.d.ts b/requirejs/require.d.ts index 39c4c3419..22d9f2de2 100644 --- a/requirejs/require.d.ts +++ b/requirejs/require.d.ts @@ -1,4 +1,4 @@ -// Type definitions for RequireJS 2.1.8 +// Type definitions for RequireJS 2.1.20 // Project: http://requirejs.org/ // Definitions by: Josh Baldwin // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -88,6 +88,10 @@ interface RequireConfig { // baseUrl. paths?: { [key: string]: any; }; + // Allows configuring multiple module IDs to be found in + // another script. + bundles?: { [key: string]: any; }; + // Dictionary of Shim's. // does not cover case of key->string[] shim?: { [key: string]: RequireShim; }; @@ -195,6 +199,20 @@ interface RequireConfig { **/ scriptType?: string; + /** + * If set to true, skips the data-main attribute scanning done + * to start module loading. Useful if RequireJS is embedded in + * a utility library that may interact with other RequireJS + * library on the page, and the embedded version should not do + * data-main loading. + **/ + skipDataMain?: boolean; + + /** + * Allow extending requirejs to support Subresource Integrity + * (SRI). + **/ + onNodeCreated?: (node: HTMLScriptElement, config: RequireConfig, moduleName: string, url: string) => void; } // todo: not sure what to do with this guy diff --git a/roslib/roslib.d.ts b/roslib/roslib.d.ts index 667a37983..8610ea7d4 100644 --- a/roslib/roslib.d.ts +++ b/roslib/roslib.d.ts @@ -3,22 +3,373 @@ // Definitions by: Stefan Profanter // Definitions: https://github.com/borisyankov/DefinitelyTyped + +/* ---------------------------------- + + NOTE: This typescript definition is not yet complete. I should be extended if definitions are missing. + + ---------------------------------- */ + declare module ROSLIB { export class Ros { - constructor(data: { - url: string + /** + * Manages connection to the server and all interactions with ROS. + * + * Emits the following events: + * * 'error' - there was an error with ROS + * * 'connection' - connected to the WebSocket server + * * 'close' - disconnected to the WebSocket server + * * - a message came from rosbridge with the given topic name + * * - a service response came from rosbridge with the given ID + * + * @constructor + * @param options - possible keys include: + * * url (optional) - the WebSocket URL for rosbridge (can be specified later with `connect`) + */ + constructor(options:{ + url?: string }); - on(eventName: string, callback: (event: any) => void) : void; - connect(url: string) : void; + on(eventName:string, callback:(event:any) => void):void; + + /** + * Connect to the specified WebSocket. + * + * @param url - WebSocket URL for Rosbridge + */ + connect(url:string):void; + + /** + * Disconnect from the WebSocket server. + */ + close():void; + + /** + * Sends an authorization request to the server. + * + * @param mac - MAC (hash) string given by the trusted source. + * @param client - IP of the client. + * @param dest - IP of the destination. + * @param rand - Random string given by the trusted source. + * @param t - Time of the authorization request. + * @param level - User level as a string given by the client. + * @param end - End time of the client's session. + */ + authenticate(mac:string, client:string, dest:string, rand:string, t:number, level:string, end:string): void; + + + /** + * Sends the message over the WebSocket, but queues the message up if not yet + * connected. + */ + callOnConnection(message:any): void; + + /** + * Retrieves list of topics in ROS as an array. + * + * @param callback function with params: + * * topics - Array of topic names + */ + getTopics(callback:(topics:string[]) => void, failedCallback:(error:any)=>void): void; + + /** + * Retrieves Topics in ROS as an array as specific type + * + * @param topicType topic type to find: + * @param callback function with params: + * * topics - Array of topic names + */ + getTopicsForType(topicType:string, callback:(topics:string[]) => void, failedCallback:(error:any)=>void): void; + + /** + * Retrieves list of active service names in ROS. + * + * @param callback - function with the following params: + * * services - array of service names + */ + getServices(callback:(services:string[]) => void, failedCallback:(error:any)=>void): void; + + /** + * Retrieves list of services in ROS as an array as specific type + * + * @param serviceType service type to find: + * @param callback function with params: + * * topics - Array of service names + */ + getServicesForType(serviceType: string, callback:(services:string[]) => void, failedCallback:(error:any)=>void): void; + + /** + * Retrieves list of active node names in ROS. + * + * @param callback - function with the following params: + * * nodes - array of node names + */ + getNodes(callback:(nodes:string[]) => void, failedCallback:(error:any)=>void): void; + + /** + * Retrieves list of param names from the ROS Parameter Server. + * + * @param callback function with params: + * * params - array of param names. + */ + getParams(callback:(params:string[]) => void, failedCallback:(error:any)=>void): void; + + /** + * Retrieves a type of ROS topic. + * + * @param topic name of the topic: + * @param callback - function with params: + * * type - String of the topic type + */ + getTopicType(topic: string, callback:(type:string) => void, failedCallback:(error:any)=>void): void; + + /** + * Retrieves a type of ROS service. + * + * @param service name of service: + * @param callback - function with params: + * * type - String of the service type + */ + getServiceType(service: string, callback:(type:string) => void, failedCallback:(error:any)=>void): void; + + /** + * Retrieves a detail of ROS message. + * + * @param callback - function with params: + * * details - Array of the message detail + * @param message - String of a topic type + */ + getMessageDetails(message: Message, callback:(detail:any) => void, failedCallback:(error:any)=>void): void; + + /** + * Decode a typedefs into a dictionary like `rosmsg show foo/bar` + * + * @param defs - array of type_def dictionary + */ + decodeTypeDefs(defs: any): void; + } + + export class Message { + /** + * Message objects are used for publishing and subscribing to and from topics. + * + * @constructor + * @param values - object matching the fields defined in the .msg definition file + */ + constructor(values:any); + } + + export class Param { + /** + * A ROS parameter. + * + * @constructor + * @param options - possible keys include: + * * ros - the ROSLIB.Ros connection handle + * * name - the param name, like max_vel_x + */ + constructor(options:{ + ros: Ros, + name: string + }); + + /** + * Fetches the value of the param. + * + * @param callback - function with the following params: + * * value - the value of the param from ROS. + */ + get(callback:(response:any) => void): void; + + /** + * Sets the value of the param in ROS. + * + * @param value - value to set param to. + */ + set(value:any, callback:(response:any) => void): void; + + /** + * Delete this parameter on the ROS server. + */ + delete(callback:(response:any) => void): void; + } export class Service { - constructor(data: { + /** + * A ROS service client. + * + * @constructor + * @params options - possible keys include: + * * ros - the ROSLIB.Ros connection handle + * * name - the service name, like /add_two_ints + * * serviceType - the service type, like 'rospy_tutorials/AddTwoInts' + */ + constructor(data:{ ros: Ros, name: string, serviceType: string }); + + /** + * Calls the service. Returns the service response in the callback. + * + * @param request - the ROSLIB.ServiceRequest to send + * @param callback - function with params: + * * response - the response from the service request + * @param failedCallback - the callback function when the service call failed (optional). Params: + * * error - the error message reported by ROS + */ + callService(request:ServiceRequest, callback:(response:any) => void, failedCallback?:(error:any) => void): void; + } + + export class ServiceRequest { + /** + * A ServiceRequest is passed into the service call. + * + * @constructor + * @param values - object matching the fields defined in the .srv definition file + */ + constructor(values?: any); + } + + export class ServiceResponse { + /** + * A ServiceResponse is returned from the service call. + * + * @constructor + * @param values - object matching the fields defined in the .srv definition file + */ + constructor(values?: any); + } + + export class Topic { + /** + * Publish and/or subscribe to a topic in ROS. + * + * Emits the following events: + * * 'warning' - if there are any warning during the Topic creation + * * 'message' - the message data from rosbridge + * + * @constructor + * @param options - object with following keys: + * * ros - the ROSLIB.Ros connection handle + * * name - the topic name, like /cmd_vel + * * messageType - the message type, like 'std_msgs/String' + * * compression - the type of compression to use, like 'png' + * * throttle_rate - the rate (in ms in between messages) at which to throttle the topics + * * queue_size - the queue created at bridge side for re-publishing webtopics (defaults to 100) + * * latch - latch the topic when publishing + * * queue_length - the queue length at bridge side used when subscribing (defaults to 0, no queueing). + */ + constructor(options: { + ros: Ros, + name: string, + messageType: string, + compression: string, + throttle_rate: number, + queue_size: number, + latch: number, + queue_length: number + }); + + /** + * Every time a message is published for the given topic, the callback + * will be called with the message object. + * + * @param callback - function with the following params: + * * message - the published message + */ + subscribe(callback: (message: Message) => void): void; + + /** + * Unregisters as a subscriber for the topic. Unsubscribing stop remove + * all subscribe callbacks. To remove a call back, you must explicitly + * pass the callback function in. + * + * @param callback - the optional callback to unregister, if + * * provided and other listeners are registered the topic won't + * * unsubscribe, just stop emitting to the passed listener + */ + unsubscribe(callback?: () => void): void; + + /** + * Registers as a publisher for the topic. + */ + advertise(): void; + + /** + * Unregisters as a publisher for the topic. + */ + unadvertise(): void; + + /** + * Publish the message. + * + * @param message - A ROSLIB.Message object. + */ + publish(message: Message): void; + } + + class ActionClient { + /** + * An actionlib action client. + * + * Emits the following events: + * * 'timeout' - if a timeout occurred while sending a goal + * * 'status' - the status messages received from the action server + * * 'feedback' - the feedback messages received from the action server + * * 'result' - the result returned from the action server + * + * @constructor + * @param options - object with following keys: + * * ros - the ROSLIB.Ros connection handle + * * serverName - the action server name, like /fibonacci + * * actionName - the action message name, like 'actionlib_tutorials/FibonacciAction' + * * timeout - the timeout length when connecting to the action server + */ + constructor(options: { + ros: Ros, + serverName: string, + actionName: string, + timeout: number + }); + + /** + * Cancel all goals associated with this ActionClient. + */ + cancel(): void; + } + + class Goal { + /** + * An actionlib goal goal is associated with an action server. + * + * Emits the following events: + * * 'timeout' - if a timeout occurred while sending a goal + * + * @constructor + * @param object with following keys: + * * actionClient - the ROSLIB.ActionClient to use with this goal + * * goalMessage - The JSON object containing the goal for the action server + */ + constructor(options: { + actionClient: ActionClient, + goalMessage: any + }); + + /** + * Send the goal to the action server. + * + * @param timeout (optional) - a timeout length for the goal's result + */ + send(timeout?: number): void; + + /** + * Cancel the current goal. + */ + cancel(): void; } } + diff --git a/select2/select2.d.ts b/select2/select2.d.ts index aa2c4a467..0752ddf98 100644 --- a/select2/select2.d.ts +++ b/select2/select2.d.ts @@ -72,6 +72,11 @@ interface Select2Options { dropdownCssClass?: any; escapeMarkup?: (markup: string) => string; theme?: string; + /** + * Template can return both plain string that will be HTML escaped and a jquery object that can render HTML + */ + templateSelection?: (object: Select2SelectionObject) => any; + templateResult?: (object: Select2SelectionObject) => any; } interface Select2JQueryEventObject extends JQueryEventObject { @@ -84,6 +89,15 @@ interface Select2JQueryEventObject extends JQueryEventObject { }; } +interface Select2SelectionObject { + disabled: boolean, + element: HTMLOptionElement, + id: string, + selected: boolean, + text: string, + title: string, +} + interface JQuery { off(events?: "change", selector?: any, handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; diff --git a/simplestorage.js/simplestorage.js-tests.ts b/simplestorage.js/simplestorage.js-tests.ts new file mode 100644 index 000000000..1e9f4202a --- /dev/null +++ b/simplestorage.js/simplestorage.js-tests.ts @@ -0,0 +1,17 @@ +/// + +var versionTest: string = simpleStorage.version; +var canUseTest: boolean = simpleStorage.canUse(); +var simpleStorageTest1: boolean|Error = simpleStorage.set("string", 7); +var simpleStorageTest2: boolean|Error = simpleStorage.set("string", 7, {}); +var simpleStorageTest3: boolean|Error = simpleStorage.set("string", 7, { TTL: 7 }); +var simpleStorageTest4: boolean|Error = simpleStorage.set("string", undefined); +var simpleStorageTest5: boolean|Error = simpleStorage.set("string", undefined, {}); +var simpleStorageTest6: boolean|Error = simpleStorage.set("string", undefined, { TTL: 7 }); +var getTest: any = simpleStorage.get("string"); +var deleteKeyTest: boolean|Error = simpleStorage.deleteKey("string"); +var setTTLTest: boolean|Error = simpleStorage.setTTL("string", 7); +var getTTLTest: number|boolean = simpleStorage.getTTL("string"); +var flushTest: boolean|Error = simpleStorage.flush(); +var indexTest: [string]|boolean = simpleStorage.index(); +var storageSizeTest: number = simpleStorage.storageSize(); diff --git a/simplestorage.js/simplestorage.js.d.ts b/simplestorage.js/simplestorage.js.d.ts new file mode 100644 index 000000000..bda285aac --- /dev/null +++ b/simplestorage.js/simplestorage.js.d.ts @@ -0,0 +1,110 @@ +// Type definitions for simpleStorage v0.1.3 +// Project: https://github.com/andris9/simpleStorage +// Definitions by: Áxel Costas Pena +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module simplestoragejs { + + /** + * {@link simpleStorage} API is a subset of {@link http://www.jstorage.info/|jStorage} with slight modifications, so for most cases it should work out of the box if you are converting from {@link http://www.jstorage.info/|jStorage}. Main difference is between return values - if an action failed because of an error (storage full, storage not available, invalid data used etc.), you get the error object as the return value. {@link http://www.jstorage.info/|jStorage} never indicated anything if an error occurred. + * @see https://github.com/andris9/simpleStorage#usage + */ + export interface SimpleStorage { + + version: string; + + /** + * Check if local storage can be used. + * Returns true if storage is available. + * @see https://github.com/andris9/simpleStorage#canuse + */ + canUse(): boolean; + + /** + * Store or update a value in local storage. + * Returns true if value was stored, false if value was not stored or {@link Error} object if value was not stored because of an error. + * @param key The key for the value. + * @param value Value to be stored (can be any JSONeable value). + * @param [options] Optional options object. + * @see https://github.com/andris9/simpleStorage#setkey-value-options + */ + set(key: string, value: any, options?: SetOptions): boolean|Error; + + /** + * Retrieve a value from local storage. + * Returns the value for a key or undefined if the key was not found. + * @param key The key to be retrieved. + * @see https://github.com/andris9/simpleStorage#getkey + */ + get(key: string): any; + + /** + * Removes a value from local storage. + * Returns true if the value was deleted, false if the value was not found or {@link Error} object if value was not deleted because of an error. + * @param key The key to be deleted. + * @see https://github.com/andris9/simpleStorage#deletekeykey + */ + deleteKey(key: string): boolean|Error; + + /** + * Set a millisecond timeout. When the timeout is reached, the key is removed automatically from local storage. + * Returns true if ttl was set, false if value was not found or {@link Error} object if ttl was not set because of an error. + * @param key The key to be updated. + * @param ttl Timeout in milliseconds. If the value is 0, timeout is cleared from the key. + * @see https://github.com/andris9/simpleStorage#setttlkey-ttl + */ + setTTL(key: string, ttl: number): boolean|Error; + + /** + * Retrieve remaining milliseconds for a key with TTL. + * Returns the finite number of remaining milliseconds, Infinity if TTL is not set for the selected key or false if the selected key does not exist or is expired. + * @param key The key to be checked. + * @see https://github.com/andris9/simpleStorage#getttlkey + */ + getTTL(key: string): number|boolean; + + /** + * Clear all values. + * Returns true if storage was flushed or {@link Error} object if storage was not flushed because of an error. + * @see https://github.com/andris9/simpleStorage#flush + */ + flush(): boolean|Error; + + /** + * Retrieve all used keys as an array. + * Returns an array of keys. + * @see https://github.com/andris9/simpleStorage#index + */ + index(): [string]|boolean; + + /** + * Get used storage in symbol count. + * @see https://github.com/andris9/simpleStorage#storagesize + */ + storageSize(): number; + } + + /** + * @see https://github.com/andris9/simpleStorage#setkey-value-options + */ + export interface SetOptions { + /** + * Sets the time-to-live (TTL) value in milliseconds for the given key/value. + */ + TTL?: number; + } + +} + +declare module "simpleStorage" { + export = simpleStorage; +} + +/** + * Cross-browser key-value store database to store data locally in the browser. + * {@link simpleStorage} is a fork of {@link http://www.jstorage.info/|jStorage} that only includes the minimal set of features. Basically it is a wrapper for native {@link JSON} + {@link WindowLocalStorage.localStorage|localStorage} with some TTL magic mixed in. + * The module has no dependencies, you can use it as a standalone script (introduces {@link simpleStorage} global) or as an AMD module. All modern browsers (including mobile) are supported, older browsers (IE7, Firefox 3) are not. + * {@link simpleStorage} is very small - about 1kB in size when minimized and gzipped. + * @see https://github.com/andris9/simpleStorage#simplestorage + */ +declare var simpleStorage:simplestoragejs.SimpleStorage; diff --git a/ui-grid/ui-grid.d.ts b/ui-grid/ui-grid.d.ts index ef013fdf1..b4ac33934 100644 --- a/ui-grid/ui-grid.d.ts +++ b/ui-grid/ui-grid.d.ts @@ -1038,6 +1038,12 @@ declare module uiGrid { * @param {scrollEndHandler} handler callback */ scrollEnd: (scope: ng.IScope, handler: scrollEndHandler) => void; + /** + * is raised after the sort criteria on one or more columns have changed + * @param {ng.IScope} scope Grid scope + * @param {sortChangedHandler} handler callback + */ + sortChanged: (scope: ng.IScope, handler: sortChangedHandler) => void; } } export interface columnVisibilityChangedHandler { @@ -1096,6 +1102,15 @@ declare module uiGrid { (scrollEvent: JQueryMouseEventObject): void; } + export interface sortChangedHandler { + /** + * Sort change event callback + * @param {IGridInstance} grid instance + * @param {IGridColumn} array of gridColumns that have sorting on them, sorted in priority order + */ + (grid: IGridInstanceOf, columns: Array>): void; + } + export module cellNav { /** * Column Definitions for cellNav feature, these are available to be set using the ui-grid diff --git a/uikit/.gitignore b/uikit/.gitignore new file mode 100644 index 000000000..7c794a353 --- /dev/null +++ b/uikit/.gitignore @@ -0,0 +1,2 @@ +tsconfig.json +.idea/ \ No newline at end of file diff --git a/uikit/README.md b/uikit/README.md new file mode 100644 index 000000000..76015e346 --- /dev/null +++ b/uikit/README.md @@ -0,0 +1,88 @@ +# UIkit + +UIkit is a lightweight and modular front-end framework for developing fast and powerful web interfaces. + +* [Homepage](http://getuikit.com) - Learn more about UIkit +* [@getuikit](https://twitter.com/getuikit) - Get the latest buzz on Twitter +* [Google+ Community](https://plus.google.com/communities/114238665434626719878) - Share news and latest work + +Join our developer chat. We are online every work day between 8:00 and 18:00 UTC + +[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/uikit/uikit) + +## Getting started + +You have following options to get UIkit: + +- Download the [latest release](https://github.com/uikit/uikit/releases/latest) +- Clone the repo, `git clone git://github.com/uikit/uikit.git`. +- Install with [Bower](http://bower.io): ```bower install uikit``` + +You find the compiled UIkit distribution in its own [repo](https://github.com/uikit/bower-uikit). + +## Developers + +First of all, install [Node](http://nodejs.org/). We use [Gulp](http://gulpjs.com) to build UIkit. If you haven't used Gulp before, you need to install the `gulp` package as a global install. + +``` +npm install --global gulp +``` + +If you haven't done so already, clone the UIkit git repo. + +``` +git clone git://github.com/uikit/uikit.git +``` +Install the Node dependencies. + +``` +cd uikit +npm install +``` + +Run `gulp` to lint, build and minify the release. + +``` +gulp [-t themename] +``` + +The built version of UIkit will be put in the `/dist` subdirectory. Pass a theme name parameter to only build the specified theme. + +### Browsersync + +``` +gulp sync +``` + +After running `gulp sync` a new browser instance will open, pointing to the uikit folder - `http://localhost:3000/`. The browser window will reload anytime you modify a source file. + +### Custom prefix + +Run gulp with your own prefix parameter ```-p``` to have all classes and JavaScript files custom prefixed. + +``` +gulp -p myprefix +``` + + +## Contributing + +UIkit follows the [GitFlow branching model](http://nvie.com/posts/a-successful-git-branching-model). The ```master``` branch always reflects a production-ready state while the latest development is taking place in the ```develop``` branch. + +Each time you want to work on a fix or a new feature, create a new branch based on the ```develop``` branch: ```git checkout -b BRANCH_NAME develop```. Only pull requests to the ```develop``` branch will be merged. + +## Versioning + +UIkit is maintained by using the [Semantic Versioning Specification (SemVer)](http://semver.org). + +## Browser Support + +![Chrome](https://raw.github.com/alrra/browser-logos/master/chrome/chrome_48x48.png) | ![Firefox](https://raw.github.com/alrra/browser-logos/master/firefox/firefox_48x48.png) | ![IE](https://raw.github.com/alrra/browser-logos/master/internet-explorer/internet-explorer_48x48.png) | ![Safari](https://raw.github.com/alrra/browser-logos/master/safari/safari_48x48.png) | ![Opera](https://raw.github.com/alrra/browser-logos/master/opera/opera_48x48.png) +--- | --- | --- | --- | --- | +Latest ✔ | Latest ✔ | 9+ ✔ | 7.1+ ✔ | Latest ✔ | + +Tested with [BrowserStack](https://www.browserstack.com) (thanks for sponsoring!). + +## Copyright and License + +Copyright [YOOtheme](http://www.yootheme.com) GmbH under the [MIT license](LICENSE.md). diff --git a/uikit/uikit-tests.ts b/uikit/uikit-tests.ts new file mode 100644 index 000000000..8bc1f7b63 --- /dev/null +++ b/uikit/uikit-tests.ts @@ -0,0 +1,186 @@ +/// + +function testModal() { + UIkit.modal.alert("Attention!"); + UIkit.modal.confirm("Are you sure?", function () { + // will be executed on confirm. + }); + UIkit.modal.prompt("Name:", 'value', function (newvalue:string) { + // will be executed on submit. + }); + var modal = UIkit.modal.blockUI("Any content..."); + modal.hide(); + modal.show(); + var modal = UIkit.modal(".modalSelector"); + + if (modal.isActive()) { + modal.hide(); + } else { + modal.show(); + } +} + +function testOffCanvas() { + UIkit.offcanvas.show("#id"); + UIkit.offcanvas.hide(); + UIkit.offcanvas.hide(true); +} + +function testLightBox() { + var element = "#group"; + var lightbox = UIkit.lightbox(element, {/* options */}); + var lightbox2 = UIkit.lightbox.create([ + {source: 'http://url/to/video.mp4', 'type': 'video'}, + {'source': 'http://url/to/image.jpg', 'type': 'image'} + ]); + lightbox2.show(); + var lightbox3 = UIkit.lightbox(element) +} + +function testAutoComplete() { + UIkit.autocomplete("#group", {}); + UIkit.autocomplete("#group"); +} + +function testDatepicker() { + var datepicker = UIkit.datepicker("#element", {}); +} + +function testHtmlEditor() { + var htmleditor = UIkit.htmleditor("textarea", {/* options */}); +} + +function testSlider() { + var slider = UIkit.slider("element", {}) +} +function testSlideSet() { + var slideset = UIkit.slideset("element", {}) +} +function testSlideShow() { + var slideshow = UIkit.slideshow("element", {}) +} + +function testParallax() { + var parallax = UIkit.parallax("element", {}) +} +function testAccordion() { + var accordion = UIkit.accordion("element", {}) +} + + +function testNotify() { + UIkit.notify({ + message: 'Bazinga!', + status: 'info', + timeout: 5000, + pos: 'top-center' + }); + + +// Shortcuts + UIkit.notify('My message'); + UIkit.notify('My message', status); + UIkit.notify('My message', {/* options */}); + + UIkit.notify("Message...", {timeout: 0}); + UIkit.notify("...", {pos: 'top-center'}); + UIkit.notify("...", {status: 'info'}); +} + + +function testSearch() { + var search = UIkit.search("element", {}) +} + +function testNestable() { + var nestable = UIkit.nestable('element', {}); +} +function testSortable() { + var sortable = UIkit.sortable('element', {}); +} +function testStick() { + var sticky = UIkit.sticky('element', {}); +} +function testTimePicker() { + var timepicker = UIkit.timepicker('element', {}) +} + +function testTooltip() { + var tooltip = UIkit.tooltip('element', {}) +} + +function testUpload() { + $(function(){ + + var progressbar = $("#progressbar"), + bar = progressbar.find('.uk-progress-bar'), + settings = { + + action: '/', // upload url + + allow : '*.(jpg|jpeg|gif|png)', // allow only images + + loadstart: function() { + bar.css("width", "0%").text("0%"); + progressbar.removeClass("uk-hidden"); + }, + + progress: function(percent: number) { + percent = Math.ceil(percent); + bar.css("width", percent+"%").text(percent+"%"); + }, + + allcomplete: function(response: any) { + + bar.css("width", "100%").text("100%"); + + setTimeout(function(){ + progressbar.addClass("uk-hidden"); + }, 250); + + alert("Upload Completed") + } + }; + + var select = UIkit.uploadSelect($("#upload-select"), settings), + drop = UIkit.uploadDrop($("#upload-drop"), settings); + }); + + // Test with object literal + var select2 = UIkit.uploadSelect($("#upload-select"), { + + action: '/', // upload url + + allow: '*.(jpg|jpeg|gif|png)', // allow only images + + loadstart: function () { + + }, + + progress: function (percent:number) { + + }, + + allcomplete: function (response:any) { + + } + }); + var drop2 = UIkit.uploadDrop($("#upload-drop"), { + + action: '/', // upload url + + allow: '*.(jpg|jpeg|gif|png)', // allow only images + + loadstart: function () { + + }, + + progress: function (percent:number) { + + }, + + allcomplete: function (response:any) { + } + }); + +} diff --git a/uikit/uikit.d.ts b/uikit/uikit.d.ts new file mode 100644 index 000000000..f1ddfe9a5 --- /dev/null +++ b/uikit/uikit.d.ts @@ -0,0 +1,1443 @@ +// Type definitions for uikit 2.23.0 +// Project: http://getuikit.org +// Definitions by: Giovanni Silva +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module UIkit { + interface ModalElement { + /** + * Show the modal + */ + show(): void + /** + * Hide the modal + */ + hide(): void + /** + * Return if the modal is active on the page + * @return {boolean} True if the modal is current active on the page, false otherwise + */ + isActive(): boolean + } + /** + * Create modal dialogs with different styles and transitions + * Documentation: {@link http://getuikit.org/docs/modal.html} + * + *

Events

+ * + * + * + * + * + * + * + + * + * + * + * + * + * + * + * + * + * + *
NameParameterDescription
show.uk.modaleventOn modal show
hide.uk.modaleventOn modal hide
+ * @example + *

+     * $('.modalSelector').on({
+	 *
+	 *	'show.uk.modal': function(){
+	 *    console.log("Modal is visible.");
+	 *	},
+	 *
+	 *   'hide.uk.modal': function(){
+	 *    console.log("Element is not visible.");
+	 *  }
+	 *	});
+     * 
+ */ + interface Modal { + /** + * Create a alert dialog + * @param {string} message The message to display. Can be Html + */ + alert(message:string): void + /** + * Create a confirm dialog and execute the function on positive confirmation + * @param {string} message The message to display. Can be Html + * @param {function} fn A function to execute on confirmation + */ + confirm(message:string, fn:() => any): void + /** + * Create a prompt dialog, where the user enter information + * @param {string} message The message to display. Can be Html + * @param {function} fn A function to execute on confirmation. The function + * receive the new value as a parameter + */ + prompt(message:string, fn:(newValue:string) => any): void + /** + * Create a prompt dialog, where the user enter information + * @param {string} message The message to display. Can be Html + * @param {string} value A value to init the input + * @param {function} fn A function to execute on confirmation. The function + * receive the new value as a parameter + */ + prompt(message:string, value:string, fn:(newValue:string) => any): void + /** + * Create a modal that blocks the entire page + * @param {string} content A content to display. Can be Html + */ + blockUI(content:string): ModalElement + /** + * Select a modal element on page and return it. + * @example + *

+         * var modal = UIkit.modal(".modalSelector");
+         *
+         * if ( modal.isActive() ) {
+	     *   modal.hide();
+	     *   } else {
+	     *   modal.show();
+	     * }
+         * 
+ */ + (selector:string|JQuery): ModalElement + } + /** + * Create a smooth off-canvas sidebar that slides in and out of the page + * Documentation: {@link http://getuikit.org/docs/offcanvas.html} + *

Events:

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
NameParameterDescription
show.uk.offcanvasevent, panel, barOn offcanvas show
hide.uk.offcanvasevent, panel, barOn offcanvas hide
+ */ + interface OffCanvas { + /** + * Show an off-canvas matching the passed CSS selector + * @param {string} selector A CSS selector + */ + show(selector:string): void + /** + * Hide any active offcanvas. Set force to true, if you don't want any + * animation + * @param {boolean} force When seted to true do not run animations. + * @default false + */ + hide(force?:boolean): void + } + interface LightBoxOptions { + /** + * Group name to group elements as a gallery to show. + * @default false + */ + group?: string + /** + * Animation duration between gallery item change + * @default 400 + */ + duration?: number + /** + * Allow keyboard navigation + * @default true + */ + keyboard?: boolean + } + interface LightBoxItem { + source: string + type: string + } + interface LightBoxElement { + /** + * Open the lightbox + */ + show(): void + } + /** + * Create a fancy lightbox for images and videos utilizing the @see {@link modal|Modal Component} + * Documentation {@link http://getuikit.org/docs/lightbox.html} + *

Events:

+ * + * + * + * + * + * + * + * + * + * + * + *
NameParameterDescription
showitem.uk.lightboxevent, dataOn lightbox show
+ */ + interface LightBox { + /** + * Create dynamic lightbox + * @param {Array} items Group of items on the lightbox + * @return {LightBoxElement} The lightbox element to show + */ + create(items:Array): LightBoxElement + /** + * Init element manually + */ + (element:string|JQuery, options?:LightBoxOptions): LightBoxElement + + } + type CallbackAutoComplete = () => string + interface AutoCompleteOptions { + /** + * Data source + * @default [] + */ + source?: string|string[]|CallbackAutoComplete + /** + * Min. input length before triggering autocomplete + * @default 3 + */ + minLength?: number + /** + * Query name when sending ajax request + * @default search + */ + param?: string + /** + * Delay time after stop typing + * @default 300 + */ + delay?: number + } + /** + * Create inputs that allow users to choose from a list of pre-generated values while typing + * Documentation {@link http://getuikit.org/docs/autocomplete.html} + *

Events

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
NameParameterDescription
selectitem.uk.autocompleteevent, data, acobjectOn item selected
show.uk.autocompleteeventOn autocomplete dropdown show
+ */ + interface AutoComplete { + /** + * Init element manually + * @param element + * @param options + */ + (element:string|JQuery, options?:AutoCompleteOptions): any + } + interface DatePickerOptions { + /** + * Start of the week + * integer (0..6) + * @default 1 + */ + weekstart?: number + /** + * Language string definitions + * @default { months:['January',...], weekdays:['Sun',..,'Sat'] } + */ + i18n?: {} + /** + * Date format string + * @default 'DD.MM.YYYY' + */ + format?: string + /** + * Offset to the input value + * @default 5 + */ + offsettop?: number + /** + * Min. date + * bool (false to ignore the option) + * string (date as in format) + * integer (offset in days from current date) + * @default false + */ + minDate?: string|boolean|number + /** + * Max. date + * bool (false to ignore the option) + * string (date as in format) + * integer (offset in days from current date) + * @default false + */ + maxDate?: string|boolean|number + /** + * Position of the datepicker + * 'auto', 'top', 'bottom' + * @default 'auto' + */ + pos?: string + + } + /** + * Create a toggleable dropdown with an datepicker + * Documentation {@link http://getuikit.org/docs/datepicker.html} + *

Events

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
NameParameterDescription
show.uk.datepickereventOn datepicker dropdown show
hide.uk.datepickereventOn datepicker dropdown hide
update.uk.datepickereventOn calendar rendering
+ */ + interface DatePicker { + /** + * Init element manually + * @param element + * @param options + */ + (element:string|JQuery, options?:DatePickerOptions): any + } + interface HtmlEditorOptions { + /** + * View mode + * Possible values 'split','tab' + * @default 'split' + */ + mode?: string + /** + * Button list to appear in the toolbar + * @default [ "bold", "italic", "strike", "link", "picture", ... ] + */ + toolbar?: string[] + /** + * Min. browser width when to switch to responsive tab mode when in split mode + * @default 1000 + */ + maxsplitsize?: number + /** + * Label string for preview mode + * @default 'Preview' + */ + lblPreview?: string + /** + * Label string for code mode + * @default 'Markdown' + */ + lblCodeview?: string + } + /** + * Create a rich HTML or markdown editor with an immediate preview and syntax highlighting + * Documentation {@link http://getuikit.org/docs/htmleditor.html} + */ + interface HtmlEditor { + /** + * Init element manually + * @param element + * @param options + */ + (element: string|JQuery, options?: HtmlEditorOptions): any + } + interface SliderOptions { + /** + * Center items mode + * @default false + */ + center?: boolean + /** + * Mouse movement threshold in pixel until trigger element dragging + * @default true + */ + threshold?: boolean + /** + * Infinite scrolling + * @default true + */ + infinite?: boolean + /** + * Class added on active item in center mode + * @default uk-active + */ + activecls?: string + /** + * Defines whether or not the slider items should switch automatically + * @default false + */ + autoplay?: boolean + /** + * Pause autoplay when hovering a slider + * @default true + */ + pauseOnHover?: boolean + /** + * Defines the timespan between switching slider items + * @default 7000 + */ + autoplayInterval?: number + } + /** + * Create a list of items to use as a responsive carousel slider + * Documentation {@link http://getuikit.org/docs/slider.html} + *

Events

+ * + * + * + * + * + * + * + * + * + * + * + *
NameParameterDescription
focusitem.uk.sliderevent, index, itemOn item focus
+ */ + interface Slider { + /** + * Init element manually + * @param element + * @param options + */ + (element:string|JQuery, options?:SliderOptions): any + } + interface SlideSetOptions { + /** + * Default visible items in a set + * @default 1 + */ + default?: number + /** + * Visible items in a set at small breakpoint + * @default null + */ + small?: number + /** + * Visible items in a set at medium breakpoint + * @default null + */ + medium?: number + /** + * Visible items in a set at large breakpoint + * @default null + */ + large?: number + /** + * Visible items in a set at xlarge breakpoint + * @default null + */ + xlarge?: number + /** + * Animation name + * @default 'fade' + */ + animation?: string + /** + * Animation duration in ms + * @default 200 + */ + duration?: number + /** + * Animation delay between items in a set + * @default 100 + */ + delay?: number + /** + * Items filter + * @default "" + */ + filter?: string + /** + * Defines whether or not the slideset items should switch automatically. + * @default false + */ + autoplay?: boolean + /** + * Pause autoplay when hovering a slideset. + * @default true + */ + pauseOnHover?: boolean + /** + * Defines the timespan between switching slideset items. + * @default 7000 + */ + autoplayInterval?: number + } + /** + * Create sets and groups of items, allowing to loop through the sets. + * Documentation {@link http://getuikit.org/docs/slideset.html} + *

Events

+ * + * + * + * + * + * + * + * + * + * + * + *
NameParameterDescription
show.uk.slidesetevent, setOn set show
+ */ + interface SlideSet { + /** + * Init element manually + * @param element + * @param options + */ + (element:string|JQuery, options?:SlideSetOptions): any + } + interface SlideShowOptions { + /** + * Defines the preferred transition between items. + * @default 'fade + */ + animation?: string + + /** + * Defines the transition duration. + * @default 500 + */ + duration?: number + + /** + * Defines the slideshow height. + * @default 'auto' + */ + height?: string + + /** + * Defines the first slideshow item to be displayed. + * @default 0 + */ + start?: number + + /** + * Defines whether or not the slideshow items should switch automatically. + * @default false + */ + autoplay?: boolean + + /** + * Pause autoplay when hovering a slideshow. + * @default true + */ + pauseOnHover?: boolean + + /** + * Defines the timespan between switching slideshow items. + * @default 7000 + */ + autoplayInterval?: number + + /** + * Defines whether or not a video starts automatically. + * @default true + */ + videoautoplay?: boolean + + /** + * Defines whether or not a video is muted. + * @default false + */ + videomute?: boolean + + /** + * Defines whether or not the Ken Burns effect is active. If kenburns is a numeric value, it will be used as + * the animation duration. + * @default false + */ + kenburns?: boolean + + /** + * Animation series. + * @default 'uk-animation-middle-left, uk-animation-top-right, uk-animation-bottom-left, uk-animation-top-center,uk-animation-bottom-right' + */ + kenburnsanimations?: string + + /** + * Defines the number of slices, if a "Slice" transition is set. + * @default 15 + */ + slices?: number + } + /** + * Create a responsive image or video slideshow with stunning transition effects, fullscreen mode and overlays. + * Documentation {@link http://getuikit.org/docs/slideshow.html} + *

Events

+ * + * + * + * + * + * + * + * + * + * + * + *
NameParameterDescription
show.uk.slideshowevent, next slideOn showing a new slide (after animation is finished)
+ */ + interface SlideShow { + /** + * Init element manually + * @param element + * @param options + */ + (element:string|JQuery, options:SlideShowOptions): any + } + interface ParallaxOptions { + + /** + * Animation velocity during scrolling + * @default 0.5 + */ + velocity?: number + /** + * Element dimension reference for animation duration. + * @default false + */ + target?: boolean + /** + * Animation range depending on the viewport. + *

Possible value

+ * float (0 to 1) + * @default false + */ + viewport?: number + /** + * Condition for the active status with a width as integer (e.g. 640) or a css media query + * @default false + *

Possible Value

+ * integer / string + */ + media?: number|string + + } + /** + * Animate CSS properties depending on the scroll position of the document. + * Documentation {@link http://getuikit.org/docs/parallax.html} + */ + interface Parallax { + /** + * Init element manually + * @param element + * @param options + */ + (element:string|JQuery, options:ParallaxOptions): any + } + interface AccordionOptions { + /** + * Show first item on init + * @default true + *

Possible value

+ * boolean + */ + showfirst?: boolean + /** + * Allow multiple open items + * @default true + *

Possible value

+ * boolean + */ + collapse?: boolean + /** + * Animate toggle + * @default true + *

Possible value

+ * boolean + */ + animate?: boolean + /** + * Animation function + * @default swing + *

Possible value

+ * string + */ + easing?: string + /** + * Animation duration + * @default 300 + *

Possible value

+ * integer + */ + duration?: number + /** + * Css selector for toggles + * @default .uk-accordion-title + *

Possible value

+ * string + */ + toggle?: string + /** + * Css selector for content containers + * @default .uk-accordion-content + *

Possible value

+ * string + */ + containers?: string + /** + * Class to add when an item is active + * @default uk-active + *

Possible value

+ * string + */ + clsactive?: string + } + /** + * Create a list of items, allowing each item's content to be expanded and collapsed by clicking its header. + * Documentation {@link http://getuikit.org/docs/accordion.html} + *

Events

+ * + * + * + * + * + * + * + * + * + * + * + *
NameParameterDescription
toggle.uk.accordionevent, active, toggle, contentOn item toggle
+ */ + interface Accordion { + /** + * Init element manually + * @param element + * @param options + */ + (element:string|JQuery, options:AccordionOptions): any + } + + interface NotifyOptions { + /** + * The message to display + */ + message?: string + + /** + * A notification can be styled by adding a status to the message to indicate an info, success, warning or a + * danger status. + *

Possible values

+ * info, sucess, warning, danger + * If you want to create one set its style with the CSS class uk-notify-message-yourStatus + * @default 'info' + */ + status?: string + + /** + * Amount of tiem in milliseconds a messa is visible. Set to 0 for sticky message + * @default 5000 + */ + timeout?: number + + /** + * Adjust the notification's position to different corners. + * @default 'top-center' + *

Possible values

+ * top-center, top-left, top-right, bottom-center, bottom-left, bottom-right + * If you want to create one value set its style with the CSS uk-notify-yourPosition + */ + pos?: string + } + /** + * Create toggleable notifications that fade out automatically + * Documentation {@link http://getuikit.org/docs/notify.html} + */ + interface Notify { + /** + * Show a message with default options + * @param message The html message + */ + (message:string): any + /** + * Show a message with a different status + * @param message The html message + * @param status The string status + */ + (message:string, status:string): any + /** + * Show a message with diferente options + * @param message The html message + * @param options Options + */ + (message:string, options:NotifyOptions): any + /** + * Show a message with diferent options + * @param options Options + */ + (options:NotifyOptions): any + } + interface SearchOptions { + /** + * Data source url + * @default '' + *

Possible value

+ * string + */ + source?: string + + /** + * Min. input length before triggering autocomplete + * @default 3 + *

Possible value

+ * integer + */ + minLength?: number + + /** + * Query name when sending ajax request + * @default search + *

Possible value

+ * string + */ + param?: string + + /** + * Delay time after stop typing + * @default 300 + *

Possible value

+ * integer + */ + delay?: number + + } + /** + * Easily create a nicely looking search. + * Documentation {@link http://getuikit.org/docs/search.html} + */ + interface Search { + /** + * Init element manually + * @param element + * @param options + */ + (element:string|JQuery, options:SearchOptions): any + } + interface NestableOptions { + /** + * List group + * @default false + *

Possible value

+ * string + */ + group?: string + /** + * Max nesting level + * @default 10 + *

Possible value

+ * integer + */ + maxDepth?: number + /** + * Pixel threshold before starting to drag + * @default 20 + *

Possible value

+ * integer + */ + threshold?: number + /** + * List node name + * @default ul + *

Possible value

+ * string + */ + listNodeName?: string + /** + * Item node name + * @default li + *

Possible value

+ * string + */ + itemNodeName?: string + /** + * List base class + * @default uk-nestable + *

Possible value

+ * string + */ + listBaseClass?: string + /** + * List class + * @default uk-nestable-list + *

Possible value

+ * string + */ + listClass?: string + /** + * List item class + * @default uk-nestable-list-item + *

Possible value

+ * string + */ + listitemClass?: string + /** + * Item class + * @default uk-nestable-item + *

Possible value

+ * string + */ + itemClass?: string + /** + * Class added to dragged list + * @default uk-nestable-list-dragged + *

Possible value

+ * string + */ + dragClass?: string + /** + * Class added to <html> when moving + * @default uk-nestable-moving + *

Possible value

+ * string + */ + movingClass?: string + /** + * Class for drag handle + * @default uk-nestable-handle + *

Possible value

+ * string + */ + handleClass?: string + /** + * Class for collapsed items + * @default uk-nestable-collapsed + *

Possible value

+ * string + */ + collapsedClass?: string + /** + * Class for placeholder of currently dragged element + * @default uk-nestable-placeholder + *

Possible value

+ * string + */ + placeClass?: string + /** + * Elements with this class will not trigger dragging. Useful when having the complete item draggable and not + * just the handle. + * @default uk-nestable-nodrag + *

Possible value

+ * string + */ + noDragClass?: string + /** + * Class for empty lists + * @default uk-nestable-empty + *

Possible value

+ * string + */ + emptyClass?: string + + } + /** + * Create nestable lists that can be sorted by drag and drop. + * Documentation {@link http://getuikit.org/docs/nestable.html} + *

Events

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
NameParameterDescription
start.uk.nestableevent, nestable objectOn nestable drag start
move.uk.nestableevent, nestable objectOn nestable move item
stop.uk.nestableevent, nestable objectOn nestable stop dragging
change.uk.nestableevent, sortable object, dragged element, actionOn nestable change item
+ */ + interface Nestable { + /** + * Init element manually + * @param element + * @param options + */ + (element:string|JQuery, options:NestableOptions): any + } + interface SortableOptions { + /** + * List group + * @default false + *

Possible value

+ * string + */ + group?: string + /** + * Animation speed in ms + * @default 150 + *

Possible value

+ * integer + */ + animation?: string + /** + * Mouse movement threshold in pixel until trigger element dragging + * @default 10 + *

Possible value

+ * integer + */ + threshold?: string + /** + * Custom class to define elements which can trigger sorting + * @default '' + *

Possible value

+ * string + */ + handleClass?: string + /** + * Custom class added to the dragged element + * @default '' + *

Possible value

+ * string + */ + dragCustomClass?: string + + } + /** + * Create sortable grids and lists to rearrange the order of its elements. + * Documentation {@link http://getuikit.org/docs/sortable.html} + *

Events

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
NameParameterDescription
start.uk.sortableevent, sortable object, dragged elementOn sortable drag start
move.uk.sortableevent, sortable objectOn sortable move item
stop.uk.sortableevent, sortable object, dragged elementOn sortable stop dragging
change.uk.sortableevent, sortable object, dragged element, actionOn sortable change item
+ */ + interface Sortable { + /** + * Init element manually + * @param element + * @param options + */ + (element:string|JQuery, options:SortableOptions): any + } + interface StickyOptions { + /** + * Top offset whent sticky should be triggered + * @default 0 + *

Possible value

+ * integer + */ + top?: number + /** + * UIkit animation class + * @default '' + *

Possible value

+ * string + */ + animation?: string + /** + * Init class when the element is sticky for the first time + * @default uk-sticky-init + *

Possible value

+ * string + */ + clsinit?: string + /** + * Active class to add, when element is sticky + * @default uk-active + *

Possible value

+ * string + */ + clsactive?: string + /** + * Class to add, when element is not sticky + * @default '' + *

Possible value

+ * string + */ + clsinactive?: string + /** + * Css selector where to get the width from in sticky mode. By default it takes the width from the created wrapper element. + * @default '' + *

Possible value

+ * string + */ + getWidthFrom?: string + /** + * Condition for the active status with a width as integer (e.g. 640) or a css media query + * @default false + *

Possible value

+ * integer / string + */ + media?: number|string + /** + * Make sure that a sticky element is not over a targeted element via location hash on dom-ready. + * @default false + *

Possible value

+ * boolean + */ + target?: boolean + /** + * Show sticky element only when scrolling up. + * @default false + *

Possible value

+ * boolean + */ + showup?: boolean + /** + * Set to true to bind sticky to the parent or a Css selector to bind sticky to a specific element. + * @default false + *

Possible value

+ * mixed + */ + boundary?: boolean|string + + } + /** + * Make elements remain at the top of the viewport, like a sticky navbar. + * Documentation {@link http://getuikit.org/docs/sticky.html} + *

Events

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
NameParameterDescription
active.uk.stickyeventElement getting sticky
inactive.uk.stickyeventElement leaving sticky mode
+ */ + interface Sticky { + /** + * Init the element manually + * @param element + * @param options + */ + (element:string|JQuery, options:StickyOptions): any + } + interface TimepickerOptions { + /** + * Defines the preferred time notation + * @default '24h' + *

Possible value

+ * '24h' or '12h' + */ + format?: string + /** + * Start time + * @default 0 + *

Possible value

+ * Integer between 0 and 24 + */ + start?: number + /** + * End time + * @default 24 + *

Possible value

+ * Integer between 0 and 24 + */ + end?: number + + } + /** + * Create a timepicker which can easily be used by selecting a time value from a pre filled dropdown. + * Documentation {@link http://getuikit.org/docs/timepicker.html} + */ + interface Timepicker { + /** + * Init element manually + * @param element + * @param options + */ + (element:string|JQuery, options:TimepickerOptions): any + } + interface TooltipOptions { + /** + * Offset to the source element + * @default 5 + *

Possible value

+ * integer + */ + offset?: number + /** + * Tooltip position + * @default 'top' + *

Possible value

+ * string + */ + pos?: string + /** + * Fade in tooltip + * @default false + *

Possible value

+ * boolean + */ + animation?: boolean + /** + * Delay tooltip show in ms + * @default 0 + *

Possible value

+ * integer + */ + delay?: number + /** + * Custom class to add on show + * @default '' + *

Possible value

+ * string + */ + cls?: string + /** + * Toggled active class + * @default 'uk-active' + *

Possible value

+ * string + */ + activeClass?: string + + } + /** + * Easily create a nicely looking tooltip. + * Documentation {@link http://getuikit.org/docs/tooltip.html} + */ + interface Tooltip { + /** + * Init element manually + * @param element + * @param options + */ + (element:string|JQuery, options:TooltipOptions): any + } + interface UploadOptions { + /** + * Target url for the upload + * @default '' + *

Possible value

+ * string + */ + action?: string + /** + * Send each file one by one + * @default true + *

Possible value

+ * boolean + */ + single?: boolean + /** + * Post query name + * @default files[] + *

Possible value

+ * string + */ + param?: string + /** + * Additional request parameters + * @default {} + *

Possible value

+ * JSON Object + */ + params?: {} + /** + * File filter + * @default *.* + *

Possible value

+ * string + */ + allow?: string + /** + * Limit the number of files to upload + * @default false + *

Possible value

+ * integer + */ + filelimit?: number + /** + * Response type from server + * @default text + *

Possible Value

+ * (text|json) + */ + "type"?: string + before?: (settings: UploadOptions, files: string|string[]) => any + beforeAll?: (files: string|string[]) => any + beforeSend?: (xhr: XMLHttpRequest) => any + progress?: (percent: number) => any + complete?: (response: any, xhr: XMLHttpRequest) => any + allcomplete?: (response: any, xhr: XMLHttpRequest) => any + notallowed?: (file: string|string[], settings: UploadOptions) => any + loadstart?: (event: any) => any + load?: (event: any) => any + loadend?: (event: any) => any + error?: (event: any) => any + abort?: (event: any) => any + readystatechange?: (event: any) => any + } + + /** + * Allow users to upload files through a file input form element or a placeholder area. + * Documentation {@link http://getuikit.org/docs/upload.html} + *

Callbacks

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
NameParameter
beforesettings, files
beforeAllfiles
beforeSendxhr
progresspercent
completeresponse, xhr
allcompleteresponse, xhr
notallowedfile, settings
loadstartevent
loadevent
loadendevent
errorevent
abortevent
readystatechangeevent
+ */ + interface Upload { + /** + * Init element manually + * @param element + * @param options + */ + (element:string|JQuery, options:UploadOptions): any + } + export var modal:Modal; + export var lightbox:LightBox; + export var offcanvas:OffCanvas; + export var autocomplete:AutoComplete; + export var datepicker:DatePicker; + export var htmleditor:HtmlEditor; + export var slider:Slider; + export var slideset:SlideSet; + export var slideshow:SlideShow; + export var parallax:Parallax; + export var accordion:Accordion; + export var notify:Notify; + export var search:Search; + export var nestable:Nestable; + export var sortable:Sortable; + export var sticky:Sticky; + export var timepicker:Timepicker; + export var tooltip:Tooltip; + export var uploadSelect: Upload; + export var uploadDrop: Upload; +} + +declare module 'uikit' { + export = UIkit +} diff --git a/utils-merge/utils-merge-tests.ts b/utils-merge/utils-merge-tests.ts new file mode 100644 index 000000000..b4a4a1487 --- /dev/null +++ b/utils-merge/utils-merge-tests.ts @@ -0,0 +1,9 @@ +/// + +import merge from "utils-merge"; + +type Result = {a: string, b: number}; + +let result: Result; + +result = merge<{a: string}, {b: number}, Result>({a: ''}, {b: 42}); diff --git a/utils-merge/utils-merge.d.ts b/utils-merge/utils-merge.d.ts new file mode 100644 index 000000000..0cb7f2522 --- /dev/null +++ b/utils-merge/utils-merge.d.ts @@ -0,0 +1,10 @@ +// Type definitions for utils-merge +// Project: https://github.com/jaredhanson/utils-merge +// Definitions by: Ilya Mochalov +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "utils-merge" { + function merge(a: TA, b: TB): TResult; + + export default merge; +} diff --git a/voximplant-websdk/voximplant-websdk.d.ts b/voximplant-websdk/voximplant-websdk.d.ts index 1609b6e70..2e715d770 100644 --- a/voximplant-websdk/voximplant-websdk.d.ts +++ b/voximplant-websdk/voximplant-websdk.d.ts @@ -3,7 +3,7 @@ // Definitions by: Alexey Aylarov // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare module VoxImplant { +declare namespace VoxImplant { module Events { @@ -727,7 +727,7 @@ declare module VoxImplant { * * @param config Client configuration options */ - init(config: Config): void; + init(config?: Config): void; /** * Check if WebRTC support is available */ @@ -1163,3 +1163,7 @@ declare module VoxImplant { function version(): String; } + +declare module "voximplant-websdk" { + export = VoxImplant; +} diff --git a/webpack/webpack-env-tests.ts b/webpack/webpack-env-tests.ts new file mode 100644 index 000000000..b4a9693ec --- /dev/null +++ b/webpack/webpack-env-tests.ts @@ -0,0 +1,15 @@ +/// + +interface SomeModule { + someMethod(): void; +} + +let someModule = require('./someModule'); +someModule.someMethod(); + +let context = require.context('./somePath', true); +let contextModule = context('./someModule'); + +require(['./someModule', './otherModule'], (someModule: SomeModule, otherModule: any) => { + +}); diff --git a/webpack/webpack-env.d.ts b/webpack/webpack-env.d.ts new file mode 100644 index 000000000..01ea6e404 --- /dev/null +++ b/webpack/webpack-env.d.ts @@ -0,0 +1,103 @@ +// Type definitions for webpack 1.12.2 (module API) +// Project: https://github.com/webpack/webpack +// Definitions by: use-strict +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/** + * Webpack module API - variables and global functions available inside modules + */ + +declare namespace __WebpackModuleApi { + interface RequireContext { + keys(): string[]; + (id: string): T; + resolve(id: string): string; + } + + interface RequireFunction { + /** + * Returns the exports from a dependency. The call is sync. No request to the server is fired. The compiler ensures that the dependency is available. + */ + (path: string): T; + /** + * Behaves similar to require.ensure, but the callback is called with the exports of each dependency in the paths array. There is no option to provide a chunk name. + */ + (paths: string[], callback: (...modules: any[]) => void): void; + /** + * Download additional dependencies on demand. The paths array lists modules that should be available. When they are, callback is called. If the callback is a function expression, dependencies in that source part are extracted and also loaded on demand. A single request is fired to the server, except if all modules are already available. + * + * This creates a chunk. The chunk can be named. If a chunk with this name already exists, the dependencies are merged into that chunk and that chunk is used. + */ + ensure: (paths: string[], callback: (require: (path: string) => T) => void) => void; + context: (path: string, deep?: boolean, filter?: RegExp) => RequireContext; + /** + * Returns the module id of a dependency. The call is sync. No request to the server is fired. The compiler ensures that the dependency is available. + * + * The module id is a number in webpack (in contrast to node.js where it is a string, the filename). + */ + resolve(path: string): number; + /** + * Like require.resolve, but doesn’t include the module into the bundle. It’s a weak dependency. + */ + resolveWeak(path: string): number; + /** + * Ensures that the dependency is available, but don’t execute it. This can be use for optimizing the position of a module in the chunks. + */ + include(path: string): void; + /** + * Multiple requires to the same module result in only one module execution and only one export. Therefore a cache in the runtime exists. Removing values from this cache cause new module execution and a new export. This is only needed in rare cases (for compatibility!). + */ + cache: { + [id: string]: any; + } + } +} + +declare var require: __WebpackModuleApi.RequireFunction; + +/** + * The resource query of the current module. + * + * e.g. __resourceQuery === "?test" // Inside "file.js?test" + */ +declare var __resourceQuery: string; + +/** + * Equals the config options output.publicPath. + */ +declare var __webpack_public_path__: string; + +/** + * The raw require function. This expression isn’t parsed by the Parser for dependencies. + */ +declare var __webpack_require__: any; + +/** + * The internal chunk loading function + * + * @param chunkId The id for the chunk to load. + * @param callback A callback function called once the chunk is loaded. + */ +declare var __webpack_chunk_load__: (chunkId: any, callback: (require: (id: string) => any) => void) => void; + +/** + * Access to the internal object of all modules. + */ +declare var __webpack_modules__: any[]; + +/** + * Access to the hash of the compilation. + * + * Only available with the HotModuleReplacementPlugin or the ExtendedAPIPlugin + */ +declare var __webpack_hash__: any; + +/** + * Generates a require function that is not parsed by webpack. Can be used to do cool stuff with a global require function if available. + */ +declare var __non_webpack_require__: any; + +/** + * Equals the config option debug + */ +declare var DEBUG: boolean; \ No newline at end of file diff --git a/webpack/webpack-tests.ts b/webpack/webpack-tests.ts index 5a70c2e10..27a4a5385 100644 --- a/webpack/webpack-tests.ts +++ b/webpack/webpack-tests.ts @@ -386,22 +386,3 @@ plugin = new webpack.ExtendedAPIPlugin(); plugin = new webpack.NoErrorsPlugin(); plugin = new webpack.WatchIgnorePlugin(paths); -// -// http://webpack.github.io/docs/api-in-modules.html -// - -interface SomeModule { - someMethod(): void; -} - -let someModule: SomeModule = require('./someModule'); -someModule.someMethod(); - -let context2 = require.context('./somePath', true); -let contextModule: SomeModule = context2('./someModule'); - -require(['./someModule', './otherModule'], (someModule: SomeModule, otherModule: any) => { - -}); - - diff --git a/webpack/webpack.d.ts b/webpack/webpack.d.ts index 82cf56458..f2049bbc9 100644 --- a/webpack/webpack.d.ts +++ b/webpack/webpack.d.ts @@ -259,101 +259,3 @@ declare module "webpack" { export = webpack; } -/** - * Webpack module API - variables and global functions available inside modules - */ - -declare namespace __WebpackModuleApi { - interface RequireContext { - keys(): string[]; - (id: string): T; - resolve(id: string): string; - } - - interface RequireFunction { - /** - * Returns the exports from a dependency. The call is sync. No request to the server is fired. The compiler ensures that the dependency is available. - */ - (path: string): T; - /** - * Behaves similar to require.ensure, but the callback is called with the exports of each dependency in the paths array. There is no option to provide a chunk name. - */ - (paths: string[], callback: (...modules: any[]) => void): void; - /** - * Download additional dependencies on demand. The paths array lists modules that should be available. When they are, callback is called. If the callback is a function expression, dependencies in that source part are extracted and also loaded on demand. A single request is fired to the server, except if all modules are already available. - * - * This creates a chunk. The chunk can be named. If a chunk with this name already exists, the dependencies are merged into that chunk and that chunk is used. - */ - ensure: (paths: string[], callback: (require: (path: string) => T) => void) => void; - context: (path: string, deep?: boolean, filter?: RegExp) => RequireContext; - /** - * Returns the module id of a dependency. The call is sync. No request to the server is fired. The compiler ensures that the dependency is available. - * - * The module id is a number in webpack (in contrast to node.js where it is a string, the filename). - */ - resolve(path: string): number; - /** - * Like require.resolve, but doesn’t include the module into the bundle. It’s a weak dependency. - */ - resolveWeak(path: string): number; - /** - * Ensures that the dependency is available, but don’t execute it. This can be use for optimizing the position of a module in the chunks. - */ - include(path: string): void; - /** - * Multiple requires to the same module result in only one module execution and only one export. Therefore a cache in the runtime exists. Removing values from this cache cause new module execution and a new export. This is only needed in rare cases (for compatibility!). - */ - cache: { - [id: string]: any; - } - } -} - -declare var require: __WebpackModuleApi.RequireFunction; - -/** - * The resource query of the current module. - * - * e.g. __resourceQuery === "?test" // Inside "file.js?test" - */ -declare var __resourceQuery: string; - -/** - * Equals the config options output.publicPath. - */ -declare var __webpack_public_path__: string; - -/** - * The raw require function. This expression isn’t parsed by the Parser for dependencies. - */ -declare var __webpack_require__: any; - -/** - * The internal chunk loading function - * - * @param chunkId The id for the chunk to load. - * @param callback A callback function called once the chunk is loaded. - */ -declare var __webpack_chunk_load__: (chunkId: any, callback: (require: (id: string) => any) => void) => void; - -/** - * Access to the internal object of all modules. - */ -declare var __webpack_modules__: any[]; - -/** - * Access to the hash of the compilation. - * - * Only available with the HotModuleReplacementPlugin or the ExtendedAPIPlugin - */ -declare var __webpack_hash__: any; - -/** - * Generates a require function that is not parsed by webpack. Can be used to do cool stuff with a global require function if available. - */ -declare var __non_webpack_require__: any; - -/** - * Equals the config option debug - */ -declare var DEBUG: boolean; diff --git a/winjs/winjs.d.ts b/winjs/winjs.d.ts index 195ecb66e..903019698 100644 --- a/winjs/winjs.d.ts +++ b/winjs/winjs.d.ts @@ -4,18 +4,12 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped /* ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. +Copyright (c) Microsoft Corporation. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ***************************************************************************** */ /** @@ -58,6 +52,11 @@ interface IOHelper { * @returns A promise that is completed when the file has been written. **/ writeText(fileName: string, text: string): WinJS.Promise; + + /** + * This API supports the WinJS infrastructure and is not intended to be used directly from your code. + **/ + storage: any; } /** @@ -88,16 +87,6 @@ declare module WinJS.Application { //#endregion Objects - //#region Methods - - /** - * Informs the application object that asynchronous work is being performed, and that this event handler should not be considered complete until the promise completes. This function can be set inside the handlers for all WinJS.Application events: onactivated oncheckpoint onerror onloaded onready onsettings onunload. - * @param promise The promise that should complete before processing is complete. - **/ - function setPromise(promise: Promise): void; - - //#endregion Methods - //#region Functions /** @@ -141,47 +130,61 @@ declare module WinJS.Application { //#region Events + interface IPromiseEvent extends CustomEvent { + /** + * Informs the application object that asynchronous work is being performed, and that this event handler should not be considered complete until the promise completes. This function can be set inside the handlers for all WinJS.Application events: onactivated oncheckpoint onerror onloaded onready onsettings onunload. + * @param promise The promise that should complete before processing is complete. + **/ + setPromise(promise: IPromise): void; + } + /** * Occurs when WinRT activation has occurred. The name of this event is "activated" (and also "mainwindowactivated"). This event occurs after the loaded event and before the ready event. * @param eventInfo An object that contains information about the event. For more information about event arguments, see the WinRT event argument classes: WebUICachedFileUpdaterActivatedEventArgs, WebUICameraSettingsActivatedEventArgs, WebUIContactPickerActivatedEventArgs, WebUIDeviceActivatedEventArgs, WebUIFileActivatedEventArgs, WebUIFileOpenPickerActivatedEventArgs, WebUIFileSavePickerActivatedEventArgs, WebUILaunchActivatedEventArgs, WebUIPrintTaskSettingsActivatedEventArgs, WebUIProtocolActivatedEventArgs, WebUISearchActivatedEventArgs, WebUIShareTargetActivatedEventArgs. **/ - function onactivated(eventInfo: CustomEvent): void; + function onactivated(eventInfo: IPromiseEvent): void; /** * Occurs when receiving PLM notification or when the checkpoint function is called. * @param eventInfo An object that contains information about the event. The detail property of this object includes the following subproperties: type, setPromise. **/ - function oncheckpoint(eventInfo: CustomEvent): void; + function oncheckpoint(eventInfo: IPromiseEvent): void; /** * Occurs when an unhandled error has been raised. * @param eventInfo An object that contains information about the event. **/ - function onerror(eventInfo: CustomEvent): void; + function onerror(eventInfo: IPromiseEvent): void; /** * Occurs after the DOMContentLoaded event, which fires after the page has been parsed but before all the resources are loaded. This event occurs before the activated event and the ready event. * @param eventInfo An object that contains information about the event. The detail property of this object includes the following subproperties: type, setPromise. **/ - function onloaded(eventInfo: CustomEvent): void; + function onloaded(eventInfo: IPromiseEvent): void; /** * Occurs when the application is ready. This event occurs after the loaded event and the activated event. * @param eventInfo An object that contains information about the event. The detail property of this object includes the following sub-properties: type, setPromise. **/ - function onready(eventInfo: CustomEvent): void; + function onready(eventInfo: IPromiseEvent): void; /** * Occurs when the settings charm is invoked. * @param eventInfo An object that contains information about the event. The detail property of this object contains the following sub-properties: type, applicationcommands. **/ - function onsettings(eventInfo: CustomEvent): void; + function onsettings(eventInfo: IPromiseEvent): void; /** * Occurs when the application is about to be unloaded. * @param eventInfo An object that contains information about the event. The detail property of this object includes the following sub-properties: type, setPromise. **/ - function onunload(eventInfo: CustomEvent): void; + function onunload(eventInfo: IPromiseEvent): void; + + /** + * Occurs whenever a user clicks the hardware backbutton. + * @param eventInfo An object that contains information about the event. The detail property of this object includes the following sub-properties: type + **/ + function onbackclick(eventInfo: IPromiseEvent): void; //#endregion Events @@ -192,11 +195,6 @@ declare module WinJS.Application { declare module WinJS.Binding { //#region Properties - /** - * Determines whether or not binding should automatically set the ID of an element. This property should be set to true in apps that use WinJS (WinJS) binding. - **/ - var optimizeBindingReferences: boolean; - //#endregion Properties //#region Objects @@ -276,7 +274,7 @@ declare module WinJS.Binding { /** * Do not instantiate. A list returned by the createFiltered method. **/ - class FilteredListProjection extends ListProjection { + interface FilteredListProjection extends ListProjection { //#region Methods /** @@ -320,9 +318,9 @@ declare module WinJS.Binding { } /** - * Do not instantiate. A list of groups. + * A list of groups. **/ - class GroupsListProjection extends ListBase { + interface GroupsListProjection extends ListBase { //#region Methods /** @@ -362,13 +360,13 @@ declare module WinJS.Binding { /** * Do not instantiate. Sorts the underlying list by group key and within a group respects the position of the item in the underlying list. Returned by createGrouped. **/ - class GroupedSortedListProjection extends SortedListProjection { + interface GroupedSortedListProjection extends SortedListProjection { //#region Properties /** * Gets a List, which is a projection of the groups that were identified in this list. **/ - groups: GroupsListProjection; + groups: GroupsListProjection; //#endregion Properties @@ -383,12 +381,12 @@ declare module WinJS.Binding { /** * Represents a list of objects that can be accessed by index or by a string key. Provides methods to search, sort, filter, and manipulate the data. **/ - class List extends ListBaseWithMutators { + class List implements ListBaseWithMutators { //#region Constructors /** * Creates a List object. - * @constructor + * @constructor * @param list The array containing the elements to initalize the list. * @param options You can set two Boolean options: binding and proxy. If options.binding is true, the list contains the result of calling as on the element values. If options.proxy is true, the list specified as the first parameter is used as the storage for the List. This option should be used with care, because uncoordinated edits to the data storage may result in errors. **/ @@ -396,86 +394,6 @@ declare module WinJS.Binding { //#endregion Constructors - //#region Methods - - /** - * Gets a key/data pair for the specified list index. - * @param index The index of value to retrieve. - * @returns An object with .key and .data properties. - **/ - getItem(index: number): IKeyDataPair; - - /** - * Gets a key/data pair for the list item key specified. - * @param key The key of the value to retrieve. - * @returns An object with .key and .data properties. - **/ - getItemFromKey(key: string): IKeyDataPair; - - /** - * Gets the index of the first occurrence of a key in a list. - * @param key The key to locate in the list. - * @returns The index of the first occurrence of a key in a list, or -1 if not found. - **/ - indexOfKey(key: string): number; - - /** - * Moves the value at index to the specified position. - * @param index The original index of the value. - * @param newIndex The index of the value after the move. - **/ - move(index: number, newIndex: number): void; - - /** - * Forces the list to send a itemmutated notification to any listeners for the value at the specified index. - * @param index The index of the value that was mutated. - **/ - notifyMutated(index: number): void; - - /** - * Returns a list with the elements reversed. This method reverses the elements of a list object in place. It does not create a new list object during execution. - **/ - reverse(): void; - - /** - * Replaces the value at the specified index with a new value. - * @param index The index of the value that was replaced. - * @param newValue The new value. - **/ - setAt(index: number, newValue: T): void; - - /** - * Returns a list with the elements sorted. This method sorts the elements of a list object in place. It does not create a new list object during execution. - * @param sortFunction The function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order. This function must always return the same results, given the same inputs. The results should not depend on values that are subject to change. You must call notifyMutated each time an item changes. Do not batch change notifications. - **/ - sort(sortFunction?: (left: T, right: T) => number): void; - - /** - * Removes elements from a list and, if necessary, inserts new elements in their place, returning the deleted elements. - * @param start The zero-based location in the list from which to start removing elements. - * @param howMany The number of elements to remove. - * @param item The elements to insert into the list in place of the deleted elements. - * @returns The deleted elements. - **/ - splice(start: number, howMany?: number, ...item: T[]): T[]; - - //#endregion Methods - - //#region Properties - - /** - * Gets or sets the length of the list, which is an integer value one higher than the highest element defined in the list. - **/ - length: number; - - //#endregion Properties - - } - - /** - * Represents a base class for lists. - **/ - class ListBase { //#region Events /** @@ -555,7 +473,341 @@ declare module WinJS.Binding { * @param groupSorter A function that accepts two arguments. The function is called with pairs of group keys found in the list. It must return one of the following numeric values: negative if the first argument is less than the second (sorted before), zero if the two arguments are equivalent, positive if the first argument is greater than the second (sorted after). * @returns A grouped projection over the list. **/ - createGrouped(groupKey: (x: T) => string, groupData: (x: T) => any, groupSorter?: (left: string, right: string) => number): GroupedSortedListProjection; + createGrouped(groupKey: (x: T) => string, groupData: (x: T) => G, groupSorter?: (left: string, right: string) => number): GroupedSortedListProjection; + + /** + * Creates a live sorted projection over this list. As the list changes, the sorted projection reacts to those changes and may also change. + * @param sorter A function that accepts two arguments. The function is called with elements in the list. It must return one of the following numeric values: negative if the first argument is less than the second, zero if the two arguments are equivalent, positive if the first argument is greater than the second. This function must always return the same results, given the same inputs. The results should not depend on values that are subject to change. You must call notifyMutated each time an item changes. Do not batch change notifications. + * @returns A sorted projection over the list. + **/ + createSorted(sorter: (left: T, right: T) => number): SortedListProjection; + + /** + * Raises an event of the specified type and with the specified additional properties. + * @param type The type (name) of the event. + * @param eventProperties The set of additional properties to be attached to the event object when the event is raised. + * @returns true if preventDefault was called on the event. + **/ + dispatchEvent(type: string, eventProperties: any): boolean; + + /** + * Checks whether the specified callback function returns true for all elements in a list. + * @param callback A function that accepts up to three arguments. This function is called for each element in the list until it returns false or the end of the list is reached. + * @param thisArg An object to which the this keyword can refer in the callback function. If thisArg is omitted, undefined is used. + * @returns true if the callback returns true for all elements in the list. + **/ + every(callback: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; + + /** + * Returns the elements of a list that meet the condition specified in a callback function. + * @param callback A function that accepts up to three arguments. The function is called for each element in the list. This function must always return the same results, given the same inputs. The results should not depend on values that are subject to change. You must call notifyMutated each time an item changes. Do not batch change notifications. + * @param thisArg An object to which the this keyword can refer in the callback function. If thisArg is omitted, undefined is used. + * @returns An array containing the elements that meet the condition specified in the callback function. + **/ + filter(callback: (value: T, index: number, array: T[]) => any, thisArg?: any): T[]; + + /** + * Calls the specified callback function for each element in a list. + * @param callback A function that accepts up to three arguments. The function is called for each element in the list. The arguments are as follows: value, index, array. + * @param thisArg An object to which the this keyword can refer in the callback function. If thisArg is omitted, undefined is used. + **/ + forEach(callback: (value: T, index: number, array: T[]) => void, thisArg?: any): void; + + /** + * Gets the value at the specified index. + * @param index The index of the value to get. + * @returns The value at the specified index. + **/ + getAt(index: number): T; + + /** + * Gets a key/data pair for the specified list index. + * @param index The index of value to retrieve. + * @returns An object with .key and .data properties. + **/ + getItem(index: number): IKeyDataPair; + + /** + * Gets a key/data pair for the list item key specified. + * @param key The key of the value to retrieve. + * @returns An object with .key and .data properties. + **/ + getItemFromKey(key: string): IKeyDataPair; + + /** + * Gets the index of the first occurrence of the specified value in a list. + * @param searchElement The value to locate in the list. + * @param fromIndex The index at which to begin the search. If fromIndex is omitted, the search starts at index 0. + * @returns The index of the first occurrence of a value in a list or -1 if not found. + **/ + indexOf(searchElement: T, fromIndex?: number): number; + + /** + * Gets the index of the first occurrence of a key in a list. + * @param key The key to locate in the list. + * @returns The index of the first occurrence of a key in a list, or -1 if not found. + **/ + indexOfKey(key: string): number; + + /** + * Returns a string consisting of all the elements of a list separated by the specified separator string. + * @param separator A string used to separate the elements of a list. If this parameter is omitted, the list elements are separated with a comma. + * @returns The elements of a list separated by the specified separator string. + **/ + join(separator?: string): string; + + /** + * Gets the index of the last occurrence of the specified value in a list. + * @param searchElement The value to locate in the list. + * @param fromIndex The index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the list. + * @returns The index of the last occurrence of a value in a list, or -1 if not found. + **/ + lastIndexOf(searchElement: T, fromIndex?: number): number; + + /** + * Calls the specified callback function on each element of a list, and returns an array that contains the results. + * @param callback A function that accepts up to three arguments. The function is called for each element in the list. + * @param thisArg n object to which the this keyword can refer in the callback function. If thisArg is omitted, undefined is used. + * @returns An array containing the result of calling the callback function on each element in the list. + **/ + map(callback: (value: T, index: number, array: T[]) => G, thisArg?: any): G[]; + + /** + * Moves the value at index to the specified position. + * @param index The original index of the value. + * @param newIndex The index of the value after the move. + **/ + move(index: number, newIndex: number): void; + + /** + * Notifies listeners that a property value was updated. + * @param name The name of the property that is being updated. + * @param newValue The new value for the property. + * @param oldValue The old value for the property. + * @returns A promise that is completed when the notifications are complete. + **/ + notify(name: string, newValue: any, oldValue: any): Promise; + + /** + * Forces the list to send a itemmutated notification to any listeners for the value at the specified index. + * @param index The index of the value that was mutated. + **/ + notifyMutated(index: number): void; + + /** + * Forces the list to send a reload notification to any listeners. + **/ + notifyReload(): void; + + /** + * Removes the last element from a list and returns it. + * @returns The last element from the list. + **/ + pop(): T; + + /** + * Appends new element(s) to a list, and returns the new length of the list. + * @param value The element to insert at the end of the list. + * @returns The new length of the list. + **/ + push(value: T): number; + push(...values: T[]): number; + + /** + * Accumulates a single result by calling the specified callback function for all elements in a list. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callback A function that accepts up to four arguments. These arguments are: previousValue, currentValue, currentIndex, array. The function is called for each element in the list. + * @param initiallValue If initialValue is specified, it is used as the value with which to start the accumulation. The first call to the function provides this value as an argument instead of a list value. + * @returns The return value from the last call to the callback function. + **/ + reduce(callback: (previousValue: any, currentValue: any, currentIndex: number, array: T[]) => T, initiallValue?: T): T; + + /** + * Accumulates a single result by calling the specified callback function for all elements in a list, starting with the last member of the list. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callback A function that accepts up to four arguments. These arguments are: previousValue, currentValue, currentIndex, array. The function is called for each element in the list. + * @param initialValue If initialValue is specified, it is used as the value with which to start the accumulation. The first call to the callback function provides this value as an argument instead of a list value. + * @returns The return value from the last call to callback function. + **/ + reduceRight(callback: (previousValue: any, currentValue: any, currentIndex: number, array: T[]) => T, initialValue?: T): T; + + /** + * Removes an event listener from the control. + * @param type The type (name) of the event. + * @param listener The listener to remove. + * @param useCapture true if capture is to be initiated, otherwise false. + **/ + removeEventListener(type: string, listener: Function, useCapture?: boolean): void; + + /** + * Returns a list with the elements reversed. This method reverses the elements of a list object in place. It does not create a new list object during execution. + **/ + reverse(): void; + + /** + * Replaces the value at the specified index with a new value. + * @param index The index of the value that was replaced. + * @param newValue The new value. + **/ + setAt(index: number, newValue: T): void; + + /** + * Removes the first element from a list and returns it. + * @returns The first element from the list. + **/ + shift(): T; + + /** + * Extracts a section of a list and returns a new list. + * @param begin The index that specifies the beginning of the section. + * @param end The index that specifies the end of the section. + * @returns Returns a section of list. + **/ + slice(begin: number, end?: number): T[]; + + /** + * Checks whether the specified callback function returns true for any element of a list. + * @param callback A function that accepts up to three arguments. The function is called for each element in the list until it returns true, or until the end of the list. + * @param thisArg An object to which the this keyword can refer in the callback function. If thisArg is omitted, undefined is used. + * @returns true if callback returns true for any element in the list. + **/ + some(callback: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; + + /** + * Returns a list with the elements sorted. This method sorts the elements of a list object in place. It does not create a new list object during execution. + * @param sortFunction The function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order. This function must always return the same results, given the same inputs. The results should not depend on values that are subject to change. You must call notifyMutated each time an item changes. Do not batch change notifications. + **/ + sort(sortFunction?: (left: T, right: T) => number): void; + + /** + * Removes elements from a list and, if necessary, inserts new elements in their place, returning the deleted elements. + * @param start The zero-based location in the list from which to start removing elements. + * @param howMany The number of elements to remove. + * @param item The elements to insert into the list in place of the deleted elements. + * @returns The deleted elements. + **/ + splice(start: number, howMany?: number, ...item: T[]): T[]; + + /** + * Removes one or more listeners from the notification list for a given property. + * @param name The name of the property to unbind. If this parameter is omitted, all listeners for all events are removed. + * @param action The function to remove from the listener list for the specified property. If this parameter is omitted, all listeners are removed for the specific property. + * @returns This object is returned. + **/ + unbind(name: string, action: Function): any; + + /** + * Appends new element(s) to a list, and returns the new length of the list. + * @param value The element to insert at the start of the list. + * @returns The new length of the list. + **/ + unshift(value: T): number; + unshift(...values: T[]): number; + + //#endregion Methods + + //#region Properties + + /** + * Gets the IListDataSource for the list. The only purpose of this property is to adapt a List to the data model that is used by ListView and FlipView. + **/ + dataSource: WinJS.UI.IListDataSource; + + /** + * Gets or sets the length of the list, which is an integer value one higher than the highest element defined in the list. + **/ + length: number; + + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; + + //#endregion Properties + } + + /** + * Represents a base class for lists. + **/ + interface ListBase { + //#region Events + + /** + * An item in the list has changed its value. + * @param eventInfo An object that contains information about the event. The detail contains the following information: index, key, newItem, newValue, oldItem, oldValue. + **/ + onitemchanged(eventInfo: CustomEvent): void; + + /** + * A new item has been inserted into the list. + * @param eventInfo An object that contains information about the event. The detail contains the following information: index, key, value. + **/ + oniteminserted(eventInfo: CustomEvent): void; + + /** + * An item has been changed locations in the list. + * @param eventInfo An object that contains information about the event. The detail contains the following information: index, key, value. + **/ + onitemmoved(eventInfo: CustomEvent): void; + + /** + * An item has been mutated. This event occurs as a result of calling the notifyMutated method. + * @param eventInfo An object that contains information about the event. The detail contains the following information: index, key, value. + **/ + onitemmutated(eventInfo: CustomEvent): void; + + /** + * An item has been removed from the list. + * @param eventInfo An object that contains information about the event. The detail contains the following information: index, key, value. + **/ + onitemremoved(eventInfo: CustomEvent): void; + + /** + * The list has been refreshed. Any references to items in the list may be incorrect. + * @param eventInfo An object that contains information about the event. The detail property of this object is null. + **/ + onreload(eventInfo: CustomEvent): void; + + //#endregion Events + + //#region Methods + + /** + * Adds an event listener to the control. + * @param type The type (name) of the event. + * @param listener The listener to invoke when the event gets raised. + * @param useCapture If true, initiates capture, otherwise false. + **/ + addEventListener(type: string, listener: Function, useCapture?: boolean): void; + + /** + * Links the specified action to the property specified in the name parameter. This function is invoked when the value of the property may have changed. It is not guaranteed that the action will be called only when a value has actually changed, nor is it guaranteed that the action will be called for every value change. The implementation of this function coalesces change notifications, such that multiple updates to a property value may result in only a single call to the specified action. + * @param name The name of the property to which to bind the action. + * @param action The function to invoke asynchronously when the property may have changed. + * @returns A reference to this observableMixin object. + **/ + bind(name: string, action: Function): any; + + /** + * Returns a new list consisting of a combination of two arrays. + * @param item Additional items to add to the end of the list. + * @returns An array containing the concatenation of the list and any other supplied items. + **/ + concat(...item: T[]): T[]; + + /** + * Creates a live filtered projection over this list. As the list changes, the filtered projection reacts to those changes and may also change. + * @param predicate A function that accepts a single argument. The createFiltered function calls the callback with each element in the list. If the function returns true, that element will be included in the filtered list. This function must always return the same results, given the same inputs. The results should not depend on values that are subject to change. You must call notifyMutated each time an item changes. Do not batch change notifications. + * @returns A filtered projection over the list. + **/ + createFiltered(predicate: (x: T) => boolean): FilteredListProjection; + + /** + * Creates a live grouped projection over this list. As the list changes, the grouped projection reacts to those changes and may also change. The grouped projection sorts all the elements of the list to be in group-contiguous order. The grouped projection also contains a .groups property, which is a List representing the groups that were found in the list. + * @param groupKey A function that accepts a single argument. The function is called with each element in the list, the function should return a string representing the group containing the element. This function must always return the same results, given the same inputs. The results should not depend on values that are subject to change. You must call notifyMutated each time an item changes. Do not batch change notifications. + * @param groupData A function that accepts a single argument. The function is called once, on one element per group. It should return the value that should be set as the data of the .groups list element for this group. The data value usually serves as summary or header information for the group. + * @param groupSorter A function that accepts two arguments. The function is called with pairs of group keys found in the list. It must return one of the following numeric values: negative if the first argument is less than the second (sorted before), zero if the two arguments are equivalent, positive if the first argument is greater than the second (sorted after). + * @returns A grouped projection over the list. + **/ + createGrouped(groupKey: (x: T) => string, groupData: (x: T) => G, groupSorter?: (left: string, right: string) => number): GroupedSortedListProjection; /** * Creates a live sorted projection over this list. As the list changes, the sorted projection reacts to those changes and may also change. @@ -704,18 +956,13 @@ declare module WinJS.Binding { **/ dataSource: WinJS.UI.IListDataSource; - /** - * Indicates that the object is compatibile with declarative processing. - **/ - static supportedForProcessing: boolean; - //#endregion Properties } /** * Represents a base class for normal list modifying operations. **/ - class ListBaseWithMutators extends ListBase { + interface ListBaseWithMutators extends ListBase { //#region Methods /** @@ -752,7 +999,7 @@ declare module WinJS.Binding { /** * Represents a base class for list projections. **/ - class ListProjection extends ListBaseWithMutators { + interface ListProjection extends ListBaseWithMutators { //#region Methods /** @@ -897,7 +1144,7 @@ declare module WinJS.Binding { /** * Do not instantiate. Returned by the createSorted method. **/ - class SortedListProjection extends ListProjection { + interface SortedListProjection extends ListProjection { //#region Methods /** @@ -948,30 +1195,35 @@ declare module WinJS.Binding { /** * Creates a template that provides a reusable declarative binding element. - * @constructor + * @constructor * @param element The DOM element to convert to a template. * @param options If this parameter is supplied, the template is loaded from the URI and the content of the element parameter is ignored. You can add the following options: href. **/ - constructor(element: HTMLElement, options?:any); + constructor(element: HTMLElement, options?: any); //#endregion Constructors //#region Methods /** - * Binds values from the specified data context to elements that are descendants of the specified root element that have the declarative binding attributes specified (data-win-bind). - * @param dataContext The object to use for default data binding. - * @param container The element to which to add this rendered template. If this parameter is omitted, a new DIV is created. - * @returns A Promise that will be completed after binding has finished. The value is either container or the created DIV. promise that is completed after binding has finished. + * Binds values from the specified data context to elements that are descendants of the specified root element that have the declarative binding attributes specified (data-win-bind). + * @param dataContext The object to use for default data binding. + * @param container The element to which to add this rendered template. If this parameter is omitted, a new DIV is created. + * @returns A Promise that will be completed after binding has finished. The value is either container or the created DIV. promise that is completed after binding has finished. **/ render(dataContext: any, container?: HTMLElement): Promise; /** - * Renders a template based on the specified URI (static method). - * @param href The URI from which to load the template. - * @param dataContext The object to use for default data binding. - * @param container The element to which to add this rendered template. If this parameter is omitted, a new DIV is created. - * @returns A promise that is completed after binding has finished. The value is either the object in the container parameter or the created DIV. + * This API supports the WinJS infrastructure and is not intended to be used directly from your code. Use render instead. + **/ + renderItem(item: WinJS.Promise, recyled: HTMLElement): { element: WinJS.Promise; renderComplete: WinJS.Promise; }; + + /** + * Renders a template based on the specified URI (static method). + * @param href The URI from which to load the template. + * @param dataContext The object to use for default data binding. + * @param container The element to which to add this rendered template. If this parameter is omitted, a new DIV is created. + * @returns A promise that is completed after binding has finished. The value is either the object in the container parameter or the created DIV. **/ static render(href: string, dataContext: any, container?: HTMLElement): Promise; @@ -1004,10 +1256,21 @@ declare module WinJS.Binding { **/ extractChild: boolean; + /** + * Gets or sets the Number of milliseconds to delay instantiating declarative controls. Zero (0) will result in no delay, any negative number + * will result in a setImmediate delay, any positive number will be treated as the number of milliseconds. + **/ + processTimeout: number; + /** * Determines whether the Template contains declarative controls that must be processed separately. This property is always true. The controls that belong to a Template object's children are instantiated when a Template instance is rendered. **/ - isDeclarativeControlContainer: boolean; + static isDeclarativeControlContainer: boolean; + + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; //#endregion Properties @@ -1071,6 +1334,11 @@ declare module WinJS.Binding { **/ function expandProperties(shape: any): any; + /** + * This API supports the WinJS infrastructure and is not intended to be used directly from your code. + **/ + function getValue(obj: any, path?: any): any; + /** * Marks a custom initializer function as being compatible with declarative data binding. * @param customInitializer The custom initializer to be marked as compatible with declarative data binding. @@ -1078,15 +1346,6 @@ declare module WinJS.Binding { **/ function initializer(customInitializer: Function): Function; - /** - * Notifies listeners that a property value was updated. - * @param name The name of the property that is being updated. - * @param newValue The new value for the property. - * @param oldValue The old value for the property. - * @returns A promise that is completed when the notifications are complete. - **/ - function notify(name: string, newValue: string, oldValue: string): Promise; - /** * Sets the destination property to the value of the source property. * @param source The source object. @@ -1211,7 +1470,7 @@ declare module WinJS { /** * Creates an Error object with the specified name and message properties. - * @constructor + * @constructor * @param name The name of this error. The name is meant to be consumed programmatically and should not be localized. * @param message The message for this error. The message is meant to be consumed by humans and should be localized. **/ @@ -1219,6 +1478,15 @@ declare module WinJS { //#endregion Constructors + //#region Properties + + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; + + //#endregion Properties + } interface IPromise { @@ -1243,7 +1511,7 @@ declare module WinJS { /** * A promise provides a mechanism to schedule work to be done on a value that has not yet been computed. It is a convenient abstraction for managing interactions with asynchronous APIs. For more information about asynchronous programming, see Asynchronous programming. For more information about promises in JavaScript, see Asynchronous programming in JavaScript. For more information about using promises, see the WinJS Promise sample. - * @constructor + * @constructor * @param init The function that is called during construction of the Promise that contains the implementation of the operation that the Promise will represent. This can be synchronous or asynchronous, depending on the nature of the operation. Note that placing code within this function does not automatically run it asynchronously; that must be done explicitly with other asynchronous APIs such as setImmediate, setTimeout, requestAnimationFrame, and the Windows Runtime asynchronous APIs. The init function is given three arguments: completeDispatch, errorDispatch, progressDispatch. This parameter is optional. * @param onCancel The function to call if a consumer of this promise wants to cancel its undone work. Promises are not required to support cancellation. **/ @@ -1460,6 +1728,15 @@ declare module WinJS { //#endregion Methods + //#region Properties + + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; + + //#endregion Properties + } //#endregion Objects @@ -1473,12 +1750,7 @@ declare module WinJS { * @param type The type of message (error, warning, info, etc.). **/ function log(message: string, tags?: string, type?: string): void; - function log(message: ()=>string, tags?: string, type?: string): void; - - /** - * This method has been deprecated. Strict processing is always on; you don't have to call this method to turn it on. - **/ - function strictProcessing(): void; + function log(message: () => string, tags?: string, type?: string): void; /** * Wraps calls to XMLHttpRequest in a promise. @@ -1499,7 +1771,7 @@ declare module WinJS { headers?: any; data?: any; responseType?: string; - customRequestInitializer?:(request: XMLHttpRequest) => void; + customRequestInitializer?: (request: XMLHttpRequest) => void; } //#endregion Interfaces @@ -1692,7 +1964,7 @@ declare module WinJS.UI.Animation { /** * Creates an object that performs an animation that adds an item or items to a list. * @param added Element or elements to add to the list. - * @param affected Element or elements affected by the added items. + * @param affected Element or elements affected by the added items. Typically, this is all other items displayed in the list. * @returns An object whose execute method is used to execute the animation. The execute method returns a Promise that completes when the animation is finished. **/ function createAddToListAnimation(added: any, affected: any): IAnimationMethodResponse; @@ -1700,7 +1972,7 @@ declare module WinJS.UI.Animation { /** * Creates an object that performs an animation that adds an item or items to a list of search results. * @param added Element or elements to add to the list. - * @param affected Element or elements affected by the added items. + * @param affected Element or elements affected by the added items. Typically, this is all other items displayed in the list. * @returns An object whose execute method is used to execute the animation. The execute method returns a Promise that completes when the animation is finished. **/ function createAddToSearchListAnimation(added: any, affected: any): IAnimationMethodResponse; @@ -1708,7 +1980,7 @@ declare module WinJS.UI.Animation { /** * Creates an object that performs an animation that collapses a list. * @param hidden Element or elements hidden as a result of the collapse. - * @param affected Element or elements affected by the hidden items. + * @param affected Element or elements affected by the hidden items. Typically, this is all other items displayed in the list. * @returns An object whose execute method is used to execute the animation. The execute method returns a Promise that completes when the animation is finished. **/ function createCollapseAnimation(hidden: any, affected: any): IAnimationMethodResponse; @@ -1716,7 +1988,7 @@ declare module WinJS.UI.Animation { /** * Creates an object that performs an animation that removes an item or items from a list. * @param deleted Element or elements to delete from the list. - * @param remaining Element or elements affected by the removal of the deleted items. + * @param remaining Element or elements affected by the removal of the deleted items. Typically, this is all other items displayed in the list. * @returns An object whose execute method is used to execute the animation. The execute method returns a Promise that completes when the animation is finished. **/ function createDeleteFromListAnimation(deleted: any, remaining: any): IAnimationMethodResponse; @@ -1724,7 +1996,7 @@ declare module WinJS.UI.Animation { /** * Creates an object that performs an animation that removes an item or items from a list of search results. * @param deleted Element or elements to delete from the list. - * @param remaining Element or elements affected by the removal of the deleted items. + * @param remaining Element or elements affected by the removal of the deleted items. Typically, this is all other items displayed in the list. * @returns An object whose execute method is used to execute the animation. The execute method returns a Promise that completes when the animation is finished. **/ function createDeleteFromSearchListAnimation(deleted: any, remaining: any): IAnimationMethodResponse; @@ -1732,11 +2004,21 @@ declare module WinJS.UI.Animation { /** * Creates an object that performs an animation that expands a list. * @param revealed Element or elements revealed by the expansion. - * @param affected Element or elements affected by the newly revealed items. + * @param affected Element or elements affected by the newly revealed items. Typically, this is all other items displayed in the list. * @returns An object whose execute method is used to execute the animation. The execute method returns a Promise that completes when the animation is finished. **/ function createExpandAnimation(revealed: any, affected: any): IAnimationMethodResponse; + /** + * Creates an exit and entrance animation to play for a page navigation given the current and incoming pages' + * animation preferences and whether the pages are navigating forwards or backwards. + * @param currentPreferredAnimation A value from WinJS.UI.PageNavigationAnimation describing the animation the current page prefers to use. + * @param A value from nextPreferredAnimation WinJS.UI.PageNavigationAnimation describing the animation the incoming page prefers to use. + * @param movingBackwards Boolean value for whether the navigation is moving backwards. + * @returns an object containing the exit and entrance animations to play based on the parameters given. + **/ + function createPageNavigationAnimations(currentPreferredAnimation: string, nextPreferredAnimation: string, movingBackwards: boolean): { exit: Function; entrance: Function }; + /** * Creates an object that performs a peek animation. * @param element Element or elements involved in the peek. @@ -1791,6 +2073,34 @@ declare module WinJS.UI.Animation { **/ function dragSourceStart(dragSource: any, affected?: any): Promise; + /** + * Execute the incoming phase of the drill in animation, scaling up the incoming page while fading it in. + * @param incomingPage Element to be scaled up and faded in. + * @returns Promise object that completes when the animation is complete. + **/ + function drillInIncoming(incomingPage: HTMLElement): Promise; + + /** + * Execute the outgoing phase of the drill in animation, scaling up the outgoing page while fading it out. + * @param incomingPage Element to be scaled up and faded out. + * @returns Promise object that completes when the animation is complete. + **/ + function drillInOutgoing(outgoingPage: HTMLElement): Promise; + + /** + * Execute the incoming phase of the drill out animation, scaling down the incoming page while fading it in. + * @param incomingPage Element to be scaled up and faded in. + * @returns Promise object that completes when the animation is complete. + **/ + function drillOutIncoming(incomingPage: HTMLElement): Promise; + + /** + * Execute the outgoing phase of the drill out animation, scaling down the outgoing page while fading it out. + * @param outgoingPage Element to be scaled down and faded out. + * @returns Promise object that completes when the animation is complete. + **/ + function drillOutOutgoing(outgoingPage: HTMLElement): Promise; + /** * Performs an animation that displays one or more elements on a page. * @param incoming Element or elements that compose the incoming content. @@ -2264,7 +2574,8 @@ declare module WinJS.UI { threebars, fourbars, scan, - preview + preview, + hamburger } /** @@ -2313,6 +2624,10 @@ declare module WinJS.UI { * The edit operation timed out. **/ noResponse, + /** + * The edit operation was canceled. + **/ + canceled, /** * The data source cannot be written to. **/ @@ -2390,7 +2705,15 @@ declare module WinJS.UI { /** * The object is an item in the list. **/ - item + item, + /** + * The object is the header for the list. + **/ + header, + /** + * The object is the footer for the list. + **/ + footer } /** @@ -2461,10 +2784,147 @@ declare module WinJS.UI { none } + /** + * Specifies what animation type should be returned by WinJS.UI.Animation.createPageNavigationAnimations. + **/ + enum PageNavigationAnimation { + /** + * The pages will exit and enter using a turnstile animation. + **/ + turnstile, + /** + * The pages will exit and enter using an animation that slides up/down. + **/ + slide, + /** + * The pages will enter using an enterPage animation, and exit with no animation. + **/ + enterPage, + /** + * The pages will exit and enter using a continuum animation. + **/ + continuum, + } + //#endregion Enumerations //#region Interfaces + /** + * Define the shape of a Command object to be used in AppBar and ToolBar controls. + **/ + export interface ICommand { + //#region Methods + + /** + * Registers an event handler for the specified event. + * @param type The event type to register. + * @param listener The event handler function to associate with the event. + * @param useCapture Set to true to register the event handler for the capturing phase; otherwise, set to false to register the event handler for the bubbling phase. + **/ + addEventListener(type: string, listener: Function, useCapture?: boolean): void; + + /** + * Releases resources held by this ICommand. Call this method when the ICommand is no longer needed. After calling this method, the ICommand becomes unusable. + **/ + dispose(): void; + + /** + * Removes an event handler that the addEventListener method registered. + * @param type The event type to unregister. + * @param listener The event handler function to remove. + * @param useCapture Set to true to remove the capturing phase event handler; set to false to remove the bubbling phase event handler. + **/ + removeEventListener(type: string, listener: Function, useCapture?: boolean): void; + + //#endregion Methods + + //#region Properties + + /** + * Gets or sets a value that indicates whether the ICommand is disabled. + **/ + disabled: boolean; + + /** + * Gets the DOM element that hosts the ICommand. + **/ + element: HTMLElement; + + /** + * Adds an extra CSS class during construction. + **/ + extraClass: string; + + /** + * Gets or sets the HTMLElement with a 'content' type ICommand that should receive focus whenever focus moves by the user pressing HOME or the arrow keys, from the previous ICommand to this ICommand. + **/ + firstElementFocus: HTMLElement; + + /** + * Gets or sets the Flyout object displayed by this command. The specified flyout is shown when the ICommand's button is invoked. + **/ + flyout: Flyout; + + /** + * Gets or sets a value that indicates whether the ICommand is hiding or in the process of becoming hidden. + **/ + hidden: boolean; + + /** + * Gets or sets the icon of the ICommand. + **/ + icon: string; + + /** + * Gets the element identifier (ID) of the command. + **/ + id: string; + + /** + * Gets or sets the label of the command. + **/ + label: string; + + /** + * Gets or sets the HTMLElement with a 'content' type ICommand that should receive focus whenever focus moves by the user pressing END or the arrow keys, from the previous Command to this Command. + **/ + lastElementFocus: HTMLElement; + + /** + * Gets or sets the function to be invoked when the command is clicked. + **/ + onclick: Function; + + /** + * Gets the section of the parent control that the command is in. The section can only be set through constructor options. + **/ + section: string; + + /** + * Gets or sets the selected state of a toggle button. + **/ + selected: boolean; + + /** + * Gets or sets the tooltip of the command. + **/ + tooltip: string; + + /** + * Gets the type of the command. The type can only be set through constructor options. + **/ + type: string; + + /** + * Gets or sets the priority of the command. + **/ + priority: number; + + //#endregion Properties + } + + /** * Contains items that were requested from an IListDataAdapter and provides some information about those items. **/ @@ -2575,145 +3035,6 @@ declare module WinJS.UI { } - /** - * This API is no longer supported. Starting with the Windows Library for JavaScript 2.0 Preview, use the ILayout2 interface. Represents a layout for the ListView. - **/ - interface ILayout { - //#region Methods - - /** - * This API is no longer supported. Starting with the Windows Library for JavaScript 2.0 Preview, use the ILayout2 interface. - * @param beginScrollPosition The first visible pixel in the ListView. For horizontal layouts, this is the x-coordinate of the pixel. For vertical layouts, this is the y-coordinate. - * @param wholeItem true if the item must be completely visible; otherwise, false if its ok for the item to be partially visible. Promise. - * @returns A Promise for the index of the first visible item at the specified point. - **/ - calculateFirstVisible(beginScrollPosition: number, wholeItem: boolean): Promise; - - /** - * This API is no longer supported. Starting with the Windows Library for JavaScript 2.0 Preview, use the ILayout2 interface. - * @param endScrollPosition The last visible pixel in the ListView. For horizontal layouts, this is the x-coordinate of the pixel. For vertical layouts, this is the y-coordinate. - * @param wholeItem true if the item must be completely visible; otherwise, false if its ok for the item to be partially visible. Promise. - * @returns A Promise for the index of the last visible item at the specified point. - **/ - calculateLastVisible(endScrollPosition: number, wholeItem: boolean): Promise; - - /** - * This API is no longer supported. Starting with the Windows Library for JavaScript 2.0 Preview, use the ILayout2 interface. - * @returns A object that has these properties: animationPromise, newEndIndex. - **/ - endLayout(): any; - - /** - * This API is no longer supported. Starting with the Windows Library for JavaScript 2.0 Preview, use the ILayout2 interface. - * @param itemIndex The index of the item. - * @returns A Promise that returns an object with these properties: left, top, contentWidth, contentHeight, totalWidth, totalHeight. - **/ - getItemPosition(itemIndex: number): Promise; - - /** - * This API is no longer supported. Starting with the Windows Library for JavaScript 2.0 Preview, use the ILayout2 interface. - * @param itemIndex The data source index of the current item. - * @param element The element for the current item. - * @param keyPressed The key that was pressed. This function must check for the arrow keys (leftArrow, upArrow, rightArrow, downArrow), pageDown, and pageUp and determine which item the user navigated to. - * @returns A Promise that contains the index of the next item (This item becomes the current item). - **/ - getKeyboardNavigatedItem(itemIndex: number, element: HTMLElement, keyPressed: WinJS.Utilities.Key): Promise; - - /** - * This API is no longer supported. Starting with the Windows Library for JavaScript 2.0 Preview, use the ILayout2 interface. - * @returns A Promise that returns an object that has these properties: beginScrollPosition, endScrollPosition. - **/ - getScrollBarRange(): Promise; - - /** - * This API is no longer supported. Starting with the Windows Library for JavaScript 2.0 Preview, use the ILayout2 interface. - * @param x The x-coordinate to test. - * @param y The y-coordinate to test. - **/ - hitTest(x: number, y: number): void; - - /** - * This API is no longer supported. Starting with the Windows Library for JavaScript 2.0 Preview, use the ILayout2 interface. - * @param elements The elements that represent the items that were added. - **/ - itemsAdded(elements: HTMLElement[]): void; - - /** - * This API is no longer supported. Starting with the Windows Library for JavaScript 2.0 Preview, use the ILayout2 interface. - **/ - itemsMoved(): void; - - /** - * This API is no longer supported. Starting with the Windows Library for JavaScript 2.0 Preview, use the ILayout2 interface. - * @param elements The elements that represent the items that were removed. - **/ - itemsRemoved(elements: HTMLElement[]): void; - - /** - * This API is no longer supported. Starting with the Windows Library for JavaScript 2.0 Preview, use the ILayout2 interface. - * @param groupIndex The index of the group in the group data source. - * @param element The element to render for the group header. - **/ - layoutHeader(groupIndex: number, element: HTMLElement): void; - - /** - * This API is no longer supported. Starting with the Windows Library for JavaScript 2.0 Preview, use the ILayout2 interface. - * @param itemIndex The index of the item in the data source. - * @param element The element to render for the item. - **/ - layoutItem(itemIndex: number, element: HTMLElement): void; - - /** - * This API is no longer supported. Starting with the Windows Library for JavaScript 2.0 Preview, use the ILayout2 interface. - * @param element The element that represents a header in the data source. - **/ - prepareHeader(element: HTMLElement): void; - - /** - * This API is no longer supported. Starting with the Windows Library for JavaScript 2.0 Preview, use the ILayout2 interface. - * @param element An element that represents an item in the data source. - **/ - prepareItem(element: HTMLElement): void; - - /** - * This API is no longer supported. Starting with the Windows Library for JavaScript 2.0 Preview, use the ILayout2 interface. - * @param element The element being released. - **/ - releaseItem(element: HTMLElement): void; - - /** - * This API is no longer supported. Starting with the Windows Library for JavaScript 2.0 Preview, use the ILayout2 interface. - **/ - reset(): void; - - /** - * This API is no longer supported. Starting with the Windows Library for JavaScript 2.0 Preview, use the ILayout2 interface. - * @param site The layout site for the layout. You can use this object to query the hosting ListView for info you might need to lay out items. - **/ - setSite(site: ILayoutSite): void; - - /** - * This API is no longer supported. Starting with the Windows Library for JavaScript 2.0 Preview, use the ILayout2 interface. - * @param beginScrollPosition The starting pixel of the area to which the items are rendered. - * @param endScrollPosition The last pixel of the area to which the items are rendered. - * @param count The upper bound of the number of items to render. - * @returns A Promise that returns an object that has these properties: beginIndex, endIndex. - **/ - startLayout(beginScrollPosition: number, endScrollPosition: number, count: number): Promise; - - //#endregion Methods - - //#region Properties - - /** - * This API is no longer supported. Starting with the Windows Library for JavaScript 2.0 Preview, use the ILayout2 interface. - **/ - horizontal: boolean; - - //#endregion Properties - - } - /** * Represents a layout for the ListView. **/ @@ -3613,14 +3934,15 @@ declare module WinJS.UI { //#region Objects /** - * Represents an application toolbar for displaying commands. + * Displays ICommands in overlayed application pane that opens and closes at the top or bottom of the main view. **/ class AppBar { + //#region Constructors /** * Creates a new AppBar object. - * @constructor + * @constructor * @param element The DOM element that will host the control. * @param options The set of properties and values to apply to the new AppBar. **/ @@ -3631,28 +3953,28 @@ declare module WinJS.UI { //#region Events /** - * Occurs immediately after the AppBar is hidden. + * Occurs immediately after the AppBar is closed. * @param eventInfo An object that contains information about the event. **/ - onafterhide(eventInfo: Event): void; + onafterclose: (eventInfo: CustomEvent) => void; /** - * Occurs after the AppBar is shown. + * Occurs immeidately after the AppBar is opened. * @param eventInfo An object that contains information about the event. **/ - onaftershow(eventInfo: Event): void; + onafteropen: (eventInfo: CustomEvent) => void; /** - * Occurs before the AppBar is hidden. + * Occurs immediately before the AppBar is closed. Is cancelable. * @param eventInfo An object that contains information about the event. **/ - onbeforehide(eventInfo: Event): void; + onbeforeclose: (eventInfo: CustomEvent) => void; /** - * Occurs before a hidden AppBar is shown. + * Occurs immediately before the AppBar is opened. Is cancelable. * @param eventInfo An object that contains information about the event. **/ - onbeforeshow(eventInfo: Event): void; + onbeforeopen: (eventInfo: CustomEvent) => void; //#endregion Events @@ -3660,11 +3982,19 @@ declare module WinJS.UI { /** * Registers an event handler for the specified event. - * @param type The event type to register. It must be beforeshow, beforehide, aftershow, or afterhide. + * @param type The event type to register. It must be beforeopen, beforeclose, afteropen, or afterclose. * @param listener The event handler function to associate with the event. * @param useCapture Set to true to register the event handler for the capturing phase; otherwise, set to false to register the event handler for the bubbling phase. **/ - addEventListener(type: string, listener: Function, useCapture?: boolean): void; + addEventListener(eventName: string, eventHandler: Function, useCapture?: boolean): void; + + /** + * Removes an event handler that the addEventListener method registered. + * @param type The event type to unregister. It must be beforeopen, beforeclose, afteropen, or afterclose. + * @param listener The event handler function to remove. + * @param useCapture Set to true to remove the capturing phase event handler; set to false to remove the bubbling phase event handler. + **/ + removeEventListener(eventName: string, eventHandler: Function, useCapture?: boolean): void; /** * Raises an event of the specified type and with additional properties. @@ -3672,7 +4002,7 @@ declare module WinJS.UI { * @param eventProperties The set of additional properties to be attached to the event object when the event is raised. * @returns true if preventDefault was called on the event, otherwise false. **/ - dispatchEvent(type: string, eventProperties: any): boolean; + dispatchEvent(eventName: string, eventProperties: any): boolean; /** * Releases resources held by this AppBar. Call this method when the AppBar is no longer needed. After calling this method, the AppBar becomes unusable. @@ -3680,69 +4010,46 @@ declare module WinJS.UI { dispose(): void; /** - * Returns the AppBarCommand object identified by id. + * Returns the Command object identified by id. * @param id The element idenitifier (ID) of the command to be returned. - * @returns The command identified by id. If multiple commands have the same ID, returns an array of all the commands matching the ID. + * @returns The command identified by id. If multiple commands have the same ID, returns the first command found. **/ - getCommandById(id: string): AppBarCommand; - - /** - * Hides the AppBar. - **/ - hide(): void; - - /** - * Hides the specified commands of the AppBar. - * @param commands The commands to hide. The array elements may be AppBarCommand objects, or the string identifiers (IDs) of commands. - * @param immediate The parameter immediate is not supported and may be altered or unavailable in the future. true to hide the commands immediately, without animating them; otherwise, false. - **/ - hideCommands(commands: any[], immediate?: boolean): void; - - /** - * Removes an event handler that the addEventListener method registered. - * @param type The event type to unregister. It must be beforeshow, beforehide, aftershow, or afterhide. - * @param listener The event handler function to remove. - * @param useCapture Set to true to remove the capturing phase event handler; set to false to remove the bubbling phase event handler. - **/ - removeEventListener(type: string, listener: Function, useCapture?: boolean): void; - - /** - * Shows the AppBar if it is not disabled. - **/ - show(): void; - - /** - * Shows the specified commands of the AppBar. - * @param commands The commands to show. The array elements may be AppBarCommand objects, or the string identifiers (IDs) of commands. - * @param immediate The parameter immediate is not supported and may be altered or unavailable in the future. true to show the commands immediately, without animating them; otherwise, false. - **/ - showCommands(commands: any[], immediate?: boolean): void; + getCommandById(id: string): ICommand; /** * Shows the specified commands of the AppBar while hiding all other commands. - * @param commands The commands to show. The array elements may be AppBarCommand objects, or the string identifiers (IDs) of commands. - * @param immediate The parameter immediate is not supported and may be altered or unavailable in the future. true to show the specified commands (and hide the others) immediately, without animating them; otherwise, false. + * @param commands The commands to show. The array elements may be ICommand objects, or the string identifiers (IDs) of commands. **/ - showOnlyCommands(commands: any[], immediate?: boolean): void; + showOnlyCommands(commands: Array): void; + + /** + * Opens the AppBar. + **/ + open(): void; + + /** + * Closes the AppBar. + **/ + close(): void; + + /** + * Forces the AppBar to update its layout. + **/ + forceLayout(): void; //#endregion Methods //#region Properties /** - * Gets/Sets how AppBar will display itself while hidden. Values are "none" and "minimal". + * Gets/Sets how AppBar will display itself while closed. Values are "none" , "minimal", "compact" and "full". **/ closedDisplayMode: string; /** - * Sets the AppBarCommand objects that appear in the app bar. + * Gets or sets the Binding List of WinJS.UI.Command for the AppBar. **/ - commands: AppBarCommand[]; - - /** - * Gets or sets a value that indicates whether the AppBar is disabled. - **/ - disabled: boolean; + data: WinJS.Binding.List; /** * Gets the DOM element that hosts the AppBar. @@ -3750,24 +4057,55 @@ declare module WinJS.UI { element: HTMLElement; /** - * Gets a value that indicates whether the AppBar is hidden or in the process of becoming hidden. + * Gets or sets whether the AppBar is currently opened. **/ - hidden: boolean; - - /** - * Gets or sets the layout of the app bar contents. - **/ - layout: string; + opened: boolean; /** * Gets or sets a value that specifies whether the AppBar appears at the top or bottom of the main view. **/ placement: string; - /** - * Gets or sets a value that indicates whether the AppBar is sticky (won't light dismiss). If not sticky, the app bar dismisses normally when the user touches outside of the appbar. + /** + * Display options for the AppBar when closed. **/ - sticky: boolean; + static ClosedDisplayMode: { + /** + * When the AppBar is closed, it is not visible and doesn't take up any space. + **/ + none: string; + /** + * When the AppBar is closed, its height is reduced to the minimal height required to display only its overflowbutton. All other content in the AppBar is not displayed. + **/ + minimal: string; + /** + * When the AppBar is closed, its height is reduced such that button commands are still visible, but their labels are hidden. + **/ + compact: string; + /** + * When the AppBar is closed, its height is always sized to content. + **/ + full: string; + }; + + /** + * Display options for AppBar placement in relation to the main view. + */ + static Placement: { + /** + * The AppBar appears at the top of the main view + **/ + top: string; + /** + * The AppBar appears at the bottom of the main view + **/ + bottom: string; + }; + + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; //#endregion Properties @@ -3776,12 +4114,12 @@ declare module WinJS.UI { /** * Represents a command to be displayed in an app bar. **/ - class AppBarCommand { + class AppBarCommand implements ICommand { //#region Constructors /** * Creates a new AppBarCommand object. - * @constructor + * @constructor * @param element The DOM element that will host the control. * @param options The set of properties and values to apply to the new AppBarCommand. **/ @@ -3806,7 +4144,7 @@ declare module WinJS.UI { /** * Removes an event handler that the addEventListener method registered. - * @param type The event type to unregister. It must be beforeshow, beforehide, aftershow, or afterhide. + * @param type The event type to unregister. * @param listener The event handler function to remove. * @param useCapture Set to true to remove the capturing phase event handler; set to false to remove the bubbling phase event handler. **/ @@ -3872,7 +4210,7 @@ declare module WinJS.UI { onclick: Function; /** - * Gets the section of the app bar that the command is in. + * Gets the section of the parent control that the command is in. The section can only be set through constructor options. **/ section: string; @@ -3887,14 +4225,159 @@ declare module WinJS.UI { tooltip: string; /** - * Gets the type of the command. + * Gets the type of the command. The type can only be set through constructor options. **/ type: string; + /** + * Gets or sets the priority of the command + **/ + priority: number; + + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; + //#endregion Properties } + /** + * A rich input box that provides suggestions as the user types. + **/ + class AutoSuggestBox { + //#region Constructors + + /** + * Creates a new AutoSuggestBox. + * @constructor + * @param element The DOM element hosts the new AutoSuggestBox. + * @param options An object that contains one or more property/value pairs to apply to the new control. Each property of the options object corresponds to one of the control's properties or events. + **/ + constructor(element?: HTMLElement, options?: any); + + //#endregion Constructors + + //#region Events + + /** + * Raised when the user or the app changes the queryText. + * @param eventInfo An object that contains information about the event. The detail property of this object contains the following sub-properties: detail.language, detail.queryText, detail.linguisticDetails. + **/ + onquerychanged(eventInfo: CustomEvent): void; + + /** + * Raised awhen the user presses Enter. + * @param eventInfo An object that contains information about the event. The detail property of this object contains the following sub-properties: detail.language, detail.queryText, detail.linguisticDetails, detail.keyModifiers. + **/ + onquerysubmitted(eventInfo: CustomEvent): void; + + /** + * Raised when the user selects a suggested option for their query. + * @param eventInfo An object that contains information about the event. The detail property of this object contains the following sub-properties: detail.tag, detail.keyModifiers, detail.storageFile. + **/ + onresultsuggestionchosen(eventInfo: CustomEvent): void; + + /** + * Raised when the system requests suggestions from this app. + * @param eventInfo An object that contains information about the event. The detail property of this object contains the following sub-properties: detail.language, detail.linguisticDetails, detail.queryText, detail.searchSuggestionCollection. + **/ + onsuggestionsrequested(eventInfo: CustomEvent): void; + + //#endregion Events + + //#region Methods + + /** + * Registers an event handler for the specified event. + * @param eventName The name of the event to handle. Note that you drop the "on" when specifying the event name. For example, instead of specifying "onclick", you specify "click". + * @param eventHandler The event handler function to associate with the event. + * @param useCapture Set to true to register the event handler for the capturing phase; otherwise, set to false to register the event handler for the bubbling phase. + **/ + addEventListener(eventName: string, eventHandler: Function, useCapture?: boolean): void; + + /** + * Raises an event of the specified type and with additional properties. + * @param type The type (name) of the event. + * @param eventProperties The set of additional properties to be attached to the event object when the event is raised. + * @returns true if preventDefault was called on the event, otherwise false. + **/ + dispatchEvent(type: string, eventProperties: any): boolean; + + /** + * Releases resources held by this AutoSuggestBox. Call this method when the AutoSuggestBox is no longer needed. After calling this method, the AutoSuggestBox becomes unusable. + **/ + dispose(): void; + + /** + * Removes an event handler that the addEventListener method registered. + * @param eventName The name of the event that the event handler is registered for. + * @param eventCallback The event handler function to remove. + * @param useCapture Set to true to remove the capturing phase event handler; set to false to remove the bubbling phase event handler. + **/ + removeEventListener(eventName: string, eventCallback: Function, useCapture?: boolean): void; + + /** + * Specifies whether suggestions based on local files are automatically displayed in the input field, and defines the criteria that + * the system uses to locate and filter these suggestions. + * @param settings The new settings for local content suggestions. + **/ + setLocalContentSuggestionSettings(settings: any): void + + //#endregion Methods + + //#region Properties + + /** + * Gets or sets whether the first suggestion is chosen when the user presses Enter. + **/ + chooseSuggestionOnEnter: boolean; + + /** + * Gets or sets a value that specifies whether the AutoSuggestBox is disabled. If the control is disabled, it won't receive focus. + **/ + disabled: boolean; + + /** + * Gets the DOM element that hosts the AutoSuggestBox. + **/ + element: HTMLElement; + + /** + * Gets or sets the placeholder text for the AutoSuggestBox. This text is displayed if there is no other text in the input box. + **/ + placeholderText: string; + + /** + * Gets or sets the query text for the AutoSuggestBox. + **/ + queryText: string; + + /** + * Gets or sets the history context. This context is used a secondary key (the app ID is the primary key) for storing history. + **/ + searchHistoryContext: string; + + /** + * Gets or sets a value that specifies whether history is disabled. + **/ + searchHistoryDisabled: boolean; + + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; + + //#endregion Properties + + /** + * Creates the image argument for SearchSuggestionCollection.appendResultSuggestion. + * @param url The url of the image. + **/ + static createResultSuggestionImage(url: string): any; + } + /** * Provides backwards navigation in the form of a button. **/ @@ -3903,7 +4386,7 @@ declare module WinJS.UI { /** * Creates a new BackButton. - * @constructor + * @constructor * @param element The DOM element hosts the new BackButton. * @param options An object that contains one or more property/value pairs to apply to the new control. Each property of the options object corresponds to one of the control's properties or events. **/ @@ -3956,6 +4439,11 @@ declare module WinJS.UI { **/ element: HTMLElement; + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; + //#endregion Properties } @@ -3968,7 +4456,7 @@ declare module WinJS.UI { /** * Creates a new CellSpanningLayout. - * @constructor + * @constructor * @param options An object that contains one or more property/value pairs to apply to the new CellSpanningLayout. Each property of the options object corresponds to one of the object's properties or events. Event names must begin with "on". **/ constructor(options?: any); @@ -4023,10 +4511,10 @@ declare module WinJS.UI { /** * This API supports the WinJS infrastructure and is not intended to be used directly from your code. - * @param tree - * @param changedRange - * @param modifiedItems - * @param modifiedGroups + * @param tree + * @param changedRange + * @param modifiedItems + * @param modifiedGroups **/ layout(tree: ILayoutSite2, changedRange: any, modifiedItems: any, modifiedGroups: any): void; @@ -4074,10 +4562,178 @@ declare module WinJS.UI { **/ orientation: WinJS.UI.Orientation; + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; + //#endregion Properties } + /** + * Data associated with hiding a dialog. + **/ + interface ContentDialogHideInfo { + /*** + * The dialog's dismissal result. May be 'primary', 'secondary', 'none', or whatever custom value was passed to hide. + **/ + result: string + } + + /** + * Event object associated with hiding a dialog. + **/ + interface ContentDialogHideEvent extends Event { + detail: ContentDialogHideInfo + } + + /** + * Represents a command to be displayed in an AppBar or ToolBar + **/ + class Command extends AppBarCommand implements ICommand { + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; + } + + /** + * Displays a modal dialog which can display arbitrary HTML content. + **/ + class ContentDialog { + /** + * Specifies the result of dismissing the ContentDialog. + **/ + static DismissalResult: { + /** + * The dialog was dismissed without the user selecting any of the commands. The user may have dismissed the dialog by hitting the escape key or pressing the hardware back button. + **/ + none: string; + /** + * The user dismissed the dialog by pressing the primary command. + **/ + primary: string; + /** + * The user dismissed the dialog by pressing the secondary command. + **/ + secondary: string + } + + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; + + /** + * Creates a new ContentDialog control. + * @constructor + * @param The DOM element that hosts the ContentDialog control. + * @param options An object that contains one or more property/value pairs to apply to the new control. Each property of the options object corresponds to one of the control's properties or events. + **/ + constructor(element?: HTMLElement, options?: any); + + /** + * Gets the DOM element that hosts the ContentDialog control. + **/ + element: HTMLElement; + + /** + * Gets or sets the ContentDialog's visibility. + **/ + hidden: boolean; + + /** + * The text displayed as the title of the dialog. + **/ + title: string; + + /** + * The text displayed on the primary command's button. + **/ + primaryCommandText: string; + + /** + * Indicates whether the button representing the primary command is currently disabled. + **/ + primaryCommandDisabled: boolean; + + /** + * The text displayed on the secondary command's button. + **/ + secondaryCommandText: string; + + /** + * Indicates whether the button representing the secondary command is currently disabled. + **/ + secondaryCommandDisabled: boolean; + + /** + * Shows the ContentDialog. Only one ContentDialog may be shown at a time. If another ContentDialog is already shown, this ContentDialog will remain hidden. + * @returns A promise which is successfully fulfilled when the dialog is dismissed. The completion value indicates the dialog's dismissal result. This may be 'primary', 'secondary', 'none', or whatever custom value was passed to hide. If this ContentDialog cannot be shown because a ContentDialog is already showing or the ContentDialog is disposed, then the return value is a promise which is in an error state. If preventDefault() is called on the beforeshow event, then this promise will be canceled. + **/ + show(): Promise; + + /** + * Hides the ContentDialog. + * @param result A value indicating why the dialog is being hidden. The promise returned by show will be fulfilled with this value. + **/ + hide(result?: any): void; + + /** + * Disposes this control. + **/ + dispose(): void; + + /** + * Registers an event handler for the specified event. + * @param eventName The name of the event to handle. Note that you drop the "on" when specifying the event name. For example, instead of specifying "onclick", you specify "click". + * @param eventHandler The event handler function to associate with the event. + * @param useCapture Set to true to register the event handler for the capturing phase; otherwise, set to false to register the event handler for the bubbling phase. + **/ + addEventListener(type: string, listener: Function, useCapture?: boolean): void; + + /** + * Removes an event handler that the addEventListener method registered. + * @param eventName The name of the event that the event handler is registered for. + * @param eventCallback The event handler function to remove. + * @param useCapture Set to true to remove the capturing phase event handler; set to false to remove the bubbling phase event handler. + **/ + removeEventListener(type: string, listener: Function, useCapture?: boolean): void; + + /** + * Raises an event of the specified type and with additional properties. + * @param type The type (name) of the event. + * @param eventProperties The set of additional properties to be attached to the event object when the event is raised. + * @returns true if preventDefault was called on the event, otherwise false. + **/ + dispatchEvent(type: string, eventProperties: any): boolean; + + /** + * Raised just before showing a dialog. Call preventDefault on this event to stop the dialog from being shown. + * @param eventInfo An object that contains information about the event. + **/ + onbeforeshow(eventInfo: Event): void; + + /** + * Raised immediately after a dialog is fully shown. + * @param eventInfo An object that contains information about the event. + **/ + onaftershow(eventInfo: Event): void; + + /** + * Raised just before hiding a dialog. Call preventDefault on this event to stop the dialog from being hidden. + * @param eventInfo An object that contains information about the event. + **/ + onbeforehide(eventInfo: ContentDialogHideEvent): void; + + /** + * Raised immediately after a dialog is fully hidden. + * @param eventInfo An object that contains information about the event. + **/ + onafterhide(eventInfo: ContentDialogHideEvent): void; + } + /** * Allows users to pick a date value. **/ @@ -4086,7 +4742,7 @@ declare module WinJS.UI { /** * Initializes a new instance of the DatePicker control. - * @constructor + * @constructor * @param element The DOM element associated with the DatePicker control. * @param options The set of options to be applied initially to the DatePicker control. The options are the following: calendar, current, datePattern, disabled, maxYear, minYear, monthPattern, yearPattern. **/ @@ -4128,12 +4784,9 @@ declare module WinJS.UI { dispose(): void; /** - * Raises an event of the specified type and with additional properties. - * @param type The type (name) of the event. - * @param eventProperties The set of additional properties to be attached to the event object when the event is raised. - * @returns true if preventDefault was called on the event, otherwise false. + * This API supports the WinJS infrastructure and is not intended to be used directly from your code. Use render instead. **/ - raiseEvent(type: string, eventProperties: any): boolean; + static getInformation(startDate: any, endDate: any, calendar?: any, datePatterns?: any): any; /** * Removes a listener for the specified event. @@ -4192,6 +4845,11 @@ declare module WinJS.UI { **/ yearPattern: string; + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; + //#endregion Properties } @@ -4199,7 +4857,7 @@ declare module WinJS.UI { /** * Adds event-related methods to the control. **/ - class DOMEventMixin { + module DOMEventMixin { //#region Methods /** @@ -4208,7 +4866,7 @@ declare module WinJS.UI { * @param listener The listener to invoke when the event gets raised. * @param useCapture true to initiate capture; otherwise, false. **/ - addEventListener(type: string, listener: Function, useCapture?: boolean): void; + export function addEventListener(type: string, listener: Function, useCapture?: boolean): void; /** * Raises an event of the specified type, adding the specified additional properties. @@ -4216,7 +4874,7 @@ declare module WinJS.UI { * @param eventProperties The set of additional properties to be attached to the event object when the event is raised. * @returns true if preventDefault was called on the event, otherwise false. **/ - dispatchEvent(type: string, eventProperties: any): boolean; + export function dispatchEvent(type: string, eventProperties: any): boolean; /** * Removes an event listener from the control. @@ -4224,17 +4882,9 @@ declare module WinJS.UI { * @param listener The listener to remove. * @param useCapture true to initiate capture; otherwise, false. **/ - removeEventListener(type: string, listener: Function, useCapture?: boolean): void; - - /** - * Adds the set of declaratively specified options (properties and events) to the specified control. If the name of the options property begins with "on", the property value is a function and the control supports addEventListener. This method calls the addEventListener method on the control. - * @param control The control on which the properties and events are to be applied. - * @param options The set of options that are specified declaratively. - **/ - setOptions(control: any, options: any): void; + export function removeEventListener(type: string, listener: Function, useCapture?: boolean): void; //#endregion Methods - } /** @@ -4245,7 +4895,7 @@ declare module WinJS.UI { /** * Creates a new FlipView. - * @constructor + * @constructor * @param element The DOM element that hosts the control. * @param options An object that contains one or more property/value pairs to apply to the new control. Each property corresponds to one of the control's properties or events. Event names must begin with "on". For example, to provide a handler for the pageselected event, add a property named "onpageselected" and set its value to the event handler. **/ @@ -4375,6 +5025,31 @@ declare module WinJS.UI { **/ orientation: string; + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; + + /** + * Event Name + **/ + static datasourceCountChangedEvent: string; + + /** + * Event Name + **/ + static pageCompletedEvent: string; + + /** + * Event Name + **/ + static pageSelectedEvent: string; + + /** + * Event Name + **/ + static pageVisibilityChangedEvent: string; + //#endregion Properties } @@ -4387,7 +5062,7 @@ declare module WinJS.UI { /** * Creates a new Flyout object. - * @constructor + * @constructor * @param element The DOM element that will host the control. * @param options The set of properties and values to apply to the new Flyout. **/ @@ -4433,6 +5108,14 @@ declare module WinJS.UI { **/ addEventListener(type: string, listener: Function, useCapture?: boolean): void; + /** + * Raises an event of the specified type and with additional properties. + * @param type The type (name) of the event. + * @param eventProperties The set of additional properties to be attached to the event object when the event is raised. + * @returns true if preventDefault was called on the event, otherwise false. + **/ + dispatchEvent(eventName: string, eventProperties: any): boolean; + /** * Releases resources held by this object. Call this method when the object is no longer needed. After calling this method, the object becomes unusable. **/ @@ -4443,6 +5126,26 @@ declare module WinJS.UI { **/ hide(): void; + /** + * Shows the Flyout, if hidden, regardless of other states. + * @param anchor. DOM element to temporarily anchor the position of the Flyout to. This is optional if Flyout.anchor has already been set. + * @param placement The placement of the Flyout to the anchor: the string literal "top", "bottom", "left", or "right". + * @param alignment For "top" or "bottom" placement, the alignment of the Flyout to the anchor's edge: the string literal "center", "left", or "right". + **/ + show(anchor?: HTMLElement, placement?: string, alignment?: string): void; + + /** + * Shows the Flyout, if hidden, regardless of other states, top and left aligned at the specified coordinates, + * @param coordinates Required. The point where the top left corner of the flyout will appear, relative to the top and left edge of the visual viewport. + **/ + showAt(coordinates: { x: number; y: number; }): void; + + /** + * Shows the Flyout, if hidden, regardless of other states, top and left aligned at the location of the mouse event object, + * @param mouseEventObj Required. The MouseEvent Object specifying where to show the Flyout. + **/ + showAt(mouseEventObj: MouseEvent): void; + /** * Removes an event handler that the addEventListener method registered. * @param type The event type to unregister. It must be beforeshow, beforehide, aftershow, or afterhide. @@ -4451,14 +5154,6 @@ declare module WinJS.UI { **/ removeEventListener(type: string, listener: Function, useCapture?: boolean): void; - /** - * Shows the Flyout, if hidden, regardless of other states. - * @param anchor Required. The DOM element to anchor the Flyout. - * @param placement The placement of the Flyout to the anchor: the string literal "top", "bottom", "left", or "right". - * @param alignment For "top" or "bottom" placement, the alignment of the Flyout to the anchor's edge: the string literal "center", "left", or "right". - **/ - show(anchor: HTMLElement, placement?: string, alignment?: string): void; - //#endregion Methods //#region Properties @@ -4473,13 +5168,18 @@ declare module WinJS.UI { **/ anchor: HTMLElement; + /** + * Gets or sets a value that indicates whether the Flyout is disabled. + **/ + disabled: boolean; + /** * Gets the DOM element that hosts the Flyout. **/ element: HTMLElement; /** - * Gets a value that indicates whether the Flyout is hidden or in the process of becoming hidden. + * Gets a value that indicates whether the Flyout is hidden or in the process of becoming hidden, or sets the Flyout to hide or show itself. **/ hidden: boolean; @@ -4488,6 +5188,11 @@ declare module WinJS.UI { **/ placement: string; + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; + //#endregion Properties } @@ -4500,7 +5205,7 @@ declare module WinJS.UI { /** * Creates a new GridLayout object. - * @constructor + * @constructor * @param options The set of properties and values to apply to the new GridLayout. **/ constructor(options?: any); @@ -4509,20 +5214,6 @@ declare module WinJS.UI { //#region Methods - /** - * This method is no longer supported. - * @param beginScrollPosition - * @param wholeItem - **/ - calculateFirstVisible(beginScrollPosition: number, wholeItem: boolean): void; - - /** - * This method is no longer supported. - * @param endScrollPosition - * @param wholeItem - **/ - calculateLastVisible(endScrollPosition: number, wholeItem: boolean): void; - /** * This API supports the WinJS infrastructure and is not intended to be used directly from your code. **/ @@ -4533,11 +5224,6 @@ declare module WinJS.UI { **/ dragOver(): void; - /** - * This method is no longer supported. - **/ - endLayout(): void; - /** * This API supports the WinJS infrastructure and is not intended to be used directly from your code. **/ @@ -4551,27 +5237,6 @@ declare module WinJS.UI { **/ getAdjacent(currentItem: any, pressedKey: WinJS.Utilities.Key): any; - /** - * This method is no longer supported. - * @param itemIndex - **/ - getItemPosition(itemIndex: number): void; - - /** - * This method is no longer supported. - * @param itemIndex - * @param element - * @param keyPressed - **/ - getKeyboardNavigatedItem(itemIndex: number, element: any, keyPressed: any): void; - - /** - * This method is no longer supported. - * @param beginScrollPosition - * @param endScrollPosition - **/ - getScrollbarRange(beginScrollPosition: number, endScrollPosition: number): void; - /** * This API supports the WinJS infrastructure and is not intended to be used directly from your code. * @param x The x-coordinate, or the horizontal position on the screen. @@ -4579,11 +5244,6 @@ declare module WinJS.UI { **/ hitTest(x: number, y: number): void; - /** - * This method is no longer supported. - **/ - init(): void; - /** * This API supports the WinJS infrastructure and is not intended to be used directly from your code. * @param site The rendering site for the layout. @@ -4591,12 +5251,6 @@ declare module WinJS.UI { **/ initialize(site: ILayoutSite2, groupsEnabled: boolean): void; - /** - * This method is no longer supported. - * @param elements - **/ - itemsAdded(elements: any): void; - /** * This API supports the WinJS infrastructure and is not intended to be used directly from your code. * @param firstPixel The first pixel the range of items falls between. @@ -4604,94 +5258,25 @@ declare module WinJS.UI { **/ itemsFromRange(firstPixel: number, lastPixel: number): void; - /** - * This method is no longer supported. - **/ - itemsMoved(): void; - - /** - * This method is no longer supported. - * @param elements - **/ - itemsRemoved(elements: any): void; - /** * This API supports the WinJS infrastructure and is not intended to be used directly from your code. - * @param tree - * @param changedRange - * @param modifiedItems - * @param modifiedGroups + * @param tree + * @param changedRange + * @param modifiedItems + * @param modifiedGroups **/ layout(tree: any, changedRange: any, modifiedItems: any, modifiedGroups: any): void; - /** - * This method is no longer supported. - * @param groupIndex - * @param element A DOM element. - **/ - layoutHeader(groupIndex: number, element: any): void; - - /** - * This method is no longer supported. - * @param itemIndex - * @param element A DOM element. - **/ - layoutItem(itemIndex: number, element: any): void; - - /** - * This method is no longer supported. - * @param element - **/ - prepareHeader(element: HTMLElement): void; - - /** - * This method is no longer supported. - * @param itemIndex - * @param element A DOM element. - **/ - prepareItem(itemIndex: number, element: any): void; - - /** - * This method is no longer supported. - * @param item - * @param newItem - **/ - releaseItem(item: any, newItem: any): void; - - /** - * This method is no longer supported. - **/ - reset(): void; - - /** - * This method is no longer supported. - * @param layoutSite - **/ - setSite(layoutSite: any): void; - /** * This API supports the WinJS infrastructure and is not intended to be used directly from your code. **/ setupAnimations(): void; - /** - * This method is no longer supported. - * @param beginScrollPosition - * @param endScrollPositionScrollPosition - **/ - startLayout(beginScrollPosition: number, endScrollPositionScrollPosition: number): void; - /** * This API supports the WinJS infrastructure and is not intended to be used directly from your code. **/ uninitialize(): void; - /** - * This method is no longer supported. - * @param count - **/ - updateBackdrop(count: number): void; - //#endregion Methods //#region Properties @@ -4716,11 +5301,6 @@ declare module WinJS.UI { **/ groupInfo: Function; - /** - * This property is no longer supported. Starting with the Windows Library for JavaScript 2.0, use the orientation property instead. - **/ - horizontal: boolean; - /** * This property is no longer supported. Starting with the Windows Library for JavaScript 2.0, use a CellSpanningLayout. **/ @@ -4746,6 +5326,11 @@ declare module WinJS.UI { **/ orientation: WinJS.UI.Orientation; + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; + //#endregion Properties } @@ -4758,7 +5343,7 @@ declare module WinJS.UI { /** * Creates a new Hub control. - * @constructor + * @constructor * @param element The DOM element that will host the Hub control. * @param options An object that contains one or more property/value pairs to apply to the new control. Each property of the options object corresponds to one of the control's properties or events. Event names must begin with "on". For example, to provide a handler for the contentanimating event, add a property named "oncontentanimating" to the options object and set its value to the event handler. **/ @@ -4811,6 +5396,12 @@ declare module WinJS.UI { **/ dispose(): void; + /** + * Forces the Hub to update its layout. + * Use this function when making the Hub visible again after you've set its style.display property to "none” or after style changes have been made that affect the size of the HubSections. + **/ + forceLayout(): void; + /** * Removes an event handler that the addEventListener method registered. * @param eventName The name of the event that the event handler is registered for. @@ -4873,6 +5464,47 @@ declare module WinJS.UI { **/ zoomableView: IZoomableView; + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; + + /** + * Specifies whether the Hub animation is an entrance animation or a transition animation. + **/ + static AnimationType: { + /** + * The animation plays when the Hub is first displayed. + **/ + entrance: string; + /** + * The animation plays when the Hub is changing its content. + **/ + contentTransition: string; + /** + * The animation plays when a section is inserted into the Hub. + **/ + insert: string; + /** + * The animation plays when a section is removed into the Hub. + **/ + remove: string; + } + + /** + * Gets the current loading state of the Hub. + **/ + static LoadingState: { + /** + * The Hub is loading sections. + **/ + loading: string; + /** + * All sections are loaded and animations are complete. + **/ + complete: string; + } + //#endregion Properties } @@ -4885,7 +5517,7 @@ declare module WinJS.UI { /** * Creates a new HubSection. - * @constructor + * @constructor * @param element The DOM element hosts the new HubSection. * @param options An object that contains one or more property/value pairs to apply to the new control. Each property of the options object corresponds to one of the control's properties or events. **/ @@ -4924,6 +5556,16 @@ declare module WinJS.UI { **/ isHeaderStatic: boolean; + /** + * This object supports the WinJS infrastructure and is not intended to be used directly from your code. + **/ + static isDeclarativeControlContainer: any; + + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; + //#endregion Properties } @@ -4944,6 +5586,15 @@ declare module WinJS.UI { //#endregion Constructors + //#region Properties + + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; + + //#endregion Properties + } /** @@ -4954,7 +5605,7 @@ declare module WinJS.UI { /** * Creates a new ItemContainer. - * @constructor + * @constructor * @param element The DOM element hosts the new ItemContainer. For the ItemContainer to be accessible, this element must have its role attribute set to "list" or "listbox". If tapBehavior is set to none and selectionDisabled is true, then use the "list" role; otherwise, use the "listbox" role. * @param options An object that contains one or more property/value pairs to apply to the new control. Each property of the options object corresponds to one of the control's properties or events. **/ @@ -5059,6 +5710,11 @@ declare module WinJS.UI { **/ tapBehavior: TapBehavior; + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; + //#endregion Properties } @@ -5067,6 +5723,10 @@ declare module WinJS.UI { * This object supports the WinJS infrastructure and is not intended to be used directly from your code. **/ class Layout { + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; } /** @@ -5077,7 +5737,7 @@ declare module WinJS.UI { /** * Creates a new ListLayout. - * @constructor + * @constructor * @param options An object that contains one or more property/value pairs to apply to the new ListLayout. Each property of the options object corresponds to one of the object's properties or events. Event names must begin with "on". **/ constructor(options?: any); @@ -5086,20 +5746,6 @@ declare module WinJS.UI { //#region Methods - /** - * This method is no longer supported. - * @param beginScrollPosition - * @param wholeItem - **/ - calculateFirstVisible(beginScrollPosition: number, wholeItem: boolean): void; - - /** - * This method is no longer supported. - * @param endScrollPosition - * @param wholeItem - **/ - calculateLastVisible(endScrollPosition: number, wholeItem: boolean): void; - /** * This API supports the WinJS infrastructure and is not intended to be used directly from your code. **/ @@ -5110,11 +5756,6 @@ declare module WinJS.UI { **/ dragOver(): void; - /** - * This method is no longer supported. - **/ - endLayout(): void; - /** * This API supports the WinJS infrastructure and is not intended to be used directly from your code. **/ @@ -5128,27 +5769,6 @@ declare module WinJS.UI { **/ getAdjacent(currentItem: any, pressedKey: WinJS.Utilities.Key): any; - /** - * This method is no longer supported. - * @param itemIndex - **/ - getItemPosition(itemIndex: number): void; - - /** - * This method is no longer supported. - * @param itemIndex - * @param element - * @param keyPressed - **/ - getKeyboardNavigatedItem(itemIndex: number, element: HTMLElement, keyPressed: any): void; - - /** - * This method is no longer supported. - * @param beginScrollPosition - * @param endScrollPosition - **/ - getScrollbarRange(beginScrollPosition: number, endScrollPosition: number): void; - /** * This API supports the WinJS infrastructure and is not intended to be used directly from your code. * @param x The x-coordinate, or the horizontal position on the screen. @@ -5156,117 +5776,37 @@ declare module WinJS.UI { **/ hitTest(x: number, y: number): void; - /** - * This method is no longer supported. - **/ - init(): void; - /** * This API supports the WinJS infrastructure and is not intended to be used directly from your code. **/ initialize(): void; - /** - * This method is no longer supported. - * @param elements - **/ - itemsAdded(elements: any): void; - /** * This API supports the WinJS infrastructure and is not intended to be used directly from your code. - * @param firstPixel - * @param lastPixel + * @param firstPixel + * @param lastPixel **/ itemsFromRange(firstPixel: number, lastPixel: number): void; - /** - * This method is no longer supported. - **/ - itemsMoved(): void; - - /** - * This method is no longer supported. - * @param elements - **/ - itemsRemoved(elements: any): void; - /** * This API supports the WinJS infrastructure and is not intended to be used directly from your code. - * @param tree - * @param changedRange - * @param modifiedItems - * @param modifiedGroups + * @param tree + * @param changedRange + * @param modifiedItems + * @param modifiedGroups **/ layout(tree: any, changedRange: any, modifiedItems: any, modifiedGroups: any): void; - /** - * This method is no longer supported. - * @param groupIndex - * @param element A DOM element. - **/ - layoutHeader(groupIndex: number, element: any): void; - - /** - * This method is no longer supported. - * @param itemIndex - * @param element A DOM element. - **/ - layoutItem(itemIndex: number, element: any): void; - - /** - * This method is no longer supported. - * @param element - **/ - prepareHeader(element: HTMLElement): void; - - /** - * This method is no longer supported. - * @param itemIndex - * @param element A DOM element. - **/ - prepareItem(itemIndex: number, element: any): void; - - /** - * This method is no longer supported. - * @param item - * @param newItem - **/ - releaseItem(item: any, newItem: any): void; - - /** - * This method is no longer supported. - **/ - reset(): void; - - /** - * This method is no longer supported. - * @param layoutSite - **/ - setSite(layoutSite: any): void; - /** * This API supports the WinJS infrastructure and is not intended to be used directly from your code. **/ setupAnimations(): void; - /** - * This method is no longer supported. - * @param beginScrollPosition - * @param endScrollPositionScrollPosition - **/ - startLayout(beginScrollPosition: number, endScrollPositionScrollPosition: number): void; - /** * This API supports the WinJS infrastructure and is not intended to be used directly from your code. **/ uninitialize(): void; - /** - * This method is no longer supported. - * @param count - **/ - updateBackdrop(count: number): void; - //#endregion Methods //#region Properties @@ -5286,21 +5826,6 @@ declare module WinJS.UI { **/ groupHeaderPosition: WinJS.UI.HeaderPosition; - /** - * This property is no longer supported. Starting with the Windows Library for JavaScript 2.0, use a CellSpanningLayout. - **/ - groupInfo: Function; - - /** - * This property is no longer supported. Starting with the Windows Library for JavaScript 2.0, use the orientation property instead. - **/ - horizontal: boolean; - - /** - * This property is no longer supported. Starting with the Windows Library for JavaScript 2.0, use a CellSpanningLayout. - **/ - itemInfo: Function; - /** * This API supports the WinJS infrastructure and is not intended to be used directly from your code. **/ @@ -5311,6 +5836,11 @@ declare module WinJS.UI { **/ orientation: WinJS.UI.Orientation; + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; + //#endregion Properties } @@ -5323,7 +5853,7 @@ declare module WinJS.UI { /** * Creates a new ListView. - * @constructor + * @constructor * @param element The DOM element that hosts the ListView control. * @param options An object that contains one or more property/value pairs to apply to the new control. Each property of the options object corresponds to one of the control's properties or events. Event names must begin with "on". For example, to provide a handler for the selectionchanged event, add a property named "onselectionchanged" to the options object and set its value to the event handler. **/ @@ -5333,6 +5863,12 @@ declare module WinJS.UI { //#region Events + /** + * Raised when the accessibility attributes have been added to the ListView items. + * @param eventInfo An object that contains information about the event. The detail property of this object contains the following sub-properties detail.firstIndex, detail.lastIndex, detail.firstHeaderIndex, detail.lastHeaderIndex. + **/ + onaccessibilityannotationcomplete(eventInfo: CustomEvent): void; + /** * Occurs when the ListView is about to play an entrance or contentTransition animation. * @param eventInfo An object that contains information about the event. The detail property of this object contains the following sub-properties: detail.type, detail.setPromise. @@ -5417,6 +5953,18 @@ declare module WinJS.UI { **/ onselectionchanging(eventInfo: CustomEvent): void; + /** + * Raised when the header's visibility property changes. + * @param eventInfo An object that contains information about the event. The detail property of this object contains the following sub-properties: detail.visible. + **/ + onheadervisibilitychanged(eventInfo: CustomEvent): void; + + /** + * Raised when the footer's visibility property changes. + * @param eventInfo An object that contains information about the event. The detail property of this object contains the following sub-properties: detail.visible. + **/ + onfootervisibilitychanged(eventInfo: CustomEvent): void; + //#endregion Events //#region Methods @@ -5559,6 +6107,16 @@ declare module WinJS.UI { **/ layout: ILayout2; + /** + * Gets or sets the footer of the ListView. + **/ + footer: HTMLElement; + + /** + * Gets or sets the header of the ListView. + **/ + header: HTMLElement; + /** * Gets or sets a value that specifies how the ListView fetches items and adds and removes them to the DOM. Don't change the value of this property after the ListView has begun loading data. **/ @@ -5575,15 +6133,25 @@ declare module WinJS.UI { maxDeferredItemCleanup: number; /** - * Gets or sets the number of pages to load when the loadingBehavior property is set to "incremental" and the user scrolls beyond the threshold specified by the pagesToLoadThreshold property. + * This property is deprecated. Gets or sets the number of pages to load when the loadingBehavior property is set to "incremental" and the user scrolls beyond the threshold specified by the pagesToLoadThreshold property. **/ pagesToLoad: number; /** - * Gets or sets the threshold (in pages) for initiating an incremental load. When the last visible item is within the specified number of pages from the end of the loaded portion of the list, and if automaticallyLoadPages is true and loadingBehavior is set to "incremental", the ListView initiates an incremental load. + * This property is deprecated. Gets or sets the threshold (in pages) for initiating an incremental load. When the last visible item is within the specified number of pages from the end of the loaded portion of the list, and if automaticallyLoadPages is true and loadingBehavior is set to "incremental", the ListView initiates an incremental load. **/ pagesToLoadThreshold: number; + /** + * Gets or sets the maximum number of pages to prefetch in the leading buffer for virtualization. + **/ + maxLeadingPages: number; + + /** + * Gets or sets the maximum number of pages to prefetch in the trailing buffer for virtualization. + **/ + maxTrailingPages: number; + /** * Gets or sets the function that is called when the ListView discards or recycles the element representation of a group header. **/ @@ -5624,19 +6192,59 @@ declare module WinJS.UI { **/ zoomableView: IZoomableView>; + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; + //#endregion Properties } /** - * A tab control that displays multiple items. -**/ + * An enumeration of Media commands that the transport bar buttons support. + **/ + interface MediaCommand { + audioTracks: string; + cast: string; + chapterSkipBack: string; + chapterSkipForward: string; + closedCaptions: string; + fastForward: string; + goToLive: string; + nextTrack: string; + pause: string; + play: string; + playbackRate: string; + playFromBeginning: string; + previousTrack: string; + rewind: string; + seek: string; + stop: string; + timeSkipBack: string; + timeSkipForward: string; + volume: string; + zoom: string; + } + + /** + * The types of timeline markers supported by the MediaPlayer. + **/ + interface MarkerType { + advertisement: string; + chapter: string; + custom: string; + } + + /** + * A tab control that displays multiple items. + **/ class Pivot { //#region Constructors /** * Creates a new Pivot. - * @constructor + * @constructor * @param element The DOM element hosts the new Pivot. * @param options An object that contains one or more property/value pairs to apply to the new control. Each property of the options object corresponds to one of the control's properties or events. Event names must begin with "on". For example, to provide a handler for the cancel event, add a property named "oncancel" to the options object and set its value to the event handler. **/ @@ -5689,6 +6297,12 @@ declare module WinJS.UI { **/ dispose(): void; + /** + * Forces the control to relayout its content. This function is expected to be called + * when the pivot element is manually resized. + **/ + forceLayout(): void; + /** * Removes an event handler that the addEventListener method registered. * @param eventName The name of the event that the event handler is registered for. @@ -5706,6 +6320,16 @@ declare module WinJS.UI { **/ element: HTMLElement; + /** + * Gets or sets the left custom header. + **/ + customLeftHeader: HTMLElement; + + /** + * Gets or sets the right custom header. + **/ + customRightHeader: HTMLElement; + /** * Gets or sets the Binding.List that contains the PivotItem objects that belong to this Pivot. **/ @@ -5726,6 +6350,11 @@ declare module WinJS.UI { **/ selectedItem: PivotItem; + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; + /** * Gets or sets the title displayed above the PivotItem controls. **/ @@ -5742,7 +6371,7 @@ declare module WinJS.UI { /** * Creates a new PivotItem. - * @constructor + * @constructor * @param element The DOM element hosts the new PivotItem. * @param options An object that contains one or more property/value pairs to apply to the new control. Each property of the options object corresponds to one of the control's properties or events. Event names must begin with "on". For example, to provide a handler for the cancel event, add a property named "oncancel" to the options object and set its value to the event handler. **/ @@ -5776,6 +6405,16 @@ declare module WinJS.UI { **/ header: string; + /** + * This object supports the WinJS infrastructure and is not intended to be used directly from your code. + **/ + static isDeclarativeControlContainer: any; + + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; + //#endregion Properties } @@ -5787,7 +6426,7 @@ declare module WinJS.UI { /** * Creates a new Menu object. - * @constructor + * @constructor * @param element The DOM element that will host the control. * @param options The set of properties and values to apply to the new Menu. **/ @@ -5833,6 +6472,14 @@ declare module WinJS.UI { **/ addEventListener(type: string, listener: Function, useCapture?: boolean): void; + /** + * Raises an event of the specified type and with additional properties. + * @param type The type (name) of the event. + * @param eventProperties The set of additional properties to be attached to the event object when the event is raised. + * @returns true if preventDefault was called on the event, otherwise false. + **/ + dispatchEvent(eventName: string, eventProperties: any): boolean; + /** * Releases resources held by this Menu. Call this method when the Menu is no longer needed. After calling this method, the Menu becomes unusable. **/ @@ -5855,7 +6502,7 @@ declare module WinJS.UI { * @param commands The commands to hide. The array elements may be MenuCommand objects, or the string identifiers (IDs) of commands. * @param immediate The parameter immediate is not supported and may be altered or unavailable in the future. true to hide the commands immediately, without animating them; otherwise, false. **/ - hideCommands(commands: any[], immediate: boolean): void; + hideCommands(commands: any[], immediate?: boolean): void; /** * Removes an event handler that the addEventListener method registered. @@ -5873,19 +6520,32 @@ declare module WinJS.UI { **/ show(anchor: HTMLElement, placement?: string, alignment?: string): void; + /** + * Shows the Menu, if hidden, regardless of other states, top and left aligned at the specified coordinates, + * @param coordinates Required. The point where the top left corner of the Menu will appear, relative to the top and left edge of the visual viewport. + **/ + showAt(coordinates: { x: number; y: number; }): void; + + /** + * Shows the Menu, if hidden, regardless of other states, top and left aligned at the location of the mouse event object, + * @param mouseEventObj Required. The MouseEvent Object specifying where to show the Menu. + **/ + showAt(mouseEventObj: MouseEvent): void; + + /** * Shows the specified commands of the Menu. * @param commands The commands to show. The array elements may be Menu objects, or the string identifiers (IDs) of commands. * @param immediate The parameter immediate is not supported and may be altered or unavailable in the future. true to show the commands immediately, without animating them; otherwise, false. **/ - showCommands(commands: any[], immediate: boolean): void; + showCommands(commands: any[], immediate?: boolean): void; /** * Shows the specified commands of the Menu while hiding all other commands. * @param commands The commands to show. The array elements may be MenuCommand objects, or the string identifiers (IDs) of commands. * @param immediate The parameter immediate is not supported and may be altered or unavailable in the future. true to show the specified commands (and hide the others) immediately, without animating them; otherwise, false. **/ - showOnlyCommands(commands: any[], immediate: boolean): void; + showOnlyCommands(commands: any[], immediate?: boolean): void; //#endregion Methods @@ -5906,13 +6566,18 @@ declare module WinJS.UI { **/ commands: MenuCommand[]; + /** + * Gets or sets a value that indicates whether the Menu is disabled. + **/ + disabled: boolean; + /** * Gets the DOM element that hosts the Menu. **/ element: HTMLElement; /** - * Gets a value that indicates whether the Menu is hidden or in the process of becoming hidden. + * Gets a value that indicates whether the Menu is hidden or in the process of becoming hidden, or sets the Menu to hide or show itself. **/ hidden: boolean; @@ -5921,6 +6586,11 @@ declare module WinJS.UI { **/ placement: string; + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; + //#endregion Properties } @@ -5933,7 +6603,7 @@ declare module WinJS.UI { /** * Creates a new MenuCommand object. - * @constructor + * @constructor * @param element The DOM element that will host the control. * @param options The set of properties and values to apply to the new MenuCommand. **/ @@ -5945,7 +6615,7 @@ declare module WinJS.UI { /** * Registers an event handler for the specified event. - * @param type The event type to register. It must be beforeshow, beforehide, aftershow, or afterhide. + * @param type The event type to register. * @param listener The event handler function to associate with the event. * @param useCapture Set to true to register the event handler for the capturing phase; otherwise, set to false to register the event handler for the bubbling phase. **/ @@ -5958,7 +6628,7 @@ declare module WinJS.UI { /** * Removes an event handler that the addEventListener method registered. - * @param type The event type to unregister. It must be beforeshow, beforehide, aftershow, or afterhide. + * @param type The event type to unregister. * @param listener The event handler function to remove. * @param useCapture Set to true to remove the capturing phase event handler; set to false to remove the bubbling phase event handler. **/ @@ -6013,6 +6683,11 @@ declare module WinJS.UI { **/ selected: boolean; + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; + /** * Gets the type of the command. **/ @@ -6023,14 +6698,14 @@ declare module WinJS.UI { } /** - * Displays navigation commands in a toolbar that the user can show or hide. + * Displays NavBarCommands in an overlayed navigation pane that opens and closes at the top or bottom of the main view. **/ class NavBar { //#region Constructors /** * Creates a new NavBar. - * @constructor + * @constructor * @param element The DOM element that will host the new NavBar. * @param options An object that contains one or more property/value pairs to apply to the new control. Each property of the options object corresponds to one of the control's properties or events. **/ @@ -6041,28 +6716,28 @@ declare module WinJS.UI { //#region Events /** - * Occurs immediately after the NavBar is hidden. + * Occurs immediately after the NavBar is closed. * @param eventInfo An object that contains information about the event. **/ - onafterhide(eventInfo: Event): void; + onafterclose(eventInfo: Event): void; /** - * Raised after the NavBar is shown. + * Raised after the NavBar is opened. * @param eventInfo An object that contains information about the event. **/ - onaftershow(eventInfo: Event): void; + onafteropen(eventInfo: Event): void; /** - * Raised just before the NavBar is hidden. + * Raised just before the NavBar is closed. * @param eventInfo An object that contains information about the event. **/ - onbeforehide(eventInfo: Event): void; + onbeforeclose(eventInfo: Event): void; /** - * Occurs before a hidden NavBar is shown. + * Occurs before a closed NavBar is opened. * @param eventInfo An object that contains information about the event. **/ - onbeforeshow(eventInfo: Event): void; + onbeforeopen(eventInfo: Event): void; /** * Occurs after the NavBar has finished processing its child elements. @@ -6096,16 +6771,16 @@ declare module WinJS.UI { dispose(): void; /** - * Hides the NavBar. + * Closes the NavBar. **/ - hide(): void; + close(): void; /** * Hides the specified commands of the NavBar. * @param commands The commands to hide. The array elements may be NavBarCommand objects, or the string identifiers (IDs) of commands. * @param immediate The parameter immediate is not supported and may be altered or unavailable in the future. true to hide the commands immediately, without animating them; otherwise, false. **/ - hideCommands(commands: any[], immediate: boolean): void; + hideCommands(commands: any[], immediate?: boolean): void; /** * Removes an event handler that the addEventListener method registered. @@ -6116,52 +6791,59 @@ declare module WinJS.UI { removeEventListener(eventName: string, eventCallback: Function, useCapture?: boolean): void; /** - * Shows the NavBar if it is not disabled. + * Opens the NavBar **/ - show(): void; + open(): void; /** * Shows the specified commands of the NavBar. * @param commands The commands to show. The array elements may be NavBarCommand objects, or the string identifiers (IDs) of commands. * @param immediate The parameter immediate is not supported and may be altered or unavailable in the future. true to show the commands immediately, without animating them; otherwise, false. **/ - showCommands(commands: any[], immediate: boolean): void; + showCommands(commands: any[], immediate?: boolean): void; /** * Shows the specified commands of the NavBar while hiding all other commands. * @param commands The commands to show. The array elements may be NavBarCommand objects, or the string identifiers (IDs) of commands. * @param immediate The parameter immediate is not supported and may be altered or unavailable in the future. true to show the specified commands (and hide the others) immediately, without animating them; otherwise, false. **/ - showOnlyCommands(commands: any[], immediate: boolean): void; + showOnlyCommands(commands: any[], immediate?: boolean): void; //#endregion Methods //#region Properties + /** + * Gets/Sets how NavBar will display itself while closed. Values are "none" and "minimal". + **/ + closedDisplayMode: string; + /** * This API supports the WinJS infrastructure and is not intended to be used directly from your code. **/ commands: AppBarCommand; - /** - * Gets or sets a value that indicates whether the NavBar is disabled. - **/ - disabled: boolean; - /** * Gets the HTML element that hosts this NavBar. **/ element: HTMLElement; /** - * Gets a value that indicates whether the NavBar is hidden or in the process of becoming hidden. + * Returns the NavBarCommand object identified by id. + * @param id The element idenitifier (ID) of the NavBarCommand to be returned. + * @returns The NavBarCommand identified by id. If multiple commands have the same ID, returns the first command found. + **/ + getCommandById(id: string): NavBarCommand; + + /** + * This API supports the WinJS infrastructure and is not intended to be used directly from your code. Use NavBar.opened instead. **/ hidden: boolean; /** - * This API supports the WinJS infrastructure and is not intended to be used directly from your code. + * Gets a value that indicates whether the NavBar is opened or in the process of becoming opened, or sets the NavBar to open or close itself. **/ - layout: string; + opened: boolean; /** * Gets or sets a value that specifies whether the NavBar appears at the top or bottom of the main view. @@ -6169,9 +6851,14 @@ declare module WinJS.UI { placement: string; /** - * Gets or sets a value that indicates whether the NavBar is sticky (won't light dismiss). If not sticky, the NavBar dismisses normally when the user touches outside of the NavBar. + * This object supports the WinJS infrastructure and is not intended to be used directly from your code. **/ - sticky: boolean; + static isDeclarativeControlContainer: any; + + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; //#endregion Properties @@ -6185,7 +6872,7 @@ declare module WinJS.UI { /** * Creates a new NavBarCommand. - * @constructor + * @constructor * @param element The DOM element hosts the new NavBarCommand. * @param options An object that contains one or more property/value pairs to apply to the new control. Each property of the options object corresponds to one of the control's properties or events. **/ @@ -6193,6 +6880,16 @@ declare module WinJS.UI { //#endregion Constructors + //#region Events + + /** + * This API supports the Windows Library for JavaScript infrastructure and is not intended to be used directly from your code. + * Use NavBarContainer.oninvoked instead. + **/ + oninvoked: any; + + //#endregion Events + //#region Methods /** @@ -6263,10 +6960,15 @@ declare module WinJS.UI { **/ state: any; + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; + /** * Gets or sets the tooltip of the command. **/ - tooltip: any; + tooltip: string; //#endregion Properties @@ -6280,7 +6982,7 @@ declare module WinJS.UI { /** * Creates a new NavBarContainer. - * @constructor + * @constructor * @param element The DOM element hosts the new NavBarContainer. * @param options An object that contains one or more property/value pairs to apply to the new control. Each property of the options object corresponds to one of the control's properties or events. **/ @@ -6374,6 +7076,11 @@ declare module WinJS.UI { **/ maxRows: number; + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; + /** * Gets or sets the WinJS.Binding.Template or templating function that creates the DOM elements for each item in the data source. Each item can contain multiple elements, but it must have a single root element. **/ @@ -6391,7 +7098,7 @@ declare module WinJS.UI { /** * Creates a new Rating. - * @constructor + * @constructor * @param element The DOM element hosts the new Rating. * @param options An object that contains one or more property/value pairs to apply to the new control. Each property of the options object corresponds to one of the control's properties or events. Event names must begin with "on". For example, to provide a handler for the cancel event, add a property named "oncancel" to the options object and set its value to the event handler. **/ @@ -6473,6 +7180,11 @@ declare module WinJS.UI { **/ maxRating: number; + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; + /** * Gets or sets a set of descriptions to show for rating values in the tooltip. **/ @@ -6495,11 +7207,11 @@ declare module WinJS.UI { /** * Creates a new Repeater control. - * @constructor + * @constructor * @param elemnt The DOM element that will host the new control. The Repeater will create an element if this value is null. * @param options An object that contains one or more property/value pairs to apply to the new Repeater. Each property of the options object corresponds to one of the object's properties or events. Event names must begin with "on". **/ - constructor(element?:HTMLElement, options?: any); + constructor(element?: HTMLElement, options?: any); //#endregion Constructors @@ -6630,6 +7342,16 @@ declare module WinJS.UI { **/ length: number; + /** + * This object supports the WinJS infrastructure and is not intended to be used directly from your code. + **/ + static isDeclarativeControlContainer: any; + + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; + /** * Gets or sets a WinJS.Binding.Template or custom rendering function that defines the HTML of each item within the Repeater. **/ @@ -6647,7 +7369,7 @@ declare module WinJS.UI { /** * Creates a new SearchBox. - * @constructor + * @constructor * @param element The DOM element hosts the new SearchBox. * @param options An object that contains one or more property/value pairs to apply to the new control. Each property of the options object corresponds to one of the control's properties or events. **/ @@ -6669,17 +7391,11 @@ declare module WinJS.UI { **/ onquerysubmitted(eventInfo: CustomEvent): void; - /** - * Raised when the app automatically redirects focus to the search box. This event can only be raised when the focusOnKeyboardInput property is set to true. - * @param eventInfo An object that contains information about the event. The detail property of this object contains the following sub-properties: detail.propertyName. - **/ - onreceivingfocusonkeyboardinput(eventInfo: CustomEvent): void; - /** * Raised when the user selects a suggested option for the search. * @param eventInfo An object that contains information about the event. The detail property of this object contains the following sub-properties: detail.tag, detail.keyModifiers, detail.storageFile. **/ - onresultsuggestionschosen(eventInfo: CustomEvent): void; + onresultsuggestionchosen(eventInfo: CustomEvent): void; /** * Raised when the system requests search suggestions from this app. @@ -6770,6 +7486,11 @@ declare module WinJS.UI { **/ searchHistoryDisabled: boolean; + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; + //#endregion Properties static createResultSuggestionImage(url: string): any; @@ -6784,7 +7505,7 @@ declare module WinJS.UI { /** * Creates a new SemanticZoom. - * @constructor + * @constructor * @param element The DOM element that hosts the SemanticZoom. * @param options An object that contains one or more property/value pairs to apply to the new control. This object can contain these properties: initiallyZoomedOut Boolean, zoomFactor 0.2–0.85. **/ @@ -6838,6 +7559,11 @@ declare module WinJS.UI { **/ removeEventListener(eventName: string, eventCallback: Function, useCapture?: boolean): void; + /** + * This API supports the WinJS infrastructure and is not intended to be used directly from your code. + **/ + setTimeoutAfterTTFF(callback: Function, delay: number): void + //#endregion Methods //#region Properties @@ -6852,16 +7578,16 @@ declare module WinJS.UI { **/ enableButton: boolean; - /** - * Determines whether any controls contained in a SemanticZoom should be processed separately. This property is always true, meaning that the SemanticZoom takes care of processing its own controls. - **/ - isDeclarativeControlContainer: boolean; - /** * Gets or sets a value that indicates whether SemanticZoom is locked and zooming between views is disabled. **/ locked: boolean; + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; + /** * Gets or sets a value that indicates whether the control is zoomed out. **/ @@ -6872,6 +7598,16 @@ declare module WinJS.UI { **/ zoomFactor: number; + /** + * Gets or sets a mapping function which can be used to change the item that is targeted on zoom in. + **/ + zoomedInItem: (any: any) => any; + + /** + * Gets or sets a mapping function which can be used to change the item that is targeted on zoom out. + **/ + zoomedOutItem: (any: any) => any; + //#endregion Properties } @@ -6884,7 +7620,7 @@ declare module WinJS.UI { /** * Creates a new SettingsFlyout object. - * @constructor + * @constructor * @param element The DOM element that will host the control. * @param options The set of properties and values to apply to the new SettingsFlyout. **/ @@ -6979,10 +7715,20 @@ declare module WinJS.UI { **/ static showSettings(id: string, path: any): void; + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; + //#endregion Methods //#region Properties + /** + * Specifies whether the SettingsFlyout is disabled. + **/ + disabled: boolean; + /** * Gets the DOM element the SettingsFlyout is attached to. **/ @@ -7006,6 +7752,325 @@ declare module WinJS.UI { //#endregion Properties } + /** + * Displays a SplitView which renders a collapsable pane next to arbitrary HTML content. + **/ + class SplitView { + /** + * Placement options for a SplitView's pane. + **/ + static PanePlacement: { + /** + * Pane is positioned left of the SplitView's content. + **/ + left: string; + /** + * Pane is positioned right of the SplitView's content. + **/ + right: string; + /** + * Pane is positioned above the SplitView's content. + **/ + top: string; + /** + * Pane is positioned below the SplitView's content. + **/ + bottom: string; + } + + /** + * Display options for a SplitView's pane when it is closed. + **/ + static ClosedDisplayMode: { + /** + * When the pane is closed, it is not visible and doesn't take up any space. + **/ + none: string; + /** + * When the pane is closed, it occupies space leaving less room for the SplitView's content. + **/ + inline: string; + } + + /** + * Display options for a SplitView's pane when it is open. + **/ + static OpenedDisplayMode: { + /** + * When the pane is open, it occupies space leaving less room for the SplitView's content. + **/ + inline: string; + /** + * When the pane is open, it doesn't take up any space and it is light dismissable. + **/ + overlay: string; + } + + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; + + /** + * Creates a new SplitView. + * @constructor + * @param element The DOM element hosts the new SplitView. + * @param options An object that contains one or more property/value pairs to apply to the new control. Each property of the options object corresponds to one of the control's properties or events. + **/ + constructor(element?: HTMLElement, options?: any); + + /** + * Gets the DOM element that hosts the SplitView control. + **/ + element: HTMLElement; + + /** + * Gets the DOM element that hosts the SplitView pane. + **/ + paneElement: HTMLElement; + + /** + * Gets the DOM element that hosts the SplitView's content. + **/ + contentElement: HTMLElement; + + /** + * Gets or sets the placement of the SplitView's pane. + **/ + panePlacement: string; + + /** + * Gets or sets the display mode of the SplitView's pane when it is closed. + **/ + closedDisplayMode: string; + + /** + * Gets or sets the display mode of the SplitView's pane when it is open. + **/ + openedDisplayMode: string; + + /** + * Gets or sets whether the SpitView's pane is currently open. + **/ + paneOpened: boolean; + + /** + * Opens the SplitView's pane. + **/ + openPane(): void; + + /** + * Closes the SplitView's pane. + **/ + closePane(): void; + + /** + * Disposes this control. + **/ + dispose(): void; + + /** + * Registers an event handler for the specified event. + * @param eventName The name of the event to handle. Note that you drop the "on" when specifying the event name. For example, instead of specifying "onclick", you specify "click". + * @param eventHandler The event handler function to associate with the event. + * @param useCapture Set to true to register the event handler for the capturing phase; otherwise, set to false to register the event handler for the bubbling phase. + **/ + addEventListener(eventName: string, eventHandler: Function, useCapture?: boolean): void; + + /** + * Removes an event handler that the addEventListener method registered. + * @param eventName The name of the event that the event handler is registered for. + * @param eventCallback The event handler function to remove. + * @param useCapture Set to true to remove the capturing phase event handler; set to false to remove the bubbling phase event handler. + **/ + removeEventListener(eventName: string, eventCallback: Function, useCapture?: boolean): void; + + /** + * Raises an event of the specified type and with additional properties. + * @param type The type (name) of the event. + * @param eventProperties The set of additional properties to be attached to the event object when the event is raised. + * @returns true if preventDefault was called on the event, otherwise false. + **/ + dispatchEvent(type: string, eventProperties: any): boolean; + + /** + * Raised just before opening the pane. Call preventDefault on this event to stop the pane from opening. + * @param eventInfo An object that contains information about the event. + **/ + onbeforeopen(eventInfo: Event): void; + + /** + * Raised immediately after the pane is fully open. + * @param eventInfo An object that contains information about the event. + **/ + onafteropen(eventInfo: Event): void; + + /** + * Raised just before closing the pane. Call preventDefault on this event to stop the pane from closing. + * @param eventInfo An object that contains information about the event. + **/ + onbeforeclose(eventInfo: Event): void; + + /** + * Raised immediately after the pane is fully closed. + * @param eventInfo An object that contains information about the event. + **/ + onafterclose(eventInfo: Event): void; + } + + /** + * Displays a button which is used for opening and closing a SplitView's pane. + **/ + class SplitViewPaneToggle { + /** + * Creates a new SplitViewPaneToggle. + * @constructor + * @param element The DOM element hosts the new SplitViewPaneToggle. + * @param options An object that contains one or more property/value pairs to apply to the new control. Each property of the options object corresponds to one of the control's properties or events. + **/ + constructor(element?: HTMLButtonElement, options?: any); + + /** + * Gets the DOM element that hosts the SplitViewPaneToggle control. + **/ + element: HTMLButtonElement; + + /** + * Gets or sets the DOM element of the SplitView that is associated with the SplitViewPaneToggle control. + * When the SplitViewPaneToggle is invoked, it'll toggle this SplitView's pane. + **/ + splitView: HTMLElement; + + /** + * Disposes this control. + **/ + dispose(): void; + + /** + * Registers an event handler for the specified event. + * @param eventName The name of the event to handle. Note that you drop the "on" when specifying the event name. For example, instead of specifying "onclick", you specify "click". + * @param eventHandler The event handler function to associate with the event. + * @param useCapture Set to true to register the event handler for the capturing phase; otherwise, set to false to register the event handler for the bubbling phase. + **/ + addEventListener(eventName: string, eventHandler: Function, useCapture?: boolean): void; + + /** + * Removes an event handler that the addEventListener method registered. + * @param eventName The name of the event that the event handler is registered for. + * @param eventCallback The event handler function to remove. + * @param useCapture Set to true to remove the capturing phase event handler; set to false to remove the bubbling phase event handler. + **/ + removeEventListener(eventName: string, eventCallback: Function, useCapture?: boolean): void; + + /** + * Raises an event of the specified type and with additional properties. + * @param type The type (name) of the event. + * @param eventProperties The set of additional properties to be attached to the event object when the event is raised. + * @returns true if preventDefault was called on the event, otherwise false. + **/ + dispatchEvent(type: string, eventProperties: any): boolean; + + /** + * Raised when the SplitViewPaneToggle is invoked. + * @param eventInfo An object that contains information about the event. + **/ + oninvoked(eventInfo: Event): void; + + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; + + } + + /** + * Represents a command in the SplitView Pane. + **/ + class SplitViewCommand { + //#region Constructors + + /** + * Creates a new SplitViewCommand. + * @constructor + * @param element The DOM element hosts the new SplitViewCommand. + * @param options An object that contains one or more property/value pairs to apply to the new control. Each property of the options object corresponds to one of the control's properties or events. + **/ + constructor(element?: HTMLElement, options?: any); + + //#endregion Constructors + + //# region Events + + /** + * Raised when a SplitViewCommand has been invoked. + * @param eventInfo An object that contains information about the event. + **/ + oninvoked(eventInfo: CustomEvent): void; + + //#endregion Events + + //#region Methods + + /** + * Registers an event handler for the specified event. + * @param eventName The name of the event to handle. Note that you drop the "on" when specifying the event name. For example, instead of specifying "onclick", you specify "click". + * @param eventHandler The event handler function to associate with the event. + * @param useCapture Set to true to register the event handler for the capturing phase; otherwise, set to false to register the event handler for the bubbling phase. + **/ + addEventListener(eventName: string, eventHandler: Function, useCapture?: boolean): void; + + /** + * Raises an event of the specified type and with additional properties. + * @param type The type (name) of the event. + * @param eventProperties The set of additional properties to be attached to the event object when the event is raised. + * @returns true if preventDefault was called on the event, otherwise false. + **/ + dispatchEvent(type: string, eventProperties: any): boolean; + + /** + * Releases resources held by this SplitViewCommand. Call this method when the SplitViewCommand is no longer needed. After calling this method, the SplitViewCommand becomes unusable. + **/ + dispose(): void; + + /** + * Removes an event handler that the addEventListener method registered. + * @param eventName The name of the event that the event handler is registered for. + * @param eventCallback The event handler function to remove. + * @param useCapture Set to true to remove the capturing phase event handler; set to false to remove the bubbling phase event handler. + **/ + removeEventListener(eventName: string, eventCallback: Function, useCapture?: boolean): void; + + //#endregion Methods + + //#region Properties + + /** + * Gets the HTML element that hosts this SplitViewCommand. + **/ + element: HTMLElement; + + /** + * Gets or sets the command's icon. + **/ + icon: string; + + /** + * Gets or sets the label of the command. + **/ + label: string; + + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; + + /** + * Gets or sets the tooltip of the command. + **/ + tooltip: string; + + //#endregion Properties + } /** * A type of IListDataSource that provides read-access to an object that implements the IStorageQueryResultBase interface. A StorageDataSource enables you to query and bind to items in the data source. @@ -7033,8 +8098,37 @@ declare module WinJS.UI { **/ loadThumbnail(item: IItem, image: HTMLImageElement): Promise; + /** + * Registers an event handler for the specified event. + * @param type The name of the event for which to add a listener. + * @param eventHandler The event handler function to associate with the event. + * @param useCapture Set to true to register the event handler for the capturing phase; otherwise, set to false to register the event handler for the bubbling phase. + **/ + addEventListener(type: string, eventHandler: Function, useCapture?: boolean): void; + + /** + * Raises an event of the specified type and with additional properties. + * @param type The type (name) of the event. + * @param details The set of additional properties to be attached to the event object. + * @returns true if preventDefault was called on the event, otherwise false. + **/ + dispatchEvent(type: string, details: any): boolean; + + /** + * Removes a listener for the specified event. + * @param type The name of the event for which to remove a listener. + * @param eventHandler The event handler function to associate with the event. + * @param useCapture Optional. The same value that was passed to addEventListener for this listener. It may be omitted if it was omitted when calling addEventListener. + **/ + removeEventListener(type: string, eventHandler: Function, useCapture?: any): void; + //#endregion Methods + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; + } /** @@ -7045,7 +8139,7 @@ declare module WinJS.UI { /** * Creates a new TabContainer. - * @constructor + * @constructor * @param element The DOM element that hosts the TabContainer control. * @param options An object that contains one or more property/value pairs to apply to the new control. Each property of the options object corresponds to one of the control's properties. **/ @@ -7069,6 +8163,11 @@ declare module WinJS.UI { **/ childFocus: HTMLElement; + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; + /** * Gets or sets the tab index of this container. **/ @@ -7086,7 +8185,7 @@ declare module WinJS.UI { /** * Initializes a new instance of a TimePicker control. - * @constructor + * @constructor * @param element The DOM element associated with the TimePicker control. * @param options The set of options to be applied initially to the TimePicker control. The options are the following: clock. **/ @@ -7128,12 +8227,9 @@ declare module WinJS.UI { dispose(): void; /** - * Raises an event of the specified type and with additional properties. - * @param type The type (name) of the event. - * @param eventProperties The set of additional properties to be attached to the event object when the event is raised. - * @returns true if preventDefault was called on the event, otherwise false. + * This API supports the WinJS infrastructure and is not intended to be used directly from your code. Use render instead. **/ - raiseEvent(type: string, eventProperties: any): boolean; + static getInformation(clock: any, minuteIncrement: any, timerPatterns?: any): any; /** * Removes a listener for the specified event. @@ -7187,6 +8283,11 @@ declare module WinJS.UI { **/ periodPattern: string; + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; + //#endregion Properties } @@ -7199,7 +8300,7 @@ declare module WinJS.UI { /** * Creates a new ToggleSwitch. - * @constructor + * @constructor * @param element The DOM that hosts the control. * @param options An object that contains one or more property/value pairs to apply to the new control. Each property of the options object corresponds to one of the control's properties or events. Event names must begin with "on". For example, to provide a handler for the change event, add a property named "onchange" to the options object and set its value to the event handler. **/ @@ -7240,20 +8341,6 @@ declare module WinJS.UI { **/ dispose(): void; - /** - * Handles the specified event. - * @param event The event. - **/ - handleEvent(event: any): void; - - /** - * Raises an event of the specified type and with additional properties. - * @param type The type (name) of the event. - * @param eventProperties The set of additional properties to be attached to the event object when the event is raised. - * @returns true if preventDefault was called on the event, otherwise false. - **/ - raiseEvent(type: string, eventProperties: any): boolean; - /** * Removes an event handler that the addEventListener method registered. * @param eventName The name of the event that the event handler is registered for. @@ -7291,6 +8378,11 @@ declare module WinJS.UI { **/ labelOn: string; + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; + /** * Gets or sets the main text for the ToggleSwitch control. This text is always displayed, regardless of whether the control is switched on or off. **/ @@ -7299,6 +8391,139 @@ declare module WinJS.UI { //#endregion Properties } + /** + * Displays ICommands within the flow of the app. Use the ToolBar around other statically positioned app content. + **/ + class ToolBar { + + /** + * Display options for the closed ToolBar. + **/ + public static ClosedDisplayMode: { + /** + * When the ToolBar is closed, the height of the ToolBar is reduced such that button commands are still visible, but their labels are hidden. + **/ + compact: string; + /** + * When the ToolBar is closed, the height of the ToolBar is always sized to content. + **/ + full: string; + }; + + /** + * Indicates that the object is compatibile with declarative processing. + **/ + public static supportedForProcessing: boolean; + + /** + * Gets the DOM element that hosts the ToolBar. + **/ + public element: HTMLElement; + + /** + * Gets or sets the Binding List of ICommand for the ToolBar. + **/ + public data: WinJS.Binding.List; + + /** + * Gets or sets the closedDisplayMode for the ToolBar. Values are "compact" and "full". + **/ + public closedDisplayMode: string; + + /** + * Creates a new ToolBar control. + * @param element The DOM element that will host the control. + * @param options The set of properties and values to apply to the new ToolBar. + **/ + constructor(element?: HTMLElement, options?: any); + + /** + * Disposes the ToolBar + **/ + public dispose(): void; + + /** + * Forces the ToolBar to update its layout. + * Use this function when the window did not change size, but the ToolBar itself did. + **/ + public forceLayout(): void; + + /** + * Opens the ToolBar + **/ + public open(): void; + + /** + * Closes the ToolBar + **/ + public close(): void; + + /** + * Returns the Command object identified by id. + * @param id The element idenitifier (ID) of the command to be returned. + * @returns The command identified by id. If multiple commands have the same ID, returns the first command found. + **/ + getCommandById(id: string): ICommand; + + /** + * Shows the specified commands of the ToolBar while hiding all other commands. + * @param commands The commands to show. The array elements may be ICommand objects, or the string identifiers (IDs) of commands. + **/ + showOnlyCommands(commands: Array): void; + + /** + * Gets or sets whether the ToolBar is currently opened. + **/ + public opened: boolean; + + /** + * Occurs immediately before the control is opened. Is cancelable. + * @param eventInfo An object that contains information about the event. + **/ + public onbeforeopen: (eventInfo: CustomEvent) => void; + + /** + * Occurs immediately after the control is opened. + * @param eventInfo An object that contains information about the event. + **/ + public onafteropen: (eventInfo: CustomEvent) => void; + + /** + * Occurs immediately before the control is closed. Is cancelable. + * @param eventInfo An object that contains information about the event. + **/ + public onbeforeclose: (eventInfo: CustomEvent) => void; + + /** + * Occurs immediately after the control is closed. + * @param eventInfo An object that contains information about the event. + **/ + public onafterclose: (eventInfo: CustomEvent) => void; + + /** + * Registers an event handler for the specified event. + * @param type The event type to register. It must be beforeopen, beforeclose, afteropen, or afterclose. + * @param listener The event handler function to associate with the event. + * @param useCapture Set to true to register the event handler for the capturing phase; otherwise, set to false to register the event handler for the bubbling phase. + **/ + addEventListener(eventName: string, eventHandler: Function, useCapture?: boolean): void; + + /** + * Removes an event handler that the addEventListener method registered. + * @param type The event type to unregister. It must be beforeopen, beforeclose, afteropen, or afterclose. + * @param listener The event handler function to remove. + * @param useCapture Set to true to remove the capturing phase event handler; set to false to remove the bubbling phase event handler. + **/ + removeEventListener(eventName: string, eventHandler: Function, useCapture?: boolean): void; + + /** + * Raises an event of the specified type and with additional properties. + * @param type The type (name) of the event. + * @param eventProperties The set of additional properties to be attached to the event object when the event is raised. + * @returns true if preventDefault was called on the event, otherwise false. + **/ + dispatchEvent(eventName: string, eventProperties: any): boolean; + } /** * Displays a tooltip that can contain images and formatting. @@ -7412,6 +8637,11 @@ declare module WinJS.UI { **/ placement: string; + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; + //#endregion Properties } @@ -7442,6 +8672,14 @@ declare module WinJS.UI { **/ addEventListener(eventName: string, eventHandler: Function, useCapture?: boolean): void; + /** + * Raises an event of the specified type and with additional properties. + * @param eventName The name of the event. + * @param eventProperties The set of additional properties to be attached to the event object when the event is raised. + * @returns true if preventDefault was called on the event, otherwise false. + **/ + dispatchEvent(eventName: string, eventProperties: any): boolean; + /** * Releases resources held by this ViewBox. Call this method when the ViewBox is no longer needed. After calling this method, the ViewBox becomes unusable. **/ @@ -7469,6 +8707,11 @@ declare module WinJS.UI { **/ element: HTMLElement; + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; + //#endregion Properties } @@ -7488,7 +8731,7 @@ declare module WinJS.UI { /** * Initializes the VirtualizedDataSource base class of a custom data source. - * @constructor + * @constructor * @param listDataAdapter The object that supplies data to the VirtualizedDataSource. * @param options An object that can contain properties that specify additional options for the VirtualizedDataSource. It supports these properties: cacheSize. **/ @@ -7498,12 +8741,6 @@ declare module WinJS.UI { //#region Events - /** - * Occurs when the status of the VirtualizedDataSource changes. - * @param eventInfo An object that contains information about the event. The detail property of this object contains the following sub-properties: status. - **/ - statuschanged(eventInfo: CustomEvent): void; - //#endregion Events //#region Methods @@ -7534,6 +8771,15 @@ declare module WinJS.UI { //#endregion Methods + //#region Properties + + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; + + //#endregion Properties + } //#endregion Objects @@ -7597,6 +8843,11 @@ declare module WinJS.UI { **/ function isAnimationEnabled(): boolean; + /** + * * This API supports the WinJS infrastructure and is not intended to be used directly from your code. + **/ + function optionsParser(value: string, context?: any, functionContext?: any): any; + /** * Applies declarative control binding to all elements, starting at the specified root element. * @param rootElement The element at which to start applying the binding. If this parameter is not specified, the binding is applied to the entire document. @@ -7621,22 +8872,156 @@ declare module WinJS.UI { function scopedSelect(selector: string, element: HTMLElement): HTMLElement; /** - * Given a DOM element and a control, attaches the control to the element. - * @param element Element to associate with the control. - * @param control The control to attach to the element. - **/ - function setControl(element: HTMLElement, control: any): void; - - /** - * Adds the set of declaratively specified options (properties and events) to the specified control. If name of the options property begins with "on", the property value is a function and the control supports addEventListener. setControl calls addEventListener on the control. + * Adds the set of declaratively specified options (properties and events) to the specified control. If name of the options property begins with "on", the property value is a function and the control supports addEventListener, setOptions calls addEventListener on the control. * @param control The control on which the properties and events are to be applied. * @param options The set of options that are specified declaratively. **/ function setOptions(control: any, options?: any): void; + /** + * This API supports the WinJS infrastructure and is not intended to be used directly from your code. + **/ + function simpleItemRenderer(fn: Function): Function; + //#endregion Functions } +/** + * Provides utility functions for generic directional focus movement +**/ +declare module WinJS.UI.XYFocus { + export interface XYFocusOptions { + /** + * The focus scope, only children of this element are considered in the calculation. + **/ + focusRoot?: HTMLElement; + + /** + * A rectangle indicating where focus came from before the current state. + **/ + historyRect?: IRect; + + /** + * The element from which to calculate the next focusable element; if specified, referenceRect is ignored. + **/ + referenceElement?: HTMLElement; + + /** + * The rectangle from which to calculate next focusable element; ignored if referenceElement is also specified. + **/ + referenceRect?: IRect; + } + + export interface IRect { + left: number; + right?: number; + top: number; + bottom?: number; + + height: number; + width: number; + } + + export interface XYFocusEvent extends CustomEvent { + detail: { nextFocusElement: HTMLElement; keyCode: number; previousFocusElement: HTMLElement }; + } + + /** + * Gets the mapping object that maps keycodes to XYFocus actions. + **/ + export var keyCodeMap: { + /** + * The array of keycodes that cause XYFocus to accept. + **/ + accept: Array; + /** + * The array of keycodes that cause XYFocus to cancel. + **/ + cancel: Array; + /** + * The array of keycodes that cause XYFocus to navigate down. + **/ + down: Array; + /** + * The array of keycodes that cause XYFocus to navigate left. + **/ + left: Array; + /** + * The array of keycodes that cause XYFocus to navigate right. + **/ + right: Array; + /** + * The array of keycodes that cause XYFocus to navigate up. + **/ + up: Array; + }; + + /** + * Gets or sets the focus root when invoking XYFocus APIs. + **/ + export var focusRoot: HTMLElement; + + /** + * Adds an event listener to XYFocus events. + * @param type The type (name) of the event. + * @param listener The listener to invoke when the event gets raised. + **/ + export function addEventListener(type: string, handler: EventListener): void; + + /** + * Raises an event of the specified type and with additional properties. + * @param type The type (name) of the event. + * @param eventProperties The set of additional properties to be attached to the event object when the event is raised. + * @returns true if preventDefault was called on the event, otherwise false. + **/ + export function dispatchEvent(type: string, eventProperties: any): boolean; + + /** + * Removes an event listener to XYFocus events. + * @param type The type (name) of the event. + * @param listener The listener to remove. + **/ + export function removeEventListener(type: string, handler: EventListener): void; + + /** + * Returns the next focusable element from the current active element (or reference, if supplied) towards the specified direction. + * @param direction The direction to search. + * @param options An options object configuring the search. + **/ + export function findNextFocusElement(direction: string, options?: XYFocusOptions): HTMLElement; + export function findNextFocusElement(direction: "left", options?: XYFocusOptions): HTMLElement; + export function findNextFocusElement(direction: "right", options?: XYFocusOptions): HTMLElement; + export function findNextFocusElement(direction: "up", options?: XYFocusOptions): HTMLElement; + export function findNextFocusElement(direction: "down", options?: XYFocusOptions): HTMLElement; + + /** + * Moves focus to the next focusable element from the current active element (or reference, if supplied) towards the specific direction. + * @param direction The direction to move. + * @param options An options object configuring the focus move. + **/ + export function moveFocus(direction: string, options?: XYFocusOptions): HTMLElement; + export function moveFocus(direction: "left", options?: XYFocusOptions): HTMLElement; + export function moveFocus(direction: "right", options?: XYFocusOptions): HTMLElement; + export function moveFocus(direction: "up", options?: XYFocusOptions): HTMLElement; + export function moveFocus(direction: "down", options?: XYFocusOptions): HTMLElement; + + //#region Events + + /** + * Occurs immeidately after XYFocus has changed focus targets. + * @param eventInfo An object that contains information about the event. The detail property of this object includes the following subproperties: previousFocusElemewnt, keyCode. + **/ + export function onfocuschanged(eventInfo: CustomEvent): void; + + /** + * Occurs immeidately before XYFocus changes focus targets. Is cancelable. + * @param eventInfo An object that contains information about the event. The detail property of this object includes the following subproperties: nextFocusElement, keyCode. + **/ + export function onfocuschanging(eventInfo: CustomEvent): void; + + //#endregion Events +} + /** * Provides functions to load HTML content programmatically. **/ @@ -7792,7 +9177,7 @@ declare module WinJS.UI.TrackTabBehavior { * Removes the tab order information from the specified element. * @param element The element to remove tab information from. **/ - function detatch(element: HTMLElement): void; + function detach(element: HTMLElement): void; //#endregion Functions @@ -8151,6 +9536,38 @@ declare module WinJS.Utilities { * The F12 key. **/ F12, + /** + * The XBox One Remote navigation view button. + **/ + NavigationView, + /** + * The XBox One Remote navigation menu button. + **/ + NavigationMenu, + /** + * The XBox One Remote navigation up button. + **/ + NavigationUp, + /** + * The XBox One Remote navigation down button. + **/ + NavigationDown, + /** + * The XBox One Remote navigation left button. + **/ + NavigationLeft, + /** + * The XBox One Remote navigation right button. + **/ + NavigationRight, + /** + * The XBox One Remote navigation accept button. + **/ + NavigationAccept, + /** + * The XBox One Remote navigation cancel button. + **/ + NavigationCancel, /** * The NUMBER LOCK key. **/ @@ -8198,6 +9615,105 @@ declare module WinJS.Utilities { /** * The open bracket key ([). **/ + /** + * The XBox One gamepad A button. + **/ + GamepadA, + /** + * The XBox One gamepad B button. + **/ + GamepadB, + /** + * The XBox One gamepad X button. + **/ + GamepadX, + /** + * The XBox One gamepad Y button. + **/ + GamepadY, + /** + * The XBox One gamepad right shoulder. + **/ + GamepadRightShoulder, + /** + * The XBox One gamepad left shoulder. + **/ + GamepadLeftShoulder, + /** + * The XBox One gamepad left trigger. + **/ + GamepadLeftTrigger, + /** + * The XBox One gamepad right trigger. + **/ + GamepadRightTrigger, + /** + * The XBox One gamepad dpad up. + **/ + GamepadDPadUp, + /** + * The XBox One gamepad dpad down. + **/ + GamepadDPadDown, + /** + * The XBox One gamepad dpad left. + **/ + GamepadDPadLeft, + /** + * The XBox One gamepad dpad right. + **/ + GamepadDPadRight, + /** + * The XBox One gamepad menu button. + **/ + GamepadMenu, + /** + * The XBox One gamepad view button. + **/ + GamepadView, + /** + * The XBox One gamepad left thumbstick button. + **/ + GamepadLeftThumbstick, + /** + * The XBox One gamepad right thumbstick button. + **/ + GamepadRightThumbstick, + /** + * The XBox One gamepad left thumbstick's up. + **/ + GamepadLeftThumbstickUp, + /** + * The XBox One gamepad left thumbstick's down. + **/ + GamepadLeftThumbstickDown, + /** + * The XBox One gamepad left thumbstick's right. + **/ + GamepadLeftThumbstickRight, + /** + * The XBox One gamepad left thumbstick's left. + **/ + GamepadLeftThumbstickLeft, + /** + * The XBox One gamepad right thumbstick's up. + **/ + GamepadRightThumbstickUp, + /** + * The XBox One gamepad right thumbstick's down. + **/ + GamepadRightThumbstickDown, + /** + * The XBox One gamepad right thumbstick's right. + **/ + GamepadRightThumbstickRight, + /** + * The XBox One gamepad right thumbstick's left. + **/ + GamepadRightThumbstickLeft, + /** + * The open bracket key ([). + **/ openBracket, /** * The backslash key (\). @@ -8210,7 +9726,11 @@ declare module WinJS.Utilities { /** * The single quote key ('). **/ - singleQuote + singleQuote, + /** + * Any IME input. + **/ + IME, } //#endregion Enumerations @@ -8254,7 +9774,7 @@ declare module WinJS.Utilities { /** * Represents the result of a query selector, and provides various operations that perform actions over the elements of the collection. **/ - interface QueryCollection extends Array { + class QueryCollection implements Array { //#region Methods /** @@ -8264,13 +9784,6 @@ declare module WinJS.Utilities { **/ addClass(name: string): QueryCollection; - /** - * Creates a QueryCollection that contains the children of the specified parent element. - * @param element The parent element. - * @returns The QueryCollection that contains the children of the element. - **/ - children(element: HTMLElement): QueryCollection; - /** * Clears the specified style property for all the elements in the collection. * @param name The name of the style property to be cleared. @@ -8315,13 +9828,6 @@ declare module WinJS.Utilities { **/ hasClass(name: string): boolean; - /** - * Looks up an element by ID and wraps the result in a QueryCollection. - * @param id The ID of the element. - * @returns A QueryCollection that contains the element, if it is found. - **/ - id(id: string): QueryCollection; - /** * Adds a set of items to this QueryCollection. * @param items The items to add to the QueryCollection. This may be an array-like object, a document fragment, or a single item. @@ -8358,7 +9864,7 @@ declare module WinJS.Utilities { /** * Removes the specified class from all the elements in the collection. * @param name The name of the class to be removed. - * @returns his QueryCollection object. + * @returns This QueryCollection object. **/ removeClass(name: string): QueryCollection; @@ -8405,14 +9911,161 @@ declare module WinJS.Utilities { //#endregion Methods - } + /** + * Indicates that the object is compatibile with declarative processing. + **/ + static supportedForProcessing: boolean; + + //#region Array.prototype + + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + **/ + concat(...items: U[]): T[]; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + **/ + concat(...items: T[]): T[]; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. + **/ + join(separator?: string): string; + + /** + * Removes the last element from an array and returns it. + **/ + pop(): T; + + /** + * Appends new elements to an array, and returns the new length of the array. + * @param items New elements of the Array. + **/ + push(...items: T[]): number; + + /** + * Reverses the elements in an Array. + **/ + reverse(): T[]; + + /** + * Removes the first element from an array and returns it. + **/ + shift(): T; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + **/ + slice(start?: number, end?: number): T[]; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order. + **/ + sort(compareFn?: (a: T, b: T) => number): T[]; + + /** + * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. + * @param start The zero-based location in the array from which to start removing elements. + **/ + splice(start: number): T[]; + + /** + * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. + * @param start The zero-based location in the array from which to start removing elements. + * @param deleteCount The number of elements to remove. + * @param items Elements to insert into the array in place of the deleted elements. + **/ + splice(start: number, deleteCount: number, ...items: T[]): T[]; + + /** + * Inserts new elements at the start of an array. + * @param items Elements to insert at the start of the Array. + **/ + unshift(...items: T[]): number; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. + **/ + indexOf(searchElement: T, fromIndex?: number): number; + + /** + * Returns the index of the last occurrence of a specified value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. + **/ + lastIndexOf(searchElement: T, fromIndex?: number): number; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + **/ + every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + **/ + some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; + + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + **/ + map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + **/ + filter(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[]; + + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + **/ + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + **/ + reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + **/ + reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + **/ + reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; + + /** + * Gets or sets the length of the array. This is a number one higher than the highest element defined in an array. + **/ + length: number; + + [n: number]: T; + + //#endregion Array.prototype - /** - * Constructor support for QueryCollection interface - **/ - export var QueryCollection: { - new (items: T[]): QueryCollection; - prototype: QueryCollection; } //#endregion Objects @@ -8536,7 +10189,7 @@ declare module WinJS.Utilities { * @param element The element. * @returns An object with two properties: scrollLeft and scrollTop **/ - function getScrollPosition(element: HTMLElement): { scrollLeft: number; scrollTop: number}; + function getScrollPosition(element: HTMLElement): { scrollLeft: number; scrollTop: number }; /** * Gets the tab index of the specified element. @@ -8668,7 +10321,7 @@ declare module WinJS.Utilities { * @param element The element. * @param position An object describing the position to set. **/ - function setScrollPosition(element: HTMLElement, position: { scrollLeft: number; scrollTop: number}): void; + function setScrollPosition(element: HTMLElement, position: { scrollLeft: number; scrollTop: number }): void; /** * Configures a logger that writes messages containing the specified tags to the JavaScript console. @@ -8700,9 +10353,9 @@ declare module WinJS.Utilities { var hasWinRT: boolean; /** - * Indicates whether the app is running on Windows Phone. + * Determines if strict declarative processing is enabled in this script context. **/ - var isPhone: boolean; + var strictProcessing: boolean; //#endregion Properties diff --git a/xregexp/xregexp-tests.ts b/xregexp/xregexp-tests.ts index 0a7f24ded..17e1d6bdf 100644 --- a/xregexp/xregexp-tests.ts +++ b/xregexp/xregexp-tests.ts @@ -8,6 +8,7 @@ import TokenOpts = X.TokenOpts; var exp: RegExp; var expArr: RegExp[]; +var expArrArr: RegExp[][]; var chain: RegExp[]; var groupChain: { regex: RegExp; backref: string }[]; var groupChain1: { regex: RegExp; backref: number }[]; @@ -19,6 +20,7 @@ var search: string; var searchEx: RegExp; var bool: boolean; var strArr: string[]; +var strArrArr: string[][]; var pattern: string; var flags: string; var right: string; @@ -42,6 +44,14 @@ str = XRegExp.version; // -- -- -- -- -- -- -- -- -- -- -- -- -- +regex = X(str); +regex = X(str, flags); +regex = X(regex); + +str = X.version; + +// -- -- -- -- -- -- -- -- -- -- -- -- -- + XRegExp.addToken(regex, (arr, scope) => { matchArr = arr; str = scope; @@ -69,13 +79,6 @@ matchArr = XRegExp.exec(str, regex); // -- -- -- -- -- -- -- -- -- -- -- -- -- -matchArr = XRegExp.forEach(str, regex, (match, index, input, regexp) => { - exp = regexp; - str = input; - num = index; - matchArr = match; -}, obj); - matchArr = XRegExp.forEach(str, regex, (match, index, input, regexp) => { exp = regexp; str = input; @@ -92,6 +95,11 @@ XRegExp.install(obj); bool = XRegExp.isInstalled(str); bool = XRegExp.isRegExp(value); + +strArr = XRegExp.match(str, regex); +strArr = XRegExp.match(str, regex, scope); +str = XRegExp.match(str, regex, "one"); + strArr = XRegExp.matchChain(str, chain); strArr = XRegExp.matchChain(str, groupChain); strArr = XRegExp.matchChain(str, groupChain1); @@ -113,6 +121,11 @@ str = XRegExp.replace(str, searchEx, str); str = XRegExp.replace(str, searchEx, replacer, scope); str = XRegExp.replace(str, searchEx, replacer); +// -- -- -- -- -- -- -- -- -- -- -- -- -- +str = XRegExp.replaceEach(str, expArrArr); +str = XRegExp.replaceEach(str, strArrArr); +str = XRegExp.replaceEach(str, [[str, exp], [str, exp]]); + // -- -- -- -- -- -- -- -- -- -- -- -- -- strArr = XRegExp.split(str, search, limit); @@ -135,4 +148,3 @@ regex = XRegExp.union(strArr, flags); regex = XRegExp.union(strArr); // -- -- -- -- -- -- -- -- -- -- -- -- -- - diff --git a/xregexp/xregexp.d.ts b/xregexp/xregexp.d.ts index 561c37f57..0bc29f07f 100644 --- a/xregexp/xregexp.d.ts +++ b/xregexp/xregexp.d.ts @@ -1,38 +1,58 @@ -// Type definitions for XRegExp 2.0.0 +// Type definitions for XRegExp 3.0.0 // Project: http://xregexp.com -// Definitions by: Bart van der Schoor +// Definitions by: Bart van der Schoor , +// Johannes Fahrenkrug // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module 'xregexp' { - // scopes: 'default', 'class', or 'all' - /* - Native flags: - g - global - i - ignore case - m - multiline anchors - y - sticky (Firefox 3+) - Additional XRegExp flags: - n - explicit capture - s - dot matches all (aka singleline) - x - free-spacing and line comments (aka extended) - */ - export interface TokenOpts { - scope?: string; - trigger?: () => boolean; - customFlags?: string; - } - export function XRegExp(pattern: string, flags?: string): RegExp; - export function XRegExp(pattern: RegExp): RegExp; + function OuterXRegExp(pattern: string, flags?: string): RegExp; + function OuterXRegExp(pattern: RegExp): RegExp; - export module XRegExp { + module OuterXRegExp { + // scopes: 'default', 'class', or 'all' + /* + Native flags: + g - global + i - ignore case + m - multiline anchors + y - sticky (Firefox 3+) + Additional XRegExp flags: + n - explicit capture + s - dot matches all (aka singleline) + x - free-spacing and line comments (aka extended) + */ + interface TokenOpts { + scope?: string; + trigger?: () => boolean; + customFlags?: string; + } + + function XRegExp(pattern: string, flags?: string): RegExp; + function XRegExp(pattern: RegExp): RegExp; + + /* Since xregexp 3.0.0 can be used either via + + import X = require('xregexp'); + X(); + + or via + + import XRegExp = X.XRegExp; + XRegExp() + + I had to duplicate the function declarations. I could simply not + find another way to accomplish this with TypeScript. + */ + + // begin API definitions function addToken(regex: RegExp, handler: (matchArr: RegExpExecArray, scope: string) => string, options?: TokenOpts): void; function build(pattern: string, subs: string[], flags?: string): RegExp; function cache(pattern: string, flags?: string): RegExp; function escape(str: string): string; function exec(str: string, regex: RegExp, pos?: number, sticky?: boolean): RegExpExecArray; - function forEach(str: string, regex: RegExp, callback: (matchArr: RegExpExecArray, index: number, input: string, regexp: RegExp) => void, context?: Object): any; + function forEach(str: string, regex: RegExp, callback: (matchArr: RegExpExecArray, index: number, input: string, regexp: RegExp) => void): any; function globalize(regex: RegExp): RegExp; function install(options: string): void; @@ -40,6 +60,10 @@ declare module 'xregexp' { function isInstalled(feature: string): boolean; function isRegExp(value: any): boolean; + function match(str: string, regex: RegExp, scope: string): any; + function match(str: string, regex: RegExp, scope: "one"): string; + function match(str: string, regex: RegExp, scope: "all"): string[]; + function match(str: string, regex: RegExp): string[]; function matchChain(str: string, chain: RegExp[]): string[]; function matchChain(str: string, chain: { regex: RegExp; backref: string }[]): string[]; function matchChain(str: string, chain: { regex: RegExp; backref: number }[]): string[]; @@ -49,6 +73,7 @@ declare module 'xregexp' { function replace(str: string, search: string, replacement: Function, scope?: string): string; function replace(str: string, search: RegExp, replacement: string, scope?: string): string; function replace(str: string, search: RegExp, replacement: Function, scope?: string): string; + function replaceEach(str: string, replacements: Array[]): string; function split(str: string, separator: string, limit?: number): string[]; function split(str: string, separator: RegExp, limit?: number): string[]; @@ -60,5 +85,52 @@ declare module 'xregexp' { function union(patterns: string[], flags?: string): RegExp; var version: string; + // end API definitions + + module XRegExp { + // begin API definitions + function addToken(regex: RegExp, handler: (matchArr: RegExpExecArray, scope: string) => string, options?: TokenOpts): void; + + function build(pattern: string, subs: string[], flags?: string): RegExp; + function cache(pattern: string, flags?: string): RegExp; + function escape(str: string): string; + function exec(str: string, regex: RegExp, pos?: number, sticky?: boolean): RegExpExecArray; + function forEach(str: string, regex: RegExp, callback: (matchArr: RegExpExecArray, index: number, input: string, regexp: RegExp) => void): any; + function globalize(regex: RegExp): RegExp; + + function install(options: string): void; + function install(options: Object): void; + + function isInstalled(feature: string): boolean; + function isRegExp(value: any): boolean; + function match(str: string, regex: RegExp, scope: string): any; + function match(str: string, regex: RegExp, scope: "one"): string; + function match(str: string, regex: RegExp, scope: "all"): string[]; + function match(str: string, regex: RegExp): string[]; + function matchChain(str: string, chain: RegExp[]): string[]; + function matchChain(str: string, chain: { regex: RegExp; backref: string }[]): string[]; + function matchChain(str: string, chain: { regex: RegExp; backref: number }[]): string[]; + function matchRecursive(str: string, left: string, right: string, flags?: string, options?: Object): string[]; + + function replace(str: string, search: string, replacement: string, scope?: string): string; + function replace(str: string, search: string, replacement: Function, scope?: string): string; + function replace(str: string, search: RegExp, replacement: string, scope?: string): string; + function replace(str: string, search: RegExp, replacement: Function, scope?: string): string; + function replaceEach(str: string, replacements: Array[]): string; + + function split(str: string, separator: string, limit?: number): string[]; + function split(str: string, separator: RegExp, limit?: number): string[]; + + function test(str: string, regex: RegExp, pos?: number, sticky?: boolean): boolean; + + function uninstall(options: Object): void; + function uninstall(options: string): void; + + function union(patterns: string[], flags?: string): RegExp; + var version: string; + // end API definitions + } } + + export = OuterXRegExp; }