Merge pull request #9848 from rakatyal/raghav/test_fixes

Fixing test failures
This commit is contained in:
Ryan Cavanaugh
2016-06-30 10:22:25 -07:00
committed by GitHub
76 changed files with 3825 additions and 3708 deletions
+3 -2
View File
@@ -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
+22 -18
View File
@@ -5,30 +5,34 @@
/// <reference types="angularjs" />
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;
}
}
}
+229 -225
View File
@@ -5,255 +5,259 @@
/// <reference types="angularjs" />
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;
}
}
}
+32 -28
View File
@@ -5,46 +5,50 @@
/// <reference types="angularjs" />
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<string>, 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<string>, persistent?: boolean): ng.hotkeys.Hotkey;
add(combo: string | string[], callback: (event: Event, hotkey?: Hotkey) => void, action?: string, allowIn?: Array<string>, 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<string>, 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<string>;
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<string>;
persistent?: boolean;
}
}
}
+14 -10
View File
@@ -5,15 +5,19 @@
/// <reference types="angularjs" />
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;
}
}
}
+232 -228
View File
@@ -5,259 +5,263 @@
/// <reference types="angularjs" />
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;
}
}
}
+22 -18
View File
@@ -5,26 +5,30 @@
/// <reference types="angularjs" />
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;
}
}
}
+26 -26
View File
@@ -5,8 +5,33 @@
/// <reference types="angularjs" />
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;
}
}
+142 -138
View File
@@ -5,145 +5,149 @@
/// <reference types="angularjs" />
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.<your-key>
*/
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.<your-key>
*/
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<T>(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<T>(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<T>(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<T>(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;
}
}
}
+41 -37
View File
@@ -6,58 +6,62 @@
/// <reference types="localForage" />
/// <reference types="angularjs" />
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<void>;
interface ILocalForageProvider {
config(config: LocalForageConfig): void;
setNotify(onItemSet: boolean, onItemRemove: boolean): void;
}
setItem(key:string, value:any):angular.IPromise<void>;
setItem(keys:Array<string>, values:Array<any>):angular.IPromise<void>;
interface ILocalForageService {
driver(): LocalForageDriver;
setDriver(name: string | string[]): angular.IPromise<void>;
getItem(key:string):angular.IPromise<any>;
getItem(keys:Array<string>):angular.IPromise<Array<any>>;
setItem(key: string, value: any): angular.IPromise<void>;
setItem(keys: Array<string>, values: Array<any>): angular.IPromise<void>;
removeItem(key:string | Array<string>):angular.IPromise<void>;
getItem(key: string): angular.IPromise<any>;
getItem(keys: Array<string>): angular.IPromise<Array<any>>;
pull(key:string):angular.IPromise<any>;
pull(keys:Array<string>):angular.IPromise<Array<any>>;
removeItem(key: string | Array<string>): angular.IPromise<void>;
clear():angular.IPromise<void>;
pull(key: string): angular.IPromise<any>;
pull(keys: Array<string>): angular.IPromise<Array<any>>;
key(n:number):angular.IPromise<string>;
clear(): angular.IPromise<void>;
keys():angular.IPromise<string>;
key(n: number): angular.IPromise<string>;
length():angular.IPromise<number>;
keys(): angular.IPromise<string>;
iterate<T>(iteratorCallback:(value:string | number, key:string)=>T):angular.IPromise<T>;
length(): angular.IPromise<number>;
bind($scope:ng.IScope, key:string):angular.IPromise<any>;
iterate<T>(iteratorCallback: (value: string | number, key: string) => T): angular.IPromise<T>;
bind($scope:ng.IScope, config:{
key:string;
defaultValue?:any;
scopeKey?:string;
name?:string;
}):angular.IPromise<any>;
bind($scope: ng.IScope, key: string): angular.IPromise<any>;
unbind($scope:ng.IScope, key:string, scopeKey?:string):void;
bind($scope: ng.IScope, config: {
key: string;
defaultValue?: any;
scopeKey?: string;
name?: string;
}): angular.IPromise<any>;
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;
}
}
}
+245 -240
View File
@@ -4,271 +4,276 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="angularjs" />
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<any>}
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<any>;
hide(response?: any): void;
cancel(response?: any): void;
}
declare module 'angularjs' {
export namespace material {
interface IPresetDialog<T> {
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<any>}): 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<any> }
controllerAs?: string;
bindToController?: boolean;
parent?: string | Element | JQuery; // default: root node
disableParentScroll?: boolean; // default: true
}
interface IAlertDialog extends IPresetDialog<IAlertDialog> {
}
interface IBottomSheetService {
show(options: IBottomSheetOptions): angular.IPromise<any>;
hide(response?: any): void;
cancel(response?: any): void;
}
interface IConfirmDialog extends IPresetDialog<IConfirmDialog> {
cancel(cancel: string): IConfirmDialog;
}
interface IPresetDialog<T> {
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<any> }): 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<any>}
controllerAs?: string;
parent?: string|Element|JQuery; // default: root node
onShowing?: Function;
onComplete?: Function;
onRemoving?: Function;
fullscreen?: boolean;
}
interface IAlertDialog extends IPresetDialog<IAlertDialog> {
}
interface IDialogService {
show(dialog: IDialogOptions|IAlertDialog|IConfirmDialog): angular.IPromise<any>;
confirm(): IConfirmDialog;
alert(): IAlertDialog;
hide(response?: any): angular.IPromise<any>;
cancel(response?: any): void;
}
interface IConfirmDialog extends IPresetDialog<IConfirmDialog> {
cancel(cancel: string): IConfirmDialog;
}
interface IIcon {
(id: string): angular.IPromise<Element>; // 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<any> }
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<any>;
confirm(): IConfirmDialog;
alert(): IAlertDialog;
hide(response?: any): angular.IPromise<any>;
cancel(response?: any): void;
}
interface IMedia {
(media: string): boolean;
}
interface IIcon {
(id: string): angular.IPromise<Element>; // id is a unique ID or URL
}
interface ISidenavObject {
toggle(): angular.IPromise<void>;
open(): angular.IPromise<void>;
close(): angular.IPromise<void>;
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<T> {
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<void>;
open(): angular.IPromise<void>;
close(): angular.IPromise<void>;
isOpen(): boolean;
isLockedOpen(): boolean;
}
interface ISimpleToastPreset extends IToastPreset<ISimpleToastPreset> {
}
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<any>}
controllerAs?: string;
parent?: string|Element|JQuery; // default: root node
}
interface IToastPreset<T> {
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<any>): angular.IPromise<any>;
showSimple(content: string): angular.IPromise<any>;
simple(): ISimpleToastPreset;
build(): IToastPreset<any>;
updateContent(): void;
hide(response?: any): void;
cancel(response?: any): void;
}
interface ISimpleToastPreset extends IToastPreset<ISimpleToastPreset> {
}
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<any> }
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<any>): angular.IPromise<any>;
showSimple(content: string): angular.IPromise<any>;
simple(): ISimpleToastPreset;
build(): IToastPreset<any>;
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<any>;
}
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<any>;
}
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;
}
}
}
+22 -17
View File
@@ -4,27 +4,32 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="angularjs" />
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> | 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> | 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> | string, callback: (result: boolean) => void): boolean;
// Returns a value indicating if the current device has a retina screen
isRetina: boolean;
is(list: Array<string> | 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> | 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> | 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> | 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> | string, callback: (result: boolean) => void, scope?: angular.IScope): boolean;
}
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
import * as angular from 'angularjs';
interface ITodo {
_id?: string;
+328 -326
View File
@@ -4,349 +4,351 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="meteor" />
/// <reference types="angularjs" />
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<Meteor.SubscriptionHandle>;
/**
* 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<any> }): 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<T>(collection: Mongo.Collection<T>|ReactiveResult|Function|(()=>T), autoClientSave?: boolean): AngularMeteorCollection<T>;
/**
* 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<T, U>(collection: Mongo.Collection<T>|ReactiveResult|Function|(()=>T), autoClientSave: boolean, updateCollection: Mongo.Collection<U>): AngularMeteorCollection2<T, U>;
/**
* 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<T>(collection: Mongo.Collection<T>, selector: Mongo.Selector|Mongo.ObjectID|string, autoClientSave?: boolean): AngularMeteorObject<T>;
/**
* 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<Meteor.SubscriptionHandle>;
/**
* 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<T>(name: string, ...methodArguments: any[]): angular.IPromise<T>;
// 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<Meteor.User>;
/**
* 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<Meteor.User>;
/**
* 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<Meteor.User>;
/**
* 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<void>;
/**
* 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<void>;
/**
* 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<void>;
/**
* Request a forgot password email.
*
* @param options.email - The email address to send a password reset link.
*/
forgotPassword(options: {email: string}): angular.IPromise<void>;
/**
* 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<void>;
/**
* 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<void>;
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<void>;
/**
* 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<void>;
// <- 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<T>(collectionName: string): Mongo.Collection<T>;
// <- $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<any>;
// <- $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<Meteor.SubscriptionHandle>;
/**
* 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<any> }): 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<T> together with T and cast it, like this:
*
* interface TodoAngularMeteorObject extends ITodo, AngularMeteorObject<ITodo> { }
* var todo = <TodoAngularMeteorObject>$meteor.object(TodoCollection, 'TodoID');
*/
interface AngularMeteorObject<T> {
/**
* @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<T>(collection: Mongo.Collection<T>|ReactiveResult|Function|(()=>T), autoClientSave?: boolean): AngularMeteorCollection<T>;
/**
* 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<T, U>(collection: Mongo.Collection<T>|ReactiveResult|Function|(()=>T), autoClientSave: boolean, updateCollection: Mongo.Collection<U>): AngularMeteorCollection2<T, U>;
/**
* 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<T>(collection: Mongo.Collection<T>, selector: Mongo.Selector|Mongo.ObjectID|string, autoClientSave?: boolean): AngularMeteorObject<T>;
/**
* 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<Meteor.SubscriptionHandle>;
/**
* 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<T>(name: string, ...methodArguments: any[]): angular.IPromise<T>;
// 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<Meteor.User>;
/**
* 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<Meteor.User>;
/**
* 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<Meteor.User>;
/**
* 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<void>;
/**
* 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<void>;
/**
* 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<void>;
/**
* Request a forgot password email.
*
* @param options.email - The email address to send a password reset link.
*/
forgotPassword(options: {email: string}): angular.IPromise<void>;
/**
* 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<void>;
/**
* 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<void>;
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<void>;
/**
* 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<void>;
// <- 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<T>(collectionName: string): Mongo.Collection<T>;
// <- $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<any>;
// <- $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<number>;
/**
* 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<T> 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<ITodo> { }
* var todo = <TodoAngularMeteorObject>$meteor.object(TodoCollection, 'TodoID');
*/
subscribe(subscriptionName:string): AngularMeteorObject<T>;
}
interface AngularMeteorObject<T> {
/**
* @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<number>;
/**
* An object that connects a Meteor Collection to an AngularJS scope variable
*/
interface AngularMeteorCollection<T> extends AngularMeteorCollection2<T, T> { }
/**
* 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<T, U> extends Array<T> {
/**
* @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<T>;
}
/**
* @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<T> extends AngularMeteorCollection2<T, 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.
* An object that connects a Meteor Collection to an AngularJS scope variable,
* but can use a differen type for updates.
*/
subscribe(subscriptionName:string): AngularMeteorCollection2<T, U>;
}
interface AngularMeteorCollection2<T, U> extends Array<T> {
/**
* @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<void>;
}
/**
* @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<T, U>;
}
interface ILoginWithExternalService {
(options: Meteor.LoginWithExternalServiceOptions): angular.IPromise<void>;
}
interface ReactiveResult { }
}
}
+64 -60
View File
@@ -5,78 +5,82 @@
/// <reference types="angularjs" />
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<INotification>;
getQueue(): Array<INotification>;
/* ============ QUERYING RELATED METHODS ============*/
/* ============== NOTIFICATION METHODS ==============*/
getAll(): Array<INotification>;
getQueue(): Array<INotification>;
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;
}
}
}
+104 -100
View File
@@ -5,122 +5,126 @@
///<reference types="angularjs" />
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 <span>).
*/
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 <span>).
* 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;
}
}
}
+147 -143
View File
@@ -6,170 +6,174 @@
/// <reference types="angularjs" />
/// <reference types="angular-ui-router" />
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<any>
): 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<any>
): 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<any>
): 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<any>
): 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<string>,
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<string>): 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<string>,
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<string>): 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<any>;
}
export interface Permission {
permissionName: string;
validationFunction?: PermissionValidationFunction;
}
interface PermissionValidationFunction {
(permission?: string, transitionProperties?: TransitionProperties): boolean | angular.IPromise<any>;
}
interface RoleValidationFunction {
(permission?: string, transitionProperties?: TransitionProperties): boolean | angular.IPromise<any>;
}
export interface IPermissionState extends angular.ui.IState {
data?: any | DataWithPermissions;
}
interface PermissionValidationFunction {
(permission?: string, transitionProperties?: TransitionProperties): boolean | angular.IPromise<any>;
}
export interface DataWithPermissions {
permissions?: {
only?: (() => void) | Array<string> | angular.IPromise<any>;
except?: (() => void) | Array<string> | angular.IPromise<any>;
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<string> | angular.IPromise<any>;
except?: (() => void) | Array<string> | angular.IPromise<any>;
redirectTo: string | (() => string) | (() => PermissionRedirectConfigation) | { [index: string]: PermissionRedirectConfigation }
};
}
export interface PermissionRedirectConfigation {
state: string;
params?: {};
options?: angular.ui.IStateOptions;
}
}
}
+45 -41
View File
@@ -5,51 +5,55 @@
/// <reference types="angularjs" />
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;
}
}
}
+104 -107
View File
@@ -5,119 +5,116 @@
/// <reference types="angularjs" />
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<T> {
addPart(name: string, priority?: number): T;
deletePart(name: string): T;
isPartAvailable(name: string): boolean;
}
interface ITranslatePartialLoaderService extends IPartialLoader<ITranslatePartialLoaderService> {
getRegisteredParts(): Array<string>;
isPartLoaded(name: string, lang: string): boolean;
}
interface ITranslatePartialLoaderProvider extends angular.IServiceProvider, IPartialLoader<ITranslatePartialLoaderProvider> {
setPart(lang: string, part: string, table: ITranslationTable): ITranslatePartialLoaderProvider;
}
interface ITranslateService {
(translationId: string, interpolateParams?: any, interpolationId?: string): angular.IPromise<string>;
(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<void>;
storage(): IStorage;
storageKey(): string;
use(): string;
use(key: string): angular.IPromise<string>;
useFallbackLanguage(langKey?: string): void;
versionInfo(): string;
loaderCache(): any;
isReady(): boolean;
onReady(): angular.IPromise<void>;
}
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<T> {
addPart(name : string, priority? : number) : T;
deletePart(name : string) : T;
isPartAvailable(name : string) : boolean;
}
interface ITranslatePartialLoaderService extends IPartialLoader<ITranslatePartialLoaderService> {
getRegisteredParts() : Array<string>;
isPartLoaded(name : string, lang : string) : boolean;
}
interface ITranslatePartialLoaderProvider extends angular.IServiceProvider, IPartialLoader<ITranslatePartialLoaderProvider> {
setPart(lang : string, part : string, table : ITranslationTable) : ITranslatePartialLoaderProvider;
}
interface ITranslateService {
(translationId: string, interpolateParams?: any, interpolationId?: string): angular.IPromise<string>;
(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<void>;
storage(): IStorage;
storageKey(): string;
use(): string;
use(key: string): angular.IPromise<string>;
useFallbackLanguage(langKey?: string): void;
versionInfo(): string;
loaderCache(): any;
isReady(): boolean;
onReady(): angular.IPromise<void>;
}
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;
};
}
}
}
+735 -743
View File
File diff suppressed because it is too large Load Diff
+79 -75
View File
@@ -5,81 +5,85 @@
/// <reference types="angularjs" />
declare namespace angular.ui {
interface IScrollDatasource<T> {
/**
* 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<T>) => 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<T> {
/**
* 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<T>) => 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;
}
}
}
+203 -200
View File
@@ -5,206 +5,209 @@
/// <reference types="angularjs" />
declare namespace angular.ui {
import * as angular from 'angularjs';
interface UISortableOptions<T> extends SortableOptions<T> {
'ui-floating'?: string|boolean;
declare module 'angularjs' {
export namespace ui {
interface UISortableOptions<T> extends SortableOptions<T> {
'ui-floating'?: string | boolean;
}
interface UISortableProperties<T> {
/**
* 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<T>;
/**
* 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<T>;
/**
* 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<T> extends ng.IAugmentedJQuery {
sortable: UISortableProperties<T>;
}
interface UISortableUIParams<T> extends SortableUIParams {
item: UISortableUIItem<T>;
}
// Base Sortable //////////////////////////////////////////////////
interface SortableCursorAtOptions {
top?: number;
left?: number;
right?: number;
bottom?: number;
}
interface SortableHelperFunctionOption {
(event: JQueryEventObject, ui: ng.IAugmentedJQuery): JQuery;
}
interface SortableOptions<T> extends SortableEvents<T> {
/**
* 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<T> {
(event: JQueryEventObject, ui: UISortableUIParams<T>): void;
}
interface SortableEvents<T> {
activate?: SortableEvent<T>;
beforeStop?: SortableEvent<T>;
change?: SortableEvent<T>;
deactivate?: SortableEvent<T>;
out?: SortableEvent<T>;
over?: SortableEvent<T>;
receive?: SortableEvent<T>;
remove?: SortableEvent<T>;
sort?: SortableEvent<T>;
start?: SortableEvent<T>;
stop?: SortableEvent<T>;
update?: SortableEvent<T>;
}
}
interface UISortableProperties<T> {
/**
* 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<T>;
/**
* 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<T>;
/**
* 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<T> extends ng.IAugmentedJQuery {
sortable: UISortableProperties<T>;
}
interface UISortableUIParams<T> extends SortableUIParams {
item: UISortableUIItem<T>;
}
// Base Sortable //////////////////////////////////////////////////
interface SortableCursorAtOptions {
top?: number;
left?: number;
right?: number;
bottom?: number;
}
interface SortableHelperFunctionOption {
(event: JQueryEventObject, ui: ng.IAugmentedJQuery): JQuery;
}
interface SortableOptions<T> extends SortableEvents<T> {
/**
* 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<T> {
(event: JQueryEventObject, ui: UISortableUIParams<T>): void;
}
interface SortableEvents<T> {
activate?: SortableEvent<T>;
beforeStop?: SortableEvent<T>;
change?: SortableEvent<T>;
deactivate?: SortableEvent<T>;
out?: SortableEvent<T>;
over?: SortableEvent<T>;
receive?: SortableEvent<T>;
remove?: SortableEvent<T>;
sort?: SortableEvent<T>;
start?: SortableEvent<T>;
stop?: SortableEvent<T>;
update?: SortableEvent<T>;
}
}
+32 -28
View File
@@ -3,36 +3,40 @@
// Definitions by: Marko Jurisic <https://github.com/mjurisic>, Ronald Wildenberg <https://github.com/rwwilden>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace angular.mgoAngularWizard {
interface WizardHandler {
wizard(name?: string): Wizard;
addWizard(name: string, wizard: Wizard): void;
removeWizard(name: string): void;
}
import * as angular from 'angularjs';
interface Wizard {
next(nextHandler?: () => boolean): void;
previous(): void;
cancel: () => void;
goTo(step: number | string): void;
finish(): void;
reset: () => void;
declare module 'angularjs' {
export namespace mgoAngularWizard {
interface WizardHandler {
wizard(name?: string): Wizard;
addWizard(name: string, wizard: Wizard): void;
removeWizard(name: string): void;
}
addStep: (step: WzStep) => void;
currentStep: () => WzStep;
currentStepNumber(): number;
currentStepDescription: () => string;
currentStepTitle: () => string;
getEnabledSteps(): WzStep[];
}
interface Wizard {
next(nextHandler?: () => boolean): void;
previous(): void;
cancel: () => void;
goTo(step: number | string): void;
finish(): void;
reset: () => void;
interface WzStep {
canenter: (...args: any[]) => boolean;
canexit: (...args: any[]) => boolean;
description: string;
selected: boolean;
title: string;
wzData: any;
wzTitle: string;
addStep: (step: WzStep) => void;
currentStep: () => WzStep;
currentStepNumber(): number;
currentStepDescription: () => string;
currentStepTitle: () => string;
getEnabledSteps(): WzStep[];
}
interface WzStep {
canenter: (...args: any[]) => boolean;
canexit: (...args: any[]) => boolean;
description: string;
selected: boolean;
title: string;
wzData: any;
wzTitle: string;
}
}
}
+3 -1
View File
@@ -5,7 +5,9 @@
/// <reference types="angularjs" />
declare namespace angular {
import * as angular from 'angularjs';
declare module 'angularjs' {
interface IAngularStatic {
throttle:( fn:Function, throttle:number, options?:{leading?:boolean; trailing?:boolean;} ) => Function;
}
+15 -11
View File
@@ -5,18 +5,22 @@
/// <reference types="angularjs"/>
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;
}
}
}
+209 -207
View File
@@ -3,6 +3,7 @@
// Definitions by: Diego Vilar <http://github.com/diegovilar>, Tony Curtis <http://github.com/daltin>
// 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;
}
}
}
///////////////////////////////////////////////////////////////////////////////
@@ -340,4 +340,6 @@ declare namespace angular {
///////////////////////////////////////////////////////////////////////////////
//Use `angular.mock.module` instead of `module`, as `module` conflicts with commonjs.
//declare var module: (...modules: any[]) => any;
declare var inject: angular.IInjectStatic;
declare global {
export var inject: angular.IInjectStatic;
}
+2
View File
@@ -5,6 +5,8 @@
/// <reference types="event-kit" />
import * as AtomEventKit from 'event-kit';
export = AtomKeymap;
declare namespace AtomKeymap {
+5 -1
View File
@@ -2,6 +2,8 @@
/// <reference types="chai" />
/// <reference types="angularjs" />
import * as angular from 'angularjs';
namespace bardTests {
var expect = chai.expect,
assert = chai.assert;
@@ -16,10 +18,12 @@ namespace bardTests {
}
}
myService.$inject = ['$q'];
function myService($q: angular.IQService) {
return new MyService($q);
}
namespace myService {
export var $inject = ['$q'];
}
class MyController {
myProperty: string;
+2 -2
View File
@@ -3,8 +3,8 @@
// Definitions by: Ilya Mochalov <https://github.com/chrootsu>
// 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 {
+1
View File
@@ -5,6 +5,7 @@
/// <reference types="base-x" />
import * as BaseX from 'base-x';
declare namespace base58 { }
+138 -139
View File
@@ -3,12 +3,7 @@
// Definitions by: Stepan Mikhaylyuk <https://github.com/stepancar>
// 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;
+1 -1
View File
@@ -1,4 +1,4 @@
import crossroads = require('crossroads');
//String rule with param:
//match '/news/123' passing "123" as param to handler
+9 -9
View File
@@ -5,15 +5,17 @@
/// <reference types="signals" />
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;
+38 -37
View File
@@ -5,56 +5,57 @@
/// <reference types="mixto" />
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
+104 -102
View File
@@ -3,119 +3,121 @@
// Definitions by: Yuichi Murata <https://github.com/mrk21>, Leon Yu <https://github.com/leonyu>
// 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;
}
+5 -5
View File
@@ -5,6 +5,8 @@
/// <reference types="falcor" />
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;
+1 -1
View File
@@ -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 {
+19 -19
View File
@@ -4,24 +4,26 @@
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference types="falcor" />
import * as FalcorModel from 'falcor';
import * as FalcorJsonGraph from 'falcor-json-graph';
import DataSource = FalcorModel.DataSource;
declare class FalcorRouter extends DataSource {
constructor(routes: Array<FalcorRouter.RouteDefinition>, 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<FalcorRouter.RouteDefinition>): typeof FalcorRouter.CreatedRouter;
}
declare namespace FalcorRouter {
import DataSource = FalcorModel.DataSource;
class Router extends DataSource {
constructor(routes: Array<RouteDefinition>, 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<RouteDefinition>): 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;
+2
View File
@@ -5,6 +5,8 @@
/// <reference types="falcor-json-graph" />
import * as FalcorJsonGraph from 'falcor-json-graph';
export = FalcorModel;
export as namespace falcor;
+4 -3
View File
@@ -6,6 +6,8 @@
/// <reference types="react" />
/// <reference types="eventemitter3" />
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;
+7 -7
View File
@@ -5,6 +5,8 @@
/// <reference types="signals" />
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;
// <static> {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;
// <static> {signals.Signal} hasher.initialized
// Signal dispatched when hasher is initialized. - pass current hash as first parameter to listeners.
initialized: Signal;
initialized: signal.Signal;
// <static> {string} hasher.prependHash
// String that should always be added to the beginning of Hash value.
@@ -38,7 +40,7 @@ declare namespace HasherJs {
// default value: '/';
// <static> {signals.Signal} hasher.stopped
// Signal dispatched when hasher is stopped. - pass current hash as first parameter to listeners
stopped: Signal;
stopped: signal.Signal;
// <static> <constant> {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;
+3 -3
View File
@@ -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;
}
+6 -6
View File
@@ -5,15 +5,15 @@
///<reference types="i18next"/>
declare namespace I18next {
interface I18n {
t(key: string, ...args: any[]): string;
}
}
declare module "i18next-sprintf-postprocessor" {
import i18next = require("i18next");
module "i18next" {
interface I18n {
t(key: string, ...args: any[]): string;
}
}
interface I18nextSprintfPostProcessor {
name: string;
type: string;
+4 -4
View File
@@ -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;
+3 -1
View File
@@ -6,7 +6,9 @@
/// <reference types="js-data" />
/// <reference types="angularjs" />
declare namespace JSData {
import * as JSData from 'js-data';
declare module 'js-data' {
interface DSProvider {
defaults:DSConfiguration;
+1 -1
View File
@@ -1,4 +1,4 @@
import * as JSData from 'js-data';
interface IUser {
+5 -5
View File
@@ -5,7 +5,9 @@
/// <reference types="js-data" />
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;
+2 -1
View File
@@ -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();
+1 -4
View File
@@ -344,7 +344,4 @@ declare var JSData:{
DSErrors: JSData.DSErrors;
};
//Support node require
declare module 'js-data' {
export = JSData;
}
export = JSData;
+1 -1
View File
@@ -505,7 +505,7 @@ interface MyResourceDefinition {
}
namespace JSData {
namespace MyJSData {
interface DS {
+32 -28
View File
@@ -6,41 +6,45 @@
/// <reference types="angularjs" />
/// <reference types="fb" />
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<string>): IFacebookProvider;
getPermissions(): string;
setVersion(version: string): IFacebookProvider;
getVersion(): string;
setCustomInit(customInit: FBInitParams): IFacebookProvider;
getCustomInit(): FBInitParams;
}
setPermissions(permissions: string | Array<string>): IFacebookProvider;
getPermissions(): string;
interface IFacebookService {
config<T extends string|number|FBInitParams>(property: string): T;
init(): void;
setCustomInit(customInit: FBInitParams): IFacebookProvider;
getCustomInit(): FBInitParams;
}
setCache<T>(attr: string, val: T): void;
getCache<T>(attr: string): T;
clearCache(): void;
interface IFacebookService {
config<T extends string | number | FBInitParams>(property: string): T;
init(): void;
isConnected(): boolean;
getAuthResponse(): {};
getLoginStatus(force?: boolean): angular.IPromise<{}>;
login(permissions?: string, rerequest?: boolean): angular.IPromise<{}>;
logout(): angular.IPromise<void>;
setCache<T>(attr: string, val: T): void;
getCache<T>(attr: string): T;
clearCache(): void;
ui(params: FBUIParams): angular.IPromise<any>;
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<void>;
cachedApi(path: string): angular.IPromise<any>;
ui(params: FBUIParams): angular.IPromise<any>;
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<any>;
}
}
}
+8 -4
View File
@@ -5,8 +5,12 @@
/// <reference types="flowjs" />
/// <reference types="angularjs" />
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;
}
}
}
+22 -18
View File
@@ -3,26 +3,30 @@
// Definitions by: Luke Forder <https://github.com/LukeForder>
// 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;
}
}
}
+17 -14
View File
@@ -3,25 +3,28 @@
// Definitions by: Jakub Pistek <https://github.com/kubiq>
// 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<T>(key: string): T;
set<T>(key: string, value: T): T;
}
get<T>(key: string): T;
set<T>(key: string, value: T): T;
}
export interface IStorageProvider extends angular.IServiceProvider {
export interface IStorageProvider extends angular.IServiceProvider {
get<T>(key:string): T;
set<T>(key:string, value:T): T;
get<T>(key: string): T;
set<T>(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;
}
}
}
-4
View File
@@ -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,
+120 -119
View File
@@ -5,135 +5,136 @@
/// <reference types="angularjs" />
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<any>;
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<any>;
/**
* 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<any>;
/**
* 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<any>;
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 <head> 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 <head> 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.
+1 -1
View File
@@ -1,4 +1,4 @@
import oc = require('oclazyload');
angular.module('app', ['oc.lazyLoad']).config(['$ocLazyLoadProvider', function ($ocLazyLoadProvider: oc.ILazyLoadProvider) {
$ocLazyLoadProvider.config({
+2 -2
View File
@@ -5,8 +5,8 @@
/// <reference types="node" />
declare var parseTorrentStatic:ParseTorrent.StaticInstance;
export = parseTorrentStatic;
declare var ParseTorrent:ParseTorrent.StaticInstance;
export = ParseTorrent;
declare namespace ParseTorrent {
export interface ParsedTorrent {
+52 -51
View File
@@ -6,60 +6,61 @@
/// <reference types="node" />
/// <reference types="Q" />
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<string>;
// 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<string>;
// 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 {
+3 -1
View File
@@ -4,7 +4,9 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="pixi.js" />
declare namespace PIXI {
import * as PIXI from 'pixi.js';
declare module 'pixi.js' {
export module spine {
+1 -1
View File
@@ -46,7 +46,7 @@ pg.connect(conString)
buffer: true
}).promise.then(
function (result) { console.log(result.rows.length + " rows returned"); },
function (err) { console.error("Error running query", err); throw err; },
function (err): void { console.error("Error running query", err); throw err; },
function (user: any) {} // called for each returned row
).finally(done);
}).done();
+3 -1
View File
@@ -5,9 +5,11 @@
/// <reference types="Q" />
import * as q from 'q';
export = Q;
declare namespace Q {
declare module 'Q' {
export interface IRetryOptions {
limit?: number;
interval?: number;
+3 -1
View File
@@ -6,6 +6,8 @@
/// <reference types="react"/>
/// <reference types="cropperjs"/>
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<HTMLImageElement>;
declare class ReactCropper extends React.Component<ReactCropperProps, {}> implements cropperjs.Cropper {
declare class ReactCropper extends React.Component<ReactCropperProps, {}> implements cropperjs {
/**
* Show the crop box manually.
+1
View File
@@ -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 {
+1 -1
View File
@@ -1,4 +1,4 @@
import * as RedisSMQ from 'rsmq';
import RSMQWorker = require('rsmq-worker');
var worker: RSMQWorker.Client;
+2 -2
View File
@@ -86,6 +86,6 @@ interface ClientOptions {
ns?: string;
}
declare var rsmq: RedisSMQStatic;
export = rsmq;
declare var RedisSMQ: RedisSMQStatic;
export = RedisSMQ;
+75 -72
View File
@@ -6,80 +6,83 @@
/// <reference types="chai" />
/// <reference types="sinon" />
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;
+1 -1
View File
@@ -1,4 +1,4 @@
import Sinon = require('sinon');
import chai = require('chai');
import sinonChai = require('sinon-chai');
+5
View File
@@ -14,6 +14,11 @@
* var chrome = <typeof SinonChrome> <any> window.chrome;
* chrome.storage.onChanged.trigger(...);
*/
import * as Sinon from 'sinon';
export = SinonChrome;
export as namespace SinonChrome;
declare namespace SinonChrome {
/**
* Flush cache
+2
View File
@@ -1,3 +1,5 @@
import * as sinon from 'sinon';
import SinonChrome = require("sinon-chrome");
var chromeStub = <typeof SinonChrome> <any> window.chrome;
// Examples taken from https://github.com/vitalets/sinon-chrome:
+3 -1
View File
@@ -5,7 +5,7 @@
/// <reference types="sinon"/>
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 {};
@@ -1,3 +1,4 @@
import * as sinon from 'sinon';
function testResolve() {
var promise = sinon.stub().returnsPromise();
promise.resolves('test val');
+2 -3
View File
@@ -428,7 +428,6 @@ declare namespace Sinon {
}
}
declare var sinon: Sinon.SinonStatic;
export = sinon;
declare var Sinon: Sinon.SinonStatic;
export = Sinon;
+2
View File
@@ -6,6 +6,8 @@
/// <reference types="bignum" />
/// <reference types="node" />
import * as BigNum from 'bignum';
export = SRP;
declare namespace SRP {
+1 -1
View File
@@ -9,7 +9,7 @@ declare class Thenable<T> {
then<TR>(onFulfilled: (value: T) => Thenable<TR>, onRejected?: (error: Error) => void): Thenable<TR>;
then<TR>(onFulfilled: (value: T) => TR, onRejected?: (error: Error) => void): Thenable<TR>;
then<TR>(onFulfilled: (value: T) => TR, onRejected?: (error: Error) => TR): Thenable<TR>;
catch(onRejected: (error: Error) => T): Thenable<T>;
catch(onRejected: (error: Error) => void): Thenable<T>;
}
interface NodeCallback<T> {
+2
View File
@@ -6,6 +6,8 @@
/// <reference types="node" />
/// <reference types="parse-torrent" />
import ParseTorrent = require("parse-torrent");
declare var webTorrentStatic:WebTorrent.ClientConstructor;
export = webTorrentStatic;
export as namespace WebTorrent;