diff --git a/angular-bootstrap-calendar/index.d.ts b/angular-bootstrap-calendar/index.d.ts index bb529e706b..da0924bb26 100644 --- a/angular-bootstrap-calendar/index.d.ts +++ b/angular-bootstrap-calendar/index.d.ts @@ -4,9 +4,10 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import * as moment from '../moment'; +import * as angular from 'angularjs'; -declare global { - namespace angular.bootstrap.calendar { +declare module 'angularjs' { + export namespace bootstrap.calendar { interface IEvent { /** * The title of the event diff --git a/angular-fullscreen/index.d.ts b/angular-fullscreen/index.d.ts index b58830952b..fce309e981 100644 --- a/angular-fullscreen/index.d.ts +++ b/angular-fullscreen/index.d.ts @@ -5,30 +5,34 @@ /// -declare namespace angular.fullscreen { +import * as angular from 'angularjs'; - /** - * Prefixing interface name with "I" is not recommended: http://www.typescriptlang.org/Handbook#writing-dts-files - * However, we let it here to keep consistency with all the other Angular-related definitions - */ - interface IFullscreen { - // enable document fullscreen - all(): void; +declare module 'angularjs' { + export namespace fullscreen { - // enable or disable the document fullscreen - toggleAll(): void; + /** + * Prefixing interface name with "I" is not recommended: http://www.typescriptlang.org/Handbook#writing-dts-files + * However, we let it here to keep consistency with all the other Angular-related definitions + */ + interface IFullscreen { + // enable document fullscreen + all(): void; - // enable fullscreen to a specific element - enable(element: Element|HTMLElement): void; + // enable or disable the document fullscreen + toggleAll(): void; - // disable fullscreen - cancel(): void; + // enable fullscreen to a specific element + enable(element: Element|HTMLElement): void; - // return true if fullscreen is enabled, otherwise false - isEnabled(): boolean; + // disable fullscreen + cancel(): void; - // return true if fullscreen API is supported by your browser - isSupported(): boolean; + // return true if fullscreen is enabled, otherwise false + isEnabled(): boolean; + + // return true if fullscreen API is supported by your browser + isSupported(): boolean; + } } } diff --git a/angular-growl-v2/index.d.ts b/angular-growl-v2/index.d.ts index 4f1eeb16b8..f2d6cb905d 100644 --- a/angular-growl-v2/index.d.ts +++ b/angular-growl-v2/index.d.ts @@ -5,255 +5,259 @@ /// -declare namespace angular.growl { +import * as angular from 'angularjs'; - /** - * Global Time-To-Leave configuration. - */ - interface IGrowlTTLConfig { - success?: number; - error?: number; - warning?: number; - info?: number; - } - - /** - * Custom configuration used in single message call. - */ - interface IGrowlMessageConfig { - title?: string; - ttl?: number; - disableCountDown?: boolean; - disableIcons?: boolean; - disableCloseButton?: boolean; - onclose?: Function; - onopen?: Function; - position?: string; - referenceId?: number; - translateMessage?: boolean; - variables?: { [variable: string]: any; }; - } - - /** - * Growl message with configuration. - */ - interface IGrowlMessage extends IGrowlMessageConfig { - text: string; +declare module 'angularjs' { + export namespace growl { /** - * Destroy the message. + * Global Time-To-Leave configuration. */ - destroy(): void; - /** - * Update the message body. - * @param newText new message body - */ - setText(newText: string): void; - } - - /** - * Growl service provider. - */ - interface IGrowlProvider extends angular.IServiceProvider { - /** - * Pre-defined server error interceptor. - */ - serverMessagesInterceptor: (string|IHttpInterceptorFactory)[]; + interface IGrowlTTLConfig { + success?: number; + error?: number; + warning?: number; + info?: number; + } /** - * Set default TTL settings. - * @param ttl configuration of TTL for different type of message + * Custom configuration used in single message call. */ - globalTimeToLive(ttl: IGrowlTTLConfig): IGrowlProvider; - /** - * Set default TTL settings. - * @param ttl ttl in milliseconds - */ - globalTimeToLive(ttl: number): IGrowlProvider; - /** - * Set default setting for disabling close button. - * @param disableCloseButton - */ - globalDisableCloseButton(disableCloseButton: boolean): IGrowlProvider; - /** - * Set default setting for disabling icons. - * @param disableIcons - */ - globalDisableIcons(disableIcons: boolean): IGrowlProvider; - /** - * Set reversing order of displaying new messages. - * @param reverseOrder - */ - globalReversedOrder(reverseOrder: boolean): IGrowlProvider; - /** - * Set default setting for displaying message disappear countdown. - * @param disableCountDown - */ - globalDisableCountDown(disableCountDown: boolean): IGrowlProvider; - /** - * Set default allowance for inline messages. - * @param inline - */ - globalInlineMessages(inline: boolean): IGrowlProvider; - /** - * Set default message position. - * @param position - */ - globalPosition(position: string): IGrowlProvider; - /** - * Enable/disable displaying only unique messages. - * @param onlyUniqueMessages - */ - onlyUniqueMessages(onlyUniqueMessages: boolean): IGrowlProvider; + interface IGrowlMessageConfig { + title?: string; + ttl?: number; + disableCountDown?: boolean; + disableIcons?: boolean; + disableCloseButton?: boolean; + onclose?: Function; + onopen?: Function; + position?: string; + referenceId?: number; + translateMessage?: boolean; + variables?: { [variable: string]: any; }; + } /** - * Set key where messages are stored (for http interceptor). - * @param messageVariableKey + * Growl message with configuration. */ - messagesKey(messageKey: string): IGrowlProvider; - /** - * Set key where message text is stored (for http interceptor). - * @param messageVariableKey - */ - messageTextKey(messageTextKey: string): IGrowlProvider; - /** - * Set key where title of message is stored (for http interceptor). - * @param messageVariableKey - */ - messageTitleKey(messageTitleKey: string): IGrowlProvider; - /** - * Set key where severity of message is stored (for http interceptor). - * @param messageVariableKey - */ - messageSeverityKey(messageSeverityKey: string): IGrowlProvider; - /** - * Set key where variables for message are stored (for http interceptor). - * @param messageVariableKey - */ - messageVariableKey(messageVariableKey: string): IGrowlProvider; - } + interface IGrowlMessage extends IGrowlMessageConfig { + text: string; - /** - * Growl service. - */ - interface IGrowlService { - /** - * Show warning message. - * @param message text to display (or code for angular-translate) - */ - warning(message: string): IGrowlMessage; - /** - * Show warning message. - * @param message text to display (or code for angular-translate) - * @param config additional message configuration - */ - warning(message: string, config: IGrowlMessageConfig): IGrowlMessage; + /** + * Destroy the message. + */ + destroy(): void; + /** + * Update the message body. + * @param newText new message body + */ + setText(newText: string): void; + } /** - * Show error message. - * @param message text to display (or code for angular-translate) + * Growl service provider. */ - error(message: string): IGrowlMessage; - /** - * Show error message. - * @param message text to display (or code for angular-translate) - * @param config additional message configuration - */ - error(message: string, config: IGrowlMessageConfig): IGrowlMessage; + interface IGrowlProvider extends angular.IServiceProvider { + /** + * Pre-defined server error interceptor. + */ + serverMessagesInterceptor: (string | IHttpInterceptorFactory)[]; + + /** + * Set default TTL settings. + * @param ttl configuration of TTL for different type of message + */ + globalTimeToLive(ttl: IGrowlTTLConfig): IGrowlProvider; + /** + * Set default TTL settings. + * @param ttl ttl in milliseconds + */ + globalTimeToLive(ttl: number): IGrowlProvider; + /** + * Set default setting for disabling close button. + * @param disableCloseButton + */ + globalDisableCloseButton(disableCloseButton: boolean): IGrowlProvider; + /** + * Set default setting for disabling icons. + * @param disableIcons + */ + globalDisableIcons(disableIcons: boolean): IGrowlProvider; + /** + * Set reversing order of displaying new messages. + * @param reverseOrder + */ + globalReversedOrder(reverseOrder: boolean): IGrowlProvider; + /** + * Set default setting for displaying message disappear countdown. + * @param disableCountDown + */ + globalDisableCountDown(disableCountDown: boolean): IGrowlProvider; + /** + * Set default allowance for inline messages. + * @param inline + */ + globalInlineMessages(inline: boolean): IGrowlProvider; + /** + * Set default message position. + * @param position + */ + globalPosition(position: string): IGrowlProvider; + /** + * Enable/disable displaying only unique messages. + * @param onlyUniqueMessages + */ + onlyUniqueMessages(onlyUniqueMessages: boolean): IGrowlProvider; + + /** + * Set key where messages are stored (for http interceptor). + * @param messageVariableKey + */ + messagesKey(messageKey: string): IGrowlProvider; + /** + * Set key where message text is stored (for http interceptor). + * @param messageVariableKey + */ + messageTextKey(messageTextKey: string): IGrowlProvider; + /** + * Set key where title of message is stored (for http interceptor). + * @param messageVariableKey + */ + messageTitleKey(messageTitleKey: string): IGrowlProvider; + /** + * Set key where severity of message is stored (for http interceptor). + * @param messageVariableKey + */ + messageSeverityKey(messageSeverityKey: string): IGrowlProvider; + /** + * Set key where variables for message are stored (for http interceptor). + * @param messageVariableKey + */ + messageVariableKey(messageVariableKey: string): IGrowlProvider; + } /** - * Show information message. - * @param message text to display (or code for angular-translate) + * Growl service. */ - info(message: string): IGrowlMessage; - /** - * Show information message. - * @param message text to display (or code for angular-translate) - * @param config additional message configuration - */ - info(message: string, config: IGrowlMessageConfig): IGrowlMessage; + interface IGrowlService { + /** + * Show warning message. + * @param message text to display (or code for angular-translate) + */ + warning(message: string): IGrowlMessage; + /** + * Show warning message. + * @param message text to display (or code for angular-translate) + * @param config additional message configuration + */ + warning(message: string, config: IGrowlMessageConfig): IGrowlMessage; + + /** + * Show error message. + * @param message text to display (or code for angular-translate) + */ + error(message: string): IGrowlMessage; + /** + * Show error message. + * @param message text to display (or code for angular-translate) + * @param config additional message configuration + */ + error(message: string, config: IGrowlMessageConfig): IGrowlMessage; + + /** + * Show information message. + * @param message text to display (or code for angular-translate) + */ + info(message: string): IGrowlMessage; + /** + * Show information message. + * @param message text to display (or code for angular-translate) + * @param config additional message configuration + */ + info(message: string, config: IGrowlMessageConfig): IGrowlMessage; + + /** + * Show success message. + * @param message text to display (or code for angular-translate) + * @param config additional message configuration + */ + success(message: string): IGrowlMessage; + /** + * Show success message. + * @param message text to display (or code for angular-translate) + */ + success(message: string, config: IGrowlMessageConfig): IGrowlMessage; + + /** + * Show message (generic). + * @param message text to display (or code for angular-translate) + */ + general(message: string): IGrowlMessage; + /** + * Show message (generic). + * @param message text to display (or code for angular-translate) + * @param config additional message configuration + */ + general(message: string, config: IGrowlMessageConfig): IGrowlMessage; + /** + * Show message (generic). + * @param message text to display (or code for angular-translate) + * @param config additional message configuration + * @param severity message severity (error, warning, success, info). + */ + general(message: string, config: IGrowlMessageConfig, severity: string): IGrowlMessage; + + /** + * Get current setting for displaying only unique messages. + */ + onlyUnique(): boolean; + /** + * Get current setting for reversing messages order. + */ + reverseOrder(): boolean; + /** + * Get current allowance for inline messages. + */ + inlineMessages(): boolean; + /** + * Get current messages position. + */ + position(): string; + } /** - * Show success message. - * @param message text to display (or code for angular-translate) - * @param config additional message configuration + * GrowlMessages service. */ - success(message: string): IGrowlMessage; - /** - * Show success message. - * @param message text to display (or code for angular-translate) - */ - success(message: string, config: IGrowlMessageConfig): IGrowlMessage; + interface IGrowlMessagesService { + /** + * Initialize a directive + * We look at the preloaded directive and use this else we + * create a new blank object + * @param referenceId + * @param limitMessages + */ + initDirective(referenceId: number, limitMessages: number): angular.IDirective; - /** - * Show message (generic). - * @param message text to display (or code for angular-translate) - */ - general(message: string): IGrowlMessage; - /** - * Show message (generic). - * @param message text to display (or code for angular-translate) - * @param config additional message configuration - */ - general(message: string, config: IGrowlMessageConfig): IGrowlMessage; - /** - * Show message (generic). - * @param message text to display (or code for angular-translate) - * @param config additional message configuration - * @param severity message severity (error, warning, success, info). - */ - general(message: string, config: IGrowlMessageConfig, severity: string): IGrowlMessage; + /** + * Get current messages + */ + getAllMessages(referenceId?: number): IGrowlMessage[]; - /** - * Get current setting for displaying only unique messages. - */ - onlyUnique(): boolean; - /** - * Get current setting for reversing messages order. - */ - reverseOrder(): boolean; - /** - * Get current allowance for inline messages. - */ - inlineMessages(): boolean; - /** - * Get current messages position. - */ - position(): string; - } + /** + * Destroy all messages + */ + destroyAllMessages(referenceId?: number): void; - /** - * GrowlMessages service. - */ - interface IGrowlMessagesService { - /** - * Initialize a directive - * We look at the preloaded directive and use this else we - * create a new blank object - * @param referenceId - * @param limitMessages - */ - initDirective(referenceId: number, limitMessages: number): angular.IDirective; + /** + * Add a message + */ + addMessage(message: IGrowlMessage): IGrowlMessage; - /** - * Get current messages - */ - getAllMessages(referenceId?: number): IGrowlMessage[]; - - /** - * Destroy all messages - */ - destroyAllMessages(referenceId?: number): void; - - /** - * Add a message - */ - addMessage(message: IGrowlMessage): IGrowlMessage; - - /** - * Delete a message - */ - deleteMessage(message: IGrowlMessage): void; + /** + * Delete a message + */ + deleteMessage(message: IGrowlMessage): void; + } } } diff --git a/angular-hotkeys/index.d.ts b/angular-hotkeys/index.d.ts index 81bb773925..ff4067945a 100644 --- a/angular-hotkeys/index.d.ts +++ b/angular-hotkeys/index.d.ts @@ -5,46 +5,50 @@ /// -declare namespace angular.hotkeys { +import * as angular from 'angularjs'; - interface HotkeysProvider { - template: string; - templateTitle:string; - includeCheatSheet: boolean; - cheatSheetHotkey: string; - cheatSheetDescription: string; +declare module 'angularjs' { + export namespace hotkeys { - add(combo: string|string[], callback: (event: Event, hotkey?: Hotkey) => void, action?: string, allowIn?: Array, persistent?: boolean): ng.hotkeys.Hotkey; + interface HotkeysProvider { + template: string; + templateTitle: string; + includeCheatSheet: boolean; + cheatSheetHotkey: string; + cheatSheetDescription: string; - add(combo: string|string[], description: string, callback: (event: Event, hotkey?: Hotkey) => void, action?: string, allowIn?: Array, persistent?: boolean): ng.hotkeys.Hotkey; + add(combo: string | string[], callback: (event: Event, hotkey?: Hotkey) => void, action?: string, allowIn?: Array, persistent?: boolean): ng.hotkeys.Hotkey; - add(hotkeyObj: ng.hotkeys.Hotkey): ng.hotkeys.Hotkey; + add(combo: string | string[], description: string, callback: (event: Event, hotkey?: Hotkey) => void, action?: string, allowIn?: Array, persistent?: boolean): ng.hotkeys.Hotkey; - bindTo(scope : ng.IScope): ng.hotkeys.HotkeysProviderChained; + add(hotkeyObj: ng.hotkeys.Hotkey): ng.hotkeys.Hotkey; - del(combo: string|string[]): void; + bindTo(scope: ng.IScope): ng.hotkeys.HotkeysProviderChained; - del(hotkeyObj: ng.hotkeys.Hotkey): void; + del(combo: string | string[]): void; - get(combo: string|string[]): ng.hotkeys.Hotkey; + del(hotkeyObj: ng.hotkeys.Hotkey): void; - toggleCheatSheet(): void; + get(combo: string | string[]): ng.hotkeys.Hotkey; - purgeHotkeys(): void; - } + toggleCheatSheet(): void; - interface HotkeysProviderChained { - add(combo: string|string[], description: string, callback: (event: Event, hotkeys: ng.hotkeys.Hotkey) => void): HotkeysProviderChained; + purgeHotkeys(): void; + } - add(hotkeyObj: ng.hotkeys.Hotkey): HotkeysProviderChained; - } + interface HotkeysProviderChained { + add(combo: string | string[], description: string, callback: (event: Event, hotkeys: ng.hotkeys.Hotkey) => void): HotkeysProviderChained; - interface Hotkey { - combo: string|string[]; - description?: string; - callback: (event: Event, hotkey: ng.hotkeys.Hotkey) => void; - action?: string; - allowIn?: Array; - persistent?: boolean; + add(hotkeyObj: ng.hotkeys.Hotkey): HotkeysProviderChained; + } + + interface Hotkey { + combo: string | string[]; + description?: string; + callback: (event: Event, hotkey: ng.hotkeys.Hotkey) => void; + action?: string; + allowIn?: Array; + persistent?: boolean; + } } } diff --git a/angular-http-auth/index.d.ts b/angular-http-auth/index.d.ts index 4918c5f4df..4b2a859c8b 100644 --- a/angular-http-auth/index.d.ts +++ b/angular-http-auth/index.d.ts @@ -5,15 +5,19 @@ /// -declare namespace angular.httpAuth { - interface IAuthService { - loginConfirmed(data?:any, configUpdater?:Function):void; - loginCancelled(data?:any, reason?:any):void; - } +import * as angular from 'angularjs'; - interface IHttpBuffer { - append(config:ng.IRequestConfig, deferred:{resolve(data:any):void; reject(data:any):void;}):void; - rejectAll(reason?:any):void; - retryAll(updater?:Function):void; - } +declare module 'angularjs' { + export namespace httpAuth { + interface IAuthService { + loginConfirmed(data?: any, configUpdater?: Function): void; + loginCancelled(data?: any, reason?: any): void; + } + + interface IHttpBuffer { + append(config: ng.IRequestConfig, deferred: { resolve(data: any): void; reject(data: any): void; }): void; + rejectAll(reason?: any): void; + retryAll(updater?: Function): void; + } + } } diff --git a/angular-idle/index.d.ts b/angular-idle/index.d.ts index 2e1d132708..84e96396f8 100644 --- a/angular-idle/index.d.ts +++ b/angular-idle/index.d.ts @@ -5,259 +5,263 @@ /// -declare namespace angular.idle { +import * as angular from 'angularjs'; - /** - * Used to configure the Title service. - */ - interface ITitleProvider extends IServiceProvider { +declare module 'angularjs' { + export namespace idle { /** - * Enables or disables the Title functionality. - * - * @param enabled Boolean, default is true. + * Used to configure the Title service. */ - enabled(enabled: boolean): void; - } + interface ITitleProvider extends IServiceProvider { - interface ITitleService { + /** + * Enables or disables the Title functionality. + * + * @param enabled Boolean, default is true. + */ + enabled(enabled: boolean): void; + } + + interface ITitleService { + + /** + * Allows the title functionality to be enabled or disabled on the fly. + */ + setEnabled(enabled: boolean): void; + + /** + * Returns whether or not the title functionality has been enabled. + */ + isEnabled(): boolean; + + /** + * Will store val as the "original" title of the document. + * + * Tracking the original title is important when restoring the title after displaying, for example, the idle warning message. + */ + original(val: string): void; + + /** + * Returns the "original" title value that has been previously set. + * + * Tracking the original title is important when restoring the title after displaying, for example, the idle warning message. + */ + original(): string; + + /** + * Changes the actual title of the document. + */ + value(val: string): void; + + /** + * Returns the current document title. + */ + value(): string; + + /** + * If overwrite is false or unspecified, updates the "original" title with the current document title + * if it has not already been stored. If overwrite is true, the current document title is stored regardless. + */ + store(overwrite?: boolean): void; + + /** + * Sets the title to the original value (if it was stored or set previously). + */ + restore(): void; + + /** + * Sets the text to use as the message displayed when the user is idle. + */ + idleMessage(val: string): void; + + /** + * Gets the text to use as the message displayed when the user is idle. + */ + idleMessage(): string; + + /** + * Sets the text to use as the message displayed when the user is timed out. + */ + timedOutMessage(val: string): void; + + /** + * Gets the text to use as the message displayed when the user is timed out. + */ + timedOutMessage(): string; + + /** + * Stores the original title if it hasn't been already, determines the number minutes, seconds, + * and total seconds from countdown, and displays the idleMessage with the aforementioned values interpolated. + */ + setAsIdle(countdown: number): void; + + /** + * Stores the original title if it hasn't been already, and displays the timedOutMessage. + */ + setAsTimedOut(): void; + } /** - * Allows the title functionality to be enabled or disabled on the fly. + * Used to configure the Keepalive service. */ - setEnabled(enabled: boolean): void; + interface IKeepAliveProvider extends IServiceProvider { + + /** + * If configured, options will be used to issue a request using $http. + * If the value is null, no HTTP request will be issued. + * You can specify a string, which it will assume to be a URL to a simple GET request. + * Otherwise, you can use the same options $http takes. However, cache will always be false. + * + * @param value May be string or IRequestConfig, default is null. + */ + http(value: string | IRequestConfig): void; + + /** + * This specifies how often the keepalive event is triggered and the + * HTTP request is issued. + * + * @param seconds Integer, default is 10 minutes. Must be greater than 0. + */ + interval(seconds: number): void; + } /** - * Returns whether or not the title functionality has been enabled. + * Keepalive will use a timeout to periodically wake, broadcast a Keepalive event on the root scope, + * and optionally make an $http request. By default, the Idle service will stop and start Keepalive + * when a user becomes idle or returns from idle, respectively. It is also started automatically when + * Idle.watch() is called. This can be disabled by configuring the IdleProvider. */ - isEnabled(): boolean; + interface IKeepAliveService { + + /** + * Starts pinging periodically until stop() is called. + */ + start(): void; + + /** + * Stops pinging. + */ + stop(): void; + + /** + * Performs one ping only. + */ + ping(): void; + + /** + * Changes the interval value at runtime. + * You will need to restart the pinging process by calling start() manually for the changes to be reflected. + */ + setInterval(seconds: number): void; + } /** - * Will store val as the "original" title of the document. - * - * Tracking the original title is important when restoring the title after displaying, for example, the idle warning message. + * Used to configure the Idle service. */ - original(val: string): void; + interface IIdleProvider extends IServiceProvider { + /** + * Specifies the DOM events the service will watch to reset the idle timeout. + * Multiple events should be separated by a space. + * + * @param events string, default 'mousemove keydown DOMMouseScroll mousewheel mousedown' + */ + interrupt(events: string): void; + + /** + * The idle timeout duration in seconds. After this amount of time passes without the user + * performing an action that triggers one of the watched DOM events, the user is considered + * idle. + * + * @param seconds integer, default is 20min + */ + idle(seconds: number): void; + + /** + * The amount of time the user has to respond (in seconds) before they have been considered + * timed out. + * + * @param seconds integer, default is 30s + */ + timeout(seconds: number): void; + + /** + * When true or idle, user activity will automatically interrupt the warning countdown + * and reset the idle state. If false or off, you will need to manually call watch() + * when you want to start watching for idleness again. If notIdle, user activity will + * only automatically interrupt if the user is not yet idle. + * + * @param enabled boolean or string, possible values: off/false, idle/true, or notIdle + */ + autoResume(enabled: boolean | string): void; + + /** + * When true, the Keepalive service is automatically stopped and started as needed. + * + * @param enabled boolean, default is true + */ + keepalive(enabled: boolean): void; + } /** - * Returns the "original" title value that has been previously set. - * - * Tracking the original title is important when restoring the title after displaying, for example, the idle warning message. + * Idle, once watch() is called, will start a timeout which if expires, will enter a warning state + * countdown. Once the countdown reaches zero, idle will broadcast a timeout event indicating the + * user has timed out (where your app should log them out or whatever you like). If the user performs + * an action that triggers a watched DOM event that bubbles up to document.body, this will reset the + * idle/warning state and start the process over again. */ - original(): string; + interface IIdleService { + /** + * Gets the current idle value + */ + getIdle(): number; - /** - * Changes the actual title of the document. - */ - value(val: string): void; + /** + * Gets the current timeout value + */ + getTimeout(): number; - /** - * Returns the current document title. - */ - value(): string; + /** + * Updates the idle value (see IdleProvider.idle()) and + * restarts the watch if its running. + */ + setIdle(idle: number): void; - /** - * If overwrite is false or unspecified, updates the "original" title with the current document title - * if it has not already been stored. If overwrite is true, the current document title is stored regardless. - */ - store(overwrite?: boolean): void; + /** + * Updates the timeout value (see IdleProvider.timeout()) and + * restarts the watch if its running. + */ + setTimeout(timeout: number): void; - /** - * Sets the title to the original value (if it was stored or set previously). - */ - restore(): void; + /** + * Whether user has timed out (meaning idleDuration + timeout has passed without any activity) + */ + isExpired(): boolean; - /** - * Sets the text to use as the message displayed when the user is idle. - */ - idleMessage(val: string): void; + /** + * Whether or not the watch() has been called and it is watching for idleness. + */ + running(): boolean; - /** - * Gets the text to use as the message displayed when the user is idle. - */ - idleMessage(): string; + /** + * Whether or not the user appears to be idle. + */ + idling(): boolean; - /** - * Sets the text to use as the message displayed when the user is timed out. - */ - timedOutMessage(val: string): void; + /** + * Starts watching for idleness, or resets the idle/warning state and continues watching. + */ + watch(): void; - /** - * Gets the text to use as the message displayed when the user is timed out. - */ - timedOutMessage(): string; + /** + * Stops watching for idleness, and resets the idle/warning state. + */ + unwatch(): void; - /** - * Stores the original title if it hasn't been already, determines the number minutes, seconds, - * and total seconds from countdown, and displays the idleMessage with the aforementioned values interpolated. - */ - setAsIdle(countdown: number): void; - - /** - * Stores the original title if it hasn't been already, and displays the timedOutMessage. - */ - setAsTimedOut(): void; - } - - /** - * Used to configure the Keepalive service. - */ - interface IKeepAliveProvider extends IServiceProvider { - - /** - * If configured, options will be used to issue a request using $http. - * If the value is null, no HTTP request will be issued. - * You can specify a string, which it will assume to be a URL to a simple GET request. - * Otherwise, you can use the same options $http takes. However, cache will always be false. - * - * @param value May be string or IRequestConfig, default is null. - */ - http(value: string | IRequestConfig): void; - - /** - * This specifies how often the keepalive event is triggered and the - * HTTP request is issued. - * - * @param seconds Integer, default is 10 minutes. Must be greater than 0. - */ - interval(seconds: number): void; - } - - /** - * Keepalive will use a timeout to periodically wake, broadcast a Keepalive event on the root scope, - * and optionally make an $http request. By default, the Idle service will stop and start Keepalive - * when a user becomes idle or returns from idle, respectively. It is also started automatically when - * Idle.watch() is called. This can be disabled by configuring the IdleProvider. - */ - interface IKeepAliveService { - - /** - * Starts pinging periodically until stop() is called. - */ - start(): void; - - /** - * Stops pinging. - */ - stop(): void; - - /** - * Performs one ping only. - */ - ping(): void; - - /** - * Changes the interval value at runtime. - * You will need to restart the pinging process by calling start() manually for the changes to be reflected. - */ - setInterval(seconds: number): void; - } - - /** - * Used to configure the Idle service. - */ - interface IIdleProvider extends IServiceProvider { - /** - * Specifies the DOM events the service will watch to reset the idle timeout. - * Multiple events should be separated by a space. - * - * @param events string, default 'mousemove keydown DOMMouseScroll mousewheel mousedown' - */ - interrupt(events: string): void; - - /** - * The idle timeout duration in seconds. After this amount of time passes without the user - * performing an action that triggers one of the watched DOM events, the user is considered - * idle. - * - * @param seconds integer, default is 20min - */ - idle(seconds: number): void; - - /** - * The amount of time the user has to respond (in seconds) before they have been considered - * timed out. - * - * @param seconds integer, default is 30s - */ - timeout(seconds: number): void; - - /** - * When true or idle, user activity will automatically interrupt the warning countdown - * and reset the idle state. If false or off, you will need to manually call watch() - * when you want to start watching for idleness again. If notIdle, user activity will - * only automatically interrupt if the user is not yet idle. - * - * @param enabled boolean or string, possible values: off/false, idle/true, or notIdle - */ - autoResume(enabled: boolean | string): void; - - /** - * When true, the Keepalive service is automatically stopped and started as needed. - * - * @param enabled boolean, default is true - */ - keepalive(enabled: boolean): void; - } - - /** - * Idle, once watch() is called, will start a timeout which if expires, will enter a warning state - * countdown. Once the countdown reaches zero, idle will broadcast a timeout event indicating the - * user has timed out (where your app should log them out or whatever you like). If the user performs - * an action that triggers a watched DOM event that bubbles up to document.body, this will reset the - * idle/warning state and start the process over again. - */ - interface IIdleService { - /** - * Gets the current idle value - */ - getIdle(): number; - - /** - * Gets the current timeout value - */ - getTimeout(): number; - - /** - * Updates the idle value (see IdleProvider.idle()) and - * restarts the watch if its running. - */ - setIdle(idle: number): void; - - /** - * Updates the timeout value (see IdleProvider.timeout()) and - * restarts the watch if its running. - */ - setTimeout(timeout: number): void; - - /** - * Whether user has timed out (meaning idleDuration + timeout has passed without any activity) - */ - isExpired(): boolean; - - /** - * Whether or not the watch() has been called and it is watching for idleness. - */ - running(): boolean; - - /** - * Whether or not the user appears to be idle. - */ - idling(): boolean; - - /** - * Starts watching for idleness, or resets the idle/warning state and continues watching. - */ - watch(): void; - - /** - * Stops watching for idleness, and resets the idle/warning state. - */ - unwatch(): void; - - /** - * Manually trigger the idle interrupt that normally occurs during user activity. - */ - interrupt(): any; + /** + * Manually trigger the idle interrupt that normally occurs during user activity. + */ + interrupt(): any; + } } } diff --git a/angular-jwt/index.d.ts b/angular-jwt/index.d.ts index 49247b2490..1cb0b48d5e 100644 --- a/angular-jwt/index.d.ts +++ b/angular-jwt/index.d.ts @@ -5,26 +5,30 @@ /// -declare namespace angular.jwt { +import * as angular from 'angularjs'; - interface JwtToken { - iss?: string; - sub?: string; - aud?: string; - exp?: number; - nbf?: number; - iat?: number; - jti?: string; - unique_name?: string; - } +declare module 'angularjs' { + export namespace jwt { - interface IJwtHelper { - decodeToken(token: string): JwtToken; - getTokenExpirationDate(token: any): Date; - isTokenExpired(token: any, offsetSeconds?: number): boolean; - } + interface JwtToken { + iss?: string; + sub?: string; + aud?: string; + exp?: number; + nbf?: number; + iat?: number; + jti?: string; + unique_name?: string; + } - interface IJwtInterceptor { - tokenGetter(...params : any[]): string; + interface IJwtHelper { + decodeToken(token: string): JwtToken; + getTokenExpirationDate(token: any): Date; + isTokenExpired(token: any, offsetSeconds?: number): boolean; + } + + interface IJwtInterceptor { + tokenGetter(...params: any[]): string; + } } } diff --git a/angular-loading-bar/index.d.ts b/angular-loading-bar/index.d.ts index 3adca41eba..fa962d6be7 100644 --- a/angular-loading-bar/index.d.ts +++ b/angular-loading-bar/index.d.ts @@ -5,8 +5,33 @@ /// +import * as angular from 'angularjs'; -declare namespace angular { +declare module 'angularjs' { + export namespace loadingBar { + + interface ILoadingBarProvider { + /** + * Turn the spinner on or off + */ + includeSpinner?: boolean; + + /** + * Turn the loading bar on or off + */ + includeBar?: boolean; + + /** + * HTML template + */ + spinnerTemplate?: string; + + /** + * Latency Threshold + */ + latencyThreshold?: number; + } + } interface IRequestShortcutConfig { /** @@ -14,30 +39,5 @@ declare namespace angular { */ ignoreLoadingBar?: boolean; } -} - -declare namespace angular.loadingBar { - - interface ILoadingBarProvider{ - /** - * Turn the spinner on or off - */ - includeSpinner?: boolean; - - /** - * Turn the loading bar on or off - */ - includeBar?: boolean; - - /** - * HTML template - */ - spinnerTemplate?: string; - - /** - * Latency Threshold - */ - latencyThreshold?: number; - } } diff --git a/angular-local-storage/index.d.ts b/angular-local-storage/index.d.ts index beb4208901..bb62ed55e8 100644 --- a/angular-local-storage/index.d.ts +++ b/angular-local-storage/index.d.ts @@ -5,145 +5,149 @@ /// -declare namespace angular.local.storage { - interface ILocalStorageServiceProvider extends angular.IServiceProvider { - /** - * Setter for the prefix - * You should set a prefix to avoid overwriting any local storage variables from the rest of your app - * e.g. localStorageServiceProvider.setPrefix('youAppName'); - * With provider you can use config as this: - * myApp.config(function (localStorageServiceProvider) { - * localStorageServiceProvider.prefix = 'yourAppName'; - * }); - * @param prefix default: ls. - */ - setPrefix(prefix: string):ILocalStorageServiceProvider; - /** - * Setter for the storageType - * @param storageType localstorage or sessionStorage. default: localStorage - */ - setStorageType(storageType: string):ILocalStorageServiceProvider; - /** - * Setter for cookie config - * @param exp number of days before cookies expire (0 = does not expire). default: 30 - * @param path the web path the cookie represents. default: '/' - */ - setStorageCookie(exp: number, path: string):ILocalStorageServiceProvider; - /** - * Set the cookie domain, since this runs inside a the config() block, only providers and constants can be injected. As a result, $location service can't be used here, use a hardcoded string or window.location. - * No default value - */ - setStorageCookieDomain(domain: string):ILocalStorageServiceProvider; - /** - * Send signals for each of the following actions: - * @param setItem default: true - * @param removeItem default: false - */ - setNotify(setItem: boolean, removeItem: boolean):ILocalStorageServiceProvider; - } +import * as angular from 'angularjs'; - interface ICookie { - /** - * Checks if cookies are enabled in the browser. - * Returns: Boolean - */ - isSupported:boolean; - /** - * Directly adds a value to cookies. - * Note: Typically used as a fallback if local storage is not supported. - * Returns: Boolean - * @param key - * @param val - */ - set(key:string, val:string):boolean; - /** - * Directly get a value from a cookie. - * Returns: value from local storage - * @param key - */ - get(key:string):string; - /** - * Remove directly value from a cookie. - * Returns: Boolean - * @param key - */ - remove(key:string):boolean; - /** - * Remove all data for this app from cookie. - */ - clearAll():any; +declare module 'angularjs' { + export namespace local.storage { + interface ILocalStorageServiceProvider extends angular.IServiceProvider { + /** + * Setter for the prefix + * You should set a prefix to avoid overwriting any local storage variables from the rest of your app + * e.g. localStorageServiceProvider.setPrefix('youAppName'); + * With provider you can use config as this: + * myApp.config(function (localStorageServiceProvider) { + * localStorageServiceProvider.prefix = 'yourAppName'; + * }); + * @param prefix default: ls. + */ + setPrefix(prefix: string): ILocalStorageServiceProvider; + /** + * Setter for the storageType + * @param storageType localstorage or sessionStorage. default: localStorage + */ + setStorageType(storageType: string): ILocalStorageServiceProvider; + /** + * Setter for cookie config + * @param exp number of days before cookies expire (0 = does not expire). default: 30 + * @param path the web path the cookie represents. default: '/' + */ + setStorageCookie(exp: number, path: string): ILocalStorageServiceProvider; + /** + * Set the cookie domain, since this runs inside a the config() block, only providers and constants can be injected. As a result, $location service can't be used here, use a hardcoded string or window.location. + * No default value + */ + setStorageCookieDomain(domain: string): ILocalStorageServiceProvider; + /** + * Send signals for each of the following actions: + * @param setItem default: true + * @param removeItem default: false + */ + setNotify(setItem: boolean, removeItem: boolean): ILocalStorageServiceProvider; + } - } + interface ICookie { + /** + * Checks if cookies are enabled in the browser. + * Returns: Boolean + */ + isSupported: boolean; + /** + * Directly adds a value to cookies. + * Note: Typically used as a fallback if local storage is not supported. + * Returns: Boolean + * @param key + * @param val + */ + set(key: string, val: string): boolean; + /** + * Directly get a value from a cookie. + * Returns: value from local storage + * @param key + */ + get(key: string): string; + /** + * Remove directly value from a cookie. + * Returns: Boolean + * @param key + */ + remove(key: string): boolean; + /** + * Remove all data for this app from cookie. + */ + clearAll(): any; - interface ILocalStorageService { - /** - * Checks if the browser support the current storage type(e.g: localStorage, sessionStorage). - * Returns: Boolean - */ - isSupported:boolean; - /** - * Returns: String - */ - getStorageType():string; - /** - * Directly adds a value to local storage. - * If local storage is not supported, use cookies instead. - * Returns: Boolean - * @param key - * @param value - */ - set(key: string, value: T): boolean; - /** - * Directly get a value from local storage. - * If local storage is not supported, use cookies instead. - * Returns: value from local storage - * @param key - */ - get(key: string): T; - /** - * Return array of keys for local storage, ignore keys that not owned. - * Returns: value from local storage - */ - keys(): string[]; - /** - * Remove an item from local storage by key. - * If local storage is not supported, use cookies instead. - * Returns: Boolean - * @param key - */ - remove(key: string): boolean; - /** - * Remove all data for this app from local storage. - * If local storage is not supported, use cookies instead. - * Note: Optionally takes a regular expression string and removes matching. - * Returns: Boolean - * @param regularExpression - */ - clearAll(regularExpression?:RegExp):boolean; - /** - * Bind $scope key to localStorageService. - * Usage: localStorageService.bind(scope, property, value[optional], key[optional]) - * Returns: deregistration function for this listener. - * @param scope - * @param property - * @param value optional - * @param key The corresponding key used in local storage - */ - bind(scope: angular.IScope, property: string, value?: any, key?: string): Function; - /** - * Return the derive key - * Returns String - * @param key - */ - deriveKey(key:string):string; - /** - * Return localStorageService.length, ignore keys that not owned. - * Returns Number - */ - length():number; - /** - * Deal with browser's cookies directly. - */ - cookie:ICookie; - } + } + + interface ILocalStorageService { + /** + * Checks if the browser support the current storage type(e.g: localStorage, sessionStorage). + * Returns: Boolean + */ + isSupported: boolean; + /** + * Returns: String + */ + getStorageType(): string; + /** + * Directly adds a value to local storage. + * If local storage is not supported, use cookies instead. + * Returns: Boolean + * @param key + * @param value + */ + set(key: string, value: T): boolean; + /** + * Directly get a value from local storage. + * If local storage is not supported, use cookies instead. + * Returns: value from local storage + * @param key + */ + get(key: string): T; + /** + * Return array of keys for local storage, ignore keys that not owned. + * Returns: value from local storage + */ + keys(): string[]; + /** + * Remove an item from local storage by key. + * If local storage is not supported, use cookies instead. + * Returns: Boolean + * @param key + */ + remove(key: string): boolean; + /** + * Remove all data for this app from local storage. + * If local storage is not supported, use cookies instead. + * Note: Optionally takes a regular expression string and removes matching. + * Returns: Boolean + * @param regularExpression + */ + clearAll(regularExpression?: RegExp): boolean; + /** + * Bind $scope key to localStorageService. + * Usage: localStorageService.bind(scope, property, value[optional], key[optional]) + * Returns: deregistration function for this listener. + * @param scope + * @param property + * @param value optional + * @param key The corresponding key used in local storage + */ + bind(scope: angular.IScope, property: string, value?: any, key?: string): Function; + /** + * Return the derive key + * Returns String + * @param key + */ + deriveKey(key: string): string; + /** + * Return localStorageService.length, ignore keys that not owned. + * Returns Number + */ + length(): number; + /** + * Deal with browser's cookies directly. + */ + cookie: ICookie; + } + } } diff --git a/angular-localForage/index.d.ts b/angular-localForage/index.d.ts index 87d16c96f4..4a11f93b57 100644 --- a/angular-localForage/index.d.ts +++ b/angular-localForage/index.d.ts @@ -6,58 +6,62 @@ /// /// -declare namespace angular.localForage { +import * as angular from 'angularjs'; - interface LocalForageConfig { - driver?:string; - name?:string | number; - version?:number; - storeName?:string; - description?:string; - } +declare module 'angularjs' { + export namespace localForage { - interface ILocalForageProvider { - config(config:LocalForageConfig):void; - setNotify(onItemSet:boolean, onItemRemove:boolean):void; - } + interface LocalForageConfig { + driver?: string; + name?: string | number; + version?: number; + storeName?: string; + description?: string; + } - interface ILocalForageService { - driver(): LocalForageDriver; - setDriver(name: string | string[]): angular.IPromise; + interface ILocalForageProvider { + config(config: LocalForageConfig): void; + setNotify(onItemSet: boolean, onItemRemove: boolean): void; + } - setItem(key:string, value:any):angular.IPromise; - setItem(keys:Array, values:Array):angular.IPromise; + interface ILocalForageService { + driver(): LocalForageDriver; + setDriver(name: string | string[]): angular.IPromise; - getItem(key:string):angular.IPromise; - getItem(keys:Array):angular.IPromise>; + setItem(key: string, value: any): angular.IPromise; + setItem(keys: Array, values: Array): angular.IPromise; - removeItem(key:string | Array):angular.IPromise; + getItem(key: string): angular.IPromise; + getItem(keys: Array): angular.IPromise>; - pull(key:string):angular.IPromise; - pull(keys:Array):angular.IPromise>; + removeItem(key: string | Array): angular.IPromise; - clear():angular.IPromise; + pull(key: string): angular.IPromise; + pull(keys: Array): angular.IPromise>; - key(n:number):angular.IPromise; + clear(): angular.IPromise; - keys():angular.IPromise; + key(n: number): angular.IPromise; - length():angular.IPromise; + keys(): angular.IPromise; - iterate(iteratorCallback:(value:string | number, key:string)=>T):angular.IPromise; + length(): angular.IPromise; - bind($scope:ng.IScope, key:string):angular.IPromise; + iterate(iteratorCallback: (value: string | number, key: string) => T): angular.IPromise; - bind($scope:ng.IScope, config:{ - key:string; - defaultValue?:any; - scopeKey?:string; - name?:string; - }):angular.IPromise; + bind($scope: ng.IScope, key: string): angular.IPromise; - unbind($scope:ng.IScope, key:string, scopeKey?:string):void; + bind($scope: ng.IScope, config: { + key: string; + defaultValue?: any; + scopeKey?: string; + name?: string; + }): angular.IPromise; - createInstance(config:LocalForageConfig):ILocalForageService; - instance(name:string):ILocalForageService; + unbind($scope: ng.IScope, key: string, scopeKey?: string): void; + + createInstance(config: LocalForageConfig): ILocalForageService; + instance(name: string): ILocalForageService; + } } } diff --git a/angular-material/index.d.ts b/angular-material/index.d.ts index dd4e7c1233..189eecc983 100644 --- a/angular-material/index.d.ts +++ b/angular-material/index.d.ts @@ -4,271 +4,276 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// -declare namespace angular.material { - interface IBottomSheetOptions { - templateUrl?: string; - template?: string; - scope?: angular.IScope; // default: new child scope - preserveScope?: boolean; // default: false - controller?: string|Function; - locals?: {[index: string]: any}; - targetEvent?: MouseEvent; - resolve?: {[index: string]: angular.IPromise} - controllerAs?: string; - bindToController?: boolean; - parent?: string|Element|JQuery; // default: root node - disableParentScroll?: boolean; // default: true - } +import * as angular from 'angularjs'; - interface IBottomSheetService { - show(options: IBottomSheetOptions): angular.IPromise; - hide(response?: any): void; - cancel(response?: any): void; - } +declare module 'angularjs' { + export namespace material { - interface IPresetDialog { - title(title: string): T; - textContent(textContent: string): T; - htmlContent(htmlContent: string): T; - ok(ok: string): T; - theme(theme: string): T; - templateUrl(templateUrl?: string): T; - template(template?: string): T; - targetEvent(targetEvent?: MouseEvent): T; - scope(scope?: angular.IScope): T; // default: new child scope - preserveScope(preserveScope?: boolean): T; // default: false - disableParentScroll(disableParentScroll?: boolean): T; // default: true - hasBackdrop(hasBackdrop?: boolean): T; // default: true - clickOutsideToClose(clickOutsideToClose?: boolean): T; // default: false - escapeToClose(escapeToClose?: boolean): T; // default: true - focusOnOpen(focusOnOpen?: boolean): T; // default: true - controller(controller?: string|Function): T; - locals(locals?: {[index: string]: any}): T; - bindToController(bindToController?: boolean): T; // default: false - resolve(resolve?: {[index: string]: angular.IPromise}): T; - controllerAs(controllerAs?: string): T; - parent(parent?: string|Element|JQuery): T; // default: root node - onComplete(onComplete?: Function): T; - ariaLabel(ariaLabel: string): T; - } + interface IBottomSheetOptions { + templateUrl?: string; + template?: string; + scope?: angular.IScope; // default: new child scope + preserveScope?: boolean; // default: false + controller?: string | Function; + locals?: { [index: string]: any }; + targetEvent?: MouseEvent; + resolve?: { [index: string]: angular.IPromise } + controllerAs?: string; + bindToController?: boolean; + parent?: string | Element | JQuery; // default: root node + disableParentScroll?: boolean; // default: true + } - interface IAlertDialog extends IPresetDialog { - } + interface IBottomSheetService { + show(options: IBottomSheetOptions): angular.IPromise; + hide(response?: any): void; + cancel(response?: any): void; + } - interface IConfirmDialog extends IPresetDialog { - cancel(cancel: string): IConfirmDialog; - } + interface IPresetDialog { + title(title: string): T; + textContent(textContent: string): T; + htmlContent(htmlContent: string): T; + ok(ok: string): T; + theme(theme: string): T; + templateUrl(templateUrl?: string): T; + template(template?: string): T; + targetEvent(targetEvent?: MouseEvent): T; + scope(scope?: angular.IScope): T; // default: new child scope + preserveScope(preserveScope?: boolean): T; // default: false + disableParentScroll(disableParentScroll?: boolean): T; // default: true + hasBackdrop(hasBackdrop?: boolean): T; // default: true + clickOutsideToClose(clickOutsideToClose?: boolean): T; // default: false + escapeToClose(escapeToClose?: boolean): T; // default: true + focusOnOpen(focusOnOpen?: boolean): T; // default: true + controller(controller?: string | Function): T; + locals(locals?: { [index: string]: any }): T; + bindToController(bindToController?: boolean): T; // default: false + resolve(resolve?: { [index: string]: angular.IPromise }): T; + controllerAs(controllerAs?: string): T; + parent(parent?: string | Element | JQuery): T; // default: root node + onComplete(onComplete?: Function): T; + ariaLabel(ariaLabel: string): T; + } - interface IDialogOptions { - templateUrl?: string; - template?: string; - autoWrap?: boolean; // default: true - targetEvent?: MouseEvent; - openFrom?: any; - closeTo?: any; - scope?: angular.IScope; // default: new child scope - preserveScope?: boolean; // default: false - disableParentScroll?: boolean; // default: true - hasBackdrop?: boolean // default: true - clickOutsideToClose?: boolean; // default: false - escapeToClose?: boolean; // default: true - focusOnOpen?: boolean; // default: true - controller?: string|Function; - locals?: {[index: string]: any}; - bindToController?: boolean; // default: false - resolve?: {[index: string]: angular.IPromise} - controllerAs?: string; - parent?: string|Element|JQuery; // default: root node - onShowing?: Function; - onComplete?: Function; - onRemoving?: Function; - fullscreen?: boolean; - } + interface IAlertDialog extends IPresetDialog { + } - interface IDialogService { - show(dialog: IDialogOptions|IAlertDialog|IConfirmDialog): angular.IPromise; - confirm(): IConfirmDialog; - alert(): IAlertDialog; - hide(response?: any): angular.IPromise; - cancel(response?: any): void; - } + interface IConfirmDialog extends IPresetDialog { + cancel(cancel: string): IConfirmDialog; + } - interface IIcon { - (id: string): angular.IPromise; // id is a unique ID or URL - } + interface IDialogOptions { + templateUrl?: string; + template?: string; + autoWrap?: boolean; // default: true + targetEvent?: MouseEvent; + openFrom?: any; + closeTo?: any; + scope?: angular.IScope; // default: new child scope + preserveScope?: boolean; // default: false + disableParentScroll?: boolean; // default: true + hasBackdrop?: boolean // default: true + clickOutsideToClose?: boolean; // default: false + escapeToClose?: boolean; // default: true + focusOnOpen?: boolean; // default: true + controller?: string | Function; + locals?: { [index: string]: any }; + bindToController?: boolean; // default: false + resolve?: { [index: string]: angular.IPromise } + controllerAs?: string; + parent?: string | Element | JQuery; // default: root node + onShowing?: Function; + onComplete?: Function; + onRemoving?: Function; + fullscreen?: boolean; + } - interface IIconProvider { - icon(id: string, url: string, viewBoxSize?: number): IIconProvider; // viewBoxSize default: 24 - iconSet(id: string, url: string, viewBoxSize?: number): IIconProvider; // viewBoxSize default: 24 - defaultIconSet(url: string, viewBoxSize?: number): IIconProvider; // viewBoxSize default: 24 - defaultViewBoxSize(viewBoxSize: number): IIconProvider; // default: 24 - defaultFontSet(name: string): IIconProvider; - } + interface IDialogService { + show(dialog: IDialogOptions | IAlertDialog | IConfirmDialog): angular.IPromise; + confirm(): IConfirmDialog; + alert(): IAlertDialog; + hide(response?: any): angular.IPromise; + cancel(response?: any): void; + } - interface IMedia { - (media: string): boolean; - } + interface IIcon { + (id: string): angular.IPromise; // id is a unique ID or URL + } - interface ISidenavObject { - toggle(): angular.IPromise; - open(): angular.IPromise; - close(): angular.IPromise; - isOpen(): boolean; - isLockedOpen(): boolean; - } + interface IIconProvider { + icon(id: string, url: string, viewBoxSize?: number): IIconProvider; // viewBoxSize default: 24 + iconSet(id: string, url: string, viewBoxSize?: number): IIconProvider; // viewBoxSize default: 24 + defaultIconSet(url: string, viewBoxSize?: number): IIconProvider; // viewBoxSize default: 24 + defaultViewBoxSize(viewBoxSize: number): IIconProvider; // default: 24 + defaultFontSet(name: string): IIconProvider; + } - interface ISidenavService { - (component: string): ISidenavObject; - } + interface IMedia { + (media: string): boolean; + } - interface IToastPreset { - textContent(content: string): T; - action(action: string): T; - highlightAction(highlightAction: boolean): T; - highlightClass(highlightClass: string): T; - capsule(capsule: boolean): T; - theme(theme: string): T; - hideDelay(delay: number): T; - position(position: string): T; - parent(parent?: string|Element|JQuery): T; // default: root node - } + interface ISidenavObject { + toggle(): angular.IPromise; + open(): angular.IPromise; + close(): angular.IPromise; + isOpen(): boolean; + isLockedOpen(): boolean; + } - interface ISimpleToastPreset extends IToastPreset { - } + interface ISidenavService { + (component: string): ISidenavObject; + } - interface IToastOptions { - templateUrl?: string; - template?: string; - autoWrap?:boolean; - scope?: angular.IScope; // default: new child scope - preserveScope?: boolean; // default: false - hideDelay?: number; // default (ms): 3000 - position?: string; // any combination of 'bottom'/'left'/'top'/'right'/'fit'; default: 'bottom left' - controller?: string|Function; - locals?: {[index: string]: any}; - bindToController?: boolean; // default: false - resolve?: {[index: string]: angular.IPromise} - controllerAs?: string; - parent?: string|Element|JQuery; // default: root node - } + interface IToastPreset { + textContent(content: string): T; + action(action: string): T; + highlightAction(highlightAction: boolean): T; + highlightClass(highlightClass: string): T; + capsule(capsule: boolean): T; + theme(theme: string): T; + hideDelay(delay: number): T; + position(position: string): T; + parent(parent?: string | Element | JQuery): T; // default: root node + } - interface IToastService { - show(optionsOrPreset: IToastOptions|IToastPreset): angular.IPromise; - showSimple(content: string): angular.IPromise; - simple(): ISimpleToastPreset; - build(): IToastPreset; - updateContent(): void; - hide(response?: any): void; - cancel(response?: any): void; - } + interface ISimpleToastPreset extends IToastPreset { + } - interface IPalette { - 0?: string; - 50?: string; - 100?: string; - 200?: string; - 300?: string; - 400?: string; - 500?: string; - 600?: string; - 700?: string; - 800?: string; - 900?: string; - A100?: string; - A200?: string; - A400?: string; - A700?: string; - contrastDefaultColor?: string; - contrastDarkColors?: string|string[]; - contrastLightColors?: string|string[]; - } + interface IToastOptions { + templateUrl?: string; + template?: string; + autoWrap?: boolean; + scope?: angular.IScope; // default: new child scope + preserveScope?: boolean; // default: false + hideDelay?: number; // default (ms): 3000 + position?: string; // any combination of 'bottom'/'left'/'top'/'right'/'fit'; default: 'bottom left' + controller?: string | Function; + locals?: { [index: string]: any }; + bindToController?: boolean; // default: false + resolve?: { [index: string]: angular.IPromise } + controllerAs?: string; + parent?: string | Element | JQuery; // default: root node + } - interface IThemeHues { - default?: string; - 'hue-1'?: string; - 'hue-2'?: string; - 'hue-3'?: string; - } + interface IToastService { + show(optionsOrPreset: IToastOptions | IToastPreset): angular.IPromise; + showSimple(content: string): angular.IPromise; + simple(): ISimpleToastPreset; + build(): IToastPreset; + updateContent(): void; + hide(response?: any): void; + cancel(response?: any): void; + } - interface IThemePalette { - name: string; - hues: IThemeHues; - } + interface IPalette { + 0?: string; + 50?: string; + 100?: string; + 200?: string; + 300?: string; + 400?: string; + 500?: string; + 600?: string; + 700?: string; + 800?: string; + 900?: string; + A100?: string; + A200?: string; + A400?: string; + A700?: string; + contrastDefaultColor?: string; + contrastDarkColors?: string | string[]; + contrastLightColors?: string | string[]; + } - interface IThemeColors { - accent: IThemePalette; - background: IThemePalette; - primary: IThemePalette; - warn: IThemePalette; - } + interface IThemeHues { + default?: string; + 'hue-1'?: string; + 'hue-2'?: string; + 'hue-3'?: string; + } - interface IThemeGrayScalePalette { - 1: string; - 2: string; - 3: string; - 4: string; - name: string; - } + interface IThemePalette { + name: string; + hues: IThemeHues; + } - interface ITheme { - name: string; - isDark: boolean; - colors: IThemeColors; - foregroundPalette: IThemeGrayScalePalette; - foregroundShadow: string; - accentPalette(name: string, hues?: IThemeHues): ITheme; - primaryPalette(name: string, hues?: IThemeHues): ITheme; - warnPalette(name: string, hues?: IThemeHues): ITheme; - backgroundPalette(name: string, hues?: IThemeHues): ITheme; - dark(isDark?: boolean): ITheme; - } + interface IThemeColors { + accent: IThemePalette; + background: IThemePalette; + primary: IThemePalette; + warn: IThemePalette; + } - interface IThemingProvider { - theme(name: string, inheritFrom?: string): ITheme; - definePalette(name: string, palette: IPalette): IThemingProvider; - extendPalette(name: string, palette: IPalette): IPalette; - setDefaultTheme(theme: string): void; - alwaysWatchTheme(alwaysWatch: boolean): void; - } + interface IThemeGrayScalePalette { + 1: string; + 2: string; + 3: string; + 4: string; + name: string; + } - interface IDateLocaleProvider { - months: string[]; - shortMonths: string[]; - days: string[]; - shortDays: string[]; - dates: string[]; - firstDayOfWeek: number; - parseDate(dateString: string): Date; - formatDate(date: Date): string; - monthHeaderFormatter(date: Date): string; - weekNumberFormatter(weekNumber: number): string; - msgCalendar: string; - msgOpenCalendar: string; - } + interface ITheme { + name: string; + isDark: boolean; + colors: IThemeColors; + foregroundPalette: IThemeGrayScalePalette; + foregroundShadow: string; + accentPalette(name: string, hues?: IThemeHues): ITheme; + primaryPalette(name: string, hues?: IThemeHues): ITheme; + warnPalette(name: string, hues?: IThemeHues): ITheme; + backgroundPalette(name: string, hues?: IThemeHues): ITheme; + dark(isDark?: boolean): ITheme; + } - interface IMenuService { - hide(response?: any, options?: any): angular.IPromise; - } + interface IThemingProvider { + theme(name: string, inheritFrom?: string): ITheme; + definePalette(name: string, palette: IPalette): IThemingProvider; + extendPalette(name: string, palette: IPalette): IPalette; + setDefaultTheme(theme: string): void; + alwaysWatchTheme(alwaysWatch: boolean): void; + } - interface IColorPalette { - red: IPalette; - pink: IPalette; - 'deep-purple': IPalette; - indigo: IPalette; - blue: IPalette; - 'light-blue': IPalette; - cyan: IPalette; - teal: IPalette; - green: IPalette; - 'light-green': IPalette; - lime: IPalette; - yellow: IPalette; - amber: IPalette; - orange: IPalette; - 'deep-orange': IPalette; - brown: IPalette; - grey: IPalette; - 'blue-grey': IPalette; + interface IDateLocaleProvider { + months: string[]; + shortMonths: string[]; + days: string[]; + shortDays: string[]; + dates: string[]; + firstDayOfWeek: number; + parseDate(dateString: string): Date; + formatDate(date: Date): string; + monthHeaderFormatter(date: Date): string; + weekNumberFormatter(weekNumber: number): string; + msgCalendar: string; + msgOpenCalendar: string; + } + + interface IMenuService { + hide(response?: any, options?: any): angular.IPromise; + } + + interface IColorPalette { + red: IPalette; + pink: IPalette; + 'deep-purple': IPalette; + indigo: IPalette; + blue: IPalette; + 'light-blue': IPalette; + cyan: IPalette; + teal: IPalette; + green: IPalette; + 'light-green': IPalette; + lime: IPalette; + yellow: IPalette; + amber: IPalette; + orange: IPalette; + 'deep-orange': IPalette; + brown: IPalette; + grey: IPalette; + 'blue-grey': IPalette; + } } } diff --git a/angular-media-queries/index.d.ts b/angular-media-queries/index.d.ts index e1eb8dffc3..fee67c8de2 100644 --- a/angular-media-queries/index.d.ts +++ b/angular-media-queries/index.d.ts @@ -4,27 +4,32 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// -declare namespace angular.matchmedia { - interface IScreenSize { +import * as angular from 'angularjs'; - // Returns a value indicating if the current device has a retina screen - isRetina: boolean; - - is(list: Array | string): boolean; +declare module 'angularjs' { + export namespace matchmedia { - // Executes the callback function on window resize with the match truthiness as the first argument. - // Returns the current match truthiness. - // The 'scope' parameter is optional. If it's not passed in, '$rootScope' is used. - on(list: Array | string, callback: (result: boolean) => void, scope?: angular.IScope): boolean; + interface IScreenSize { - // Executes the callback function ONLY when the match differs from previous match. - // Returns the current match truthiness. - // The 'scope' parameter is required for cleanup reasons (destroy event). - onChange(scope: angular.IScope, list: Array | string, callback: (result: boolean) => void): boolean; + // Returns a value indicating if the current device has a retina screen + isRetina: boolean; + + is(list: Array | string): boolean; - // Executes the callback only when inside of the particular screensize. - // The 'scope' parameter is optional. If it's not passed in, '$rootScope' is used. - when(list: Array | string, callback: (result: boolean) => void, scope?: angular.IScope): boolean; + // Executes the callback function on window resize with the match truthiness as the first argument. + // Returns the current match truthiness. + // The 'scope' parameter is optional. If it's not passed in, '$rootScope' is used. + on(list: Array | string, callback: (result: boolean) => void, scope?: angular.IScope): boolean; + + // Executes the callback function ONLY when the match differs from previous match. + // Returns the current match truthiness. + // The 'scope' parameter is required for cleanup reasons (destroy event). + onChange(scope: angular.IScope, list: Array | string, callback: (result: boolean) => void): boolean; + + // Executes the callback only when inside of the particular screensize. + // The 'scope' parameter is optional. If it's not passed in, '$rootScope' is used. + when(list: Array | string, callback: (result: boolean) => void, scope?: angular.IScope): boolean; + } } } \ No newline at end of file diff --git a/angular-meteor/angular-meteor-tests.ts b/angular-meteor/angular-meteor-tests.ts index 8500a431e8..9317676eed 100644 --- a/angular-meteor/angular-meteor-tests.ts +++ b/angular-meteor/angular-meteor-tests.ts @@ -1,4 +1,4 @@ - +import * as angular from 'angularjs'; interface ITodo { _id?: string; diff --git a/angular-meteor/index.d.ts b/angular-meteor/index.d.ts index 347936e7a6..1602ad3fa7 100644 --- a/angular-meteor/index.d.ts +++ b/angular-meteor/index.d.ts @@ -4,349 +4,351 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// -/// -declare namespace angular.meteor { - interface IRootScopeService extends angular.IRootScopeService { - /** - * The current logged in user and it's data. it is null if the user is not logged in. A reactive data source. - */ - currentUser: Meteor.User; +import * as angular from 'angularjs'; - /** - * True if a login method (such as Meteor.loginWithPassword, Meteor.loginWithFacebook, or Accounts.createUser) is currently in progress. - * A reactive data source. Can be use to display animation while user is logging in. - */ - loggingIn: boolean; - } - - interface IScope extends angular.IScope, IRootScopeService { - /** - * A method to get a $scope variable and watch it reactivly - * - * @param scopeVariableName - The name of the scope's variable to bind to - * @param [objectEquality=false] - Watch the object equality using angular.equals instead of comparing for reference equality, deeper watch but also slower - */ - getReactively(scopeVariableName: string, objectEquality?: boolean): ReactiveResult; - - /** - * A service which is a wrapper for Meteor.subscribe. It subscribes to a Meteor.publish method in the client and returns a AngularJS promise when ready. - * Calling $scope.subscribe will automatically stop the subscription when the scope is destroyed. - * - * @param name - Name of the subscription. Matches the name of the server's publish() call. - * @param publisherArguments - Optional arguments passed to publisher function on server. - * - * @return The promise solved successfully when subscription is ready. The success promise holds the subscription handle. - */ - subscribe(name: string, ...publisherArguments: any[]): angular.IPromise; - - /** - * The helpers method is part of the ReactiveContext, and available on every context and $scope. - * These method are defined as Object, where each key is the name of the variable that will be available on the context we run, and each value is a function with a return value. - * Under the hood, each helper starts a new Tracker.autorun. When its reactive dependencies change, the helper is rerun. - * To trigger a rerun every time an specific Angular variable change, use getReactively](/api/1.3.1/get-reactively) to make your Angular variable reactive inside the helper its used in. - * Each helper function should return a MongoDB Cursor and the helpers will expose it as a normal array to the context. - * - * @param definitions - Object containing `name` => `function` definition, where each name is a string and each function is the helper function. Should return a [MongoDB Cursor](http://docs.meteor.com/#/full/mongo_cursor) - * @return This method returns this, which the the reactive context, in order to provide the ability to chain the logic. - */ - helpers(definitions : { [helperName : string] : () => Mongo.Cursor }): IScope; - - /** - * This method is a wrapper of Tracker.autorun and shares exactly the same API. - * The autorun method is part of the ReactiveContext, and available on every context and $scope. - * The argument of this method is a callback, which will be called each time Autorun will be used. - * The Autorun will stop automatically when when it's context ($scope) is destroyed. - * - * @param runFunc - The function to run. It receives one argument: the Computation object that will be returned. - */ - autorun(runFunc : () => void) : Tracker.Computation; - } - - /** - * $meteor in angularjs - */ - interface IMeteorService { - /** - * A service that wraps the Meteor collections to enable reactivity within AngularJS. - * - * @param collection - A Meteor Collection or a reactive function to bind to. - * - Reactive function can be used with $scope.getReactively to add $scope variable as reactive variable to the cursor. - * @param [autoClientSave=true] - By default, changes in the Angular collection will automatically update the Meteor collection. - * - However if set to false, changes in the client won't be automatically propagated back to the Meteor collection. - */ - collection(collection: Mongo.Collection|ReactiveResult|Function|(()=>T), autoClientSave?: boolean): AngularMeteorCollection; - - /** - * A service that wraps the Meteor collections to enable reactivity within AngularJS. - * - * @param collection - A Meteor Collection or a reactive function to bind to. - * - Reactive function can be used with $scope.getReactively to add $scope variable as reactive variable to the cursor. - * @param [autoClientSave=true] - By default, changes in the Angular collection will automatically update the Meteor collection. - * - However if set to false, changes in the client won't be automatically propagated back to the Meteor collection. - * @param [updateCollection] - A collection object which will be used for updates (insert, update, delete). - */ - collection(collection: Mongo.Collection|ReactiveResult|Function|(()=>T), autoClientSave: boolean, updateCollection: Mongo.Collection): AngularMeteorCollection2; - - /** - * A service that wraps a Meteor object to enable reactivity within AngularJS. - * Finds the first document that matches the selector, as ordered by sort and skip options. Wraps collection.findOne - * - * @param collection - A Meteor Collection to bind to. - * @param selector - A query describing the documents to find or just the ID of the document. - * - $meteor.object will find the first document that matches the selector, - * - as ordered by sort and skip options, exactly like Meteor's collection.findOne - * @param [autoClientSave=true] - By default, changes in the Angular object will automatically update the Meteor object. - * - However if set to false, changes in the client won't be automatically propagated back to the Meteor object. - */ - object(collection: Mongo.Collection, selector: Mongo.Selector|Mongo.ObjectID|string, autoClientSave?: boolean): AngularMeteorObject; - - /** - * A service which is a wrapper for Meteor.subscribe. It subscribes to a Meteor.publish method in the client and returns a AngularJS promise when ready. - * - * @param name - Name of the subscription. Matches the name of the server's publish() call. - * @param publisherArguments - Optional arguments passed to publisher function on server. - * - * @return The promise solved successfully when subscription is ready. The success promise holds the subscription handle. - */ - subscribe(name: string, ...publisherArguments: any[]): angular.IPromise; - - /** - * A service service which wraps up Meteor.methods with AngularJS promises. - * - * @param name - Name of method to invoke - * @param methodArguments - Optional method arguments - * - * @return The promise solves successfully with the return value of the method or return reject with the error from the method. - */ - call(name: string, ...methodArguments: any[]): angular.IPromise; - - // User Authentication BEGIN -> - - /** - * Returns a promise fulfilled with the currentUser when the user subscription is ready. - * This is useful when you want to grab the current user before the route is rendered. - * If there is no logged in user, it will return null. - * See the “Authentication with Routers” section of our tutorial for more information and a full example. - */ - waitForUser(): angular.IPromise; - - /** - * Resolves the promise successfully if a user is authenticated and rejects otherwise. - * This is useful in cases where you want to require a route to have an authenticated user. - * You can catch the rejected promise and redirect the unauthenticated user to a different page, such as the login page. - * See the “Authentication with Routers” section of our tutorial for more information and a full example. - */ - requireUser(): angular.IPromise; - - /** - * Resolves the promise successfully if a user is authenticated and the validatorFn returns true; rejects otherwise. - * This is useful in cases where you want to require a route to have an authenticated user and do extra validation like the user's role or group. - * You can catch the rejected promise and redirect the unauthenticated user to a different page, such as the login page. - * See the “Authentication with Routers” section of our tutorial for more information and a full example. - * - * The mandatory validator function will be called with the authenticated user as the single param and it's expected to return true in order to resolve. - * If it returns a string, the promise will be rejected using said string as the reason. - * Any other return (false, null, undefined) will be rejected with the default "FORBIDDEN" reason. - */ - requireValidUser(validatorFn: (user: Meteor.User) => boolean|string): angular.IPromise; - - /** - * Log the user in with a password. - * - * @param user - Either a string interpreted as a username or an email; or an object with a single key: email, username or id. - * @param password - The user's password. - */ - loginWithPassword(user: string|{email: string}|{username: string}|{id: string}, password: string): angular.IPromise; - - /** - * Create a new user. More information: http://docs.meteor.com/#/full/accounts_createuser - * - * @param options.username - A unique name for this user. Either this, or email is required. - * @param options.email - The user's email address. Either this, or username is required. - * @param options.password - The user's password. This is not sent in plain text over the wire. - * @param options.profile - The user's profile, typically including the name field. - */ - createUser(options: {username?: string; email?: string; password: string; profile?: Object}): angular.IPromise; - - /** - * Change the current user's password. Must be logged in. - * - * @param oldPassword - The user's current password. This is not sent in plain text over the wire. - * @param newPassword - A new password for the user. This is not sent in plain text over the wire. - */ - changePassword(oldPassword: string, newPassword: string): angular.IPromise; - - /** - * Request a forgot password email. - * - * @param options.email - The email address to send a password reset link. - */ - forgotPassword(options: {email: string}): angular.IPromise; - - /** - * Reset the password for a user using a token received in email. Logs the user in afterwards. - * - * @param token - The token retrieved from the reset password URL. - * @param newPassword - A new password for the user. This is not sent in plain text over the wire. - */ - resetPassword(token: string, newPassword: string): angular.IPromise; - - /** - * Marks the user's email address as verified. Logs the user in afterwards. - * - * @param token - The token retrieved from the reset password URL. - */ - verifyEmail(token: string): angular.IPromise; - - loginWithFacebook: ILoginWithExternalService; - loginWithTwitter: ILoginWithExternalService; - loginWithGoogle: ILoginWithExternalService; - loginWithGithub: ILoginWithExternalService; - loginWithMeetup: ILoginWithExternalService; - loginWithWeibo: ILoginWithExternalService; - - /** - * Log the user out. - * - * @return Resolves with no arguments on success, or reject with a Error argument on failure. - */ - logout(): angular.IPromise; - - /** - * Log out other clients logged in as the current user, but does not log out the client that calls this function. - * For example, when called in a user's browser, connections in that browser remain logged in, - * but any other browsers or DDP clients logged in as that user will be logged out. - * - * @return Resolves with no arguments on success, or reject with a Error argument on failure. - */ - logoutOtherClients(): angular.IPromise; - - // <- User Authentication END - // $meteorUtils BEGIN -> - - /** - * @param scope - The AngularJS scope you use the autorun on. - * @param fn - The function that will re-run every time a reactive variable changes inside it. - */ - autorun(scope: angular.IScope, fn: Function): void; - - /** - * @param collectionName - The name of the collection you want to get back - */ - getCollectionByName(collectionName: string): Mongo.Collection; - - // <- $meteorUtils END - // $meteorCamera BEGIN -> - - /** - * A helper service for taking pictures across platforms. - * Must add mdg:camera package to use! (meteor add mdg:camera) - * - * @param [options] - options is an optional argument that is an Object with the following possible keys: - * @param options.width - An integer that specifies the minimum width of the returned photo. - * @param options.height - An integer that specifies the minimum height of the returned photo. - * @param options.quality - A number from 0 to 100 specifying the desired quality of JPEG encoding. - * - * @return The promise solved successfully when the picture is taken with the data as a parameter or rejected with an error as a parameter in case of error. - */ - getPicture(options?: {width?: number; height?: number; quality?: number}): angular.IPromise; - - // <- $meteorCamera END - - /** - * A service that binds a scope variable to a Meteor Session variable. - * - * @param sessionKey - The name of the session variable - * @return An object with a single function bind - to bind to that variable. - */ - session(sessionKey: string): { +declare module 'angularjs' { + export namespace meteor { + interface IRootScopeService extends angular.IRootScopeService { /** - * @param scope - The scope the document will be bound to. - * @param model - The name of the scope's model variable that the document will be bound to. + * The current logged in user and it's data. it is null if the user is not logged in. A reactive data source. */ - bind: (scope: IScope, model: string) => void; - }; - } + currentUser: Meteor.User; + /** + * True if a login method (such as Meteor.loginWithPassword, Meteor.loginWithFacebook, or Accounts.createUser) is currently in progress. + * A reactive data source. Can be use to display animation while user is logging in. + */ + loggingIn: boolean; + } + + interface IScope extends angular.IScope, IRootScopeService { + /** + * A method to get a $scope variable and watch it reactivly + * + * @param scopeVariableName - The name of the scope's variable to bind to + * @param [objectEquality=false] - Watch the object equality using angular.equals instead of comparing for reference equality, deeper watch but also slower + */ + getReactively(scopeVariableName: string, objectEquality?: boolean): ReactiveResult; + + /** + * A service which is a wrapper for Meteor.subscribe. It subscribes to a Meteor.publish method in the client and returns a AngularJS promise when ready. + * Calling $scope.subscribe will automatically stop the subscription when the scope is destroyed. + * + * @param name - Name of the subscription. Matches the name of the server's publish() call. + * @param publisherArguments - Optional arguments passed to publisher function on server. + * + * @return The promise solved successfully when subscription is ready. The success promise holds the subscription handle. + */ + subscribe(name: string, ...publisherArguments: any[]): angular.IPromise; + + /** + * The helpers method is part of the ReactiveContext, and available on every context and $scope. + * These method are defined as Object, where each key is the name of the variable that will be available on the context we run, and each value is a function with a return value. + * Under the hood, each helper starts a new Tracker.autorun. When its reactive dependencies change, the helper is rerun. + * To trigger a rerun every time an specific Angular variable change, use getReactively](/api/1.3.1/get-reactively) to make your Angular variable reactive inside the helper its used in. + * Each helper function should return a MongoDB Cursor and the helpers will expose it as a normal array to the context. + * + * @param definitions - Object containing `name` => `function` definition, where each name is a string and each function is the helper function. Should return a [MongoDB Cursor](http://docs.meteor.com/#/full/mongo_cursor) + * @return This method returns this, which the the reactive context, in order to provide the ability to chain the logic. + */ + helpers(definitions : { [helperName : string] : () => Mongo.Cursor }): IScope; + + /** + * This method is a wrapper of Tracker.autorun and shares exactly the same API. + * The autorun method is part of the ReactiveContext, and available on every context and $scope. + * The argument of this method is a callback, which will be called each time Autorun will be used. + * The Autorun will stop automatically when when it's context ($scope) is destroyed. + * + * @param runFunc - The function to run. It receives one argument: the Computation object that will be returned. + */ + autorun(runFunc : () => void) : Tracker.Computation; + } - /** - * An object that connects a Meteor Object to an AngularJS scope variable. - * - * The object contains also all the properties from the generic type T, - * unfortunately TypeScript doesn't at the moment allow to extend a generic type (see https://github.com/Microsoft/TypeScript/issues/2225 for details and updates). - * For a workaround, you'll need to implement an interface which will merge AngularMeteorObject together with T and cast it, like this: - * - * interface TodoAngularMeteorObject extends ITodo, AngularMeteorObject { } - * var todo = $meteor.object(TodoCollection, 'TodoID'); - */ - interface AngularMeteorObject { /** - * @param [doc] - The doc to save to the Meteor Object. If nothing is passed, the method saves everything in the AngularMeteorObject as is. - * - Unchanged properties will be overridden with their existing values, which may trigger hooks. - * - If doc is passed, the method only updates the Meteor Object with the properties passed, and no other changes will be saved. + * $meteor in angularjs + */ + interface IMeteorService { + /** + * A service that wraps the Meteor collections to enable reactivity within AngularJS. + * + * @param collection - A Meteor Collection or a reactive function to bind to. + * - Reactive function can be used with $scope.getReactively to add $scope variable as reactive variable to the cursor. + * @param [autoClientSave=true] - By default, changes in the Angular collection will automatically update the Meteor collection. + * - However if set to false, changes in the client won't be automatically propagated back to the Meteor collection. + */ + collection(collection: Mongo.Collection|ReactiveResult|Function|(()=>T), autoClientSave?: boolean): AngularMeteorCollection; + + /** + * A service that wraps the Meteor collections to enable reactivity within AngularJS. + * + * @param collection - A Meteor Collection or a reactive function to bind to. + * - Reactive function can be used with $scope.getReactively to add $scope variable as reactive variable to the cursor. + * @param [autoClientSave=true] - By default, changes in the Angular collection will automatically update the Meteor collection. + * - However if set to false, changes in the client won't be automatically propagated back to the Meteor collection. + * @param [updateCollection] - A collection object which will be used for updates (insert, update, delete). + */ + collection(collection: Mongo.Collection|ReactiveResult|Function|(()=>T), autoClientSave: boolean, updateCollection: Mongo.Collection): AngularMeteorCollection2; + + /** + * A service that wraps a Meteor object to enable reactivity within AngularJS. + * Finds the first document that matches the selector, as ordered by sort and skip options. Wraps collection.findOne + * + * @param collection - A Meteor Collection to bind to. + * @param selector - A query describing the documents to find or just the ID of the document. + * - $meteor.object will find the first document that matches the selector, + * - as ordered by sort and skip options, exactly like Meteor's collection.findOne + * @param [autoClientSave=true] - By default, changes in the Angular object will automatically update the Meteor object. + * - However if set to false, changes in the client won't be automatically propagated back to the Meteor object. + */ + object(collection: Mongo.Collection, selector: Mongo.Selector|Mongo.ObjectID|string, autoClientSave?: boolean): AngularMeteorObject; + + /** + * A service which is a wrapper for Meteor.subscribe. It subscribes to a Meteor.publish method in the client and returns a AngularJS promise when ready. + * + * @param name - Name of the subscription. Matches the name of the server's publish() call. + * @param publisherArguments - Optional arguments passed to publisher function on server. + * + * @return The promise solved successfully when subscription is ready. The success promise holds the subscription handle. + */ + subscribe(name: string, ...publisherArguments: any[]): angular.IPromise; + + /** + * A service service which wraps up Meteor.methods with AngularJS promises. + * + * @param name - Name of method to invoke + * @param methodArguments - Optional method arguments + * + * @return The promise solves successfully with the return value of the method or return reject with the error from the method. + */ + call(name: string, ...methodArguments: any[]): angular.IPromise; + + // User Authentication BEGIN -> + + /** + * Returns a promise fulfilled with the currentUser when the user subscription is ready. + * This is useful when you want to grab the current user before the route is rendered. + * If there is no logged in user, it will return null. + * See the “Authentication with Routers” section of our tutorial for more information and a full example. + */ + waitForUser(): angular.IPromise; + + /** + * Resolves the promise successfully if a user is authenticated and rejects otherwise. + * This is useful in cases where you want to require a route to have an authenticated user. + * You can catch the rejected promise and redirect the unauthenticated user to a different page, such as the login page. + * See the “Authentication with Routers” section of our tutorial for more information and a full example. + */ + requireUser(): angular.IPromise; + + /** + * Resolves the promise successfully if a user is authenticated and the validatorFn returns true; rejects otherwise. + * This is useful in cases where you want to require a route to have an authenticated user and do extra validation like the user's role or group. + * You can catch the rejected promise and redirect the unauthenticated user to a different page, such as the login page. + * See the “Authentication with Routers” section of our tutorial for more information and a full example. + * + * The mandatory validator function will be called with the authenticated user as the single param and it's expected to return true in order to resolve. + * If it returns a string, the promise will be rejected using said string as the reason. + * Any other return (false, null, undefined) will be rejected with the default "FORBIDDEN" reason. + */ + requireValidUser(validatorFn: (user: Meteor.User) => boolean|string): angular.IPromise; + + /** + * Log the user in with a password. + * + * @param user - Either a string interpreted as a username or an email; or an object with a single key: email, username or id. + * @param password - The user's password. + */ + loginWithPassword(user: string|{email: string}|{username: string}|{id: string}, password: string): angular.IPromise; + + /** + * Create a new user. More information: http://docs.meteor.com/#/full/accounts_createuser + * + * @param options.username - A unique name for this user. Either this, or email is required. + * @param options.email - The user's email address. Either this, or username is required. + * @param options.password - The user's password. This is not sent in plain text over the wire. + * @param options.profile - The user's profile, typically including the name field. + */ + createUser(options: {username?: string; email?: string; password: string; profile?: Object}): angular.IPromise; + + /** + * Change the current user's password. Must be logged in. + * + * @param oldPassword - The user's current password. This is not sent in plain text over the wire. + * @param newPassword - A new password for the user. This is not sent in plain text over the wire. + */ + changePassword(oldPassword: string, newPassword: string): angular.IPromise; + + /** + * Request a forgot password email. + * + * @param options.email - The email address to send a password reset link. + */ + forgotPassword(options: {email: string}): angular.IPromise; + + /** + * Reset the password for a user using a token received in email. Logs the user in afterwards. + * + * @param token - The token retrieved from the reset password URL. + * @param newPassword - A new password for the user. This is not sent in plain text over the wire. + */ + resetPassword(token: string, newPassword: string): angular.IPromise; + + /** + * Marks the user's email address as verified. Logs the user in afterwards. + * + * @param token - The token retrieved from the reset password URL. + */ + verifyEmail(token: string): angular.IPromise; + + loginWithFacebook: ILoginWithExternalService; + loginWithTwitter: ILoginWithExternalService; + loginWithGoogle: ILoginWithExternalService; + loginWithGithub: ILoginWithExternalService; + loginWithMeetup: ILoginWithExternalService; + loginWithWeibo: ILoginWithExternalService; + + /** + * Log the user out. + * + * @return Resolves with no arguments on success, or reject with a Error argument on failure. + */ + logout(): angular.IPromise; + + /** + * Log out other clients logged in as the current user, but does not log out the client that calls this function. + * For example, when called in a user's browser, connections in that browser remain logged in, + * but any other browsers or DDP clients logged in as that user will be logged out. + * + * @return Resolves with no arguments on success, or reject with a Error argument on failure. + */ + logoutOtherClients(): angular.IPromise; + + // <- User Authentication END + // $meteorUtils BEGIN -> + + /** + * @param scope - The AngularJS scope you use the autorun on. + * @param fn - The function that will re-run every time a reactive variable changes inside it. + */ + autorun(scope: angular.IScope, fn: Function): void; + + /** + * @param collectionName - The name of the collection you want to get back + */ + getCollectionByName(collectionName: string): Mongo.Collection; + + // <- $meteorUtils END + // $meteorCamera BEGIN -> + + /** + * A helper service for taking pictures across platforms. + * Must add mdg:camera package to use! (meteor add mdg:camera) + * + * @param [options] - options is an optional argument that is an Object with the following possible keys: + * @param options.width - An integer that specifies the minimum width of the returned photo. + * @param options.height - An integer that specifies the minimum height of the returned photo. + * @param options.quality - A number from 0 to 100 specifying the desired quality of JPEG encoding. + * + * @return The promise solved successfully when the picture is taken with the data as a parameter or rejected with an error as a parameter in case of error. + */ + getPicture(options?: {width?: number; height?: number; quality?: number}): angular.IPromise; + + // <- $meteorCamera END + + /** + * A service that binds a scope variable to a Meteor Session variable. + * + * @param sessionKey - The name of the session variable + * @return An object with a single function bind - to bind to that variable. + */ + session(sessionKey: string): { + /** + * @param scope - The scope the document will be bound to. + * @param model - The name of the scope's model variable that the document will be bound to. + */ + bind: (scope: IScope, model: string) => void; + }; + } + + /** + * An object that connects a Meteor Object to an AngularJS scope variable. * - * @return Returns a promise with an error in case for an error or a number of successful docs changed in case of success. - */ - save(doc?: T): angular.IPromise; - - /** - * Reset the current value of the object to the one in the server. - */ - reset(): void; - - /** - * Returns a copy of the AngularMeteorObject with all the AngularMeteor-specific internal properties removed. - * The returned object is then safe to use as a parameter for method calls, or anywhere else where the data needs to be converted to JSON. - */ - getRawObject(): T; - - /** - * A shorten (Syntactic sugar) function for the $meteor.subscribe function. - * Takes only one parameter and not returns a promise like $meteor.subscribe does. + * The object contains also all the properties from the generic type T, + * unfortunately TypeScript doesn't at the moment allow to extend a generic type (see https://github.com/Microsoft/TypeScript/issues/2225 for details and updates). + * For a workaround, you'll need to implement an interface which will merge AngularMeteorObject together with T and cast it, like this: * - * @param subscriptionName - The subscription name to subscribe to. Exactly like the first parameter in $meteor.subscribe service. + * interface TodoAngularMeteorObject extends ITodo, AngularMeteorObject { } + * var todo = $meteor.object(TodoCollection, 'TodoID'); */ - subscribe(subscriptionName:string): AngularMeteorObject; - } + interface AngularMeteorObject { + /** + * @param [doc] - The doc to save to the Meteor Object. If nothing is passed, the method saves everything in the AngularMeteorObject as is. + * - Unchanged properties will be overridden with their existing values, which may trigger hooks. + * - If doc is passed, the method only updates the Meteor Object with the properties passed, and no other changes will be saved. + * + * @return Returns a promise with an error in case for an error or a number of successful docs changed in case of success. + */ + save(doc?: T): angular.IPromise; - /** - * An object that connects a Meteor Collection to an AngularJS scope variable - */ - interface AngularMeteorCollection extends AngularMeteorCollection2 { } + /** + * Reset the current value of the object to the one in the server. + */ + reset(): void; - /** - * An object that connects a Meteor Collection to an AngularJS scope variable, - * but can use a differen type for updates. - */ - interface AngularMeteorCollection2 extends Array { - /** - * @param [docs] - The docs to save to the Meteor Collection. - * - If the docs parameter is empty, the method saves everything in the AngularMeteorCollection as is. - * - If an object is passed, the method pushes that object into the AngularMeteorCollection. - * - If an array is passed, the method pushes all objects in the array into the AngularMeteorCollection. - */ - save(docs?: U|U[]): void; + /** + * Returns a copy of the AngularMeteorObject with all the AngularMeteor-specific internal properties removed. + * The returned object is then safe to use as a parameter for method calls, or anywhere else where the data needs to be converted to JSON. + */ + getRawObject(): T; + + /** + * A shorten (Syntactic sugar) function for the $meteor.subscribe function. + * Takes only one parameter and not returns a promise like $meteor.subscribe does. + * + * @param subscriptionName - The subscription name to subscribe to. Exactly like the first parameter in $meteor.subscribe service. + */ + subscribe(subscriptionName:string): AngularMeteorObject; + } /** - * @param [keys] - The keys of the object to remove from the Meteor Collection. - * - If nothing is passed, the method removes all the documents from the AngularMeteorCollection. - * - If an object is passed, the method removes the object with that key from the AngularMeteorCollection. - * - If an array is passed, the method removes all objects that matches the keys in the array from the AngularMeteorCollection. + * An object that connects a Meteor Collection to an AngularJS scope variable */ - remove(keys?: U|string|number|string[]|number[]): void; + interface AngularMeteorCollection extends AngularMeteorCollection2 { } /** - * A shorten (Syntactic sugar) function for the $meteor.subscribe function. - * Takes only one parameter and not returns a promise like $meteor.subscribe does. - * - * @param subscriptionName - The subscription name to subscribe to. Exactly like the first parameter in $meteor.subscribe service. + * An object that connects a Meteor Collection to an AngularJS scope variable, + * but can use a differen type for updates. */ - subscribe(subscriptionName:string): AngularMeteorCollection2; - } + interface AngularMeteorCollection2 extends Array { + /** + * @param [docs] - The docs to save to the Meteor Collection. + * - If the docs parameter is empty, the method saves everything in the AngularMeteorCollection as is. + * - If an object is passed, the method pushes that object into the AngularMeteorCollection. + * - If an array is passed, the method pushes all objects in the array into the AngularMeteorCollection. + */ + save(docs?: U|U[]): void; - interface ILoginWithExternalService { - (options: Meteor.LoginWithExternalServiceOptions): angular.IPromise; - } + /** + * @param [keys] - The keys of the object to remove from the Meteor Collection. + * - If nothing is passed, the method removes all the documents from the AngularMeteorCollection. + * - If an object is passed, the method removes the object with that key from the AngularMeteorCollection. + * - If an array is passed, the method removes all objects that matches the keys in the array from the AngularMeteorCollection. + */ + remove(keys?: U|string|number|string[]|number[]): void; - interface ReactiveResult { } + /** + * A shorten (Syntactic sugar) function for the $meteor.subscribe function. + * Takes only one parameter and not returns a promise like $meteor.subscribe does. + * + * @param subscriptionName - The subscription name to subscribe to. Exactly like the first parameter in $meteor.subscribe service. + */ + subscribe(subscriptionName:string): AngularMeteorCollection2; + } + + interface ILoginWithExternalService { + (options: Meteor.LoginWithExternalServiceOptions): angular.IPromise; + } + + interface ReactiveResult { } + } } diff --git a/angular-notifications/index.d.ts b/angular-notifications/index.d.ts index 72ceff3f96..209e4a1c22 100644 --- a/angular-notifications/index.d.ts +++ b/angular-notifications/index.d.ts @@ -5,78 +5,82 @@ /// -declare namespace angular.notifications { +import * as angular from 'angularjs'; - interface IAnimation { - duration: number; - enabled: boolean; - } +declare module 'angularjs' { + export namespace notifications { - interface ISettings { - info: IAnimation; - warning: IAnimation; - error: IAnimation; - success: IAnimation; - progress: IAnimation; - custom: IAnimation; - details: boolean; - localStorage: boolean; - html5Mode: boolean; - html5DefaultIcon: string; - } + interface IAnimation { + duration: number; + enabled: boolean; + } - interface INotification { - type: string; - image: string; - icon: string; - title: string; - content: string; - timestamp: string; - userData: string; - } + interface ISettings { + info: IAnimation; + warning: IAnimation; + error: IAnimation; + success: IAnimation; + progress: IAnimation; + custom: IAnimation; + details: boolean; + localStorage: boolean; + html5Mode: boolean; + html5DefaultIcon: string; + } - interface INotificationFactory extends angular.IModule { + interface INotification { + type: string; + image: string; + icon: string; + title: string; + content: string; + timestamp: string; + userData: string; + } - /* ========== SETTINGS RELATED METHODS =============*/ + interface INotificationFactory extends angular.IModule { - disableHtml5Mode(): void; - disableType(notificationType: string): void; - enableHtml5Mode(): void; - enableType(notificationType: string): void; - getSettings(): ISettings; - toggleType(notificationType: string): void; - toggleHtml5Mode(): void; - requestHtml5ModePermissions(): boolean; + /* ========== SETTINGS RELATED METHODS =============*/ - /* ============ QUERYING RELATED METHODS ============*/ + disableHtml5Mode(): void; + disableType(notificationType: string): void; + enableHtml5Mode(): void; + enableType(notificationType: string): void; + getSettings(): ISettings; + toggleType(notificationType: string): void; + toggleHtml5Mode(): void; + requestHtml5ModePermissions(): boolean; - getAll(): Array; - getQueue(): Array; + /* ============ QUERYING RELATED METHODS ============*/ - /* ============== NOTIFICATION METHODS ==============*/ + getAll(): Array; + getQueue(): Array; - info(title: string): INotification; - info(title: string, content: string): INotification; - info(title: string, content: string, userData: any): INotification; - error(title: string): INotification; - error(title: string, content: string): INotification; - error(title: string, content: string, userData: any): INotification; - success(title: string): INotification; - success(title: string, content: string): INotification; - success(title: string, content: string, userData: any): INotification; - warning(title: string): INotification; - warning(title: string, content: string): INotification; - warning(title: string, content: string, userData: any): INotification; - awesomeNotify(type: string, icon: string, title: string, content: string, userData: any): INotification; - notify(image: string, title: string, content: string, userData: any): INotification; - makeNotification(type: string, image: string, icon: string, title: string, content: string, userData: any): INotification; + /* ============== NOTIFICATION METHODS ==============*/ - /* ============ PERSISTENCE METHODS ============ */ + info(title: string): INotification; + info(title: string, content: string): INotification; + info(title: string, content: string, userData: any): INotification; + error(title: string): INotification; + error(title: string, content: string): INotification; + error(title: string, content: string, userData: any): INotification; + success(title: string): INotification; + success(title: string, content: string): INotification; + success(title: string, content: string, userData: any): INotification; + warning(title: string): INotification; + warning(title: string, content: string): INotification; + warning(title: string, content: string, userData: any): INotification; + awesomeNotify(type: string, icon: string, title: string, content: string, userData: any): INotification; + notify(image: string, title: string, content: string, userData: any): INotification; + makeNotification(type: string, image: string, icon: string, title: string, content: string, userData: any): INotification; - save(): void; - restore(): void; - clear(): void; - } + /* ============ PERSISTENCE METHODS ============ */ + + save(): void; + restore(): void; + clear(): void; + } +} } diff --git a/angular-notify/index.d.ts b/angular-notify/index.d.ts index 58f680a09b..bff27531f2 100644 --- a/angular-notify/index.d.ts +++ b/angular-notify/index.d.ts @@ -5,122 +5,126 @@ /// -declare namespace angular.cgNotify { +import * as angular from 'angularjs'; - interface INotifyService { +declare module 'angularjs' { + export namespace cgNotify { - /** - * The notify function can either be passed a string or an object. - * This function will return an object with a close() method and a message property. - * @param message - */ - (message:string):INotify; - - /** - * When passing an object, the object parameters can be: - * @param option - */ - (option:{ - /** - * Required. The message to show. - */ - message : string; + interface INotifyService { /** - * Optional. A custom template for the UI of the message. + * The notify function can either be passed a string or an object. + * This function will return an object with a close() method and a message property. + * @param message */ - templateUrl? : string; + (message: string): INotify; /** - * Optional. A list of custom CSS classes to apply to the message element. + * When passing an object, the object parameters can be: + * @param option */ - classes? : string; + (option: { + /** + * Required. The message to show. + */ + message: string; + + /** + * Optional. A custom template for the UI of the message. + */ + templateUrl?: string; + + /** + * Optional. A list of custom CSS classes to apply to the message element. + */ + classes?: string; + + /** + * Optional. A string containing any valid Angular HTML which will be shown instead of the regular message text. + * The string must contain one root element like all valid Angular HTML templates (so wrap everything in a ). + */ + messageTemplate?: string; + + /** + * Optional. A valid Angular scope object. The scope of the template will be created by calling $new() on this scope. + */ + $scope?: ng.IScope; + + /** + * Optional. Currently center and right are the only acceptable values. + */ + position?: string; + + /** + * Optional. The duration (in milliseconds) of the message. A duration of 0 will prevent the message from closing automatically. + */ + duration?: number; + + /** + * Optional. Element that contains each notification. Defaults to document.body. + */ + container?: any; + }): INotify; + /** - * Optional. A string containing any valid Angular HTML which will be shown instead of the regular message text. - * The string must contain one root element like all valid Angular HTML templates (so wrap everything in a ). + * Call config to set the default configuration options for angular-notify. + * The following options may be specified in the given object: + * @param option */ - messageTemplate? : string; + config(option: { + /** + * The default duration (in milliseconds) of each message. A duration of 0 will prevent messages from closing automatically. + */ + duration?: number; + + /** + * The Y pixel value where messages will be shown. + */ + startTop?: number; + + /** + * The number of pixels that should be reserved between messages vertically. + */ + verticalSpacing?: number; + + /** + * The default message template. + */ + templateUrl?: string; + + /** + * The default position of each message. Currently only center and right are the supported values. + */ + position?: string; + + /** + * The default element that contains each notification. Defaults to document.body. + */ + container?: any; + + /** + * The maximum number of total notifications that can be visible at one time. Older notifications will be closed when the maximum is reached. + */ + maximumOpen?: number; + }): void; /** - * Optional. A valid Angular scope object. The scope of the template will be created by calling $new() on this scope. + * Closes all currently open notifications. */ - $scope? : ng.IScope; + closeAll(): void; + } + + interface INotify { + /** + * The message to show. + */ + message: string; /** - * Optional. Currently center and right are the only acceptable values. + * Close this open notifications. */ - position? : string; - - /** - * Optional. The duration (in milliseconds) of the message. A duration of 0 will prevent the message from closing automatically. - */ - duration? : number; - - /** - * Optional. Element that contains each notification. Defaults to document.body. - */ - container? : any; - }):INotify; - - - /** - * Call config to set the default configuration options for angular-notify. - * The following options may be specified in the given object: - * @param option - */ - config(option:{ - /** - * The default duration (in milliseconds) of each message. A duration of 0 will prevent messages from closing automatically. - */ - duration? : number; - - /** - * The Y pixel value where messages will be shown. - */ - startTop? : number; - - /** - * The number of pixels that should be reserved between messages vertically. - */ - verticalSpacing? : number; - - /** - * The default message template. - */ - templateUrl? : string; - - /** - * The default position of each message. Currently only center and right are the supported values. - */ - position? : string; - - /** - * The default element that contains each notification. Defaults to document.body. - */ - container? : any; - - /** - * The maximum number of total notifications that can be visible at one time. Older notifications will be closed when the maximum is reached. - */ - maximumOpen? : number; - }):void; - - /** - * Closes all currently open notifications. - */ - closeAll():void; - } - - interface INotify{ - /** - * The message to show. - */ - message:string; - - /** - * Close this open notifications. - */ - close():void; + close(): void; + } } } diff --git a/angular-permission/index.d.ts b/angular-permission/index.d.ts index a32366b218..c743faa1cc 100644 --- a/angular-permission/index.d.ts +++ b/angular-permission/index.d.ts @@ -6,170 +6,174 @@ /// /// -declare namespace angular.permission { - /** - * Used as optional parameter provided on definitions of permissions and roles - */ - export interface TransitionProperties { - fromState?: angular.ui.IState; - fromParams?: angular.ui.IStateParamsService; - toState?: angular.ui.IState; - toParams?: angular.ui.IStateParamsService; - options?: angular.ui.IStateOptions; - } +import * as angular from 'angularjs'; - export interface PermissionStore { +declare module 'angularjs' { + export namespace permission { /** - * Allows to define permission on application configuration - * @method - * - * @param permissionName {String} Name of defined permission - * @param validationFunction {Function} Function used to validate if permission is valid + * Used as optional parameter provided on definitions of permissions and roles */ - definePermission( - name: string, - validationFunction: (permission?: string, transitionProperties?: TransitionProperties) => boolean | angular.IPromise - ): void; + export interface TransitionProperties { + fromState?: angular.ui.IState; + fromParams?: angular.ui.IStateParamsService; + toState?: angular.ui.IState; + toParams?: angular.ui.IStateParamsService; + options?: angular.ui.IStateOptions; + } - /** - * Allows to define set of permissionNames with shared validation function on application configuration - * @method - * @throws {TypeError} - * - * @param permissionNames {Array} Set of permission names - * @param validationFunction {Function} Function used to validate if permission is valid - */ - defineManyPermissions( - permissions: string[], - validationFunction: (permission?: string, transitionProperties?: TransitionProperties) => boolean | angular.IPromise - ): void; + export interface PermissionStore { + /** + * Allows to define permission on application configuration + * @method + * + * @param permissionName {String} Name of defined permission + * @param validationFunction {Function} Function used to validate if permission is valid + */ + definePermission( + name: string, + validationFunction: (permission?: string, transitionProperties?: TransitionProperties) => boolean | angular.IPromise + ): void; - clearStore(): void; + /** + * Allows to define set of permissionNames with shared validation function on application configuration + * @method + * @throws {TypeError} + * + * @param permissionNames {Array} Set of permission names + * @param validationFunction {Function} Function used to validate if permission is valid + */ + defineManyPermissions( + permissions: string[], + validationFunction: (permission?: string, transitionProperties?: TransitionProperties) => boolean | angular.IPromise + ): void; - /** - * Deletes permission - * @method - * - * @param permissionName {String} Name of defined permission - */ - removePermissionDefinition(permission: string): void; + clearStore(): void; - /** - * Checks if permission exists - * @method - * - * @param permissionName {String} Name of defined permission - * @returns {Boolean} - */ - hasPermissionDefinition(permissionName: string): boolean; + /** + * Deletes permission + * @method + * + * @param permissionName {String} Name of defined permission + */ + removePermissionDefinition(permission: string): void; - /** - * Returns all permissions - * @method - * - * @returns {Object} Permissions collection - */ - getStore(): Permission[]; - } + /** + * Checks if permission exists + * @method + * + * @param permissionName {String} Name of defined permission + * @returns {Boolean} + */ + hasPermissionDefinition(permissionName: string): boolean; - export interface RoleStore { - /** - * Allows to define role - * @method - * - * @param roleName {String} Name of defined role - * @param permissions {Array} Set of permission names - * @param [validationFunction] {Function} Function used to validate if permissions in role are valid - */ - defineRole( - role: string, - permissions: Array, - validationFunction: RoleValidationFunction - ): void; + /** + * Returns all permissions + * @method + * + * @returns {Object} Permissions collection + */ + getStore(): Permission[]; + } - /** - * Allows to define role - * @method - * - * @param roleName {String} Name of defined role - * @param permissions {Array} Set of permission names - */ - defineRole(role: string, permissions: Array): void; + export interface RoleStore { + /** + * Allows to define role + * @method + * + * @param roleName {String} Name of defined role + * @param permissions {Array} Set of permission names + * @param [validationFunction] {Function} Function used to validate if permissions in role are valid + */ + defineRole( + role: string, + permissions: Array, + validationFunction: RoleValidationFunction + ): void; - /** - * Checks if role is defined in store - * @method - * - * @param roleName {String} Name of role - * @returns {Boolean} - */ - hasRoleDefinition(role: string): boolean; + /** + * Allows to define role + * @method + * + * @param roleName {String} Name of defined role + * @param permissions {Array} Set of permission names + */ + defineRole(role: string, permissions: Array): void; - /** - * Returns role definition object by it's name - * @method - * - * @returns {permission.Role} Role definition object - */ - getRoleDefinition(roleName: string): Role; + /** + * Checks if role is defined in store + * @method + * + * @param roleName {String} Name of role + * @returns {Boolean} + */ + hasRoleDefinition(role: string): boolean; - /** - * Removes all role definitions - * @method - */ - clearStore(): void; + /** + * Returns role definition object by it's name + * @method + * + * @returns {permission.Role} Role definition object + */ + getRoleDefinition(roleName: string): Role; - /** - * Deletes role from store - * @method - * - * @param roleName {String} Name of defined permission - */ - removeRoleDefinition(roleName: string): void; + /** + * Removes all role definitions + * @method + */ + clearStore(): void; - /** - * Returns all role definitions - * @method - * - * @returns {Object} Defined roles collection - */ - getStore(): Role[]; - } + /** + * Deletes role from store + * @method + * + * @param roleName {String} Name of defined permission + */ + removeRoleDefinition(roleName: string): void; - export interface Role { - roleName: string; - permissionNames: string[]; - validationFunction?: RoleValidationFunction; - } + /** + * Returns all role definitions + * @method + * + * @returns {Object} Defined roles collection + */ + getStore(): Role[]; + } - export interface Permission { - permissionName: string; - validationFunction?: PermissionValidationFunction; - } + export interface Role { + roleName: string; + permissionNames: string[]; + validationFunction?: RoleValidationFunction; + } - interface RoleValidationFunction { - (permission?: string, transitionProperties?: TransitionProperties): boolean | angular.IPromise; - } + export interface Permission { + permissionName: string; + validationFunction?: PermissionValidationFunction; + } - interface PermissionValidationFunction { - (permission?: string, transitionProperties?: TransitionProperties): boolean | angular.IPromise; - } + interface RoleValidationFunction { + (permission?: string, transitionProperties?: TransitionProperties): boolean | angular.IPromise; + } - export interface IPermissionState extends angular.ui.IState { - data?: any | DataWithPermissions; - } + interface PermissionValidationFunction { + (permission?: string, transitionProperties?: TransitionProperties): boolean | angular.IPromise; + } - export interface DataWithPermissions { - permissions?: { - only?: (() => void) | Array | angular.IPromise; - except?: (() => void) | Array | angular.IPromise; - redirectTo: string | (() => string) | (() => PermissionRedirectConfigation) | {[index: string]: PermissionRedirectConfigation} - }; - } + export interface IPermissionState extends angular.ui.IState { + data?: any | DataWithPermissions; + } - export interface PermissionRedirectConfigation { - state: string; - params?: {}; - options?: angular.ui.IStateOptions; + export interface DataWithPermissions { + permissions?: { + only?: (() => void) | Array | angular.IPromise; + except?: (() => void) | Array | angular.IPromise; + redirectTo: string | (() => string) | (() => PermissionRedirectConfigation) | { [index: string]: PermissionRedirectConfigation } + }; + } + + export interface PermissionRedirectConfigation { + state: string; + params?: {}; + options?: angular.ui.IStateOptions; + } } } diff --git a/angular-storage/index.d.ts b/angular-storage/index.d.ts index b9e57edf26..3ed3aff94f 100644 --- a/angular-storage/index.d.ts +++ b/angular-storage/index.d.ts @@ -5,51 +5,55 @@ /// -declare namespace angular.a0.storage { - interface IStoreService extends INamespacedStoreService { - /** - * Returns a namespaced store - * - * @param {String} namespace - The namespace - * @param {String} storage - The name of the storage service. Defaults to local storage. - * @param {String} delimiter - The delimiter to use to separate the namespace and the keys. - * @returns {INamespacedStoreService} - */ - getNamespacedStore(namespace: string, storage?: string, delimiter?: string): INamespacedStoreService; - } +import * as angular from 'angularjs'; - interface INamespacedStoreService { - /** - * Sets a new value to the storage with the key name. It can be any object. - * - * @param {String} name - The key name for the location of the value - * @param value - The value to store - */ - set(name: string, value: any): void; +declare module 'angularjs' { + export namespace a0.storage { + interface IStoreService extends INamespacedStoreService { + /** + * Returns a namespaced store + * + * @param {String} namespace - The namespace + * @param {String} storage - The name of the storage service. Defaults to local storage. + * @param {String} delimiter - The delimiter to use to separate the namespace and the keys. + * @returns {INamespacedStoreService} + */ + getNamespacedStore(namespace: string, storage?: string, delimiter?: string): INamespacedStoreService; + } - /** - * Returns the saved value with they key name. - * - * @param {String} name - The key name for the location of the value - * @returns The saved value; if you saved an object, you get an object - */ - get(name: string): any; + interface INamespacedStoreService { + /** + * Sets a new value to the storage with the key name. It can be any object. + * + * @param {String} name - The key name for the location of the value + * @param value - The value to store + */ + set(name: string, value: any): void; - /** - * Deletes the saved value with the key name - * - * @param {String} name - The key name for the location of the value to remove - */ - remove(name: string): void; - } + /** + * Returns the saved value with they key name. + * + * @param {String} name - The key name for the location of the value + * @returns The saved value; if you saved an object, you get an object + */ + get(name: string): any; - interface IStoreProvider { + /** + * Deletes the saved value with the key name + * + * @param {String} name - The key name for the location of the value to remove + */ + remove(name: string): void; + } - /** - * Sets the storage. - * - * @param {String} storage - The storage name - */ - setStore(storage: string): void; + interface IStoreProvider { + + /** + * Sets the storage. + * + * @param {String} storage - The storage name + */ + setStore(storage: string): void; + } } } diff --git a/angular-translate/index.d.ts b/angular-translate/index.d.ts index e2e72cced9..9f5cd79837 100644 --- a/angular-translate/index.d.ts +++ b/angular-translate/index.d.ts @@ -5,119 +5,116 @@ /// -declare module "angular-translate" { - import ngt = angular.translate; - export = ngt; -} +import * as angular from 'angularjs'; -declare namespace angular.translate { +declare module 'angularjs' { + export namespace translate { - interface ITranslationTable { - [key: string]: any; + interface ITranslationTable { + [key: string]: any; + } + + interface ILanguageKeyAlias { + [key: string]: string; + } + + interface IStorage { + get(name: string): string; + put(name: string, value: string): void; + } + + interface IStaticFilesLoaderOptions { + prefix: string; + suffix: string; + key?: string; + } + + interface IPartialLoader { + addPart(name: string, priority?: number): T; + deletePart(name: string): T; + isPartAvailable(name: string): boolean; + } + + interface ITranslatePartialLoaderService extends IPartialLoader { + getRegisteredParts(): Array; + isPartLoaded(name: string, lang: string): boolean; + } + + interface ITranslatePartialLoaderProvider extends angular.IServiceProvider, IPartialLoader { + setPart(lang: string, part: string, table: ITranslationTable): ITranslatePartialLoaderProvider; + } + + interface ITranslateService { + (translationId: string, interpolateParams?: any, interpolationId?: string): angular.IPromise; + (translationId: string[], interpolateParams?: any, interpolationId?: string): angular.IPromise<{ [key: string]: string }>; + cloakClassName(): string; + cloakClassName(name: string): ITranslateProvider; + fallbackLanguage(langKey?: string): string; + fallbackLanguage(langKey?: string[]): string; + instant(translationId: string, interpolateParams?: any, interpolationId?: string): string; + instant(translationId: string[], interpolateParams?: any, interpolationId?: string): { [key: string]: string }; + isPostCompilingEnabled(): boolean; + preferredLanguage(langKey?: string): string; + proposedLanguage(): string; + refresh(langKey?: string): angular.IPromise; + storage(): IStorage; + storageKey(): string; + use(): string; + use(key: string): angular.IPromise; + useFallbackLanguage(langKey?: string): void; + versionInfo(): string; + loaderCache(): any; + isReady(): boolean; + onReady(): angular.IPromise; + } + + interface ITranslateProvider extends angular.IServiceProvider { + translations(): ITranslationTable; + translations(key: string, translationTable: ITranslationTable): ITranslateProvider; + cloakClassName(): string; + cloakClassName(name: string): ITranslateProvider; + addInterpolation(factory: any): ITranslateProvider; + useMessageFormatInterpolation(): ITranslateProvider; + useInterpolation(factory: string): ITranslateProvider; + useSanitizeValueStrategy(value: string): ITranslateProvider; + preferredLanguage(): ITranslateProvider; + preferredLanguage(language: string): ITranslateProvider; + translationNotFoundIndicator(indicator: string): ITranslateProvider; + translationNotFoundIndicatorLeft(): string; + translationNotFoundIndicatorLeft(indicator: string): ITranslateProvider; + translationNotFoundIndicatorRight(): string; + translationNotFoundIndicatorRight(indicator: string): ITranslateProvider; + fallbackLanguage(): ITranslateProvider; + fallbackLanguage(language: string): ITranslateProvider; + fallbackLanguage(languages: string[]): ITranslateProvider; + forceAsyncReload(value: boolean): ITranslateProvider; + use(): string; + use(key: string): ITranslateProvider; + storageKey(): string; + storageKey(key: string): void; // JeroMiya - the library should probably return ITranslateProvider but it doesn't here + useUrlLoader(url: string): ITranslateProvider; + useStaticFilesLoader(options: IStaticFilesLoaderOptions): ITranslateProvider; + useLoader(loaderFactory: string, options?: any): ITranslateProvider; + useLocalStorage(): ITranslateProvider; + useCookieStorage(): ITranslateProvider; + useStorage(storageFactory: any): ITranslateProvider; + storagePrefix(): string; + storagePrefix(prefix: string): ITranslateProvider; + useMissingTranslationHandlerLog(): ITranslateProvider; + useMissingTranslationHandler(factory: string): ITranslateProvider; + usePostCompiling(value: boolean): ITranslateProvider; + directivePriority(): number; + directivePriority(priority: number): ITranslateProvider; + determinePreferredLanguage(fn?: () => void): ITranslateProvider; + registerAvailableLanguageKeys(): string[]; + registerAvailableLanguageKeys(languageKeys: string[], aliases?: ILanguageKeyAlias): ITranslateProvider; + useLoaderCache(cache?: any): ITranslateProvider; + } } - interface ILanguageKeyAlias { - [key: string]: string; - } - - interface IStorage { - get(name: string): string; - put(name: string, value: string): void; - } - - interface IStaticFilesLoaderOptions { - prefix: string; - suffix: string; - key?: string; - } - - interface IPartialLoader { - addPart(name : string, priority? : number) : T; - deletePart(name : string) : T; - isPartAvailable(name : string) : boolean; - } - - interface ITranslatePartialLoaderService extends IPartialLoader { - getRegisteredParts() : Array; - isPartLoaded(name : string, lang : string) : boolean; - } - - interface ITranslatePartialLoaderProvider extends angular.IServiceProvider, IPartialLoader { - setPart(lang : string, part : string, table : ITranslationTable) : ITranslatePartialLoaderProvider; - } - - interface ITranslateService { - (translationId: string, interpolateParams?: any, interpolationId?: string): angular.IPromise; - (translationId: string[], interpolateParams?: any, interpolationId?: string): angular.IPromise<{ [key: string]: string }>; - cloakClassName(): string; - cloakClassName(name: string): ITranslateProvider; - fallbackLanguage(langKey?: string): string; - fallbackLanguage(langKey?: string[]): string; - instant(translationId: string, interpolateParams?: any, interpolationId?: string): string; - instant(translationId: string[], interpolateParams?: any, interpolationId?: string): { [key: string]: string }; - isPostCompilingEnabled(): boolean; - preferredLanguage(langKey?: string): string; - proposedLanguage(): string; - refresh(langKey?: string): angular.IPromise; - storage(): IStorage; - storageKey(): string; - use(): string; - use(key: string): angular.IPromise; - useFallbackLanguage(langKey?: string): void; - versionInfo(): string; - loaderCache(): any; - isReady(): boolean; - onReady(): angular.IPromise; - } - - interface ITranslateProvider extends angular.IServiceProvider { - translations(): ITranslationTable; - translations(key: string, translationTable: ITranslationTable): ITranslateProvider; - cloakClassName(): string; - cloakClassName(name: string): ITranslateProvider; - addInterpolation(factory: any): ITranslateProvider; - useMessageFormatInterpolation(): ITranslateProvider; - useInterpolation(factory: string): ITranslateProvider; - useSanitizeValueStrategy(value: string): ITranslateProvider; - preferredLanguage(): ITranslateProvider; - preferredLanguage(language: string): ITranslateProvider; - translationNotFoundIndicator(indicator: string): ITranslateProvider; - translationNotFoundIndicatorLeft(): string; - translationNotFoundIndicatorLeft(indicator: string): ITranslateProvider; - translationNotFoundIndicatorRight(): string; - translationNotFoundIndicatorRight(indicator: string): ITranslateProvider; - fallbackLanguage(): ITranslateProvider; - fallbackLanguage(language: string): ITranslateProvider; - fallbackLanguage(languages: string[]): ITranslateProvider; - forceAsyncReload(value: boolean): ITranslateProvider; - use(): string; - use(key: string): ITranslateProvider; - storageKey(): string; - storageKey(key: string): void; // JeroMiya - the library should probably return ITranslateProvider but it doesn't here - useUrlLoader(url: string): ITranslateProvider; - useStaticFilesLoader(options: IStaticFilesLoaderOptions): ITranslateProvider; - useLoader(loaderFactory: string, options?: any): ITranslateProvider; - useLocalStorage(): ITranslateProvider; - useCookieStorage(): ITranslateProvider; - useStorage(storageFactory: any): ITranslateProvider; - storagePrefix(): string; - storagePrefix(prefix: string): ITranslateProvider; - useMissingTranslationHandlerLog(): ITranslateProvider; - useMissingTranslationHandler(factory: string): ITranslateProvider; - usePostCompiling(value: boolean): ITranslateProvider; - directivePriority(): number; - directivePriority(priority: number): ITranslateProvider; - determinePreferredLanguage(fn?: () => void): ITranslateProvider; - registerAvailableLanguageKeys(): string[]; - registerAvailableLanguageKeys(languageKeys: string[], aliases?: ILanguageKeyAlias): ITranslateProvider; - useLoaderCache(cache?: any): ITranslateProvider; - } -} - -declare namespace angular { interface IFilterService { (name:'translate'): { (translationId: string, interpolateParams?: any, interpolation?: string): string; }; } -} +} \ No newline at end of file diff --git a/angular-ui-bootstrap/index.d.ts b/angular-ui-bootstrap/index.d.ts index 65dee80e5a..3f740de5a1 100644 --- a/angular-ui-bootstrap/index.d.ts +++ b/angular-ui-bootstrap/index.d.ts @@ -5,748 +5,740 @@ /// -// Support for AMD require -declare module 'angular-bootstrap' { - let _: string; - export = _; -} - -declare module 'angular-ui-bootstrap' { - let _: string; - export = _; -} - -declare namespace angular.ui.bootstrap { - - interface IAccordionConfig { - /** - * Controls whether expanding an item will cause the other items to close. - * - * @default true - */ - closeOthers?: boolean; - } - - - interface IButtonConfig { - /** - * @default: 'active' - */ - activeClass?: string; - - /** - * @default: 'Click' - */ - toggleEvent?: string; - } - - - interface IDatepickerConfig { - /** - * Format of day in month. - * - * @default 'dd' - */ - formatDay?: string; - - /** - * Format of month in year. - * - * @default 'MMM' - */ - formatMonth?: string; - - /** - * Format of year in year range. - * - * @default 'yyyy' - */ - formatYear?: string; - - /** - * Format of day in week header. - * - * @default 'EEE' - */ - formatDayHeader?: string; - - /** - * Format of title when selecting day. - * - * @default 'MMM yyyy' - */ - formatDayTitle?: string; - - /** - * Format of title when selecting month. - * - * @default 'yyyy' - */ - formatMonthTitle?: string; - - /** - * Current mode of the datepicker (day|month|year). Can be used to initialize datepicker to specific mode. - * - * @default 'day' - */ - datepickerMode?: string; - - /** - * Set a lower limit for mode. - * - * @default 'day' - */ - minMode?: string; - - /** - * Set an upper limit for mode. - * - * @default 'year' - */ - maxMode?: string; - - /** - * Whether to display week numbers. - * - * @default true - */ - showWeeks?: boolean; - - /** - * Starting day of the week from 0-6 where 0=Sunday and 6=Saturday. - * - * @default 0 - */ - startingDay?: number; - - /** - * Number of years displayed in year selection. - * - * @default 20 - */ - yearRange?: number; - - /** - * Defines the minimum available date. - * - * @default null - */ - minDate?: any; - - /** - * Defines the maximum available date. - * - * @default null - */ - maxDate?: any; - - /** - * An option to disable or enable shortcut's event propagation - * - * @default false - */ - shortcutPropagation?: boolean; - } - - interface IDatepickerPopupConfig { - /** - * The format for displayed dates. - * - * @default 'yyyy-MM-dd' - */ - datepickerPopup?: string; - - /** - * Allows overriding of default template of the popup. - * - * @default 'template/datepicker/popup.html' - */ - datepickerPopupTemplateUrl?: string; - - /** - * Allows overriding of default template of the datepicker used in popup. - * - * @default 'template/datepicker/popup.html' - */ - datepickerTemplateUrl?: string; - - /** - * Allows overriding of the default format for html5 date inputs. - */ - html5Types?: { - date?: string; - 'datetime-local'?: string; - month?: string; - }; - - /** - * The text to display for the current day button. - * - * @default 'Today' - */ - currentText?: string; - - /** - * The text to display for the clear button. - * - * @default 'Clear' - */ - clearText?: string; - - /** - * The text to display for the close button. - * - * @default 'Done' - */ - closeText?: string; - - /** - * Whether to close calendar when a date is chosen. - * - * @default true - */ - closeOnDateSelection?: boolean; - - /** - * Append the datepicker popup element to `body`, rather than inserting after `datepicker-popup`. - * - * @default false - */ - appendToBody?: boolean; - - /** - * Whether to display a button bar underneath the datepicker. - * - * @default true - */ - showButtonBar?: boolean; - - /** - * Whether to focus the datepicker popup upon opening. - * - * @default true - */ - onOpenFocus?: boolean; - } - - - interface IModalProvider { - /** - * Default options all modals will use. - */ - options: IModalSettings; - } - - interface IModalService { - /** - * @param {IModalSettings} options - * @returns {IModalServiceInstance} - */ - open(options: IModalSettings): IModalServiceInstance; - } - - interface IModalServiceInstance { - /** - * A method that can be used to close a modal, passing a result. If `preventDefault` is called on the `modal.closing` event then the modal will remain open. - */ - close(result?: any): void; - - /** - * A method that can be used to dismiss a modal, passing a reason. If `preventDefault` is called on the `modal.closing` event then the modal will remain open. - */ - dismiss(reason?: any): void; - - /** - * A promise that is resolved when a modal is closed and rejected when a modal is dismissed. - */ - result: angular.IPromise; - - /** - * A promise that is resolved when a modal gets opened after downloading content's template and resolving all variables. - */ - opened: angular.IPromise; - - /** - * A promise that is resolved when a modal is rendered. - */ - rendered: angular.IPromise; - } - - interface IModalScope extends angular.IScope { - /** - * Dismiss the dialog without assigning a value to the promise output. If `preventDefault` is called on the `modal.closing` event then the modal will remain open. - * - * @returns true if the modal was closed; otherwise false - */ - $dismiss(reason?: any): boolean; - - /** - * Close the dialog resolving the promise to the given value. If `preventDefault` is called on the `modal.closing` event then the modal will remain open. - * - * @returns true if the modal was closed; otherwise false - */ - $close(result?: any): boolean; - } - - interface IModalSettings { - /** - * a path to a template representing modal's content - */ - templateUrl?: string | (() => string); - - /** - * inline template representing the modal's content - */ - template?: string; - - /** - * a scope instance to be used for the modal's content (actually the $modal service is going to create a child scope of a provided scope). - * Defaults to `$rootScope`. - */ - scope?: angular.IScope|IModalScope; - - /** - * a controller for a modal instance - it can initialize scope used by modal. - * A controller can be injected with `$modalInstance` - * If value is an array, it must be in Inline Array Annotation format for injection (strings followed by factory method) - */ - controller?: string | Function | Array; - - /** - * an alternative to the controller-as syntax, matching the API of directive definitions. - * Requires the controller option to be provided as well - */ - controllerAs?: string; - - /** - * When used with controllerAs and set to true, it will bind the controller properties onto the $scope directly. - * - * @default false - */ - bindToController?: boolean; - - /** - * members that will be resolved and passed to the controller as locals; it is equivalent of the `resolve` property for AngularJS routes - * If property value is an array, it must be in Inline Array Annotation format for injection (strings followed by factory method) - */ - resolve?: { [ key: string ]: string | Function | Array | Object }; - - /** - * Set to false to disable animations on new modal/backdrop. Does not toggle animations for modals/backdrops that are already displayed. - * - * @default true - */ - animation?: boolean; - - /** - * controls the presence of a backdrop - * Allowed values: - * - true (default) - * - false (no backdrop) - * - 'static' backdrop is present but modal window is not closed when clicking outside of the modal window - * - * @default true - */ - backdrop?: boolean | string; - - /** - * indicates whether the dialog should be closable by hitting the ESC key - * - * @default true - */ - keyboard?: boolean; - - /** - * additional CSS class(es) to be added to a modal backdrop template - */ - backdropClass?: string; - - /** - * additional CSS class(es) to be added to a modal window template - */ - windowClass?: string; - - /** - * Optional suffix of modal window class. The value used is appended to the `modal-` class, i.e. a value of `sm` gives `modal-sm`. - */ - size?: string; - - /** - * a path to a template overriding modal's window template - */ - windowTemplateUrl?: string; - - /** - * The class added to the body element when the modal is opened. - * - * @default 'model-open' - */ - openedClass?: string; - } - - interface IModalStackService { - /** - * Opens a new modal instance. - */ - open(modalInstance: IModalServiceInstance, modal: any): void; - - /** - * Closes a modal instance with an optional result. - */ - close(modalInstance: IModalServiceInstance, result?: any): void; - - /** - * Dismisses a modal instance with an optional reason. - */ - dismiss(modalInstance: IModalServiceInstance, reason?: any): void; - - /** - * Dismiss all open modal instances with an optional reason that will be passed to each instance. - */ - dismissAll(reason?: any): void; - - /** - * Gets the topmost modal instance that is open. - */ - getTop(): IModalStackedMapKeyValuePair; - } - - interface IModalStackedMapKeyValuePair { - key: IModalServiceInstance; - value: any; - } - - - interface IPaginationConfig { - /** - * Total number of items in all pages. - */ - totalItems?: number; - - /** - * Maximum number of items per page. A value less than one indicates all items on one page. - * - * @default 10 - */ - itemsPerPage?: number; - - /** - * Limit number for pagination size. - * - * @default: null - */ - maxSize?: number; - - /** - * An optional expression assigned the total number of pages to display. - * - * @default angular.noop - */ - numPages?: number; - - /** - * Whether to keep current page in the middle of the visible ones. - * - * @default true - */ - rotate?: boolean; - - /** - * Whether to display Previous / Next buttons. - * - * @default true - */ - directionLinks?: boolean; - - /** - * Text for Previous button. - * - * @default 'Previous' - */ - previousText?: string; - - /** - * Text for Next button. - * - * @default 'Next' - */ - nextText?: string; - - /** - * Whether to display First / Last buttons. - * - * @default false - */ - boundaryLinks?: boolean; - - /** - * Text for First button. - * - * @default 'First' - */ - firstText?: string; - - /** - * Text for Last button. - * - * @default 'Last' - */ - lastText?: string; - - /** - * Override the template for the component with a custom provided template. - * - * @default 'template/pagination/pagination.html' - */ - templateUrl?: string; - } - - interface IPagerConfig { - /** - * Whether to align each link to the sides. - * - * @default true - */ - align?: boolean; - - /** - * Maximum number of items per page. A value less than one indicates all items on one page. - * - * @default 10 - */ - itemsPerPage?: number; - - /** - * Text for Previous button. - * - * @default '« Previous' - */ - previousText?: string; - - /** - * Text for Next button. - * - * @default 'Next »' - */ - nextText?: string; - } - - - interface IPositionCoordinates { - width?: number; - height?: number; - top?: number; - left?: number; - } - - interface IPositionService { - /** - * Provides a read-only equivalent of jQuery's position function. - */ - position(element: JQuery): IPositionCoordinates; - - /** - * Provides a read-only equivalent of jQuery's offset function. - */ - offset(element: JQuery): IPositionCoordinates; - } - - - interface IProgressConfig { - /** - * Whether bars use transitions to achieve the width change. - * - * @default: true - */ - animate?: boolean; - - /** - * A number that specifies the total value of bars that is required. - * - * @default: 100 - */ - max?: number; - } - - - interface IRatingConfig { - /** - * Changes the number of icons. - * - * @default: 5 - */ - max?: number; - - /** - * A variable used in the template to specify the state for selected icons. - * - * @default: null - */ - stateOn?: string; - - /** - * A variable used in the template to specify the state for unselected icons. - * - * @default: null - */ - stateOff?: string; - - /** - * An array of strings defining titles for all icons. - * - * @default: ["one", "two", "three", "four", "five"] - */ - titles?: Array; - } - - - interface ITimepickerConfig { - /** - * Number of hours to increase or decrease when using a button. - * - * @default 1 - */ - hourStep?: number; - - /** - * Number of minutes to increase or decrease when using a button. - * - * @default 1 - */ - minuteStep?: number; - - /** - * Whether to display 12H or 24H mode. - * - * @default true - */ - showMeridian?: boolean; - - /** - * Meridian labels based on locale. To override you must supply an array like ['AM', 'PM']. - * - * @default null - */ - meridians?: Array; - - /** - * Whether the user can type inside the hours & minutes input. - * - * @default false - */ - readonlyInput?: boolean; - - /** - * Whether the user can scroll inside the hours & minutes input to increase or decrease it's values. - * - * @default true - */ - mousewheel?: boolean; - - /** - * Whether the user can use up/down arrowkeys inside the hours & minutes input to increase or decrease it's values. - * - * @default true - */ - arrowkeys?: boolean; - - /** - * Shows spinner arrows above and below the inputs. - * - * @default true - */ - showSpinners?: boolean; - } - - - interface ITooltipOptions { - /** - * Where to place it? Defaults to 'top', but also accepts 'right', 'bottom', or 'left'. - * - * @default 'top' - */ - placement?: string; - - /** - * Should the modal fade in and out? - * - * @default true - */ - animation?: boolean; - - /** - * For how long should the user have to have the mouse over the element before the tooltip shows (in milliseconds)? - * - * @default 0 - */ - popupDelay?: number; - - /** - * Should the tooltip be appended to `$body` instead of the parent element? - * - * @default false - */ - appendToBody?: boolean; - - /** - * What should trigger a show of the tooltip? Supports a space separated list of event names. - * - * @default 'mouseenter' for tooltip, 'click' for popover - */ - trigger?: string; - - /** - * Should an expression on the scope be used to load the content? - * - * @default false - */ - useContentExp?: boolean; - } - - interface ITooltipProvider { - /** - * Provide a set of defaults for certain tooltip and popover attributes. - */ - options(value: ITooltipOptions): void; - - /** - * Extends the default trigger mappings with mappings of your own. E.g. `{ 'openTrigger': 'closeTrigger' }`. - */ - setTriggers(triggers: Object): void; - } - - - /** - * WARNING: $transition is now deprecated. Use $animate from ngAnimate instead. - */ - interface ITransitionService { - /** - * The browser specific animation event name. - */ - animationEndEventName: string; - - /** - * The browser specific transition event name. - */ - transitionEndEventName: string; - - /** - * Provides a consistent interface to trigger CSS 3 transitions and to be informed when they complete. - * - * @param element The DOMElement that will be animated - * @param trigger The thing that will cause the transition to start: - * - As a string, it represents the css class to be added to the element. - * - As an object, it represents a hash of style attributes to be applied to the element. - * - As a function, it represents a function to be called that will cause the transition to occur. - * @param options Optional settings for the transition. - * - * @return A promise that is resolved when the transition finishes. - */ - (element: angular.IAugmentedJQuery, trigger: any, options?: ITransitionServiceOptions): angular.IPromise; - } - - interface ITransitionServiceOptions { - animation?: boolean; - } - +import * as angular from 'angularjs'; + +declare module 'angularjs' { + export namespace ui.bootstrap { + + interface IAccordionConfig { + /** + * Controls whether expanding an item will cause the other items to close. + * + * @default true + */ + closeOthers?: boolean; + } + + + interface IButtonConfig { + /** + * @default: 'active' + */ + activeClass?: string; + + /** + * @default: 'Click' + */ + toggleEvent?: string; + } + + + interface IDatepickerConfig { + /** + * Format of day in month. + * + * @default 'dd' + */ + formatDay?: string; + + /** + * Format of month in year. + * + * @default 'MMM' + */ + formatMonth?: string; + + /** + * Format of year in year range. + * + * @default 'yyyy' + */ + formatYear?: string; + + /** + * Format of day in week header. + * + * @default 'EEE' + */ + formatDayHeader?: string; + + /** + * Format of title when selecting day. + * + * @default 'MMM yyyy' + */ + formatDayTitle?: string; + + /** + * Format of title when selecting month. + * + * @default 'yyyy' + */ + formatMonthTitle?: string; + + /** + * Current mode of the datepicker (day|month|year). Can be used to initialize datepicker to specific mode. + * + * @default 'day' + */ + datepickerMode?: string; + + /** + * Set a lower limit for mode. + * + * @default 'day' + */ + minMode?: string; + + /** + * Set an upper limit for mode. + * + * @default 'year' + */ + maxMode?: string; + + /** + * Whether to display week numbers. + * + * @default true + */ + showWeeks?: boolean; + + /** + * Starting day of the week from 0-6 where 0=Sunday and 6=Saturday. + * + * @default 0 + */ + startingDay?: number; + + /** + * Number of years displayed in year selection. + * + * @default 20 + */ + yearRange?: number; + + /** + * Defines the minimum available date. + * + * @default null + */ + minDate?: any; + + /** + * Defines the maximum available date. + * + * @default null + */ + maxDate?: any; + + /** + * An option to disable or enable shortcut's event propagation + * + * @default false + */ + shortcutPropagation?: boolean; + } + + interface IDatepickerPopupConfig { + /** + * The format for displayed dates. + * + * @default 'yyyy-MM-dd' + */ + datepickerPopup?: string; + + /** + * Allows overriding of default template of the popup. + * + * @default 'template/datepicker/popup.html' + */ + datepickerPopupTemplateUrl?: string; + + /** + * Allows overriding of default template of the datepicker used in popup. + * + * @default 'template/datepicker/popup.html' + */ + datepickerTemplateUrl?: string; + + /** + * Allows overriding of the default format for html5 date inputs. + */ + html5Types?: { + date?: string; + 'datetime-local'?: string; + month?: string; + }; + + /** + * The text to display for the current day button. + * + * @default 'Today' + */ + currentText?: string; + + /** + * The text to display for the clear button. + * + * @default 'Clear' + */ + clearText?: string; + + /** + * The text to display for the close button. + * + * @default 'Done' + */ + closeText?: string; + + /** + * Whether to close calendar when a date is chosen. + * + * @default true + */ + closeOnDateSelection?: boolean; + + /** + * Append the datepicker popup element to `body`, rather than inserting after `datepicker-popup`. + * + * @default false + */ + appendToBody?: boolean; + + /** + * Whether to display a button bar underneath the datepicker. + * + * @default true + */ + showButtonBar?: boolean; + + /** + * Whether to focus the datepicker popup upon opening. + * + * @default true + */ + onOpenFocus?: boolean; + } + + + interface IModalProvider { + /** + * Default options all modals will use. + */ + options: IModalSettings; + } + + interface IModalService { + /** + * @param {IModalSettings} options + * @returns {IModalServiceInstance} + */ + open(options: IModalSettings): IModalServiceInstance; + } + + interface IModalServiceInstance { + /** + * A method that can be used to close a modal, passing a result. If `preventDefault` is called on the `modal.closing` event then the modal will remain open. + */ + close(result?: any): void; + + /** + * A method that can be used to dismiss a modal, passing a reason. If `preventDefault` is called on the `modal.closing` event then the modal will remain open. + */ + dismiss(reason?: any): void; + + /** + * A promise that is resolved when a modal is closed and rejected when a modal is dismissed. + */ + result: angular.IPromise; + + /** + * A promise that is resolved when a modal gets opened after downloading content's template and resolving all variables. + */ + opened: angular.IPromise; + + /** + * A promise that is resolved when a modal is rendered. + */ + rendered: angular.IPromise; + } + + interface IModalScope extends angular.IScope { + /** + * Dismiss the dialog without assigning a value to the promise output. If `preventDefault` is called on the `modal.closing` event then the modal will remain open. + * + * @returns true if the modal was closed; otherwise false + */ + $dismiss(reason?: any): boolean; + + /** + * Close the dialog resolving the promise to the given value. If `preventDefault` is called on the `modal.closing` event then the modal will remain open. + * + * @returns true if the modal was closed; otherwise false + */ + $close(result?: any): boolean; + } + + interface IModalSettings { + /** + * a path to a template representing modal's content + */ + templateUrl?: string | (() => string); + + /** + * inline template representing the modal's content + */ + template?: string; + + /** + * a scope instance to be used for the modal's content (actually the $modal service is going to create a child scope of a provided scope). + * Defaults to `$rootScope`. + */ + scope?: angular.IScope | IModalScope; + + /** + * a controller for a modal instance - it can initialize scope used by modal. + * A controller can be injected with `$modalInstance` + * If value is an array, it must be in Inline Array Annotation format for injection (strings followed by factory method) + */ + controller?: string | Function | Array; + + /** + * an alternative to the controller-as syntax, matching the API of directive definitions. + * Requires the controller option to be provided as well + */ + controllerAs?: string; + + /** + * When used with controllerAs and set to true, it will bind the controller properties onto the $scope directly. + * + * @default false + */ + bindToController?: boolean; + + /** + * members that will be resolved and passed to the controller as locals; it is equivalent of the `resolve` property for AngularJS routes + * If property value is an array, it must be in Inline Array Annotation format for injection (strings followed by factory method) + */ + resolve?: { [key: string]: string | Function | Array | Object }; + + /** + * Set to false to disable animations on new modal/backdrop. Does not toggle animations for modals/backdrops that are already displayed. + * + * @default true + */ + animation?: boolean; + + /** + * controls the presence of a backdrop + * Allowed values: + * - true (default) + * - false (no backdrop) + * - 'static' backdrop is present but modal window is not closed when clicking outside of the modal window + * + * @default true + */ + backdrop?: boolean | string; + + /** + * indicates whether the dialog should be closable by hitting the ESC key + * + * @default true + */ + keyboard?: boolean; + + /** + * additional CSS class(es) to be added to a modal backdrop template + */ + backdropClass?: string; + + /** + * additional CSS class(es) to be added to a modal window template + */ + windowClass?: string; + + /** + * Optional suffix of modal window class. The value used is appended to the `modal-` class, i.e. a value of `sm` gives `modal-sm`. + */ + size?: string; + + /** + * a path to a template overriding modal's window template + */ + windowTemplateUrl?: string; + + /** + * The class added to the body element when the modal is opened. + * + * @default 'model-open' + */ + openedClass?: string; + } + + interface IModalStackService { + /** + * Opens a new modal instance. + */ + open(modalInstance: IModalServiceInstance, modal: any): void; + + /** + * Closes a modal instance with an optional result. + */ + close(modalInstance: IModalServiceInstance, result?: any): void; + + /** + * Dismisses a modal instance with an optional reason. + */ + dismiss(modalInstance: IModalServiceInstance, reason?: any): void; + + /** + * Dismiss all open modal instances with an optional reason that will be passed to each instance. + */ + dismissAll(reason?: any): void; + + /** + * Gets the topmost modal instance that is open. + */ + getTop(): IModalStackedMapKeyValuePair; + } + + interface IModalStackedMapKeyValuePair { + key: IModalServiceInstance; + value: any; + } + + + interface IPaginationConfig { + /** + * Total number of items in all pages. + */ + totalItems?: number; + + /** + * Maximum number of items per page. A value less than one indicates all items on one page. + * + * @default 10 + */ + itemsPerPage?: number; + + /** + * Limit number for pagination size. + * + * @default: null + */ + maxSize?: number; + + /** + * An optional expression assigned the total number of pages to display. + * + * @default angular.noop + */ + numPages?: number; + + /** + * Whether to keep current page in the middle of the visible ones. + * + * @default true + */ + rotate?: boolean; + + /** + * Whether to display Previous / Next buttons. + * + * @default true + */ + directionLinks?: boolean; + + /** + * Text for Previous button. + * + * @default 'Previous' + */ + previousText?: string; + + /** + * Text for Next button. + * + * @default 'Next' + */ + nextText?: string; + + /** + * Whether to display First / Last buttons. + * + * @default false + */ + boundaryLinks?: boolean; + + /** + * Text for First button. + * + * @default 'First' + */ + firstText?: string; + + /** + * Text for Last button. + * + * @default 'Last' + */ + lastText?: string; + + /** + * Override the template for the component with a custom provided template. + * + * @default 'template/pagination/pagination.html' + */ + templateUrl?: string; + } + + interface IPagerConfig { + /** + * Whether to align each link to the sides. + * + * @default true + */ + align?: boolean; + + /** + * Maximum number of items per page. A value less than one indicates all items on one page. + * + * @default 10 + */ + itemsPerPage?: number; + + /** + * Text for Previous button. + * + * @default '« Previous' + */ + previousText?: string; + + /** + * Text for Next button. + * + * @default 'Next »' + */ + nextText?: string; + } + + + interface IPositionCoordinates { + width?: number; + height?: number; + top?: number; + left?: number; + } + + interface IPositionService { + /** + * Provides a read-only equivalent of jQuery's position function. + */ + position(element: JQuery): IPositionCoordinates; + + /** + * Provides a read-only equivalent of jQuery's offset function. + */ + offset(element: JQuery): IPositionCoordinates; + } + + + interface IProgressConfig { + /** + * Whether bars use transitions to achieve the width change. + * + * @default: true + */ + animate?: boolean; + + /** + * A number that specifies the total value of bars that is required. + * + * @default: 100 + */ + max?: number; + } + + + interface IRatingConfig { + /** + * Changes the number of icons. + * + * @default: 5 + */ + max?: number; + + /** + * A variable used in the template to specify the state for selected icons. + * + * @default: null + */ + stateOn?: string; + + /** + * A variable used in the template to specify the state for unselected icons. + * + * @default: null + */ + stateOff?: string; + + /** + * An array of strings defining titles for all icons. + * + * @default: ["one", "two", "three", "four", "five"] + */ + titles?: Array; + } + + + interface ITimepickerConfig { + /** + * Number of hours to increase or decrease when using a button. + * + * @default 1 + */ + hourStep?: number; + + /** + * Number of minutes to increase or decrease when using a button. + * + * @default 1 + */ + minuteStep?: number; + + /** + * Whether to display 12H or 24H mode. + * + * @default true + */ + showMeridian?: boolean; + + /** + * Meridian labels based on locale. To override you must supply an array like ['AM', 'PM']. + * + * @default null + */ + meridians?: Array; + + /** + * Whether the user can type inside the hours & minutes input. + * + * @default false + */ + readonlyInput?: boolean; + + /** + * Whether the user can scroll inside the hours & minutes input to increase or decrease it's values. + * + * @default true + */ + mousewheel?: boolean; + + /** + * Whether the user can use up/down arrowkeys inside the hours & minutes input to increase or decrease it's values. + * + * @default true + */ + arrowkeys?: boolean; + + /** + * Shows spinner arrows above and below the inputs. + * + * @default true + */ + showSpinners?: boolean; + } + + + interface ITooltipOptions { + /** + * Where to place it? Defaults to 'top', but also accepts 'right', 'bottom', or 'left'. + * + * @default 'top' + */ + placement?: string; + + /** + * Should the modal fade in and out? + * + * @default true + */ + animation?: boolean; + + /** + * For how long should the user have to have the mouse over the element before the tooltip shows (in milliseconds)? + * + * @default 0 + */ + popupDelay?: number; + + /** + * Should the tooltip be appended to `$body` instead of the parent element? + * + * @default false + */ + appendToBody?: boolean; + + /** + * What should trigger a show of the tooltip? Supports a space separated list of event names. + * + * @default 'mouseenter' for tooltip, 'click' for popover + */ + trigger?: string; + + /** + * Should an expression on the scope be used to load the content? + * + * @default false + */ + useContentExp?: boolean; + } + + interface ITooltipProvider { + /** + * Provide a set of defaults for certain tooltip and popover attributes. + */ + options(value: ITooltipOptions): void; + + /** + * Extends the default trigger mappings with mappings of your own. E.g. `{ 'openTrigger': 'closeTrigger' }`. + */ + setTriggers(triggers: Object): void; + } + + + /** + * WARNING: $transition is now deprecated. Use $animate from ngAnimate instead. + */ + interface ITransitionService { + /** + * The browser specific animation event name. + */ + animationEndEventName: string; + + /** + * The browser specific transition event name. + */ + transitionEndEventName: string; + + /** + * Provides a consistent interface to trigger CSS 3 transitions and to be informed when they complete. + * + * @param element The DOMElement that will be animated + * @param trigger The thing that will cause the transition to start: + * - As a string, it represents the css class to be added to the element. + * - As an object, it represents a hash of style attributes to be applied to the element. + * - As a function, it represents a function to be called that will cause the transition to occur. + * @param options Optional settings for the transition. + * + * @return A promise that is resolved when the transition finishes. + */ + (element: angular.IAugmentedJQuery, trigger: any, options?: ITransitionServiceOptions): angular.IPromise; + } + + interface ITransitionServiceOptions { + animation?: boolean; + } + } } diff --git a/angular-ui-scroll/index.d.ts b/angular-ui-scroll/index.d.ts index e8a04c4eeb..ddeca0c20b 100644 --- a/angular-ui-scroll/index.d.ts +++ b/angular-ui-scroll/index.d.ts @@ -5,81 +5,85 @@ /// -declare namespace angular.ui { - interface IScrollDatasource { - /** - * The datasource object implements methods and properties to be used by the directive to access the data - * - * @param index indicates the first data row requested - * - * @param count indicates number of data rows requested - * - * @param success function to call when the data are retrieved. The implementation of the service has to call - * this function when the data are retrieved and pass it an array of the items retrieved. If no items are - * retrieved, an empty array has to be passed. - * - * Important: Make sure to respect the index and count parameters of the request. The array passed to the - * success method should have exactly count elements unless it hit eof/bof - */ - get(index: number, count: number, success: (results: Array) => any): void; - } +import * as angular from 'angularjs'; - interface IScrollAdapter { - /** - * a boolean value indicating whether there are any pending load requests. - */ - isLoading: boolean; - /** - * a reference to the item currently in the topmost visible position. - */ - topVisible: any; - /** - * a reference to the DOM element currently in the topmost visible position. - */ - topVisibleElement: ng.IAugmentedJQueryStatic; - /** - * a reference to the scope created for the item currently in the topmost visible position. - */ - topVisibleScope: ng.IRepeatScope; - /** - * calling this method reinitializes and reloads the scroller content. - */ - reload(): void; - /** - * Replaces the item in the buffer at the given index with the new items. - * - * @param index provides position of the item to be affected in the dataset (not in the buffer). If the item with - * the given index currently is not in the buffer no updates will be applied. $index property of the item $scope - * can be used to access the index value for a given item - * - * @param newItems is an array of items to replace the affected item. If the array is empty ([]) the item will - * be deleted, otherwise the items in the array replace the item. If the newItem array contains the old item, - * the old item stays in place. - */ - applyUpdates(index: number, newItems: any[]): void; - /** - * Replaces the item in the buffer at the given index with the new items. - * - * @param updater is a function to be applied to every item currently in the buffer. The function will receive - * 3 parameters: item, scope, and element. Here item is the item to be affected, scope is the item $scope, and - * element is the html element for the item. The return value of the function should be an array of items. - * Similarly to the newItem parameter (see above), if the array is empty([]), the item is deleted, otherwise - * the item is replaced by the items in the array. If the return value is not an array, the item remains - * unaffected, unless some updates were made to the item in the updater function. This can be thought of as - * in place update. - */ - applyUpdates(updater: (item: any, scope: ng.IRepeatScope) => any): void; - /** - * Adds new items after the last item in the buffer - * - * @param newItems provides an array of items to be appended. - */ - append(newItems: any[]): void; - /** - * Adds new items before the first item in the buffer - * - * @param newItems provides an array of items to be prepended. - */ - prepend(newItems: any[]): void; +declare module 'angularjs' { + export namespace ui { + interface IScrollDatasource { + /** + * The datasource object implements methods and properties to be used by the directive to access the data + * + * @param index indicates the first data row requested + * + * @param count indicates number of data rows requested + * + * @param success function to call when the data are retrieved. The implementation of the service has to call + * this function when the data are retrieved and pass it an array of the items retrieved. If no items are + * retrieved, an empty array has to be passed. + * + * Important: Make sure to respect the index and count parameters of the request. The array passed to the + * success method should have exactly count elements unless it hit eof/bof + */ + get(index: number, count: number, success: (results: Array) => any): void; + } + + interface IScrollAdapter { + /** + * a boolean value indicating whether there are any pending load requests. + */ + isLoading: boolean; + /** + * a reference to the item currently in the topmost visible position. + */ + topVisible: any; + /** + * a reference to the DOM element currently in the topmost visible position. + */ + topVisibleElement: ng.IAugmentedJQueryStatic; + /** + * a reference to the scope created for the item currently in the topmost visible position. + */ + topVisibleScope: ng.IRepeatScope; + /** + * calling this method reinitializes and reloads the scroller content. + */ + reload(): void; + /** + * Replaces the item in the buffer at the given index with the new items. + * + * @param index provides position of the item to be affected in the dataset (not in the buffer). If the item with + * the given index currently is not in the buffer no updates will be applied. $index property of the item $scope + * can be used to access the index value for a given item + * + * @param newItems is an array of items to replace the affected item. If the array is empty ([]) the item will + * be deleted, otherwise the items in the array replace the item. If the newItem array contains the old item, + * the old item stays in place. + */ + applyUpdates(index: number, newItems: any[]): void; + /** + * Replaces the item in the buffer at the given index with the new items. + * + * @param updater is a function to be applied to every item currently in the buffer. The function will receive + * 3 parameters: item, scope, and element. Here item is the item to be affected, scope is the item $scope, and + * element is the html element for the item. The return value of the function should be an array of items. + * Similarly to the newItem parameter (see above), if the array is empty([]), the item is deleted, otherwise + * the item is replaced by the items in the array. If the return value is not an array, the item remains + * unaffected, unless some updates were made to the item in the updater function. This can be thought of as + * in place update. + */ + applyUpdates(updater: (item: any, scope: ng.IRepeatScope) => any): void; + /** + * Adds new items after the last item in the buffer + * + * @param newItems provides an array of items to be appended. + */ + append(newItems: any[]): void; + /** + * Adds new items before the first item in the buffer + * + * @param newItems provides an array of items to be prepended. + */ + prepend(newItems: any[]): void; + } } } diff --git a/angular-ui-sortable/index.d.ts b/angular-ui-sortable/index.d.ts index 1b3508143d..ce1cebe57f 100644 --- a/angular-ui-sortable/index.d.ts +++ b/angular-ui-sortable/index.d.ts @@ -5,206 +5,209 @@ /// -declare namespace angular.ui { +import * as angular from 'angularjs'; - interface UISortableOptions extends SortableOptions { - 'ui-floating'?: string|boolean; +declare module 'angularjs' { + export namespace ui { + + interface UISortableOptions extends SortableOptions { + 'ui-floating'?: string | boolean; + } + + interface UISortableProperties { + /** + * Holds the index of the drop target that the dragged item was dropped. + */ + dropindex: number; + + /** + * Holds the ui-sortable element that the dragged item was dropped on. + */ + droptarget: number; + + /** + * Holds the array that is specified by the `ng-model` attribute of the [`droptarget`](#droptarget) ui-sortable element. + */ + droptargetModel: Array; + + /** + * Holds the original index of the item dragged. + */ + index: number; + + /** + * Holds the JavaScript object that is used as the model of the dragged item, as specified by the ng-repeat of the [`source`](#source) ui-sortable element and the item's [`index`](#index). + */ + model: T; + + /** + * Holds the model of the dragged item only when a sorting happens between two connected ui-sortable elements. + * In other words: `'moved' in ui.item.sortable` will return false only when a sorting is withing the same ui-sortable element ([`source`](#source) equals to the [`droptarget`](#droptarget)). + */ + moved?: T; + + /** + * When sorting between two connected sortables, it will be set to true inside the `update` callback of the [`droptarget`](#droptarget). + */ + received: Boolean; + + /** + * Holds the ui-sortable element that the dragged item originated from. + */ + source: ng.IAugmentedJQuery + + /** + * Holds the array that is specified by the `ng-model` of the [`source`](#source) ui-sortable element. + */ + sourceModel: Array; + + /** + * Can be called inside the `update` callback, in order to prevent/revert a sorting. + * Should be used instead of the [jquery-ui-sortable cancel()](http://api.jqueryui.com/sortable/#method-cancel) method. + */ + cancel(): void; + + /** + * Returns whether the current sorting is marked as canceled, by an earlier call to [`ui.item.sortable.cancel()`](#cancel). + */ + isCanceled(): Boolean; + + /** + * Returns whether the [`helper`](http://api.jqueryui.com/sortable/#option-helper) element used for the current sorting, is one of the original ui-sortable list elements. + */ + isCustomHelperUsed(): Boolean; + } + + interface UISortableUIItem extends ng.IAugmentedJQuery { + sortable: UISortableProperties; + } + + interface UISortableUIParams extends SortableUIParams { + item: UISortableUIItem; + } + + // Base Sortable ////////////////////////////////////////////////// + + interface SortableCursorAtOptions { + top?: number; + left?: number; + right?: number; + bottom?: number; + } + + interface SortableHelperFunctionOption { + (event: JQueryEventObject, ui: ng.IAugmentedJQuery): JQuery; + } + + interface SortableOptions extends SortableEvents { + /** + * jQuery, Element, Selector or string + * Default: "parent" + */ + appendTo?: any; + /** + * "X", "Y" or false + * Default: false + */ + axis?: string | boolean; + /** + * Selector + * Default: "input,textarea,button,select,option" + */ + cancel?: string; + /** + * Selector or false + * Default: false + */ + connectWith?: string | boolean; + /** + * Element, Selector, string or false + * Default: false + */ + containment?: any; + cursor?: string; + /** + * Moves the sorting element or helper so the cursor always appears to drag from the same position. Coordinates can be given as a hash using a combination of one or two keys SortableCursorAtOptions: { top, left, right, bottom } + * Default: false + */ + cursorAt?: SortableCursorAtOptions | boolean; + delay?: number; + disabled?: boolean; + distance?: number; + dropOnEmpty?: boolean; + forceHelperSize?: boolean; + forcePlaceholderSize?: boolean; + /** + * Array of numbers or false + * Default: false + */ + grid?: number[] | boolean; + /** + * Selector or Element + */ + handle?: any; + /** + * "original", "clone" or Function() + * Default: "original" + */ + helper?: string | SortableHelperFunctionOption; + /** + * Selector + */ + items?: string; + /** + * Number or false + * Default: false + */ + opacity?: number | boolean; + /** + * string or false + * Default: false + */ + placeholder?: string | boolean; + /** + * boolean or number + * Default: false + */ + revert?: number | boolean; + scroll?: boolean; + scrollSensitivity?: number; + scrollSpeed?: number; + /** + * "intersect" or "pointer" + * Default: "intersect" + */ + tolerance?: string; + zIndex?: number; + } + + interface SortableUIParams { + helper: ng.IAugmentedJQuery; + item: ng.IAugmentedJQuery; + offset: any; + position: any; + originalPosition: any; + sender: ng.IAugmentedJQuery; + placeholder: ng.IAugmentedJQuery; + } + + interface SortableEvent { + (event: JQueryEventObject, ui: UISortableUIParams): void; + } + + interface SortableEvents { + activate?: SortableEvent; + beforeStop?: SortableEvent; + change?: SortableEvent; + deactivate?: SortableEvent; + out?: SortableEvent; + over?: SortableEvent; + receive?: SortableEvent; + remove?: SortableEvent; + sort?: SortableEvent; + start?: SortableEvent; + stop?: SortableEvent; + update?: SortableEvent; + } } - - interface UISortableProperties { - /** - * Holds the index of the drop target that the dragged item was dropped. - */ - dropindex: number; - - /** - * Holds the ui-sortable element that the dragged item was dropped on. - */ - droptarget: number; - - /** - * Holds the array that is specified by the `ng-model` attribute of the [`droptarget`](#droptarget) ui-sortable element. - */ - droptargetModel: Array; - - /** - * Holds the original index of the item dragged. - */ - index: number; - - /** - * Holds the JavaScript object that is used as the model of the dragged item, as specified by the ng-repeat of the [`source`](#source) ui-sortable element and the item's [`index`](#index). - */ - model: T; - - /** - * Holds the model of the dragged item only when a sorting happens between two connected ui-sortable elements. - * In other words: `'moved' in ui.item.sortable` will return false only when a sorting is withing the same ui-sortable element ([`source`](#source) equals to the [`droptarget`](#droptarget)). - */ - moved?: T; - - /** - * When sorting between two connected sortables, it will be set to true inside the `update` callback of the [`droptarget`](#droptarget). - */ - received: Boolean; - - /** - * Holds the ui-sortable element that the dragged item originated from. - */ - source: ng.IAugmentedJQuery - - /** - * Holds the array that is specified by the `ng-model` of the [`source`](#source) ui-sortable element. - */ - sourceModel: Array; - - /** - * Can be called inside the `update` callback, in order to prevent/revert a sorting. - * Should be used instead of the [jquery-ui-sortable cancel()](http://api.jqueryui.com/sortable/#method-cancel) method. - */ - cancel(): void; - - /** - * Returns whether the current sorting is marked as canceled, by an earlier call to [`ui.item.sortable.cancel()`](#cancel). - */ - isCanceled(): Boolean; - - /** - * Returns whether the [`helper`](http://api.jqueryui.com/sortable/#option-helper) element used for the current sorting, is one of the original ui-sortable list elements. - */ - isCustomHelperUsed(): Boolean; - } - - interface UISortableUIItem extends ng.IAugmentedJQuery { - sortable: UISortableProperties; - } - - interface UISortableUIParams extends SortableUIParams { - item: UISortableUIItem; - } - - // Base Sortable ////////////////////////////////////////////////// - - interface SortableCursorAtOptions { - top?: number; - left?: number; - right?: number; - bottom?: number; - } - - interface SortableHelperFunctionOption { - (event: JQueryEventObject, ui: ng.IAugmentedJQuery): JQuery; - } - - interface SortableOptions extends SortableEvents { - /** - * jQuery, Element, Selector or string - * Default: "parent" - */ - appendTo?: any; - /** - * "X", "Y" or false - * Default: false - */ - axis?: string|boolean; - /** - * Selector - * Default: "input,textarea,button,select,option" - */ - cancel?: string; - /** - * Selector or false - * Default: false - */ - connectWith?: string|boolean; - /** - * Element, Selector, string or false - * Default: false - */ - containment?: any; - cursor?: string; - /** - * Moves the sorting element or helper so the cursor always appears to drag from the same position. Coordinates can be given as a hash using a combination of one or two keys SortableCursorAtOptions: { top, left, right, bottom } - * Default: false - */ - cursorAt?: SortableCursorAtOptions|boolean; - delay?: number; - disabled?: boolean; - distance?: number; - dropOnEmpty?: boolean; - forceHelperSize?: boolean; - forcePlaceholderSize?: boolean; - /** - * Array of numbers or false - * Default: false - */ - grid?: number[]|boolean; - /** - * Selector or Element - */ - handle?: any; - /** - * "original", "clone" or Function() - * Default: "original" - */ - helper?: string|SortableHelperFunctionOption; - /** - * Selector - */ - items?: string; - /** - * Number or false - * Default: false - */ - opacity?: number|boolean; - /** - * string or false - * Default: false - */ - placeholder?: string|boolean; - /** - * boolean or number - * Default: false - */ - revert?: number|boolean; - scroll?: boolean; - scrollSensitivity?: number; - scrollSpeed?: number; - /** - * "intersect" or "pointer" - * Default: "intersect" - */ - tolerance?: string; - zIndex?: number; - } - - interface SortableUIParams { - helper: ng.IAugmentedJQuery; - item: ng.IAugmentedJQuery; - offset: any; - position: any; - originalPosition: any; - sender: ng.IAugmentedJQuery; - placeholder: ng.IAugmentedJQuery; - } - - interface SortableEvent { - (event: JQueryEventObject, ui: UISortableUIParams): void; - } - - interface SortableEvents { - activate?: SortableEvent; - beforeStop?: SortableEvent; - change?: SortableEvent; - deactivate?: SortableEvent; - out?: SortableEvent; - over?: SortableEvent; - receive?: SortableEvent; - remove?: SortableEvent; - sort?: SortableEvent; - start?: SortableEvent; - stop?: SortableEvent; - update?: SortableEvent; - } - } diff --git a/angular.throttle/index.d.ts b/angular.throttle/index.d.ts index ee70e42eb8..cac8badb90 100644 --- a/angular.throttle/index.d.ts +++ b/angular.throttle/index.d.ts @@ -5,7 +5,9 @@ /// -declare namespace angular { +import * as angular from 'angularjs'; + +declare module 'angularjs' { interface IAngularStatic { throttle:( fn:Function, throttle:number, options?:{leading?:boolean; trailing?:boolean;} ) => Function; } diff --git a/angularLocalStorage/index.d.ts b/angularLocalStorage/index.d.ts index 84ecc42e5e..2113e05c62 100644 --- a/angularLocalStorage/index.d.ts +++ b/angularLocalStorage/index.d.ts @@ -5,18 +5,22 @@ /// -declare namespace angular.localStorage { - interface ILocalStorageService { - set(key: string, value: any): any; - get(key: string): any; - remove(key: string): boolean; - clearAll(): void; +import * as angular from 'angularjs'; - bind($scope: ng.IScope, key: string, opts?: { - defaultValue?: any; - storeName?: string; - }): any; - unbind($scope: ng.IScope, key: string, storeName?: string): void; +declare module 'angularjs' { + export namespace localStorage { + interface ILocalStorageService { + set(key: string, value: any): any; + get(key: string): any; + remove(key: string): boolean; + clearAll(): void; + + bind($scope: ng.IScope, key: string, opts?: { + defaultValue?: any; + storeName?: string; + }): any; + unbind($scope: ng.IScope, key: string, storeName?: string): void; + } } } diff --git a/angularjs/angular-mocks.d.ts b/angularjs/angular-mocks.d.ts index 3d8a6e8926..40b6dc0c76 100644 --- a/angularjs/angular-mocks.d.ts +++ b/angularjs/angular-mocks.d.ts @@ -3,6 +3,7 @@ // Definitions by: Diego Vilar , Tony Curtis // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +import * as angular from 'angularjs'; declare module "angular-mocks/ngMock" { var _: string; @@ -22,38 +23,38 @@ declare module "angular-mocks/ngAnimateMock" { /////////////////////////////////////////////////////////////////////////////// // ngMock module (angular-mocks.js) /////////////////////////////////////////////////////////////////////////////// -declare namespace angular { +declare module 'angularjs' { /////////////////////////////////////////////////////////////////////////// // AngularStatic // We reopen it to add the MockStatic definition /////////////////////////////////////////////////////////////////////////// interface IAngularStatic { - mock: IMockStatic; + mock: IMockStatic; } // see https://docs.angularjs.org/api/ngMock/function/angular.mock.inject interface IInjectStatic { - (...fns: Function[]): any; - (...inlineAnnotatedConstructor: any[]): any; // this overload is undocumented, but works - strictDi(val?: boolean): void; + (...fns: Function[]): any; + (...inlineAnnotatedConstructor: any[]): any; // this overload is undocumented, but works + strictDi(val?: boolean): void; } interface IMockStatic { - // see https://docs.angularjs.org/api/ngMock/function/angular.mock.dump - dump(obj: any): string; + // see https://docs.angularjs.org/api/ngMock/function/angular.mock.dump + dump(obj: any): string; - inject: IInjectStatic + inject: IInjectStatic - // see https://docs.angularjs.org/api/ngMock/function/angular.mock.module - module: { - (...modules: any[]): any; - sharedInjector(): void; - } + // see https://docs.angularjs.org/api/ngMock/function/angular.mock.module + module: { + (...modules: any[]): any; + sharedInjector(): void; + } - // see https://docs.angularjs.org/api/ngMock/type/angular.mock.TzDate - TzDate(offset: number, timestamp: number): Date; - TzDate(offset: number, timestamp: string): Date; + // see https://docs.angularjs.org/api/ngMock/type/angular.mock.TzDate + TzDate(offset: number, timestamp: number): Date; + TzDate(offset: number, timestamp: string): Date; } /////////////////////////////////////////////////////////////////////////// @@ -62,7 +63,7 @@ declare namespace angular { // see https://docs.angularjs.org/api/ngMock/provider/$exceptionHandlerProvider /////////////////////////////////////////////////////////////////////////// interface IExceptionHandlerProvider extends IServiceProvider { - mode(mode: string): void; + mode(mode: string): void; } /////////////////////////////////////////////////////////////////////////// @@ -71,9 +72,9 @@ declare namespace angular { // Augments the original service /////////////////////////////////////////////////////////////////////////// interface ITimeoutService { - flush(delay?: number): void; - flushNext(expectedDelay?: number): void; - verifyNoPendingTasks(): void; + flush(delay?: number): void; + flushNext(expectedDelay?: number): void; + verifyNoPendingTasks(): void; } /////////////////////////////////////////////////////////////////////////// @@ -82,7 +83,7 @@ declare namespace angular { // Augments the original service /////////////////////////////////////////////////////////////////////////// interface IIntervalService { - flush(millis?: number): number; + flush(millis?: number): number; } /////////////////////////////////////////////////////////////////////////// @@ -91,12 +92,12 @@ declare namespace angular { // Augments the original service /////////////////////////////////////////////////////////////////////////// interface ILogService { - assertEmpty(): void; - reset(): void; + assertEmpty(): void; + reset(): void; } interface ILogCall { - logs: string[]; + logs: string[]; } /////////////////////////////////////////////////////////////////////////// @@ -127,212 +128,211 @@ declare namespace angular { // see https://docs.angularjs.org/api/ngMock/service/$httpBackend /////////////////////////////////////////////////////////////////////////// interface IHttpBackendService { - /** - * Flushes all pending requests using the trained responses. - * @param count Number of responses to flush (in the order they arrived). If undefined, all pending requests will be flushed. - */ - flush(count?: number): void; - - /** - * Resets all request expectations, but preserves all backend definitions. - */ - resetExpectations(): void; - - /** - * Verifies that all of the requests defined via the expect api were made. If any of the requests were not made, verifyNoOutstandingExpectation throws an exception. - */ - verifyNoOutstandingExpectation(): void; - - /** - * Verifies that there are no outstanding requests that need to be flushed. - */ - verifyNoOutstandingRequest(): void; - - /** - * Creates a new request expectation. - * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false. - * Returns an object with respond method that controls how a matched request is handled. - * @param method HTTP method. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. - * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. - */ - expect(method: string, url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)) :mock.IRequestHandler; - - /** - * Creates a new request expectation for DELETE requests. - * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false. - * Returns an object with respond method that controls how a matched request is handled. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url is as expected. - * @param headers HTTP headers object to be compared with the HTTP headers in the request. + /** + * Flushes all pending requests using the trained responses. + * @param count Number of responses to flush (in the order they arrived). If undefined, all pending requests will be flushed. */ - expectDELETE(url: string | RegExp | ((url: string) => boolean), headers?: Object): mock.IRequestHandler; + flush(count?: number): void; - /** - * Creates a new request expectation for GET requests. - * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false. - * Returns an object with respond method that controls how a matched request is handled. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - * @param headers HTTP headers object to be compared with the HTTP headers in the request. - */ - expectGET(url: string | RegExp | ((url: string) => boolean), headers?: Object): mock.IRequestHandler; + /** + * Resets all request expectations, but preserves all backend definitions. + */ + resetExpectations(): void; - /** - * Creates a new request expectation for HEAD requests. - * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false. - * Returns an object with respond method that controls how a matched request is handled. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - * @param headers HTTP headers object to be compared with the HTTP headers in the request. - */ - expectHEAD(url: string | RegExp | ((url: string) => boolean), headers?: Object): mock.IRequestHandler; + /** + * Verifies that all of the requests defined via the expect api were made. If any of the requests were not made, verifyNoOutstandingExpectation throws an exception. + */ + verifyNoOutstandingExpectation(): void; - /** - * Creates a new request expectation for JSONP requests. - * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, or if function returns false. - * Returns an object with respond method that controls how a matched request is handled. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - */ - expectJSONP(url: string | RegExp | ((url: string) => boolean)): mock.IRequestHandler; + /** + * Verifies that there are no outstanding requests that need to be flushed. + */ + verifyNoOutstandingRequest(): void; - /** - * Creates a new request expectation for PATCH requests. - * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false. - * Returns an object with respond method that controls how a matched request is handled. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. - * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. - */ - expectPATCH(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object): mock.IRequestHandler; + /** + * Creates a new request expectation. + * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false. + * Returns an object with respond method that controls how a matched request is handled. + * @param method HTTP method. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. + * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. + * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. + */ + expect(method: string, url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler; - /** - * Creates a new request expectation for POST requests. - * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false. - * Returns an object with respond method that controls how a matched request is handled. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. - * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. - */ - expectPOST(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object): mock.IRequestHandler; + /** + * Creates a new request expectation for DELETE requests. + * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false. + * Returns an object with respond method that controls how a matched request is handled. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url is as expected. + * @param headers HTTP headers object to be compared with the HTTP headers in the request. + */ + expectDELETE(url: string | RegExp | ((url: string) => boolean), headers?: Object): mock.IRequestHandler; - /** - * Creates a new request expectation for PUT requests. - * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false. - * Returns an object with respond method that controls how a matched request is handled. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. - * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. - */ - expectPUT(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object): mock.IRequestHandler; + /** + * Creates a new request expectation for GET requests. + * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false. + * Returns an object with respond method that controls how a matched request is handled. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. + * @param headers HTTP headers object to be compared with the HTTP headers in the request. + */ + expectGET(url: string | RegExp | ((url: string) => boolean), headers?: Object): mock.IRequestHandler; - /** - * Creates a new backend definition. - * Returns an object with respond method that controls how a matched request is handled. - * @param method HTTP method. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. - * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. - */ - when(method: string, url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler; + /** + * Creates a new request expectation for HEAD requests. + * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false. + * Returns an object with respond method that controls how a matched request is handled. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. + * @param headers HTTP headers object to be compared with the HTTP headers in the request. + */ + expectHEAD(url: string | RegExp | ((url: string) => boolean), headers?: Object): mock.IRequestHandler; - /** - * Creates a new backend definition for DELETE requests. - * Returns an object with respond method that controls how a matched request is handled. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. - */ - whenDELETE(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler; + /** + * Creates a new request expectation for JSONP requests. + * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, or if function returns false. + * Returns an object with respond method that controls how a matched request is handled. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. + */ + expectJSONP(url: string | RegExp | ((url: string) => boolean)): mock.IRequestHandler; - /** - * Creates a new backend definition for GET requests. - * Returns an object with respond method that controls how a matched request is handled. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. - */ - whenGET(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler; + /** + * Creates a new request expectation for PATCH requests. + * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false. + * Returns an object with respond method that controls how a matched request is handled. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. + * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. + * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. + */ + expectPATCH(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object): mock.IRequestHandler; - /** - * Creates a new backend definition for HEAD requests. - * Returns an object with respond method that controls how a matched request is handled. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. - */ - whenHEAD(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler; + /** + * Creates a new request expectation for POST requests. + * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false. + * Returns an object with respond method that controls how a matched request is handled. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. + * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. + * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. + */ + expectPOST(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object): mock.IRequestHandler; - /** - * Creates a new backend definition for JSONP requests. - * Returns an object with respond method that controls how a matched request is handled. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. - */ - whenJSONP(url: string | RegExp | ((url: string) => boolean)): mock.IRequestHandler; + /** + * Creates a new request expectation for PUT requests. + * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false. + * Returns an object with respond method that controls how a matched request is handled. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. + * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. + * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. + */ + expectPUT(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object): mock.IRequestHandler; - /** - * Creates a new backend definition for PATCH requests. - * Returns an object with respond method that controls how a matched request is handled. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. - * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. - */ - whenPATCH(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler; + /** + * Creates a new backend definition. + * Returns an object with respond method that controls how a matched request is handled. + * @param method HTTP method. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. + * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. + * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. + */ + when(method: string, url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler; - /** - * Creates a new backend definition for POST requests. - * Returns an object with respond method that controls how a matched request is handled. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. - * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. - */ - whenPOST(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler; + /** + * Creates a new backend definition for DELETE requests. + * Returns an object with respond method that controls how a matched request is handled. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. + * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. + */ + whenDELETE(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler; - /** - * Creates a new backend definition for PUT requests. - * Returns an object with respond method that controls how a matched request is handled. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. - * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. - */ - whenPUT(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler; + /** + * Creates a new backend definition for GET requests. + * Returns an object with respond method that controls how a matched request is handled. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. + * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. + */ + whenGET(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler; + + /** + * Creates a new backend definition for HEAD requests. + * Returns an object with respond method that controls how a matched request is handled. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. + * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. + */ + whenHEAD(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler; + + /** + * Creates a new backend definition for JSONP requests. + * Returns an object with respond method that controls how a matched request is handled. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. + * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. + */ + whenJSONP(url: string | RegExp | ((url: string) => boolean)): mock.IRequestHandler; + + /** + * Creates a new backend definition for PATCH requests. + * Returns an object with respond method that controls how a matched request is handled. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. + * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. + * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. + */ + whenPATCH(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler; + + /** + * Creates a new backend definition for POST requests. + * Returns an object with respond method that controls how a matched request is handled. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. + * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. + * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. + */ + whenPOST(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler; + + /** + * Creates a new backend definition for PUT requests. + * Returns an object with respond method that controls how a matched request is handled. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. + * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. + * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. + */ + whenPUT(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler; } export module mock { - // returned interface by the the mocked HttpBackendService expect/when methods - interface IRequestHandler { + // returned interface by the the mocked HttpBackendService expect/when methods + interface IRequestHandler { - /** - * Controls the response for a matched request using a function to construct the response. - * Returns the RequestHandler object for possible overrides. - * @param func Function that receives the request HTTP method, url, data, and headers and returns an array containing response status (number), data, headers, and status text. - */ - respond(func: ((method: string, url: string, data: string | Object, headers: Object) => [number, string | Object, Object, string])): IRequestHandler; + /** + * Controls the response for a matched request using a function to construct the response. + * Returns the RequestHandler object for possible overrides. + * @param func Function that receives the request HTTP method, url, data, and headers and returns an array containing response status (number), data, headers, and status text. + */ + respond(func: ((method: string, url: string, data: string | Object, headers: Object) => [number, string | Object, Object, string])): IRequestHandler; - /** - * Controls the response for a matched request using supplied static data to construct the response. - * Returns the RequestHandler object for possible overrides. - * @param status HTTP status code to add to the response. - * @param data Data to add to the response. - * @param headers Headers object to add to the response. - * @param responseText Response text to add to the response. - */ - respond(status: number, data: string | Object, headers?: Object, responseText?: string): IRequestHandler; + /** + * Controls the response for a matched request using supplied static data to construct the response. + * Returns the RequestHandler object for possible overrides. + * @param status HTTP status code to add to the response. + * @param data Data to add to the response. + * @param headers Headers object to add to the response. + * @param responseText Response text to add to the response. + */ + respond(status: number, data: string | Object, headers?: Object, responseText?: string): IRequestHandler; - /** - * Controls the response for a matched request using the HTTP status code 200 and supplied static data to construct the response. - * Returns the RequestHandler object for possible overrides. - * @param data Data to add to the response. - * @param headers Headers object to add to the response. - * @param responseText Response text to add to the response. - */ - respond(data: string | Object, headers?: Object, responseText?: string): IRequestHandler; + /** + * Controls the response for a matched request using the HTTP status code 200 and supplied static data to construct the response. + * Returns the RequestHandler object for possible overrides. + * @param data Data to add to the response. + * @param headers Headers object to add to the response. + * @param responseText Response text to add to the response. + */ + respond(data: string | Object, headers?: Object, responseText?: string): IRequestHandler; - // Available when ngMockE2E is loaded - /** - * Any request matching a backend definition or expectation with passThrough handler will be passed through to the real backend (an XHR request will be made to the server.) - */ - passThrough(): IRequestHandler; - } + // Available when ngMockE2E is loaded + /** + * Any request matching a backend definition or expectation with passThrough handler will be passed through to the real backend (an XHR request will be made to the server.) + */ + passThrough(): IRequestHandler; + } } - } /////////////////////////////////////////////////////////////////////////////// diff --git a/atom-keymap/index.d.ts b/atom-keymap/index.d.ts index 0b425c83d9..c066867a5b 100644 --- a/atom-keymap/index.d.ts +++ b/atom-keymap/index.d.ts @@ -5,6 +5,8 @@ /// +import * as AtomEventKit from 'event-kit'; + export = AtomKeymap; declare namespace AtomKeymap { diff --git a/base-x/index.d.ts b/base-x/index.d.ts index 19af3aa993..bbad200ce1 100644 --- a/base-x/index.d.ts +++ b/base-x/index.d.ts @@ -3,8 +3,8 @@ // Definitions by: Ilya Mochalov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare var base: BaseX.Base; -export = base; +declare var BaseX: BaseX.Base; +export = BaseX; declare namespace BaseX { interface EncodeBuffer { diff --git a/bs58/index.d.ts b/bs58/index.d.ts index dcc0735e08..1539910e12 100644 --- a/bs58/index.d.ts +++ b/bs58/index.d.ts @@ -5,6 +5,7 @@ /// +import * as BaseX from 'base-x'; declare namespace base58 { } diff --git a/cropperjs/index.d.ts b/cropperjs/index.d.ts index 0759f97732..e0d08f9571 100644 --- a/cropperjs/index.d.ts +++ b/cropperjs/index.d.ts @@ -3,12 +3,7 @@ // Definitions by: Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare const Cropper: typeof cropperjs.Cropper; -export = Cropper; -export as namespace Cropper; - -declare module cropperjs { +declare namespace cropperjs { export enum CropperViewMods { CropBoxIsJustWithInTheContainer = 0, CropBoxShouldBeWithInTheCanvas = 1, @@ -315,138 +310,142 @@ declare module cropperjs { */ fillColor?: string; } - export class Cropper { - constructor(element: HTMLImageElement, options: CropperOptions); - /** - * Show the crop box manually. - */ - crop(): void; - - /** - * Clear the crop box. - */ - reset(): void; - - /** - * Replace the image's src and rebuild the cropper. - * @param url A new image url - */ - replace(url: string): void; - - /** - * Enable (unfreeze) the cropper. - */ - enable(): void; - - /** - * Disable (freeze) the cropper - */ - disable(): void; - - /** - * Destroy the cropper and remove the instance from the image. - */ - destroy(): void; - - /** - * Move the canvas (image wrapper) with relative offsets. - * @param offsetX Moving size (px) in the horizontal direction. - * @param offsetY Moving size (px) in the vertical direction. - * If not present, its default value is offsetX. - */ - move(offsetX: number, offsetY?: number): void; - - /** - * Move the canvas (image wrapper) to an absolute point. - * @param x The left value of the canvas - * @param y The top value of the canvas - * If not present, its default value is x. - */ - moveTo(x: number, y?: number): void; - - /** - * Zoom the canvas (image wrapper) with a relative ratio. - * Zoom in: requires a positive number (ratio > 0) - * Zoom out: requires a negative number (ratio < 0) - */ - zoom(ratio: number): void; - - /** - * Rotate the canvas (image wrapper) with a relative degree. - * Rotate right: requires a positive number (degree > 0) - * Rotate left: requires a negative number (degree < 0) - */ - rotate(degree: number): void; - - /** - * Clear the crop box. - */ - clear(): void; - - /** - * Output the cropped area position and size data (base on the original image). - */ - getData(rounded?: boolean): Data; - - /** - * Change the cropped area position and size with new data (base on the original image). - */ - setData(data: Data): void; - - /** - * Output the container size data. - */ - getContainerData(): ContainerData; - - /** - * Output the image position, size and other related data. - */ - getImageData(): ImageData; - - /** - * Output the canvas (image wrapper) position and size data. - */ - getCanvasData(): CanvasData & { - /** - * the natural width of the canvas (read only) - */ - naturalWidth: number; - /** - * the natural height of the canvas (read only) - */ - naturalHeight: number; - }; - - /** - * Change the canvas (image wrapper) position and size with new data. - */ - setCanvasData(data: CanvasData): void; - - /** - * Output the crop box position and size data. - */ - getCropBoxData(): CropBoxData; - - /** - * Change the crop box position and size with new data. - */ - setCropBoxData(data: CropBoxData): void; - - /** - * Get a canvas drawn the cropped image. - */ - getCroppedCanvas(options?: CroppedCanvasOptions): HTMLCanvasElement; - - /** - * Change the aspect ratio of the crop box. - */ - setAspectRatio(aspectRatio: number): void; - - /** - * Change the drag mode. - */ - setDragMode(mode?: 'none' | 'crop' | 'move'): void; - - } } +declare class cropperjs { + constructor(element: HTMLImageElement, options: cropperjs.CropperOptions); + /** + * Show the crop box manually. + */ + crop(): void; + + /** + * Clear the crop box. + */ + reset(): void; + + /** + * Replace the image's src and rebuild the cropper. + * @param url A new image url + */ + replace(url: string): void; + + /** + * Enable (unfreeze) the cropper. + */ + enable(): void; + + /** + * Disable (freeze) the cropper + */ + disable(): void; + + /** + * Destroy the cropper and remove the instance from the image. + */ + destroy(): void; + + /** + * Move the canvas (image wrapper) with relative offsets. + * @param offsetX Moving size (px) in the horizontal direction. + * @param offsetY Moving size (px) in the vertical direction. + * If not present, its default value is offsetX. + */ + move(offsetX: number, offsetY?: number): void; + + /** + * Move the canvas (image wrapper) to an absolute point. + * @param x The left value of the canvas + * @param y The top value of the canvas + * If not present, its default value is x. + */ + moveTo(x: number, y?: number): void; + + /** + * Zoom the canvas (image wrapper) with a relative ratio. + * Zoom in: requires a positive number (ratio > 0) + * Zoom out: requires a negative number (ratio < 0) + */ + zoom(ratio: number): void; + + /** + * Rotate the canvas (image wrapper) with a relative degree. + * Rotate right: requires a positive number (degree > 0) + * Rotate left: requires a negative number (degree < 0) + */ + rotate(degree: number): void; + + /** + * Clear the crop box. + */ + clear(): void; + + /** + * Output the cropped area position and size data (base on the original image). + */ + getData(rounded?: boolean): cropperjs.Data; + + /** + * Change the cropped area position and size with new data (base on the original image). + */ + setData(data: cropperjs.Data): void; + + /** + * Output the container size data. + */ + getContainerData(): cropperjs.ContainerData; + + /** + * Output the image position, size and other related data. + */ + getImageData(): cropperjs.ImageData; + + /** + * Output the canvas (image wrapper) position and size data. + */ + getCanvasData(): cropperjs.CanvasData & { + /** + * the natural width of the canvas (read only) + */ + naturalWidth: number; + /** + * the natural height of the canvas (read only) + */ + naturalHeight: number; + }; + + /** + * Change the canvas (image wrapper) position and size with new data. + */ + setCanvasData(data: cropperjs.CanvasData): void; + + /** + * Output the crop box position and size data. + */ + getCropBoxData(): cropperjs.CropBoxData; + + /** + * Change the crop box position and size with new data. + */ + setCropBoxData(data: cropperjs.CropBoxData): void; + + /** + * Get a canvas drawn the cropped image. + */ + getCroppedCanvas(options?: cropperjs.CroppedCanvasOptions): HTMLCanvasElement; + + /** + * Change the aspect ratio of the crop box. + */ + setAspectRatio(aspectRatio: number): void; + + /** + * Change the drag mode. + */ + setDragMode(mode?: 'none' | 'crop' | 'move'): void; + +} + +export = cropperjs; +export as namespace Cropper; + diff --git a/crossroads/crossroads-tests.ts b/crossroads/crossroads-tests.ts index 3004d851cc..aa25187bf5 100644 --- a/crossroads/crossroads-tests.ts +++ b/crossroads/crossroads-tests.ts @@ -1,4 +1,4 @@ - +import crossroads = require('crossroads'); //String rule with param: //match '/news/123' passing "123" as param to handler diff --git a/crossroads/index.d.ts b/crossroads/index.d.ts index f0da2a56b6..42a631599e 100644 --- a/crossroads/index.d.ts +++ b/crossroads/index.d.ts @@ -5,15 +5,17 @@ /// +import * as signal from 'signals'; + declare namespace CrossroadsJs { export interface Route { - matched: Signal; + matched: signal.Signal; /** * Signal dispatched every time a request "leaves" the route. */ - switched: Signal; + switched: signal.Signal; /** * Object used to configure parameters/segments validation rules. @@ -47,7 +49,7 @@ declare namespace CrossroadsJs { * @param listenercontext Context on which listener will be executed (object that should represent the `this` variable inside listener function). * @param priority The priority level of the event listener. Listeners with higher priority will be executed before listeners with lower priority. Listeners with same priority level will be executed at the same order as they were added. (default = 0) */ - add(listener: Function, listenerContext?: any, priority?: Number): SignalBinding; + add(listener: Function, listenerContext?: any, priority?: Number): signal.SignalBinding; } export interface CrossRoadsStatic { @@ -93,12 +95,12 @@ declare namespace CrossroadsJs { /** * Signal dispatched every time that crossroads.parse can't find a Route that matches the request. Useful for debuging and error handling. */ - bypassed: Signal; + bypassed: signal.Signal; /** * Signal dispatched every time that crossroads.parse find a Route that matches the request. Useful for debuging and for executing tasks that should happen at each routing. */ - routed: Signal; + routed: signal.Signal; /** * Create a new independent Router instance. @@ -153,7 +155,5 @@ declare namespace CrossroadsJs { } declare var crossroads: CrossroadsJs.CrossRoadsStatic; - -declare module 'crossroads'{ - export = crossroads; -} +export = crossroads; +export as namespace crossroads; diff --git a/emissary/index.d.ts b/emissary/index.d.ts index fc9ee6e38d..e8de4ff94a 100644 --- a/emissary/index.d.ts +++ b/emissary/index.d.ts @@ -5,56 +5,57 @@ /// -declare namespace Emissary { - interface IEmitterStatic extends Mixto.IMixinStatic { - new ():IEmitter; - } +export as namespace Emissary; - interface IEmitter { - on(eventNames:string, handler:Function):any; // return value type are Signal - once(eventName:string, handler:Function):any; // return value type are Signal - signal(eventName:string):void; - behavior(eventName:string, initialValue:any):void; - emit(eventName:string, ...args:any[]):void; - off(eventNames:string, handler:Function):void; - pauseEvents(eventNames:string):void; - resumeEvents(eventNames:string):void; - incrementSubscriptionCount(eventName:string):number; - decrementSubscriptionCount(eventName:string):number; - getSubscriptionCount(eventName:string):number; - hasSubscriptions(eventName:string):boolean; - } +export interface IEmitterStatic extends Mixto.IMixinStatic { + new ():IEmitter; +} - interface ISubscriberStatic extends Mixto.IMixinStatic { - new ():ISubscriber; - } +export interface IEmitter { + on(eventNames:string, handler:Function):any; // return value type are Signal + once(eventName:string, handler:Function):any; // return value type are Signal + signal(eventName:string):void; + behavior(eventName:string, initialValue:any):void; + emit(eventName:string, ...args:any[]):void; + off(eventNames:string, handler:Function):void; + pauseEvents(eventNames:string):void; + resumeEvents(eventNames:string):void; + incrementSubscriptionCount(eventName:string):number; + decrementSubscriptionCount(eventName:string):number; + getSubscriptionCount(eventName:string):number; + hasSubscriptions(eventName:string):boolean; +} - interface ISubscriber { - subscribeWith(eventEmitter:any, methodName:string, args:any):ISubscription; +export interface ISubscriberStatic extends Mixto.IMixinStatic { + new ():ISubscriber; +} - addSubscription(subscription:any):ISubscription; +export interface ISubscriber { + subscribeWith(eventEmitter:any, methodName:string, args:any):ISubscription; - subscribe(eventEmitterOrSubscription:any, ...args:any[]):ISubscription; + addSubscription(subscription:any):ISubscription; - subscribeToCommand(eventEmitter:any, ...args:any[]):ISubscription; + subscribe(eventEmitterOrSubscription:any, ...args:any[]):ISubscription; - unsubscribe(object?:any):any; - } + subscribeToCommand(eventEmitter:any, ...args:any[]):ISubscription; - interface ISubscriptionStatic { - new (emitter: any, eventNames:string, handler:Function):ISubscription; - } + unsubscribe(object?:any):any; +} - interface ISubscription extends IEmitter { - cancelled:boolean; +export interface ISubscriptionStatic { + new (emitter: any, eventNames:string, handler:Function):ISubscription; +} - off():any; - } +export interface ISubscription extends IEmitter { + cancelled:boolean; + + off():any; } -export var Emitter:Emissary.IEmitterStatic; -export var Subscriber:Emissary.ISubscriberStatic; + +export var Emitter:IEmitterStatic; +export var Subscriber:ISubscriberStatic; export var Signal:Function; // TODO export var Behavior:Function; // TODO export var combine:Function; // TODO diff --git a/eventemitter3/index.d.ts b/eventemitter3/index.d.ts index 63e1cd12e1..31ede80c21 100644 --- a/eventemitter3/index.d.ts +++ b/eventemitter3/index.d.ts @@ -3,119 +3,121 @@ // Definitions by: Yuichi Murata , Leon Yu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// -// Expose the module. -// -declare var event_emitter3: EventEmitter3.EventEmitter3Static; -export = event_emitter3; +export = EventEmitter; -declare namespace EventEmitter3 { - interface EventEmitter3Static { +declare namespace EventEmitter { + type EventEmitter = self; +} + +type self = EventEmitter; +declare class EventEmitter { + static prefixed: string | boolean; + + static EventEmitter: { new (): EventEmitter; prefixed: string | boolean; - } - class EventEmitter { - /** - * Minimal EventEmitter interface that is molded against the Node.js - * EventEmitter interface. - * - * @constructor - * @api public - */ - constructor(); + }; - /** - * Return a list of assigned event listeners. - * - * @param {String} event The events that should be listed. - * @returns {Array} - * @api public - */ - listeners(event?: string): Function[]; + /** + * Minimal EventEmitter interface that is molded against the Node.js + * EventEmitter interface. + * + * @constructor + * @api public + */ + constructor(); - /** - * Return a list of assigned event listeners. - * - * @param {String} event The events that should be listed. - * @param {Boolean} exists We only need to know if there are listeners. - * @returns {Boolean} - * @api public - */ - listeners(event: string, param: boolean): boolean; + /** + * Return a list of assigned event listeners. + * + * @param {String} event The events that should be listed. + * @returns {Array} + * @api public + */ + listeners(event?: string): Function[]; - /** - * Emit an event to all registered event listeners. - * - * @param {String} event The name of the event. - * @returns {Boolean} Indication if we've emitted an event. - * @api public - */ - emit(event: string, ...args: any[]): boolean; + /** + * Return a list of assigned event listeners. + * + * @param {String} event The events that should be listed. + * @param {Boolean} exists We only need to know if there are listeners. + * @returns {Boolean} + * @api public + */ + listeners(event: string, param: boolean): boolean; - /** - * Register a new EventListener for the given event. - * - * @param {String} event Name of the event. - * @param {Function} fn Callback function. - * @param {Mixed} [context=this] The context of the function. - * @api public - */ - on(event: string, fn: Function, context?: any): EventEmitter; + /** + * Emit an event to all registered event listeners. + * + * @param {String} event The name of the event. + * @returns {Boolean} Indication if we've emitted an event. + * @api public + */ + emit(event: string, ...args: any[]): boolean; - /** - * Add an EventListener that's only called once. - * - * @param {String} event Name of the event. - * @param {Function} fn Callback function. - * @param {Mixed} [context=this] The context of the function. - * @api public - */ - once(event: string, fn: Function, context?: any): EventEmitter; + /** + * Register a new EventListener for the given event. + * + * @param {String} event Name of the event. + * @param {Function} fn Callback function. + * @param {Mixed} [context=this] The context of the function. + * @api public + */ + on(event: string, fn: Function, context?: any): EventEmitter; - /** - * Remove event listeners. - * - * @param {String} event The event we want to remove. - * @param {Function} fn The listener that we need to find. - * @param {Mixed} context Only remove listeners matching this context. - * @param {Boolean} once Only remove once listeners. - * @api public - */ - removeListener(event: string, fn?: Function, context?: any, once?: boolean): EventEmitter; + /** + * Add an EventListener that's only called once. + * + * @param {String} event Name of the event. + * @param {Function} fn Callback function. + * @param {Mixed} [context=this] The context of the function. + * @api public + */ + once(event: string, fn: Function, context?: any): EventEmitter; - /** - * Remove all listeners or only the listeners for the specified event. - * - * @param {String} event The event want to remove all listeners for. - * @api public - */ - removeAllListeners(event?: string): EventEmitter; + /** + * Remove event listeners. + * + * @param {String} event The event we want to remove. + * @param {Function} fn The listener that we need to find. + * @param {Mixed} context Only remove listeners matching this context. + * @param {Boolean} once Only remove once listeners. + * @api public + */ + removeListener(event: string, fn?: Function, context?: any, once?: boolean): EventEmitter; - /** - * Remove event listeners. - * - * @param {String} event The event we want to remove. - * @param {Function} fn The listener that we need to find. - * @param {Mixed} context Only remove listeners matching this context. - * @param {Boolean} once Only remove once listeners. - * @api public - */ - off(event: string, fn?: Function, context?: any, once?: boolean): EventEmitter; + /** + * Remove all listeners or only the listeners for the specified event. + * + * @param {String} event The event want to remove all listeners for. + * @api public + */ + removeAllListeners(event?: string): EventEmitter; - /** - * Register a new EventListener for the given event. - * - * @param {String} event Name of the event. - * @param {Function} fn Callback function. - * @param {Mixed} [context=this] The context of the function. - * @api public - */ - addListener(event: string, fn: Function, context?: any): EventEmitter; + /** + * Remove event listeners. + * + * @param {String} event The event we want to remove. + * @param {Function} fn The listener that we need to find. + * @param {Mixed} context Only remove listeners matching this context. + * @param {Boolean} once Only remove once listeners. + * @api public + */ + off(event: string, fn?: Function, context?: any, once?: boolean): EventEmitter; - /** - * This function doesn't apply anymore. - * @deprecated - */ - setMaxListeners(): EventEmitter; - } + /** + * Register a new EventListener for the given event. + * + * @param {String} event Name of the event. + * @param {Function} fn Callback function. + * @param {Mixed} [context=this] The context of the function. + * @api public + */ + addListener(event: string, fn: Function, context?: any): EventEmitter; + + /** + * This function doesn't apply anymore. + * @deprecated + */ + setMaxListeners(): EventEmitter; } diff --git a/falcor-http-datasource/index.d.ts b/falcor-http-datasource/index.d.ts index 9465b31e70..c2104cbce4 100644 --- a/falcor-http-datasource/index.d.ts +++ b/falcor-http-datasource/index.d.ts @@ -5,6 +5,8 @@ /// +import * as FalcorModel from 'falcor'; + declare namespace FalcorHttpDataSource { /** @@ -15,9 +17,7 @@ declare namespace FalcorHttpDataSource { } } -declare module 'falcor-http-datasource' { - import XMlHttpSource = FalcorHttpDataSource.XMlHttpSource; - export {XMlHttpSource}; - export default XMlHttpSource; -} +import XMlHttpSource = FalcorHttpDataSource.XMlHttpSource; +export {XMlHttpSource}; +export default XMlHttpSource; diff --git a/falcor-router/falcor-router-tests.ts b/falcor-router/falcor-router-tests.ts index fd2ffa7da1..5f5bdca0e4 100644 --- a/falcor-router/falcor-router-tests.ts +++ b/falcor-router/falcor-router-tests.ts @@ -69,7 +69,7 @@ new Router([{ new Router([{ route: 'todos[{integers:indicies}]', - get(pathset: FalcorRouter.RoutePathSet & {indicies: number[]}) { + get(pathset: Router.RoutePathSet & {indicies: number[]}) { return pathset.indicies.map(idx => { const id = 'id' + idx; return { diff --git a/falcor-router/index.d.ts b/falcor-router/index.d.ts index b645901c42..659f45767f 100644 --- a/falcor-router/index.d.ts +++ b/falcor-router/index.d.ts @@ -4,24 +4,26 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped /// +import * as FalcorModel from 'falcor'; +import * as FalcorJsonGraph from 'falcor-json-graph'; +import DataSource = FalcorModel.DataSource; + +declare class FalcorRouter extends DataSource { + + constructor(routes: Array, options?: FalcorRouter.RouterOptions); + + /** + * When a route misses on a call, get, or set the unhandledDataSource will + * have a chance to fulfill that request. + **/ + routeUnhandledPathsTo(dataSource: DataSource): void; + + static createClass(routes?: Array): typeof FalcorRouter.CreatedRouter; +} + declare namespace FalcorRouter { - import DataSource = FalcorModel.DataSource; - - class Router extends DataSource { - - constructor(routes: Array, options?: RouterOptions); - - /** - * When a route misses on a call, get, or set the unhandledDataSource will - * have a chance to fulfill that request. - **/ - routeUnhandledPathsTo(dataSource: DataSource): void; - - static createClass(routes?: Array): typeof CreatedRouter; - } - - class CreatedRouter extends Router { + class CreatedRouter extends FalcorRouter { constructor(options?: RouterOptions); } @@ -53,7 +55,5 @@ declare namespace FalcorRouter { } } -declare module 'falcor-router' { - export = FalcorRouter.Router; -} +export = FalcorRouter; diff --git a/falcor/index.d.ts b/falcor/index.d.ts index 519c643fd4..32ba62fd4f 100644 --- a/falcor/index.d.ts +++ b/falcor/index.d.ts @@ -5,6 +5,8 @@ /// +import * as FalcorJsonGraph from 'falcor-json-graph'; + export = FalcorModel; export as namespace falcor; diff --git a/fluxxor/index.d.ts b/fluxxor/index.d.ts index 658e4878b9..8205f9ad03 100644 --- a/fluxxor/index.d.ts +++ b/fluxxor/index.d.ts @@ -6,6 +6,8 @@ /// /// +import * as EventEmitter3 from 'eventemitter3'; + declare namespace Fluxxor { class Dispatcher { constructor(stores: any); @@ -65,6 +67,5 @@ declare namespace Fluxxor { var version: string; } -declare module 'fluxxor' { - export = Fluxxor; -} +export = Fluxxor; +export as namespace Fluxxor; diff --git a/hasher/index.d.ts b/hasher/index.d.ts index e2eff2514b..b71b6b1d2b 100644 --- a/hasher/index.d.ts +++ b/hasher/index.d.ts @@ -5,6 +5,8 @@ /// +import * as signal from 'signals'; + declare namespace HasherJs { export interface HasherStatic { @@ -18,11 +20,11 @@ declare namespace HasherJs { // avoid conflicts with elements that contain ID equal to hash value; // {signals.Signal} hasher.changed // Signal dispatched when hash value changes. - pass current hash as 1st parameter to listeners and previous hash value as 2nd parameter. - changed: Signal; + changed: signal.Signal; // {signals.Signal} hasher.initialized // Signal dispatched when hasher is initialized. - pass current hash as first parameter to listeners. - initialized: Signal; + initialized: signal.Signal; // {string} hasher.prependHash // String that should always be added to the beginning of Hash value. @@ -38,7 +40,7 @@ declare namespace HasherJs { // default value: '/'; // {signals.Signal} hasher.stopped // Signal dispatched when hasher is stopped. - pass current hash as first parameter to listeners - stopped: Signal; + stopped: signal.Signal; // {string} hasher.VERSION // hasher Version Number @@ -110,7 +112,5 @@ declare namespace HasherJs { declare var hasher: HasherJs.HasherStatic; -// AMD -declare module 'hasher'{ - export = hasher; -} +export = hasher; +export as namespace hasher; diff --git a/i18next-express-middleware/index.d.ts b/i18next-express-middleware/index.d.ts index e02fed221e..05328ffadc 100644 --- a/i18next-express-middleware/index.d.ts +++ b/i18next-express-middleware/index.d.ts @@ -96,8 +96,8 @@ declare module "i18next-express-middleware" { init(services: any, options?: Object, allOptions?: Object): void; } - export function getResourcesHandler(i18next: I18next.I18n, options: Object): express.Handler; - export function handle(i18next: I18next.I18n, options?: Object): express.Handler; + export function getResourcesHandler(i18next: i18next.I18n, options: Object): express.Handler; + export function handle(i18next: i18next.I18n, options?: Object): express.Handler; /** * @summary Gets handler for missing key. @@ -105,5 +105,5 @@ declare module "i18next-express-middleware" { * @param {Object} options The options. * @return {express.Handler} The express handler. */ - export function missingKeyHandler(i18next: I18next.I18n, options: Object): express.Handler; + export function missingKeyHandler(i18next: i18next.I18n, options: Object): express.Handler; } diff --git a/i18next/index.d.ts b/i18next/index.d.ts index 674911fc27..451243d82c 100644 --- a/i18next/index.d.ts +++ b/i18next/index.d.ts @@ -6,7 +6,7 @@ // Sources: https://github.com/i18next/i18next/ -declare namespace I18n { +declare namespace i18n { interface ResourceStore { [language: string]: ResourceStoreLanguage; } @@ -87,8 +87,8 @@ declare namespace I18n { type TranslationFunction = (key:string, options?:TranslationOptions) => string; - class I18n { - constructor(options?:Options, callback?:(err:any, t:TranslationFunction) => void); + interface I18n { + //constructor(options?:Options, callback?:(err:any, t:TranslationFunction) => void); init(options?:Options, callback?:(err:any, t:TranslationFunction) => void):I18n; @@ -118,6 +118,6 @@ declare namespace I18n { } } -declare var i18n:I18n.I18n; +declare var i18n:i18n.I18n; export = i18n; diff --git a/js-data-angular/index.d.ts b/js-data-angular/index.d.ts index 51d3195900..3684f2635e 100644 --- a/js-data-angular/index.d.ts +++ b/js-data-angular/index.d.ts @@ -6,7 +6,9 @@ /// /// -declare namespace JSData { +import * as JSData from 'js-data'; + +declare module 'js-data' { interface DSProvider { defaults:DSConfiguration; diff --git a/js-data-angular/js-data-angular-tests.ts b/js-data-angular/js-data-angular-tests.ts index ffb5aed8c4..4e0293f4a1 100644 --- a/js-data-angular/js-data-angular-tests.ts +++ b/js-data-angular/js-data-angular-tests.ts @@ -1,4 +1,4 @@ - +import * as JSData from 'js-data'; interface IUser { diff --git a/js-data-http/index.d.ts b/js-data-http/index.d.ts index 5c51b1ec65..5729a6dba3 100644 --- a/js-data-http/index.d.ts +++ b/js-data-http/index.d.ts @@ -5,7 +5,9 @@ /// -declare namespace JSData { +import * as JSData from 'js-data'; + +declare module 'js-data' { interface DSHttpAdapterOptions { serialize?: (resourceName:string, data:any)=>any; @@ -38,7 +40,5 @@ declare namespace JSData { } declare var DSHttpAdapter:JSData.DSHttpAdapter; - -declare module 'js-data-http' { - export = DSHttpAdapter; -} +export = DSHttpAdapter; +export as namespace DSHttpAdapter; \ No newline at end of file diff --git a/js-data-http/js-data-http-tests.ts b/js-data-http/js-data-http-tests.ts index 97a0fc9b03..9f725b2776 100644 --- a/js-data-http/js-data-http-tests.ts +++ b/js-data-http/js-data-http-tests.ts @@ -1,4 +1,5 @@ - +import * as JSData from 'js-data'; +import DSHttpAdapter = require("js-data-http"); var adapter = new DSHttpAdapter(); var store = new JSData.DS(); diff --git a/js-data/index.d.ts b/js-data/index.d.ts index da87e81ccc..5668f6ef56 100644 --- a/js-data/index.d.ts +++ b/js-data/index.d.ts @@ -344,7 +344,4 @@ declare var JSData:{ DSErrors: JSData.DSErrors; }; -//Support node require -declare module 'js-data' { - export = JSData; -} +export = JSData; diff --git a/js-data/js-data-tests.ts b/js-data/js-data-tests.ts index 596e0077df..48b3bb350a 100644 --- a/js-data/js-data-tests.ts +++ b/js-data/js-data-tests.ts @@ -505,7 +505,7 @@ interface MyResourceDefinition { } -namespace JSData { +namespace MyJSData { interface DS { diff --git a/ng-facebook/index.d.ts b/ng-facebook/index.d.ts index be446def31..89ed08a7ff 100644 --- a/ng-facebook/index.d.ts +++ b/ng-facebook/index.d.ts @@ -6,41 +6,45 @@ /// /// -declare namespace angular.ngFacebook { - interface IFacebookProvider { - setAppId(appId: string): IFacebookProvider; - getAppId(): string; +import * as angular from 'angularjs'; - setVersion(version: string): IFacebookProvider; - getVersion(): string; +declare module 'angularjs' { + export namespace ngFacebook { + interface IFacebookProvider { + setAppId(appId: string): IFacebookProvider; + getAppId(): string; - setPermissions(permissions: string|Array): IFacebookProvider; - getPermissions(): string; + setVersion(version: string): IFacebookProvider; + getVersion(): string; - setCustomInit(customInit: FBInitParams): IFacebookProvider; - getCustomInit(): FBInitParams; - } + setPermissions(permissions: string | Array): IFacebookProvider; + getPermissions(): string; - interface IFacebookService { - config(property: string): T; - init(): void; + setCustomInit(customInit: FBInitParams): IFacebookProvider; + getCustomInit(): FBInitParams; + } - setCache(attr: string, val: T): void; - getCache(attr: string): T; - clearCache(): void; + interface IFacebookService { + config(property: string): T; + init(): void; - isConnected(): boolean; - getAuthResponse(): {}; - getLoginStatus(force?: boolean): angular.IPromise<{}>; - login(permissions?: string, rerequest?: boolean): angular.IPromise<{}>; - logout(): angular.IPromise; + setCache(attr: string, val: T): void; + getCache(attr: string): T; + clearCache(): void; - ui(params: FBUIParams): angular.IPromise; - api(path: string): angular.IPromise<{}>; - api(path: string, method: string): angular.IPromise<{}>; - api(path: string, params: Object): angular.IPromise<{}>; - api(path: string, method: string, params: Object): angular.IPromise<{}>; + isConnected(): boolean; + getAuthResponse(): {}; + getLoginStatus(force?: boolean): angular.IPromise<{}>; + login(permissions?: string, rerequest?: boolean): angular.IPromise<{}>; + logout(): angular.IPromise; - cachedApi(path: string): angular.IPromise; + ui(params: FBUIParams): angular.IPromise; + api(path: string): angular.IPromise<{}>; + api(path: string, method: string): angular.IPromise<{}>; + api(path: string, params: Object): angular.IPromise<{}>; + api(path: string, method: string, params: Object): angular.IPromise<{}>; + + cachedApi(path: string): angular.IPromise; + } } } diff --git a/ng-flow/index.d.ts b/ng-flow/index.d.ts index 0e960ab511..8962f43ac0 100644 --- a/ng-flow/index.d.ts +++ b/ng-flow/index.d.ts @@ -5,8 +5,12 @@ /// /// -declare namespace angular.flow { - interface IFlowFactory { - create(options?: flowjs.IFlowOptions): flowjs.IFlow; - } +import * as angular from 'angularjs'; + +declare module 'angularjs' { + export namespace flow { + interface IFlowFactory { + create(options?: flowjs.IFlowOptions): flowjs.IFlow; + } + } } diff --git a/ngprogress-lite/index.d.ts b/ngprogress-lite/index.d.ts index 8faf3c2368..a141b9d61a 100644 --- a/ngprogress-lite/index.d.ts +++ b/ngprogress-lite/index.d.ts @@ -3,26 +3,30 @@ // Definitions by: Luke Forder // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare namespace angular.progressLite { +import * as angular from 'angularjs'; - export interface INgProgressLite { - set(num: number): INgProgressLite; - get(): number; - start(): INgProgressLite; - inc(amount?: number): INgProgressLite; - done(): void; - } +declare module 'angularjs' { + export namespace progressLite { - export interface IConfigurationOptions { - minimum: number; - speed: number; - ease: string; - trickleRate: number; - trickleSpeed: number; - template: string; - } + export interface INgProgressLite { + set(num: number): INgProgressLite; + get(): number; + start(): INgProgressLite; + inc(amount?: number): INgProgressLite; + done(): void; + } - export interface INgProgressLiteProvider { - settings: IConfigurationOptions; + export interface IConfigurationOptions { + minimum: number; + speed: number; + ease: string; + trickleRate: number; + trickleSpeed: number; + template: string; + } + + export interface INgProgressLiteProvider { + settings: IConfigurationOptions; + } } } diff --git a/ngstorage/index.d.ts b/ngstorage/index.d.ts index 94184296b3..450ec4a2b1 100644 --- a/ngstorage/index.d.ts +++ b/ngstorage/index.d.ts @@ -3,25 +3,28 @@ // Definitions by: Jakub Pistek // Definitions: https://github.com/kubiq/DefinitelyTyped +import * as angular from 'angularjs'; -declare namespace angular.storage { +declare module 'angularjs' { + export namespace storage { - export interface IStorageService { - $default(items: {}): IStorageService; - $reset(items?: {}): IStorageService; - $apply(): void; + export interface IStorageService { + $default(items: {}): IStorageService; + $reset(items?: {}): IStorageService; + $apply(): void; - get(key: string): T; - set(key: string, value: T): T; - } + get(key: string): T; + set(key: string, value: T): T; + } - export interface IStorageProvider extends angular.IServiceProvider { + export interface IStorageProvider extends angular.IServiceProvider { - get(key:string): T; - set(key:string, value:T): T; + get(key: string): T; + set(key: string, value: T): T; - setKeyPrefix(prefix: string): void; - setSerializer(serializer: (value: any)=>string): void; - setDeserializer(deserializer: (value: string)=>any): void; + setKeyPrefix(prefix: string): void; + setSerializer(serializer: (value: any) => string): void; + setDeserializer(deserializer: (value: string) => any): void; + } } } diff --git a/node/index.d.ts b/node/index.d.ts index 31f1cecc0c..15b2794956 100644 --- a/node/index.d.ts +++ b/node/index.d.ts @@ -9,10 +9,6 @@ * * ************************************************/ -interface Error { - stack?: string; -} - // compat for TypeScript 1.8 // if you use with --target es3 or --target es5 and use below definitions, diff --git a/oclazyload/index.d.ts b/oclazyload/index.d.ts index 574b037b70..fd7bdea03d 100644 --- a/oclazyload/index.d.ts +++ b/oclazyload/index.d.ts @@ -5,135 +5,136 @@ /// -declare namespace oc { +import * as angular from 'angularjs'; - interface ILazyLoad { - /** - * Loads a module or a list of modules into Angular. - * - * @param module The name of a predefined module config object, or a module config object, or an array of either - * @param config Options to be used when loading the modules - */ - load(module: string|ITypedModuleConfig|IModuleConfig|(string|ITypedModuleConfig|IModuleConfig)[], config?: IOptionsConfig): ng.IPromise; +export as namespace oc; - /** - * Defines a module config object. - * @param config The module config object - * @returns The module config object that was passed in - */ - setModuleConfig(config: IModuleConfig): IModuleConfig; +export interface ILazyLoad { + /** + * Loads a module or a list of modules into Angular. + * + * @param module The name of a predefined module config object, or a module config object, or an array of either + * @param config Options to be used when loading the modules + */ + load(module: string|ITypedModuleConfig|IModuleConfig|(string|ITypedModuleConfig|IModuleConfig)[], config?: IOptionsConfig): ng.IPromise; - /** - * Gets the specified module config object. - * @param name The name of the module config object to get - */ - getModuleConfig(name: string): IModuleConfig; + /** + * Defines a module config object. + * @param config The module config object + * @returns The module config object that was passed in + */ + setModuleConfig(config: IModuleConfig): IModuleConfig; - /** - * Gets the list of loaded module names. - */ - getModules(): string[]; + /** + * Gets the specified module config object. + * @param name The name of the module config object to get + */ + getModuleConfig(name: string): IModuleConfig; - /** - * Checks if a module name, or list of modules names, has been previously loaded into Angular. - */ - isLoaded(moduleName: string|string[]): boolean; + /** + * Gets the list of loaded module names. + */ + getModules(): string[]; - /** - * Injects a module with the associated name into Angular. Useful for manual injection when loading through RequireJS, SystemJS, etc. Useful in - * conjunction with the toggleWatch() method. - */ - inject(moduleName: string|string[]): ng.IPromise; + /** + * Checks if a module name, or list of modules names, has been previously loaded into Angular. + */ + isLoaded(moduleName: string|string[]): boolean; - /** - * Enables or disables watching Angular for new modules. Useful in conjunction with the inject() method. Make sure to not keep the watch enabled - * indefinitely, or unexpected results may occur. - */ - toggleWatch(watch: boolean): void; - } + /** + * Injects a module with the associated name into Angular. Useful for manual injection when loading through RequireJS, SystemJS, etc. Useful in + * conjunction with the toggleWatch() method. + */ + inject(moduleName: string|string[]): ng.IPromise; - interface ITypedModuleConfig extends IOptionsConfig { - /** - * The file extension, without the period. For example, 'html'. - */ - type: string; - - /** - * The file path, including file name. - */ - path: string; - } - - interface IModuleConfig extends IOptionsConfig { - /** - * The name of the module for easy retrieval later. - */ - name?: string; - - /** - * The list of files to be loaded for this module. - */ - files: string[]; - } - - interface IOptionsConfig extends ng.IRequestShortcutConfig { - /** - * If true, bypasses browser cache by appending a timestamp to URLs. Defaults to true. - */ - cache?: boolean; - - /** - * If true, a module config will be invoked each time the module is reloaded. Use with caution, as re-invoking configs can lead to unexpected results. - * Defaults to false. - */ - reconfig?: boolean; - - /** - * If true, a module run block will be invoked each time the module is reloaded. Use with caution, as re-invoking run blocks can lead to unexpected results. - * Defaults to false. - */ - rerun?: boolean; - - /** - * If true, will load files in a series, instead of in parallel. Defaults to false. - */ - serie?: boolean; - - /** - * If set, will insert files immediately before the provided CSS selector, instead of the default behavior of inserting files immediately before the - * last child of the element. Defaults to undefined. - */ - insertBefore?: string; - } - - interface ILazyLoadProvider { - /** - * Configures the main service provider. - * @param config The configuration settings to use - */ - config(config: IProviderConfig): void; - } - - interface IProviderConfig { - /** - * If true, all errors will be logged to the console, in addition to rejecting a promise. Defaults to false. - */ - debug?: boolean; - - /** - * If true, an event will be broadcast whenever a module, component or file is loaded. Events that can be broadcast are: ocLazyLoad.moduleLoaded, - * ocLazyLoad.moduleReloaded, ocLazyLoad.componentLoaded, ocLazyLoad.fileLoaded. Defaults to false. - */ - events?: boolean; - - /** - * Predefines a set of module configurations for later use. A name must be provided for each module so that it can be retrieved later. - */ - modules?: IModuleConfig[]; - } + /** + * Enables or disables watching Angular for new modules. Useful in conjunction with the inject() method. Make sure to not keep the watch enabled + * indefinitely, or unexpected results may occur. + */ + toggleWatch(watch: boolean): void; } -declare namespace angular { +export interface ITypedModuleConfig extends IOptionsConfig { + /** + * The file extension, without the period. For example, 'html'. + */ + type: string; + + /** + * The file path, including file name. + */ + path: string; +} + +export interface IModuleConfig extends IOptionsConfig { + /** + * The name of the module for easy retrieval later. + */ + name?: string; + + /** + * The list of files to be loaded for this module. + */ + files: string[]; +} + +export interface IOptionsConfig extends ng.IRequestShortcutConfig { + /** + * If true, bypasses browser cache by appending a timestamp to URLs. Defaults to true. + */ + cache?: boolean; + + /** + * If true, a module config will be invoked each time the module is reloaded. Use with caution, as re-invoking configs can lead to unexpected results. + * Defaults to false. + */ + reconfig?: boolean; + + /** + * If true, a module run block will be invoked each time the module is reloaded. Use with caution, as re-invoking run blocks can lead to unexpected results. + * Defaults to false. + */ + rerun?: boolean; + + /** + * If true, will load files in a series, instead of in parallel. Defaults to false. + */ + serie?: boolean; + + /** + * If set, will insert files immediately before the provided CSS selector, instead of the default behavior of inserting files immediately before the + * last child of the element. Defaults to undefined. + */ + insertBefore?: string; +} + +export interface ILazyLoadProvider { + /** + * Configures the main service provider. + * @param config The configuration settings to use + */ + config(config: IProviderConfig): void; +} + +export interface IProviderConfig { + /** + * If true, all errors will be logged to the console, in addition to rejecting a promise. Defaults to false. + */ + debug?: boolean; + + /** + * If true, an event will be broadcast whenever a module, component or file is loaded. Events that can be broadcast are: ocLazyLoad.moduleLoaded, + * ocLazyLoad.moduleReloaded, ocLazyLoad.componentLoaded, ocLazyLoad.fileLoaded. Defaults to false. + */ + events?: boolean; + + /** + * Predefines a set of module configurations for later use. A name must be provided for each module so that it can be retrieved later. + */ + modules?: IModuleConfig[]; +} + +declare module 'angularjs' { interface IAngularStatic { /** * The angular.module is a global place for creating, registering and retrieving Angular modules. All modules (angular core or 3rd party) that should be available to an application must be registered using this mechanism. diff --git a/oclazyload/oclazyload-tests.ts b/oclazyload/oclazyload-tests.ts index f281d3b798..16b38b9315 100644 --- a/oclazyload/oclazyload-tests.ts +++ b/oclazyload/oclazyload-tests.ts @@ -1,4 +1,4 @@ - +import oc = require('oclazyload'); angular.module('app', ['oc.lazyLoad']).config(['$ocLazyLoadProvider', function ($ocLazyLoadProvider: oc.ILazyLoadProvider) { $ocLazyLoadProvider.config({ diff --git a/parse-torrent/index.d.ts b/parse-torrent/index.d.ts index b27d911026..787f03ce6b 100644 --- a/parse-torrent/index.d.ts +++ b/parse-torrent/index.d.ts @@ -5,8 +5,8 @@ /// -declare var parseTorrentStatic:ParseTorrent.StaticInstance; -export = parseTorrentStatic; +declare var ParseTorrent:ParseTorrent.StaticInstance; +export = ParseTorrent; declare namespace ParseTorrent { export interface ParsedTorrent { diff --git a/pathwatcher/index.d.ts b/pathwatcher/index.d.ts index 93aea6806b..b1fbca4b32 100644 --- a/pathwatcher/index.d.ts +++ b/pathwatcher/index.d.ts @@ -6,60 +6,61 @@ /// /// -declare namespace PathWatcher { - interface IFileStatic { - new (path:string, symlink?:boolean):IFile; - } +export as namespace PathWatcher; - interface IFile { - realPath:string; - path:string; - symlink:boolean; - cachedContents:string; - digest:string; - - handleEventSubscriptions():void; - setPath(path:string):void; - getPath():string; - getRealPathSync():string; - getBaseName():string; - write(text:string):void; - readSync(flushCache:boolean):string; - read(flushCache?:boolean):Q.Promise; - // exists():boolean; - existsSync():boolean; - setDigest(contents:string):void; - getDigest():string; - writeFileWithPrivilegeEscalationSync (filePath:string, text:string):void; - handleNativeChangeEvent(eventType:string, eventPath:string):void; - detectResurrectionAfterDelay():void; - detectResurrection():void; - subscribeToNativeChangeEvents():void; - unsubscribeFromNativeChangeEvents():void; - } - - interface IDirectoryStatic { - new (path:string, symlink?:boolean):IDirectory; - } - - interface IDirectory { - realPath:string; - path:string; - symlink:boolean; - - getBaseName():string; - getPath():void; - getRealPathSync():string; - contains(pathToCheck:string):boolean; - relativize(fullPath:string):string; - getEntriesSync():any[]; // return type are {File | Directory}[] - getEntries(callback:Function):void; - subscribeToNativeChangeEvents():void; - unsubscribeFromNativeChangeEvents():void; - isPathPrefixOf(prefix:string, fullPath:string):boolean; - } +export interface IFileStatic { + new (path:string, symlink?:boolean):IFile; } +export interface IFile { + realPath:string; + path:string; + symlink:boolean; + cachedContents:string; + digest:string; + + handleEventSubscriptions():void; + setPath(path:string):void; + getPath():string; + getRealPathSync():string; + getBaseName():string; + write(text:string):void; + readSync(flushCache:boolean):string; + read(flushCache?:boolean):Q.Promise; + // exists():boolean; + existsSync():boolean; + setDigest(contents:string):void; + getDigest():string; + writeFileWithPrivilegeEscalationSync (filePath:string, text:string):void; + handleNativeChangeEvent(eventType:string, eventPath:string):void; + detectResurrectionAfterDelay():void; + detectResurrection():void; + subscribeToNativeChangeEvents():void; + unsubscribeFromNativeChangeEvents():void; +} + +export interface IDirectoryStatic { + new (path:string, symlink?:boolean):IDirectory; +} + +export interface IDirectory { + realPath:string; + path:string; + symlink:boolean; + + getBaseName():string; + getPath():void; + getRealPathSync():string; + contains(pathToCheck:string):boolean; + relativize(fullPath:string):string; + getEntriesSync():any[]; // return type are {File | Directory}[] + getEntries(callback:Function):void; + subscribeToNativeChangeEvents():void; + unsubscribeFromNativeChangeEvents():void; + isPathPrefixOf(prefix:string, fullPath:string):boolean; +} + + import events = require("events"); export interface IHandleWatcher extends events.EventEmitter { diff --git a/pixi-spine/index.d.ts b/pixi-spine/index.d.ts index 2cba21ee3d..77415c00a8 100644 --- a/pixi-spine/index.d.ts +++ b/pixi-spine/index.d.ts @@ -4,7 +4,9 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// -declare namespace PIXI { +import * as PIXI from 'pixi.js'; + +declare module 'pixi.js' { export module spine { diff --git a/q-retry/index.d.ts b/q-retry/index.d.ts index 851f5fabe3..108a22cbbf 100644 --- a/q-retry/index.d.ts +++ b/q-retry/index.d.ts @@ -5,9 +5,11 @@ /// +import * as q from 'q'; + export = Q; -declare namespace Q { +declare module 'Q' { export interface IRetryOptions { limit?: number; interval?: number; diff --git a/react-cropper/index.d.ts b/react-cropper/index.d.ts index 86484b962e..44e414541c 100644 --- a/react-cropper/index.d.ts +++ b/react-cropper/index.d.ts @@ -6,6 +6,8 @@ /// /// +import cropperjs = require('cropperjs'); + import Data = cropperjs.Data; import ContainerData = cropperjs.ContainerData; @@ -15,7 +17,7 @@ import CropBoxData = cropperjs.CropBoxData; import CroppedCanvasOptions = cropperjs.CroppedCanvasOptions; type ReactCropperProps = cropperjs.CropperOptions & React.HTMLProps; -declare class ReactCropper extends React.Component implements cropperjs.Cropper { +declare class ReactCropper extends React.Component implements cropperjs { /** * Show the crop box manually. diff --git a/rsmq-worker/index.d.ts b/rsmq-worker/index.d.ts index 195b1ed819..9fdfa3c648 100644 --- a/rsmq-worker/index.d.ts +++ b/rsmq-worker/index.d.ts @@ -8,6 +8,7 @@ import redis = require('redis'); import events = require('events'); +import * as RedisSMQ from 'rsmq'; declare namespace RSMQWorker { export interface Client extends events.EventEmitter { diff --git a/rsmq-worker/rsmq-worker-tests.ts b/rsmq-worker/rsmq-worker-tests.ts index 2e1361d73c..719abdd3e5 100644 --- a/rsmq-worker/rsmq-worker-tests.ts +++ b/rsmq-worker/rsmq-worker-tests.ts @@ -1,4 +1,4 @@ - +import * as RedisSMQ from 'rsmq'; import RSMQWorker = require('rsmq-worker'); var worker: RSMQWorker.Client; diff --git a/rsmq/index.d.ts b/rsmq/index.d.ts index b10c6c30a1..5edaf09fa3 100644 --- a/rsmq/index.d.ts +++ b/rsmq/index.d.ts @@ -86,6 +86,6 @@ interface ClientOptions { ns?: string; } -declare var rsmq: RedisSMQStatic; -export = rsmq; +declare var RedisSMQ: RedisSMQStatic; +export = RedisSMQ; diff --git a/sinon-chai/index.d.ts b/sinon-chai/index.d.ts index 149b46abea..facf13cdce 100644 --- a/sinon-chai/index.d.ts +++ b/sinon-chai/index.d.ts @@ -6,80 +6,83 @@ /// /// -declare namespace Chai { +import * as Sinon from 'sinon'; - interface LanguageChains { - always: Assertion; - } +declare global { - interface Assertion { - /** - * true if the spy was called at least once. - */ - called: Assertion; - /** - * @param count The number of recorded calls. - */ - callCount(count: number): Assertion; - /** - * true if the spy was called exactly once. - */ - calledOnce: Assertion; - /** - * true if the spy was called exactly twice. - */ - calledTwice: Assertion; - /** - * true if the spy was called exactly thrice. - */ - calledThrice: Assertion; - /** - * Returns true if the spy was called before anotherSpy. - */ - calledBefore(anotherSpy: Sinon.SinonSpy): Assertion; - /** - * Returns true if the spy was called after anotherSpy. - */ - calledAfter(anotherSpy: Sinon.SinonSpy): Assertion; - /** - * Returns true if spy/stub was called with the new operator. Beware that - * this is inferred based on the value of the this object and the spy - * function's prototype, so it may give false positives if you actively - * return the right kind of object. - */ - calledWithNew: Assertion; - /** - * Returns true if context was this for this call. - */ - calledOn(context: any): Assertion; - /** - * Returns true if call received provided arguments (and possibly others). - */ - calledWith(...args: any[]): Assertion; - /** - * Returns true if call received provided arguments and no others. - */ - calledWithExactly(...args: any[]): Assertion; - /** - * Returns true if call received matching arguments (and possibly others). - * This behaves the same as spyCall.calledWith(sinon.match(arg1), sinon.match(arg2), ...). - */ - calledWithMatch(...args: any[]): Assertion; - /** - * Returns true if spy returned the provided value at least once. Uses - * deep comparison for objects and arrays. Use spy.returned(sinon.match.same(obj)) - * for strict comparison (see matchers). - */ - returned(obj: any): Assertion; - /** - * Returns true if spy threw the provided exception object at least once. - */ - thrown(obj?: Error|typeof Error|string): Assertion; + export namespace Chai { + + interface LanguageChains { + always: Assertion; + } + + interface Assertion { + /** + * true if the spy was called at least once. + */ + called: Assertion; + /** + * @param count The number of recorded calls. + */ + callCount(count: number): Assertion; + /** + * true if the spy was called exactly once. + */ + calledOnce: Assertion; + /** + * true if the spy was called exactly twice. + */ + calledTwice: Assertion; + /** + * true if the spy was called exactly thrice. + */ + calledThrice: Assertion; + /** + * Returns true if the spy was called before anotherSpy. + */ + calledBefore(anotherSpy: Sinon.SinonSpy): Assertion; + /** + * Returns true if the spy was called after anotherSpy. + */ + calledAfter(anotherSpy: Sinon.SinonSpy): Assertion; + /** + * Returns true if spy/stub was called with the new operator. Beware that + * this is inferred based on the value of the this object and the spy + * function's prototype, so it may give false positives if you actively + * return the right kind of object. + */ + calledWithNew: Assertion; + /** + * Returns true if context was this for this call. + */ + calledOn(context: any): Assertion; + /** + * Returns true if call received provided arguments (and possibly others). + */ + calledWith(...args: any[]): Assertion; + /** + * Returns true if call received provided arguments and no others. + */ + calledWithExactly(...args: any[]): Assertion; + /** + * Returns true if call received matching arguments (and possibly others). + * This behaves the same as spyCall.calledWith(sinon.match(arg1), sinon.match(arg2), ...). + */ + calledWithMatch(...args: any[]): Assertion; + /** + * Returns true if spy returned the provided value at least once. Uses + * deep comparison for objects and arrays. Use spy.returned(sinon.match.same(obj)) + * for strict comparison (see matchers). + */ + returned(obj: any): Assertion; + /** + * Returns true if spy threw the provided exception object at least once. + */ + thrown(obj?: Error | typeof Error | string): Assertion; + } } } -declare module "sinon-chai" { - function sinonChai(chai: any, utils: any): void; - namespace sinonChai { } - export = sinonChai; -} +declare function sinonChai(chai: any, utils: any): void; +declare namespace sinonChai { } +export = sinonChai; diff --git a/sinon-chai/sinon-chai-tests.ts b/sinon-chai/sinon-chai-tests.ts index b19d1b4d5a..70e2aa750c 100644 --- a/sinon-chai/sinon-chai-tests.ts +++ b/sinon-chai/sinon-chai-tests.ts @@ -1,4 +1,4 @@ - +import Sinon = require('sinon'); import chai = require('chai'); import sinonChai = require('sinon-chai'); diff --git a/sinon-chrome/index.d.ts b/sinon-chrome/index.d.ts index 0bd8874780..cfb769fb7c 100644 --- a/sinon-chrome/index.d.ts +++ b/sinon-chrome/index.d.ts @@ -14,6 +14,11 @@ * var chrome = window.chrome; * chrome.storage.onChanged.trigger(...); */ + +import * as Sinon from 'sinon'; +export = SinonChrome; +export as namespace SinonChrome; + declare namespace SinonChrome { /** * Flush cache diff --git a/sinon-chrome/sinon-chrome-tests.ts b/sinon-chrome/sinon-chrome-tests.ts index 70c6cfb1d3..58639b8a65 100644 --- a/sinon-chrome/sinon-chrome-tests.ts +++ b/sinon-chrome/sinon-chrome-tests.ts @@ -1,3 +1,5 @@ +import * as sinon from 'sinon'; +import SinonChrome = require("sinon-chrome"); var chromeStub = window.chrome; // Examples taken from https://github.com/vitalets/sinon-chrome: diff --git a/sinon-stub-promise/index.d.ts b/sinon-stub-promise/index.d.ts index cc84d9000d..30e24650ac 100644 --- a/sinon-stub-promise/index.d.ts +++ b/sinon-stub-promise/index.d.ts @@ -5,7 +5,7 @@ /// -declare namespace Sinon { +declare module 'sinon' { interface SinonPromise { resolves(value?: any): void; rejects(value?: any): void; @@ -15,3 +15,5 @@ declare namespace Sinon { returnsPromise(): SinonPromise; } } + +export {}; diff --git a/sinon-stub-promise/sinon-stub-promise-tests.ts b/sinon-stub-promise/sinon-stub-promise-tests.ts index 3a03787235..7840272bd6 100644 --- a/sinon-stub-promise/sinon-stub-promise-tests.ts +++ b/sinon-stub-promise/sinon-stub-promise-tests.ts @@ -1,3 +1,4 @@ +import * as sinon from 'sinon'; function testResolve() { var promise = sinon.stub().returnsPromise(); promise.resolves('test val'); diff --git a/sinon/index.d.ts b/sinon/index.d.ts index 77de211994..a124c823e5 100644 --- a/sinon/index.d.ts +++ b/sinon/index.d.ts @@ -428,7 +428,6 @@ declare namespace Sinon { } } -declare var sinon: Sinon.SinonStatic; - -export = sinon; +declare var Sinon: Sinon.SinonStatic; +export = Sinon; diff --git a/srp/index.d.ts b/srp/index.d.ts index f13add89ff..64b32259ec 100644 --- a/srp/index.d.ts +++ b/srp/index.d.ts @@ -6,6 +6,8 @@ /// /// +import * as BigNum from 'bignum'; + export = SRP; declare namespace SRP { diff --git a/tspromise/index.d.ts b/tspromise/index.d.ts index a2e38426a3..7fa5dd1411 100644 --- a/tspromise/index.d.ts +++ b/tspromise/index.d.ts @@ -9,7 +9,7 @@ declare class Thenable { then(onFulfilled: (value: T) => Thenable, onRejected?: (error: Error) => void): Thenable; then(onFulfilled: (value: T) => TR, onRejected?: (error: Error) => void): Thenable; then(onFulfilled: (value: T) => TR, onRejected?: (error: Error) => TR): Thenable; - catch(onRejected: (error: Error) => T): Thenable; + catch(onRejected: (error: Error) => void): Thenable; } interface NodeCallback { diff --git a/webtorrent/index.d.ts b/webtorrent/index.d.ts index b6e55823f5..5182e629e5 100644 --- a/webtorrent/index.d.ts +++ b/webtorrent/index.d.ts @@ -6,6 +6,8 @@ /// /// +import ParseTorrent = require("parse-torrent"); + declare var webTorrentStatic:WebTorrent.ClientConstructor; export = webTorrentStatic; export as namespace WebTorrent;