diff --git a/ace/index.d.ts b/ace/index.d.ts index 6a09235977..1ac19c7c63 100644 --- a/ace/index.d.ts +++ b/ace/index.d.ts @@ -77,9 +77,6 @@ declare namespace AceAjax { onTextInput(text: any): void; } - var KeyBinding: { - new(editor: Editor): KeyBinding; - } export interface TextMode { diff --git a/adal/index.d.ts b/adal/index.d.ts index 76b86e7150..1c60cbf6ef 100644 --- a/adal/index.d.ts +++ b/adal/index.d.ts @@ -131,9 +131,9 @@ declare namespace adal { /** * Gets requestInfo from given hash. - * @returns {string} error message related to login + * @returns {RequestInfo} for appropriate hash. */ - getRequestInfo(hash: string): string; + getRequestInfo(hash: string): RequestInfo; /** * Saves token from hash that is received from redirect. diff --git a/agenda/index.d.ts b/agenda/index.d.ts index dc252af65a..8bf309249f 100644 --- a/agenda/index.d.ts +++ b/agenda/index.d.ts @@ -5,8 +5,10 @@ /// -import {EventEmitter} from "events"; -import {Db, Collection, ObjectID} from "mongodb"; +import { EventEmitter } from "events"; +import { Db, Collection, ObjectID } from "mongodb"; + +export = Agenda; interface Callback { (err?: Error): void; @@ -16,277 +18,6 @@ interface ResultCallback { (err?: Error, result?: T): void; } -/** - * Agenda Configuration. - */ -interface AgendaConfiguration { - - /** - * Sets the interval with which the queue is checked. A number in milliseconds or a frequency string. - */ - processEvery?: string | number; - - /** - * Takes a number which specifies the default number of a specific job that can be running at any given moment. - * By default it is 5. - */ - defaultConcurrency?: number; - - /** - * Takes a number which specifies the max number of jobs that can be running at any given moment. By default it - * is 20. - */ - maxConcurrency?: number; - - /** - * Takes a number which specifies the default number of a specific job that can be locked at any given moment. - * By default it is 0 for no max. - */ - defaultLockLimit?: number; - - /** - * Takes a number shich specifies the max number jobs that can be locked at any given moment. By default it is - * 0 for no max. - */ - lockLimit?: number; - - /** - * Takes a number which specifies the default lock lifetime in milliseconds. By default it is 10 minutes. This - * can be overridden by specifying the lockLifetime option to a defined job. - */ - defaultLockLifetime?: number; - - /** - * Specifies that Agenda should be initialized using and existing MongoDB connection. - */ - mongo?: { - /** - * The MongoDB database connection to use. - */ - db: Db; - - /** - * The name of the collection to use. - */ - collection?: string; - } - - /** - * Specifies that Agenda should connect to MongoDB. - */ - db?: { - /** - * The connection URL. - */ - address: string; - - /** - * The name of the collection to use. - */ - collection?: string; - - /** - * Connection options to pass to MongoDB. - */ - options?: any; - } -} - -/** - * The database record associated with a job. - */ -interface JobAttributes { - /** - * The record identity. - */ - _id: ObjectID; - - /** - * The name of the job. - */ - name: string; - - /** - * The type of the job (single|normal). - */ - type: string; - - /** - * The job details. - */ - data: { [name: string]: any }; - - /** - * The priority of the job. - */ - priority: number; - - /** - * How often the job is repeated using a human-readable or cron format. - */ - repeatInterval: string | number; - - /** - * The timezone that conforms to [moment-timezone](http://momentjs.com/timezone/). - */ - repeatTimezone: string; - - /** - * Date/time the job was las modified. - */ - lastModifiedBy: string; - - /** - * Date/time the job will run next. - */ - nextRunAt: Date; - - /** - * Date/time the job was locked. - */ - lockedAt: Date; - - /** - * Date/time the job was last run. - */ - lastRunAt: Date; - - /** - * Date/time the job last finished running. - */ - lastFinishedAt: Date; - - /** - * The reason the job failed. - */ - failReason: string; - - /** - * The number of times the job has failed. - */ - failCount: number; - - /** - * The date/time the job last failed. - */ - failedAt: Date; -} - -/** - * A scheduled job. - */ -interface Job { - - /** - * The database record associated with the job. - */ - attrs: JobAttributes; - - /** - * Specifies an interval on which the job should repeat. - * @param interval A human-readable format String, a cron format String, or a Number. - * @param options An optional argument that can include a timezone field. The timezone should be a string as - * accepted by moment-timezone and is considered when using an interval in the cron string format. - */ - repeatEvery(interval: string | number, options?: { timezone?: string }): Job - - /** - * Specifies a time when the job should repeat. [Possible values](https://github.com/matthewmueller/date#examples). - * @param time - */ - repeatAt(time: string): Job - - /** - * Disables the job. - */ - disable(): Job; - - /** - * Enables the job. - */ - enable(): Job; - - /** - * Ensure that only one instance of this job exists with the specified properties - * @param value The properties associated with the job that must be unqiue. - * @param opts - */ - unique(value: any, opts?: { insertOnly?: boolean }): Job; - - /** - * Specifies the next time at which the job should run. - * @param time The next time at which the job should run. - */ - schedule(time: string | Date): Job; - - /** - * Specifies the priority weighting of the job. - * @param value The priority of the job (lowest|low|normal|high|highest|number). - */ - priority(value: string | number): Job; - - /** - * Sets job.attrs.failedAt to now, and sets job.attrs.failReason to reason. - * @param reason A message or Error object that indicates why the job failed. - */ - fail(reason: string | Error): Job; - - /** - * Runs the given job and calls callback(err, job) upon completion. Normally you never need to call this manually - * @param cb Called when the job is completed. - */ - run(cb?: ResultCallback): Job; - - /** - * Returns true if the job is running; otherwise, returns false. - */ - isRunning(): boolean; - - /** - * Saves the job into the database. - * @param cb Called when the job is saved. - */ - save(cb?: ResultCallback): Job; - - /** - * Removes the job from the database and cancels the job. - * @param cb Called after the job has beeb removed from the database. - */ - remove(cb?: Callback): void; - - /** - * Resets the lock on the job. Useful to indicate that the job hasn't timed out when you have very long running - * jobs. - * @param cb Called after the job has been saved to the database. - */ - touch(cb?: Callback): void; -} - -interface JobOptions { - - /** - * Maximum number of that job that can be running at once (per instance of agenda) - */ - concurrency?: number; - - /** - * Maximum number of that job that can be locked at once (per instance of agenda) - */ - lockLimit?: number; - - /** - * Interval in ms of how long the job stays locked for (see multiple job processors for more info). A job will - * automatically unlock if done() is called. - */ - lockLifetime?: number; - - /** - * (lowest|low|normal|high|highest|number) specifies the priority of the job. Higher priority jobs will run - * first. - */ - priority?: string | number; -} - declare class Agenda extends EventEmitter { /** @@ -294,7 +25,7 @@ declare class Agenda extends EventEmitter { * @param config Optional configuration to initialize the Agenda. * @param cb Optional callback called with the MongoDB colleciton. */ - constructor(config?: AgendaConfiguration, cb?: ResultCallback); + constructor(config?: Agenda.AgendaConfiguration, cb?: ResultCallback); /** * Connect to the specified MongoDB server and database. @@ -357,14 +88,14 @@ declare class Agenda extends EventEmitter { * @param name The name of the job. * @param data Data to associated with the job. */ - create(name: string, data?: any): Job; + create(name: string, data?: any): Agenda.Job; /** * Find all Jobs matching `query` and pass same back in cb(). * @param query * @param cb */ - jobs(query: any, cb: ResultCallback): void; + jobs(query: any, cb: ResultCallback): void; /** * Removes all jobs in the database without defined behaviors. Useful if you change a definition name and want @@ -381,8 +112,8 @@ declare class Agenda extends EventEmitter { * @param options The options for the job. * @param handler The handler to execute. */ - define(name: string, handler: (job?: Job, done?: (err?: Error) => void) => void): void; - define(name: string, options: JobOptions, handler: (job?: Job, done?: (err?: Error) => void) => void): void; + define(name: string, handler: (job?: Agenda.Job, done?: (err?: Error) => void) => void): void; + define(name: string, options: Agenda.JobOptions, handler: (job?: Agenda.Job, done?: (err?: Error) => void) => void): void; /** * Runs job name at the given interval. Optionally, data and options can be passed in. @@ -392,8 +123,8 @@ declare class Agenda extends EventEmitter { * @param options An optional argument that will be passed to job.repeatEvery. * @param cb An optional callback function which will be called when the job has been persisted in the database. */ - every(interval: number | string, names: string, data?: any, options?: any, cb?: ResultCallback): Job; - every(interval: number | string, names: string[], data?: any, options?: any, cb?: ResultCallback): Job[]; + every(interval: number | string, names: string, data?: any, options?: any, cb?: ResultCallback): Agenda.Job; + every(interval: number | string, names: string[], data?: any, options?: any, cb?: ResultCallback): Agenda.Job[]; /** * Schedules a job to run name once at a given time. @@ -402,8 +133,8 @@ declare class Agenda extends EventEmitter { * @param data An optional argument that will be passed to the processing function under job.attrs.data. * @param cb An optional callback function which will be called when the job has been persisted in the database. */ - schedule(when: Date | string, names: string, data?: any, cb?: ResultCallback): Job; - schedule(when: Date | string, names: string[], data?: any, cb?: ResultCallback): Job[]; + schedule(when: Date | string, names: string, data?: any, cb?: ResultCallback): Agenda.Job; + schedule(when: Date | string, names: string[], data?: any, cb?: ResultCallback): Agenda.Job[]; /** * Schedules a job to run name once immediately. @@ -411,7 +142,7 @@ declare class Agenda extends EventEmitter { * @param data An optional argument that will be passed to the processing function under job.attrs.data. * @param cb An optional callback function which will be called when the job has been persisted in the database. */ - now(name: string, data?: any, cb?: ResultCallback): Job; + now(name: string, data?: any, cb?: ResultCallback): Agenda.Job; /** * Cancels any jobs matching the passed mongodb-native query, and removes them from the database. @@ -433,7 +164,274 @@ declare class Agenda extends EventEmitter { } declare namespace Agenda { + /** + * Agenda Configuration. + */ + interface AgendaConfiguration { + /** + * Sets the interval with which the queue is checked. A number in milliseconds or a frequency string. + */ + processEvery?: string | number; + + /** + * Takes a number which specifies the default number of a specific job that can be running at any given moment. + * By default it is 5. + */ + defaultConcurrency?: number; + + /** + * Takes a number which specifies the max number of jobs that can be running at any given moment. By default it + * is 20. + */ + maxConcurrency?: number; + + /** + * Takes a number which specifies the default number of a specific job that can be locked at any given moment. + * By default it is 0 for no max. + */ + defaultLockLimit?: number; + + /** + * Takes a number shich specifies the max number jobs that can be locked at any given moment. By default it is + * 0 for no max. + */ + lockLimit?: number; + + /** + * Takes a number which specifies the default lock lifetime in milliseconds. By default it is 10 minutes. This + * can be overridden by specifying the lockLifetime option to a defined job. + */ + defaultLockLifetime?: number; + + /** + * Specifies that Agenda should be initialized using and existing MongoDB connection. + */ + mongo?: { + /** + * The MongoDB database connection to use. + */ + db: Db; + + /** + * The name of the collection to use. + */ + collection?: string; + } + + /** + * Specifies that Agenda should connect to MongoDB. + */ + db?: { + /** + * The connection URL. + */ + address: string; + + /** + * The name of the collection to use. + */ + collection?: string; + + /** + * Connection options to pass to MongoDB. + */ + options?: any; + } + } + + /** + * The database record associated with a job. + */ + interface JobAttributes { + /** + * The record identity. + */ + _id: ObjectID; + + /** + * The name of the job. + */ + name: string; + + /** + * The type of the job (single|normal). + */ + type: string; + + /** + * The job details. + */ + data: { [name: string]: any }; + + /** + * The priority of the job. + */ + priority: number; + + /** + * How often the job is repeated using a human-readable or cron format. + */ + repeatInterval: string | number; + + /** + * The timezone that conforms to [moment-timezone](http://momentjs.com/timezone/). + */ + repeatTimezone: string; + + /** + * Date/time the job was las modified. + */ + lastModifiedBy: string; + + /** + * Date/time the job will run next. + */ + nextRunAt: Date; + + /** + * Date/time the job was locked. + */ + lockedAt: Date; + + /** + * Date/time the job was last run. + */ + lastRunAt: Date; + + /** + * Date/time the job last finished running. + */ + lastFinishedAt: Date; + + /** + * The reason the job failed. + */ + failReason: string; + + /** + * The number of times the job has failed. + */ + failCount: number; + + /** + * The date/time the job last failed. + */ + failedAt: Date; + } + + /** + * A scheduled job. + */ + interface Job { + + /** + * The database record associated with the job. + */ + attrs: JobAttributes; + + /** + * Specifies an interval on which the job should repeat. + * @param interval A human-readable format String, a cron format String, or a Number. + * @param options An optional argument that can include a timezone field. The timezone should be a string as + * accepted by moment-timezone and is considered when using an interval in the cron string format. + */ + repeatEvery(interval: string | number, options?: { timezone?: string }): Job + + /** + * Specifies a time when the job should repeat. [Possible values](https://github.com/matthewmueller/date#examples). + * @param time + */ + repeatAt(time: string): Job + + /** + * Disables the job. + */ + disable(): Job; + + /** + * Enables the job. + */ + enable(): Job; + + /** + * Ensure that only one instance of this job exists with the specified properties + * @param value The properties associated with the job that must be unqiue. + * @param opts + */ + unique(value: any, opts?: { insertOnly?: boolean }): Job; + + /** + * Specifies the next time at which the job should run. + * @param time The next time at which the job should run. + */ + schedule(time: string | Date): Job; + + /** + * Specifies the priority weighting of the job. + * @param value The priority of the job (lowest|low|normal|high|highest|number). + */ + priority(value: string | number): Job; + + /** + * Sets job.attrs.failedAt to now, and sets job.attrs.failReason to reason. + * @param reason A message or Error object that indicates why the job failed. + */ + fail(reason: string | Error): Job; + + /** + * Runs the given job and calls callback(err, job) upon completion. Normally you never need to call this manually + * @param cb Called when the job is completed. + */ + run(cb?: ResultCallback): Job; + + /** + * Returns true if the job is running; otherwise, returns false. + */ + isRunning(): boolean; + + /** + * Saves the job into the database. + * @param cb Called when the job is saved. + */ + save(cb?: ResultCallback): Job; + + /** + * Removes the job from the database and cancels the job. + * @param cb Called after the job has beeb removed from the database. + */ + remove(cb?: Callback): void; + + /** + * Resets the lock on the job. Useful to indicate that the job hasn't timed out when you have very long running + * jobs. + * @param cb Called after the job has been saved to the database. + */ + touch(cb?: Callback): void; + } + + interface JobOptions { + + /** + * Maximum number of that job that can be running at once (per instance of agenda) + */ + concurrency?: number; + + /** + * Maximum number of that job that can be locked at once (per instance of agenda) + */ + lockLimit?: number; + + /** + * Interval in ms of how long the job stays locked for (see multiple job processors for more info). A job will + * automatically unlock if done() is called. + */ + lockLifetime?: number; + + /** + * (lowest|low|normal|high|highest|number) specifies the priority of the job. Higher priority jobs will run + * first. + */ + priority?: string | number; + } } - -export = Agenda; diff --git a/angular-websocket/angular-websocket-tests.ts b/angular-websocket/angular-websocket-tests.ts index 78ba982aa5..e7cb30fe49 100644 --- a/angular-websocket/angular-websocket-tests.ts +++ b/angular-websocket/angular-websocket-tests.ts @@ -1,11 +1,36 @@ /// let dummySocket: ng.websocket.IWebSocket; +let dummyPromise: ng.IPromise; +let dummyScope: ng.IScope; -let provider: ng.websocket.IWebSocketProvider = (url: string) => { +let provider: ng.websocket.IWebSocketProvider = (url: string, protocols?:string[] | ng.websocket.IWebSocketConfigOptions, options?: ng.websocket.IWebSocketConfigOptions) => { return dummySocket; } +let socketWithProtocol = provider("wss://localhost", "protocol"); +let socketWithProtocols = provider("wss://localhost", ["protocol-a", "protocol-b"]); + +let socketWithOptions = provider("wss://localhost", { + scope: dummyScope, + rootScopeFailOver: true, + useApplyAsync: true, + initialTimeout: 100, + maxTimeout: 300000, + reconnectIfNotNormalClose: true, + binaryType: "blob" +}); + +let socketWithProtocolAndOptions = provider("wss://localhost", "protocol", { + scope: dummyScope, + rootScopeFailOver: true, + useApplyAsync: true, + initialTimeout: 100, + maxTimeout: 300000, + reconnectIfNotNormalClose: true, + binaryType: "blob" +}); + let socket = provider("wss://localhost"); socket.onOpen((event) => {}) @@ -23,3 +48,24 @@ socket.close(); socket.send("Some great data here!").finally(() => {}); socket.send({ list: [1, 2, 3, 4] }); + +socket.socket.send("data"); +socket.socket.close(); +socket.socket.close(1); +socket.socket.close(1, "reason"); + +socket.sendQueue.push({ message: "msg", defered: dummyPromise }); + +socket.onOpenCallbacks.push((event: Event) => {}); +socket.onCloseCallbacks.push((event: CloseEvent) => {}); +socket.onErrorCallbacks.push((event: Event) => {}); +socket.onMessageCallbacks.push({ fn: (event: MessageEvent) => {}, pattern: 'Some Filter', autoApply: true }); +socket.onMessageCallbacks.push({ fn: (event: MessageEvent) => {}, pattern: /Some Filter/, autoApply: true }); +socket.onMessageCallbacks.push({ fn: (event: MessageEvent) => {}, pattern: undefined, autoApply: true }); + +socket.readyState = 0; + +socket.initialTimeout = 10; + +socket.maxTimeout = 5000; + diff --git a/angular-websocket/angular-websocket.d.ts b/angular-websocket/angular-websocket.d.ts index 04859a7d16..6929561f9c 100644 --- a/angular-websocket/angular-websocket.d.ts +++ b/angular-websocket/angular-websocket.d.ts @@ -7,6 +7,18 @@ declare namespace angular.websocket { + /** + * Options available to be specified for IWebSocketProvider. + */ + type IWebSocketConfigOptions = { + scope?: ng.IScope; + rootScopeFailOver?: boolean; + useApplyAsync?: boolean; + initialTimeout?: number; + maxTimeout?: number; + binaryType?: "blob" | "arraybuffer"; + reconnectIfNotNormalClose?: boolean; + } interface IWebSocketProvider { /** * Creates and opens an IWebSocket instance. @@ -14,7 +26,7 @@ declare namespace angular.websocket { * @param url url to connect to * @return websocket instance */ - (url: string): IWebSocket; + (url: string, protocols?: string | string[] | IWebSocketConfigOptions, options?: IWebSocketConfigOptions): IWebSocket; } /** Options available to be specified for IWebSocket.onMessage */ @@ -30,6 +42,19 @@ declare namespace angular.websocket { autoApply?: boolean; } + /** Type corresponding to onMessage callbaks stored in $Websocket#onMessageCallbacks instance. */ + type IWebSocketMessageHandler = { + fn: (evt: MessageEvent) => void; + pattern: string | RegExp; + autoApply: boolean; + } + + /** Type corresponding to items stored in $WebSocket#sendQueue instance. */ + type IWebSocketQueueItem = { + message: any; + defered: ng.IPromise; + } + interface IWebSocket { /** @@ -81,6 +106,52 @@ declare namespace angular.websocket { * * @param data data to send, if this is an object, it will be stringified before sending */ - send(data: string | {}): ng.IPromise; + send(data: string | {}): ng.IPromise; + + /** + * WebSocket instance. + */ + socket: WebSocket; + + /** + * Queue of send calls to be made on socket when socket is able to receive data. + */ + sendQueue: IWebSocketQueueItem[]; + + /** + * List of callbacks to be executed when the socket is opened. + */ + onOpenCallbacks: ((evt: Event) => void)[]; + + /** + * List of callbacks to be executed when a message is received from the socket. + */ + onMessageCallbacks: IWebSocketMessageHandler[]; + + /** + * List of callbacks to be executed when an error is received from the socket. + */ + onErrorCallbacks: ((evt: Event) => void)[]; + + /** + * List of callbacks to be executed when the socket is closed. + */ + onCloseCallbacks: ((evt: CloseEvent) => void)[]; + + /** + * Returns either the readyState value from the underlying WebSocket instance + * or a proprietary value representing the internal state + */ + readyState: number; + + /** + * The initial timeout. + */ + initialTimeout: number; + + /** + * Maximun timeout used to determine reconnection delay. + */ + maxTimeout: number; } } diff --git a/angular-xeditable/angular-xeditable-tests.ts b/angular-xeditable/angular-xeditable-tests.ts new file mode 100644 index 0000000000..9264c47f41 --- /dev/null +++ b/angular-xeditable/angular-xeditable-tests.ts @@ -0,0 +1,15 @@ +/// + +var myApp = angular.module('testModule', ['xeditable']); + +myApp.run(["editableOptions", (editableOptions: angular.xeditable.IEditableOptions) => { + + editableOptions.activate = "select"; + editableOptions.activationEvent = "click"; + editableOptions.blurElem = "ignore"; + editableOptions.blurForm = "submit"; + editableOptions.buttons = "no"; + editableOptions.icon_set = "font-awesome"; + editableOptions.isDisabled = true; + editableOptions.theme = "bs3"; +}]); \ No newline at end of file diff --git a/angular-xeditable/angular-xeditable.d.ts b/angular-xeditable/angular-xeditable.d.ts new file mode 100644 index 0000000000..eaa1296886 --- /dev/null +++ b/angular-xeditable/angular-xeditable.d.ts @@ -0,0 +1,56 @@ +// Type definitions for Angular xEditable 0.2.0 (angular.xeditable module) +// Project: https://vitalets.github.io/angular-xeditable/ +// Definitions by: Joao Monteiro +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace angular.xeditable { + + interface IEditableOptions { + + /** + * Theme. Possible values `bs3`, `bs2`, `default` + */ + theme: string; + + /** + * Icon Set. Possible values `font-awesome`, `default`. + */ + icon_set: string; + + /** + * Whether to show buttons for single editalbe element. + * Possible values `right` (default), `no`. + */ + buttons: string; + + /** + * Default value for `blur` attribute of single editable element. + * Can be `cancel|submit|ignore`. + */ + blurElem: string; + + /** + * Default value for `blur` attribute of editable form. + * Can be `cancel|submit|ignore`. + */ + blurForm: string; + + /** + * How input elements get activated. Possible values: `focus|select|none`. + */ + activate: string; + + /** + * Whether to disable x-editable. Can be overloaded on each element. + */ + isDisabled: boolean; + + /* + * Event, on which the edit mode gets activated. + * Can be any event. + */ + activationEvent: string; + } +} diff --git a/apigee-access/apigee-access-tests.ts b/apigee-access/apigee-access-tests.ts new file mode 100644 index 0000000000..99baec8021 --- /dev/null +++ b/apigee-access/apigee-access-tests.ts @@ -0,0 +1,67 @@ +/// +import apigee from "apigee-access"; + +//Sample code from +// https://www.npmjs.com/package/apigee-access + +var request: any = null; + +// Variables +var val1 = apigee.getVariable(request, 'TestVariable'); + +apigee.setIntVariable(request, 'TestVariable', '123'); +apigee.setIntVariable(request, 'TestVariable2', 42); + +apigee.deleteVariable(request, 'TestVariable'); + +// Mode +console.log('The deployment mode is ' + apigee.getMode()); + +// Cache +var cache = apigee.getCache('cache'); +var customCache = apigee.getCache('MyCustomCache', + { resource: 'MyCustomrResource' }); +cache.put('key2', 'Hello, World!', 120); +cache.put('key4', 'Hello, World!', function (err: any) { +}); + +cache.get('key', function (err: any, data: any) { +}); + +cache.remove('key'); + +// Secure Vault +var orgVault = apigee.getVault('vault1', 'organization'); +orgVault.get('key1', function (err: any, secretValue: any) { +}); + +// Quota Service +var quota = apigee.getQuota(); +quota.apply({ identifier: 'Foo', allow: 10, timeUnit: 'hour' }, + function (err: any, result: any) { + console.log('Quota applied: %j', result); + }); + +quota.apply({ + identifier: 'Foo', + timeUnit: 'hour', + allow: 100 +}, quotaResult); + +quota.apply({ + identifier: 'Bar', + timeUnit: 'minute', + interval: 5, + allow: 500 +}, quotaResult); + +quota.apply({ + identifier: 'Foo', + timeUnit: 'hour', + allow: 100, + weight: 10 +}, quotaResult); + +function quotaResult(err: any, r: any) { + if (err) { console.error('Quota failed'); } +} \ No newline at end of file diff --git a/apigee-access/apigee-access.d.ts b/apigee-access/apigee-access.d.ts new file mode 100644 index 0000000000..af34724023 --- /dev/null +++ b/apigee-access/apigee-access.d.ts @@ -0,0 +1,58 @@ +// Type definitions for apigee-access +// Project: https://www.npmjs.com/package/apigee-access +// Definitions by: Casper Skydt +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module ApigeeAccess { + + function getVariable(request: any, name: string): string | number | boolean; + function setVariable(request: any, name: string, value: string | number | boolean ): void; + function setIntVariable(request: any, name: string, value: string | number): void; + function deleteVariable(request: any, name: string): void; + function getCache(name: string, options?: CacheOptions): any; + function getVault(name: string, scope?: "organization" | "environment"): SecureVault; + function getQuota(options?: any): QuotaService; + function getMode(): "apigee" | "standalone"; + + interface CacheOptions{ + resource?: string; + scope?: "global" | "application" | "exclusive"; + defaultTtl?: number; + timeout?: number; + } + + interface Cache{ + put(key: string, data: any, ttl?: number, callback?: (err: any) => void): void; + get(key: string, callback: (err: any, data: any) => void): void; + remove(key: string, callback?: (err: any) => void): void; + } + + interface SecureVault{ + getKeys(callback: (err: any, data: any) => void): void; + get(key: string, callback: (err: any, data: any) => void): void; + } + + interface QuotaService{ + apply(options?: QuotaServiceApplyOptions, callback?: (err: any, data: QuotaServiceApplyCallbackData) => void): void; + } + + interface QuotaServiceApplyOptions{ + identifier: string; + timeUnit: "minute" | "hour" | "day" | "week" | "month"; + allow: number; + interval?: number; + weight?: number; + } + + interface QuotaServiceApplyCallbackData{ + used: number; + allowed: number; + isAllowed: boolean; + expiryTime: number; + timestamp: number; + } +} + +declare module "apigee-access"{ + export default ApigeeAccess; +} \ No newline at end of file diff --git a/axios/axios-tests.ts b/axios/axios-tests.ts index 9c39031ae5..1f05653229 100644 --- a/axios/axios-tests.ts +++ b/axios/axios-tests.ts @@ -91,3 +91,9 @@ var repoSum = (repo1: Axios.AxiosXHR, repo2: Axios.AxiosXHR([getRepoDetails, getRepoDetails]).then(axios.spread(repoSum)); + +axios.defaults.baseURL = 'https://api.example.com'; +axios.defaults.headers.common['Authorization'] = "AUTH_TOKEN"; +axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'; + +axiosInstance.defaults.headers.common['Authorization'] = "AUTH_TOKEN"; \ No newline at end of file diff --git a/axios/index.d.ts b/axios/index.d.ts index 44083f7960..9c4705d093 100644 --- a/axios/index.d.ts +++ b/axios/index.d.ts @@ -124,6 +124,18 @@ declare namespace Axios { data?: T; } + interface AxiosXHRConfigDefaults extends AxiosXHRConfigBase { + /** + * custom headers to be sent + */ + headers: { + common: {[index: string]: string}; + patch: {[index: string]: string}; + post: {[index: string]: string}; + put: {[index: string]: string}; + }; + } + /** * - expected response type, * - request body data type @@ -223,6 +235,11 @@ declare namespace Axios { */ interceptors: Interceptor; + /** + * Config defaults + */ + defaults: AxiosXHRConfigDefaults; + /** * equivalent to `Promise.all` */ diff --git a/bluebird/index.d.ts b/bluebird/index.d.ts index d4c4fe40bb..e5d6067b37 100644 --- a/bluebird/index.d.ts +++ b/bluebird/index.d.ts @@ -18,11 +18,24 @@ declare var Promise: PromiseConstructor; +interface PromiseCancelHandlerSetter { + (handler: () => void): void; +} + interface PromiseConstructor { /** - * Create a new promise. The passed in function will receive functions `resolve` and `reject` as its arguments which can be called to seal the fate of the created promise. + * Create a new promise. The passed in function will receive functions + * `resolve` and `reject` as its arguments which can be called to seal the + * fate of the created promise. + * + * If configured appropriately, it will also receive an `onCancel` + * function that can be used to configure a promise cancellation handler. */ - new (callback: (resolve: (thenableOrResult?: T | PromiseLike) => void, reject: (error: any) => void) => void): Promise; + new (callback: ( + resolve: (thenableOrResult?: T | PromiseLike) => void, + reject: (error: any) => void, + onCancel?: PromiseCancelHandlerSetter + ) => void): Promise; config(options: { warnings?: boolean | {wForgottenReturn?: boolean}; diff --git a/breeze/breeze-tests.ts b/breeze/breeze-tests.ts index 1606e6f591..17653706ad 100644 --- a/breeze/breeze-tests.ts +++ b/breeze/breeze-tests.ts @@ -883,7 +883,7 @@ function test_config() { o = config.getAdapter("myInterfaceName", "myAdapterName"); o = config.getAdapterInstance("myInterfaceName", "myAdapterName"); config.initializeAdapterInstance("myInterfaceName", "myAdapterName", true); - config.initializeAdapterInstances({ x: 3, y: "not" }); + config.initializeAdapterInstances({ ajax: "", dataService: "" }); s = config.interfaceInitialized.type; o = config.interfaceRegistry; o = config.objectRegistry; diff --git a/breeze/index.d.ts b/breeze/index.d.ts index 28a6be26c9..3fc54dc5d4 100644 --- a/breeze/index.d.ts +++ b/breeze/index.d.ts @@ -11,21 +11,22 @@ // Updated Jan 16 2015 for Breeze 1.4.17 to add support for noimplicitany - Kevin Wilson ( www.kwilson.me.uk ) // Updated Jan 20 2015 for Breeze 1.5.2 and merging changes from DefinitelyTyped // Updated Feb 28 2015 add any/all clause on Predicate +// Updated Jun 27 2016 - Marcel Good (www.ideablade.com) declare namespace breeze.core { - interface ErrorCallback { + export interface ErrorCallback { (error: Error): void; } - interface IEnum { + export interface IEnum { contains(object: any): boolean; fromName(name: string): EnumSymbol; getNames(): string[]; getSymbols(): EnumSymbol[]; } - class Enum implements IEnum { + export class Enum implements IEnum { constructor(name: string, methodObj?: any); addSymbol(propertiesObj?: any): EnumSymbol; @@ -37,14 +38,14 @@ declare namespace breeze.core { resolveSymbols(): void; } - class EnumSymbol { + export class EnumSymbol { parentEnum: IEnum; getName(): string; toString(): string; } - class Event { + export class Event { constructor(name: string, publisher: any, defaultErrorCallback?: ErrorCallback); static enable(eventName: string, target: any): void; @@ -91,25 +92,27 @@ declare namespace breeze.core { declare namespace breeze { - interface Entity { + export interface Entity { entityAspect: EntityAspect; entityType: EntityType; } - interface ComplexObject { + export interface ComplexObject { complexAspect: ComplexAspect; complexType: ComplexType; } - interface IProperty { + export interface IProperty { name: string; + nameOnServer: string; + displayName: string; parentType: IStructuralType; validators: Validator[]; isDataProperty: boolean; isNavigationProperty: boolean; } - interface IStructuralType { + export interface IStructuralType { complexProperties: DataProperty[]; dataProperties: DataProperty[]; name: string; @@ -119,13 +122,13 @@ declare namespace breeze { validators: Validator[]; } - class AutoGeneratedKeyType { + export class AutoGeneratedKeyType { static Identity: AutoGeneratedKeyType; static KeyGenerator: AutoGeneratedKeyType; static None: AutoGeneratedKeyType; } - class ComplexAspect { + export class ComplexAspect { complexObject: ComplexObject; getEntityAspect(): EntityAspect; parent: Object; @@ -134,7 +137,7 @@ declare namespace breeze { originalValues: Object; } - class ComplexType implements IStructuralType { + export class ComplexType implements IStructuralType { complexProperties: DataProperty[]; dataProperties: DataProperty[]; name: string; @@ -146,7 +149,7 @@ declare namespace breeze { getProperties(): DataProperty[]; } - class DataProperty implements IProperty { + export class DataProperty implements IProperty { complexTypeName: string; concurrencyMode: string; dataType: DataTypeSymbol; @@ -162,13 +165,14 @@ declare namespace breeze { maxLength: number; name: string; nameOnServer: string; + displayName: string; parentType: IStructuralType; relatedNavigationProperty: NavigationProperty; validators: Validator[]; constructor(config: DataPropertyOptions); } - interface DataPropertyOptions { + export interface DataPropertyOptions { complexTypeName?: string; concurrencyMode?: string; custom?: any; @@ -185,7 +189,7 @@ declare namespace breeze { validators?: Validator[]; } - class DataService { + export class DataService { adapterInstance: DataServiceAdapter; adapterName: string; hasServerMetadata: boolean; @@ -197,7 +201,7 @@ declare namespace breeze { using(config: DataServiceOptions): DataService; } - interface DataServiceOptions { + export interface DataServiceOptions { serviceName?: string; adapterName?: string; uriBuilderName?: string; @@ -206,7 +210,7 @@ declare namespace breeze { useJsonp?: boolean; } - class DataServiceAdapter { + export class DataServiceAdapter { checkForRecomposition(interfaceInitializedArgs: { interfaceName: string; isDefault: boolean }): void; initialize(): void; fetchMetadata(metadataStore: MetadataStore, dataService: DataService): breeze.promises.IPromise; @@ -215,7 +219,7 @@ declare namespace breeze { JsonResultsAdapter: JsonResultsAdapter; } - class JsonResultsAdapter { + export class JsonResultsAdapter { name: string; extractResults: (data: {}) => {}; visitNode: (node: {}, queryContext: QueryContext, nodeContext: NodeContext) => { entityType?: EntityType; nodeId?: any; nodeRefId?: any; ignore?: boolean; }; @@ -226,24 +230,24 @@ declare namespace breeze { }); } - interface QueryContext { + export interface QueryContext { url: string; - query: any; // how to also say it could be an EntityQuery or a string + query: EntityQuery | string; entityManager: EntityManager; dataService: DataService; queryOptions: QueryOptions; } - interface NodeContext { + export interface NodeContext { nodeType: string; } - class DataTypeSymbol extends breeze.core.EnumSymbol { + export class DataTypeSymbol extends breeze.core.EnumSymbol { defaultValue: any; isNumeric: boolean; isDate: boolean; } - interface DataType extends breeze.core.IEnum { + export interface DataType extends breeze.core.IEnum { Binary: DataTypeSymbol; Boolean: DataTypeSymbol; Byte: DataTypeSymbol; @@ -259,16 +263,36 @@ declare namespace breeze { String: DataTypeSymbol; Time: DataTypeSymbol; Undefined: DataTypeSymbol; + toDataType(typeName: string): DataTypeSymbol; parseDateFromServer(date: any): Date; defaultValue: any; isNumeric: boolean; - } - var DataType: DataType; + isInteger: boolean; - class EntityActionSymbol extends breeze.core.EnumSymbol { + /** Function to convert a value from string to this DataType. Note that this will be called each time a property is changed, so make it fast. */ + parse: (val: any, sourceTypeName: string) => any; + + /** Function to format this DataType for OData queries. */ + fmtOData: (val: any) => any; + + /** Optional function to get the next value for key generation, if this datatype is used as a key. Uses an internal table of previous values. */ + getNext?: () => any; + + /** Optional function to normalize a data value for comparison, if its value cannot be used directly. Note that this will be called each time a property is changed, so make it fast. */ + normalize?: (val: any) => any; + + /** Optional function to get the next value when the datatype is used as a concurrency property. */ + getConcurrencyValue?: (val: any) => any; + + /** Optional function to convert a raw (server) value from string to this DataType. */ + parseRawValue?: (val: any) => any; } - interface EntityAction extends breeze.core.IEnum { + export var DataType: DataType; + + export class EntityActionSymbol extends breeze.core.EnumSymbol { + } + export interface EntityAction extends breeze.core.IEnum { AcceptChanges: EntityActionSymbol; Attach: EntityActionSymbol; AttachOnImport: EntityActionSymbol; @@ -282,9 +306,9 @@ declare namespace breeze { PropertyChange: EntityActionSymbol; RejectChanges: EntityActionSymbol; } - var EntityAction: EntityAction; + export var EntityAction: EntityAction; - class EntityAspect { + export class EntityAspect { entity: Entity; entityManager: EntityManager; entityState: EntityStateSymbol; @@ -318,8 +342,6 @@ declare namespace breeze { removeValidationError(validator: Validator, property: NavigationProperty): void; removeValidationError(validationError: ValidationError): void; - /** Sets the entity to an EntityState of 'Added'. This is NOT the equivalent of calling {{#crossLink "EntityManager/addEntity"}}{{/crossLink}} - because no key generation will occur for autogenerated keys as a result of this operation. */ setAdded(): void; setDeleted(): void; setDetached(): void; @@ -333,7 +355,7 @@ declare namespace breeze { validateProperty(property: NavigationProperty, context?: any): boolean; } - class PropertyChangedEventArgs { + export class PropertyChangedEventArgs { entity: Entity; property: IProperty; propertyName: string; @@ -342,21 +364,21 @@ declare namespace breeze { parent: any; } - class PropertyChangedEvent extends breeze.core.Event { + export class PropertyChangedEvent extends breeze.core.Event { subscribe(callback?: (data: PropertyChangedEventArgs) => void): number; } - class ValidationErrorsChangedEventArgs { + export class ValidationErrorsChangedEventArgs { entity: Entity; added: ValidationError[]; removed: ValidationError[]; } - class ValidationErrorsChangedEvent extends breeze.core.Event { + export class ValidationErrorsChangedEvent extends breeze.core.Event { subscribe(callback?: (data: ValidationErrorsChangedEventArgs) => void): number; } - class EntityKey { + export class EntityKey { constructor(entityType: EntityType, keyValue: any); constructor(entityType: EntityType, keyValues: any[]); @@ -366,17 +388,17 @@ declare namespace breeze { values: any[]; } - interface EntityByKeyResult { + export interface EntityByKeyResult { entity: Entity; entityKey: EntityKey; fromCache: boolean; } - interface ExportEntitiesOptions { + export interface ExportEntitiesOptions { asString: boolean; // default true includeMetadata: boolean; // default true } - class EntityManager { + export class EntityManager { dataService: DataService; keyGeneratorCtor: Function; metadataStore: MetadataStore; @@ -392,7 +414,7 @@ declare namespace breeze { constructor(config?: EntityManagerOptions); constructor(config?: string); - acceptChanges(): void; + acceptChanges(): void; addEntity(entity: Entity): Entity; attachEntity(entity: Entity, entityState?: EntityStateSymbol, mergeStrategy?: MergeStrategySymbol): Entity; clear(): void; @@ -447,7 +469,7 @@ declare namespace breeze { setProperties(config: EntityManagerProperties): void; } - interface EntityManagerOptions { + export interface EntityManagerOptions { serviceName?: string; dataService?: DataService; metadataStore?: MetadataStore; @@ -457,7 +479,7 @@ declare namespace breeze { keyGeneratorCtor?: Function; } - interface EntityManagerProperties { + export interface EntityManagerProperties { serviceName?: string; dataService?: DataService; metadataStore?: MetadataStore; @@ -467,19 +489,19 @@ declare namespace breeze { keyGeneratorCtor?: Function; } - interface ExecuteQuerySuccessCallback { + export interface ExecuteQuerySuccessCallback { (data: QueryResult): void; } - interface ExecuteQueryErrorCallback { + export interface ExecuteQueryErrorCallback { (error: { query: EntityQuery; httpResponse: HttpResponse; entityManager: EntityManager; message?: string; stack?:string }): void; } - interface SaveChangesSuccessCallback { + export interface SaveChangesSuccessCallback { (saveResult: SaveResult): void; } - interface EntityError { + export interface EntityError { entity: Entity; errorMessage: string; errorName: string; @@ -487,7 +509,7 @@ declare namespace breeze { propertyName: string; } - interface SaveChangesErrorCallback { + export interface SaveChangesErrorCallback { (error: { entityErrors: EntityError[]; httpResponse: HttpResponse; @@ -497,26 +519,26 @@ declare namespace breeze { }): void; } - class EntityChangedEventArgs { + export class EntityChangedEventArgs { entity: Entity; entityAction: EntityActionSymbol; args: Object; } - class EntityChangedEvent extends breeze.core.Event { + export class EntityChangedEvent extends breeze.core.Event { subscribe(callback?: (data: EntityChangedEventArgs) => void): number; } - class HasChangesChangedEventArgs { + export class HasChangesChangedEventArgs { entityManager: EntityManager; hasChanges: boolean; } - class HasChangesChangedEvent extends breeze.core.Event { + export class HasChangesChangedEvent extends breeze.core.Event { subscribe(callback?: (data: HasChangesChangedEventArgs) => void): number; } - class EntityQuery { + export class EntityQuery { entityManager: EntityManager; orderByClause: OrderByClause; parameters: Object; @@ -573,10 +595,10 @@ declare namespace breeze { toJSON(): string; } - interface OrderByClause { + export interface OrderByClause { } - class EntityStateSymbol extends breeze.core.EnumSymbol { + export class EntityStateSymbol extends breeze.core.EnumSymbol { isAdded(): boolean; isAddedModifiedOrDeleted(): boolean; isDeleted(): boolean; @@ -585,16 +607,16 @@ declare namespace breeze { isUnchanged(): boolean; isUnchangedOrModified(): boolean; } - interface EntityState extends breeze.core.IEnum { + export interface EntityState extends breeze.core.IEnum { Added: EntityStateSymbol; Deleted: EntityStateSymbol; Detached: EntityStateSymbol; Modified: EntityStateSymbol; Unchanged: EntityStateSymbol; } - var EntityState: EntityState; + export var EntityState: EntityState; - class EntityType implements IStructuralType { + export class EntityType implements IStructuralType { autoGeneratedKeyType: AutoGeneratedKeyType; baseEntityType: EntityType; complexProperties: DataProperty[]; @@ -630,7 +652,7 @@ declare namespace breeze { toString(): string; } - interface EntityTypeOptions { + export interface EntityTypeOptions { shortName?: string; namespace?: string; autoGeneratedKeyType?: AutoGeneratedKeyType; @@ -639,24 +661,24 @@ declare namespace breeze { navigationProperties?: NavigationProperty[]; } - interface EntityTypeProperties { + export interface EntityTypeProperties { autoGeneratedKeyType?: AutoGeneratedKeyType; defaultResourceName?: string; serializerFn?: (dataProperty: DataProperty, value: any) => any; } - class FetchStrategySymbol extends breeze.core.EnumSymbol { + export class FetchStrategySymbol extends breeze.core.EnumSymbol { private foo; // to distinguish this class from MergeStrategySymbol } - interface FetchStrategy extends breeze.core.IEnum { + export interface FetchStrategy extends breeze.core.IEnum { FromLocalCache: FetchStrategySymbol; FromServer: FetchStrategySymbol; } - var FetchStrategy: FetchStrategy; + export var FetchStrategy: FetchStrategy; - class FilterQueryOpSymbol extends breeze.core.EnumSymbol { + export class FilterQueryOpSymbol extends breeze.core.EnumSymbol { } - interface FilterQueryOp extends breeze.core.IEnum { + export interface FilterQueryOp extends breeze.core.IEnum { Contains: FilterQueryOpSymbol; EndsWith: FilterQueryOpSymbol; Equals: FilterQueryOpSymbol; @@ -670,9 +692,9 @@ declare namespace breeze { Any: FilterQueryOpSymbol; All: FilterQueryOpSymbol; } - var FilterQueryOp: FilterQueryOp; + export var FilterQueryOp: FilterQueryOp; - class LocalQueryComparisonOptions { + export class LocalQueryComparisonOptions { static caseInsensitiveSQL: LocalQueryComparisonOptions; static defaultInstance: LocalQueryComparisonOptions; @@ -681,17 +703,17 @@ declare namespace breeze { setAsDefault(): void; } - class MergeStrategySymbol extends breeze.core.EnumSymbol { + export class MergeStrategySymbol extends breeze.core.EnumSymbol { } - interface MergeStrategy extends breeze.core.IEnum { + export interface MergeStrategy extends breeze.core.IEnum { OverwriteChanges: MergeStrategySymbol; PreserveChanges: MergeStrategySymbol; SkipMerge: MergeStrategySymbol; Disallowed: MergeStrategySymbol; } - var MergeStrategy: MergeStrategy; + export var MergeStrategy: MergeStrategy; - class MetadataStore { + export class MetadataStore { constructor(); constructor(config?: MetadataStoreOptions); namingConvention: NamingConvention; @@ -707,7 +729,7 @@ declare namespace breeze { static importMetadata(exportedString: string): MetadataStore; importMetadata(exportedString: string, allowMerge?: boolean): MetadataStore; isEmpty(): boolean; - registerEntityTypeCtor(entityTypeName: string, entityCtor: Function, initializationFn?: (entity: Entity) => void, noTrackingFn?: (entity: Entity) => Entity): void; + registerEntityTypeCtor(entityTypeName: string, entityCtor: Function, initializationFn?: (entity: Entity) => void, noTrackingFn?: (node: Object, entityType: EntityType) => Object): void; trackUnmappedType(entityCtor: Function, interceptor?: Function): void; setEntityTypeForResourceName(resourceName: string, entityType: EntityType): void; setEntityTypeForResourceName(resourceName: string, entityTypeName: string): void; @@ -715,12 +737,12 @@ declare namespace breeze { setProperties(config: { name?: string; serializerFn?: Function }): void; } - interface MetadataStoreOptions { + export interface MetadataStoreOptions { namingConvention?: NamingConvention; localQueryComparisonOptions?: LocalQueryComparisonOptions; } - class NamingConvention { + export class NamingConvention { static camelCase: NamingConvention; static defaultInstance: NamingConvention; static none: NamingConvention; @@ -736,12 +758,12 @@ declare namespace breeze { setAsDefault(): NamingConvention; } - interface NamingConventionOptions { + export interface NamingConventionOptions { serverPropertyNameToClient?: (name: string) => string; clientPropertyNameToServer?: (name: string) => string; } - class NavigationProperty implements IProperty { + export class NavigationProperty implements IProperty { associationName: string; entityType: EntityType; foreignKeyNames: string[]; @@ -750,6 +772,8 @@ declare namespace breeze { isNavigationProperty: boolean; isScalar: boolean; name: string; + nameOnServer: string; + displayName: string; parentType: IStructuralType; relatedDataProperties: DataProperty[]; validators: Validator[]; @@ -757,7 +781,7 @@ declare namespace breeze { constructor(config: NavigationPropertyOptions); } - interface NavigationPropertyOptions { + export interface NavigationPropertyOptions { name?: string; nameOnServer?: string; entityTypeName: string; @@ -768,15 +792,21 @@ declare namespace breeze { validators?: Validator[]; } - class Predicate { + export interface IRecursiveArray { + [i: number]: T | IRecursiveArray; + } + + export class Predicate { + constructor(); constructor(property: string, operator: string, value: any); constructor(property: string, operator: FilterQueryOpSymbol, value: any); constructor(property: string, operator: string, value: { value: any; isLiteral?: boolean; dataType?: breeze.DataType }); constructor(property: string, operator: FilterQueryOpSymbol, value: { value: any; isLiteral?: boolean; dataType?: breeze.DataType }); constructor(property: string, filterop: FilterQueryOpSymbol, property2: string, filterop2: FilterQueryOpSymbol, value: any); // for any/all clauses constructor(property: string, filterop: string, property2: string, filterop2: string, value: any); // for any/all clauses - /** Create predicate from an expression tree */ - constructor(tree: Object); + constructor(passthru: string); + constructor(predicate: Predicate); + constructor(anArray: IRecursiveArray); and: PredicateMethod; static and: PredicateMethod; @@ -798,7 +828,7 @@ declare namespace breeze { toJSON(): string; } - interface PredicateMethod { + export interface PredicateMethod { (predicates: Predicate[]): Predicate; (...predicates: Predicate[]): Predicate; (property: string, operator: string, value: any, valueIsLiteral?: boolean): Predicate; @@ -807,7 +837,7 @@ declare namespace breeze { (property: string, filterop: string, property2: string, filterop2: string, value: any): Predicate; // for any/all clauses } - class QueryOptions { + export class QueryOptions { static defaultInstance: QueryOptions; fetchStrategy: FetchStrategySymbol; mergeStrategy: MergeStrategySymbol; @@ -822,12 +852,12 @@ declare namespace breeze { using(config: FetchStrategySymbol): QueryOptions; } - interface QueryOptionsConfiguration { + export interface QueryOptionsConfiguration { fetchStrategy?: FetchStrategySymbol; mergeStrategy?: MergeStrategySymbol; } - interface HttpResponse { + export interface HttpResponse { config: any; data: Entity[]; error?: any; @@ -836,7 +866,7 @@ declare namespace breeze { getHeaders(headerName: string): string } - interface QueryResult { + export interface QueryResult { /** Top level entities returned */ results: Entity[]; /** Query that was executed */ @@ -851,33 +881,33 @@ declare namespace breeze { retrievedEntities?: Entity[] } - class SaveOptions { + export class SaveOptions { allowConcurrentSaves: boolean; resourceName: string; dataService: DataService; tag: Object; static defaultInstance: SaveOptions; - constructor(config?: { allowConcurrentSaves?: boolean; resourceName?: string; dataService?: DataService; tag?: any}); + constructor(config?: { allowConcurrentSaves?: boolean; resourceName?: string; dataService?: DataService; tag?: any }); setAsDefault(): SaveOptions; using(config: SaveOptionsConfiguration): SaveOptions; } - interface SaveOptionsConfiguration { + export interface SaveOptionsConfiguration { allowConcurrentSaves?: boolean; resourceName?: string; dataService?: DataService; tag?: Object; } - interface SaveResult { + export interface SaveResult { entities: Entity[]; keyMappings: any; XHR: XMLHttpRequest; } - class ValidationError { + export class ValidationError { key: string; context: any; errorMessage: string; @@ -889,7 +919,7 @@ declare namespace breeze { constructor(validator: Validator, context: any, errorMessage: string, key: string); } - class ValidationOptions { + export class ValidationOptions { static defaultInstance: ValidationOptions; validateOnAttach: boolean; validateOnPropertyChange: boolean; @@ -902,14 +932,14 @@ declare namespace breeze { using(config: ValidationOptionsConfiguration): ValidationOptions; } - interface ValidationOptionsConfiguration { + export interface ValidationOptionsConfiguration { validateOnAttach?: boolean; validateOnSave?: boolean; validateOnQuery?: boolean; validateOnPropertyChange?: boolean; } - class Validator { + export class Validator { /** Map of standard error message templates keyed by validator name.*/ static messageTemplates: any; context: any; @@ -962,7 +992,7 @@ declare namespace breeze { /** Creates a regular expression validator with a fixed expression. */ static makeRegExpValidator(validatorName: string, expression: RegExp, defaultMessage: string, context?: any): Validator; - /** Run this validator against the specified value. + /** Run this validator against the specified value. @param value {Object} Value to validate @param additionalContext {Object} Any additional contextual information that the Validator can make use of. @return {ValidationError|null} A ValidationError if validation fails, null otherwise */ @@ -972,11 +1002,11 @@ declare namespace breeze { getMessage(): string; } - interface ValidatorFunction { + export interface ValidatorFunction { (value: any, context: ValidatorFunctionContext): void; } - interface ValidatorFunctionContext { + export interface ValidatorFunctionContext { value: any; validatorName: string; displayName: string; @@ -984,84 +1014,89 @@ declare namespace breeze { message?: string; } - var metadataVersion: string; - var remoteAccess_odata: string; - var remoteAccess_webApi: string; - var version: string; + export var metadataVersion: string; + export var remoteAccess_odata: string; + export var remoteAccess_webApi: string; + export var version: string; + } declare namespace breeze.config { - var ajax: string; - var dataService: string; - var functionRegistry: Object; + + export var ajax: string; + export var dataService: string; + export var functionRegistry: Object; /** Returns the ctor function used to implement a specific interface with a specific adapter name. - @method getAdapter @param interfaceName {String} One of the following interface names "ajax", "dataService" or "modelLibrary" - @param [adapterName] {String} The name of any previously registered adapter. If this parameter is omitted then + @param adapterName {String} The name of any previously registered adapter. If this parameter is omitted then this method returns the "default" adapter for this interface. If there is no default adapter, then a null is returned. - @return {Function|null} Returns either a ctor function or null. + @returns {Function|null} Returns either a ctor function or null. **/ export function getAdapter(interfaceName: string, adapterName?: string): Function; /** Returns the adapter instance corresponding to the specified interface and adapter names. - @method getAdapterInstance @param interfaceName {String} The name of the interface. - @param [adapterName] {String} - The name of a previously registered adapter. If this parameter is + @param adapterName {String} - The name of a previously registered adapter. If this parameter is omitted then the default implementation of the specified interface is returned. If there is no defaultInstance of this interface, then the first registered instance of this interface is returned. @return {an instance of the specified adapter} **/ export function getAdapterInstance(interfaceName: string, adapterName?: string): Object; /** - Initializes a single adapter implementation. Initialization means either newing a instance of the + Initializes a single adapter implementation. Initialization means either newing a instance of the specified interface and then calling "initialize" on it or simply calling "initialize" on the instance if it already exists. - @method initializeAdapterInstance @param interfaceName {String} The name of the interface to which the adapter to initialize belongs. @param adapterName {String} - The name of a previously registered adapter to initialize. - @param [isDefault=true] {Boolean} - Whether to make this the default "adapter" for this interface. + @param isDefault=true {Boolean} - Whether to make this the default "adapter" for this interface. @return {an instance of the specified adapter} **/ export function initializeAdapterInstance(interfaceName: string, adapterName: string, isDefault?: boolean): void; + + export interface AdapterInstancesConfig { + /** the name of a previously registered "ajax" adapter */ + ajax?: string; + /** the name of a previously registered "dataService" adapter */ + dataService?: string; + /** the name of a previously registered "modelLibrary" adapter */ + modelLibary?: string; + /** the name of a previously registered "uriBuilder" adapter */ + uriBuilder?: string; + } /** Initializes a collection of adapter implementations and makes each one the default for its corresponding interface. - @method initializeAdapterInstances - @param config {Object} - @param [config.ajax] {String} - the name of a previously registered "ajax" adapter - @param [config.dataService] {String} - the name of a previously registered "dataService" adapter - @param [config.modelLibrary] {String} - the name of a previously registered "modelLibrary" adapter - @param [config.uriBuilder] {String} - the name of a previously registered "uriBuilder" adapter + @param config {AdapterInstancesConfig} @return [array of instances] **/ - export function initializeAdapterInstances(config: Object): Object[]; - var interfaceInitialized: Event; - var interfaceRegistry: Object; - var objectRegistry: Object; + export function initializeAdapterInstances(config: AdapterInstancesConfig): Object[]; + export var interfaceInitialized: Event; + export var interfaceRegistry: Object; + export var objectRegistry: Object; /** Method use to register implementations of standard breeze interfaces. Calls to this method are usually - made as the last step within an adapter implementation. - @method registerAdapter + made as the last step within an adapter implementation. @param interfaceName {String} - one of the following interface names "ajax", "dataService" or "modelLibrary" - @param adapterCtor {Function} - an ctor function that returns an instance of the specified interface. + @param adapterCtor {Function} - an ctor function that returns an instance of the specified interface. **/ export function registerAdapter(interfaceName: string, adapterCtor: Function): void; export function registerFunction(fn: Function, fnName: string): void; export function registerType(ctor: Function, typeName: string): void; //static setProperties(config: Object): void; //deprecated - /** + /** Set the promise implementation, if Q.js is not found. @param q - implementation of promise. @see http://wiki.commonjs.org/wiki/Promises/A */ export function setQ(q: breeze.promises.IPromiseService): void; - var stringifyPad: string; - var typeRegistry: Object; + export var stringifyPad: string; + export var typeRegistry: Object; } /** Promises interface used by Breeze. Usually implemented by Q (https://github.com/kriskowal/q) or angular.$q using breeze.config.setQ(impl) */ declare namespace breeze.promises { - interface IPromise { + + export interface IPromise { then(onFulfill: (value: T) => U, onReject?: (reason: any) => U): IPromise; then(onFulfill: (value: T) => IPromise, onReject?: (reason: any) => U): IPromise; then(onFulfill: (value: T) => U, onReject?: (reason: any) => IPromise): IPromise; @@ -1071,13 +1106,13 @@ declare namespace breeze.promises { finally(finallyCallback: () => any): IPromise; } - interface IDeferred { + export interface IDeferred { promise: IPromise; resolve(value: T): void; reject(reason: any): void; } - interface IPromiseService { + export interface IPromiseService { defer(): IDeferred; reject(reason?: any): IPromise; resolve(object: T): IPromise; @@ -1085,3 +1120,6 @@ declare namespace breeze.promises { } } +declare module "breeze" { + export = breeze; +} diff --git a/bytes/bytes-tests.ts b/bytes/bytes-tests.ts index 8df0bcbf18..482b54afd2 100644 --- a/bytes/bytes-tests.ts +++ b/bytes/bytes-tests.ts @@ -6,7 +6,9 @@ console.log(bytes(104857, { thousandsSeparator: ' ' })); console.log(bytes.format(104857)); console.log(bytes.format(104857, { thousandsSeparator: ' ' })); - +console.log(bytes.format(104857, { decimalPlaces: 2 })); +console.log(bytes.format(104857, { fixedDecimals: true })); +console.log(bytes.format(104857, { unitSeparator: '-' })); console.log(bytes('1024kb')); console.log(bytes(1024)); diff --git a/bytes/index.d.ts b/bytes/index.d.ts index 37a25897a0..cc9b5975b7 100644 --- a/bytes/index.d.ts +++ b/bytes/index.d.ts @@ -1,10 +1,14 @@ -// Type definitions for bytes v2.1.0 +// Type definitions for bytes v2.4.0 // Project: https://github.com/visionmedia/bytes.js // Definitions by: Zhiyuan Wang // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - +interface BytesOptions { + decimalPlaces?: number, + thousandsSeparator?: string, + unitSeparator?: string, + fixedDecimals?: boolean +} /** *Convert the given value in bytes into a string. * @@ -37,7 +41,7 @@ declare namespace bytes { * @param {BytesFormatOptions} [options] */ - function format(value: number, options?: { thousandsSeparator: string }): string; + function format(value: number, options?: BytesOptions): string; /** * Just return the input number value. diff --git a/content-type/content-type-tests.ts b/content-type/content-type-tests.ts index dcbba27d85..0e5eb2c048 100644 --- a/content-type/content-type-tests.ts +++ b/content-type/content-type-tests.ts @@ -1,47 +1,17 @@ +import contentType = require('content-type'); +import express = require('express'); + +var obj = contentType.parse('image/svg+xml; charset=utf-8'); + +console.log(obj.type); // => 'image/svg+xml' +console.log(obj.parameters.charset); // => 'utf-8' -import MediaType = require('content-type'); +var req: express.Request; +obj = contentType.parse(req); -// https://github.com/deoxxa/content-type/blob/master/README.md -function new_test(): void { - var p = new MediaType('text/html;level=1;q=0.5'); - p.q === 0.5; - p.params.level === "1"; +var res: express.Response; +obj = contentType.parse(res); - var q = new MediaType('application/json', { profile: 'http://example.com/schema.json' }); - q.type === "application/json"; - q.params.profile === "http://example.com/schema.json"; +var str: string = contentType.format({type: 'image/svg+xml'}); - q.q = 1; - q.toString() === 'application/json;q=1;profile="http://example.com/schema.json"'; -} - -function mediaCmp_test(): void { - MediaType.mediaCmp(MediaType.parseMedia('text/html'), MediaType.parseMedia('text/html')) === 0; - MediaType.mediaCmp(MediaType.parseMedia('*/*'), MediaType.parseMedia('text/html')) === 1; - MediaType.mediaCmp(MediaType.parseMedia('text/html;level=1'), MediaType.parseMedia('text/html')) === -1; - MediaType.mediaCmp(MediaType.parseMedia('application/json;profile="v1.json"'), MediaType.parseMedia('application/json;profile="v2.json"')) === null; -} - -// https://github.com/deoxxa/content-type/blob/master/example.js -function example(): void { - var representations = [ - 'application/json', - 'text/html', - 'application/json;profile="schema.json"', - 'application/json;profile="different.json"', - ]; - - var accept = [ - 'text/html;q=0.50', - '*/*;q=0.01', - 'application/json;profile=different.json', - 'application/json;profile="a,b;c.json?d=1;f=2";q=0.2', - ]; - - console.log('Formats:\n\t' + representations.map(MediaType.parseMedia).join('\n\t')); - - console.log('Accept:\n\t' + accept.map(MediaType.parseMedia).join('\n\t')); - - console.log('Selected:', (MediaType.select(representations.map(MediaType.parseMedia), accept.map(MediaType.parseMedia)) || 'None').toString()); -} \ No newline at end of file diff --git a/content-type/index.d.ts b/content-type/index.d.ts index 086e1b9d4f..0095367565 100644 --- a/content-type/index.d.ts +++ b/content-type/index.d.ts @@ -1,30 +1,21 @@ -// Type definitions for content-type v0.0.1 -// Project: https://github.com/deoxxa/content-type -// Definitions by: Pine Mizune -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Type definitions for content-type v1.0.1 +// Project: https://www.npmjs.com/package/content-type +// Definitions by: Hiroki Horiuchi +// Definitions: https://github.com/borisyankov/DefinitelyTyped -declare var x: ContentType.MediaTypeStatic; +declare var x: ContentType.StaticFunctions; export = x; declare namespace ContentType { + interface StaticFunctions { + parse(string: string): MediaType; + parse(req: { headers: any; }): MediaType; + parse(res: { getHeader(key: string): string; }): MediaType; + format(obj: MediaType): string; + } + interface MediaType { type: string; - q?: number; - params: any; - toString(): string; - } - - interface SelectOptions { - sortAvailable?: boolean; - sortAccepted?: boolean; - } - - interface MediaTypeStatic { - new (s: string, p?: any): MediaType; - parseMedia(type: string): MediaType; - splitQuotedString(str: string, delimiter?: string, quote?: string): string[]; - splitContentTypes(str: string): string[]; - select(availableTypes: MediaType[], acceptedTypes: MediaType[], options?: SelectOptions): string; - mediaCmp(a: MediaType, b: MediaType): number; + parameters?: any; } } diff --git a/cordova-plugin-ibeacon/index.d.ts b/cordova-plugin-ibeacon/index.d.ts index df8e3304c5..f33cc62c73 100644 --- a/cordova-plugin-ibeacon/index.d.ts +++ b/cordova-plugin-ibeacon/index.d.ts @@ -50,6 +50,7 @@ declare namespace BeaconPlugin { beacons: Beacon[]; authorizationStatus: string; state: string; + error: string; } export interface Delegate { diff --git a/deoxxa-content-type/content-type-test.ts b/deoxxa-content-type/content-type-test.ts new file mode 100644 index 0000000000..3e419933ef --- /dev/null +++ b/deoxxa-content-type/content-type-test.ts @@ -0,0 +1,47 @@ +/// + +import MediaType = require('content-type'); + +// https://github.com/deoxxa/content-type/blob/master/README.md +function new_test(): void { + var p = new MediaType('text/html;level=1;q=0.5'); + p.q === 0.5; + p.params.level === "1"; + + var q = new MediaType('application/json', { profile: 'http://example.com/schema.json' }); + q.type === "application/json"; + q.params.profile === "http://example.com/schema.json"; + + q.q = 1; + q.toString() === 'application/json;q=1;profile="http://example.com/schema.json"'; +} + +function mediaCmp_test(): void { + MediaType.mediaCmp(MediaType.parseMedia('text/html'), MediaType.parseMedia('text/html')) === 0; + MediaType.mediaCmp(MediaType.parseMedia('*/*'), MediaType.parseMedia('text/html')) === 1; + MediaType.mediaCmp(MediaType.parseMedia('text/html;level=1'), MediaType.parseMedia('text/html')) === -1; + MediaType.mediaCmp(MediaType.parseMedia('application/json;profile="v1.json"'), MediaType.parseMedia('application/json;profile="v2.json"')) === null; +} + +// https://github.com/deoxxa/content-type/blob/master/example.js +function example(): void { + var representations = [ + 'application/json', + 'text/html', + 'application/json;profile="schema.json"', + 'application/json;profile="different.json"', + ]; + + var accept = [ + 'text/html;q=0.50', + '*/*;q=0.01', + 'application/json;profile=different.json', + 'application/json;profile="a,b;c.json?d=1;f=2";q=0.2', + ]; + + console.log('Formats:\n\t' + representations.map(MediaType.parseMedia).join('\n\t')); + + console.log('Accept:\n\t' + accept.map(MediaType.parseMedia).join('\n\t')); + + console.log('Selected:', (MediaType.select(representations.map(MediaType.parseMedia), accept.map(MediaType.parseMedia)) || 'None').toString()); +} diff --git a/deoxxa-content-type/content-type.d.ts b/deoxxa-content-type/content-type.d.ts new file mode 100644 index 0000000000..6e901e7f86 --- /dev/null +++ b/deoxxa-content-type/content-type.d.ts @@ -0,0 +1,32 @@ +// Type definitions for content-type v0.0.1 +// Project: https://github.com/deoxxa/content-type +// Definitions by: Pine Mizune +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace ContentType { + interface MediaType { + type: string; + q?: number; + params: any; + toString(): string; + } + + interface SelectOptions { + sortAvailable?: boolean; + sortAccepted?: boolean; + } + + interface MediaTypeStatic { + new (s: string, p?: any): MediaType; + parseMedia(type: string): MediaType; + splitQuotedString(str: string, delimiter?: string, quote?: string): string[]; + splitContentTypes(str: string): string[]; + select(availableTypes: MediaType[], acceptedTypes: MediaType[], options?: SelectOptions): string; + mediaCmp(a: MediaType, b: MediaType): number; + } +} + +declare module "content-type" { + var x: ContentType.MediaTypeStatic; + export = x; +} diff --git a/dot-object/dot-object-tests.ts b/dot-object/dot-object-tests.ts new file mode 100644 index 0000000000..ca7aa3f676 --- /dev/null +++ b/dot-object/dot-object-tests.ts @@ -0,0 +1,67 @@ +/// + +var obj = { + 'first_name': 'John', + 'last_name': 'Doe' +}; + +dot.move('first_name', 'contact.firstname', obj); +dot.move('last_name', 'contact.lastname', obj); + +var src = { + name: 'John', + stuff: { + phone: { + brand: 'iphone', + version: 6 + } + } +}; + +var tgt = {name: 'Brandon'}; + +dot.copy('stuff.phone', 'wanna.haves.phone', src, tgt, [(arg: any) => { + return arg; +}]); + +dot.transfer('stuff.phone', 'wanna.haves.phone', src, tgt); + +var row = { + 'id': 2, + 'contact.name.first': 'John', + 'contact.name.last': 'Doe', + 'contact.email': 'example@gmail.com', + 'contact.info.about.me': 'classified', + 'devices[0]': 'mobile', + 'devices[1]': 'laptop', + 'some.other.things.0': 'this', + 'some.other.things.1': 'that' +}; + +dot.object(row, (arg: any) => { + return arg; +}); + +dot.str('this.is.my.string', 'value', tgt); + +var newObj = { + some: { + nested: { + value: 'Hi there!' + } + } +}; + +var val = dot.pick('some.nested.value', newObj); +console.log(val); + +// Pick & Remove the value +val = dot.pick('some.nested.value', newObj, true); + +// shorthand +val = dot.remove('some.nested.value', newObj); + +// or use the alias `del` +val = dot.del('some.nested.value', newObj); + +var dotWithArrow = new dot('=>'); \ No newline at end of file diff --git a/dot-object/dot-object.d.ts b/dot-object/dot-object.d.ts new file mode 100644 index 0000000000..953291c631 --- /dev/null +++ b/dot-object/dot-object.d.ts @@ -0,0 +1,169 @@ +// Type definitions for Dot-Object v1.4.1 +// Project: https://github.com/rhalff/dot-object +// Definitions by: Niko Kovačič +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + + +declare namespace DotObject { + interface DotConstructor extends Dot { + new(separator: string): Dot; + } + + interface ModifierFunctionWrapper { + (arg: any): any; + } + + interface Dot { + /** + * + * Copy a property from one object to another object. + * + * If the source path does not exist (undefined) + * the property on the other object will not be set. + * + * @param {String} source + * @param {String} target + * @param {Object} obj1 + * @param {Object} obj2 + * @param {Function|Array} mods + * @param {Boolean} merge + */ + copy(source: string, target: string, obj1: any, obj2: any, mods?: ModifierFunctionWrapper | Array, merge?: boolean): void; + /** + * + * Convert object to dotted-key/value pair + * + * Usage: + * + * var tgt = dot.dot(obj) + * + * or + * + * var tgt = {} + * dot.dot(obj, tgt) + * + * @param {Object} obj source object + * @param {Object} tgt target object + */ + dot(obj: any, tgt: any): void + /** + * + * Remove value from an object using dot notation. + * + * @param {String} path + * @param {Object} obj + * @return {Mixed} The removed value + */ + del(path: string, obj: any): any; + /** + * + * Move a property from one place to the other. + * + * If the source path does not exist (undefined) + * the target property will not be set. + * + * @param {String} source + * @param {String} target + * @param {Object} obj + * @param {Function|Array} mods + * @param {Boolean} merge + */ + move(source: string, target: string, obj: any, mods?: ModifierFunctionWrapper | Array, merge?: boolean): void; + /** + * + * Converts an object with dotted-key/value pairs to it's expanded version + * + * Optionally transformed by a set of modifiers. + * + * Usage: + * + * var row = { + * 'nr': 200, + * 'doc.name': ' My Document ' + * } + * + * var mods = { + * 'doc.name': [_s.trim, _s.underscored] + * } + * + * dot.object(row, mods) + * + * @param {Object} obj + * @param {Object} mods + */ + object(obj: any, mods?: ModifierFunctionWrapper | Array): void; + /** + * + * Pick a value from an object using dot notation. + * + * Optionally remove the value + * + * @param {String} path + * @param {Object} obj + * @param {Boolean} remove + */ + pick(path: string, obj: any, remove?: boolean): void; + /** + * + * Remove value from an object using dot notation. + * + * @param {String} path + * @param {Object} obj + * @return {Mixed} The removed value + */ + remove(path: string, obj: any): any; + /** + * @param {String} path dotted path + * @param {String} v value to be set + * @param {Object} obj object to be modified + * @param {Function|Array} mods optional modifier + */ + str(path: string, v: any, obj: Object, mods?: ModifierFunctionWrapper | Array): void; + /** + * + * Transfer a property from one object to another object. + * + * If the source path does not exist (undefined) + * the property on the other object will not be set. + * + * @param {String} source + * @param {String} target + * @param {Object} obj1 + * @param {Object} obj2 + * @param {Function|Array} mods + * @param {Boolean} merge + */ + transfer(source: string, target: string, obj1: any, obj2: any, mods?: ModifierFunctionWrapper | Array, merge?: boolean): void; + /** + * + * Transform an object + * + * Usage: + * + * var obj = { + * "id": 1, + * "some": { + * "thing": "else" + * } + * } + * + * var transform = { + * "id": "nr", + * "some.thing": "name" + * } + * + * var tgt = dot.transform(transform, obj) + * + * @param {Object} recipe Transform recipe + * @param {Object} obj Object to be transformed + * @param {Array} mods modifiers for the target + */ + transform(recipe: any, obj: any, mods?: ModifierFunctionWrapper | Array): void; + } +} + +declare var dot: DotObject.DotConstructor; + +declare module 'dot-object' { + export = dot; +} \ No newline at end of file diff --git a/drop/index.d.ts b/drop/index.d.ts index e702bd8392..52bf76946f 100644 --- a/drop/index.d.ts +++ b/drop/index.d.ts @@ -51,6 +51,12 @@ declare namespace Drop { constrainToScrollParent?: boolean; remove?: boolean; beforeClose?: () => boolean; + openDelay?: number; + closeDelay?: number; + focusDelay?: number; + blurDelay?: number; + hoverOpenDelay?: number; + hoverCloseDelay?: number; tetherOptions?: Tether.ITetherOptions; } } diff --git a/ember/ember-1.11.3-tests.ts b/ember/ember-1.11.3-tests.ts new file mode 100644 index 0000000000..6cd304c54a --- /dev/null +++ b/ember/ember-1.11.3-tests.ts @@ -0,0 +1,210 @@ +/// +/// + + +var App : any; + +App = Em.Application.create(); + +App.president = Em.Object.create({ + name: 'Barack Obama' +}); +App.country = Em.Object.create({ + presidentNameBinding: 'MyApp.president.name' +}); +App.country.get('presidentName'); +App.president = Em.Object.create({ + firstName: 'Barack', + lastName: 'Obama', + fullName: function () { + return this.get('firstName') + ' ' + this.get('lastName'); + }.property() +}); +App.president.get('fullName'); + +declare class MyPerson extends Em.Object { + static createMan(): MyPerson; +} + +var Person1 = Em.Object.extend({ + say: (thing: string) => { + alert(thing); + } +}); + +declare class MyPerson2 extends Em.Object { + helloWorld(): void; +} +var tom = Person1.create({ + name: 'Tom Dale', + helloWorld: function() { + this.say('Hi my name is ' + this.get('name')); + } +}); +tom.helloWorld(); + +Person1.reopen({ isPerson: true }); +Person1.create().get('isPerson'); + +Person1.reopenClass({ + createMan: () => { + return Person1.create({ isMan: true }); + } +}); +// ReSharper disable once DuplicatingLocalDeclaration +declare var Person1: typeof MyPerson; +Person1.createMan().get('isMan'); + +var person = Person1.create({ + firstName: 'Yehuda', + lastName: 'Katz' +}); +person.addObserver('fullName', null, () => { }); +person.set('firstName', 'Brohuda'); + +App.todosController = Em.Object.create({ + todos: [ + Em.Object.create({ isDone: false }) + ], + remaining: (function() { + var todos = this.get('todos'); + return todos.filterProperty('isDone', false).get('length'); + }).property('todos.@each.isDone') +}); + +var todos = App.todosController.get('todos'); +var todo = todos.objectAt(0); +todo.set('isDone', true); +App.todosController.get('remaining'); +todo = Em.Object.create({ isDone: false }); +todos.pushObject(todo); +App.todosController.get('remaining'); + +App.wife = Em.Object.create({ + householdIncome: 80000 +}); +App.husband = Em.Object.create({ + householdIncomeBinding: 'App.wife.householdIncome' +}); +App.husband.get('householdIncome'); +App.husband.set('householdIncome', 90000); +App.wife.get('householdIncome'); + +App.user = Em.Object.create({ + fullName: 'Kara Gates' +}); +App.userView = Em.View.create({ + userNameBinding: Em.Binding.oneWay('App.user.fullName') +}); +App.user.set('fullName', 'Krang Gates'); +App.userView.set('userName', 'Truckasaurus Gates'); +App.user.get('fullName'); + +App = Em.Application.create({ + rootElement: '#sidebar' +}); + +var view = Em.View.create({ + templateName: 'say-hello', + name: 'Bob' +}); +view.appendTo('#container'); +view.append(); +view.remove(); + +App.AlertView = Em.View.extend({ + priority: 'p4', + isUrgent: true +}); + +App.ListingView = Em.View.extend({ + templateName: 'listing', + edit: (event: any) => { + event.view.set('isEditing', true); + } +}); + +App.userController = Em.Object.create({ + content: Em.Object.create({ + firstName: 'Albert', + lastName: 'Hofmann', + posts: 25, + hobbies: 'Riding bicycles' + }) +}); + +Handlebars.registerHelper('highlight', function(property: string, options: any) { + var value = Em.Handlebars.get(this, property, options); + return new Handlebars.SafeString('' + value + ''); +}); + +App.MyText = Em.TextField.extend({ + formBlurredBinding: 'App.adminController.formBlurred', + change: function() { + this.set('formBlurred', true); + } +}); + +var textArea = Em.TextArea.create({ + valueBinding: 'TestObject.value' +}); + +App.ClickableView = Em.View.extend({ + click: () => { + alert('ClickableView was clicked!'); + } +}); + +var container = Em.ContainerView.create(); +container.append(); +var coolView = App.CoolView.create(), + childViews = container.get('childViews'); +childViews.pushObject(coolView); + +var Person2 = Em.Object.extend({ + sayHello: function() { + console.log('Hello from ' + this.get('name')); + } +}); +var people = [ + Person2.create({ name: 'Juan' }), + Person2.create({ name: 'Charles' }), + Person2.create({ name: 'Majd' }) +]; +people.invoke('sayHello'); + +var arr = [Em.Object.create(), Em.Object.create()]; +arr.setEach('name', 'unknown'); +arr.getEach('name'); + +var Person3 = Em.Object.extend({ + name: null, + isHappy: false +}); +var people2 = [ + Person3.create({ name: 'Yehuda', isHappy: true }), + Person3.create({ name: 'Majd', isHappy: false }) +]; +people2.every((person: Em.Object) => { + return !!person.get('isHappy'); +}); +people2.some((person: Em.Object) => { + return !!person.get('isHappy'); +}); +people2.everyProperty('isHappy', true); +people2.someProperty('isHappy', true); + +// Examples taken from http://emberjs.com/api/classes/Ember.RSVP.Promise.html +var promise = new Ember.RSVP.Promise(function(resolve: Function, reject: Function) { + // on success + resolve('ok!'); + + // on failure + reject('no-k!'); +}); + +promise.then(function(value: any) { + // on fulfillment +}, function(reason: any) { + // on rejection +}); diff --git a/ember/ember-1.11.3.d.ts b/ember/ember-1.11.3.d.ts new file mode 100644 index 0000000000..c24661d763 --- /dev/null +++ b/ember/ember-1.11.3.d.ts @@ -0,0 +1,3492 @@ +// Type definitions for Ember.js 1.11.3 +// Project: http://emberjs.com/ +// Definitions by: Jed Mao +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// + +declare var Handlebars: HandlebarsStatic; + +declare namespace EmberStates { + + interface Transition { + targetName: string; + urlMethod: string; + intent: any; + params: {}|any; + pivotHandler: any; + resolveIndex: number; + handlerInfos: any; + resolvedModels: {}|any; + isActive: boolean; + state: any; + queryParams: {}|any; + queryParamsOnly: boolean; + + isTransition: boolean; + + /** + The Transition's internal promise. Calling `.then` on this property + is that same as calling `.then` on the Transition object itself, but + this property is exposed for when you want to pass around a + Transition's promise, but not the Transition object itself, since + Transition object can be externally `abort`ed, while the promise + cannot. + */ + promise: Ember.RSVP.Promise; + + /** + Custom state can be stored on a Transition's `data` object. + This can be useful for decorating a Transition within an earlier + hook and shared with a later hook. Properties set on `data` will + be copied to new transitions generated by calling `retry` on this + transition. + */ + data: any; + + /** + A standard promise hook that resolves if the transition + succeeds and rejects if it fails/redirects/aborts. + + Forwards to the internal `promise` property which you can + use in situations where you want to pass around a thennable, + but not the Transition itself. + + @arg {Function} onFulfilled + @arg {Function} onRejected + @arg {String} label optional string for labeling the promise. Useful for tooling. + @return {Promise} + */ + then(onFulfilled: Function, onRejected?: Function, label?: string): Ember.RSVP.Promise; + + /** + Forwards to the internal `promise` property which you can + use in situations where you want to pass around a thennable, + but not the Transition itself. + + @method catch + @arg {Function} onRejection + @arg {String} label optional string for labeling the promise. + Useful for tooling. + @return {Promise} + */ + catch(onRejection: Function, label?: string): Ember.RSVP.Promise; + + /** + Forwards to the internal `promise` property which you can + use in situations where you want to pass around a thennable, + but not the Transition itself. + + @method finally + @arg {Function} callback + @arg {String} label optional string for labeling the promise. + Useful for tooling. + @return {Promise} + */ + finally(callback: Function, label?: string): Ember.RSVP.Promise; + + /** + Aborts the Transition. Note you can also implicitly abort a transition + by initiating another transition while a previous one is underway. + */ + abort(): EmberStates.Transition; + normalize(manager: Ember.StateManager, contexts: any[]): void; + + /** + Retries a previously-aborted transition (making sure to abort the + transition if it's still active). Returns a new transition that + represents the new attempt to transition. + */ + retry(): EmberStates.Transition; + + /** + Sets the URL-changing method to be employed at the end of a + successful transition. By default, a new Transition will just + use `updateURL`, but passing 'replace' to this method will + cause the URL to update using 'replaceWith' instead. Omitting + a parameter will disable the URL change, allowing for transitions + that don't update the URL at completion (this is also used for + handleURL, since the URL has already changed before the + transition took place). + + @arg {String} method the type of URL-changing method to use + at the end of a transition. Accepted values are 'replace', + falsy values, or any other non-falsy value (which is + interpreted as an updateURL transition). + + @return {Transition} this transition + */ + method(method: string): EmberStates.Transition; + + /** + Fires an event on the current list of resolved/resolving + handlers within this transition. Useful for firing events + on route hierarchies that haven't fully been entered yet. + + Note: This method is also aliased as `send` + + @arg {Boolean} [ignoreFailure=false] a boolean specifying whether unhandled events throw an error + @arg {String} name the name of the event to fire + */ + trigger(ignoreFailure:boolean, eventName: string): void; + /** + Fires an event on the current list of resolved/resolving + handlers within this transition. Useful for firing events + on route hierarchies that haven't fully been entered yet. + + Note: This method is also aliased as `send` + + @arg {String} name the name of the event to fire + */ + trigger(eventName: string): void; + + /** + Transitions are aborted and their promises rejected + when redirects occur; this method returns a promise + that will follow any redirects that occur and fulfill + with the value fulfilled by any redirecting transitions + that occur. + + @return {Promise} a promise that fulfills with the same + value that the final redirecting transition fulfills with + */ + followRedirects(): Ember.RSVP.Promise; + } + +} + +declare namespace EmberTesting { + + namespace Test { + + class Adapter { + asyncEnd(): void; + asyncStart(): void; + exception(error: string): void; + } + + class QUnitAdapter extends Adapter { } + + } + +} + +interface Function { + observes(...args: string[]): Function; + observesBefore(...args: string[]): Function; + on(...args: string[]): Function; + property(...args: string[]): Function; +} + +interface String { + camelize(): string; + capitalize(): string; + classify(): string; + dasherize(): string; + decamelize(): string; + fmt(...args: string[]): string; + htmlSafe(): typeof Handlebars.SafeString; + loc(...args: string[]): string; + underscore(): string; + w(): string[]; +} + +interface Array { + constructor(arr: any[]): void; + activate(): void; + addArrayObserver(target: any, opts?: EnumerableConfigurationOptions): any[]; + addEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): any[]; + any(callback: Function, target?: any): boolean; + anyBy(key: string, value?: string): boolean; + arrayContentDidChange(startIdx: number, removeAmt: number, addAmt: number): any[]; + arrayContentWillChange(startIdx: number, removeAmt: number, addAmt: number): any[]; + someProperty(key: string, value?: any): boolean; + clear(): any[]; + compact(): any[]; + contains(obj: any): boolean; + enumerableContentDidChange(start: number, removing: number, adding: number): any; + enumerableContentDidChange(start: number, removing: Ember.Enumerable, adding: number): any; + enumerableContentDidChange(start: number, removing: number, adding: Ember.Enumerable): any; + enumerableContentDidChange(start: number, removing: Ember.Enumerable, adding: Ember.Enumerable): any; + enumerableContentDidChange(removing: number, adding: number): any; + enumerableContentDidChange(removing: Ember.Enumerable, adding: number): any; + enumerableContentDidChange(removing: number, adding: Ember.Enumerable): any; + enumerableContentDidChange(removing: Ember.Enumerable, adding: Ember.Enumerable): any; + enumerableContentWillChange(removing: number, adding: number): any[]; + enumerableContentWillChange(removing: Ember.Enumerable, adding: number): any[]; + enumerableContentWillChange(removing: number, adding: Ember.Enumerable): any[]; + enumerableContentWillChange(removing: Ember.Enumerable, adding: Ember.Enumerable): any[]; + every(callback: Function, target?: any): boolean; + everyBy(key: string, value?: string): boolean; + everyProperty(key: string, value?: any): boolean; + filter(callback: Function, target?: any): any[]; + filterBy(key: string, value?: string): any[]; + + /** + Returns the first item in the array for which the callback returns true. + This method works similar to the `filter()` method defined in JavaScript 1.6 + except that it will stop working on the array once a match is found. + The callback method you provide should have the following signature (all + parameters are optional): + ```javascript + function(item, index, enumerable); + ``` + - `item` is the current item in the iteration. + - `index` is the current index in the iteration. + - `enumerable` is the enumerable object itself. + It should return the `true` to include the item in the results, `false` + otherwise. + Note that in addition to a callback, you can also pass an optional target + object that will be set as `this` on the context. This is a good way + to give your iterator function access to the current object. + @function find + @arg callback The callback to execute + @arg {Object} [target] The target object to use + @return {Object} Found item or `undefined`. +*/ + find(callback: Function, target?: any): any; + findBy(key: string, value?: string): any; + forEach(callback: Function, target?: any): any; + getEach(key: string): any[]; + indexOf(object: any, startAt?: number): number; + insertAt(idx: number, object: any): any[]; + invoke(methodName: string, ...args: any[]): any[]; + lastIndexOf(object: any, startAt?: number): number; + map(callback: Function, target?: any): any[]; + mapBy(key: string): any[]; + nextObject(index: number, previousObject: any, context: any): any; + objectAt(idx: number): any; + objectsAt(...args: number[]): any[]; + popObject(): any; + pushObject(obj: any): any; + pushObjects(...args: any[]): any[]; + reduce(callback: ReduceCallback, initialValue: any, reducerProperty: string): any; + reject: ItemIndexEnumerableCallbackTarget; + rejectBy(key: string, value?: string): any[]; + removeArrayObserver(target: any, opts: EnumerableConfigurationOptions): any[]; + removeAt(start: number, len: number): any; + removeEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): any[]; + replace(idx: number, amt: number, objects: any[]): void; + reverseObjects(): any[]; + setEach(key: string, value?: any): any; + setObjects(objects: any[]): any[]; + shiftObject(): any; + slice(beginIndex?: number, endIndex?: number): any[]; + some(callback: Function, target?: any): boolean; + toArray(): any[]; + uniq(): any[]; + unshiftObject(object: any): any; + unshiftObjects(objects: any[]): any[]; + without(value: any): any[]; + '[]': any[]; + '@each': Ember.EachProxy; + Boolean: boolean; + firstObject: any; + hasEnumerableObservers: boolean; + lastObject: any; + addObject(object: any): any; + addObjects(objects: Ember.Enumerable): any[]; + removeObject(object: any): any; + removeObjects(objects: Ember.Enumerable): any[]; + addObserver: ModifyObserver; + beginPropertyChanges(): any[]; + cacheFor(keyName: string): any; + decrementProperty(keyName: string, decrement?: number): number; + endPropertyChanges(): any[]; + get(keyName: string): any; + getProperties(...args: string[]): {}; + getProperties(keys: string[]): {}; + getWithDefault(keyName: string, defaultValue: any): any; + hasObserverFor(key: string): boolean; + incrementProperty(keyName: string, increment?: number): number; + notifyPropertyChange(keyName: string): any[]; + propertyDidChange(keyName: string): any[]; + propertyWillChange(keyName: string): any[]; + removeObserver(key: string, target: any, method: string): Ember.Observable; + removeObserver(key: string, target: any, method: Function): Ember.Observable; + set(keyName: string, value: any): any[]; + setProperties(hash: {}): any[]; + toggleProperty(keyName: string): any; + copy(deep: boolean): any[]; + frozenCopy(): any[]; + // 1.3 + isAny(key: string, value?: string): boolean; + isEvery(key: string, value?: string): boolean; +} + +interface ApplicationCreateArguments { + customEvents?: {}; + rootElement?: string; + /** + Basic logging of successful transitions. + **/ + LOG_TRANSITIONS?: boolean; + /** + Detailed logging of all routing steps. + **/ + LOG_TRANSITIONS_INTERNAL?: boolean; +} + +interface ApplicationInitializerArguments { + name?: string; + initialize?: ApplicationInitializerFunction; +} + +interface ApplicationInitializerFunction { + (container: Ember.Container, application: Ember.Application): void; +} + +interface CoreObjectArguments { + /** + An overridable method called when objects are instantiated. By default, does nothing unless it is + overridden during class definition. NOTE: If you do override init for a framework class like Ember.View + or Ember.ArrayController, be sure to call this._super() in your init declaration! If you don't, Ember + may not have an opportunity to do important setup work, and you'll see strange behavior in your application. + **/ + init?: Function; + /** + Override to implement teardown. + **/ + willDestroy?: Function; + + [propName: string]: any; +} + +interface EnumerableConfigurationOptions { + willChange?: boolean ; + didChange?: boolean ; +} + +interface ItemIndexEnumerableCallbackTarget { + (callback: ItemIndexEnumerableCallback, target?: any): any[]; +} + +interface ItemIndexEnumerableCallback { + (item: any, index: number, enumerable: Ember.Enumerable): void; +} + +interface ReduceCallback { + (previousValue: any, item: any, index: number, enumerable: Ember.Enumerable): void; +} + +interface TransitionsHash { + contexts: any[]; + exitStates: Ember.State[]; + enterStates: Ember.State[]; + resolveState: Ember.State; +} + +interface ActionsHash { + willTransition?: Function; + error?: Function; +} + +interface DisconnectOutletOptions { + outlet?: string; + parentView?: string; +} + +interface RenderOptions { + into?: string; + controller?: string; + model?: any; + outlet?: string; + view?: string; +} + +interface ModifyObserver { + (obj: any, path: string, target: any, method?: Function): void; + (obj: any, path: string, target: any, method?: string): void; + (obj: any, path: string, func: Function, method?: Function): void; + (obj: any, path: string, func: Function, method?: string): void; +} + +declare namespace Ember { + /** + Alias for jQuery. + **/ + // ReSharper disable once DuplicatingLocalDeclaration + var $: JQueryStatic; + /** + Creates an Ember.NativeArray from an Array like object. Does not modify the original object. + Ember.A is not needed if Ember.EXTEND_PROTOTYPES is true (the default value). However, it is + recommended that you use Ember.A when creating addons for ember or when you can not garentee + that Ember.EXTEND_PROTOTYPES will be true. + **/ + function A(arr?: any[]): NativeArray; + /** + The Ember.ActionHandler mixin implements support for moving an actions property to an _actions + property at extend time, and adding _actions to the object's mergedProperties list. + **/ + class ActionHandlerMixin { + /** + Triggers a named action on the ActionHandler + **/ + send(name: string, ...args: any[]): void; + /** + The collection of functions, keyed by name, available on this ActionHandler as action targets. + **/ + actions: ActionsHash; + } + /** + An instance of Ember.Application is the starting point for every Ember application. It helps to + instantiate, initialize and coordinate the many objects that make up your app. + **/ + class Application extends Namespace { + static detect(obj: any): boolean; + static detectInstance(obj: any): boolean; + /** + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ + static eachComputedProperty(callback: Function, binding: {}): void; + /** + Returns the original hash that was passed to meta(). + @param key property name + **/ + static metaForProperty(key: string): {}; + static isClass: boolean; + static isMethod: boolean; + static initializer(args?: ApplicationInitializerArguments): void; + /** + Call advanceReadiness after any asynchronous setup logic has completed. + Each call to deferReadiness must be matched by a call to advanceReadiness + or the application will never become ready and routing will not begin. + **/ + advanceReadiness(): void; + /** + Use this to defer readiness until some condition is true. + + This allows you to perform asynchronous setup logic and defer + booting your application until the setup has finished. + + However, if the setup requires a loading UI, it might be better + to use the router for this purpose. + */ + deferReadiness(): void; + /** + defines an injection or typeInjection + **/ + inject(factoryNameOrType: string, property: string, injectionName: string): void; + /** + This injects the test helpers into the window's scope. If a function of the + same name has already been defined it will be cached (so that it can be reset + if the helper is removed with `unregisterHelper` or `removeTestHelpers`). + Any callbacks registered with `onInjectHelpers` will be called once the + helpers have been injected. + **/ + injectTestHelpers(): void; + /** + registers a factory for later injection + @param fullName type:name (e.g., 'model:user') + @param factory (e.g., App.Person) + **/ + register(fullName: string, factory: Function, options?: {}): void; + /** + This removes all helpers that have been registered, and resets and functions + that were overridden by the helpers. + **/ + removeTestHelpers(): void; + /** + Reset the application. This is typically used only in tests. + **/ + reset(): void; + /** + This hook defers the readiness of the application, so that you can start + the app when your tests are ready to run. It also sets the router's + location to 'none', so that the window's location will not be modified + (preventing both accidental leaking of state between tests and interference + with your testing framework). + **/ + setupForTesting(): void; + /** + The DOM events for which the event dispatcher should listen. + */ + customEvents: {}; + /** + The Ember.EventDispatcher responsible for delegating events to this application's views. + **/ + eventDispatcher: EventDispatcher; + /** + Set this to provide an alternate class to Ember.DefaultResolver + **/ + resolver: DefaultResolver; + /** + The root DOM element of the Application. This can be specified as an + element or a jQuery-compatible selector string. + + This is the element that will be passed to the Application's, eventDispatcher, + which sets up the listeners for event delegation. Every view in your application + should be a child of the element you specify here. + **/ + rootElement: HTMLElement; + /** + Called when the Application has become ready. + The call will be delayed until the DOM has become ready. + **/ + ready: Function; + /** + Application's router. + **/ + Router: Router; + } + /** + This module implements Observer-friendly Array-like behavior. This mixin is picked up by the + Array class as well as other controllers, etc. that want to appear to be arrays. + **/ + class Array implements Enumerable { + addArrayObserver(target: any, opts?: EnumerableConfigurationOptions): any[]; + addEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): Enumerable; + any(callback: Function, target?: any): boolean; + anyBy(key: string, value?: string): boolean; + arrayContentDidChange(startIdx: number, removeAmt: number, addAmt: number): any[]; + arrayContentWillChange(startIdx: number, removeAmt: number, addAmt: number): any[]; + someProperty(key: string, value?: string): boolean; + compact(): any[]; + contains(obj: any): boolean; + enumerableContentDidChange(start: number, removing: number, adding: number): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: number): any; + enumerableContentDidChange(start: number, removing: number, adding: Enumerable): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable): any; + enumerableContentDidChange(removing: number, adding: number): any; + enumerableContentDidChange(removing: Enumerable, adding: number): any; + enumerableContentDidChange(removing: number, adding: Enumerable): any; + enumerableContentDidChange(removing: Enumerable, adding: Enumerable): any; + enumerableContentWillChange(removing: number, adding: number): Enumerable; + enumerableContentWillChange(removing: Enumerable, adding: number): Enumerable; + enumerableContentWillChange(removing: number, adding: Enumerable): Enumerable; + enumerableContentWillChange(removing: Enumerable, adding: Enumerable): Enumerable; + every(callback: Function, target?: any): boolean; + everyBy(key: string, value?: string): boolean; + everyProperty(key: string, value?: string): boolean; + filter(callback: Function, target: any): any[]; + filterBy(key: string, value?: string): any[]; + find(callback: Function, target?: any): any; + findBy(key: string, value?: string): any; + forEach(callback: Function, target?: any): any; + getEach(key: string): any[]; + indexOf(object: any, startAt: number): number; + invoke(methodName: string, ...args: any[]): any[]; + lastIndexOf(object: any, startAt: number): number; + map: ItemIndexEnumerableCallbackTarget; + mapBy(key: string): any[]; + nextObject(index: number, previousObject: any, context: any): any; + objectAt(idx: number): any; + objectsAt(...args: number[]): any[]; + reduce(callback: ReduceCallback, initialValue: any, reducerProperty: string): any; + reject: ItemIndexEnumerableCallbackTarget; + rejectBy(key: string, value?: string): any[]; + removeArrayObserver(target: any, opts: EnumerableConfigurationOptions): any[]; + removeEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): Enumerable; + setEach(key: string, value?: any): any; + slice(beginIndex?: number, endIndex?: number): any[]; + some(callback: Function, target?: any): boolean; + toArray(): any[]; + uniq(): Enumerable; + without(value: any): Enumerable; + '@each': EachProxy; + Boolean: boolean; + '[]': any[]; + firstObject: any; + hasEnumerableObservers: boolean; + lastObject: any; + length: number; + } + /** + Provides a way for you to publish a collection of objects so that you can easily bind to the + collection from a Handlebars #each helper, an Ember.CollectionView, or other controllers. + **/ + class ArrayController extends ArrayProxy implements SortableMixin, ControllerMixin { + static detect(obj: any): boolean; + static detectInstance(obj: any): boolean; + /** + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ + static eachComputedProperty(callback: Function, binding: {}): void; + /** + Returns the original hash that was passed to meta(). + @param key property name + **/ + static metaForProperty(key: string): {}; + static isClass: boolean; + static isMethod: boolean; + lookupItemController(object: any): string; + arrangedContent: any; + itemController: string; + sortAscending: boolean; + sortFunction: Comparable; + sortProperties: any[]; + replaceRoute(name: string, ...args: any[]): void; + transitionToRoute(name: string, ...args: any[]): void; + controllers: {}; + needs: string[]; + target: any; + model: any; + queryParams: any; + send(name: string, ...args: any[]): void; + actions: {}; + + } + /** + Array polyfills to support ES5 features in older browsers. + **/ + var ArrayPolyfills: { + map: typeof Array.prototype.map; + forEach: typeof Array.prototype.forEach; + indexOf: typeof Array.prototype.indexOf; + }; + /** + An ArrayProxy wraps any other object that implements Ember.Array and/or Ember.MutableArray, + forwarding all requests. This makes it very useful for a number of binding use cases or other cases + where being able to swap out the underlying array is useful. + **/ + class ArrayProxy extends Object implements MutableArray { + static detect(obj: any): boolean; + static detectInstance(obj: any): boolean; + /** + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ + static eachComputedProperty(callback: Function, binding: {}): void; + /** + Returns the original hash that was passed to meta(). + @param key property name + **/ + static metaForProperty(key: string): {}; + static isClass: boolean; + static isMethod: boolean; + addArrayObserver(target: any, opts?: EnumerableConfigurationOptions): any[]; + addEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): Enumerable; + any(callback: Function, target?: any): boolean; + anyBy(key: string, value?: string): boolean; + arrayContentDidChange(startIdx: number, removeAmt: number, addAmt: number): any[]; + arrayContentWillChange(startIdx: number, removeAmt: number, addAmt: number): any[]; + someProperty(key: string, value?: string): boolean; + clear(): any[]; + compact(): any[]; + contains(obj: any): boolean; + enumerableContentDidChange(start: number, removing: number, adding: number): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: number): any; + enumerableContentDidChange(start: number, removing: number, adding: Enumerable): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable): any; + enumerableContentDidChange(removing: number, adding: number): any; + enumerableContentDidChange(removing: Enumerable, adding: number): any; + enumerableContentDidChange(removing: number, adding: Enumerable): any; + enumerableContentDidChange(removing: Enumerable, adding: Enumerable): any; + enumerableContentWillChange(removing: number, adding: number): Enumerable; + enumerableContentWillChange(removing: Enumerable, adding: number): Enumerable; + enumerableContentWillChange(removing: number, adding: Enumerable): Enumerable; + enumerableContentWillChange(removing: Enumerable, adding: Enumerable): Enumerable; + every(callback: Function, target?: any): boolean; + everyBy(key: string, value?: string): boolean; + everyProperty(key: string, value?: string): boolean; + filter(callback: Function, target: any): any[]; + filterBy(key: string, value?: string): any[]; + find(callback: Function, target: any): any; + findBy(key: string, value?: string): any; + forEach(callback: Function, target?: any): any; + getEach(key: string): any[]; + indexOf(object: any, startAt: number): number; + insertAt(idx: number, object: any): any[]; + invoke(methodName: string, ...args: any[]): any[]; + lastIndexOf(object: any, startAt: number): number; + map: ItemIndexEnumerableCallbackTarget; + mapBy(key: string): any[]; + nextObject(index: number, previousObject: any, context: any): any; + objectAt(idx: number): any; + objectAtContent(idx: number): any; + objectsAt(...args: number[]): any[]; + popObject(): any; + pushObject(obj: any): any; + pushObjects(...args: any[]): any[]; + reduce(callback: ReduceCallback, initialValue: any, reducerProperty: string): any; + reject: ItemIndexEnumerableCallbackTarget; + rejectBy(key: string, value?: string): any[]; + removeArrayObserver(target: any, opts: EnumerableConfigurationOptions): any[]; + removeAt(start: number, len: number): any; + removeEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): Enumerable; + replace(idx: number, amt: number, objects: any[]): any; + replaceContent(idx: number, amt: number, objects: any[]): void; + reverseObjects(): any[]; + setEach(key: string, value?: any): any; + setObjects(objects: any[]): any[]; + shiftObject(): any; + slice(beginIndex?: number, endIndex?: number): any[]; + some(callback: Function, target?: any): boolean; + toArray(): any[]; + uniq(): Enumerable; + unshiftObject(object: any): any; + unshiftObjects(objects: any[]): any[]; + without(value: any): Enumerable; + '[]': any[]; + '@each': EachProxy; + Boolean: boolean; + firstObject: any; + hasEnumerableObservers: boolean; + lastObject: any; + length: number; + addObject(object: any): any; + addObjects(objects: Enumerable): MutableEnumberable; + removeObject(object: any): any; + removeObjects(objects: Enumerable): MutableEnumberable; + } + var BOOTED: boolean; + /** + Connects the properties of two objects so that whenever the value of one property changes, + the other property will be changed also. + **/ + class Binding { + constructor(toPath: string, fromPath: string); + connect(obj: any): Binding; + copy(): Binding; + disconnect(obj: any): Binding; + from(path: string): Binding; + static oneWay(from: string, flag?: boolean): Binding; + to(path: string): Binding; + to(pathTuple: any[]): Binding; + toString(): string; + } + class Button extends View implements TargetActionSupport { + static detect(obj: any): boolean; + static detectInstance(obj: any): boolean; + /** + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ + static eachComputedProperty(callback: Function, binding: {}): void; + /** + Returns the original hash that was passed to meta(). + @param key property name + **/ + static metaForProperty(key: string): {}; + static isClass: boolean; + static isMethod: boolean; + triggerAction(opts: {}): boolean; + } + /** + The internal class used to create text inputs when the {{input}} helper is used + with type of checkbox. See Handlebars.helpers.input for usage details. + **/ + class Checkbox extends View { + static detect(obj: any): boolean; + static detectInstance(obj: any): boolean; + /** + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ + static eachComputedProperty(callback: Function, binding: {}): void; + /** + Returns the original hash that was passed to meta(). + @param key property name + **/ + static metaForProperty(key: string): {}; + static isClass: boolean; + static isMethod: boolean; + } + /** + An Ember.View descendent responsible for managing a collection (an array or array-like object) + by maintaining a child view object and associated DOM representation for each item in the array + and ensuring that child views and their associated rendered HTML are updated when items in the + array are added, removed, or replaced. + **/ + class CollectionView extends ContainerView { + arrayDidChange(content: any[], start: number, removed: number, added: number): void; + arrayWillChange(content: any[], start: number, removed: number): void; + createChildView(viewClass: {}, attrs?: {}): CollectionView; + destroy(): CollectionView; + init(): void; + static CONTAINER_MAP: {}; + content: any[]; + emptyView: View; + itemViewClass: View; + } + /** + Implements some standard methods for comparing objects. Add this mixin to any class + you create that can compare its instances. + **/ + class Comparable { + compare(a: any, b: any): number; + } + /** + A view that is completely isolated. Property access in its templates go to the view object + and actions are targeted at the view object. There is no access to the surrounding context or + outer controller; all contextual information is passed in. + **/ + class Component extends View { + static detect(obj: any): boolean; + static detectInstance(obj: any): boolean; + /** + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ + static eachComputedProperty(callback: Function, binding: {}): void; + /** + Returns the original hash that was passed to meta(). + @param key property name + **/ + static metaForProperty(key: string): {}; + static isClass: boolean; + static isMethod: boolean; + sendAction(action: string, context: any): void; + targetObject: Controller; + } + /** + A computed property transforms an objects function into a property. + By default the function backing the computed property will only be called once and the result + will be cached. You can specify various properties that your computed property is dependent on. + This will force the cached result to be recomputed if the dependencies are modified. + **/ + class ComputedProperty { + cacheable(aFlag?: boolean): ComputedProperty; + get(keyName: string): any; + meta(meta: {}): ComputedProperty; + property(...args: string[]): ComputedProperty; + readOnly(): ComputedProperty; + set(keyName: string, newValue: any, oldValue: string): any; + // ReSharper disable UsingOfReservedWord + volatile(): ComputedProperty; + // ReSharper restore UsingOfReservedWord + } + class Container { + constructor(parent: Container); + parent: Container; + children: any[]; + resolver: Function; + registry: {}; + cache: {}; + typeInjections: {}; + injections: {}; + child(): Container; + set(object: {}, key: string, value: any): void; + /** + registers a factory for later injection + @param fullName type:name (e.g., 'model:user') + @param factory (e.g., App.Person) + **/ + register(fullName: string, factory: Function, options?: {}): void; + unregister(fullName: string): void; + resolve(fullName: string): Function; + describe(fullName: string): string; + normalize(fullName: string): string; + makeToString(factory: any, fullName: string): Function; + lookup(fullName: string, options?: {}): any; + lookupFactory(fullName: string): any; + has(fullName: string): boolean; + optionsForType(type: string, options: {}): void; + options(type: string, options: {}): void; + injection(factoryName: string, property: string, injectionName: string): void; + factoryInjection(factoryName: string, property: string, injectionName: string): void; + destroy(): void; + reset(): void; + } + /** + An Ember.View subclass that implements Ember.MutableArray allowing programatic + management of its child views. + **/ + class ContainerView extends View { + static detect(obj: any): boolean; + static detectInstance(obj: any): boolean; + /** + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ + static eachComputedProperty(callback: Function, binding: {}): void; + /** + Returns the original hash that was passed to meta(). + @param key property name + **/ + static metaForProperty(key: string): {}; + static isClass: boolean; + static isMethod: boolean; + } + class Controller extends Object implements ControllerMixin { + replaceRoute(name: string, ...args: any[]): void; + transitionToRoute(name: string, ...args: any[]): void; + controllers: {}; + model: any; + needs: string[]; + queryParams: any; + target: any; + send(name: string, ...args: any[]): void; + actions: ActionsHash; + } + /** + Additional methods for the ControllerMixin. + **/ + class ControllerMixin extends ActionHandlerMixin { + replaceRoute(name: string, ...args: any[]): void; + transitionToRoute(name: string, ...args: any[]): void; + controllers: {}; + model : any; + needs: string[]; + queryParams: any; + target: any; + } + /** + Implements some standard methods for copying an object. Add this mixin to any object you + create that can create a copy of itself. This mixin is added automatically to the built-in array. + You should generally implement the copy() method to return a copy of the receiver. + Note that frozenCopy() will only work if you also implement Ember.Freezable. + **/ + class Copyable { + copy(deep: boolean): Copyable; + frozenCopy(): Copyable; + } + class CoreObject { + /** + An overridable method called when objects are instantiated. By default, + does nothing unless it is overridden during class definition. + @method init + **/ + init(): void; + + /** + Defines the properties that will be concatenated from the superclass (instead of overridden). + @property concatenatedProperties + @type Array + @default null + **/ + concatenatedProperties: any[]; + + /** + Destroyed object property flag. If this property is true the observers and bindings were + already removed by the effect of calling the destroy() method. + @property isDestroyed + @default false + **/ + isDestroyed: boolean; + /** + Destruction scheduled flag. The destroy() method has been called. The object stays intact + until the end of the run loop at which point the isDestroyed flag is set. + @property isDestroying + @default false + **/ + isDestroying: boolean; + + /** + Destroys an object by setting the `isDestroyed` flag and removing its + metadata, which effectively destroys observers and bindings. + If you try to set a property on a destroyed object, an exception will be + raised. + Note that destruction is scheduled for the end of the run loop and does not + happen immediately. It will set an isDestroying flag immediately. + @method destroy + @return {Ember.Object} receiver + */ + destroy(): CoreObject; + + /** + Override to implement teardown. + @method willDestroy + */ + willDestroy(): void; + + /** + Returns a string representation which attempts to provide more information than Javascript's toString + typically does, in a generic way for all Ember objects (e.g., ""). + @method toString + @return {String} string representation + **/ + toString(): string; + + static isClass: boolean; + static isMethod: boolean; + + /** + Creates a new subclass. + @method extend + @static + @param {Object} [args] - Object containing values to use within the new class + **/ + static extend(args?: CoreObjectArguments): T; + /** + Creates a new subclass. + @method extend + @static + @param {Mixin} [mixins] - One or more Mixin classes + @param {Object} [args] - Object containing values to use within the new class + **/ + static extend(mixins?: Mixin, args?: CoreObjectArguments): T; + + /** + Creates a new subclass. + @method extend + @param {Object} [args] - Object containing values to use within the new class + Non-static method because Ember classes aren't currently 'real' TypeScript classes. + **/ + extend(args ?: CoreObjectArguments): T; + /** + Creates a new subclass. + @method extend + @param {Mixin} [mixins] - One or more Mixin classes + @param {Object} [args] - Object containing values to use within the new class + Non-static method because Ember classes aren't currently 'real' TypeScript classes. + **/ + extend(mixins ? : Mixin, args ?: CoreObjectArguments): T; + + /** + Equivalent to doing extend(arguments).create(). If possible use the normal create method instead. + @method createWithMixins + @static + @param [args] + **/ + static createWithMixins(args?: {}): T; + + /** + Creates an instance of the class. + @method create + @static + @param [args] - A hash containing values with which to initialize the newly instantiated object. + **/ + static create(args?: {}): T; + + /** + Augments a constructor's prototype with additional properties and functions. + To add functions and properties to the constructor itself, see reopenClass. + @method reopen + **/ + static reopen(args?: {}): T; + + /** + Augments a constructor's own properties and functions. + To add functions and properties to instances of a constructor by extending the + constructor's prototype see reopen. + @method reopenClass + **/ + static reopenClass(args?: {}): T; + + static detect(obj: any): boolean; + static detectInstance(obj: any): boolean; + + /** + Returns the original hash that was passed to meta(). + @method metaForProperty + @static + @param key {String} property name + **/ + static metaForProperty(key: string): {}; + + /** + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + + @method eachComputedProperty + @static + @param {Function} callback + @param {Object} binding + **/ + static eachComputedProperty(callback: Function, binding: {}): void; + } + /** + An abstract class that exists to give view-like behavior to both Ember's main view class Ember.View + and other classes like Ember._SimpleMetamorphView that don't need the fully functionaltiy of Ember.View. + Unless you have specific needs for CoreView, you will use Ember.View in your applications. + **/ + class CoreView extends Object implements ActionHandlerMixin { + static detect(obj: any): boolean; + static detectInstance(obj: any): boolean; + /** + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ + static eachComputedProperty(callback: Function, binding: {}): void; + /** + Returns the original hash that was passed to meta(). + @param key property name + **/ + static metaForProperty(key: string): {}; + static isClass: boolean; + static isMethod: boolean; + send(name: string, ...args: any[]): void; + actions: ActionsHash; + parentView: CoreView; + } + class DAG { + add(name: string): any; + map(name: string, value: any): void; + addEdge(fromName: string, toName: string): void; + topsort(fn: Function): void; + addEdges(name: string, value: any, before: any, after: any): void; + names: any[]; + vertices: {}; + } + function DEFAULT_GETTER_FUNCTION(name: string): Function; + /** + The DefaultResolver defines the default lookup rules to resolve container lookups before consulting + the container for registered items: + templates are looked up on Ember.TEMPLATES + other names are looked up on the application after converting the name. + For example, controller:post looks up App.PostController by default. + **/ + class DefaultResolver { + resolve(fullName: string): {}; + namespace: Application; + } + class Deferred { + reject(value: any): void; + resolve(value: any): void; + then(resolve: Function, reject: Function): void; + } + class DeferredMixin extends Mixin { + reject(value: any): void; + resolve(value: any): void; + then(resolve: Function, reject: Function): void; + } + /** + Objects of this type can implement an interface to respond to requests to get and set. + The default implementation handles simple properties. + You generally won't need to create or subclass this directly. + **/ + class Descriptor { } + var EMPTY_META: {}; // TODO: define interface + var ENV: {}; + var EXTEND_PROTOTYPES: boolean; + /** + This is the object instance returned when you get the @each property on an array. It uses + the unknownProperty handler to automatically create EachArray instances for property names. + **/ + class EachProxy extends Object { + static detect(obj: any): boolean; + static detectInstance(obj: any): boolean; + /** + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ + static eachComputedProperty(callback: Function, binding: {}): void; + /** + Returns the original hash that was passed to meta(). + @param key property name + **/ + static metaForProperty(key: string): {}; + static isClass: boolean; + static isMethod: boolean; + unknownProperty(keyName: string, value: any): any[]; + } + /** + This mixin defines the common interface implemented by enumerable objects in Ember. Most of these + methods follow the standard Array iteration API defined up to JavaScript 1.8 (excluding language-specific + features that cannot be emulated in older versions of JavaScript). + This mixin is applied automatically to the Array class on page load, so you can use any of these methods + on simple arrays. If Array already implements one of these methods, the mixin will not override them. + **/ + class Enumerable { + addEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): Enumerable; + any(callback: Function, target?: any): boolean; + anyBy(key: string, value?: string): boolean; + someProperty(key: string, value?: string): boolean; + compact(): any[]; + contains(obj: any): boolean; + enumerableContentDidChange(start: number, removing: number, adding: number): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: number): any; + enumerableContentDidChange(start: number, removing: number, adding: Enumerable): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable): any; + enumerableContentDidChange(removing: number, adding: number): any; + enumerableContentDidChange(removing: Enumerable, adding: number): any; + enumerableContentDidChange(removing: number, adding: Enumerable): any; + enumerableContentDidChange(removing: Enumerable, adding: Enumerable): any; + enumerableContentWillChange(removing: number, adding: number): Enumerable; + enumerableContentWillChange(removing: Enumerable, adding: number): Enumerable; + enumerableContentWillChange(removing: number, adding: Enumerable): Enumerable; + enumerableContentWillChange(removing: Enumerable, adding: Enumerable): Enumerable; + every(callback: Function, target?: any): boolean; + everyBy(key: string, value?: string): boolean; + everyProperty(key: string, value?: string): boolean; + filter(callback: Function, target: any): any[]; + filterBy(key: string, value?: string): any[]; + find(callback: Function, target: any): any; + findBy(key: string, value?: string): any; + forEach(callback: Function, target?: any): any; + getEach(key: string): any[]; + invoke(methodName: string, ...args: any[]): any[]; + map: ItemIndexEnumerableCallbackTarget; + mapBy(key: string): any[]; + nextObject(index: number, previousObject: any, context: any): any; + reduce(callback: ReduceCallback, initialValue: any, reducerProperty: string): any; + reject: ItemIndexEnumerableCallbackTarget; + rejectBy(key: string, value?: string): any[]; + removeEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): Enumerable; + setEach(key: string, value?: any): any; + some(callback: Function, target?: any): boolean; + toArray(): any[]; + uniq(): Enumerable; + without(value: any): Enumerable; + '[]': any[]; + firstObject: any; + hasEnumerableObservers: boolean; + lastObject: any; + } + var EnumerableUtils: {}; // TODO: define interface + /** + A subclass of the JavaScript Error object for use in Ember. + **/ + // Restore this to 'typeof Error' when https://github.com/Microsoft/TypeScript/issues/983 is resolved + // ReSharper disable once DuplicatingLocalDeclaration + var Error: any; // typeof Error; + /** + Handles delegating browser events to their corresponding Ember.Views. For example, when you click on + a view, Ember.EventDispatcher ensures that that view's mouseDown method gets called. + **/ + class EventDispatcher extends Object { + static detect(obj: any): boolean; + static detectInstance(obj: any): boolean; + /** + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ + static eachComputedProperty(callback: Function, binding: {}): void; + /** + Returns the original hash that was passed to meta(). + @param key property name + **/ + static metaForProperty(key: string): {}; + static isClass: boolean; + static isMethod: boolean; + events: {}; + } + /** + This mixin allows for Ember objects to subscribe to and emit events. + You can also chain multiple event subscriptions. + **/ + class Evented { + has(name: string): boolean; + off(name: string, target: any, method: Function): Evented; + on(name: string, target: any, method: Function): Evented; + one(name: string, target: any, method: Function): Evented; + trigger(name: string, ...args: string[]): void; + } + var FROZEN_ERROR: string; + class Freezable { + freeze(): Freezable; + isFrozen: boolean; + } + var GUID_KEY: string; + namespace Handlebars { + function compile(string: string): Function; + function get(root: any, path: string, options?: {}): any; + function helper(name: string, func: Function, dependentKeys?: string): void; + function helper(name: string, view: View, dependentKeys?: string): void; + class helpers { + action(actionName: string, context: any, options?: {}): void; + bindAttr(options?: {}): string; + connectOutlet(outletName: string, view: {}): void; + control(path: string, modelPath: string, options?: {}): string; + debugger(property: string): void; + disconnectOutlet(outletName: string): void; + each(name: string, path: string, options?: {}): void; + if(context: Function, options?: {}): string; + init(): void; + input(options?: {}): void; + linkTo(routeName: string, context: any, options?: {}): string; + loc(str: string): void; + log(property: string): void; + outlet(property: string): string; + partial(partialName: string): void; + render(name: string, context?: string, options?: {}): string; + textarea(options?: {}): void; + unbound(property: string): string; + unless(context: Function, options?: {}): string; + view(path: string, options?: {}): string; + with(context: Function, options?: {}): string; + yield(options?: {}): string; + } + function precompile(string: string): void; + function registerBoundHelper(name: string, func: Function, dependentKeys?: string): void; + class Compiler { } + class JavaScriptCompiler { } + function registerHelper(name: string, fn: Function, inverse?: boolean): void; + function registerPartial(name: string, str: any): void; + function K(): any; + function createFrame(objec: any): any; + function Exception(message: string): void; + class SafeString { + constructor(str: string); + static toString(): string; + } + function parse(string: string): any; + function print(ast: any): void; + var logger: typeof Ember.Logger; + function log(level: string, str: string): void; + function compile(environment: any, options?: any, context?: any, asObject?: any): any; + } + class HashLocation extends Object { + static detect(obj: any): boolean; + static detectInstance(obj: any): boolean; + /** + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ + static eachComputedProperty(callback: Function, binding: {}): void; + /** + Returns the original hash that was passed to meta(). + @param key property name + **/ + static metaForProperty(key: string): {}; + static isClass: boolean; + static isMethod: boolean; + } + class HistoryLocation extends Object { + static detect(obj: any): boolean; + static detectInstance(obj: any): boolean; + /** + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ + static eachComputedProperty(callback: Function, binding: {}): void; + /** + Returns the original hash that was passed to meta(). + @param key property name + **/ + static metaForProperty(key: string): {}; + static isClass: boolean; + static isMethod: boolean; + rootURL: string; + } + var IS_BINDING: RegExp; + class Instrumentation { + getProperties(obj: any, list: any[]): {}; + getProperties(obj: any, ...args: string[]): {}; + instrument(name: string, payload: any, callback: Function, binding: any): void; + reset(): void; + subscribe(pattern: string, object: any): void; + unsubscribe(subscriber: any): void; + } + var K: Function; + var LOG_BINDINGS: boolean; + var LOG_STACKTRACE_ON_DEPRECATION: boolean; + var LOG_VERSION: boolean; + class LinkView extends View { + static detect(obj: any): boolean; + static detectInstance(obj: any): boolean; + /** + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ + static eachComputedProperty(callback: Function, binding: {}): void; + /** + Returns the original hash that was passed to meta(). + @param key property name + **/ + static metaForProperty(key: string): {}; + static isClass: boolean; + static isMethod: boolean; + init(): void; + active: any; + activeClass: string; + attributeBindings: any; + classNameBindings: string[]; + disabled: any; + disabledClass: string; + eventName: string; + href: any; + loading: any; + loadingClass: string; + loadingHref: string; + rel: any; + replace: boolean; + title: any; + click: Function; + } + class Location { + create(options?: {}): any; + registerImplementation(name: string, implementation: any): void; + } + var Logger: { + assert(param: any): void; + debug(...args: any[]): void; + error(...args: any[]): void; + info(...args: any[]): void; + log(...args: any[]): void; + warn(...args: any[]): void; + }; + function MANDATORY_SETTER_FUNCTION(value: string): void; + var META_KEY: string; + class Map { + copy(): Map; + static create(): Map; + forEach(callback: Function, self: any): void; + get(key: any): any; + has(key: any): boolean; + remove(key: any): boolean; + set(key: any, value: any): void; + length: number; + } + class MapWithDefault extends Map { + copy(): MapWithDefault; + static create(): MapWithDefault; + } + class Mixin { + apply(obj: any): any; + /** + Creates an instance of the class. + @param arguments A hash containing values with which to initialize the newly instantiated object. + **/ + static create(...args: CoreObjectArguments[]): T; + detect(obj: any): boolean; + reopen(args?: {}): T; + } + class MutableArray implements Array, MutableEnumberable { + addArrayObserver(target: any, opts?: EnumerableConfigurationOptions): any[]; + addEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): Enumerable; + any(callback: Function, target?: any): boolean; + anyBy(key: string, value?: string): boolean; + arrayContentDidChange(startIdx: number, removeAmt: number, addAmt: number): any[]; + arrayContentWillChange(startIdx: number, removeAmt: number, addAmt: number): any[]; + someProperty(key: string, value?: string): boolean; + clear(): any[]; + compact(): any[]; + contains(obj: any): boolean; + enumerableContentDidChange(start: number, removing: number, adding: number): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: number): any; + enumerableContentDidChange(start: number, removing: number, adding: Enumerable): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable): any; + enumerableContentDidChange(removing: number, adding: number): any; + enumerableContentDidChange(removing: Enumerable, adding: number): any; + enumerableContentDidChange(removing: number, adding: Enumerable): any; + enumerableContentDidChange(removing: Enumerable, adding: Enumerable): any; + enumerableContentWillChange(removing: number, adding: number): Enumerable; + enumerableContentWillChange(removing: Enumerable, adding: number): Enumerable; + enumerableContentWillChange(removing: number, adding: Enumerable): Enumerable; + enumerableContentWillChange(removing: Enumerable, adding: Enumerable): Enumerable; + every(callback: Function, target?: any): boolean; + everyBy(key: string, value?: string): boolean; + everyProperty(key: string, value?: string): boolean; + filter(callback: Function, target: any): any[]; + filterBy(key: string, value?: string): any[]; + find(callback: Function, target: any): any; + findBy(key: string, value?: string): any; + forEach(callback: Function, target?: any): any; + getEach(key: string): any[]; + indexOf(object: any, startAt: number): number; + insertAt(idx: number, object: any): any[]; + invoke(methodName: string, ...args: any[]): any[]; + lastIndexOf(object: any, startAt: number): number; + map: ItemIndexEnumerableCallbackTarget; + mapBy(key: string): any[]; + nextObject(index: number, previousObject: any, context: any): any; + objectAt(idx: number): any; + objectsAt(...args: number[]): any[]; + popObject(): any; + pushObject(obj: any): any; + pushObjects(...args: any[]): any[]; + reduce(callback: ReduceCallback, initialValue: any, reducerProperty: string): any; + reject: ItemIndexEnumerableCallbackTarget; + rejectBy(key: string, value?: string): any[]; + removeArrayObserver(target: any, opts: EnumerableConfigurationOptions): any[]; + removeAt(start: number, len: number): any; + removeEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): Enumerable; + replace(idx: number, amt: number, objects: any[]): any; + reverseObjects(): any[]; + setEach(key: string, value?: any): any; + setObjects(objects: any[]): any[]; + shiftObject(): any; + slice(beginIndex?: number, endIndex?: number): any[]; + some(callback: Function, target?: any): boolean; + toArray(): any[]; + uniq(): Enumerable; + unshiftObject(object: any): any; + unshiftObjects(objects: any[]): any[]; + without(value: any): Enumerable; + '[]': any[]; + '@each': EachProxy; + Boolean: boolean; + firstObject: any; + hasEnumerableObservers: boolean; + lastObject: any; + length: number; + addObject(object: any): any; + addObjects(objects: Enumerable): MutableEnumberable; + removeObject(object: any): any; + removeObjects(objects: Enumerable): MutableEnumberable; + } + class MutableEnumberable implements Enumerable { + addEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): Enumerable; + addObject(object: any): any; + addObjects(objects: Enumerable): MutableEnumberable; + any(callback: Function, target?: any): boolean; + anyBy(key: string, value?: string): boolean; + someProperty(key: string, value?: string): boolean; + compact(): any[]; + contains(obj: any): boolean; + enumerableContentDidChange(start: number, removing: number, adding: number): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: number): any; + enumerableContentDidChange(start: number, removing: number, adding: Enumerable): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable): any; + enumerableContentDidChange(removing: number, adding: number): any; + enumerableContentDidChange(removing: Enumerable, adding: number): any; + enumerableContentDidChange(removing: number, adding: Enumerable): any; + enumerableContentDidChange(removing: Enumerable, adding: Enumerable): any; + enumerableContentWillChange(removing: number, adding: number): Enumerable; + enumerableContentWillChange(removing: Enumerable, adding: number): Enumerable; + enumerableContentWillChange(removing: number, adding: Enumerable): Enumerable; + enumerableContentWillChange(removing: Enumerable, adding: Enumerable): Enumerable; + every(callback: Function, target?: any): boolean; + everyBy(key: string, value?: string): boolean; + everyProperty(key: string, value?: string): boolean; + filter(callback: Function, target: any): any[]; + filterBy(key: string, value?: string): any[]; + find(callback: Function, target: any): any; + findBy(key: string, value?: string): any; + forEach(callback: Function, target?: any): any; + getEach(key: string): any[]; + invoke(methodName: string, ...args: any[]): any[]; + map: ItemIndexEnumerableCallbackTarget; + mapBy(key: string): any[]; + nextObject(index: number, previousObject: any, context: any): any; + reduce(callback: ReduceCallback, initialValue: any, reducerProperty: string): any; + reject: ItemIndexEnumerableCallbackTarget; + rejectBy(key: string, value?: string): any[]; + removeEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): Enumerable; + removeObject(object: any): any; + removeObjects(objects: Enumerable): MutableEnumberable; + setEach(key: string, value?: any): any; + some(callback: Function, target?: any): boolean; + toArray(): any[]; + uniq(): Enumerable; + without(value: any): Enumerable; + '[]': any[]; + firstObject: any; + hasEnumerableObservers: boolean; + lastObject: any; + } + var NAME_KEY: string; + class Namespace extends Object { + static detect(obj: any): boolean; + static detectInstance(obj: any): boolean; + /** + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ + static eachComputedProperty(callback: Function, binding: {}): void; + /** + Returns the original hash that was passed to meta(). + @param key property name + **/ + static metaForProperty(key: string): {}; + static isClass: boolean; + static isMethod: boolean; + } + class NativeArray implements MutableArray, Observable, Copyable { + constructor(arr: any[]); + static activate(): void; + addArrayObserver(target: any, opts?: EnumerableConfigurationOptions): any[]; + addEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): Enumerable; + any(callback: Function, target?: any): boolean; + anyBy(key: string, value?: string): boolean; + arrayContentDidChange(startIdx: number, removeAmt: number, addAmt: number): any[]; + arrayContentWillChange(startIdx: number, removeAmt: number, addAmt: number): any[]; + someProperty(key: string, value?: any): boolean; + clear(): any[]; + compact(): any[]; + contains(obj: any): boolean; + enumerableContentDidChange(start: number, removing: number, adding: number): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: number): any; + enumerableContentDidChange(start: number, removing: number, adding: Enumerable): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable): any; + enumerableContentDidChange(removing: number, adding: number): any; + enumerableContentDidChange(removing: Enumerable, adding: number): any; + enumerableContentDidChange(removing: number, adding: Enumerable): any; + enumerableContentDidChange(removing: Enumerable, adding: Enumerable): any; + enumerableContentWillChange(removing: number, adding: number): Enumerable; + enumerableContentWillChange(removing: Enumerable, adding: number): Enumerable; + enumerableContentWillChange(removing: number, adding: Enumerable): Enumerable; + enumerableContentWillChange(removing: Enumerable, adding: Enumerable): Enumerable; + every(callback: Function, target?: any): boolean; + everyBy(key: string, value?: string): boolean; + everyProperty(key: string, value?: any): boolean; + filter(callback: Function, target: any): any[]; + filterBy(key: string, value?: string): any[]; + find(callback: Function, target: any): any; + findBy(key: string, value?: string): any; + forEach(callback: Function, target?: any): any; + getEach(key: string): any[]; + indexOf(object: any, startAt: number): number; + insertAt(idx: number, object: any): any[]; + invoke(methodName: string, ...args: any[]): any[]; + lastIndexOf(object: any, startAt: number): number; + map: ItemIndexEnumerableCallbackTarget; + mapBy(key: string): any[]; + nextObject(index: number, previousObject: any, context: any): any; + objectAt(idx: number): any; + objectsAt(...args: number[]): any[]; + popObject(): any; + pushObject(obj: any): any; + pushObjects(...args: any[]): any[]; + reduce(callback: ReduceCallback, initialValue: any, reducerProperty: string): any; + reject: ItemIndexEnumerableCallbackTarget; + rejectBy(key: string, value?: string): any[]; + removeArrayObserver(target: any, opts: EnumerableConfigurationOptions): any[]; + removeAt(start: number, len: number): any; + removeEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): Enumerable; + replace(idx: number, amt: number, objects: any[]): any; + reverseObjects(): any[]; + setEach(key: string, value?: any): any; + setObjects(objects: any[]): any[]; + shiftObject(): any; + slice(beginIndex?: number, endIndex?: number): any[]; + some(callback: Function, target?: any): boolean; + toArray(): any[]; + uniq(): Enumerable; + unshiftObject(object: any): any; + unshiftObjects(objects: any[]): any[]; + without(value: any): Enumerable; + '[]': any[]; + '@each': EachProxy; + Boolean: boolean; + firstObject: any; + hasEnumerableObservers: boolean; + lastObject: any; + length: number; + addObject(object: any): any; + addObjects(objects: Enumerable): MutableEnumberable; + removeObject(object: any): any; + removeObjects(objects: Enumerable): MutableEnumberable; + addObserver: ModifyObserver; + beginPropertyChanges(): Observable; + cacheFor(keyName: string): any; + decrementProperty(keyName: string, decrement?: number): number; + endPropertyChanges(): Observable; + get(keyName: string): any; + getProperties(...args: string[]): {}; + getProperties(keys: string[]): {}; + getWithDefault(keyName: string, defaultValue: any): any; + hasObserverFor(key: string): boolean; + incrementProperty(keyName: string, increment?: number): number; + notifyPropertyChange(keyName: string): Observable; + propertyDidChange(keyName: string): Observable; + propertyWillChange(keyName: string): Observable; + removeObserver(key: string, target: any, method: string): void; + removeObserver(key: string, target: any, method: Function): void; + set(keyName: string, value: any): Observable; + setProperties(hash: {}): Observable; + toggleProperty(keyName: string): any; + copy(deep: boolean): Copyable; + frozenCopy(): Copyable; + } + class NoneLocation extends Object { + static detect(obj: any): boolean; + static detectInstance(obj: any): boolean; + /** + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ + static eachComputedProperty(callback: Function, binding: {}): void; + /** + Returns the original hash that was passed to meta(). + @param key property name + **/ + static metaForProperty(key: string): {}; + static isClass: boolean; + static isMethod: boolean; + } + var ORDER_DEFINITION: string[]; + class Object extends CoreObject implements Observable { + addObserver: ModifyObserver; + beginPropertyChanges(): Observable; + cacheFor(keyName: string): any; + decrementProperty(keyName: string, decrement?: number): number; + endPropertyChanges(): Observable; + + /** + * Retrieves the value of a property from the object + * @param keyName + * @returns {} + */ + get(keyName: string): any; + + /** + * Retrieves the value of a property from the object + * @param keyName + * @returns {} + */ + get(keyName: string): T; + + getProperties(...args: string[]): {}; + getProperties(keys: string[]): {}; + getWithDefault(keyName: string, defaultValue: any): any; + hasObserverFor(key: string): boolean; + incrementProperty(keyName: string, increment?: number): number; + notifyPropertyChange(keyName: string): Observable; + propertyDidChange(keyName: string): Observable; + propertyWillChange(keyName: string): Observable; + removeObserver(key: string, target: any, method: string): Observable; + removeObserver(key: string, target: any, method: Function): Observable; + set(keyName: string, value: any): Observable; + setProperties(hash: {}): Observable; + toggleProperty(keyName: string): any; + } + class ObjectController extends ObjectProxy implements ControllerMixin { + replaceRoute(name: string, ...args: any[]): void; + transitionToRoute(name: string, ...args: any[]): void; + controllers: Object; + needs: string[]; + target: any; + model: any; + queryParams: any; + send(name: string, ...args: any[]): void; + actions: {}; + } + class ObjectProxy extends Object { + static detect(obj: any): boolean; + static detectInstance(obj: any): boolean; + /** + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ + static eachComputedProperty(callback: Function, binding: {}): void; + /** + Returns the original hash that was passed to meta(). + @param key property name + **/ + static metaForProperty(key: string): {}; + static isClass: boolean; + static isMethod: boolean; + /** + The object whose properties will be forwarded. + **/ + content: Object; + } + class Observable { + addObserver: ModifyObserver; + beginPropertyChanges(): Observable; + cacheFor(keyName: string): any; + decrementProperty(keyName: string, decrement?: number): number; + endPropertyChanges(): Observable; + get(keyName: string): any; + getProperties(...args: string[]): {}; + getProperties(keys: string[]): {}; + getWithDefault(keyName: string, defaultValue: any): any; + hasObserverFor(key: string): boolean; + incrementProperty(keyName: string, increment?: number): number; + notifyPropertyChange(keyName: string): Observable; + propertyDidChange(keyName: string): Observable; + propertyWillChange(keyName: string): Observable; + removeObserver(key: string, target: {}, method: string): void; + removeObserver(key: string, target: {}, method: Function): void; + set(keyName: string, value: any): Observable; + setProperties(hash: {}): Observable; + /** + Set the value of a boolean property to the opposite of its current value. + */ + toggleProperty(keyName: string): boolean; + } + class OrderedSet { + add(obj: any): void; + clear(): void; + copy(): OrderedSet; + static create(): OrderedSet; + forEach(fn: Function, self: any): void; + has(obj: any): boolean; + isEmpty(): boolean; + remove(obj: any): void; + toArray(): any[]; + } + + // FYI - RSVP source comes from https://github.com/tildeio/rsvp.js/blob/master/lib/rsvp/promise.js + namespace RSVP { + interface PromiseResolve { + (value?: any): void; + } + interface PromiseReject { + (reason?: any): void; + } + interface PromiseResolverFunction { + (resolve: PromiseResolve, reject: PromiseReject): void; + } + + class Promise { + + /** + Promise objects represent the eventual result of an asynchronous operation. The + primary way of interacting with a promise is through its `then` method, which + registers callbacks to receive either a promise's eventual value or the reason + why the promise cannot be fulfilled. + @class RSVP.Promise + @param {function} resolver + @param {String} label optional string for labeling the promise. + Useful for tooling. + @constructor + */ + constructor(resolver: PromiseResolverFunction, label?: string); + + /** + The primary way of interacting with a promise is through its `then` method, + which registers callbacks to receive either a promise's eventual value or the + reason why the promise cannot be fulfilled. + @method then + @param {Function} onFulfilled + @param {Function} onRejected + @param {String} label optional string for labeling the promise. + Useful for tooling. + @return {Promise} + */ + then(onFulfilled?: Function, onRejected?: Function): Promise; + + /** + `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same + as the catch block of a try/catch statement. + + @method catch + @param {Function} onRejection + @param {String} label optional string for labeling the promise. + Useful for tooling. + @return {Promise} + */ + catch(onRejection: Function, label?: string): Promise; + + /** + `finally` will be invoked regardless of the promise's fate just as native + try/catch/finally behaves + + @method finally + @param {Function} callback + @param {String} label optional string for labeling the promise. + Useful for tooling. + @return {Promise} + */ + finally(callback: Function, label?: string): Promise; + } + } + class RenderBuffer { + addClass(className: string): RenderBuffer; + attr(name: string, value: any): any; + element(): HTMLElement; + id(id: string): RenderBuffer; + prop(name: string, value: string): any; + push(string: string): RenderBuffer; + removeAttr(name: string): RenderBuffer; + removeProp(name: string): RenderBuffer; + string(): string; + style(name: string, value: string): RenderBuffer; + classes: any[]; + elementAttributes: {}; + elementId: string; + elementProperties: {}; + elementStyle: {}; + elementTag: string; + parentBuffer: RenderBuffer; + } + + /** + The `Ember.Route` class is used to define individual routes. Refer to + the [routing guide](http://emberjs.com/guides/routing/) for documentation. + */ + class Route extends Object implements ActionHandlerMixin, Evented { + + static isClass: boolean; + static isMethod: boolean; + + /** + This hook is executed when the router enters the route. It is not executed + when the model for the route changes. + @method activate + */ + activate: Function; + + /** + This hook is called after this route's model has resolved. + It follows identical async/promise semantics to `beforeModel` + but is provided the route's resolved model in addition to + the `transition`, and is therefore suited to performing + logic that can only take place after the model has already + resolved. + + Refer to documentation for `beforeModel` for a description + of transition-pausing semantics when a promise is returned + from this hook. + @method afterModel + @param {Object} resolvedModel the value returned from `model`, + or its resolved value if it was a promise + @param {Transition} transition + @return {Promise} if the value returned from this hook is + a promise, the transition will pause until the transition + resolves. Otherwise, non-promise return values are not + utilized in any way. + */ + afterModel(resolvedModel: any, transition: EmberStates.Transition): RSVP.Promise; + + /** + This hook is the first of the route entry validation hooks + called when an attempt is made to transition into a route + or one of its children. It is called before `model` and + `afterModel`, and is appropriate for cases when: + 1) A decision can be made to redirect elsewhere without + needing to resolve the model first. + 2) Any async operations need to occur first before the + model is attempted to be resolved. + This hook is provided the current `transition` attempt + as a parameter, which can be used to `.abort()` the transition, + save it for a later `.retry()`, or retrieve values set + on it from a previous hook. You can also just call + `this.transitionTo` to another route to implicitly + abort the `transition`. + You can return a promise from this hook to pause the + transition until the promise resolves (or rejects). This could + be useful, for instance, for retrieving async code from + the server that is required to enter a route. + + @method beforeModel + @param {Transition} transition + @return {Promise} if the value returned from this hook is + a promise, the transition will pause until the transition + resolves. Otherwise, non-promise return values are not + utilized in any way. + */ + beforeModel(transition: EmberStates.Transition): RSVP.Promise; + + /** + The controller associated with this route. + + @property controller + @type Ember.Controller + @since 1.6.0 + */ + controller: Controller; + + /** + Returns the controller for a particular route or name. + The controller instance must already have been created, either through entering the + associated route or using `generateController`. + + @method controllerFor + @param {String} name the name of the route or controller + @return {Ember.Controller} + */ + controllerFor(name: string): Controller; + + /** + The name of the controller to associate with this route. + By default, Ember will lookup a route's controller that matches the name + of the route (i.e. `App.PostController` for `App.PostRoute`). However, + if you would like to define a specific controller to use, you can do so + using this property. + This is useful in many ways, as the controller specified will be: + * passed to the `setupController` method. + * used as the controller for the view being rendered by the route. + * returned from a call to `controllerFor` for the route. + @property controllerName + @type String + @default null + @since 1.4.0 + */ + controllerName: string; + + /** + This hook is executed when the router completely exits this route. It is + not executed when the model for the route changes. + @method deactivate + */ + deactivate: Function; + + /** + Deserializes value of the query parameter based on defaultValueType + @method deserializeQueryParam + @param {Object} value + @param {String} urlKey + @param {String} defaultValueType + */ + deserializeQueryParam(value: any, urlKey: string, defaultValueType: string): any; + + /** + Disconnects a view that has been rendered into an outlet. + You may pass any or all of the following options to `disconnectOutlet`: + * `outlet`: the name of the outlet to clear (default: 'main') + * `parentView`: the name of the view containing the outlet to clear + (default: the view rendered by the parent route) + + @method disconnectOutlet + @param {Object|String} options the options hash or outlet name + */ + disconnectOutlet(options: DisconnectOutletOptions|string): void; + + /** + @method findModel + @param {String} type the model type + @param {Object} value the value passed to find + */ + findModel(type: string, value: any): any; + + /** + Generates a controller for a route. + If the optional model is passed then the controller type is determined automatically, + e.g., an ArrayController for arrays. + + @method generateController + @param {String} name the name of the controller + @param {Object} model the model to infer the type of the controller (optional) + */ + generateController(name: string, model: {}): Controller; + + /** + Perform a synchronous transition into another route without attempting + to resolve promises, update the URL, or abort any currently active + asynchronous transitions (i.e. regular transitions caused by + `transitionTo` or URL changes). + This method is handy for performing intermediate transitions on the + way to a final destination route, and is called internally by the + default implementations of the `error` and `loading` handlers. + @method intermediateTransitionTo + @param {String} name the name of the route + @param {...Object} models the model(s) to be used while transitioning + to the route. + @since 1.2.0 + */ + intermediateTransitionTo(name: string, ...models: any[]): void; + + /** + A hook you can implement to convert the URL into the model for + this route. + + @method model + @param {Object} params the parameters extracted from the URL + @param {Transition} transition + @return {Object|Promise} the model for this route. If + a promise is returned, the transition will pause until + the promise resolves, and the resolved value of the promise + will be used as the model for this route. + */ + model(params: {}, transition: EmberStates.Transition): any|RSVP.Promise; + + /** + Returns the model of a parent (or any ancestor) route + in a route hierarchy. During a transition, all routes + must resolve a model object, and if a route + needs access to a parent route's model in order to + resolve a model (or just reuse the model from a parent), + it can call `this.modelFor(theNameOfParentRoute)` to + retrieve it. + + @method modelFor + @param {String} name the name of the route + @return {Object} the model object + */ + modelFor(name: string): {}; + + /** + Retrieves parameters, for current route using the state.params + variable and getQueryParamsFor, using the supplied routeName. + @method paramsFor + @param {String} name + */ + paramsFor(name: string) : any; + + /** + Configuration hash for this route's queryParams. + @property queryParams + @for Ember.Route + @type Hash + */ + queryParams: {}; + + /** + Refresh the model on this route and any child routes, firing the + `beforeModel`, `model`, and `afterModel` hooks in a similar fashion + to how routes are entered when transitioning in from other route. + The current route params (e.g. `article_id`) will be passed in + to the respective model hooks, and if a different model is returned, + `setupController` and associated route hooks will re-fire as well. + An example usage of this method is re-querying the server for the + latest information using the same parameters as when the route + was first entered. + Note that this will cause `model` hooks to fire even on routes + that were provided a model object when the route was initially + entered. + @method refresh + @return {Transition} the transition object associated with this + attempted transition + @since 1.4.0 + */ + redirect(): EmberStates.Transition; + + + /** + Refresh the model on this route and any child routes, firing the + `beforeModel`, `model`, and `afterModel` hooks in a similar fashion + to how routes are entered when transitioning in from other route. + The current route params (e.g. `article_id`) will be passed in + to the respective model hooks, and if a different model is returned, + `setupController` and associated route hooks will re-fire as well. + An example usage of this method is re-querying the server for the + latest information using the same parameters as when the route + was first entered. + Note that this will cause `model` hooks to fire even on routes + that were provided a model object when the route was initially + entered. + @method refresh + @return {Transition} the transition object associated with this + attempted transition + @since 1.4.0 + */ + refresh(): EmberStates.Transition; + + /** + `render` is used to render a template into a region of another template + (indicated by an `{{outlet}}`). `render` is used both during the entry + phase of routing (via the `renderTemplate` hook) and later in response to + user interaction. + + @method render + @param {String} name the name of the template to render + @param {Object} [options] the options + @param {String} [options.into] the template to render into, + referenced by name. Defaults to the parent template + @param {String} [options.outlet] the outlet inside `options.template` to render into. + Defaults to 'main' + @param {String|Object} [options.controller] the controller to use for this template, + referenced by name or as a controller instance. Defaults to the Route's paired controller + @param {Object} [options.model] the model object to set on `options.controller`. + Defaults to the return value of the Route's model hook + */ + render(name: string, options?: RenderOptions): void; + + /** + A hook you can use to render the template for the current route. + This method is called with the controller for the current route and the + model supplied by the `model` hook. By default, it renders the route's + template, configured with the controller for the route. + This method can be overridden to set up and render additional or + alternative templates. + + @method renderTemplate + @param {Object} controller the route's controller + @param {Object} model the route's model + */ + renderTemplate(controller: Controller, model: {}): void; + + /** + Transition into another route while replacing the current URL, if possible. + This will replace the current history entry instead of adding a new one. + Beside that, it is identical to `transitionTo` in all other respects. See + 'transitionTo' for additional information regarding multiple models. + + @method replaceWith + @param {String} name the name of the route or a URL + @param {...Object} models the model(s) or identifier(s) to be used while + transitioning to the route. + @return {Transition} the transition object associated with this + attempted transition + */ + replaceWith(name: string, ...models: any[]): void; + + /** + A hook you can use to reset controller values either when the model + changes or the route is exiting. + + @method resetController + @param {Controller} controller instance + @param {Boolean} isExiting + @param {Object} transition + @since 1.7.0 + */ + resetController(controller: Ember.Controller, isExiting: boolean, transition: any): void; + + /** + A hook you can implement to convert the route's model into parameters + for the URL. + + The default `serialize` method will insert the model's `id` into the + route's dynamic segment (in this case, `:post_id`) if the segment contains '_id'. + If the route has multiple dynamic segments or does not contain '_id', `serialize` + will return `Ember.getProperties(model, params)` + This method is called when `transitionTo` is called with a context + in order to populate the URL. + @method serialize + @param {Object} model the route's model + @param {Array} params an Array of parameter names for the current + route (in the example, `['post_id']`. + @return {Object} the serialized parameters + */ + serialize(model: {}, params: string[]): string; + + /** + Serializes value of the query parameter based on defaultValueType + @method serializeQueryParam + @param {Object} value + @param {String} urlKey + @param {String} defaultValueType + */ + serializeQueryParam(value: any, urlKey: string, defaultValueType: string): string; + + /** + Serializes the query parameter key + @method serializeQueryParamKey + @param {String} controllerPropertyName + */ + serializeQueryParamKey(controllerPropertyName: string): string; + + /** + A hook you can use to setup the controller for the current route. + This method is called with the controller for the current route and the + model supplied by the `model` hook. + By default, the `setupController` hook sets the `model` property of + the controller to the `model`. + If you implement the `setupController` hook in your Route, it will + prevent this default behavior. If you want to preserve that behavior + when implementing your `setupController` function, make sure to call + `_super` + @method setupController + @param {Controller} controller instance + @param {Object} model + */ + setupController(controller: Controller, model: {}): void; + + /** + Store property provides a hook for data persistence libraries to inject themselves. + By default, this store property provides the exact same functionality previously + in the model hook. + Currently, the required interface is: + `store.find(modelName, findArguments)` + @method store + @param {Object} store + */ + store(store: any): any; + + /** + The name of the template to use by default when rendering this routes + template. + This is similar with `viewName`, but is useful when you just want a custom + template without a view. + + @property templateName + @type String + @default null + @since 1.4.0 + */ + templateName: string; + + /** + Transition the application into another route. The route may + be either a single route or route path + + @method transitionTo + @param {String} name the name of the route or a URL + @param {...Object} models the model(s) or identifier(s) to be used while + transitioning to the route. + @param {Object} [options] optional hash with a queryParams property + containing a mapping of query parameters + @return {Transition} the transition object associated with this + attempted transition + */ + transitionTo(name: string, ...object: any[]): EmberStates.Transition; + + /** + The name of the view to use by default when rendering this routes template. + When rendering a template, the route will, by default, determine the + template and view to use from the name of the route itself. If you need to + define a specific view, set this property. + This is useful when multiple routes would benefit from using the same view + because it doesn't require a custom `renderTemplate` method. + @property viewName + @type String + @default null + @since 1.4.0 + */ + viewName: string; + + // ActionHandlerMixin methods + + /** + Sends an action to the router, which will delegate it to the currently + active route hierarchy per the bubbling rules explained under actions + + @method send + @param {String} actionName The action to trigger + @param {*} context a context to send with the action + */ + send(name: string, ...args: any[]): void; + + /** + The collection of functions, keyed by name, available on this + `ActionHandler` as action targets. + These functions will be invoked when a matching `{{action}}` is triggered + from within a template and the application's current route is this route. + Actions can also be invoked from other parts of your application + via `ActionHandler#send`. + The `actions` hash will inherit action handlers from + the `actions` hash defined on extended parent classes + or mixins rather than just replace the entire hash. + + Within a Controller, Route, View or Component's action handler, + the value of the `this` context is the Controller, Route, View or + Component object: + + It is also possible to call `this._super.apply(this, arguments)` from within an + action handler if it overrides a handler defined on a parent + class or mixin. + + ## Bubbling + By default, an action will stop bubbling once a handler defined + on the `actions` hash handles it. To continue bubbling the action, + you must return `true` from the handler + + @property actions + @type Hash + @default null + */ + actions: ActionsHash; + + // Evented methods + + /** + Subscribes to a named event with given function. + + An optional target can be passed in as the 2nd argument that will + be set as the "this" for the callback. This is a good way to give your + function access to the object triggering the event. When the target + parameter is used the callback becomes the third argument. + + @method on + @param {String} name The name of the event + @param {Object} [target] The "this" binding for the callback + @param {Function} method The callback to execute + @return this + */ + on(name: string, target: any, method: Function): Evented; + + /** + Subscribes a function to a named event and then cancels the subscription + after the first time the event is triggered. It is good to use ``one`` when + you only care about the first time an event has taken place. + This function takes an optional 2nd argument that will become the "this" + value for the callback. If this argument is passed then the 3rd argument + becomes the function. + + @method one + @param {String} name The name of the event + @param {Object} [target] The "this" binding for the callback + @param {Function} method The callback to execute + @return this + */ + one(name: string, target: any, method: Function): Evented; + + /** + Triggers a named event for the object. Any additional arguments + will be passed as parameters to the functions that are subscribed to the + event. + + @method trigger + @param {String} name The name of the event + @param {Object...} args Optional arguments to pass on + */ + trigger(name: string, ...args: string[]): void; + + /** + Cancels subscription for given name, target, and method. + + @method off + @param {String} name The name of the event + @param {Object} target The target of the subscription + @param {Function} method The function of the subscription + @return this + */ + off(name: string, target:any , method: Function): Evented; + + /** + Checks to see if object has any subscriptions for named event. + + @method has + @param {String} name The name of the event + @return {Boolean} does the object have a subscription for event + */ + has(name: string): boolean; + } + + class Router extends Object { + static detect(obj: any): boolean; + static detectInstance(obj: any): boolean; + /** + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ + static eachComputedProperty(callback: Function, binding: {}): void; + /** + Returns the original hash that was passed to meta(). + @param key property name + **/ + static metaForProperty(key: string): {}; + static isClass: boolean; + static isMethod: boolean; + map(callback: Function): Router; + } + class RouterDSL { + resource(name: string, options?: {}, callback?: Function): void; + resource(name: string, callback: Function): void; + route(name: string, options?: {}): void; + } + var SHIM_ES5: boolean; + var STRINGS: boolean; + class Select extends View { + static detect(obj: any): boolean; + static detectInstance(obj: any): boolean; + /** + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ + static eachComputedProperty(callback: Function, binding: {}): void; + /** + Returns the original hash that was passed to meta(). + @param key property name + **/ + static metaForProperty(key: string): {}; + static isClass: boolean; + static isMethod: boolean; + content: any[]; + groupView: View; + multiple: boolean; + optionGroupPath: string; + optionLabelPath: string; + optionValuePath: string; + optionView: View; + prompt: string; + selection: any; + value: string; + } + class SelectOption extends View { + static detect(obj: any): boolean; + static detectInstance(obj: any): boolean; + /** + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ + static eachComputedProperty(callback: Function, binding: {}): void; + /** + Returns the original hash that was passed to meta(). + @param key property name + **/ + static metaForProperty(key: string): {}; + static isClass: boolean; + static isMethod: boolean; + } + class Set extends CoreObject implements MutableEnumberable, Copyable, Freezable { + addEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): Set; + addObject(object: any): any; + addObjects(objects: Enumerable): Set; + any(callback: Function, target?: any): boolean; + anyBy(key: string, value?: string): boolean; + someProperty(key: string, value?: string): boolean; + compact(): any[]; + contains(obj: any): boolean; + enumerableContentDidChange(start: number, removing: number, adding: number): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: number): any; + enumerableContentDidChange(start: number, removing: number, adding: Enumerable): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable): any; + enumerableContentDidChange(removing: number, adding: number): any; + enumerableContentDidChange(removing: Enumerable, adding: number): any; + enumerableContentDidChange(removing: number, adding: Enumerable): any; + enumerableContentDidChange(removing: Enumerable, adding: Enumerable): any; + enumerableContentWillChange(removing: number, adding: number): Set; + enumerableContentWillChange(removing: Enumerable, adding: number): Set; + enumerableContentWillChange(removing: number, adding: Enumerable): Set; + enumerableContentWillChange(removing: Enumerable, adding: Enumerable): Set; + every(callback: Function, target?: any): boolean; + everyBy(key: string, value?: string): boolean; + everyProperty(key: string, value?: string): boolean; + filter(callback: Function, target: any): any[]; + filterBy(key: string, value?: string): any[]; + find(callback: Function, target: any): any; + findBy(key: string, value?: string): any; + forEach(callback: Function, target?: any): any; + getEach(key: string): any[]; + invoke(methodName: string, ...args: any[]): any[]; + map: ItemIndexEnumerableCallbackTarget; + mapBy(key: string): any[]; + nextObject(index: number, previousObject: any, context: any): any; + reduce(callback: ReduceCallback, initialValue: any, reducerProperty: string): any; + reject: ItemIndexEnumerableCallbackTarget; + rejectBy(key: string, value?: string): any[]; + removeEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): Set; + removeObject(object: any): any; + removeObjects(objects: Enumerable): Set; + setEach(key: string, value?: any): any; + some(callback: Function, target?: any): boolean; + toArray(): any[]; + uniq(): Set; + without(value: any): Set; + '[]': any[]; + firstObject: any; + hasEnumerableObservers: boolean; + lastObject: any; + copy(deep: boolean): Set; + frozenCopy(): Set; + freeze(): Set; + isFrozen: boolean; + add(obj: any): Set; + addEach(...args: any[]): Set; + clear(): Set; + isEqual(obj: Set): boolean; + pop(): any; + push(obj: any): Set; + remove(obj: any): Set; + removeEach(...args: any[]): Set; + shift(): any; + unshift(obj: any): Set; + length: number; + } + class SortableMixin implements MutableEnumberable { + addEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): Enumerable; + addObject(object: any): any; + addObjects(objects: Enumerable): MutableEnumberable; + any(callback: Function, target?: any): boolean; + anyBy(key: string, value?: string): boolean; + someProperty(key: string, value?: string): boolean; + compact(): any[]; + contains(obj: any): boolean; + enumerableContentDidChange(start: number, removing: number, adding: number): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: number): any; + enumerableContentDidChange(start: number, removing: number, adding: Enumerable): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable): any; + enumerableContentDidChange(removing: number, adding: number): any; + enumerableContentDidChange(removing: Enumerable, adding: number): any; + enumerableContentDidChange(removing: number, adding: Enumerable): any; + enumerableContentDidChange(removing: Enumerable, adding: Enumerable): any; + enumerableContentWillChange(removing: number, adding: number): Enumerable; + enumerableContentWillChange(removing: Enumerable, adding: number): Enumerable; + enumerableContentWillChange(removing: number, adding: Enumerable): Enumerable; + enumerableContentWillChange(removing: Enumerable, adding: Enumerable): Enumerable; + every(callback: Function, target?: any): boolean; + everyBy(key: string, value?: string): boolean; + everyProperty(key: string, value?: string): boolean; + filter(callback: Function, target: any): any[]; + filterBy(key: string, value?: string): any[]; + find(callback: Function, target: any): any; + findBy(key: string, value?: string): any; + forEach(callback: Function, target?: any): any; + getEach(key: string): any[]; + invoke(methodName: string, ...args: any[]): any[]; + map: ItemIndexEnumerableCallbackTarget; + mapBy(key: string): any[]; + nextObject(index: number, previousObject: any, context: any): any; + reduce(callback: ReduceCallback, initialValue: any, reducerProperty: string): any; + reject: ItemIndexEnumerableCallbackTarget; + rejectBy(key: string, value?: string): any[]; + removeEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): Enumerable; + removeObject(object: any): any; + removeObjects(objects: Enumerable): MutableEnumberable; + setEach(key: string, value?: any): any; + some(callback: Function, target?: any): boolean; + toArray(): any[]; + uniq(): Enumerable; + without(value: any): Enumerable; + '[]': any[]; + arrangedContent: any; + firstObject: any; + hasEnumerableObservers: boolean; + lastObject: any; + sortAscending: boolean; + sortFunction: Comparable; + sortProperties: any[]; + } + class State extends Object implements Evented { + static detect(obj: any): boolean; + static detectInstance(obj: any): boolean; + /** + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ + static eachComputedProperty(callback: Function, binding: {}): void; + /** + Returns the original hash that was passed to meta(). + @param key property name + **/ + static metaForProperty(key: string): {}; + static isClass: boolean; + static isMethod: boolean; + has(name: string): boolean; + off(name: string, target: any, method: Function): State; + on(name: string, target: any, method: Function): State; + one(name: string, target: any, method: Function): State; + trigger(name: string, ...args: string[]): void; + getPathsCache(stateManager: {}, path: string): {}; + init(): void; + setPathsCache(stateManager: {}, path: string, transitions: any): void; + static transitionTo(target: string): void; + hasContext: boolean; + isLeaf: boolean; + name: string; + parentState: State; + path: string; + enter: Function; + exit: Function; + setup: Function; + } + class StateManager extends State { + static detect(obj: any): boolean; + static detectInstance(obj: any): boolean; + /** + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ + static eachComputedProperty(callback: Function, binding: {}): void; + /** + Returns the original hash that was passed to meta(). + @param key property name + **/ + static metaForProperty(key: string): {}; + static isClass: boolean; + static isMethod: boolean; + contextFreeTransition(currentState: State, path: string): TransitionsHash; + enterState(transition: TransitionsHash): void; + getState(name: string): State; + getStateByPath(root: State, path: string): State; + getStateMeta(state: State, key: string): any; + getStatesInPath(root: State, path: string): State[]; + goToState(path: string, context: any): void; + send(event: string): void; + setStateMeta(state: State, key: string, value: any): any; + stateMetaFor(state: State): {}; + transitionTo(path: string, context: any): void; + triggerSetupContext(transitions: TransitionsHash): void; + unhandledEvent(manager: StateManager, event: string): any; + currentPath: string; + currentState: State; + errorOnUnhandledEvents: boolean; + transitionEvent: string; + } + namespace String { + function camelize(str: string): string; + function capitalize(str: string): string; + function classify(str: string): string; + function dasherize(str: string): string; + function decamelize(str: string): string; + function fmt(...args: string[]): string; + function htmlSafe(str: string): void; // TODO: @returns Handlebars.SafeStringStatic; + function loc(...args: string[]): string; + function underscore(str: string): string; + function w(str: string): string[]; + } + var TEMPLATES: {}; + class TargetActionSupport { + triggerAction(opts: {}): boolean; + } + class Test { + click(selector: string): RSVP.Promise; + fillin(selector: string, text: string): RSVP.Promise; + find(selector: string): JQuery; + findWithAssert(selector: string): JQuery; + injectTestHelpers(): void; + keyEvent(selector: string, type: string, keyCode: number): RSVP.Promise; + static oninjectHelpers(callback: Function): void; + static promise(resolver: Function): RSVP.Promise; + static registerHelper(name: string, helperMethod: Function): void; + removeTestHelpers(): void; + setupForTesting(): void; + static unregisterHelper(name: string): void; + visit(url: string): RSVP.Promise; + wait(value: any): RSVP.Promise; + static adapter: Object; + testHelpers: {}; + } + class TextArea extends View implements TextSupport { + static detect(obj: any): boolean; + static detectInstance(obj: any): boolean; + /** + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ + static eachComputedProperty(callback: Function, binding: {}): void; + /** + Returns the original hash that was passed to meta(). + @param key property name + **/ + static metaForProperty(key: string): {}; + static isClass: boolean; + static isMethod: boolean; + cancel(event: Function): void; + focusIn(event: Function): void; + focusOut(event: Function): void; + insertNewLine(event: Function): void; + keyPress(event: Function): void; + action: string; + bubbles: boolean; + onEvent: string; + } + class TextField extends View implements TextSupport { + static detect(obj: any): boolean; + static detectInstance(obj: any): boolean; + /** + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ + static eachComputedProperty(callback: Function, binding: {}): void; + /** + Returns the original hash that was passed to meta(). + @param key property name + **/ + static metaForProperty(key: string): {}; + static isClass: boolean; + static isMethod: boolean; + cancel(event: Function): void; + focusIn(event: Function): void; + focusOut(event: Function): void; + insertNewLine(event: Function): void; + keyPress(event: Function): void; + action: string; + bubbles: boolean; + onEvent: string; + pattern: string; + size: string; + type: string; + value: string; + } + class TextSupport { + cancel(event: Function): void; + focusIn(event: Function): void; + focusOut(event: Function): void; + insertNewLine(event: Function): void; + keyPress(event: Function): void; + action: string; + bubbles: boolean; + onEvent: string; + } + var VERSION: string; + class View extends CoreView { + static detect(obj: any): boolean; + static detectInstance(obj: any): boolean; + /** + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ + static eachComputedProperty(callback: Function, binding: {}): void; + /** + Returns the original hash that was passed to meta(). + @param key property name + **/ + static metaForProperty(key: string): {}; + static isClass: boolean; + static isMethod: boolean; + $(): JQuery; + append(): View; + // ReSharper disable InconsistentNaming + appendTo(A: string): View; + appendTo(A: HTMLElement): View; + appendTo(A: JQuery): View; + // ReSharper restore InconsistentNaming + createChildView(viewClass: {}, attrs?: {}): View; + createChildView(viewClass: string, attrs?: {}): View; + createElement(): View; + destroy(): View; + destroyElement(): View; + findElementInParentElement(parentElement: HTMLElement): HTMLElement; + remove(): View; + removeAllChildren(): View; + removeChild(view: View): View; + removeFromParent(): View; + render(buffer: RenderBuffer): void; + // ReSharper disable InconsistentNaming + replaceIn(A: string): View; + replaceIn(A: HTMLElement): View; + replaceIn(A: JQuery): View; + // ReSharper restore InconsistentNaming + rerender(): void; + ariaRole: string; + attributeBindings: any; + classNameBindings: string[]; + classNames: string[]; + context: any; + controller: any; + element: HTMLElement; + isView: boolean; + isVisible: boolean; + layout: Function; + layoutName: string; + nearestChildOf: View; + nearestOfType: View; + nearestWithProperty: View; + tagName: string; + template: Function; + templateName: string; + templates: {}; + views: {}; + didInsertElement: Function; + parentViewDidChange: Function; + willClearRender: Function; + willDestroyElement: Function; + willInsertElement: Function; + } + class ViewTargetActionSupport extends Mixin { + target: any; + actionContext: any; + } + var ViewUtils: {}; // TODO: define interface + function addBeforeObserver(obj: any, path: string, target: any, method: Function): any; + function addListener(obj: any, eventName: string, target: any, method: Function, once?: boolean): void; + function addListener(obj: any, eventName: string, target: any, method: string, once?: boolean): void; + function addListener(obj: any, eventName: string, func: Function, method: Function, once?: boolean): void; + function addListener(obj: any, eventName: string, func: Function, method: string, once?: boolean): void; + var addObserver: ModifyObserver; + /** + Ember.alias is deprecated. Please use Ember.aliasMethod or Ember.computed.alias instead. + **/ + var alias: typeof deprecateFunc; + function aliasMethod(methodName: string): Descriptor; + var anyUnprocessedMixins: boolean; + function assert(desc: string, test: boolean): void; + function beforeObserver(func: Function, propertyName: string): Function; + function beforeObserversFor(obj: any, path: string): string[]; + function beginPropertyChanges(): void; + function bind(obj: any, to: string, from: string): Binding; + function cacheFor(obj: any, key: string): any; + function canInvoke(obj: any, methodName: string): boolean; + function changeProperties(callback: Function, binding?: any): void; + function compare(v: any, w: any): number; + // ReSharper disable once DuplicatingLocalDeclaration + var computed: { + (...args: any[]): ComputedProperty; + alias(dependentKey: string): ComputedProperty; + and(...args: string[]): ComputedProperty; + any(...args: string[]): ComputedProperty; + bool(dependentKey: string): ComputedProperty; + defaultTo(defaultPath: string): ComputedProperty; + empty(dependentKey: string): ComputedProperty; + equal(dependentKey: string, value: any): ComputedProperty; + gt(dependentKey: string, value: number): ComputedProperty; + gte(dependentKey: string, value: number): ComputedProperty; + lt(dependentKey: string, value: number): ComputedProperty; + lte(dependentKey: string, value: number): ComputedProperty; + map(...args: string[]): ComputedProperty; + match(dependentKey: string, regexp: RegExp): ComputedProperty; + none(dependentKey: string): ComputedProperty; + not(dependentKey: string): ComputedProperty; + notEmpty(dependentKey: string): ComputedProperty; + oneWay(dependentKey: string): ComputedProperty; + or(...args: string[]): ComputedProperty; + }; + // ReSharper disable DuplicatingLocalDeclaration + var config: {}; + // ReSharper restore DuplicatingLocalDeclaration + function controllerFor(container: Container, controllerName: string, lookupOptions?: {}): Controller; + function copy(obj: any, deep: boolean): any; + /** + Creates an instance of the CoreObject class. + @param arguments A hash containing values with which to initialize the newly instantiated object. + **/ + function create(arguments?: {}): CoreObject; + function debug(message: string): void; + function defineProperty(obj: any, keyName: string, desc: {}): void; + function deprecate(message: string, test?: boolean): void; + function deprecateFunc(message: string, func: Function): Function; + function destroy(obj: any): void; + /** + Ember.empty is deprecated. Please use Ember.isEmpty instead. + **/ + // ReSharper disable once DuplicatingLocalDeclaration + var empty: typeof deprecateFunc; + function endPropertyChanges(): void; + // ReSharper disable once DuplicatingLocalDeclaration + var exports: {}; + function finishChains(obj: any): void; + function flushPendingChains(): void; + function generateController(container: Container, controllerName: string, context: any): Controller; + function generateGuid(obj: any, prefix?: string): string; + function get(obj: any, keyName: string): any; + function getMeta(obj: any, property: string): any; + /** + getPath is deprecated since get now supports paths. + **/ + var getPath: typeof deprecateFunc; + function getWithDefault(root: string, key: string, defaultValue: any): any; + function guidFor(obj: any): string; + function handleErrors(func: Function, context: any): any; + function hasListeners(context: any, name: string): boolean; + function hasOwnProperty(prop: string): boolean; + function immediateObserver(func: Function, ...propertyNames: any[]): Function; + var imports: {}; + function inspect(obj: any): string; + function instrument(name: string, payload: any, callback: Function, binding: any): void; + function isArray(obj: any): boolean; + function isEmpty(obj: any): boolean; + function isEqual(a: any, b: any): boolean; + function isGlobalPath(path: string): boolean; + var isNamespace: boolean; + function isNone(obj: any): boolean; + function isPrototypeOf(obj: {}): boolean; + function isWatching(obj: any, key: string): boolean; + function keys(obj: any): any[]; + function listenersDiff(obj: any, eventName: string, otherActions: any[]): any[]; + function listenersFor(obj: any, eventName: string): any[]; + function listenersUnion(obj: any, eventName: string, otherActions: any[]): void; + // ReSharper disable once DuplicatingLocalDeclaration + var lookup: {}; // TODO: define interface + function makeArray(obj: any): any[]; + function merge(original: any, updates: any): any; + function meta(obj: any, writable?: boolean): {}; + function metaPath(obj: any, path: string, writable?: boolean): any; + function mixin(obj: any, ...args: any[]): any; + /** + Ember.none is deprecated. Please use Ember.isNone instead. + **/ + var none: typeof deprecateFunc; + function normalizeTuple(target: any, path: string): any[]; + function observer(...args: any[]): Function; + function observersFor(obj: any, path: string): any[]; + function onLoad(name: string, callback: Function): void; + function oneWay(obj: any, to: string, from: string): Binding; + var onError: Error; + function overrideChains(obj: any, keyName: string, m: any): boolean; + // ReSharper disable once DuplicatingLocalDeclaration + var platform: { + addBeforeObserver: ModifyObserver; + addObserver: ModifyObserver; + defineProperty(obj: any, keyName: string, desc: {}): void; + removeBeforeObserver: ModifyObserver; + removeObserver: ModifyObserver; + hasPropertyAccessors: boolean; + }; + function propertyDidChange(obj: any, keyName: string): void; + function propertyIsEnumerable(prop: string): boolean; + function propertyWillChange(obj: any, keyName: string): void; + function removeBeforeObserver(obj: any, path: string, target: any, method: Function): any; + function removeChainWatcher(obj: any, keyName: string, node: any): void; + function removeListener(obj: any, eventName: string, target: any, method: Function): void; + function removeListener(obj: any, eventName: string, target: any, method: string): void; + function removeListener(obj: any, eventName: string, func: Function, method: Function): void; + function removeListener(obj: any, eventName: string, func: Function, method: string): void; + function removeObserver(obj: any, path: string, target: any, method: Function): any; + function required(): Descriptor; + function rewatch(obj: any): void; + var run: { + (target: any, method: Function): void; + begin(): void; + cancel(timer: any): void; + debounce(target: any, method: Function, ...args: any[]): void; + debounce(target: any, method: string, ...args: any[]): void; + end(): void; + join(target: any, method: Function, ...args: any[]): any; + join(target: any, method: string, ...args: any[]): any; + later(target: any, method: Function, ...args: any[]): string; + later(target: any, method: string, ...args: any[]): string; + next(target: any, method: Function, ...args: any[]): number; + next(target: any, method: string, ...args: any[]): number; + once(target: any, method: Function, ...args: any[]): number; + once(target: any, method: string, ...args: any[]): number; + schedule(queue: string, target: any, method: Function, ...args: any[]): void; + schedule(queue: string, target: any, method: string, ...args: any[]): void; + scheduleOnce(queue: string, target: any, method: Function, ...args: any[]): void; + scheduleOnce(queue: string, target: any, method: string, ...args: any[]): void; + sync(): void; + throttle(target: any, method: Function, ...args: any[]): void; + throttle(target: any, method: string, ...args: any[]): void; + queues: any[]; + }; + function runLoadHooks(name: string, object: any): void; + function sendEvent(obj: any, eventName: string, params?: any[], actions?: any[]): boolean; + function set(obj: any, keyName: string, value: any): any; + function setMeta(obj: any, property: string, value: any): void; + /** + setPath is deprecated since set now supports paths. + **/ + var setPath: typeof deprecateFunc; + function setProperties(self: any, hash: {}): any; + function subscribe(pattern: string, object: any): void; + function toLocaleString(): string; + function toString(): string; + function tryCatchFinally(tryable: Function, catchable: Function, finalizer: Function, binding?: any): any; + function tryFinally(tryable: Function, finalizer: Function, binding?: any): any; + function tryInvoke(obj: any, methodName: string, args?: any[]): any; + function trySet(obj: any, path: string, value: any): void; + /** + trySetPath has been renamed to trySet. + **/ + var trySetPath: typeof deprecateFunc; + function typeOf(item: any): string; + function unwatch(obj: any, keyPath: string): void; + function unwatchKey(obj: any, keyName: string): void; + function unwatchPath(obj: any, keyPath: string): void; + // ReSharper disable once DuplicatingLocalDeclaration + var uuid: number; + function valueOf(): {}; + function warn(message: string, test?: boolean): void; + function watch(obj: any, keyPath: string): void; + function watchKey(obj: any, keyName: string): void; + function watchPath(obj: any, keyPath: string): void; + function watchedEvents(obj: {}): any[]; + function wrap(func: Function, superFunc: Function): Function; +} + +// ReSharper disable DuplicatingLocalDeclaration +declare namespace Em { + /** + Alias for jQuery. + **/ + var $: typeof Ember.$; + var A: typeof Ember.A; + class ActionHandlerMixin extends Ember.ActionHandlerMixin { } + class Application extends Ember.Application { } + class Array extends Ember.Array { } + class ArrayController extends Ember.ArrayController { } + var ArrayPolyfills: typeof Ember.ArrayPolyfills; + class ArrayProxy extends Ember.ArrayProxy { } + var BOOTED: typeof Ember.BOOTED; + class Binding extends Ember.Binding { } + class Button extends Ember.Button { } + class Checkbox extends Ember.Checkbox { } + class CollectionView extends Ember.CollectionView { } + class Comparable extends Ember.Comparable { } + class Component extends Ember.Component { } + class ComputedProperty extends Ember.ComputedProperty { } + class Container extends Ember.Container { } + class ContainerView extends Ember.ContainerView { } + class Controller extends Ember.Controller { } + class ControllerMixin extends Ember.ControllerMixin { } + class Copyable extends Ember.Copyable { } + class CoreObject extends Ember.CoreObject { } + class CoreView extends Ember.CoreView { } + class DAG extends Ember.DAG { } + var DEFAULT_GETTER_FUNCTION: typeof Ember.DEFAULT_GETTER_FUNCTION; + class DefaultResolver extends Ember.DefaultResolver { } + class Deffered extends Ember.Deferred { } + class DeferredMixin extends Ember.DeferredMixin { } + class Descriptor extends Ember.Descriptor { } + var EMPTY_META: typeof Ember.EMPTY_META; + var ENV: typeof Ember.ENV; + var EXTEND_PROTOTYPES: typeof Ember.EXTEND_PROTOTYPES; + class EachProxy extends Ember.EachProxy { } + class Enumerable extends Ember.Enumerable { } + var EnumerableUtils: typeof Ember.EnumerableUtils; + var Error: typeof Ember.Error; + class EventDispatcher extends Ember.EventDispatcher { } + class Evented extends Ember.Evented { } + var FROZEN_ERROR: typeof Ember.FROZEN_ERROR; + class Freezable extends Ember.Freezable { } + var GUID_KEY: typeof Ember.GUID_KEY; + namespace Handlebars { + var compile: typeof Ember.Handlebars.compile; + var get: typeof Ember.Handlebars.get; + var helper: typeof Ember.Handlebars.helper; + class helpers extends Ember.Handlebars.helpers { } + var precompile: typeof Ember.Handlebars.precompile; + var registerBoundHelper: typeof Ember.Handlebars.registerBoundHelper; + class Compiler extends Ember.Handlebars.Compiler { } + class JavaScriptCompiler extends Ember.Handlebars.JavaScriptCompiler { } + var registerHelper: typeof Ember.Handlebars.registerHelper; + var registerPartial: typeof Ember.Handlebars.registerPartial; + var K: typeof Ember.Handlebars.K; + var createFrame: typeof Ember.Handlebars.createFrame; + var Exception: typeof Ember.Handlebars.Exception; + class SafeString extends Ember.Handlebars.SafeString { } + var parse: typeof Ember.Handlebars.parse; + var print: typeof Ember.Handlebars.print; + var logger: typeof Ember.Handlebars.logger; + var log: typeof Ember.Handlebars.log; + } + class HashLocation extends Ember.HashLocation { } + class HistoryLocation extends Ember.HistoryLocation { } + var IS_BINDING: typeof Ember.IS_BINDING; + class Instrumentation extends Ember.Instrumentation { } + var K: typeof Ember.K; + var LOG_BINDINGS: typeof Ember.LOG_BINDINGS; + var LOG_STACKTRACE_ON_DEPRECATION: typeof Ember.LOG_STACKTRACE_ON_DEPRECATION; + var LOG_VERSION: typeof Ember.LOG_VERSION; + class LinkView extends Ember.LinkView { } + class Location extends Ember.Location { } + var Logger: typeof Ember.Logger; + var MANDATORY_SETTER_FUNCTION: typeof Ember.MANDATORY_SETTER_FUNCTION; + var META_KEY: typeof Ember.META_KEY; + class Map extends Ember.Map { } + class MapWithDefault extends Ember.MapWithDefault { } + class Mixin extends Ember.Mixin { } + class MutableArray extends Ember.MutableArray { } + class MutableEnumerable extends Ember.MutableEnumberable { } + var NAME_KEY: typeof Ember.NAME_KEY; + class Namespace extends Ember.Namespace { } + class NativeArray extends Ember.NativeArray { } + class NoneLocation extends Ember.NoneLocation { } + var ORDER_DEFINITION: typeof Ember.ORDER_DEFINITION; + class Object extends Ember.Object { } + class ObjectController extends Ember.ObjectController { } + class ObjectProxy extends Ember.ObjectProxy { } + class Observable extends Ember.Observable { } + class OrderedSet extends Ember.OrderedSet { } + namespace RSVP { + interface PromiseResolve extends Ember.RSVP.PromiseResolve { } + interface PromiseReject extends Ember.RSVP.PromiseReject { } + interface PromiseResolverFunction extends Ember.RSVP.PromiseResolverFunction { } + class Promise extends Ember.RSVP.Promise { } + } + class RenderBuffer extends Ember.RenderBuffer { } + class Route extends Ember.Route { } + class Router extends Ember.Router { } + class RouterDSL extends Ember.RouterDSL { } + var SHIM_ES5: typeof Ember.SHIM_ES5; + var STRINGS: typeof Ember.STRINGS; + class Select extends Ember.Select { } + class SelectOption extends Ember.SelectOption { } + class Set extends Ember.Set { } + class SortableMixin extends Ember.SortableMixin { } + class State extends Ember.State { } + class StateManager extends Ember.StateManager { } + namespace String { + var camelize: typeof Ember.String.camelize; + var capitalize: typeof Ember.String.capitalize; + var classify: typeof Ember.String.classify; + var dasherize: typeof Ember.String.dasherize; + var decamelize: typeof Ember.String.decamelize; + var fmt: typeof Ember.String.fmt; + var htmlSafe: typeof Ember.String.htmlSafe; + var loc: typeof Ember.String.loc; + var underscore: typeof Ember.String.underscore; + var w: typeof Ember.String.w; + } + var TEMPLATES: typeof Ember.TEMPLATES; + class TargetActionSupport extends Ember.TargetActionSupport { } + class Test extends Ember.Test { } + class TextArea extends Ember.TextArea { } + class TextField extends Ember.TextField { } + class TextSupport extends Ember.TextSupport { } + var VERSION: typeof Ember.VERSION; + class View extends Ember.View { } + class ViewTargetActionSupport extends Ember.ViewTargetActionSupport { } + var ViewUtils: typeof Ember.ViewUtils; + var addBeforeObserver: typeof Ember.addBeforeObserver; + var addListener: typeof Ember.addListener; + var addObserver: typeof Ember.addObserver; + var alias: typeof Ember.alias; + var aliasMethod: typeof Ember.aliasMethod; + var anyUnprocessedMixins: typeof Ember.anyUnprocessedMixins; + var assert: typeof Ember.assert; + var beforeObserver: typeof Ember.beforeObserver; + var beforeObserversFor: typeof Ember.beforeObserversFor; + var beginPropertyChanges: typeof Ember.beginPropertyChanges; + var bind: typeof Ember.bind; + var cacheFor: typeof Ember.cacheFor; + var canInvoke: typeof Ember.canInvoke; + var changeProperties: typeof Ember.changeProperties; + var compare: typeof Ember.compare; + var computed: typeof Ember.computed; + var config: typeof Ember.config; + var controllerFor: typeof Ember.controllerFor; + var copy: typeof Ember.copy; + var create: typeof Ember.create; + var debug: typeof Ember.debug; + var defineProperty: typeof Ember.defineProperty; + var deprecate: typeof Ember.deprecate; + var deprecateFunc: typeof Ember.deprecateFunc; + var destroy: typeof Ember.destroy; + var empty: typeof deprecateFunc; + var endPropertyChanges: typeof Ember.endPropertyChanges; + var exports: typeof Ember.exports; + var finishChains: typeof Ember.finishChains; + var flushPendingChains: typeof Ember.flushPendingChains; + var generateController: typeof Ember.generateController; + var generateGuid: typeof Ember.generateGuid; + var get: typeof Ember.get; + var getMeta: typeof Ember.getMeta; + var getPath: typeof Ember.getPath; + var getWithDefault: typeof Ember.getWithDefault; + var guidFor: typeof Ember.guidFor; + var handleErrors: typeof Ember.handleErrors; + var hasListeners: typeof Ember.hasListeners; + var hasOwnProperty: typeof Ember.hasOwnProperty; + var immediateObserver: typeof Ember.immediateObserver; + var imports: typeof Ember.imports; + var inspect: typeof Ember.inspect; + var instrument: typeof Ember.instrument; + var isArray: typeof Ember.isArray; + var isEmpty: typeof Ember.isEmpty; + var isEqual: typeof Ember.isEqual; + var isGlobalPath: typeof Ember.isGlobalPath; + var isNamespace: typeof Ember.isNamespace; + var isNone: typeof Ember.isNone; + var isPrototypeOf: typeof Ember.isPrototypeOf; + var isWatching: typeof Ember.isWatching; + var keys: typeof Ember.keys; + var listenersDiff: typeof Ember.listenersDiff; + var listenersFor: typeof Ember.listenersFor; + var listenersUnion: typeof Ember.listenersUnion; + var lookup: typeof Ember.lookup; + var makeArray: typeof Ember.makeArray; + var merge: typeof Ember.merge; + var meta: typeof Ember.meta; + var metaPath: typeof Ember.metaPath; + var mixin: typeof Ember.mixin; + var none: typeof Ember.none; + var normalizeTuple: typeof Ember.normalizeTuple; + var observer: typeof Ember.observer; + var observersFor: typeof Ember.observersFor; + var onLoad: typeof Ember.onLoad; + var oneWay: typeof Ember.oneWay; + var onError: typeof Ember.onError; + var overrideChains: typeof Ember.overrideChains; + var platform: typeof Ember.platform; + var propertyDidChange: typeof Ember.propertyDidChange; + var propertyIsEnumerable: typeof Ember.propertyIsEnumerable; + var propertyWillChange: typeof Ember.propertyWillChange; + var removeBeforeObserver: typeof Ember.removeBeforeObserver; + var removeChainWatcher: typeof Ember.removeChainWatcher; + var removeListener: typeof Ember.removeListener; + var removeObserver: typeof Ember.removeObserver; + var required: typeof Ember.required; + var rewatch: typeof Ember.rewatch; + var run: typeof Ember.run; + var runLoadHooks: typeof Ember.runLoadHooks; + var sendEvent: typeof Ember.sendEvent; + var set: typeof Ember.set; + var setMeta: typeof Ember.setMeta; + var setPath: typeof Ember.setPath; + var setProperties: typeof Ember.setProperties; + var subscribe: typeof Ember.subscribe; + var toLocaleString: typeof Ember.toLocaleString; + var toString: typeof Ember.toString; + var tryCatchFinally: typeof Ember.tryCatchFinally; + var tryFinally: typeof Ember.tryFinally; + var tryInvoke: typeof Ember.tryInvoke; + var trySet: typeof Ember.trySet; + var trySetPath: typeof Ember.trySetPath; + var typeOf: typeof Ember.typeOf; + var unwatch: typeof Ember.unwatch; + var unwatchKey: typeof Ember.unwatchKey; + var unwatchPath: typeof Ember.unwatchPath; + var uuid: typeof Ember.uuid; + var valueOf: typeof Ember.valueOf; + var warn: typeof Ember.warn; + var watch: typeof Ember.watch; + var watchKey: typeof Ember.watchKey; + var watchPath: typeof Ember.watchPath; + var watchedEvents: typeof Ember.watchedEvents; + var wrap: typeof Ember.wrap; +} + +/** + * External ambient module - to allow "import Ember = require('Ember');" to work correctly + */ + +declare module "Ember" { + + var $: typeof Ember.$; + var A: typeof Ember.A; + class ActionHandlerMixin extends Ember.ActionHandlerMixin { } + class Application extends Ember.Application { } + class Array extends Ember.Array { } + class ArrayController extends Ember.ArrayController { } + var ArrayPolyfills: typeof Ember.ArrayPolyfills; + class ArrayProxy extends Ember.ArrayProxy { } + var BOOTED: typeof Ember.BOOTED; + class Binding extends Ember.Binding { } + class Button extends Ember.Button { } + class Checkbox extends Ember.Checkbox { } + class CollectionView extends Ember.CollectionView { } + class Comparable extends Ember.Comparable { } + class Component extends Ember.Component { } + class ComputedProperty extends Ember.ComputedProperty { } + class Container extends Ember.Container { } + class ContainerView extends Ember.ContainerView { } + class Controller extends Ember.Controller { } + class ControllerMixin extends Ember.ControllerMixin { } + class Copyable extends Ember.Copyable { } + class CoreObject extends Ember.CoreObject { } + class CoreView extends Ember.CoreView { } + class DAG extends Ember.DAG { } + var DEFAULT_GETTER_FUNCTION: typeof Ember.DEFAULT_GETTER_FUNCTION; + class DefaultResolver extends Ember.DefaultResolver { } + class Deffered extends Ember.Deferred { } + class DeferredMixin extends Ember.DeferredMixin { } + class Descriptor extends Ember.Descriptor { } + var EMPTY_META: typeof Ember.EMPTY_META; + var ENV: typeof Ember.ENV; + var EXTEND_PROTOTYPES: typeof Ember.EXTEND_PROTOTYPES; + class EachProxy extends Ember.EachProxy { } + class Enumerable extends Ember.Enumerable { } + var EnumerableUtils: typeof Ember.EnumerableUtils; + var Error: typeof Ember.Error; + class EventDispatcher extends Ember.EventDispatcher { } + class Evented extends Ember.Evented { } + var FROZEN_ERROR: typeof Ember.FROZEN_ERROR; + class Freezable extends Ember.Freezable { } + var GUID_KEY: typeof Ember.GUID_KEY; + namespace Handlebars { + var compile: typeof Ember.Handlebars.compile; + var get: typeof Ember.Handlebars.get; + var helper: typeof Ember.Handlebars.helper; + class helpers extends Ember.Handlebars.helpers { } + var precompile: typeof Ember.Handlebars.precompile; + var registerBoundHelper: typeof Ember.Handlebars.registerBoundHelper; + class Compiler extends Ember.Handlebars.Compiler { } + class JavaScriptCompiler extends Ember.Handlebars.JavaScriptCompiler { } + var registerHelper: typeof Ember.Handlebars.registerHelper; + var registerPartial: typeof Ember.Handlebars.registerPartial; + var K: typeof Ember.Handlebars.K; + var createFrame: typeof Ember.Handlebars.createFrame; + var Exception: typeof Ember.Handlebars.Exception; + class SafeString extends Ember.Handlebars.SafeString { } + var parse: typeof Ember.Handlebars.parse; + var print: typeof Ember.Handlebars.print; + var logger: typeof Ember.Handlebars.logger; + var log: typeof Ember.Handlebars.log; + } + class HashLocation extends Ember.HashLocation { } + class HistoryLocation extends Ember.HistoryLocation { } + var IS_BINDING: typeof Ember.IS_BINDING; + class Instrumentation extends Ember.Instrumentation { } + var K: typeof Ember.K; + var LOG_BINDINGS: typeof Ember.LOG_BINDINGS; + var LOG_STACKTRACE_ON_DEPRECATION: typeof Ember.LOG_STACKTRACE_ON_DEPRECATION; + var LOG_VERSION: typeof Ember.LOG_VERSION; + class LinkView extends Ember.LinkView { } + class Location extends Ember.Location { } + var Logger: typeof Ember.Logger; + var MANDATORY_SETTER_FUNCTION: typeof Ember.MANDATORY_SETTER_FUNCTION; + var META_KEY: typeof Ember.META_KEY; + class Map extends Ember.Map { } + class MapWithDefault extends Ember.MapWithDefault { } + class Mixin extends Ember.Mixin { } + class MutableArray extends Ember.MutableArray { } + class MutableEnumerable extends Ember.MutableEnumberable { } + var NAME_KEY: typeof Ember.NAME_KEY; + class Namespace extends Ember.Namespace { } + class NativeArray extends Ember.NativeArray { } + class NoneLocation extends Ember.NoneLocation { } + var ORDER_DEFINITION: typeof Ember.ORDER_DEFINITION; + class Object extends Ember.Object { } + class ObjectController extends Ember.ObjectController { } + class ObjectProxy extends Ember.ObjectProxy { } + class Observable extends Ember.Observable { } + class OrderedSet extends Ember.OrderedSet { } + namespace RSVP { + interface PromiseResolve extends Ember.RSVP.PromiseResolve { } + interface PromiseReject extends Ember.RSVP.PromiseReject { } + interface PromiseResolverFunction extends Ember.RSVP.PromiseResolverFunction { } + class Promise extends Ember.RSVP.Promise { } + } + class RenderBuffer extends Ember.RenderBuffer { } + class Route extends Ember.Route { } + class Router extends Ember.Router { } + class RouterDSL extends Ember.RouterDSL { } + var SHIM_ES5: typeof Ember.SHIM_ES5; + var STRINGS: typeof Ember.STRINGS; + class Select extends Ember.Select { } + class SelectOption extends Ember.SelectOption { } + class Set extends Ember.Set { } + class SortableMixin extends Ember.SortableMixin { } + class State extends Ember.State { } + class StateManager extends Ember.StateManager { } + namespace String { + var camelize: typeof Ember.String.camelize; + var capitalize: typeof Ember.String.capitalize; + var classify: typeof Ember.String.classify; + var dasherize: typeof Ember.String.dasherize; + var decamelize: typeof Ember.String.decamelize; + var fmt: typeof Ember.String.fmt; + var htmlSafe: typeof Ember.String.htmlSafe; + var loc: typeof Ember.String.loc; + var underscore: typeof Ember.String.underscore; + var w: typeof Ember.String.w; + } + var TEMPLATES: typeof Ember.TEMPLATES; + class TargetActionSupport extends Ember.TargetActionSupport { } + class Test extends Ember.Test { } + class TextArea extends Ember.TextArea { } + class TextField extends Ember.TextField { } + class TextSupport extends Ember.TextSupport { } + var VERSION: typeof Ember.VERSION; + class View extends Ember.View { } + class ViewTargetActionSupport extends Ember.ViewTargetActionSupport { } + var ViewUtils: typeof Ember.ViewUtils; + var addBeforeObserver: typeof Ember.addBeforeObserver; + var addListener: typeof Ember.addListener; + var addObserver: typeof Ember.addObserver; + var alias: typeof Ember.alias; + var aliasMethod: typeof Ember.aliasMethod; + var anyUnprocessedMixins: typeof Ember.anyUnprocessedMixins; + var assert: typeof Ember.assert; + var beforeObserver: typeof Ember.beforeObserver; + var beforeObserversFor: typeof Ember.beforeObserversFor; + var beginPropertyChanges: typeof Ember.beginPropertyChanges; + var bind: typeof Ember.bind; + var cacheFor: typeof Ember.cacheFor; + var canInvoke: typeof Ember.canInvoke; + var changeProperties: typeof Ember.changeProperties; + var compare: typeof Ember.compare; + var computed: typeof Ember.computed; + var config: typeof Ember.config; + var controllerFor: typeof Ember.controllerFor; + var copy: typeof Ember.copy; + var create: typeof Ember.create; + var debug: typeof Ember.debug; + var defineProperty: typeof Ember.defineProperty; + var deprecate: typeof Ember.deprecate; + var deprecateFunc: typeof Ember.deprecateFunc; + var destroy: typeof Ember.destroy; + var empty: typeof Ember.deprecateFunc; + var endPropertyChanges: typeof Ember.endPropertyChanges; + var exports: typeof Ember.exports; + var finishChains: typeof Ember.finishChains; + var flushPendingChains: typeof Ember.flushPendingChains; + var generateController: typeof Ember.generateController; + var generateGuid: typeof Ember.generateGuid; + var get: typeof Ember.get; + var getMeta: typeof Ember.getMeta; + var getPath: typeof Ember.getPath; + var getWithDefault: typeof Ember.getWithDefault; + var guidFor: typeof Ember.guidFor; + var handleErrors: typeof Ember.handleErrors; + var hasListeners: typeof Ember.hasListeners; + var hasOwnProperty: typeof Ember.hasOwnProperty; + var immediateObserver: typeof Ember.immediateObserver; + var imports: typeof Ember.imports; + var inspect: typeof Ember.inspect; + var instrument: typeof Ember.instrument; + var isArray: typeof Ember.isArray; + var isEmpty: typeof Ember.isEmpty; + var isEqual: typeof Ember.isEqual; + var isGlobalPath: typeof Ember.isGlobalPath; + var isNamespace: typeof Ember.isNamespace; + var isNone: typeof Ember.isNone; + var isPrototypeOf: typeof Ember.isPrototypeOf; + var isWatching: typeof Ember.isWatching; + var keys: typeof Ember.keys; + var listenersDiff: typeof Ember.listenersDiff; + var listenersFor: typeof Ember.listenersFor; + var listenersUnion: typeof Ember.listenersUnion; + var lookup: typeof Ember.lookup; + var makeArray: typeof Ember.makeArray; + var merge: typeof Ember.merge; + var meta: typeof Ember.meta; + var metaPath: typeof Ember.metaPath; + var mixin: typeof Ember.mixin; + var none: typeof Ember.none; + var normalizeTuple: typeof Ember.normalizeTuple; + var observer: typeof Ember.observer; + var observersFor: typeof Ember.observersFor; + var onLoad: typeof Ember.onLoad; + var oneWay: typeof Ember.oneWay; + var onError: typeof Ember.onError; + var overrideChains: typeof Ember.overrideChains; + var platform: typeof Ember.platform; + var propertyDidChange: typeof Ember.propertyDidChange; + var propertyIsEnumerable: typeof Ember.propertyIsEnumerable; + var propertyWillChange: typeof Ember.propertyWillChange; + var removeBeforeObserver: typeof Ember.removeBeforeObserver; + var removeChainWatcher: typeof Ember.removeChainWatcher; + var removeListener: typeof Ember.removeListener; + var removeObserver: typeof Ember.removeObserver; + var required: typeof Ember.required; + var rewatch: typeof Ember.rewatch; + var run: typeof Ember.run; + var runLoadHooks: typeof Ember.runLoadHooks; + var sendEvent: typeof Ember.sendEvent; + var set: typeof Ember.set; + var setMeta: typeof Ember.setMeta; + var setPath: typeof Ember.setPath; + var setProperties: typeof Ember.setProperties; + var subscribe: typeof Ember.subscribe; + var toLocaleString: typeof Ember.toLocaleString; + var toString: typeof Ember.toString; + var tryCatchFinally: typeof Ember.tryCatchFinally; + var tryFinally: typeof Ember.tryFinally; + var tryInvoke: typeof Ember.tryInvoke; + var trySet: typeof Ember.trySet; + var trySetPath: typeof Ember.trySetPath; + var typeOf: typeof Ember.typeOf; + var unwatch: typeof Ember.unwatch; + var unwatchKey: typeof Ember.unwatchKey; + var unwatchPath: typeof Ember.unwatchPath; + var uuid: typeof Ember.uuid; + var valueOf: typeof Ember.valueOf; + var warn: typeof Ember.warn; + var watch: typeof Ember.watch; + var watchKey: typeof Ember.watchKey; + var watchPath: typeof Ember.watchPath; + var watchedEvents: typeof Ember.watchedEvents; + var wrap: typeof Ember.wrap; +} diff --git a/ember/ember-tests.ts b/ember/ember-tests.ts index 103fb0146e..46b3039123 100644 --- a/ember/ember-tests.ts +++ b/ember/ember-tests.ts @@ -89,9 +89,6 @@ App.wife.get('householdIncome'); App.user = Em.Object.create({ fullName: 'Kara Gates' }); -App.userView = Em.View.create({ - userNameBinding: Em.Binding.oneWay('App.user.fullName') -}); App.user.set('fullName', 'Krang Gates'); App.userView.set('userName', 'Truckasaurus Gates'); App.user.get('fullName'); @@ -100,26 +97,6 @@ App = Em.Application.create({ rootElement: '#sidebar' }); -var view = Em.View.create({ - templateName: 'say-hello', - name: 'Bob' -}); -view.appendTo('#container'); -view.append(); -view.remove(); - -App.AlertView = Em.View.extend({ - priority: 'p4', - isUrgent: true -}); - -App.ListingView = Em.View.extend({ - templateName: 'listing', - edit: (event: any) => { - event.view.set('isEditing', true); - } -}); - App.userController = Em.Object.create({ content: Em.Object.create({ firstName: 'Albert', @@ -130,32 +107,10 @@ App.userController = Em.Object.create({ }); Handlebars.registerHelper('highlight', function(property: string, options: any) { - var value = Em.Handlebars.get(this, property, options); - return new Handlebars.SafeString('' + value + ''); + return new Handlebars.SafeString('' + "some value" + ''); }); -App.MyText = Em.TextField.extend({ - formBlurredBinding: 'App.adminController.formBlurred', - change: function() { - this.set('formBlurred', true); - } -}); - -var textArea = Em.TextArea.create({ - valueBinding: 'TestObject.value' -}); - -App.ClickableView = Em.View.extend({ - click: () => { - alert('ClickableView was clicked!'); - } -}); - -var container = Em.ContainerView.create(); -container.append(); -var coolView = App.CoolView.create(), - childViews = container.get('childViews'); -childViews.pushObject(coolView); +var coolView = App.CoolView.create(); var Person2 = Em.Object.extend({ sayHello: function() { diff --git a/ember/index.d.ts b/ember/index.d.ts index c278c17bd6..d19c3cfd86 100644 --- a/ember/index.d.ts +++ b/ember/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Ember.js 1.11.3 +// Type definitions for Ember.js 2.0 // Project: http://emberjs.com/ // Definitions by: Jed Mao // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -592,50 +592,6 @@ declare namespace Ember { length: number; } /** - Provides a way for you to publish a collection of objects so that you can easily bind to the - collection from a Handlebars #each helper, an Ember.CollectionView, or other controllers. - **/ - class ArrayController extends ArrayProxy implements SortableMixin, ControllerMixin { - static detect(obj: any): boolean; - static detectInstance(obj: any): boolean; - /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ - static eachComputedProperty(callback: Function, binding: {}): void; - /** - Returns the original hash that was passed to meta(). - @param key property name - **/ - static metaForProperty(key: string): {}; - static isClass: boolean; - static isMethod: boolean; - lookupItemController(object: any): string; - arrangedContent: any; - itemController: string; - sortAscending: boolean; - sortFunction: Comparable; - sortProperties: any[]; - replaceRoute(name: string, ...args: any[]): void; - transitionToRoute(name: string, ...args: any[]): void; - controllers: {}; - needs: string[]; - target: any; - model: any; - queryParams: any; - send(name: string, ...args: any[]): void; - actions: {}; - - } - /** - Array polyfills to support ES5 features in older browsers. - **/ - var ArrayPolyfills: { - map: typeof Array.prototype.map; - forEach: typeof Array.prototype.forEach; - indexOf: typeof Array.prototype.indexOf; - }; - /** An ArrayProxy wraps any other object that implements Ember.Array and/or Ember.MutableArray, forwarding all requests. This makes it very useful for a number of binding use cases or other cases where being able to swap out the underlying array is useful. @@ -741,12 +697,11 @@ declare namespace Ember { copy(): Binding; disconnect(obj: any): Binding; from(path: string): Binding; - static oneWay(from: string, flag?: boolean): Binding; to(path: string): Binding; to(pathTuple: any[]): Binding; toString(): string; } - class Button extends View implements TargetActionSupport { + class Button extends Component implements TargetActionSupport { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** @@ -767,7 +722,7 @@ declare namespace Ember { The internal class used to create text inputs when the {{input}} helper is used with type of checkbox. See Handlebars.helpers.input for usage details. **/ - class Checkbox extends View { + class Checkbox extends Component { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** @@ -784,23 +739,6 @@ declare namespace Ember { static isMethod: boolean; } /** - An Ember.View descendent responsible for managing a collection (an array or array-like object) - by maintaining a child view object and associated DOM representation for each item in the array - and ensuring that child views and their associated rendered HTML are updated when items in the - array are added, removed, or replaced. - **/ - class CollectionView extends ContainerView { - arrayDidChange(content: any[], start: number, removed: number, added: number): void; - arrayWillChange(content: any[], start: number, removed: number): void; - createChildView(viewClass: {}, attrs?: {}): CollectionView; - destroy(): CollectionView; - init(): void; - static CONTAINER_MAP: {}; - content: any[]; - emptyView: View; - itemViewClass: View; - } - /** Implements some standard methods for comparing objects. Add this mixin to any class you create that can compare its instances. **/ @@ -812,7 +750,7 @@ declare namespace Ember { and actions are targeted at the view object. There is no access to the surrounding context or outer controller; all contextual information is passed in. **/ - class Component extends View { + class Component { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** @@ -837,7 +775,6 @@ declare namespace Ember { This will force the cached result to be recomputed if the dependencies are modified. **/ class ComputedProperty { - cacheable(aFlag?: boolean): ComputedProperty; get(keyName: string): any; meta(meta: {}): ComputedProperty; property(...args: string[]): ComputedProperty; @@ -863,42 +800,13 @@ declare namespace Ember { @param fullName type:name (e.g., 'model:user') @param factory (e.g., App.Person) **/ - register(fullName: string, factory: Function, options?: {}): void; - unregister(fullName: string): void; - resolve(fullName: string): Function; describe(fullName: string): string; - normalize(fullName: string): string; makeToString(factory: any, fullName: string): Function; lookup(fullName: string, options?: {}): any; lookupFactory(fullName: string): any; - has(fullName: string): boolean; - optionsForType(type: string, options: {}): void; - options(type: string, options: {}): void; - injection(factoryName: string, property: string, injectionName: string): void; - factoryInjection(factoryName: string, property: string, injectionName: string): void; destroy(): void; reset(): void; } - /** - An Ember.View subclass that implements Ember.MutableArray allowing programatic - management of its child views. - **/ - class ContainerView extends View { - static detect(obj: any): boolean; - static detectInstance(obj: any): boolean; - /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ - static eachComputedProperty(callback: Function, binding: {}): void; - /** - Returns the original hash that was passed to meta(). - @param key property name - **/ - static metaForProperty(key: string): {}; - static isClass: boolean; - static isMethod: boolean; - } class Controller extends Object implements ControllerMixin { replaceRoute(name: string, ...args: any[]): void; transitionToRoute(name: string, ...args: any[]): void; @@ -1077,30 +985,6 @@ declare namespace Ember { **/ static eachComputedProperty(callback: Function, binding: {}): void; } - /** - An abstract class that exists to give view-like behavior to both Ember's main view class Ember.View - and other classes like Ember._SimpleMetamorphView that don't need the fully functionaltiy of Ember.View. - Unless you have specific needs for CoreView, you will use Ember.View in your applications. - **/ - class CoreView extends Object implements ActionHandlerMixin { - static detect(obj: any): boolean; - static detectInstance(obj: any): boolean; - /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ - static eachComputedProperty(callback: Function, binding: {}): void; - /** - Returns the original hash that was passed to meta(). - @param key property name - **/ - static metaForProperty(key: string): {}; - static isClass: boolean; - static isMethod: boolean; - send(name: string, ...args: any[]): void; - actions: ActionsHash; - parentView: CoreView; - } class DAG { add(name: string): any; map(name: string, value: any): void; @@ -1122,16 +1006,6 @@ declare namespace Ember { resolve(fullName: string): {}; namespace: Application; } - class Deferred { - reject(value: any): void; - resolve(value: any): void; - then(resolve: Function, reject: Function): void; - } - class DeferredMixin extends Mixin { - reject(value: any): void; - resolve(value: any): void; - then(resolve: Function, reject: Function): void; - } /** Objects of this type can implement an interface to respond to requests to get and set. The default implementation handles simple properties. @@ -1215,7 +1089,6 @@ declare namespace Ember { hasEnumerableObservers: boolean; lastObject: any; } - var EnumerableUtils: {}; // TODO: define interface /** A subclass of the JavaScript Error object for use in Ember. **/ @@ -1262,38 +1135,9 @@ declare namespace Ember { var GUID_KEY: string; namespace Handlebars { function compile(string: string): Function; - function get(root: any, path: string, options?: {}): any; - function helper(name: string, func: Function, dependentKeys?: string): void; - function helper(name: string, view: View, dependentKeys?: string): void; - class helpers { - action(actionName: string, context: any, options?: {}): void; - bindAttr(options?: {}): string; - connectOutlet(outletName: string, view: {}): void; - control(path: string, modelPath: string, options?: {}): string; - debugger(property: string): void; - disconnectOutlet(outletName: string): void; - each(name: string, path: string, options?: {}): void; - if(context: Function, options?: {}): string; - init(): void; - input(options?: {}): void; - linkTo(routeName: string, context: any, options?: {}): string; - loc(str: string): void; - log(property: string): void; - outlet(property: string): string; - partial(partialName: string): void; - render(name: string, context?: string, options?: {}): string; - textarea(options?: {}): void; - unbound(property: string): string; - unless(context: Function, options?: {}): string; - view(path: string, options?: {}): string; - with(context: Function, options?: {}): string; - yield(options?: {}): string; - } function precompile(string: string): void; - function registerBoundHelper(name: string, func: Function, dependentKeys?: string): void; class Compiler { } class JavaScriptCompiler { } - function registerHelper(name: string, fn: Function, inverse?: boolean): void; function registerPartial(name: string, str: any): void; function K(): any; function createFrame(objec: any): any; @@ -1354,38 +1198,6 @@ declare namespace Ember { var LOG_BINDINGS: boolean; var LOG_STACKTRACE_ON_DEPRECATION: boolean; var LOG_VERSION: boolean; - class LinkView extends View { - static detect(obj: any): boolean; - static detectInstance(obj: any): boolean; - /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ - static eachComputedProperty(callback: Function, binding: {}): void; - /** - Returns the original hash that was passed to meta(). - @param key property name - **/ - static metaForProperty(key: string): {}; - static isClass: boolean; - static isMethod: boolean; - init(): void; - active: any; - activeClass: string; - attributeBindings: any; - classNameBindings: string[]; - disabled: any; - disabledClass: string; - eventName: string; - href: any; - loading: any; - loadingClass: string; - loadingHref: string; - rel: any; - replace: boolean; - title: any; - click: Function; - } class Location { create(options?: {}): any; registerImplementation(name: string, implementation: any): void; @@ -1406,7 +1218,6 @@ declare namespace Ember { forEach(callback: Function, self: any): void; get(key: any): any; has(key: any): boolean; - remove(key: any): boolean; set(key: any, value: any): void; length: number; } @@ -1714,17 +1525,6 @@ declare namespace Ember { setProperties(hash: {}): Observable; toggleProperty(keyName: string): any; } - class ObjectController extends ObjectProxy implements ControllerMixin { - replaceRoute(name: string, ...args: any[]): void; - transitionToRoute(name: string, ...args: any[]): void; - controllers: Object; - needs: string[]; - target: any; - model: any; - queryParams: any; - send(name: string, ...args: any[]): void; - actions: {}; - } class ObjectProxy extends Object { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; @@ -1777,7 +1577,6 @@ declare namespace Ember { forEach(fn: Function, self: any): void; has(obj: any): boolean; isEmpty(): boolean; - remove(obj: any): void; toArray(): any[]; } @@ -1846,25 +1645,6 @@ declare namespace Ember { finally(callback: Function, label?: string): Promise; } } - class RenderBuffer { - addClass(className: string): RenderBuffer; - attr(name: string, value: any): any; - element(): HTMLElement; - id(id: string): RenderBuffer; - prop(name: string, value: string): any; - push(string: string): RenderBuffer; - removeAttr(name: string): RenderBuffer; - removeProp(name: string): RenderBuffer; - string(): string; - style(name: string, value: string): RenderBuffer; - classes: any[]; - elementAttributes: {}; - elementId: string; - elementProperties: {}; - elementStyle: {}; - elementTag: string; - parentBuffer: RenderBuffer; - } /** The `Ember.Route` class is used to define individual routes. Refer to @@ -2414,7 +2194,7 @@ declare namespace Ember { } var SHIM_ES5: boolean; var STRINGS: boolean; - class Select extends View { + class SelectOption extends Component { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** @@ -2429,151 +2209,6 @@ declare namespace Ember { static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; - content: any[]; - groupView: View; - multiple: boolean; - optionGroupPath: string; - optionLabelPath: string; - optionValuePath: string; - optionView: View; - prompt: string; - selection: any; - value: string; - } - class SelectOption extends View { - static detect(obj: any): boolean; - static detectInstance(obj: any): boolean; - /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ - static eachComputedProperty(callback: Function, binding: {}): void; - /** - Returns the original hash that was passed to meta(). - @param key property name - **/ - static metaForProperty(key: string): {}; - static isClass: boolean; - static isMethod: boolean; - } - class Set extends CoreObject implements MutableEnumberable, Copyable, Freezable { - addEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): Set; - addObject(object: any): any; - addObjects(objects: Enumerable): Set; - any(callback: Function, target?: any): boolean; - anyBy(key: string, value?: string): boolean; - someProperty(key: string, value?: string): boolean; - compact(): any[]; - contains(obj: any): boolean; - enumerableContentDidChange(start: number, removing: number, adding: number): any; - enumerableContentDidChange(start: number, removing: Enumerable, adding: number): any; - enumerableContentDidChange(start: number, removing: number, adding: Enumerable): any; - enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable): any; - enumerableContentDidChange(removing: number, adding: number): any; - enumerableContentDidChange(removing: Enumerable, adding: number): any; - enumerableContentDidChange(removing: number, adding: Enumerable): any; - enumerableContentDidChange(removing: Enumerable, adding: Enumerable): any; - enumerableContentWillChange(removing: number, adding: number): Set; - enumerableContentWillChange(removing: Enumerable, adding: number): Set; - enumerableContentWillChange(removing: number, adding: Enumerable): Set; - enumerableContentWillChange(removing: Enumerable, adding: Enumerable): Set; - every(callback: Function, target?: any): boolean; - everyBy(key: string, value?: string): boolean; - everyProperty(key: string, value?: string): boolean; - filter(callback: Function, target: any): any[]; - filterBy(key: string, value?: string): any[]; - find(callback: Function, target: any): any; - findBy(key: string, value?: string): any; - forEach(callback: Function, target?: any): any; - getEach(key: string): any[]; - invoke(methodName: string, ...args: any[]): any[]; - map: ItemIndexEnumerableCallbackTarget; - mapBy(key: string): any[]; - nextObject(index: number, previousObject: any, context: any): any; - reduce(callback: ReduceCallback, initialValue: any, reducerProperty: string): any; - reject: ItemIndexEnumerableCallbackTarget; - rejectBy(key: string, value?: string): any[]; - removeEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): Set; - removeObject(object: any): any; - removeObjects(objects: Enumerable): Set; - setEach(key: string, value?: any): any; - some(callback: Function, target?: any): boolean; - toArray(): any[]; - uniq(): Set; - without(value: any): Set; - '[]': any[]; - firstObject: any; - hasEnumerableObservers: boolean; - lastObject: any; - copy(deep: boolean): Set; - frozenCopy(): Set; - freeze(): Set; - isFrozen: boolean; - add(obj: any): Set; - addEach(...args: any[]): Set; - clear(): Set; - isEqual(obj: Set): boolean; - pop(): any; - push(obj: any): Set; - remove(obj: any): Set; - removeEach(...args: any[]): Set; - shift(): any; - unshift(obj: any): Set; - length: number; - } - class SortableMixin implements MutableEnumberable { - addEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): Enumerable; - addObject(object: any): any; - addObjects(objects: Enumerable): MutableEnumberable; - any(callback: Function, target?: any): boolean; - anyBy(key: string, value?: string): boolean; - someProperty(key: string, value?: string): boolean; - compact(): any[]; - contains(obj: any): boolean; - enumerableContentDidChange(start: number, removing: number, adding: number): any; - enumerableContentDidChange(start: number, removing: Enumerable, adding: number): any; - enumerableContentDidChange(start: number, removing: number, adding: Enumerable): any; - enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable): any; - enumerableContentDidChange(removing: number, adding: number): any; - enumerableContentDidChange(removing: Enumerable, adding: number): any; - enumerableContentDidChange(removing: number, adding: Enumerable): any; - enumerableContentDidChange(removing: Enumerable, adding: Enumerable): any; - enumerableContentWillChange(removing: number, adding: number): Enumerable; - enumerableContentWillChange(removing: Enumerable, adding: number): Enumerable; - enumerableContentWillChange(removing: number, adding: Enumerable): Enumerable; - enumerableContentWillChange(removing: Enumerable, adding: Enumerable): Enumerable; - every(callback: Function, target?: any): boolean; - everyBy(key: string, value?: string): boolean; - everyProperty(key: string, value?: string): boolean; - filter(callback: Function, target: any): any[]; - filterBy(key: string, value?: string): any[]; - find(callback: Function, target: any): any; - findBy(key: string, value?: string): any; - forEach(callback: Function, target?: any): any; - getEach(key: string): any[]; - invoke(methodName: string, ...args: any[]): any[]; - map: ItemIndexEnumerableCallbackTarget; - mapBy(key: string): any[]; - nextObject(index: number, previousObject: any, context: any): any; - reduce(callback: ReduceCallback, initialValue: any, reducerProperty: string): any; - reject: ItemIndexEnumerableCallbackTarget; - rejectBy(key: string, value?: string): any[]; - removeEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): Enumerable; - removeObject(object: any): any; - removeObjects(objects: Enumerable): MutableEnumberable; - setEach(key: string, value?: any): any; - some(callback: Function, target?: any): boolean; - toArray(): any[]; - uniq(): Enumerable; - without(value: any): Enumerable; - '[]': any[]; - arrangedContent: any; - firstObject: any; - hasEnumerableObservers: boolean; - lastObject: any; - sortAscending: boolean; - sortFunction: Comparable; - sortProperties: any[]; } class State extends Object implements Evented { static detect(obj: any): boolean; @@ -2675,7 +2310,7 @@ declare namespace Ember { static adapter: Object; testHelpers: {}; } - class TextArea extends View implements TextSupport { + class TextArea extends Component implements TextSupport { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** @@ -2699,7 +2334,7 @@ declare namespace Ember { bubbles: boolean; onEvent: string; } - class TextField extends View implements TextSupport { + class TextField extends Component implements TextSupport { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** @@ -2738,76 +2373,11 @@ declare namespace Ember { onEvent: string; } var VERSION: string; - class View extends CoreView { - static detect(obj: any): boolean; - static detectInstance(obj: any): boolean; - /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ - static eachComputedProperty(callback: Function, binding: {}): void; - /** - Returns the original hash that was passed to meta(). - @param key property name - **/ - static metaForProperty(key: string): {}; - static isClass: boolean; - static isMethod: boolean; - $(): JQuery; - append(): View; - // ReSharper disable InconsistentNaming - appendTo(A: string): View; - appendTo(A: HTMLElement): View; - appendTo(A: JQuery): View; - // ReSharper restore InconsistentNaming - createChildView(viewClass: {}, attrs?: {}): View; - createChildView(viewClass: string, attrs?: {}): View; - createElement(): View; - destroy(): View; - destroyElement(): View; - findElementInParentElement(parentElement: HTMLElement): HTMLElement; - remove(): View; - removeAllChildren(): View; - removeChild(view: View): View; - removeFromParent(): View; - render(buffer: RenderBuffer): void; - // ReSharper disable InconsistentNaming - replaceIn(A: string): View; - replaceIn(A: HTMLElement): View; - replaceIn(A: JQuery): View; - // ReSharper restore InconsistentNaming - rerender(): void; - ariaRole: string; - attributeBindings: any; - classNameBindings: string[]; - classNames: string[]; - context: any; - controller: any; - element: HTMLElement; - isView: boolean; - isVisible: boolean; - layout: Function; - layoutName: string; - nearestChildOf: View; - nearestOfType: View; - nearestWithProperty: View; - tagName: string; - template: Function; - templateName: string; - templates: {}; - views: {}; - didInsertElement: Function; - parentViewDidChange: Function; - willClearRender: Function; - willDestroyElement: Function; - willInsertElement: Function; - } class ViewTargetActionSupport extends Mixin { target: any; actionContext: any; } var ViewUtils: {}; // TODO: define interface - function addBeforeObserver(obj: any, path: string, target: any, method: Function): any; function addListener(obj: any, eventName: string, target: any, method: Function, once?: boolean): void; function addListener(obj: any, eventName: string, target: any, method: string, once?: boolean): void; function addListener(obj: any, eventName: string, func: Function, method: Function, once?: boolean): void; @@ -2820,8 +2390,6 @@ declare namespace Ember { function aliasMethod(methodName: string): Descriptor; var anyUnprocessedMixins: boolean; function assert(desc: string, test: boolean): void; - function beforeObserver(func: Function, propertyName: string): Function; - function beforeObserversFor(obj: any, path: string): string[]; function beginPropertyChanges(): void; function bind(obj: any, to: string, from: string): Binding; function cacheFor(obj: any, key: string): any; @@ -2878,7 +2446,6 @@ declare namespace Ember { function generateController(container: Container, controllerName: string, context: any): Controller; function generateGuid(obj: any, prefix?: string): string; function get(obj: any, keyName: string): any; - function getMeta(obj: any, property: string): any; /** getPath is deprecated since get now supports paths. **/ @@ -2909,7 +2476,6 @@ declare namespace Ember { function makeArray(obj: any): any[]; function merge(original: any, updates: any): any; function meta(obj: any, writable?: boolean): {}; - function metaPath(obj: any, path: string, writable?: boolean): any; function mixin(obj: any, ...args: any[]): any; /** Ember.none is deprecated. Please use Ember.isNone instead. @@ -2919,22 +2485,16 @@ declare namespace Ember { function observer(...args: any[]): Function; function observersFor(obj: any, path: string): any[]; function onLoad(name: string, callback: Function): void; - function oneWay(obj: any, to: string, from: string): Binding; var onError: Error; function overrideChains(obj: any, keyName: string, m: any): boolean; // ReSharper disable once DuplicatingLocalDeclaration var platform: { - addBeforeObserver: ModifyObserver; - addObserver: ModifyObserver; - defineProperty(obj: any, keyName: string, desc: {}): void; - removeBeforeObserver: ModifyObserver; - removeObserver: ModifyObserver; + defineProperty: boolean; hasPropertyAccessors: boolean; }; function propertyDidChange(obj: any, keyName: string): void; function propertyIsEnumerable(prop: string): boolean; function propertyWillChange(obj: any, keyName: string): void; - function removeBeforeObserver(obj: any, path: string, target: any, method: Function): any; function removeChainWatcher(obj: any, keyName: string, node: any): void; function removeListener(obj: any, eventName: string, target: any, method: Function): void; function removeListener(obj: any, eventName: string, target: any, method: string): void; @@ -2970,7 +2530,6 @@ declare namespace Ember { function runLoadHooks(name: string, object: any): void; function sendEvent(obj: any, eventName: string, params?: any[], actions?: any[]): boolean; function set(obj: any, keyName: string, value: any): any; - function setMeta(obj: any, property: string, value: any): void; /** setPath is deprecated since set now supports paths. **/ @@ -2980,7 +2539,6 @@ declare namespace Ember { function toLocaleString(): string; function toString(): string; function tryCatchFinally(tryable: Function, catchable: Function, finalizer: Function, binding?: any): any; - function tryFinally(tryable: Function, finalizer: Function, binding?: any): any; function tryInvoke(obj: any, methodName: string, args?: any[]): any; function trySet(obj: any, path: string, value: any): void; /** @@ -3012,36 +2570,28 @@ declare namespace Em { class ActionHandlerMixin extends Ember.ActionHandlerMixin { } class Application extends Ember.Application { } class Array extends Ember.Array { } - class ArrayController extends Ember.ArrayController { } - var ArrayPolyfills: typeof Ember.ArrayPolyfills; class ArrayProxy extends Ember.ArrayProxy { } var BOOTED: typeof Ember.BOOTED; class Binding extends Ember.Binding { } class Button extends Ember.Button { } class Checkbox extends Ember.Checkbox { } - class CollectionView extends Ember.CollectionView { } class Comparable extends Ember.Comparable { } class Component extends Ember.Component { } class ComputedProperty extends Ember.ComputedProperty { } class Container extends Ember.Container { } - class ContainerView extends Ember.ContainerView { } class Controller extends Ember.Controller { } class ControllerMixin extends Ember.ControllerMixin { } class Copyable extends Ember.Copyable { } class CoreObject extends Ember.CoreObject { } - class CoreView extends Ember.CoreView { } class DAG extends Ember.DAG { } var DEFAULT_GETTER_FUNCTION: typeof Ember.DEFAULT_GETTER_FUNCTION; class DefaultResolver extends Ember.DefaultResolver { } - class Deffered extends Ember.Deferred { } - class DeferredMixin extends Ember.DeferredMixin { } class Descriptor extends Ember.Descriptor { } var EMPTY_META: typeof Ember.EMPTY_META; var ENV: typeof Ember.ENV; var EXTEND_PROTOTYPES: typeof Ember.EXTEND_PROTOTYPES; class EachProxy extends Ember.EachProxy { } class Enumerable extends Ember.Enumerable { } - var EnumerableUtils: typeof Ember.EnumerableUtils; var Error: typeof Ember.Error; class EventDispatcher extends Ember.EventDispatcher { } class Evented extends Ember.Evented { } @@ -3050,14 +2600,9 @@ declare namespace Em { var GUID_KEY: typeof Ember.GUID_KEY; namespace Handlebars { var compile: typeof Ember.Handlebars.compile; - var get: typeof Ember.Handlebars.get; - var helper: typeof Ember.Handlebars.helper; - class helpers extends Ember.Handlebars.helpers { } var precompile: typeof Ember.Handlebars.precompile; - var registerBoundHelper: typeof Ember.Handlebars.registerBoundHelper; class Compiler extends Ember.Handlebars.Compiler { } class JavaScriptCompiler extends Ember.Handlebars.JavaScriptCompiler { } - var registerHelper: typeof Ember.Handlebars.registerHelper; var registerPartial: typeof Ember.Handlebars.registerPartial; var K: typeof Ember.Handlebars.K; var createFrame: typeof Ember.Handlebars.createFrame; @@ -3076,7 +2621,6 @@ declare namespace Em { var LOG_BINDINGS: typeof Ember.LOG_BINDINGS; var LOG_STACKTRACE_ON_DEPRECATION: typeof Ember.LOG_STACKTRACE_ON_DEPRECATION; var LOG_VERSION: typeof Ember.LOG_VERSION; - class LinkView extends Ember.LinkView { } class Location extends Ember.Location { } var Logger: typeof Ember.Logger; var MANDATORY_SETTER_FUNCTION: typeof Ember.MANDATORY_SETTER_FUNCTION; @@ -3092,7 +2636,6 @@ declare namespace Em { class NoneLocation extends Ember.NoneLocation { } var ORDER_DEFINITION: typeof Ember.ORDER_DEFINITION; class Object extends Ember.Object { } - class ObjectController extends Ember.ObjectController { } class ObjectProxy extends Ember.ObjectProxy { } class Observable extends Ember.Observable { } class OrderedSet extends Ember.OrderedSet { } @@ -3102,16 +2645,12 @@ declare namespace Em { interface PromiseResolverFunction extends Ember.RSVP.PromiseResolverFunction { } class Promise extends Ember.RSVP.Promise { } } - class RenderBuffer extends Ember.RenderBuffer { } class Route extends Ember.Route { } class Router extends Ember.Router { } class RouterDSL extends Ember.RouterDSL { } var SHIM_ES5: typeof Ember.SHIM_ES5; var STRINGS: typeof Ember.STRINGS; - class Select extends Ember.Select { } class SelectOption extends Ember.SelectOption { } - class Set extends Ember.Set { } - class SortableMixin extends Ember.SortableMixin { } class State extends Ember.State { } class StateManager extends Ember.StateManager { } namespace String { @@ -3133,18 +2672,14 @@ declare namespace Em { class TextField extends Ember.TextField { } class TextSupport extends Ember.TextSupport { } var VERSION: typeof Ember.VERSION; - class View extends Ember.View { } class ViewTargetActionSupport extends Ember.ViewTargetActionSupport { } var ViewUtils: typeof Ember.ViewUtils; - var addBeforeObserver: typeof Ember.addBeforeObserver; var addListener: typeof Ember.addListener; var addObserver: typeof Ember.addObserver; var alias: typeof Ember.alias; var aliasMethod: typeof Ember.aliasMethod; var anyUnprocessedMixins: typeof Ember.anyUnprocessedMixins; var assert: typeof Ember.assert; - var beforeObserver: typeof Ember.beforeObserver; - var beforeObserversFor: typeof Ember.beforeObserversFor; var beginPropertyChanges: typeof Ember.beginPropertyChanges; var bind: typeof Ember.bind; var cacheFor: typeof Ember.cacheFor; @@ -3169,7 +2704,6 @@ declare namespace Em { var generateController: typeof Ember.generateController; var generateGuid: typeof Ember.generateGuid; var get: typeof Ember.get; - var getMeta: typeof Ember.getMeta; var getPath: typeof Ember.getPath; var getWithDefault: typeof Ember.getWithDefault; var guidFor: typeof Ember.guidFor; @@ -3196,21 +2730,18 @@ declare namespace Em { var makeArray: typeof Ember.makeArray; var merge: typeof Ember.merge; var meta: typeof Ember.meta; - var metaPath: typeof Ember.metaPath; var mixin: typeof Ember.mixin; var none: typeof Ember.none; var normalizeTuple: typeof Ember.normalizeTuple; var observer: typeof Ember.observer; var observersFor: typeof Ember.observersFor; var onLoad: typeof Ember.onLoad; - var oneWay: typeof Ember.oneWay; var onError: typeof Ember.onError; var overrideChains: typeof Ember.overrideChains; var platform: typeof Ember.platform; var propertyDidChange: typeof Ember.propertyDidChange; var propertyIsEnumerable: typeof Ember.propertyIsEnumerable; var propertyWillChange: typeof Ember.propertyWillChange; - var removeBeforeObserver: typeof Ember.removeBeforeObserver; var removeChainWatcher: typeof Ember.removeChainWatcher; var removeListener: typeof Ember.removeListener; var removeObserver: typeof Ember.removeObserver; @@ -3220,14 +2751,12 @@ declare namespace Em { var runLoadHooks: typeof Ember.runLoadHooks; var sendEvent: typeof Ember.sendEvent; var set: typeof Ember.set; - var setMeta: typeof Ember.setMeta; var setPath: typeof Ember.setPath; var setProperties: typeof Ember.setProperties; var subscribe: typeof Ember.subscribe; var toLocaleString: typeof Ember.toLocaleString; var toString: typeof Ember.toString; var tryCatchFinally: typeof Ember.tryCatchFinally; - var tryFinally: typeof Ember.tryFinally; var tryInvoke: typeof Ember.tryInvoke; var trySet: typeof Ember.trySet; var trySetPath: typeof Ember.trySetPath; @@ -3256,36 +2785,28 @@ declare module "Ember" { class ActionHandlerMixin extends Ember.ActionHandlerMixin { } class Application extends Ember.Application { } class Array extends Ember.Array { } - class ArrayController extends Ember.ArrayController { } - var ArrayPolyfills: typeof Ember.ArrayPolyfills; class ArrayProxy extends Ember.ArrayProxy { } var BOOTED: typeof Ember.BOOTED; class Binding extends Ember.Binding { } class Button extends Ember.Button { } class Checkbox extends Ember.Checkbox { } - class CollectionView extends Ember.CollectionView { } class Comparable extends Ember.Comparable { } class Component extends Ember.Component { } class ComputedProperty extends Ember.ComputedProperty { } class Container extends Ember.Container { } - class ContainerView extends Ember.ContainerView { } class Controller extends Ember.Controller { } class ControllerMixin extends Ember.ControllerMixin { } class Copyable extends Ember.Copyable { } class CoreObject extends Ember.CoreObject { } - class CoreView extends Ember.CoreView { } class DAG extends Ember.DAG { } var DEFAULT_GETTER_FUNCTION: typeof Ember.DEFAULT_GETTER_FUNCTION; class DefaultResolver extends Ember.DefaultResolver { } - class Deffered extends Ember.Deferred { } - class DeferredMixin extends Ember.DeferredMixin { } class Descriptor extends Ember.Descriptor { } var EMPTY_META: typeof Ember.EMPTY_META; var ENV: typeof Ember.ENV; var EXTEND_PROTOTYPES: typeof Ember.EXTEND_PROTOTYPES; class EachProxy extends Ember.EachProxy { } class Enumerable extends Ember.Enumerable { } - var EnumerableUtils: typeof Ember.EnumerableUtils; var Error: typeof Ember.Error; class EventDispatcher extends Ember.EventDispatcher { } class Evented extends Ember.Evented { } @@ -3294,14 +2815,9 @@ declare module "Ember" { var GUID_KEY: typeof Ember.GUID_KEY; namespace Handlebars { var compile: typeof Ember.Handlebars.compile; - var get: typeof Ember.Handlebars.get; - var helper: typeof Ember.Handlebars.helper; - class helpers extends Ember.Handlebars.helpers { } var precompile: typeof Ember.Handlebars.precompile; - var registerBoundHelper: typeof Ember.Handlebars.registerBoundHelper; class Compiler extends Ember.Handlebars.Compiler { } class JavaScriptCompiler extends Ember.Handlebars.JavaScriptCompiler { } - var registerHelper: typeof Ember.Handlebars.registerHelper; var registerPartial: typeof Ember.Handlebars.registerPartial; var K: typeof Ember.Handlebars.K; var createFrame: typeof Ember.Handlebars.createFrame; @@ -3320,7 +2836,6 @@ declare module "Ember" { var LOG_BINDINGS: typeof Ember.LOG_BINDINGS; var LOG_STACKTRACE_ON_DEPRECATION: typeof Ember.LOG_STACKTRACE_ON_DEPRECATION; var LOG_VERSION: typeof Ember.LOG_VERSION; - class LinkView extends Ember.LinkView { } class Location extends Ember.Location { } var Logger: typeof Ember.Logger; var MANDATORY_SETTER_FUNCTION: typeof Ember.MANDATORY_SETTER_FUNCTION; @@ -3336,7 +2851,6 @@ declare module "Ember" { class NoneLocation extends Ember.NoneLocation { } var ORDER_DEFINITION: typeof Ember.ORDER_DEFINITION; class Object extends Ember.Object { } - class ObjectController extends Ember.ObjectController { } class ObjectProxy extends Ember.ObjectProxy { } class Observable extends Ember.Observable { } class OrderedSet extends Ember.OrderedSet { } @@ -3346,16 +2860,12 @@ declare module "Ember" { interface PromiseResolverFunction extends Ember.RSVP.PromiseResolverFunction { } class Promise extends Ember.RSVP.Promise { } } - class RenderBuffer extends Ember.RenderBuffer { } class Route extends Ember.Route { } class Router extends Ember.Router { } class RouterDSL extends Ember.RouterDSL { } var SHIM_ES5: typeof Ember.SHIM_ES5; var STRINGS: typeof Ember.STRINGS; - class Select extends Ember.Select { } class SelectOption extends Ember.SelectOption { } - class Set extends Ember.Set { } - class SortableMixin extends Ember.SortableMixin { } class State extends Ember.State { } class StateManager extends Ember.StateManager { } namespace String { @@ -3377,18 +2887,14 @@ declare module "Ember" { class TextField extends Ember.TextField { } class TextSupport extends Ember.TextSupport { } var VERSION: typeof Ember.VERSION; - class View extends Ember.View { } class ViewTargetActionSupport extends Ember.ViewTargetActionSupport { } var ViewUtils: typeof Ember.ViewUtils; - var addBeforeObserver: typeof Ember.addBeforeObserver; var addListener: typeof Ember.addListener; var addObserver: typeof Ember.addObserver; var alias: typeof Ember.alias; var aliasMethod: typeof Ember.aliasMethod; var anyUnprocessedMixins: typeof Ember.anyUnprocessedMixins; var assert: typeof Ember.assert; - var beforeObserver: typeof Ember.beforeObserver; - var beforeObserversFor: typeof Ember.beforeObserversFor; var beginPropertyChanges: typeof Ember.beginPropertyChanges; var bind: typeof Ember.bind; var cacheFor: typeof Ember.cacheFor; @@ -3413,7 +2919,6 @@ declare module "Ember" { var generateController: typeof Ember.generateController; var generateGuid: typeof Ember.generateGuid; var get: typeof Ember.get; - var getMeta: typeof Ember.getMeta; var getPath: typeof Ember.getPath; var getWithDefault: typeof Ember.getWithDefault; var guidFor: typeof Ember.guidFor; @@ -3440,21 +2945,18 @@ declare module "Ember" { var makeArray: typeof Ember.makeArray; var merge: typeof Ember.merge; var meta: typeof Ember.meta; - var metaPath: typeof Ember.metaPath; var mixin: typeof Ember.mixin; var none: typeof Ember.none; var normalizeTuple: typeof Ember.normalizeTuple; var observer: typeof Ember.observer; var observersFor: typeof Ember.observersFor; var onLoad: typeof Ember.onLoad; - var oneWay: typeof Ember.oneWay; var onError: typeof Ember.onError; var overrideChains: typeof Ember.overrideChains; var platform: typeof Ember.platform; var propertyDidChange: typeof Ember.propertyDidChange; var propertyIsEnumerable: typeof Ember.propertyIsEnumerable; var propertyWillChange: typeof Ember.propertyWillChange; - var removeBeforeObserver: typeof Ember.removeBeforeObserver; var removeChainWatcher: typeof Ember.removeChainWatcher; var removeListener: typeof Ember.removeListener; var removeObserver: typeof Ember.removeObserver; @@ -3464,14 +2966,12 @@ declare module "Ember" { var runLoadHooks: typeof Ember.runLoadHooks; var sendEvent: typeof Ember.sendEvent; var set: typeof Ember.set; - var setMeta: typeof Ember.setMeta; var setPath: typeof Ember.setPath; var setProperties: typeof Ember.setProperties; var subscribe: typeof Ember.subscribe; var toLocaleString: typeof Ember.toLocaleString; var toString: typeof Ember.toString; var tryCatchFinally: typeof Ember.tryCatchFinally; - var tryFinally: typeof Ember.tryFinally; var tryInvoke: typeof Ember.tryInvoke; var trySet: typeof Ember.trySet; var trySetPath: typeof Ember.trySetPath; diff --git a/express-serve-static-core/index.d.ts b/express-serve-static-core/index.d.ts index a235a66d66..50b62b6445 100644 --- a/express-serve-static-core/index.d.ts +++ b/express-serve-static-core/index.d.ts @@ -782,6 +782,15 @@ declare module "express-serve-static-core" { locals: any; charset: string; + + /** + * Adds the field to the Vary response header, if it is not there already. + * Examples: + * + * res.vary('User-Agent').render('docs'); + * + */ + vary(field: string): Response; } interface NextFunction { diff --git a/gl-matrix/gl-matrix-tests.ts b/gl-matrix/gl-matrix-tests.ts index 70d2556ded..cec5812e7d 100644 --- a/gl-matrix/gl-matrix-tests.ts +++ b/gl-matrix/gl-matrix-tests.ts @@ -308,6 +308,11 @@ q = [0, 0, 0, 1]; out = mat4.fromRotationTranslation(out, q, [1, 2, 3]); out = mat4.fromQuat(out, q); +q = [0, 0, 0, 1]; +out = mat4.fromRotationTranslationScale(out, q, [1, 2, 3], [1, 2, 3]); +out = mat4.fromQuat(out, q); + + // quat var quatA = [1, 2, 3, 4]; var quatB = [5, 6, 7, 8]; diff --git a/gl-matrix/index.d.ts b/gl-matrix/index.d.ts index b5dcdf3f1d..16366f263a 100644 --- a/gl-matrix/index.d.ts +++ b/gl-matrix/index.d.ts @@ -1828,8 +1828,27 @@ declare namespace mat4 { * @param v Translation vector * @returns out */ - export function fromRotationTranslation(out: GLM.IArray, q: GLM.IArray, - v: GLM.IArray): GLM.IArray; + export function fromRotationTranslation(out: GLM.IArray, q: GLM.IArray, v: GLM.IArray): GLM.IArray; + + /** + * Creates a matrix from a quaternion rotation, vector translation and vector scale. + * + * This is equivalent to (but much faster than): + * + * mat4.identity(dest); + * mat4.translate(dest, vec); + * var quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * mat4.scale(dest, scale) + * + * @param out mat4 receiving operation result + * @param q Rotation quaternion + * @param v Translation vector + * @param s Scale vector + * @returns out + */ + export function fromRotationTranslationScale(out: GLM.IArray, q: GLM.IArray, v: GLM.IArray, s: GLM.IArray): GLM.IArray /** * Creates a matrix from a quaternion diff --git a/google-libphonenumber/google-libphonenumber-tests.ts b/google-libphonenumber/google-libphonenumber-tests.ts new file mode 100644 index 0000000000..0768f0f7a9 --- /dev/null +++ b/google-libphonenumber/google-libphonenumber-tests.ts @@ -0,0 +1,36 @@ +/// + +import libphonenumber = require('google-libphonenumber'); +import {PhoneNumberFormat, PhoneNumberUtil, AsYouTypeFormatter} from 'google-libphonenumber'; + +() => { + // Require `PhoneNumberFormat`. + var PNF = libphonenumber.PhoneNumberFormat; + + // Get an instance of `PhoneNumberUtil`. + var phoneUtil = libphonenumber.PhoneNumberUtil.getInstance(); + + // Parse number with country code. + var phoneNumber = phoneUtil.parse('202-456-1414', 'US'); + + // Print number in the international format. + console.log(phoneUtil.format(phoneNumber, PNF.INTERNATIONAL)); + // => +1 202-456-1414 +} + +() => { + // Require `AsYouTypeFormatter`. + var AsYouTypeFormatter = libphonenumber.AsYouTypeFormatter; + var formatter = new AsYouTypeFormatter('US'); + + console.log(formatter.inputDigit('6')); // => 6 + console.log(formatter.inputDigit('5')); // => 65 + console.log(formatter.inputDigit('0')); // => 650 + console.log(formatter.inputDigit('2')); // => 650-2 + console.log(formatter.inputDigit('5')); // => 650-25 + console.log(formatter.inputDigit('3')); // => 650-253 + console.log(formatter.inputDigit('2')); // => 650-2532 + console.log(formatter.inputDigit('2')); // => (650) 253-22 + + formatter.clear(); +} diff --git a/google-libphonenumber/google-libphonenumber.d.ts b/google-libphonenumber/google-libphonenumber.d.ts new file mode 100644 index 0000000000..fea36d9675 --- /dev/null +++ b/google-libphonenumber/google-libphonenumber.d.ts @@ -0,0 +1,38 @@ +// Type definitions for libphonenumber v7.4.3 +// Project: https://github.com/googlei18n/libphonenumber +// Project: https://github.com/seegno/google-libphonenumber +// Definitions by: Leon Yu +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace libphonenumber { + export enum PhoneNumberFormat { + E164, + INTERNATIONAL, + NATIONAL, + RFC3966 + } + + interface PhoneNumber { + } + + export class PhoneNumberUtil { + static getInstance(): PhoneNumberUtil + parse(number: string, region: string): PhoneNumber; + isValidNumber(phoneNumber: PhoneNumber): boolean; + isValidNumberForRegion(phoneNumber: PhoneNumber): boolean; + getRegionCodeForNumber(phoneNumber: PhoneNumber): string; + isNANPACountry(regionCode: string): boolean; + format(phoneNumber: PhoneNumber, format: PhoneNumberFormat): string; + } + + export class AsYouTypeFormatter { + constructor(region: string); + inputDigit(digit: string): string; + clear(): void; + } +} + + +declare module 'google-libphonenumber' { + export = libphonenumber; +} diff --git a/gregorian-calendar/gregorian-calendar-tests.ts b/gregorian-calendar/gregorian-calendar-tests.ts new file mode 100644 index 0000000000..d364e00fd2 --- /dev/null +++ b/gregorian-calendar/gregorian-calendar-tests.ts @@ -0,0 +1,14 @@ +/// + +import GregorianCalendar = require('gregorian-calendar'); +import GregorianCalendarFormat = require('gregorian-calendar-format'); + + +let cal = new GregorianCalendar(); +cal.set(2016, 7, 27, 0, 0, 0, 0); + +let fmt = new GregorianCalendarFormat('yyyy-MM'); + +let calAsStr = fmt.format(cal); +console.log(calAsStr); + diff --git a/gregorian-calendar/gregorian-calendar.d.ts b/gregorian-calendar/gregorian-calendar.d.ts new file mode 100644 index 0000000000..0bb2ffa934 --- /dev/null +++ b/gregorian-calendar/gregorian-calendar.d.ts @@ -0,0 +1,274 @@ +// Type definitions for gregorian-calendar v4.1.4 +// Project: https://github.com/yiminghe/gregorian-calendar +// Definitions by: Charlie Arnold +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + + +declare module 'gregorian-calendar' { + + class GregorianCalendar { + + constructor(locale?: Object); + + /** + * same as call setYear, setMonth, setDayOfMonth .... + */ + set(year: Number, month: Number, dayOfMonth: Number, + hourOfDay: Number, minutes: Number, seconds: Number, + milliseconds: Number): void; + + /** + * set absolute time for current instance + */ + setTime(time: Number): void; + + /** + * get absolute time for current instance + */ + getTime(): Number; + + /** + * set current date instance's timezone offset (in minutes) + */ + setTimezoneOffset(timezoneOffset: Number): void + + /** + * current date instance's timezone offset (in minutes) + */ + getTimezoneOffset(): Number; + + /** + * set the year of the given calendar field. + */ + setYear(year: Number): void; + + /** + * Returns the year of the given calendar field. + */ + getYear(): Number; + + /** + * set the month of the given calendar field. January is 0, you can use enum + */ + setMonth(month: Number): void; + + /** + * set the month of the given calendar field without influence month. + * 2015-09-29 -> setMonth(2) -> 2015-03-01 + * 2015-09-29 -> rollSetMonth(2) -> 2015-02-28 + */ + rollSetMonth(month: Number): void; + + /** + * Returns the month of the given calendar field. + */ + getMonth(): Number; + + /** + * set the day of month of the given calendar field. + */ + setDayOfMonth(day: Number): void; + + /** + * Returns the day of month of the given calendar field. + */ + getDayOfMonth(): Number; + + + /** + * set the hour of day for the given calendar field. + */ + setHourOfDay(hour: Number): void; + + /** + * Returns the hour of day for the given calendar field. + */ + getHourOfDay(): Number + + /** + * set the minute of the given calendar field. + */ + setMinutes(minute: Number): void; + + /** + * Returns the minute of the given calendar field. + */ + getMinutes(): Number; + + /** + * set the second of the given calendar field. + */ + setSeconds(second: Number): void; + + /** + * Returns the second of the given calendar field. + */ + getSeconds(): Number; + + /** + * set the millisecond of the given calendar field. + */ + setMilliSeconds(second: Number): void; + + /** + * Returns the millisecond of the given calendar field. + */ + getMilliSeconds(): Number; + + /** + * Returns the week of year of the given calendar field. + */ + getWeekOfYear(): Number; + + /** + * Returns the week of month of the given calendar field. + */ + getWeekOfMonth(): Number; + + /** + * Returns the day of year of the given calendar field. + */ + getDayOfYear(): Number; + + /** + * Returns the day of week of the given calendar field. sunday is 0, monday is 1 + */ + getDayOfWeek(): Number; + + /** + * Returns the day of week in month of the given calendar field. + */ + getDayOfWeekInMonth(): Number; + + /** + * add the year of the given calendar field. + */ + addYear(amount: Number): void; + + /** + * add the month of the given calendar field. + */ + addMonth(amount: Number): void; + + /** + * add the day of month of the given calendar field. + */ + addDayOfMonth(amount: Number): void; + + /** + * add the hour of day of the given calendar field. + */ + addHourOfDay(amount: Number): void; + + /** + * add the minute of the given calendar field. + */ + addMinute(amount: Number): void; + + /** + * add the second of the given calendar field. + */ + addSecond(amount: Number): void; + + /** + * add the millisecond of the given calendar field. + */ + addMilliSecond(amount: Number): void; + + /** + * Returns the week number of year represented by this GregorianCalendar. + */ + getWeekYear(): Number; + + /** + * Sets this GregorianCalendar to the date given by the date specifiers - weekYear, weekOfYear, and dayOfWeek. + * weekOfYear follows the WEEK_OF_YEAR numbering. + * The dayOfWeek value must be one of the DAY_OF_WEEK values: SUNDAY to SATURDAY. + * weekYear: the week year + * weekOfYear: the week number based on weekYear + * dayOfWeek: the day of week value + */ + setWeekDate(weekYear: Number, weekOfYear: Number, dayOfWeek: Number): void; + + /** + * Returns the number of weeks in the week year + */ + getWeeksInWeekYear(): Number; + + /** + * Returns a clone of current instance + */ + clone(): GregorianCalendar; + + equals(other: GregorianCalendar): boolean; + + /** + * compare this object and other by day. return -1 0 or 1 + */ + compareToDay(other: GregorianCalendar): Number; + + /** + * clear all field of current instance + */ + clear(): void; + } + + export = GregorianCalendar; +} + +declare module 'gregorian-calendar-format' { + + import GregorianCalendar = require('gregorian-calendar'); + + enum DateTimeStyle { + /** + * full style + */ + FULL = 0, + /** + * long style + */ + LONG, + /** + * medium style + */ + MEDIUM, + /** + * short style + */ + SHORT, + } + + class DateTimeFormat { + + public Style: DateTimeStyle; + + /** + * @param pattern The format pattern string + * @param locale The local of to output (defaults to require('gregorian-calendar/lib/locale/en_US'), + * may also be one of: + * require('gregorian-calendar/lib/locale/zh_CN') + * require('gregorian-calendar/lib/locale/ru_RU') + */ + constructor(pattern: string, locale?: Object); + + /** + * format an instance of GregorianCalendar according to pattern + */ + format(calendar: GregorianCalendar): String; + + /** + * parse a dateString to an instance of GregorianCalendar according to pattern, it's better to specify calendarLocale, such as + * `df.parse('2013-11-12', {locale: require('gregorian-calendar/lib/locale/zh_CN'}));` + */ + parse(dateString: String, {locale: Object}): GregorianCalendar; + + /** + * get a predefine GregorianCalendarFormat instance + */ + getDateTimeInstance(dateStyle: DateTimeStyle, timeStyle: DateTimeStyle, locale?: Object): DateTimeFormat; + } + + export = DateTimeFormat; +} + diff --git a/java/index.d.ts b/java/index.d.ts index 264a9cdc48..46dc577e35 100644 --- a/java/index.d.ts +++ b/java/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for java 0.5.4 +// Type definitions for java 0.7.2 // Project: https://github.com/joeferner/node-java -// Definitions by: Jim Lloyd +// Definitions by: Jim Lloyd , Kentaro Teramoto // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -34,16 +34,26 @@ declare namespace NodeJavaCore { // *NodeAPI* declares methods & members exported by the node java module. interface NodeAPI { classpath: string[]; + options: string[]; asyncOptions: AsyncOptions; + nativeBindingLocation: string; + callMethod(instance: any, className: string, methodName: string, args: any[], callback: Callback): void; callMethodSync(instance: any, className: string, methodName: string, ...args: any[]): any; + callStaticMethod(className: string, methodName: string, ...args: Array>): void; callStaticMethodSync(className: string, methodName: string, ...args: any[]): any; + getStaticFieldValue(className: string, fieldName: string): any; + setStaticFieldValue(className: string, fieldName: string, newValue: any): void; instanceOf(javaObject: any, className: string): boolean; registerClient(before: (cb: Callback) => void, after?: (cb: Callback) => void): void; registerClientP(beforeP: () => Promise, afterP?: () => Promise): void; ensureJvm(done: Callback): void; ensureJvm(): Promise; + isJvmCreated(): boolean; + newByte(val: number): any; + newChar(val: string|number): any; + newDouble(val: number): any; newShort(val: number): any; newLong(val: number): any; newFloat(val: number): any; diff --git a/jquery/index.d.ts b/jquery/index.d.ts index 866d0de076..5dc88bf795 100644 --- a/jquery/index.d.ts +++ b/jquery/index.d.ts @@ -1024,7 +1024,7 @@ interface JQueryStatic { * @param func The function to process each item against. The first argument to the function is the item, and the second argument is the index. The function should return a Boolean value. this will be the global window object. * @param invert If "invert" is false, or not provided, then the function returns an array consisting of all elements for which "callback" returns true. If "invert" is true, then the function returns an array consisting of all elements for which "callback" returns false. */ - grep(array: T[], func: (elementOfArray: T, indexInArray: number) => boolean, invert?: boolean): T[]; + grep(array: T[], func: (elementOfArray?: T, indexInArray?: number) => boolean, invert?: boolean): T[]; /** * Search for a specified value within an array and return its index (or -1 if not found). @@ -1091,14 +1091,14 @@ interface JQueryStatic { * @param array The Array to translate. * @param callback The function to process each item against. The first argument to the function is the array item, the second argument is the index in array The function can return any value. Within the function, this refers to the global (window) object. */ - map(array: T[], callback: (elementOfArray: T, indexInArray: number) => U): U[]; + map(array: T[], callback: (elementOfArray?: T, indexInArray?: number) => U): U[]; /** * Translate all items in an array or object to new array of items. * * @param arrayOrObject The Array or Object to translate. * @param callback The function to process each item against. The first argument to the function is the value; the second argument is the index or key of the array or object property. The function can return any value to add to the array. A returned array will be flattened into the resulting array. Within the function, this refers to the global (window) object. */ - map(arrayOrObject: any, callback: (value: any, indexOrKey: any) => any): any; + map(arrayOrObject: any, callback: (value?: any, indexOrKey?: any) => any): any; /** * Merge the contents of two arrays together into the first array. diff --git a/leaflet/index.d.ts b/leaflet/index.d.ts index 98ed2cb5f0..f16c9e326d 100644 --- a/leaflet/index.d.ts +++ b/leaflet/index.d.ts @@ -611,7 +611,7 @@ declare namespace L { /** * Size of the icon in pixels. Can be also set through CSS. */ - iconSize?: Point; + iconSize?: Point|[number, number]; /** * The coordinates of the "tip" of the icon (relative to its top left corner). @@ -619,7 +619,7 @@ declare namespace L { * location. Centered by default if size is specified, also can be set in CSS * with negative margins. */ - iconAnchor?: Point; + iconAnchor?: Point|[number, number]; /** * A custom class name to assign to the icon. @@ -635,6 +635,12 @@ declare namespace L { */ html?: string; + /** + * The coordinates of the point from which popups will "open", relative to the + * icon anchor. + */ + popupAnchor?: Point|[number, number]; + } } @@ -4091,7 +4097,7 @@ declare namespace L { * * Default value: 'abc'. */ - subdomains?: string[]; + subdomains?: string|string[]; /** * URL to the tile image to show in place of the tile that failed to load. diff --git a/localForage/index.d.ts b/localForage/index.d.ts index 89e767037b..803bde9e57 100644 --- a/localForage/index.d.ts +++ b/localForage/index.d.ts @@ -52,7 +52,7 @@ interface LocalForage { config(options: LocalForageOptions): boolean; createInstance(options: LocalForageOptions): LocalForage; - driver(): LocalForageDriver; + driver(): string; /** * Force usage of a particular driver or drivers, if available. * @param {string} driver diff --git a/material-ui/index.d.ts b/material-ui/index.d.ts index afd40b65c0..8c0bb78401 100644 --- a/material-ui/index.d.ts +++ b/material-ui/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for material-ui v0.15.0 +// Type definitions for material-ui v0.15.1 // Project: https://github.com/callemall/material-ui // Definitions by: Nathan Brown , Oliver Herrmann // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -18,6 +18,7 @@ declare module "material-ui" { export import CardText = __MaterialUI.Card.CardText; export import CardTitle = __MaterialUI.Card.CardTitle; export import Checkbox = __MaterialUI.Switches.Checkbox; + export import Chip = __MaterialUI.Chip; export import CircularProgress = __MaterialUI.CircularProgress; export import DatePicker = __MaterialUI.DatePicker.DatePicker; export import Dialog = __MaterialUI.Dialog; @@ -247,7 +248,7 @@ declare namespace __MaterialUI { inkBar?: { backgroundColor?: string; }; - navDrawer?: { + drawer?: { width?: number; color?: string; }; @@ -426,7 +427,7 @@ declare namespace __MaterialUI { menu: number; appBar: number; drawerOverlay: number; - navDrawer: number; + drawer: number; dialogOverlay: number; dialog: number; layer: number; @@ -512,6 +513,7 @@ declare namespace __MaterialUI { iconElementLeft?: React.ReactElement; iconElementRight?: React.ReactElement; iconStyleRight?: string; + iconStyleLeft?: string; onLeftIconButtonTouchTap?: TouchTapEventHandler; onRightIconButtonTouchTap?: TouchTapEventHandler; onTitleTouchTap?: TouchTapEventHandler; @@ -532,6 +534,7 @@ declare namespace __MaterialUI { namespace propTypes { type horizontal = 'left' | 'middle' | 'right'; type vertical = 'top' | 'center' | 'bottom'; + type direction = 'left' | 'right' | 'up' | 'down'; interface origin { horizontal: horizontal; @@ -836,6 +839,18 @@ declare namespace __MaterialUI { } } + interface ChipProps extends React.Props { + backgroundColor?: string; + className?: string; + labelColor?: string; + labelStyle?: React.CSSProperties; + onRequestDelete?: React.TouchEventHandler; + onTouchTap?: React.TouchEventHandler; + style?: React.CSSProperties; + } + export class Chip extends React.Component { + } + namespace DatePicker { interface DatePickerProps extends React.Props { // is the element that get the 'other' properties @@ -1161,6 +1176,7 @@ declare namespace __MaterialUI { touchTapCloseDelay?: number; useLayerForClickAway?: boolean; + animated?: boolean; autoWidth?: boolean; desktop?: boolean; listStyle?: React.CSSProperties; @@ -1180,6 +1196,7 @@ declare namespace __MaterialUI { interface DropDownMenuProps extends React.Props { //
is the element that gets the 'other' properties + animated?: boolean; autoWidth?: boolean; className?: string; disabled?: boolean; @@ -1300,6 +1317,7 @@ declare namespace __MaterialUI { disabled?: boolean; errorStyle?: React.CSSProperties; errorText?: React.ReactNode; + floatingLabelFixed?: boolean; floatingLabelStyle?: React.CSSProperties; floatingLabelText?: React.ReactNode; fullWidth?: boolean; @@ -1784,6 +1802,8 @@ declare namespace __MaterialUI { autoOk?: boolean; cancelLabel?: React.ReactNode; defaultTime?: Date; + dialogBodyStyle?: React.CSSProperties; + dialogStyle?: React.CSSProperties; disabled?: boolean; format?: "ampm" | "24hr"; okLabel?: React.ReactNode; @@ -1979,6 +1999,11 @@ declare module 'material-ui/Checkbox' { export default Checkbox; } +declare module 'material-ui/Chip' { + export import Chip = __MaterialUI.Chip; + export default Chip; +} + declare module 'material-ui/CircularProgress' { export import CircularProgress = __MaterialUI.CircularProgress; export default CircularProgress; @@ -7267,16 +7292,26 @@ declare module 'material-ui/utils/colorManipulator' { export import darken = __MaterialUI.Utils.ColorManipulator.darken; export import lighten = __MaterialUI.Utils.ColorManipulator.lighten; } - declare module 'material-ui/utils/dom' { export import Dom = __MaterialUI.Utils.Dom; export default Dom; } - declare module 'material-ui/utils/events' { export import Events = __MaterialUI.Utils.Events; export default Events; } +declare module 'material-ui/utils/withWidth' { + export const SMALL: number; + export const MEDIUM: number; + export const LARGE: number; + + interface Options { + largeWidth?: number; + mediumWidth?: number; + resizeInterval?: number; + } + export default function withWidth(options?: Options): React.ComponentClass +} declare namespace __MaterialUI.Styles { interface Colors { @@ -8493,3 +8528,180 @@ declare module "material-ui/svg-icons" { export import ToggleStarBorder = __MaterialUI.SvgIcon; // require('material-ui/svg-icons/toggle/star-border'); export import ToggleStarHalf = __MaterialUI.SvgIcon; // require('material-ui/svg-icons/toggle/star-half'); } + + +declare module 'material-ui/internal/AppCanvas' { + interface AppCanvasProps extends React.Props { } + class AppCanvas extends React.Component { } + export default AppCanvas; +} +declare module 'material-ui/internal/AutoLockScrolling' { + interface AutoLockScrollingProps extends React.Props { + lock: boolean; + } + class AutoLockScrolling extends React.Component { } + export default AutoLockScrolling; +} +declare module 'material-ui/internal/BeforeAfterWrapper' { + interface BeforeAfterWrapperProps extends React.Props { + afterElementType?: string, + afterStyle?: React.CSSProperties, + beforeElementType?: string, + beforeStyle?: React.CSSProperties, + elementType?: string, + style?: React.CSSProperties, + } + class BeforeAfterWrapper extends React.Component { } + export default BeforeAfterWrapper; +} +declare module 'material-ui/internal/CircleRipple' { + interface CircleRippleProps extends React.Props { + aborted?: boolean; + color?: string; + opacity?: number; + style?: React.CSSProperties; + } + class CircleRipple extends React.Component { } + export default CircleRipple; +} +declare module 'material-ui/internal/ClearFix' { + interface ClearFixProps extends React.Props { + style?: React.CSSProperties; + } + class ClearFix extends React.Component { } + export default ClearFix; +} +declare module 'material-ui/internal/ClickAwayListener' { + interface ClickAwayListenerProps extends React.Props { + onClickAway?: any, + } + class ClickAwayListener extends React.Component { } + export default ClickAwayListener; +} +declare module 'material-ui/internal/EnhancedButton' { + interface EnhancedButtonProps extends __MaterialUI.SharedEnhancedButtonProps {} + class EnhancedButton extends React.Component {} + export default EnhancedButton; +} +declare module 'material-ui/internal/EnhancedSwitch' { + interface EnhancedSwitchProps extends __MaterialUI.Switches.CommonEnhancedSwitchProps {} + class EnhancedSwitch extends React.Component {} + export default EnhancedSwitch; +} +declare module 'material-ui/internal/ExpandTransition' { + interface ExpandTransitionProps extends React.Props { + enterDelay?: number; + loading?: boolean; + open?: boolean; + style?: React.CSSProperties; + transitionDelay?: number; + transitionDuration?: number; + } + class ExpandTransition extends React.Component { } + export default ExpandTransition; +} +declare module 'material-ui/internal/ExpandTransitionChild' { + interface ExpandTransitionChildProps extends React.Props { + enterDelay?: number; + style?: React.CSSProperties; + transitionDelay?: number; + transitionDuration?: number; + } + class ExpandTransitionChild extends React.Component { } + export default ExpandTransitionChild; +} +declare module 'material-ui/internal/FocusRipple' { + interface FocusRippleProps extends React.Props { + color?: string, + innerStyle?: React.CSSProperties, + opacity?: number, + show?: boolean, + style?: React.CSSProperties + } + class FocusRipple extends React.Component { } + export default FocusRipple; +} +declare module 'material-ui/internal/Overlay' { + interface OverlayProps extends React.Props { + autoLockScrolling?: boolean; + show: boolean; + style?: React.CSSProperties; + transitionEnabled?: boolean; + } + class Overlay extends React.Component { } + export default Overlay; +} +declare module 'material-ui/internal/RenderToLayer' { + interface RenderToLayerProps extends React.Props { + componentClickAway?: Function; + open: boolean; + render: Function; + useLayerForClickAway?: boolean; + } + class RenderToLayer extends React.Component { } + export default RenderToLayer; +} +declare module 'material-ui/internal/ScaleIn' { + interface ScaleInProps extends React.Props { + childStyle?: React.CSSProperties; + enterDelay?: number; + maxScale?: number; + minScale?: number; + } + class ScaleIn extends React.Component { } + export default ScaleIn; +} +declare module 'material-ui/internal/ScaleInChild' { + interface ScaleInChildProps extends React.Props { + enterDelay?: number; + maxScale?: number; + minScale?: number; + style?: React.CSSProperties; + } + class ScaleInChild extends React.Component { } + export default ScaleInChild; +} +declare module 'material-ui/internal/SlideIn' { + interface SlideInProps extends React.Props { + childStyle?: React.CSSProperties; + direction?: __MaterialUI.propTypes.direction; + enterDelay?: number; + style?: React.CSSProperties; + } + class SlideIn extends React.Component { } + export default SlideIn; +} +declare module 'material-ui/internal/SlideInChild' { + interface SlideInChildProps extends React.Props { + direction?: string, + enterDelay?: number; + getLeaveDirection: Function; + style?: React.CSSProperties; + } + class SlideInChild extends React.Component { } + export default SlideInChild; +} +declare module 'material-ui/internal/Tooltip' { + interface TooltipProps extends React.Props { + className?: string; + horizontalPosition?: __MaterialUI.propTypes.horizontal; + label: any; + show?: boolean; + style?: React.CSSProperties; + touch?: boolean; + verticalPosition?: __MaterialUI.propTypes.vertical; + } + class Tooltip extends React.Component { } + export default Tooltip; +} +declare module 'material-ui/internal/TouchRipple' { + interface TouchRippleProps extends React.Props { + abortOnScroll?: boolean, + centerRipple?: boolean; + color?: string; + opacity?: number; + style?: React.CSSProperties + } + class TouchRipple extends React.Component { } + export default TouchRipple; +} diff --git a/material-ui/legacy/material-ui-0.15.0-tests.tsx b/material-ui/legacy/material-ui-0.15.0-tests.tsx new file mode 100644 index 0000000000..a0374db8b8 --- /dev/null +++ b/material-ui/legacy/material-ui-0.15.0-tests.tsx @@ -0,0 +1,4913 @@ +/// +/// +/// +/// + +import * as React from 'react'; +import {Component, PropTypes} from 'react'; +import * as ReactDOM from 'react-dom'; + +import getMuiTheme from 'material-ui/styles/getMuiTheme'; +import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'; +import darkBaseTheme from 'material-ui/styles/baseThemes/darkBaseTheme'; +import muiThemeable from 'material-ui/styles/muiThemeable'; +import {MuiTheme} from 'material-ui/styles' + +import AppBar from 'material-ui/AppBar'; +import AutoComplete from 'material-ui/AutoComplete'; +import Avatar from 'material-ui/Avatar'; +import Badge from 'material-ui/Badge'; +import Checkbox from 'material-ui/Checkbox'; +import CircularProgress from 'material-ui/CircularProgress'; +import DatePicker from 'material-ui/DatePicker'; +import Dialog from 'material-ui/Dialog'; +import Divider from 'material-ui/Divider'; +import Drawer from 'material-ui/Drawer'; +import DropDownMenu from 'material-ui/DropDownMenu'; +import FlatButton from 'material-ui/FlatButton'; +import FloatingActionButton from 'material-ui/FloatingActionButton'; +import FontIcon from 'material-ui/FontIcon'; +import IconButton from 'material-ui/IconButton'; +import IconMenu from 'material-ui/IconMenu'; +import LinearProgress from 'material-ui/LinearProgress'; +import List from 'material-ui/List/List'; +import ListItem from 'material-ui/List/ListItem'; +import MenuItem from 'material-ui/MenuItem'; +import Paper from 'material-ui/Paper'; +import RaisedButton from 'material-ui/RaisedButton'; +import RefreshIndicator from 'material-ui/RefreshIndicator'; +import SelectField from 'material-ui/SelectField'; +import Slider from 'material-ui/Slider'; +import Snackbar from 'material-ui/Snackbar'; +import Subheader from 'material-ui/Subheader'; +import SvgIcon from 'material-ui/SvgIcon'; +import TextField from 'material-ui/TextField'; +import TimePicker from 'material-ui/TimePicker'; +import Toggle from 'material-ui/Toggle'; +import {Card, CardActions, CardHeader, CardMedia, CardTitle, CardText} from 'material-ui/Card'; +import {GridList, GridTile} from 'material-ui/GridList'; +import {MakeSelectable} from 'material-ui/List'; +import {Menu} from 'material-ui/Menu'; +import {Popover, PopoverAnimationVertical} from 'material-ui/Popover'; +import {RadioButton, RadioButtonGroup} from 'material-ui/RadioButton'; +import {Step, Stepper, StepLabel, StepContent, StepButton} from 'material-ui/Stepper'; +import {Table, TableBody, TableHeader, TableHeaderColumn, TableRow, TableRowColumn, TableFooter} from 'material-ui/Table'; +import {Tabs, Tab} from 'material-ui/Tabs'; +import {Toolbar, ToolbarGroup, ToolbarSeparator, ToolbarTitle} from 'material-ui/Toolbar'; + +import ActionAndroid from 'material-ui/svg-icons/action/android'; +import ActionAssignment from 'material-ui/svg-icons/action/assignment'; +import ActionFavorite from 'material-ui/svg-icons/action/favorite'; +import ActionFavoriteBorder from 'material-ui/svg-icons/action/favorite-border'; +import ActionFlightTakeoff from 'material-ui/svg-icons/action/flight-takeoff'; +import ActionGrade from 'material-ui/svg-icons/action/grade'; +import ActionHome from 'material-ui/svg-icons/action/home'; +import ActionInfo from 'material-ui/svg-icons/action/info'; +import ArrowDropRight from 'material-ui/svg-icons/navigation-arrow-drop-right'; +import CommunicationCall from 'material-ui/svg-icons/communication/call'; +import CommunicationChatBubble from 'material-ui/svg-icons/communication/chat-bubble'; +import CommunicationEmail from 'material-ui/svg-icons/communication/email'; +import ContentAdd from 'material-ui/svg-icons/content/add'; +import ContentCopy from 'material-ui/svg-icons/content/content-copy'; +import ContentDrafts from 'material-ui/svg-icons/content/drafts'; +import ContentFilter from 'material-ui/svg-icons/content/filter-list'; +import ContentInbox from 'material-ui/svg-icons/content/inbox'; +import ContentLink from 'material-ui/svg-icons/content/link'; +import ContentSend from 'material-ui/svg-icons/content/send'; +import Delete from 'material-ui/svg-icons/action/delete'; +import Download from 'material-ui/svg-icons/file/file-download'; +import EditorInsertChart from 'material-ui/svg-icons/editor/insert-chart'; +import FileCloudDownload from 'material-ui/svg-icons/file/cloud-download'; +import FileFileDownload from 'material-ui/svg-icons/file/file-download'; +import FileFolder from 'material-ui/svg-icons/file/folder'; +import FolderIcon from 'material-ui/svg-icons/file/folder-open'; +import HardwareVideogameAsset from 'material-ui/svg-icons/hardware/videogame-asset'; +import MapsPersonPin from 'material-ui/svg-icons/maps/person-pin'; +import MapsPlace from 'material-ui/svg-icons/maps/place'; +import MoreVertIcon from 'material-ui/svg-icons/navigation/more-vert'; +import NavigationClose from 'material-ui/svg-icons/navigation/close'; +import NavigationExpandMoreIcon from 'material-ui/svg-icons/navigation/expand-more'; +import NotificationsIcon from 'material-ui/svg-icons/social/notifications'; +import PersonAdd from 'material-ui/svg-icons/social/person-add'; +import RemoveRedEye from 'material-ui/svg-icons/image/remove-red-eye'; +import StarBorder from 'material-ui/svg-icons/toggle/star-border'; +import UploadIcon from 'material-ui/svg-icons/file/cloud-upload'; +import WarningIcon from 'material-ui/svg-icons/alert/warning'; + +import {cyan500, cyan700, + grey100, grey300, grey400, grey500, + pinkA200, + white, darkBlack, fullBlack, + blue300, + indigo900, + orange200, + deepOrange300, + pink400, + purple500, + fullWhite, + blue500, red500, greenA200, yellow500, + transparent, yellow600, indigo500, lightBlack, + orange500, +} from 'material-ui/styles/colors'; +import {fade} from 'material-ui/utils/colorManipulator'; + + +import injectTapEventPlugin = require('react-tap-event-plugin'); + +// Needed for onTouchTap +// Check this repo: +// https://github.com/zilverline/react-tap-event-plugin +injectTapEventPlugin(); + +function handleTouchTap() { + alert('onTouchTap triggered on the title component'); +} + +const styles = { + title: { + cursor: 'pointer', + }, + exampleImageInput: { + cursor: 'pointer', + position: 'absolute', + top: 0, + bottom: 0, + right: 0, + left: 0, + width: '100%', + opacity: 0, + }, + button: { + margin: 12, + }, + smallIcon: { + width: 36, + height: 36, + }, + mediumIcon: { + width: 48, + height: 48, + }, + largeIcon: { + width: 60, + height: 60, + }, + small: { + width: 72, + height: 72, + padding: 16, + }, + medium: { + width: 96, + height: 96, + padding: 24, + }, + large: { + width: 120, + height: 120, + padding: 30, + }, + radioButton: { + marginTop: 16, + }, + root: { + display: 'flex', + flexWrap: 'wrap', + justifyContent: 'space-around', + }, + gridList: { + width: 500, + height: 500, + overflowY: 'auto', + marginBottom: 24, + }, + paper: { + display: 'inline-block', + float: 'left', + margin: '16px 32px 16px 0', + }, + rightIcon: { + textAlign: 'center', + lineHeight: '24px', + }, + customWidth: { + width: 200, + }, + h3: { + marginTop: 20, + fontWeight: 400, + }, + block: { + display: 'flex', + maxWidth: 250, + }, + block2: { + margin: 10, + }, + container: { + position: 'relative', + }, + refresh: { + display: 'inline-block', + position: 'relative', + }, + checkbox: { + marginBottom: 16, + }, + toggle: { + marginBottom: 16, + }, + propContainer: { + width: 200, + overflow: 'hidden', + margin: '20px auto 0', + }, + propToggleHeader: { + margin: '20px auto 10px', + }, + headline: { + fontSize: 24, + paddingTop: 16, + marginBottom: 12, + fontWeight: 400, + }, + errorStyle: { + color: orange500, + }, + underlineStyle: { + borderColor: orange500, + }, + floatingLabelStyle: { + color: orange500, + }, + floatingLabelFocusStyle: { + color: blue500, + }, +}; + +const style = { + marginRight: 20, + marginLeft: 20, + display: 'inline-block', + margin: '16px 32px 16px 0', +}; + +const customContentStyle = { + width: '100%', + maxWidth: 'none', +}; + +const iconStyles = { + marginRight: 24, +}; + + +// "http://www.material-ui.com/#/customization/themes" + +// This replaces the textColor value on the palette +// and then update the keys for each component that depends on it. +// More on Colors: http://www.material-ui.com/#/customization/colors +const muiTheme = getMuiTheme({ + palette: { + textColor: cyan500, + }, + appBar: { + height: 50, + }, +}); + +const darkMuiTheme = getMuiTheme(darkBaseTheme); + +const lightBaseTheme = { + spacing: { + iconSize: 24, + desktopGutter: 24, + desktopGutterMore: 32, + desktopGutterLess: 16, + desktopGutterMini: 8, + desktopKeylineIncrement: 64, + desktopDropDownMenuItemHeight: 32, + desktopDropDownMenuFontSize: 15, + desktopDrawerMenuItemHeight: 48, + desktopSubheaderHeight: 48, + desktopToolbarHeight: 56, + }, + fontFamily: 'Roboto, sans-serif', + palette: { + primary1Color: cyan500, + primary2Color: cyan700, + primary3Color: grey400, + accent1Color: pinkA200, + accent2Color: grey100, + accent3Color: grey500, + textColor: darkBlack, + alternateTextColor: white, + canvasColor: white, + borderColor: grey300, + disabledColor: fade(darkBlack, 0.3), + pickerHeaderColor: cyan500, + clockCircleColor: fade(darkBlack, 0.07), + shadowColor: fullBlack, + }, +}; + +const lightMuiTheme = getMuiTheme(lightBaseTheme); + + +class DeepDownTheTree extends React.Component<{} & {muiTheme: MuiTheme}, {}> { + static propTypes: React.ValidationMap = { + muiTheme: React.PropTypes.object.isRequired, + }; + + render() { + return ( + + Hello World! + + ); + } +} + + +// "http://www.material-ui.com/#/customization/inline-styles" +const InlineStylesCheckbox = () => ( + +); + + +// "http://www.material-ui.com/#/components/app-bar" +const AppBarExampleIcon = () => ( + +); + +const AppBarExampleIconButton = () => ( + Title} + onTitleTouchTap={handleTouchTap} + iconElementLeft={} + iconElementRight={} + /> +); + +const AppBarExampleIconMenu = () => ( + } + iconElementRight={ + + } + targetOrigin={{horizontal: 'right', vertical: 'top'}} + anchorOrigin={{horizontal: 'right', vertical: 'top'}} + > + + + + + } + /> +); + +// "http://www.material-ui.com/#/components/auto-complete" +export class AutoCompleteExampleSimple extends React.Component<{}, {dataSource: string[]}> { + + constructor(props) { + super(props); + + this.state = { + dataSource: [], + }; + } + + handleUpdateInput = (value) => { + this.setState({ + dataSource: [ + value, + value + value, + value + value + value, + ], + }); + }; + + render() { + return ( +
+ + +
+ ); + } +} + +const dataSource1 = [ + { + text: 'text-value1', + value: ( + + ), + }, + { + text: 'text-value2', + value: ( + + ), + }, +]; + +const dataSource2 = ['12345', '23456', '34567']; + +const dataSource3 = [ + {text: 'Some Text', value: 'someFirstValue'}, + {text: 'Some Text', value: 'someSecondValue'}, +]; + +const AutoCompleteExampleNoFilter = () => ( +
+
+
+ +
+); + +const colors = [ + 'Red', + 'Orange', + 'Yellow', + 'Green', + 'Blue', + 'Purple', + 'Black', + 'White', +]; + +const fruit = [ + 'Apple', 'Apricot', 'Avocado', + 'Banana', 'Bilberry', 'Blackberry', 'Blackcurrant', 'Blueberry', + 'Boysenberry', 'Blood Orange', + 'Cantaloupe', 'Currant', 'Cherry', 'Cherimoya', 'Cloudberry', + 'Coconut', 'Cranberry', 'Clementine', + 'Damson', 'Date', 'Dragonfruit', 'Durian', + 'Elderberry', + 'Feijoa', 'Fig', + 'Goji berry', 'Gooseberry', 'Grape', 'Grapefruit', 'Guava', + 'Honeydew', 'Huckleberry', + 'Jabouticaba', 'Jackfruit', 'Jambul', 'Jujube', 'Juniper berry', + 'Kiwi fruit', 'Kumquat', + 'Lemon', 'Lime', 'Loquat', 'Lychee', + 'Nectarine', + 'Mango', 'Marion berry', 'Melon', 'Miracle fruit', 'Mulberry', 'Mandarine', + 'Olive', 'Orange', + 'Papaya', 'Passionfruit', 'Peach', 'Pear', 'Persimmon', 'Physalis', 'Plum', 'Pineapple', + 'Pumpkin', 'Pomegranate', 'Pomelo', 'Purple Mangosteen', + 'Quince', + 'Raspberry', 'Raisin', 'Rambutan', 'Redcurrant', + 'Salal berry', 'Satsuma', 'Star fruit', 'Strawberry', 'Squash', 'Salmonberry', + 'Tamarillo', 'Tamarind', 'Tomato', 'Tangerine', + 'Ugli fruit', + 'Watermelon', +]; + +const AutoCompleteExampleFilters = () => ( +
+ +
+ +
+); + +// "http://www.material-ui.com/#/components/avatar" +const AvatarExampleSimple = () => ( + + + } + > + Image Avatar + + + } + > + Image Avatar with custom size + + } /> + } + > + FontIcon Avatar + + } + color={blue300} + backgroundColor={indigo900} + size={30} + style={style} + /> + } + > + FontIcon Avatar with custom colors and size + + } /> + } + > + SvgIcon Avatar + + } + color={orange200} + backgroundColor={pink400} + size={30} + style={style} + /> + } + > + SvgIcon Avatar with custom colors and size + + A} + > + Letter Avatar + + + A + + } + > + Letter Avatar with custom colors and size + + +); + + +// "http://www.material-ui.com/#/components/badge" +const BadgeExampleSimple = () => ( +
+ + + + + + + + +
+); + +const BadgeExampleContent = () => ( +
+ } + > + + + + Company Name + +
+); + + +// "http://www.material-ui.com/#/components/flat-button" +const FlatButtonExampleSimple = () => ( +
+ + + + +
+); + +const FlatButtonExampleComplex = () => ( +
+ + + + + } + /> + + } + /> + +
+); + +const FlatButtonExampleIcon = () => ( +
+ } + style={style} + /> + } + style={style} + /> + } + style={style} + /> +
+); + + +// "http://www.material-ui.com/#/components/raised-button" +const RaisedButtonExampleSimple = () => ( +
+ + + + +
+); + +const RaisedButtonExampleComplex = () => ( +
+ + + + } + style={styles.button} + /> + } + /> +
+); + +const RaisedButtonExampleIcon = () => ( +
+ } + style={style} + /> + } + style={style} + /> + } + style={style} + /> +
+); + + +// "http://www.material-ui.com/#/components/floating-action-button" +const FloatingActionButtonExampleSimple = () => ( +
+ + + + + + + + + + + + + + + + + + + + + + + +
+); + + +// "http://www.material-ui.com/#/components/icon-button" +const IconButtonExampleSimple = () => ( +
+ + +
+); + +const IconButtonExampleComplex = () => ( +
+ + + + + + + + + + home + +
+); + +const IconButtonExampleSize = () => ( +
+ + + + + + + + + + + + + + + +
+); + +const IconButtonExampleTooltip = () => ( +
+ + + + + + +
+); + +const IconButtonExampleTouch = () => ( +
+ + + + + + + + + + + + + + + + + + +
+); + + +// "http://www.material-ui.com/#/components/card" +const CardExampleWithAvatar = () => ( + + + } + > + + + + + Lorem ipsum dolor sit amet, consectetur adipiscing elit. + Donec mattis pretium massa. Aliquam erat volutpat. Nulla facilisi. + Donec vulputate interdum sollicitudin. Nunc lacinia auctor quam sed pellentesque. + Aliquam dui mauris, mattis quis lacus id, pellentesque lobortis odio. + + + + + + +); + +const CardExampleWithoutAvatar = () => ( + + + + Lorem ipsum dolor sit amet, consectetur adipiscing elit. + Donec mattis pretium massa. Aliquam erat volutpat. Nulla facilisi. + Donec vulputate interdum sollicitudin. Nunc lacinia auctor quam sed pellentesque. + Aliquam dui mauris, mattis quis lacus id, pellentesque lobortis odio. + + + + + + +); + +class CardExampleControlled extends React.Component<{}, {expanded: boolean}> { + + constructor(props) { + super(props); + this.state = { + expanded: false, + }; + } + + handleExpandChange = (expanded) => { + this.setState({expanded: expanded}); + }; + + handleToggle = (event, toggle) => { + this.setState({expanded: toggle}); + }; + + handleExpand = () => { + this.setState({expanded: true}); + }; + + handleReduce = () => { + this.setState({expanded: false}); + }; + + render() { + return ( + + + + + + } + > + + + + + Lorem ipsum dolor sit amet, consectetur adipiscing elit. + Donec mattis pretium massa. Aliquam erat volutpat. Nulla facilisi. + Donec vulputate interdum sollicitudin. Nunc lacinia auctor quam sed pellentesque. + Aliquam dui mauris, mattis quis lacus id, pellentesque lobortis odio. + + + + + + + ); + } +} + + +// "http://www.material-ui.com/#/components/date-picker" +const DatePickerExampleSimple = () => ( +
+ + + +
+); + +const DatePickerExampleInline = () => ( +
+ + +
+); + +const optionsStyle = { + maxWidth: 255, + marginRight: 'auto', +}; + +interface DatePickerExampleToggleState { + minDate?: Date; + maxDate?: Date; + autoOk?: boolean; + disableYearSelection?: boolean; +} + +class DatePickerExampleToggle extends React.Component<{}, DatePickerExampleToggleState> { + constructor(props) { + super(props); + + const minDate = new Date(); + const maxDate = new Date(); + minDate.setFullYear(minDate.getFullYear() - 1); + minDate.setHours(0, 0, 0, 0); + maxDate.setFullYear(maxDate.getFullYear() + 1); + maxDate.setHours(0, 0, 0, 0); + + this.state = { + minDate: minDate, + maxDate: maxDate, + autoOk: false, + disableYearSelection: false, + }; + } + + handleChangeMinDate = (event, date) => { + this.setState({ + minDate: date, + }); + }; + + handleChangeMaxDate = (event, date) => { + this.setState({ + maxDate: date, + }); + }; + + handleToggle = (event, toggled) => { + this.setState({ + [event.target.name]: toggled, + }); + }; + + render() { + return ( +
+ +
+ + + + +
+
+ ); + } +} + +class DatePickerExampleControlled extends React.Component<{}, {controlledDate?: Date}> { + + constructor(props) { + super(props); + + this.state = { + controlledDate: null, + }; + } + + handleChange = (event, date) => { + this.setState({ + controlledDate: date, + }); + }; + + render() { + return ( + + ); + } +} + +function disableWeekends(date) { + return date.getDay() === 0 || date.getDay() === 6; +} +function disableRandomDates() { + return Math.random() > 0.7; +} +const DatePickerExampleDisableDates = () => ( +
+ + +
+); + +let DateTimeFormat = new Intl.DateTimeFormat('fr'); +const DatePickerExampleInternational = () => ( +
+ + + +
+); + + + +// "http://material-ui.com/#/components/dialog" +class DialogExampleSimple extends React.Component<{}, {open?: boolean}> { + state = { + open: false, + }; + + handleOpen = () => { + this.setState({open: true}); + }; + + handleClose = () => { + this.setState({open: false}); + }; + + render() { + const actions = [ + , + , + ]; + + return ( +
+ + + The actions in this window were passed in as an array of React objects. + +
+ ); + } +} + +class DialogExampleModal extends React.Component<{}, {open?: boolean}> { + state = { + open: false, + }; + + handleOpen = () => { + this.setState({open: true}); + }; + + handleClose = () => { + this.setState({open: false}); + }; + + render() { + const actions = [ + , + , + ]; + + return ( +
+ + + Only actions can close this dialog. + +
+ ); + } +} + +class DialogExampleCustomWidth extends React.Component<{}, {open?: boolean}> { + state = { + open: false, + }; + + handleOpen = () => { + this.setState({open: true}); + }; + + handleClose = () => { + this.setState({open: false}); + }; + + render() { + const actions = [ + , + , + ]; + + return ( +
+ + + This dialog spans the entire width of the screen. + +
+ ); + } +} + +class DialogExampleDialogDatePicker extends React.Component<{}, {open?: boolean}> { + state = { + open: false, + }; + + handleOpen = () => { + this.setState({open: true}); + }; + + handleClose = () => { + this.setState({open: false}); + }; + + render() { + const actions = [ + , + ]; + + return ( +
+ + + Open a Date Picker dialog from within a dialog. + + +
+ ); + } +} + +class DialogExampleScrollable extends React.Component<{}, {open?: boolean}> { + state = { + open: false, + }; + + handleOpen = () => { + this.setState({open: true}); + }; + + handleClose = () => { + this.setState({open: false}); + }; + + render() { + const actions = [ + , + , + ]; + + const radios = []; + for (let i = 0; i < 30; i++) { + radios.push( + + ); + } + + return ( +
+ + + + {radios} + + +
+ ); + } +} + +class DialogExampleAlert extends React.Component<{}, {open?: boolean}> { + state = { + open: false, + }; + + handleOpen = () => { + this.setState({open: true}); + }; + + handleClose = () => { + this.setState({open: false}); + }; + + render() { + const actions = [ + , + , + ]; + + return ( +
+ + + Discard draft? + +
+ ); + } +} + + +// "http://www.material-ui.com/#/components/divider" +const DividerExampleForm = () => ( + + + + + + + + + + +); + +const DividerExampleList = () => ( + + + + + + + + + + + +); + +const DividerExampleMenu = () => ( + + + + + + +); + + +// "http://www.material-ui.com/#/components/drawer" +class DrawerSimpleExample extends React.Component<{}, {open?: boolean}> { + + constructor(props) { + super(props); + this.state = {open: false}; + } + + handleToggle = () => this.setState({open: !this.state.open}); + + render() { + return ( +
+ + + Menu Item + Menu Item 2 + +
+ ); + } +} + +class DrawerUndockedExample extends React.Component<{}, {open?: boolean}> { + + constructor(props) { + super(props); + this.state = {open: false}; + } + + handleToggle = () => this.setState({open: !this.state.open}); + + handleClose = () => this.setState({open: false}); + + render() { + return ( +
+ + this.setState({open})} + > + Menu Item + Menu Item 2 + +
+ ); + } +} + +class DrawerOpenRightExample extends React.Component<{}, {open?: boolean}> { + + constructor(props) { + super(props); + this.state = {open: false}; + } + + handleToggle = () => this.setState({open: !this.state.open}); + + render() { + return ( +
+ + + + +
+ ); + } +} + + +// "http://www.material-ui.com/#/components/grid-list" +const tilesData: {img: string, title: string, author: string, featured?: boolean}[] = [ + { + img: 'images/grid-list/00-52-29-429_640.jpg', + title: 'Breakfast', + author: 'jill111', + featured: true, + }, + { + img: 'images/grid-list/burger-827309_640.jpg', + title: 'Tasty burger', + author: 'pashminu', + }, + { + img: 'images/grid-list/camera-813814_640.jpg', + title: 'Camera', + author: 'Danson67', + }, + { + img: 'images/grid-list/morning-819362_640.jpg', + title: 'Morning', + author: 'fancycrave1', + }, + { + img: 'images/grid-list/hats-829509_640.jpg', + title: 'Hats', + author: 'Hans', + }, + { + img: 'images/grid-list/honey-823614_640.jpg', + title: 'Honey', + author: 'fancycravel', + }, + { + img: 'images/grid-list/vegetables-790022_640.jpg', + title: 'Vegetables', + author: 'jill111', + }, + { + img: 'images/grid-list/water-plant-821293_640.jpg', + title: 'Water plant', + author: 'BkrmadtyaKarki', + }, +]; + +const GridListExampleSimple = () => ( +
+ + December + {tilesData.map((tile) => ( + by {tile.author}} + actionIcon={} + > + + + ))} + +
+); + +const GridListExampleComplex = () => ( +
+ + {tilesData.map((tile) => ( + } + actionPosition="left" + titlePosition="top" + titleBackground="linear-gradient(to bottom, rgba(0,0,0,0.7) 0%,rgba(0,0,0,0.3) 70%,rgba(0,0,0,0) 100%)" + cols={tile.featured ? 2 : 1} + rows={tile.featured ? 2 : 1} + > + + + ))} + +
+); + + +// "http://www.material-ui.com/#/components/font-icon" +const FontIconExampleSimple = () => ( +
+ + + + + +
+); + +const FontIconExampleIcons = () => ( +
+ home + flight_takeoff + cloud_download + videogame_asset +
+); + + +// "http://www.material-ui.com/#/components/svg-icon" +const HomeIcon = (props) => ( + + + +); + +const SvgIconExampleSimple = () => ( +
+ + + +
+); + +const SvgIconExampleIcons = () => ( +
+ + + + +
+); + + +// "http://material-ui.com/#/components/lists" +const ListExampleSimple = () => ( + + + } /> + } /> + } /> + } /> + } /> + + + + } /> + } /> + } /> + } /> + + +); + +const ListExampleChat = () => ( + + + Recent chats + } + rightIcon={} + /> + } + rightIcon={} + /> + } + rightIcon={} + /> + } + rightIcon={} + /> + } + rightIcon={} + /> + + + + Previous chats + } + /> + } + /> + + +); + +const ListExampleContacts = () => ( + + + } + rightAvatar={} + /> + } + /> + } + /> + } + /> + + + + + A + + } + rightAvatar={} + /> + } + /> + } + /> + } + /> + + +); + +const ListExampleFolder = () => ( + + + Folders + } />} + rightIcon={} + primaryText="Photos" + secondaryText="Jan 9, 2014" + /> + } />} + rightIcon={} + primaryText="Recipes" + secondaryText="Jan 17, 2014" + /> + } />} + rightIcon={} + primaryText="Work" + secondaryText="Jan 28, 2014" + /> + + + + Files + } backgroundColor={blue500} />} + rightIcon={} + primaryText="Vacation itinerary" + secondaryText="Jan 20, 2014" + /> + } backgroundColor={yellow600} />} + rightIcon={} + primaryText="Kitchen remodel" + secondaryText="Jan 10, 2014" + /> + + +); + +const ListExampleNested = () => ( + + + Nested List Items + } /> + } /> + } + initiallyOpen={true} + primaryTogglesNestedList={true} + nestedItems={[ + } + />, + } + disabled={true} + nestedItems={[ + } />, + ]} + />, + ]} + /> + + +); + +const ListExampleSettings = () => ( +
+ + + General + + + + + + Hangout Notifications + } + primaryText="Notifications" + secondaryText="Allow notifications" + /> + } + primaryText="Sounds" + secondaryText="Hangouts message" + /> + } + primaryText="Video sounds" + secondaryText="Hangouts video call" + /> + + + + + + + + + Priority Interruptions + } /> + } /> + } /> + + + + Hangout Notifications + } /> + } /> + } /> + + +
+); + +const ListExamplePhone = () => ( + + + } + rightIcon={} + primaryText="(650) 555 - 1234" + secondaryText="Mobile" + /> + } + primaryText="(323) 555 - 6789" + secondaryText="Work" + /> + + + + } + primaryText="aliconnors@example.com" + secondaryText="Personal" + /> + + + +); + +const iconButtonElement = ( + + + +); + +const rightIconMenu = ( + + Reply + Forward + Delete + +); + +const ListExampleMessages = () => ( +
+ + + Today + } + primaryText="Brunch this weekend?" + secondaryText={ +

+ Brendan Lim -- + I'll be in your neighborhood doing errands this weekend. Do you want to grab brunch? +

+ } + secondaryTextLines={2} + /> + + } + primaryText={ +

Summer BBQ  4

+ } + secondaryText={ +

+ to me, Scott, Jennifer -- + Wish I could come, but I'm out of town this weekend. +

+ } + secondaryTextLines={2} + /> + + } + primaryText="Oui oui" + secondaryText={ +

+ Grace Ng -- + Do you have Paris recommendations? Have you ever been? +

+ } + secondaryTextLines={2} + /> + + } + primaryText="Birdthday gift" + secondaryText={ +

+ Kerem Suer -- + Do you have any ideas what we can get Heidi for her birthday? How about a pony? +

+ } + secondaryTextLines={2} + /> + + } + primaryText="Recipe to try" + secondaryText={ +

+ Raquel Parrado -- + We should eat this: grated squash. Corn and tomatillo tacos. +

+ } + secondaryTextLines={2} + /> +
+
+ + + Today + } + rightIconButton={rightIconMenu} + primaryText="Brendan Lim" + secondaryText={ +

+ Brunch this weekend?
+ I'll be in your neighborhood doing errands this weekend. Do you want to grab brunch? +

+ } + secondaryTextLines={2} + /> + + } + rightIconButton={rightIconMenu} + primaryText="me, Scott, Jennifer" + secondaryText={ +

+ Summer BBQ
+ Wish I could come, but I'm out of town this weekend. +

+ } + secondaryTextLines={2} + /> + + } + rightIconButton={rightIconMenu} + primaryText="Grace Ng" + secondaryText={ +

+ Oui oui
+ Do you have any Paris recs? Have you ever been? +

+ } + secondaryTextLines={2} + /> + + } + rightIconButton={rightIconMenu} + primaryText="Kerem Suer" + secondaryText={ +

+ Birthday gift
+ Do you have any ideas what we can get Heidi for her birthday? How about a pony? +

+ } + secondaryTextLines={2} + /> + + } + rightIconButton={rightIconMenu} + primaryText="Raquel Parrado" + secondaryText={ +

+ Recipe to try
+ We should eat this: grated squash. Corn and tomatillo tacos. +

+ } + secondaryTextLines={2} + /> +
+
+
+); + +function wrapState(ComposedComponent: React.ComponentClass<__MaterialUI.List.SelectableProps>) { + return class SelectableList extends Component<{defaultValue: number}, {selectedIndex: number}> { + static propTypes = { + children: PropTypes.node.isRequired, + defaultValue: PropTypes.number.isRequired, + }; + + componentWillMount() { + this.setState({ + selectedIndex: this.props.defaultValue, + }); + } + + handleRequestChange = (event, index) => { + this.setState({ + selectedIndex: index, + }); + }; + + render() { + return ( + + {this.props.children} + + ); + } + }; +} + +let SelectableList = wrapState(MakeSelectable(List)); + +const ListExampleSelectable = () => ( + + + Selectable Contacts + } + nestedItems={[ + } + />, + ]} + /> + } + /> + } + /> + } + /> + + +); + + +// "http://www.material-ui.com/#/components/menu" +const MenuExampleSimple = () => ( +
+ + + + + + + + + + + + + + + + +
+); + +const MenuExampleDisable = () => ( +
+ + + + + + + + + + + + + + + + + + + + +
+); + +const MenuExampleIcons = () => ( +
+ + + } /> + } /> + } /> + + } /> + } /> + + } /> + + + + + + } /> + settings} /> + settings + } + /> + ¶} /> + §} /> + + +
+); + +const MenuExampleSecondary = () => ( +
+ + + + + + + + + + } /> + } /> + } /> + } /> + } /> + + + + + + + + + + + + + + + + + + +
+); + +const MenuExampleNested = () => ( +
+ + + + + + } + menuItems={[ + } + menuItems={[ + , + , + , + , + ]} + />, + , + , + , + ]} + /> + + + + + + + +
+); + + +// "http://www.material-ui.com/#/components/icon-menu" +const IconMenuExampleSimple = () => ( +
+ } + anchorOrigin={{horizontal: 'left', vertical: 'top'}} + targetOrigin={{horizontal: 'left', vertical: 'top'}} + > + + + + + + + } + anchorOrigin={{horizontal: 'left', vertical: 'bottom'}} + targetOrigin={{horizontal: 'left', vertical: 'bottom'}} + > + + + + + + + } + anchorOrigin={{horizontal: 'right', vertical: 'bottom'}} + targetOrigin={{horizontal: 'right', vertical: 'bottom'}} + > + + + + + + + } + anchorOrigin={{horizontal: 'right', vertical: 'top'}} + targetOrigin={{horizontal: 'right', vertical: 'top'}} + > + + + + + + +
+); + +interface IconMenuExampleControlledState { + valueSingle?: string; + valueMultiple?: string[]; + openMenu?: boolean; +} + +class IconMenuExampleControlled extends React.Component<{}, IconMenuExampleControlledState> { + constructor(props) { + super(props); + + this.state = { + valueSingle: '3', + valueMultiple: ['3', '5'], + }; + } + + handleChangeSingle = (event, value) => { + this.setState({ + valueSingle: value, + }); + }; + + handleChangeMultiple = (event, value) => { + this.setState({ + valueMultiple: value, + }); + }; + + handleOpenMenu = () => { + this.setState({ + openMenu: true, + }); + } + + handleOnRequestChange = (value) => { + this.setState({ + openMenu: value, + }); + } + + render() { + return ( +
+ } + onChange={this.handleChangeSingle} + value={this.state.valueSingle} + > + + + + + + + } + onChange={this.handleChangeMultiple} + value={this.state.valueMultiple} + multiple={true} + > + + + + + + + + } + open={this.state.openMenu} + onRequestChange={this.handleOnRequestChange} + > + + + + + + +
+ ); + } +} + +const IconMenuExampleScrollable = () => ( + } + anchorOrigin={{horizontal: 'left', vertical: 'top'}} + targetOrigin={{horizontal: 'left', vertical: 'top'}} + maxHeight={272} + > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +); + +const IconMenuExampleNested = () => ( +
+ } + anchorOrigin={{horizontal: 'left', vertical: 'top'}} + targetOrigin={{horizontal: 'left', vertical: 'top'}} + > + } + menuItems={[ + , + , + , + , + ]} + /> + + } + menuItems={[ + , + , + , + , + ]} + /> + + } /> + + + + +
+); + + +// "http://www.material-ui.com/#/components/dropdown-menu" +class DropDownMenuSimpleExample extends React.Component<{}, {value?: number}> { + + constructor(props) { + super(props); + this.state = {value: 1}; + } + + handleChange = (event, index, value) => this.setState({value}); + + render() { + return ( +
+ + + + + + + +
+ + + + + + + +
+ ); + } +} + +class DropDownMenuOpenImmediateExample extends React.Component<{}, {value?: number}> { + + constructor(props) { + super(props); + this.state = {value: 2}; + } + + handleChange = (event, index, value) => this.setState({value}); + + render() { + return ( + + + + + + + + ); + } +} + +const items: React.ReactElement<__MaterialUI.Menus.MenuItemProps>[] = []; +for (let i = 0; i < 100; i++ ) { + items.push(); +} + +class DropDownMenuLongMenuExample extends React.Component<{}, {value?: number}> { + + constructor(props) { + super(props); + this.state = {value: 10}; + } + + handleChange = (event, index, value) => this.setState({value}); + + render() { + return ( + + {items} + + ); + } +} + +class DropDownMenuLabeledExample extends React.Component<{}, {value?: number}> { + + constructor(props) { + super(props); + this.state = {value: 2}; + } + + handleChange = (event, index, value) => this.setState({value}); + + render() { + return ( + + + + + + + ); + } +} + + +// "http://material-ui.com/#/components/paper" +const PaperExampleSimple = () => ( +
+ + + + + +
+); + +const PaperExampleRounded = () => ( +
+ + + + + +
+); + +const PaperExampleCircle = () => ( +
+ + + + + +
+); + + +// "http://www.material-ui.com/#/components/popover" +class PopoverExampleSimple extends React.Component<{}, {open?: boolean, anchorEl?: React.ReactInstance}> { + + constructor(props) { + super(props); + + this.state = { + open: false, + }; + } + + handleTouchTap = (event) => { + // This prevents ghost click. + event.preventDefault(); + + this.setState({ + open: true, + anchorEl: event.currentTarget, + }); + }; + + handleRequestClose = () => { + this.setState({ + open: false, + }); + }; + + render() { + return ( +
+ + + + + + + + + +
+ ); + } +} + +class PopoverExampleAnimation extends React.Component<{}, {open?: boolean, anchorEl?: React.ReactInstance}> { + + constructor(props) { + super(props); + + this.state = { + open: false, + }; + } + + handleTouchTap = (event) => { + // This prevents ghost click. + event.preventDefault(); + this.setState({ + open: true, + anchorEl: event.currentTarget, + }); + }; + + handleRequestClose = () => { + this.setState({ + open: false, + }); + }; + + render() { + return ( +
+ + + + + + + + + +
+ ); + } +} + +interface PopoverExampleConfigurableState { + open?: boolean; + anchorOrigin?: __MaterialUI.propTypes.origin; + targetOrigin?: __MaterialUI.propTypes.origin; + anchorEl?: React.ReactInstance; +} + +class PopoverExampleConfigurable extends React.Component<{}, PopoverExampleConfigurableState> { + + constructor(props) { + super(props); + + this.state = { + open: false, + anchorOrigin: { + horizontal: 'left', + vertical: 'bottom', + }, + targetOrigin: { + horizontal: 'left', + vertical: 'top', + }, + }; + } + + handleTouchTap = (event) => { + // This prevents ghost click. + event.preventDefault(); + this.setState({ + open: true, + anchorEl: event.currentTarget, + }); + }; + + handleRequestClose = () => { + this.setState({ + open: false, + }); + }; + + setAnchor = (positionElement, position) => { + const {anchorOrigin} = this.state; + anchorOrigin[positionElement] = position; + + this.setState({ + anchorOrigin: anchorOrigin, + }); + }; + + setTarget = (positionElement, position) => { + const {targetOrigin} = this.state; + targetOrigin[positionElement] = position; + + this.setState({ + targetOrigin: targetOrigin, + }); + }; + + render() { + return ( +
+ +

Current Settings

+
+          anchorOrigin: {JSON.stringify(this.state.anchorOrigin)}
+          
+ targetOrigin: {JSON.stringify(this.state.targetOrigin)} +
+

Position Options

+

Use the settings below to toggle the positioning of the popovers above

+

Anchor Origin

+
+
+ Vertical + + + +
+
+ Horizontal + + + +
+
+

Target Origin

+
+
+ Vertical + + + +
+
+ Horizontal + + + +
+
+ + + + + + + + +
+ ); + } +} + + +// "http://www.material-ui.com/#/components/circular-progress" +const CircularProgressExampleSimple = () => ( +
+ + + +
+); + +class CircularProgressExampleDeterminate extends React.Component<{}, {completed?: number}> { + private timer: number; + + constructor(props) { + super(props); + + this.state = { + completed: 0, + }; + } + + componentDidMount() { + this.timer = setTimeout(() => this.progress(5), 1000); + } + + componentWillUnmount() { + clearTimeout(this.timer); + } + + progress(completed) { + if (completed > 100) { + this.setState({completed: 100}); + } else { + this.setState({completed}); + const diff = Math.random() * 10; + this.timer = setTimeout(() => this.progress(completed + diff), 1000); + } + } + + render() { + return ( +
+ + + +
+ ); + } +} + + +// "http://www.material-ui.com/#/components/linear-progress" +const LinearProgressExampleSimple = () => ( + +); + +class LinearProgressExampleDeterminate extends React.Component<{}, {completed?: number}> { + private timer: number; + + constructor(props) { + super(props); + + this.state = { + completed: 0, + }; + } + + componentDidMount() { + this.timer = setTimeout(() => this.progress(5), 1000); + } + + componentWillUnmount() { + clearTimeout(this.timer); + } + + progress(completed) { + if (completed > 100) { + this.setState({completed: 100}); + } else { + this.setState({completed}); + const diff = Math.random() * 10; + this.timer = setTimeout(() => this.progress(completed + diff), 1000); + } + } + + render() { + return ( + + ); + } +} + + +// "http://www.material-ui.com/#/components/refresh-indicator" +const RefreshIndicatorExampleSimple = () => ( +
+ + + + +
+); + +const RefreshIndicatorExampleLoading = () => ( +
+ + +
+); + + +// "http://www.material-ui.com/#/components/select-field" +class SelectFieldExampleSimple extends React.Component<{}, {value?: number}> { + + constructor(props) { + super(props); + this.state = {value: 1}; + } + + handleChange = (event, index, value) => this.setState({value}); + + render() { + return ( +
+ + + + + + + +
+ + + + +
+ + + + + + + +
+ + + + + + + +
+ ); + } +} + +class SelectFieldLongMenuExample extends React.Component<{}, {value?: number}> { + + constructor(props) { + super(props); + this.state = {value: 10}; + } + + handleChange = (event, index, value) => this.setState({value}); + + render() { + return ( + + {items} + + ); + } +} + +class SelectFieldExampleCustomLabel extends React.Component<{}, {value?: number}> { + + constructor(props) { + super(props); + this.state = {value: 1}; + } + + handleChange = (event, index, value) => this.setState({value}); + + render() { + return ( + + + + + + + ); + } +} + +const itemsPeriod = [ + , + , + , + , + , +]; + +export default class SelectFieldExampleFloatingLabel extends React.Component<{}, {value?: number}> { + + constructor(props) { + super(props); + this.state = {value: null}; + } + + handleChange = (event, index, value) => this.setState({value}); + + render() { + return ( +
+ + {itemsPeriod} + +
+ + {itemsPeriod} + +
+ ); + } +} + +class SelectFieldExampleError extends React.Component<{}, {value?: number}> { + + constructor(props) { + super(props); + this.state = {value: null}; + } + + handleChange = (event, index, value) => this.setState({value}); + + render() { + const {value} = this.state; + + const night = value === 2 || value === 3; + + return ( +
+ + {itemsPeriod} + +
+ + {itemsPeriod} + +
+ ); + } +} + + +// "http://www.material-ui.com/#/components/slider" +const SliderExampleSimple = () => ( +
+ + + +
+); + +const SliderExampleDisabled = () => ( +
+ + + +
+); + +const SliderExampleStep = () => ( + +); + +class SliderExampleControlled extends React.Component<{}, {firstSlider?: number, secondSlider?: number}> { + + state = { + firstSlider: 0.5, + secondSlider: 50, + } + + handleFirstSlider(event, value) { + this.setState({firstSlider: value}); + } + + handleSecondSlider(event, value) { + this.setState({secondSlider: value}); + } + + render() { + return ( +
+ +

+ {'The value of this slider is: '} + {this.state.firstSlider} + {' from a range of 0 to 1 inclusive'} +

+ +

+ {'The value of this slider is: '} + {this.state.secondSlider} + {' from a range of 0 to 100 inclusive'} +

+
+ ); + } +} + + +// "http://www.material-ui.com/#/components/checkbox" +const CheckboxExampleSimple = () => ( +
+ + + } + uncheckedIcon={} + label="Custom icon" + style={styles.checkbox} + /> + + + +
+); + + +// "http://www.material-ui.com/#/components/radio-button" +const RadioButtonExampleSimple = () => ( +
+ + + + } + uncheckedIcon={} + style={styles.radioButton} + /> + + + + + + + + +
+); + + +// "http://www.material-ui.com/#/components/toggle" +const ToggleExampleSimple = () => ( +
+ + + + +
+); + + +// "http://material-ui.com/#/components/snackbar" +class SnackbarExampleSimple extends React.Component<{}, {open?: boolean}> { + + constructor(props) { + super(props); + this.state = { + open: false, + }; + } + + handleTouchTap = () => { + this.setState({ + open: true, + }); + }; + + handleRequestClose = () => { + this.setState({ + open: false, + }); + }; + + render() { + return ( +
+ + +
+ ); + } +} + +class SnackbarExampleAction extends React.Component<{}, {open?: boolean, autoHideDuration?: number, message?: string}> { + + constructor(props) { + super(props); + this.state = { + autoHideDuration: 4000, + message: 'Event added to your calendar', + open: false, + }; + } + + handleTouchTap = () => { + this.setState({ + open: true, + }); + }; + + handleActionTouchTap = () => { + this.setState({ + open: false, + }); + alert('Event removed from your calendar.'); + }; + + handleChangeDuration = (event) => { + const value = event.target.value; + this.setState({ + autoHideDuration: value.length > 0 ? parseInt(value) : 0, + }); + }; + + handleRequestClose = () => { + this.setState({ + open: false, + }); + }; + + render() { + return ( +
+ +
+ + +
+ ); + } +} + +class SnackbarExampleTwice extends React.Component<{}, {open?: boolean, message?: string}> { + + private timer: number; + + constructor(props) { + super(props); + this.state = { + message: 'Event 1 added to your calendar', + open: false, + }; + this.timer = undefined; + } + + componentWillUnMount() { + clearTimeout(this.timer); + } + + handleTouchTap = () => { + this.setState({ + open: true, + }); + + this.timer = setTimeout(() => { + this.setState({ + message: `Event ${Math.round(Math.random() * 100)} added to your calendar`, + }); + }, 1500); + }; + + handleRequestClose = () => { + this.setState({ + open: false, + }); + }; + + render() { + return ( +
+ + +
+ ); + } +} + + +// "http://www.material-ui.com/#/components/stepper" +class HorizontalLinearStepper extends React.Component<{}, {stepIndex?: number, finished?: boolean}> { + + state = { + finished: false, + stepIndex: 0, + }; + + handleNext = () => { + const {stepIndex} = this.state; + this.setState({ + stepIndex: stepIndex + 1, + finished: stepIndex >= 2, + }); + }; + + handlePrev = () => { + const {stepIndex} = this.state; + if (stepIndex > 0) { + this.setState({stepIndex: stepIndex - 1}); + } + }; + + getStepContent(stepIndex) { + switch (stepIndex) { + case 0: + return 'Select campaign settings...'; + case 1: + return 'What is an ad group anyways?'; + case 2: + return 'This is the bit I really care about!'; + default: + return 'You\'re a long way from home sonny jim!'; + } + } + + render() { + const {finished, stepIndex} = this.state; + const contentStyle = {margin: '0 16px'}; + + return ( +
+ + + Select campaign settings + + + Create an ad group + + + Create an ad + + +
+ {finished ? ( +

+ { + event.preventDefault(); + this.setState({stepIndex: 0, finished: false}); + }} + > + Click here + to reset the example. +

+ ) : ( +
+

{this.getStepContent(stepIndex)}

+
+ + +
+
+ )} +
+
+ ); + } +} + +class VerticalLinearStepper extends React.Component<{}, {stepIndex?: number, finished?: boolean}> { + + state = { + finished: false, + stepIndex: 0, + }; + + handleNext = () => { + const {stepIndex} = this.state; + this.setState({ + stepIndex: stepIndex + 1, + finished: stepIndex >= 2, + }); + }; + + handlePrev = () => { + const {stepIndex} = this.state; + if (stepIndex > 0) { + this.setState({stepIndex: stepIndex - 1}); + } + }; + + renderStepActions(step) { + const {stepIndex} = this.state; + + return ( +
+ + {step > 0 && ( + + )} +
+ ); + } + + render() { + const {finished, stepIndex} = this.state; + + return ( +
+ + + Select campaign settings + +

+ For each ad campaign that you create, you can control how much + you're willing to spend on clicks and conversions, which networks + and geographical locations you want your ads to show on, and more. +

+ {this.renderStepActions(0)} +
+
+ + Create an ad group + +

An ad group contains one or more ads which target a shared set of keywords.

+ {this.renderStepActions(1)} +
+
+ + Create an ad + +

+ Try out different ad text to see what brings in the most customers, + and learn how to enhance your ads using features like ad extensions. + If you run into any problems with your ads, find out how to tell if + they're running and how to resolve approval issues. +

+ {this.renderStepActions(2)} +
+
+
+ {finished && ( +

+ { + event.preventDefault(); + this.setState({stepIndex: 0, finished: false}); + }} + > + Click here + to reset the example. +

+ )} +
+ ); + } +} + +class HorizontalNonLinearStepper extends React.Component<{}, {stepIndex?: number}> { + + state = { + stepIndex: 0, + }; + + handleNext = () => { + const {stepIndex} = this.state; + if (stepIndex < 2) { + this.setState({stepIndex: stepIndex + 1}); + } + }; + + handlePrev = () => { + const {stepIndex} = this.state; + if (stepIndex > 0) { + this.setState({stepIndex: stepIndex - 1}); + } + }; + + getStepContent(stepIndex) { + switch (stepIndex) { + case 0: + return 'Select campaign settings...'; + case 1: + return 'What is an ad group anyways?'; + case 2: + return 'This is the bit I really care about!'; + default: + return 'You\'re a long way from home sonny jim!'; + } + } + + render() { + const {stepIndex} = this.state; + const contentStyle = {margin: '0 16px'}; + + return ( +
+ + + this.setState({stepIndex: 0})}> + Select campaign settings + + + + this.setState({stepIndex: 1})}> + Create an ad group + + + + this.setState({stepIndex: 2})}> + Create an ad + + + +
+

{this.getStepContent(stepIndex)}

+
+ + +
+
+
+ ); + } +} + +class VerticalNonLinear extends React.Component<{}, {stepIndex?: number}> { + + state = { + stepIndex: 0, + }; + + handleNext = () => { + const {stepIndex} = this.state; + if (stepIndex < 2) { + this.setState({stepIndex: stepIndex + 1}); + } + }; + + handlePrev = () => { + const {stepIndex} = this.state; + if (stepIndex > 0) { + this.setState({stepIndex: stepIndex - 1}); + } + }; + + renderStepActions(step) { + return ( +
+ + {step > 0 && ( + + )} +
+ ); + } + + render() { + const {stepIndex} = this.state; + + return ( +
+ + + this.setState({stepIndex: 0})}> + Select campaign settings + + +

+ For each ad campaign that you create, you can control how much + you're willing to spend on clicks and conversions, which networks + and geographical locations you want your ads to show on, and more. +

+ {this.renderStepActions(0)} +
+
+ + this.setState({stepIndex: 1})}> + Create an ad group + + +

An ad group contains one or more ads which target a shared set of keywords.

+ {this.renderStepActions(1)} +
+
+ + this.setState({stepIndex: 2})}> + Create an ad + + +

+ Try out different ad text to see what brings in the most customers, + and learn how to enhance your ads using features like ad extensions. + If you run into any problems with your ads, find out how to tell if + they're running and how to resolve approval issues. +

+ {this.renderStepActions(2)} +
+
+
+
+ ); + } +} + +const getStyles = () => { + return { + root: { + width: '100%', + maxWidth: 700, + margin: 'auto', + }, + content: { + margin: '0 16px', + }, + actions: { + marginTop: 12, + }, + backButton: { + marginRight: 12, + }, + }; +}; + +class GranularControlStepper extends React.Component<{}, {stepIndex?: number, visited?: number[]}> { + + state = { + stepIndex: null, + visited: [], + }; + + componentWillMount() { + const {stepIndex, visited} = this.state; + this.setState({visited: visited.concat(stepIndex)}); + } + + componentWillUpdate(nextProps, nextState) { + const {stepIndex, visited} = nextState; + if (visited.indexOf(stepIndex) === -1) { + this.setState({visited: visited.concat(stepIndex)}); + } + } + + handleNext = () => { + const {stepIndex} = this.state; + if (stepIndex < 2) { + this.setState({stepIndex: stepIndex + 1}); + } + }; + + handlePrev = () => { + const {stepIndex} = this.state; + if (stepIndex > 0) { + this.setState({stepIndex: stepIndex - 1}); + } + }; + + getStepContent(stepIndex) { + switch (stepIndex) { + case 0: + return 'Select campaign settings...'; + case 1: + return 'What is an ad group anyways?'; + case 2: + return 'This is the bit I really care about!'; + default: + return 'Click a step to get started.'; + } + } + + render() { + const {stepIndex, visited} = this.state; + const styles = getStyles(); + + return ( +
+

+ { + event.preventDefault(); + this.setState({stepIndex: null, visited: []}); + }} + > + Click here + to reset the example. +

+ + + this.setState({stepIndex: 0})}> + Select campaign settings + + + + this.setState({stepIndex: 1})}> + Create an ad group + + + + this.setState({stepIndex: 2})}> + Create an ad + + + +
+

{this.getStepContent(stepIndex)}

+ {stepIndex !== null && ( +
+ + +
+ )} +
+
+ ); + } +} + +class CustomIcon extends React.Component<{}, {stepIndex?: number}> { + + state = { + stepIndex: 0, + }; + + handleNext = () => { + const {stepIndex} = this.state; + if (stepIndex < 2) { + this.setState({stepIndex: stepIndex + 1}); + } + }; + + handlePrev = () => { + const {stepIndex} = this.state; + if (stepIndex > 0) { + this.setState({stepIndex: stepIndex - 1}); + } + }; + + getStepContent(stepIndex) { + switch (stepIndex) { + case 0: + return 'Select campaign settings...'; + case 1: + return 'What is an ad group anyways?'; + case 2: + return 'This is the bit I really care about!'; + default: + return 'You\'re a long way from home sonny jim!'; + } + } + + render() { + return ( +
+ + + + Select campaign settings + + + + } + style={{color: red500}} + > + Create an ad group + + + + + Create an ad + + + +
+ ); + } +} + + +// "http://www.material-ui.com/#/components/subheader" +// Included in ListExampleChat and ListExampleFolder + +// "http://www.material-ui.com/#/components/table" +const TableExampleSimple = () => ( + + + + ID + Name + Status + + + + + 1 + John Smith + Employed + + + 2 + Randal White + Unemployed + + + 3 + Stephanie Sanders + Employed + + + 4 + Steve Brown + Employed + + +
+); + +const tableData: {name: string, status: string, selected?: boolean}[] = [ + { + name: 'John Smith', + status: 'Employed', + selected: true, + }, + { + name: 'Randal White', + status: 'Unemployed', + }, + { + name: 'Stephanie Sanders', + status: 'Employed', + selected: true, + }, + { + name: 'Steve Brown', + status: 'Employed', + }, + { + name: 'Joyce Whitten', + status: 'Employed', + }, + { + name: 'Samuel Roberts', + status: 'Employed', + }, + { + name: 'Adam Moore', + status: 'Employed', + }, +]; + +interface TableExampleComplexState { + fixedHeader?: boolean, + fixedFooter?: boolean, + stripedRows?: boolean, + showRowHover?: boolean, + selectable?: boolean, + multiSelectable?: boolean, + enableSelectAll?: boolean, + deselectOnClickaway?: boolean, + showCheckboxes?: boolean, + height?: string, +} + +class TableExampleComplex extends React.Component<{}, TableExampleComplexState> { + + constructor(props) { + super(props); + + this.state = { + fixedHeader: true, + fixedFooter: true, + stripedRows: false, + showRowHover: false, + selectable: true, + multiSelectable: false, + enableSelectAll: false, + deselectOnClickaway: true, + showCheckboxes: true, + height: '300px', + }; + } + + handleToggle = (event, toggled) => { + this.setState({ + [event.target.name]: toggled, + }); + }; + + handleChange = (event) => { + this.setState({height: event.target.value}); + }; + + render() { + return ( +
+ + + + + Super Header + + + + ID + Name + Status + + + + {tableData.map( (row, index) => ( + + {index} + {row.name} + {row.status} + + ))} + + + + ID + Name + Status + + + + Super Footer + + + +
+ +
+

Table Properties

+ + + + + + +

TableBody Properties

+ + + +

Multiple Properties

+ +
+
+ ); + } +} + +// "http://www.material-ui.com/#/components/tabs" +function handleActive(tab) { + alert(`A tab with this value property ${tab.props.value} was activated.`); +} + +const TabsExampleSimple = () => ( + + +
+

Tab One

+

+ This is an example tab. +

+

+ You can put any sort of HTML or react component in here. It even keeps the component state! +

+ +
+
+ +
+

Tab Two

+

+ This is another example tab. +

+
+
+ +
+

Tab Three

+

+ This is a third example tab. +

+
+
+
+); + +class TabsExampleControlled extends React.Component<{}, {value?: string}> { + + constructor(props) { + super(props); + this.state = { + value: 'a', + }; + } + + handleChange = (value) => { + this.setState({ + value: value, + }); + }; + + render() { + return ( + + +
+

Controllable Tab A

+

+ Tabs are also controllable if you want to programmatically pass them their values. + This allows for more functionality in Tabs such as not + having any Tab selected or assigning them different values. +

+
+
+ +
+

Controllable Tab B

+

+ This is another example of a controllable tab. Remember, if you + use controllable Tabs, you need to give all of your tabs values or else + you wont be able to select them. +

+
+
+
+ ); + } +} + +const TabsExampleIcon = () => ( + + } /> + } /> + favorite} /> + +); + +const TabsExampleIconText = () => ( + + phone} + label="RECENTS" + /> + favorite} + label="FAVORITES" + /> + } + label="NEARBY" + /> + +); + + +// "http://www.material-ui.com/#/components/text-field" +const TextFieldExampleSimple = () => ( +
+
+
+
+
+
+
+
+
+
+ +
+); + +const TextFieldExampleError = () => ( +
+
+
+
+
+
+); + +const TextFieldExampleCustomize = () => ( +
+
+
+
+
+ +
+); + +const TextFieldExampleDisabled = () => ( +
+
+
+
+ +
+); + +class TextFieldExampleControlled extends React.Component<{}, {value?: string}> { + + constructor(props) { + super(props); + + this.state = { + value: 'Property Value', + }; + } + + handleChange = (event) => { + this.setState({ + value: event.target.value, + }); + }; + + render() { + return ( +
+ +
+ ); + } +} + +// "http://www.material-ui.com/#/components/time-picker" +const TimePickerExampleSimple = () => ( +
+ + + +
+); + +class TimePickerExampleComplex extends React.Component<{}, {value24?: Date, value12?: Date}> { + + constructor(props) { + super(props); + this.state = {value24: null, value12: null}; + } + + handleChangeTimePicker24 = (event, date) => { + this.setState({value24: date}); + }; + + handleChangeTimePicker12 = (event, date) => { + this.setState({value12: date}); + }; + + render() { + return ( +
+ + +
+ ); + } +} + +const TimePickerInternational = () => ( +
+ +
+); + + +// "http://www.material-ui.com/#/components/toolbar" +class ToolbarExamplesSimple extends React.Component<{}, {value?: number}> { + + constructor(props) { + super(props); + this.state = { + value: 3, + }; + } + + handleChange = (event, index, value) => this.setState({value}); + + render() { + return ( + + + + + + + + + + + + + + + + + + + + + } + > + + + + + + ); + } +} + + +interface MaterialUiTestsState { +} + +class MaterialUiTests extends React.Component<{}, MaterialUiTestsState> { + + render () { + return ( + + + + + ); + } +} + +// "http://www.material-ui.com/#/get-started/usage" +ReactDOM.render( + , + document.getElementById('app') +); \ No newline at end of file diff --git a/material-ui/legacy/material-ui-0.15.0-tests.tsx.tscparams b/material-ui/legacy/material-ui-0.15.0-tests.tsx.tscparams new file mode 100644 index 0000000000..855355b85f --- /dev/null +++ b/material-ui/legacy/material-ui-0.15.0-tests.tsx.tscparams @@ -0,0 +1 @@ +--experimentalDecorators \ No newline at end of file diff --git a/material-ui/legacy/material-ui-0.15.0.d.ts b/material-ui/legacy/material-ui-0.15.0.d.ts new file mode 100644 index 0000000000..d566c16a46 --- /dev/null +++ b/material-ui/legacy/material-ui-0.15.0.d.ts @@ -0,0 +1,8414 @@ +// Type definitions for material-ui v0.15.0 +// Project: https://github.com/callemall/material-ui +// Definitions by: Nathan Brown , Oliver Herrmann +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "material-ui" { + export import AppBar = __MaterialUI.AppBar; + export import AutoComplete = __MaterialUI.AutoComplete; + export import Avatar = __MaterialUI.Avatar; + export import Badge = __MaterialUI.Badge; + export import Card = __MaterialUI.Card.Card; + export import CardActions = __MaterialUI.Card.CardActions; + export import CardHeader = __MaterialUI.Card.CardHeader; + export import CardMedia = __MaterialUI.Card.CardMedia; + export import CardText = __MaterialUI.Card.CardText; + export import CardTitle = __MaterialUI.Card.CardTitle; + export import Checkbox = __MaterialUI.Switches.Checkbox; + export import CircularProgress = __MaterialUI.CircularProgress; + export import DatePicker = __MaterialUI.DatePicker.DatePicker; + export import Dialog = __MaterialUI.Dialog; + export import Divider = __MaterialUI.Divider; + export import Drawer = __MaterialUI.Drawer; + export import DropDownMenu = __MaterialUI.Menus.DropDownMenu; + export import FlatButton = __MaterialUI.FlatButton; + export import FloatingActionButton = __MaterialUI.FloatingActionButton; + export import FontIcon = __MaterialUI.FontIcon; + export import GridList = __MaterialUI.GridList.GridList; + export import GridTile = __MaterialUI.GridList.GridTile; + export import IconButton = __MaterialUI.IconButton; + export import IconMenu = __MaterialUI.Menus.IconMenu; + export import LinearProgress = __MaterialUI.LinearProgress; + export import List = __MaterialUI.List.List; + export import ListItem = __MaterialUI.List.ListItem; + export import MakeSelectable = __MaterialUI.List.MakeSelectable; + export import Menu = __MaterialUI.Menus.Menu; + export import MenuItem = __MaterialUI.Menus.MenuItem; + export import Paper = __MaterialUI.Paper; + export import Popover = __MaterialUI.Popover.Popover; + export import RadioButton = __MaterialUI.Switches.RadioButton; + export import RadioButtonGroup = __MaterialUI.Switches.RadioButtonGroup; + export import RaisedButton = __MaterialUI.RaisedButton; + export import RefreshIndicator = __MaterialUI.RefreshIndicator; + export import SelectField = __MaterialUI.SelectField; + export import Slider = __MaterialUI.Slider; + export import Subheader = __MaterialUI.Subheader; + export import SvgIcon = __MaterialUI.SvgIcon; + export import Step = __MaterialUI.Stepper.Step; + export import StepButton = __MaterialUI.Stepper.StepButton; + export import StepContent = __MaterialUI.Stepper.StepContent; + export import StepLabel = __MaterialUI.Stepper.StepLabel; + export import Stepper = __MaterialUI.Stepper; + export import Snackbar = __MaterialUI.Snackbar; + export import Tab = __MaterialUI.Tabs.Tab; + export import Tabs = __MaterialUI.Tabs.Tabs; + export import Table = __MaterialUI.Table.Table; + export import TableBody = __MaterialUI.Table.TableBody; + export import TableFooter = __MaterialUI.Table.TableFooter; + export import TableHeader = __MaterialUI.Table.TableHeader; + export import TableHeaderColumn = __MaterialUI.Table.TableHeaderColumn; + export import TableRow = __MaterialUI.Table.TableRow; + export import TableRowColumn = __MaterialUI.Table.TableRowColumn; + export import TextField = __MaterialUI.TextField; + export import TimePicker = __MaterialUI.TimePicker; + export import Toggle = __MaterialUI.Switches.Toggle; + export import Toolbar = __MaterialUI.Toolbar.Toolbar; + export import ToolbarGroup = __MaterialUI.Toolbar.ToolbarGroup; + export import ToolbarSeparator = __MaterialUI.Toolbar.ToolbarSeparator; + export import ToolbarTitle = __MaterialUI.Toolbar.ToolbarTitle; + + // export type definitions + export type TouchTapEvent = __MaterialUI.TouchTapEvent; + export type TouchTapEventHandler = __MaterialUI.TouchTapEventHandler; +} + +declare namespace __MaterialUI { + export import React = __React; + + // ReactLink is from "react/addons" + interface ReactLink { + value: T; + requestChange(newValue: T): void; + } + + // What's common between React.TouchEvent and React.MouseEvent + interface TouchTapEvent extends React.SyntheticEvent { + altKey: boolean; + ctrlKey: boolean; + getModifierState(key: string): boolean; + metaKey: boolean; + shiftKey: boolean; + } + + // What's common between React.TouchEventHandler and React.MouseEventHandler + interface TouchTapEventHandler extends React.EventHandler { } + + interface ThemeWrapperProps extends React.Props { + theme: Styles.MuiTheme; + } + export class ThemeWrapper extends React.Component { + } + + export namespace Styles { + interface Spacing { + iconSize?: number; + + desktopGutter?: number; + desktopGutterMore?: number; + desktopGutterLess?: number; + desktopGutterMini?: number; + desktopKeylineIncrement?: number; + desktopDropDownMenuItemHeight?: number; + desktopDropDownMenuFontSize?: number; + desktopLeftNavMenuItemHeight?: number; + desktopSubheaderHeight?: number; + desktopToolbarHeight?: number; + } + export var Spacing: Spacing; + + interface ThemePalette { + primary1Color?: string; + primary2Color?: string; + primary3Color?: string; + accent1Color?: string; + accent2Color?: string; + accent3Color?: string; + textColor?: string; + alternateTextColor?: string; + canvasColor?: string; + borderColor?: string; + disabledColor?: string; + pickerHeaderColor?: string; + clockCircleColor?: string; + shadowColor?: string; + } + interface MuiTheme { + spacing?: Spacing; + fontFamily?: string; + palette?: ThemePalette; + isRtl?: boolean; + userAgent?: string; + zIndex?: zIndex; + baseTheme?: RawTheme; + rawTheme?: RawTheme; + appBar?: { + color?: string; + textColor?: string; + height?: number; + titleFontWeight?: number; + padding?: number; + }; + avatar?: { + color?: string; + backgroundColor?: string; + borderColor?: string; + }; + badge?: { + color?: string; + textColor?: string; + primaryColor?: string; + primaryTextColor?: string; + secondaryColor?: string; + secondaryTextColor?: string; + fontWeight?: number; + }; + button?: { + height?: number; + minWidth?: number; + iconButtonSize?: number; + }; + card?: { + titleColor?: string; + subtitleColor?: string; + fontWeight?: number; + }; + cardMedia?: { + color?: string; + overlayContentBackground?: string; + titleColor?: string; + subtitleColor?: string; + }; + cardText?: { + textColor?: string; + }; + checkbox?: { + boxColor?: string; + checkedColor?: string; + requiredColor?: string; + disabledColor?: string; + labelColor?: string; + labelDisabledColor?: string; + }; + chip?: { + backgroundColor?: string; + deleteIconColor?: string; + textColor?: string; + fontSize?: number; + fontWeight?: number; + shadow?: string; + }; + datePicker?: { + color?: string; + textColor?: string; + calendarTextColor?: string; + selectColor?: string; + selectTextColor?: string; + calendarYearBackgroundColor?: string; + }; + dialog?: { + titleFontSize?: number; + bodyFontSize?: number; + bodyColor?: string; + }; + dropDownMenu?: { + accentColor?: string; + }; + enhancedButton?: { + tapHighlightColor?: string; + }; + flatButton?: { + color?: string; + buttonFilterColor?: string; + disabledTextColor?: string; + textColor?: string; + primaryTextColor?: string; + secondaryTextColor?: string; + fontSize?: number; + fontWeight?: number; + }; + floatingActionButton?: { + buttonSize?: number; + miniSize?: number; + color?: string; + iconColor?: string; + secondaryColor?: string; + secondaryIconColor?: string; + disabledTextColor?: string; + disabledColor?: string; + }; + gridTile?: { + textColor?: string; + }; + icon?: { + color?: string; + backgroundColor?: string; + }; + inkBar?: { + backgroundColor?: string; + }; + navDrawer?: { + width?: number; + color?: string; + }; + listItem?: { + nestedLevelDepth?: number; + secondaryTextColor?: string; + leftIconColor?: string; + rightIconColor?: string; + }; + menu?: { + backgroundColor?: string; + containerBackgroundColor?: string; + }; + menuItem?: { + dataHeight?: number; + height?: number; + hoverColor?: string; + padding?: number; + selectedTextColor?: string; + rightIconDesktopFill?: string; + }; + menuSubheader?: { + padding?: number; + borderColor?: string; + textColor?: string; + }; + overlay?: { + backgroundColor?: string; + }; + paper?: { + color?: string; + backgroundColor?: string; + zDepthShadows?: string[]; + }; + radioButton?: { + borderColor?: string; + backgroundColor?: string; + checkedColor?: string; + requiredColor?: string; + disabledColor?: string; + size?: number; + labelColor?: string; + labelDisabledColor?: string; + }; + raisedButton?: { + color?: string; + textColor?: string; + primaryColor?: string; + primaryTextColor?: string; + secondaryColor?: string; + secondaryTextColor?: string; + disabledColor?: string; + disabledTextColor?: string; + fontSize?: number; + fontWeight?: number; + }; + refreshIndicator?: { + strokeColor?: string; + loadingStrokeColor?: string; + }; + ripple?: { + color?: string; + }; + slider?: { + trackSize?: number; + trackColor?: string; + trackColorSelected?: string; + handleSize?: number; + handleSizeDisabled?: number; + handleSizeActive?: number; + handleColorZero?: string; + handleFillColor?: string; + selectionColor?: string; + rippleColor?: string; + }; + snackbar?: { + textColor?: string; + backgroundColor?: string; + actionColor?: string; + }; + subheader?: { + color?: string; + fontWeight?: number; + }; + stepper?: { + backgroundColor?: string; + hoverBackgroundColor?: string; + iconColor?: string; + hoveredIconColor?: string; + inactiveIconColor?: string; + textColor?: string; + disabledTextColor?: string; + connectorLineColor?: string; + }; + table?: { + backgroundColor?: string; + }; + tableFooter?: { + borderColor?: string; + textColor?: string; + }; + tableHeader?: { + borderColor?: string; + }; + tableHeaderColumn?: { + textColor?: string; + height?: number; + spacing?: number; + }; + tableRow?: { + hoverColor?: string; + stripeColor?: string; + selectedColor?: string; + textColor?: string; + borderColor?: string; + height?: number; + }; + tableRowColumn?: { + height?: number; + spacing?: number; + }; + tabs?: { + backgroundColor?: string; + textColor?: string; + selectedTextColor?: string; + }; + textField?: { + textColor?: string; + hintColor?: string; + floatingLabelColor?: string; + disabledTextColor?: string; + errorColor?: string; + focusColor?: string; + backgroundColor?: string; + borderColor?: string; + }; + timePicker?: { + color?: string; + textColor?: string; + accentColor?: string; + clockColor?: string; + clockCircleColor?: string; + headerColor?: string; + selectColor?: string; + selectTextColor?: string; + }; + toggle?: { + thumbOnColor?: string; + thumbOffColor?: string; + thumbDisabledColor?: string; + thumbRequiredColor?: string; + trackOnColor?: string; + trackOffColor?: string; + trackDisabledColor?: string; + labelColor?: string; + labelDisabledColor?: string; + trackRequiredColor?: string; + }; + toolbar?: { + color?: string; + hoverColor?: string; + backgroundColor?: string; + height?: number; + titleFontSize?: number; + iconColor?: string; + separatorColor?: string; + menuHoverColor?: string; + }; + tooltip?: { + color?: string; + rippleBackgroundColor?: string; + }; + } + + interface zIndex { + menu: number; + appBar: number; + drawerOverlay: number; + navDrawer: number; + dialogOverlay: number; + dialog: number; + layer: number; + popover: number; + snackbar: number; + tooltip: number; + } + export var zIndex: zIndex; + + interface RawTheme { + spacing?: Spacing; + fontFamily?: string; + palette?: ThemePalette; + } + var lightBaseTheme: RawTheme; + var darkBaseTheme: RawTheme; + + export function muiThemeable, P, S>(): (component: TComponent) => TComponent; + + //** @deprecated use MuiThemeProvider instead **/ + export function themeDecorator(muiTheme: Styles.MuiTheme): (Component: TFunction) => TFunction; + + interface MuiThemeProviderProps extends React.Props { + muiTheme: Styles.MuiTheme; + } + export class MuiThemeProvider extends React.Component{ + } + + export function getMuiTheme(...muiTheme: MuiTheme[]): MuiTheme; + + interface ThemeManager { + //** @deprecated ThemeManager is deprecated. please import getMuiTheme directly from "material-ui/styles/getMuiTheme" **/ + getMuiTheme(baseTheme: RawTheme, muiTheme?: MuiTheme): MuiTheme; + + //** @deprecated modifyRawThemeSpacing is deprecated. please use getMuiTheme to modify your theme directly. http://www.material-ui.com/#/customization/themes **/ + modifyRawThemeSpacing(muiTheme: MuiTheme, newSpacing: Spacing): MuiTheme; + + //** @deprecated modifyRawThemePalette is deprecated. please use getMuiTheme to modify your theme directly. http://www.material-ui.com/#/customization/themes **/ + modifyRawThemePalette(muiTheme: MuiTheme, newPaletteKeys: ThemePalette): MuiTheme; + + //** @deprecated modifyRawThemeFontFamily is deprecated. please use getMuiTheme to modify your theme directly. http://www.material-ui.com/#/customization/themes **/ + modifyRawThemeFontFamily(muiTheme: MuiTheme, newFontFamily: string): MuiTheme; + } + export var ThemeManager: ThemeManager; + + interface Transitions { + easeOut(duration?: string, property?: string | string[], delay?: string, easeFunction?: string): string; + create(duration?: string, property?: string, delay?: string, easeFunction?: string): string; + easeOutFunction: string; + easeInOutFunction: string; + } + export var Transitions: Transitions; + + interface Typography { + textFullBlack: string; + textDarkBlack: string; + textLightBlack: string; + textMinBlack: string; + textFullWhite: string; + textDarkWhite: string; + textLightWhite: string; + + // font weight + fontWeightLight: number; + fontWeightNormal: number; + fontWeightMedium: number; + + fontStyleButtonFontSize: number; + } + export var Typography: Typography; + + //** @deprecated use darkBaseTheme instead **/ + export var DarkRawTheme: RawTheme; + + //** @deprecated use lightBaseTheme instead **/ + export var LightRawTheme: RawTheme; + } + + interface AppBarProps extends React.Props { + className?: string; + iconClassNameLeft?: string; + iconClassNameRight?: string; + iconElementLeft?: React.ReactElement; + iconElementRight?: React.ReactElement; + iconStyleRight?: string; + onLeftIconButtonTouchTap?: TouchTapEventHandler; + onRightIconButtonTouchTap?: TouchTapEventHandler; + onTitleTouchTap?: TouchTapEventHandler; + showMenuIconButton?: boolean; + style?: React.CSSProperties; + title?: React.ReactNode; + titleStyle?: React.CSSProperties; + zDepth?: number; + } + export class AppBar extends React.Component{ + } + + interface AppCanvasProps extends React.Props { + } + export class AppCanvas extends React.Component { + } + + namespace propTypes { + type horizontal = 'left' | 'middle' | 'right'; + type vertical = 'top' | 'center' | 'bottom'; + + interface origin { + horizontal: horizontal; + vertical: vertical; + } + + type corners = 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right'; + type cornersAndCenter = 'bottom-center' | 'bottom-left' | 'bottom-right' | 'top-center' | 'top-left' | 'top-right'; + } + + type AutoCompleteDataItem = { text: string, value: React.ReactNode } | string; + type AutoCompleteDataSource = { text: string, value: React.ReactNode }[] | string[]; + interface AutoCompleteProps extends React.Props { + anchorOrigin?: propTypes.origin; + animated?: boolean; + dataSource: AutoCompleteDataSource; + disableFocusRipple?: boolean; + errorStyle?: React.CSSProperties; + errorText?: string; + filter?: (searchText: string, key: string, item: AutoCompleteDataItem) => boolean; + floatingLabelText?: string; + fullWidth?: boolean; + hintText?: string; + listStyle?: React.CSSProperties; + maxSearchResults?: number; + menuCloseDelay?: number; + menuProps?: any; + menuStyle?: React.CSSProperties; + onBlur?: React.FocusEventHandler; + onFocus?: React.FocusEventHandler; + onKeyDown?: React.KeyboardEventHandler; + onNewRequest?: (chosenRequest: string, index: number) => void; + onUpdateInput?: (searchText: string, dataSource: AutoCompleteDataSource) => void; + open?: boolean; + openOnFocus?: boolean; + searchText?: string; + style?: React.CSSProperties; + targetOrigin?: propTypes.origin; + /** @deprecated Instead, use openOnFocus */ + triggerUpdateOnFocus?: boolean; + } + export class AutoComplete extends React.Component { + static noFilter: () => boolean; + static defaultFilter: (searchText: string, key: string) => boolean; + static caseSensitiveFilter: (searchText: string, key: string) => boolean; + static caseInsensitiveFilter: (searchText: string, key: string) => boolean; + static levenshteinDistanceFilter(distanceLessThan: number): (searchText: string, key: string) => boolean; + static fuzzyFilter: (searchText: string, key: string) => boolean; + static Item: Menus.MenuItem; + static Divider: Divider; + } + + interface AvatarProps extends React.Props { + backgroundColor?: string; + className?: string; + color?: string; + icon?: React.ReactElement; + size?: number; + src?: string; + style?: React.CSSProperties; + } + export class Avatar extends React.Component { + } + + interface BadgeProps extends React.Props { + badgeContent: React.ReactNode; + badgeStyle?: React.CSSProperties; + className?: string; + primary?: boolean; + secondary?: boolean; + style?: React.CSSProperties; + } + export class Badge extends React.Component { + } + + interface BeforeAfterWrapperProps extends React.Props { + afterElementType?: string; + afterStyle?: React.CSSProperties; + beforeElementType?: string; + beforeStyle?: React.CSSProperties; + elementType?: string; + style?: React.CSSProperties; + } + export class BeforeAfterWrapper extends React.Component { + } + + // non generally overridden elements of EnhancedButton + interface SharedEnhancedButtonProps extends React.Props { + centerRipple?: boolean; + disableFocusRipple?: boolean; + disableKeyboardFocus?: boolean; + disableTouchRipple?: boolean; + focusRippleColor?: string; + focusRippleOpacity?: number; + keyboardFocused?: boolean; + linkButton?: boolean; + onBlur?: React.FocusEventHandler; + onFocus?: React.FocusEventHandler; + onKeyboardFocus?: (e: React.FocusEvent, isKeyboardFocused: boolean) => void; + onKeyDown?: React.KeyboardEventHandler; + onKeyUp?: React.KeyboardEventHandler; + onTouchTap?: TouchTapEventHandler; + onClick?: React.MouseEventHandler; + style?: React.CSSProperties; + tabIndex?: number; + touchRippleColor?: string; + touchRippleOpacity?: number; + type?: string; + containerElement?: React.ReactNode | string; + } + + interface EnhancedButtonProps extends React.HTMLAttributes, SharedEnhancedButtonProps { + // container element,