From 48daae658413eb91583765fef12d7b9f87b5f441 Mon Sep 17 00:00:00 2001 From: CodySchaaf Date: Wed, 17 Jun 2015 16:24:32 -0700 Subject: [PATCH] Adds angular-animateCss definitions Re-adds deprecated ICookieStoreService since it can still be used...for now. Allow validators viewValue be an object, not just string. --- angularjs/angular-animate.d.ts | 155 ++++++++++++++++++++++++++++----- angularjs/angular-cookies.d.ts | 45 +++++++--- angularjs/angular.d.ts | 68 ++++++++------- 3 files changed, 207 insertions(+), 61 deletions(-) diff --git a/angularjs/angular-animate.d.ts b/angularjs/angular-animate.d.ts index 3ecc95b5b7..1ecc3d0d76 100644 --- a/angularjs/angular-animate.d.ts +++ b/angularjs/angular-animate.d.ts @@ -1,6 +1,6 @@ // Type definitions for Angular JS 1.3 (ngAnimate module) // Project: http://angularjs.org -// Definitions by: Michel Salib , Adi Dahiya , Raphael Schweizer +// Definitions by: Michel Salib , Adi Dahiya , Raphael Schweizer , Cody Schaaf // Definitions: https://github.com/borisyankov/DefinitelyTyped /// @@ -10,15 +10,22 @@ declare module "angular-animate" { export = _; } -/////////////////////////////////////////////////////////////////////////////// -// ngAnimate module (angular-animate.js) -/////////////////////////////////////////////////////////////////////////////// +/** + * ngAnimate module (angular-animate.js) + */ declare module angular.animate { + interface IAnimateFactory extends Function { + enter?: (element: ng.IAugmentedJQuery, doneFn: Function) => IAnimateCssRunner|void; + leave?: (element: ng.IAugmentedJQuery, doneFn: Function) => IAnimateCssRunner|void; + addClass?: (element: ng.IAugmentedJQuery, className: string, doneFn: Function) => IAnimateCssRunner|void; + removeClass?: (element: ng.IAugmentedJQuery, className: string, doneFn: Function) => IAnimateCssRunner|void; + setClass?: (element: ng.IAugmentedJQuery, className: string, doneFn: Function) => IAnimateCssRunner|void; + } - /////////////////////////////////////////////////////////////////////////// - // AnimateService - // see http://docs.angularjs.org/api/ngAnimate/service/$animate - /////////////////////////////////////////////////////////////////////////// + /** + * AnimateService + * see http://docs.angularjs.org/api/ngAnimate/service/$animate + */ interface IAnimateService extends angular.IAnimateService { /** * Globally enables / disables animations. @@ -113,10 +120,10 @@ declare module angular.animate { cancel(animationPromise: IPromise): void; } - /////////////////////////////////////////////////////////////////////////// - // AngularProvider - // see http://docs.angularjs.org/api/ngAnimate/provider/$animateProvider - /////////////////////////////////////////////////////////////////////////// + /** + * AngularProvider + * see http://docs.angularjs.org/api/ngAnimate/provider/$animateProvider + */ interface IAnimateProvider { /** * Registers a new injectable animation factory function. @@ -135,12 +142,120 @@ declare module angular.animate { classNameFilter(expression?: RegExp): RegExp; } - /////////////////////////////////////////////////////////////////////////// - // Angular Animation Options - // see https://docs.angularjs.org/api/ngAnimate/#applying-directive-specific-styles-to-an-animation - /////////////////////////////////////////////////////////////////////////// - interface IAnimationOptions { - to?: Object; - from?: Object; - } + /** + * Angular Animation Options + * see https://docs.angularjs.org/api/ngAnimate/#applying-directive-specific-styles-to-an-animation + */ + interface IAnimationOptions { + /** + * The ending CSS styles (a key/value object) that will be applied across the animation via a CSS transition. + */ + to?: Object; + + /** + * The starting CSS styles (a key/value object) that will be applied at the start of the animation. + */ + from?: Object; + + /** + * The DOM event (e.g. enter, leave, move). When used, a generated CSS class of ng-EVENT and + * ng-EVENT-active will be applied to the element during the animation. Multiple events can be provided when + * spaces are used as a separator. (Note that this will not perform any DOM operation.) + */ + event?: string; + + /** + * The CSS easing value that will be applied to the transition or keyframe animation (or both). + */ + easing?: string; + + /** + * The raw CSS transition style that will be used (e.g. 1s linear all). + */ + transition?: string; + + /** + * The raw CSS keyframe animation style that will be used (e.g. 1s my_animation linear). + */ + keyframe?: string; + + /** + * A space separated list of CSS classes that will be added to the element and spread across the animation. + */ + addClass?: string; + + /** + * A space separated list of CSS classes that will be removed from the element and spread across + * the animation. + */ + removeClass?: string; + + /** + * A number value representing the total duration of the transition and/or keyframe (note that a value + * of 1 is 1000ms). If a value of 0 is provided then the animation will be skipped entirely. + */ + duration?: number; + + /** + * A number value representing the total delay of the transition and/or keyframe (note that a value of + * 1 is 1000ms). If a value of true is used then whatever delay value is detected from the CSS classes will be + * mirrored on the elements styles (e.g. by setting delay true then the style value of the element will be + * transition-delay: DETECTED_VALUE). Using true is useful when you want the CSS classes and inline styles to + * all share the same CSS delay value. + */ + delay?: number; + + /** + * A numeric time value representing the delay between successively animated elements (Click here to + * learn how CSS-based staggering works in ngAnimate.) + */ + stagger?: number; + + /** + * The numeric index representing the stagger item (e.g. a value of 5 is equal to the sixth item + * in the stagger; therefore when a stagger option value of 0.1 is used then there will be a stagger delay of 600ms) + * applyClassesEarly - Whether or not the classes being added or removed will be used when detecting the animation. + * This is set by $animate when enter/leave/move animations are fired to ensure that the CSS classes are resolved in time. + * (Note that this will prevent any transitions from occuring on the classes being added and removed.) + */ + staggerIndex?: number; + } + + interface IAnimateCssRunner { + /** + * Starts the animation + * + * @returns The animation runner with a done function for supplying a callback. + */ + start(): IAnimateCssRunnerStart; + + /** + * Ends (aborts) the animation + */ + end(): void; + } + + interface IAnimateCssRunnerStart extends IPromise { + /** + * Allows you to add done callbacks to the running animation + * + * @param callbackFn: the callback function to be run + */ + done(callbackFn: (animationFinished: boolean) => void): void; + } + + /** + * AnimateCssService + * see http://docs.angularjs.org/api/ngAnimate/service/$animateCss + */ + interface IAnimateCssService { + (element: JQuery, animateCssOptions: IAnimationOptions): IAnimateCssRunner; + } + +} + +declare module angular { + interface IModule { + animate(cssSelector: string, animateFactory: angular.animate.IAnimateFactory): IModule; + } } diff --git a/angularjs/angular-cookies.d.ts b/angularjs/angular-cookies.d.ts index cdea69d369..e34518b8ab 100644 --- a/angularjs/angular-cookies.d.ts +++ b/angularjs/angular-cookies.d.ts @@ -11,23 +11,23 @@ declare module "angular-cookies" { export = _; } -/////////////////////////////////////////////////////////////////////////////// -// ngCookies module (angular-cookies.js) -/////////////////////////////////////////////////////////////////////////////// +/** + * ngCookies module (angular-cookies.js) + */ declare module angular.cookies { - /////////////////////////////////////////////////////////////////////////// - // CookieService - // see http://docs.angularjs.org/api/ngCookies.$cookies - /////////////////////////////////////////////////////////////////////////// + /** + * CookieService + * see http://docs.angularjs.org/api/ngCookies.$cookies + */ interface ICookiesService { [index: string]: any; } - /////////////////////////////////////////////////////////////////////////// - // CookieStoreService - // see http://docs.angularjs.org/api/ngCookies.$cookieStore - /////////////////////////////////////////////////////////////////////////// + /** + * CookieStoreService + * see http://docs.angularjs.org/api/ngCookies.$cookieStore + */ interface ICookiesService { get(key: string): string; getObject(key: string): any; @@ -37,4 +37,27 @@ declare module angular.cookies { remove(key: string, options?: any): void; } + /** + * CookieStoreService DEPRECATED + * see https://code.angularjs.org/1.2.26/docs/api/ngCookies/service/$cookieStore + */ + interface ICookieStoreService { + /** + * Returns the value of given cookie key + * @param key Id to use for lookup + */ + get(key: string): any; + /** + * Sets a value for given cookie key + * @param key Id for the value + * @param value Value to be stored + */ + put(key: string, value: any): void; + /** + * Remove given cookie + * @param key Id of the key-value pair to delete + */ + remove(key: string): void; + } + } diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index c7c90efe55..8906432985 100755 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -249,12 +249,12 @@ declare module angular { isString(value: any): boolean; isUndefined(value: any): boolean; lowercase(str: string): string; - + /** * Deeply extends the destination object dst by copying own enumerable properties from the src object(s) to dst. You can specify multiple src objects. If you want to preserve original objects, you can do so by passing an empty object as the target: var object = angular.merge({}, object1, object2). - * + * * Unlike extend(), merge() recursively descends into object properties of source objects, performing a deep copy. - * + * * @param dst Destination object. * @param src Source object(s). */ @@ -524,11 +524,14 @@ declare module angular { } interface IModelValidators { - [index: string]: (modelValue: any, viewValue: string) => boolean; + /** + * viewValue is any because it can be an object that is called in the view like $viewValue.name:$viewValue.subName + */ + [index: string]: (modelValue: any, viewValue: any) => boolean; } interface IAsyncModelValidators { - [index: string]: (modelValue: any, viewValue: string) => IPromise; + [index: string]: (modelValue: any, viewValue: any) => IPromise; } interface IModelParser { @@ -560,11 +563,11 @@ declare module angular { /** * Dispatches an event name downwards to all child scopes (and their children) notifying the registered $rootScope.Scope listeners. - * + * * The event life cycle starts at the scope on which $broadcast was called. All listeners listening for name event on this scope get notified. Afterwards, the event propagates to all direct and indirect scopes of the current scope and calls all registered listeners along the way. The event cannot be canceled. - * + * * Any exception emitted from the listeners will be passed onto the $exceptionHandler service. - * + * * @param name Event name to broadcast. * @param args Optional one or more arguments which will be passed onto the event listeners. */ @@ -577,7 +580,7 @@ declare module angular { * The event life cycle starts at the scope on which $emit was called. All listeners listening for name event on this scope get notified. Afterwards, the event traverses upwards toward the root scope and calls all registered listeners along the way. The event will stop propagating if one of the listeners cancels it. * * Any exception emitted from the listeners will be passed onto the $exceptionHandler service. - * + * * @param name Event name to emit. * @param args Optional one or more arguments which will be passed onto the event listeners. */ @@ -757,16 +760,16 @@ declare module angular { /** * $filter - $filterProvider - service in module ng - * + * * Filters are used for formatting data displayed to the user. - * + * * see https://docs.angularjs.org/api/ng/service/$filter */ interface IFilterService { /** * Usage: * $filter(name); - * + * * @param name Name of the filter function to retrieve */ (name: string): Function; @@ -774,15 +777,15 @@ declare module angular { /** * $filterProvider - $filter - provider in module ng - * + * * Filters are just functions which transform input to an output. However filters need to be Dependency Injected. To achieve this a filter definition consists of a factory function which is annotated with dependencies and is responsible for creating a filter function. - * + * * see https://docs.angularjs.org/api/ng/provider/$filterProvider */ interface IFilterProvider extends IServiceProvider { /** * register(name); - * + * * @param name Name of the filter function, or an object map of filters where the keys are the filter names and the values are the filter factories. Note: Filter names must be valid angular Expressions identifiers, such as uppercase or orderBy. Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace your filters, then you can use capitalization (myappSubsectionFilterx) or underscores (myapp_subsection_filterx). */ register(name: string | {}): IServiceProvider; @@ -1033,10 +1036,10 @@ declare module angular { interface IPromise { /** * Regardless of when the promise was or will be resolved or rejected, then calls one of the success or error callbacks asynchronously as soon as the result is available. The callbacks are called with a single argument: the result or rejection reason. Additionally, the notify callback may be called zero or more times to provide a progress indication, before the promise is resolved or rejected. - * + * The successCallBack may return IPromise for when a $q.reject() needs to be returned * This method returns a new promise which is resolved or rejected via the return value of the successCallback, errorCallback. It also notifies via the return value of the notifyCallback method. The promise can not be resolved or rejected from the notifyCallback method. */ - then(successCallback: (promiseValue: T) => IHttpPromise|IPromise|TResult, errorCallback?: (reason: any) => any, notifyCallback?: (state: any) => any): IPromise; + then(successCallback: (promiseValue: T) => IHttpPromise|IPromise|TResult|IPromise, errorCallback?: (reason: any) => any, notifyCallback?: (state: any) => any): IPromise; /** * Shorthand for promise.then(null, errorCallback) @@ -1074,31 +1077,31 @@ declare module angular { /** * $cacheFactory - service in module ng - * + * * Factory that constructs Cache objects and gives access to them. - * + * * see https://docs.angularjs.org/api/ng/service/$cacheFactory */ interface ICacheFactoryService { /** * Factory that constructs Cache objects and gives access to them. - * + * * @param cacheId Name or id of the newly created cache. * @param optionsMap Options object that specifies the cache behavior. Properties: - * + * * capacity — turns the cache into LRU cache. */ (cacheId: string, optionsMap?: { capacity?: number; }): ICacheObject; /** - * Get information about all the caches that have been created. + * Get information about all the caches that have been created. * @returns key-value map of cacheId to the result of calling cache#info */ info(): any; /** * Get access to a cache object by the cacheId used when it was created. - * + * * @param cacheId Name or id of a cache to access. */ get(cacheId: string): ICacheObject; @@ -1106,9 +1109,9 @@ declare module angular { /** * $cacheFactory.Cache - type in module ng - * + * * A cache object used to store and retrieve data, primarily used by $http and the script directive to cache templates and other data. - * + * * see https://docs.angularjs.org/api/ng/type/$cacheFactory.Cache */ interface ICacheObject { @@ -1131,9 +1134,9 @@ declare module angular { /** * Inserts a named entry into the Cache object to be retrieved later, and incrementing the size of the cache if the key was not already present in the cache. If behaving like an LRU cache, it will also remove stale entries from the set. - * + * * It will not insert undefined values into the cache. - * + * * @param key the key under which the cached data is stored. * @param value the value to store alongside the key. If it is undefined, the key will not be stored. */ @@ -1141,14 +1144,14 @@ declare module angular { /** * Retrieves named data stored in the Cache object. - * + * * @param key the key of the data to be retrieved */ get(key: string): any; /** * Removes an entry from the Cache object. - * + * * @param key the key of the entry to be removed */ remove(key: string): void; @@ -1163,7 +1166,7 @@ declare module angular { */ destroy(): void; } - + /////////////////////////////////////////////////////////////////////////// // CompileService // see http://docs.angularjs.org/api/ng.$compile @@ -1416,6 +1419,11 @@ declare module angular { */ interface IHttpProviderDefaults { cache?: boolean; + /** + * Transform function or an array of such functions. The transform function takes the http request body and + * headers and returns its transformed (typically serialized) version. + */ + transformRequest?: ((data: any, headersGetter?: any) => any)|((data: any, headersGetter?: any) => any)[]; xsrfCookieName?: string; xsrfHeaderName?: string; withCredentials?: boolean;