From 4e78cb2eddc44072c291c22f184f5438fdb88aa9 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Mon, 18 Jul 2016 15:36:53 -0700 Subject: [PATCH] Angular sub packages (#10170) * move angular-animate.d.ts to its own folder * Make angular-animate a module, and use module augmentation to update the angular module * Move angular-cookies.d.ts to its own folder * Make angular-cookies a module, and use module augmentation to update the angular module * Remove outdated readme * Move angular-mocks.d.ts to its own folder * Make angular-mocks a module, and use module augmentation to update the angular module * Move angular-resource.d.ts to its own folder * Make angular-resource a module, and use module augmentation to update the angular module * Move angular-route.d.ts to its own folder * Make angular-route a module, and use module augmentation to update the angular module * Move angular-santize.d.ts to its own folder * Make angular-sanitize a module, and use module augmentation to update the angular module --- angular-animate/index.d.ts | 298 ++++++++++++++++++ angular-animate/tsconfig.json | 18 ++ angular-cookies/index.d.ts | 90 ++++++ angular-cookies/tsconfig.json | 18 ++ .../angular-mocks-tests.ts | 1 - .../index.d.ts | 18 +- angular-mocks/mocks.d.ts | 14 + angular-mocks/tsconfig.json | 20 ++ .../angular-resource-tests.ts | 2 - angular-resource/index.d.ts | 192 +++++++++++ angular-resource/tsconfig.json | 19 ++ .../angular-route-tests.ts | 2 - angular-route/index.d.ts | 157 +++++++++ angular-route/tsconfig.json | 19 ++ .../angular-sanitize-tests.ts | 2 - angular-sanitize/index.d.ts | 38 +++ angular-sanitize/tsconfig.json | 19 ++ angular/angular-animate.d.ts | 298 ------------------ angular/angular-cookies.d.ts | 90 ------ angular/angular-resource.d.ts | 195 ------------ angular/angular-route.d.ts | 158 ---------- angular/angular-sanitize.d.ts | 39 --- angular/index.d.ts | 2 - 23 files changed, 905 insertions(+), 804 deletions(-) create mode 100644 angular-animate/index.d.ts create mode 100644 angular-animate/tsconfig.json create mode 100644 angular-cookies/index.d.ts create mode 100644 angular-cookies/tsconfig.json rename {angular => angular-mocks}/angular-mocks-tests.ts (99%) rename angular/angular-mocks.d.ts => angular-mocks/index.d.ts (98%) create mode 100644 angular-mocks/mocks.d.ts create mode 100644 angular-mocks/tsconfig.json rename {angular => angular-resource}/angular-resource-tests.ts (99%) create mode 100644 angular-resource/index.d.ts create mode 100644 angular-resource/tsconfig.json rename {angular => angular-route}/angular-route-tests.ts (99%) create mode 100644 angular-route/index.d.ts create mode 100644 angular-route/tsconfig.json rename {angular => angular-sanitize}/angular-sanitize-tests.ts (99%) create mode 100644 angular-sanitize/index.d.ts create mode 100644 angular-sanitize/tsconfig.json delete mode 100644 angular/angular-animate.d.ts delete mode 100644 angular/angular-cookies.d.ts delete mode 100644 angular/angular-resource.d.ts delete mode 100644 angular/angular-route.d.ts delete mode 100644 angular/angular-sanitize.d.ts diff --git a/angular-animate/index.d.ts b/angular-animate/index.d.ts new file mode 100644 index 00000000000000..e13c4e8835aed4 --- /dev/null +++ b/angular-animate/index.d.ts @@ -0,0 +1,298 @@ +// Type definitions for Angular JS 1.5 (ngAnimate module) +// Project: http://angularjs.org +// Definitions by: Michel Salib , Adi Dahiya , Raphael Schweizer , Cody Schaaf +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare var _: string; +export = _; + +import * as angular from 'angular'; + +declare module 'angular' { + /** + * ngAnimate module (angular-animate.js) + */ + namespace animate { + interface IAnimateFactory { + (...args: any[]): IAnimateCallbackObject; + } + + interface IAnimateCallbackObject { + eventFn?: (element: IAugmentedJQuery, doneFunction: Function, options: IAnimationOptions) => any; + setClass?: (element: IAugmentedJQuery, addedClasses: string, removedClasses: string, doneFunction: Function, options: IAnimationOptions) => any; + addClass?: (element: IAugmentedJQuery, addedClasses: string, doneFunction: Function, options: IAnimationOptions) => any; + removeClass?: (element: IAugmentedJQuery, removedClasses: string, doneFunction: Function, options: IAnimationOptions) => any; + enter?: (element: IAugmentedJQuery, doneFunction: Function, options: IAnimationOptions) => any; + leave?: (element: IAugmentedJQuery, doneFunction: Function, options: IAnimationOptions) => any; + move?: (element: IAugmentedJQuery, doneFunction: Function, options: IAnimationOptions) => any; + animate?: (element: IAugmentedJQuery, fromStyles: string, toStyles: string, doneFunction: Function, options: IAnimationOptions) => any; + } + + interface IAnimationPromise extends IPromise { } + + /** + * AnimateService + * see http://docs.angularjs.org/api/ngAnimate/service/$animate + */ + interface IAnimateService { + /** + * Sets up an event listener to fire whenever the animation event has fired on the given element or among any of its children. + * + * @param event the animation event that will be captured (e.g. enter, leave, move, addClass, removeClass, etc...) + * @param container the container element that will capture each of the animation events that are fired on itself as well as among its children + * @param callback the callback function that will be fired when the listener is triggered + */ + on(event: string, container: JQuery, callback: Function): void; + + /** + * Deregisters an event listener based on the event which has been associated with the provided element. + * + * @param event the animation event (e.g. enter, leave, move, addClass, removeClass, etc...) + * @param container the container element the event listener was placed on + * @param callback the callback function that was registered as the listener + */ + off(event: string, container?: JQuery, callback?: Function): void; + + /** + * Associates the provided element with a host parent element to allow the element to be animated even if it exists outside of the DOM structure of the Angular application. + * + * @param element the external element that will be pinned + * @param parentElement the host parent element that will be associated with the external element + */ + pin(element: JQuery, parentElement: JQuery): void; + + /** + * Globally enables / disables animations. + * + * @param element If provided then the element will be used to represent the enable/disable operation. + * @param value If provided then set the animation on or off. + * @returns current animation state + */ + enabled(element: JQuery, value?: boolean): boolean; + enabled(value: boolean): boolean; + + /** + * Cancels the provided animation. + */ + cancel(animationPromise: IAnimationPromise): void; + + /** + * Performs an inline animation on the element. + * + * @param element the element that will be the focus of the animation + * @param from a collection of CSS styles that will be applied to the element at the start of the animation + * @param to a collection of CSS styles that the element will animate towards + * @param className an optional CSS class that will be added to the element for the duration of the animation (the default class is 'ng-inline-animate') + * @param options an optional collection of styles that will be picked up by the CSS transition/animation + * @returns the animation callback promise + */ + animate(element: JQuery, from: any, to: any, className?: string, options?: IAnimationOptions): IAnimationPromise; + + /** + * Appends the element to the parentElement element that resides in the document and then runs the enter animation. + * + * @param element the element that will be the focus of the enter animation + * @param parentElement the parent element of the element that will be the focus of the enter animation + * @param afterElement the sibling element (which is the previous element) of the element that will be the focus of the enter animation + * @param options an optional collection of styles that will be picked up by the CSS transition/animation + * @returns the animation callback promise + */ + enter(element: JQuery, parentElement: JQuery, afterElement?: JQuery, options?: IAnimationOptions): IAnimationPromise; + + /** + * Runs the leave animation operation and, upon completion, removes the element from the DOM. + * + * @param element the element that will be the focus of the leave animation + * @param options an optional collection of styles that will be picked up by the CSS transition/animation + * @returns the animation callback promise + */ + leave(element: JQuery, options?: IAnimationOptions): IAnimationPromise; + + /** + * Fires the move DOM operation. Just before the animation starts, the animate service will either append + * it into the parentElement container or add the element directly after the afterElement element if present. + * Then the move animation will be run. + * + * @param element the element that will be the focus of the move animation + * @param parentElement the parent element of the element that will be the focus of the move animation + * @param afterElement the sibling element (which is the previous element) of the element that will be the focus of the move animation + * @returns the animation callback promise + */ + move(element: JQuery, parentElement: JQuery, afterElement?: JQuery): IAnimationPromise; + + /** + * Triggers a custom animation event based off the className variable and then attaches the className + * value to the element as a CSS class. + * + * @param element the element that will be animated + * @param className the CSS class that will be added to the element and then animated + * @param options an optional collection of styles that will be picked up by the CSS transition/animation + * @returns the animation callback promise + */ + addClass(element: JQuery, className: string, options?: IAnimationOptions): IAnimationPromise; + + /** + * Triggers a custom animation event based off the className variable and then removes the CSS class + * provided by the className value from the element. + * + * @param element the element that will be animated + * @param className the CSS class that will be animated and then removed from the element + * @param options an optional collection of styles that will be picked up by the CSS transition/animation + * @returns the animation callback promise + */ + removeClass(element: JQuery, className: string, options?: IAnimationOptions): IAnimationPromise; + + /** + * Adds and/or removes the given CSS classes to and from the element. Once complete, the done() callback + * will be fired (if provided). + * + * @param element the element which will have its CSS classes changed removed from it + * @param add the CSS classes which will be added to the element + * @param remove the CSS class which will be removed from the element CSS classes have been set on the element + * @param options an optional collection of styles that will be picked up by the CSS transition/animation + * @returns the animation callback promise + */ + setClass(element: JQuery, add: string, remove: string, options?: IAnimationOptions): IAnimationPromise; + } + + /** + * AnimateProvider + * see http://docs.angularjs.org/api/ngAnimate/provider/$animateProvider + */ + interface IAnimateProvider { + /** + * Registers a new injectable animation factory function. + * + * @param name The name of the animation. + * @param factory The factory function that will be executed to return the animation object. + */ + register(name: string, factory: IAnimateFactory): void; + + /** + * Gets and/or sets the CSS class expression that is checked when performing an animation. + * + * @param expression The className expression which will be checked against all animations. + * @returns The current CSS className expression value. If null then there is no expression value. + */ + classNameFilter(expression?: RegExp): RegExp; + } + + /** + * 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; + } + } + + interface IModule { + animation(name: string, animationFactory: angular.animate.IAnimateFactory): IModule; + animation(name: string, inlineAnnotatedFunction: any[]): IModule; + animation(object: Object): IModule; + } +} \ No newline at end of file diff --git a/angular-animate/tsconfig.json b/angular-animate/tsconfig.json new file mode 100644 index 00000000000000..81f1a4a3643739 --- /dev/null +++ b/angular-animate/tsconfig.json @@ -0,0 +1,18 @@ +{ + "files": [ + "index.d.ts" + ], + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": false + } +} \ No newline at end of file diff --git a/angular-cookies/index.d.ts b/angular-cookies/index.d.ts new file mode 100644 index 00000000000000..ad28d2bdfe8a6d --- /dev/null +++ b/angular-cookies/index.d.ts @@ -0,0 +1,90 @@ +// Type definitions for Angular JS 1.4 (ngCookies module) +// Project: http://angularjs.org +// Definitions by: Diego Vilar , Anthony Ciccarello +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare var _: string; +export = _; + +import * as angular from 'angular'; + +declare module 'angular' { + + /** + * ngCookies module (angular-cookies.js) + */ + namespace cookies { + + /** + * Cookies options + * see https://docs.angularjs.org/api/ngCookies/provider/$cookiesProvider#defaults + */ + interface ICookiesOptions { + /** + * The cookie will be available only for this path and its sub-paths. + * By default, this would be the URL that appears in your base tag. + */ + path?: string; + /** + * The cookie will be available only for this domain and its sub-domains. + * For obvious security reasons the user agent will not accept the cookie if the + * current domain is not a sub domain or equals to the requested domain. + */ + domain?: string; + /** + * String of the form "Wdy, DD Mon YYYY HH:MM:SS GMT" or a Date object + * indicating the exact date/time this cookie will expire. + */ + expires?: string | Date; + /** + * The cookie will be available only in secured connection. + */ + secure?: boolean; + } + + /** + * CookieService + * see http://docs.angularjs.org/api/ngCookies.$cookies + */ + interface ICookiesService { + [index: string]: any; + } + + /** + * CookieStoreService + * see http://docs.angularjs.org/api/ngCookies.$cookieStore + */ + interface ICookiesService { + get(key: string): string; + getObject(key: string): any; + getObject(key: string): T; + getAll(): any; + put(key: string, value: string, options?: ICookiesOptions): void; + putObject(key: string, value: any, options?: ICookiesOptions): void; + remove(key: string, options?: ICookiesOptions): 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; + } + } +} \ No newline at end of file diff --git a/angular-cookies/tsconfig.json b/angular-cookies/tsconfig.json new file mode 100644 index 00000000000000..81f1a4a3643739 --- /dev/null +++ b/angular-cookies/tsconfig.json @@ -0,0 +1,18 @@ +{ + "files": [ + "index.d.ts" + ], + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": false + } +} \ No newline at end of file diff --git a/angular/angular-mocks-tests.ts b/angular-mocks/angular-mocks-tests.ts similarity index 99% rename from angular/angular-mocks-tests.ts rename to angular-mocks/angular-mocks-tests.ts index fd925016c22c1e..c817cfd779df7b 100644 --- a/angular/angular-mocks-tests.ts +++ b/angular-mocks/angular-mocks-tests.ts @@ -1,5 +1,4 @@ - /////////////////////////////////////// // IAngularStatic /////////////////////////////////////// diff --git a/angular/angular-mocks.d.ts b/angular-mocks/index.d.ts similarity index 98% rename from angular/angular-mocks.d.ts rename to angular-mocks/index.d.ts index ae3d1252f5bf68..6ea8f9db8eb09d 100644 --- a/angular/angular-mocks.d.ts +++ b/angular-mocks/index.d.ts @@ -3,22 +3,10 @@ // Definitions by: Diego Vilar , Tony Curtis // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -import * as angular from 'angular'; - -declare module "angular-mocks/ngMock" { - var _: string; - export = _; -} +/// +/// -declare module "angular-mocks/ngMockE2E" { - var _: string; - export = _; -} - -declare module "angular-mocks/ngAnimateMock" { - var _: string; - export = _; -} +import * as angular from 'angular'; /////////////////////////////////////////////////////////////////////////////// // ngMock module (angular-mocks.js) diff --git a/angular-mocks/mocks.d.ts b/angular-mocks/mocks.d.ts new file mode 100644 index 00000000000000..17c077008c8c82 --- /dev/null +++ b/angular-mocks/mocks.d.ts @@ -0,0 +1,14 @@ +declare module "angular-mocks/ngMock" { + var _: string; + export = _; +} + +declare module "angular-mocks/ngMockE2E" { + var _: string; + export = _; +} + +declare module "angular-mocks/ngAnimateMock" { + var _: string; + export = _; +} \ No newline at end of file diff --git a/angular-mocks/tsconfig.json b/angular-mocks/tsconfig.json new file mode 100644 index 00000000000000..b53af4d397cdf1 --- /dev/null +++ b/angular-mocks/tsconfig.json @@ -0,0 +1,20 @@ +{ + "files": [ + "index.d.ts", + "mocks.d.ts", + "angular-mocks-tests.ts" + ], + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": false + } +} \ No newline at end of file diff --git a/angular/angular-resource-tests.ts b/angular-resource/angular-resource-tests.ts similarity index 99% rename from angular/angular-resource-tests.ts rename to angular-resource/angular-resource-tests.ts index 3aa202d0e847ba..d2e25a72b54cdc 100644 --- a/angular/angular-resource-tests.ts +++ b/angular-resource/angular-resource-tests.ts @@ -1,6 +1,4 @@ - - import IHttpPromiseCallbackArg = angular.IHttpPromiseCallbackArg; interface IMyData {} diff --git a/angular-resource/index.d.ts b/angular-resource/index.d.ts new file mode 100644 index 00000000000000..30683ea0829797 --- /dev/null +++ b/angular-resource/index.d.ts @@ -0,0 +1,192 @@ +// Type definitions for Angular JS 1.5 (ngResource module) +// Project: http://angularjs.org +// Definitions by: Diego Vilar , Michael Jess +// Definitions: https://github.com/daptiv/DefinitelyTyped + +declare var _: string; +export = _; + +import * as angular from 'angular'; + +declare module 'angular' { + /////////////////////////////////////////////////////////////////////////////// + // ngResource module (angular-resource.js) + /////////////////////////////////////////////////////////////////////////////// + namespace resource { + /** + * Currently supported options for the $resource factory options argument. + */ + interface IResourceOptions { + /** + * If true then the trailing slashes from any calculated URL will be stripped (defaults to true) + */ + stripTrailingSlashes?: boolean; + /** + * If true, the request made by a "non-instance" call will be cancelled (if not already completed) by calling + * $cancelRequest() on the call's return value. This can be overwritten per action. (Defaults to false.) + */ + cancellable?: boolean; + } + + /////////////////////////////////////////////////////////////////////////// + // ResourceService + // see http://docs.angularjs.org/api/ngResource.$resource + // Most part of the following definitions were achieved by analyzing the + // actual implementation, since the documentation doesn't seem to cover + // that deeply. + /////////////////////////////////////////////////////////////////////////// + interface IResourceService { + (url: string, paramDefaults?: any, + /** example: {update: { method: 'PUT' }, delete: deleteDescriptor } + where deleteDescriptor : IActionDescriptor */ + actions?: any, options?: IResourceOptions): IResourceClass>; + (url: string, paramDefaults?: any, + /** example: {update: { method: 'PUT' }, delete: deleteDescriptor } + where deleteDescriptor : IActionDescriptor */ + actions?: any, options?: IResourceOptions): U; + (url: string, paramDefaults?: any, + /** example: {update: { method: 'PUT' }, delete: deleteDescriptor } + where deleteDescriptor : IActionDescriptor */ + actions?: any, options?: IResourceOptions): IResourceClass; + } + + // Just a reference to facilitate describing new actions + interface IActionDescriptor { + method: string; + params?: any; + url?: string; + isArray?: boolean; + transformRequest?: angular.IHttpRequestTransformer | angular.IHttpRequestTransformer[]; + transformResponse?: angular.IHttpResponseTransformer | angular.IHttpResponseTransformer[]; + headers?: any; + cache?: boolean | angular.ICacheObject; + /** + * Note: In contrast to $http.config, promises are not supported in $resource, because the same value + * would be used for multiple requests. If you are looking for a way to cancel requests, you should + * use the cancellable option. + */ + timeout?: number + cancellable?: boolean; + withCredentials?: boolean; + responseType?: string; + interceptor?: angular.IHttpInterceptor; + } + + // Allow specify more resource methods + // No need to add duplicates for all four overloads. + interface IResourceMethod { + (): T; + (params: Object): T; + (success: Function, error?: Function): T; + (params: Object, success: Function, error?: Function): T; + (params: Object, data: Object, success?: Function, error?: Function): T; + } + + // Allow specify resource moethod which returns the array + // No need to add duplicates for all four overloads. + interface IResourceArrayMethod { + (): IResourceArray; + (params: Object): IResourceArray; + (success: Function, error?: Function): IResourceArray; + (params: Object, success: Function, error?: Function): IResourceArray; + (params: Object, data: Object, success?: Function, error?: Function): IResourceArray; + } + + // Baseclass for everyresource with default actions. + // If you define your new actions for the resource, you will need + // to extend this interface and typecast the ResourceClass to it. + // + // In case of passing the first argument as anything but a function, + // it's gonna be considered data if the action method is POST, PUT or + // PATCH (in other words, methods with body). Otherwise, it's going + // to be considered as parameters to the request. + // https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L461-L465 + // + // Only those methods with an HTTP body do have 'data' as first parameter: + // https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L463 + // More specifically, those methods are POST, PUT and PATCH: + // https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L432 + // + // Also, static calls always return the IResource (or IResourceArray) retrieved + // https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L538-L549 + interface IResourceClass { + new (dataOrParams?: any): T; + get: IResourceMethod; + + query: IResourceArrayMethod; + + save: IResourceMethod; + + remove: IResourceMethod; + + delete: IResourceMethod; + } + + // Instance calls always return the the promise of the request which retrieved the object + // https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L538-L546 + interface IResource { + $get(): angular.IPromise; + $get(params?: Object, success?: Function, error?: Function): angular.IPromise; + $get(success: Function, error?: Function): angular.IPromise; + + $query(): angular.IPromise>; + $query(params?: Object, success?: Function, error?: Function): angular.IPromise>; + $query(success: Function, error?: Function): angular.IPromise>; + + $save(): angular.IPromise; + $save(params?: Object, success?: Function, error?: Function): angular.IPromise; + $save(success: Function, error?: Function): angular.IPromise; + + $remove(): angular.IPromise; + $remove(params?: Object, success?: Function, error?: Function): angular.IPromise; + $remove(success: Function, error?: Function): angular.IPromise; + + $delete(): angular.IPromise; + $delete(params?: Object, success?: Function, error?: Function): angular.IPromise; + $delete(success: Function, error?: Function): angular.IPromise; + + $cancelRequest(): void; + + /** the promise of the original server interaction that created this instance. **/ + $promise: angular.IPromise; + $resolved: boolean; + toJSON(): T; + } + + /** + * Really just a regular Array object with $promise and $resolve attached to it + */ + interface IResourceArray extends Array> { + /** the promise of the original server interaction that created this collection. **/ + $promise: angular.IPromise>; + $resolved: boolean; + } + + /** when creating a resource factory via IModule.factory */ + interface IResourceServiceFactoryFunction { + ($resource: angular.resource.IResourceService): IResourceClass; + >($resource: angular.resource.IResourceService): U; + } + + // IResourceServiceProvider used to configure global settings + interface IResourceServiceProvider extends angular.IServiceProvider { + + defaults: IResourceOptions; + } + + } + + /** extensions to base ng based on using angular-resource */ + interface IModule { + /** creating a resource service factory */ + factory(name: string, resourceServiceFactoryFunction: angular.resource.IResourceServiceFactoryFunction): IModule; + } +} + +declare global { + interface Array { + /** the promise of the original server interaction that created this collection. **/ + $promise: angular.IPromise>; + $resolved: boolean; + } +} diff --git a/angular-resource/tsconfig.json b/angular-resource/tsconfig.json new file mode 100644 index 00000000000000..fe51bc7293f919 --- /dev/null +++ b/angular-resource/tsconfig.json @@ -0,0 +1,19 @@ +{ + "files": [ + "index.d.ts", + "angular-resource-tests.ts" + ], + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": false + } +} \ No newline at end of file diff --git a/angular/angular-route-tests.ts b/angular-route/angular-route-tests.ts similarity index 99% rename from angular/angular-route-tests.ts rename to angular-route/angular-route-tests.ts index 0fefab51f7598b..4d596cdfdf8869 100644 --- a/angular/angular-route-tests.ts +++ b/angular-route/angular-route-tests.ts @@ -1,6 +1,4 @@ - - /** * @license HTTP Auth Interceptor Module for AngularJS * (c) 2013 Jonathan Park @ Daptiv Solutions Inc diff --git a/angular-route/index.d.ts b/angular-route/index.d.ts new file mode 100644 index 00000000000000..dc1f6507bfd075 --- /dev/null +++ b/angular-route/index.d.ts @@ -0,0 +1,157 @@ +// Type definitions for Angular JS 1.3 (ngRoute module) +// Project: http://angularjs.org +// Definitions by: Jonathan Park +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare var _: string; +export = _; + +import * as angular from 'angular'; + +declare module 'angular' { + /////////////////////////////////////////////////////////////////////////////// + // ngRoute module (angular-route.js) + /////////////////////////////////////////////////////////////////////////////// + namespace route { + /////////////////////////////////////////////////////////////////////////// + // RouteParamsService + // see http://docs.angularjs.org/api/ngRoute.$routeParams + /////////////////////////////////////////////////////////////////////////// + interface IRouteParamsService { + [key: string]: any; + } + + /////////////////////////////////////////////////////////////////////////// + // RouteService + // see http://docs.angularjs.org/api/ngRoute.$route + // see http://docs.angularjs.org/api/ngRoute.$routeProvider + /////////////////////////////////////////////////////////////////////////// + interface IRouteService { + reload(): void; + routes: any; + + // May not always be available. For instance, current will not be available + // to a controller that was not initialized as a result of a route maching. + current?: ICurrentRoute; + + /** + * Causes $route service to update the current URL, replacing current route parameters with those specified in newParams. + * Provided property names that match the route's path segment definitions will be interpolated into the + * location's path, while remaining properties will be treated as query params. + * + * @param newParams Object. mapping of URL parameter names to values + */ + updateParams(newParams: { [key: string]: string }): void; + } + + type InlineAnnotatedFunction = Function | Array + + /** + * see http://docs.angularjs.org/api/ngRoute/provider/$routeProvider#when for API documentation + */ + interface IRoute { + /** + * {(string|function()=} + * Controller fn that should be associated with newly created scope or the name of a registered controller if passed as a string. + */ + controller?: string | InlineAnnotatedFunction; + /** + * A controller alias name. If present the controller will be published to scope under the controllerAs name. + */ + controllerAs?: string; + /** + * Undocumented? + */ + name?: string; + /** + * {string=|function()=} + * Html template as a string or a function that returns an html template as a string which should be used by ngView or ngInclude directives. This property takes precedence over templateUrl. + * + * If template is a function, it will be called with the following parameters: + * + * {Array.} - route parameters extracted from the current $location.path() by applying the current route + */ + template?: string | { ($routeParams?: angular.route.IRouteParamsService): string; } + /** + * {string=|function()=} + * Path or function that returns a path to an html template that should be used by ngView. + * + * If templateUrl is a function, it will be called with the following parameters: + * + * {Array.} - route parameters extracted from the current $location.path() by applying the current route + */ + templateUrl?: string | { ($routeParams?: angular.route.IRouteParamsService): string; } + /** + * {Object.=} - An optional map of dependencies which should be injected into the controller. If any of these dependencies are promises, the router will wait for them all to be resolved or one to be rejected before the controller is instantiated. If all the promises are resolved successfully, the values of the resolved promises are injected and $routeChangeSuccess event is fired. If any of the promises are rejected the $routeChangeError event is fired. The map object is: + * + * - key - {string}: a name of a dependency to be injected into the controller. + * - factory - {string|function}: If string then it is an alias for a service. Otherwise if function, then it is injected and the return value is treated as the dependency. If the result is a promise, it is resolved before its value is injected into the controller. Be aware that ngRoute.$routeParams will still refer to the previous route within these resolve functions. Use $route.current.params to access the new route parameters, instead. + */ + resolve?: { [key: string]: any }; + /** + * {(string|function())=} + * Value to update $location path with and trigger route redirection. + * + * If redirectTo is a function, it will be called with the following parameters: + * + * - {Object.} - route parameters extracted from the current $location.path() by applying the current route templateUrl. + * - {string} - current $location.path() + * - {Object} - current $location.search() + * - The custom redirectTo function is expected to return a string which will be used to update $location.path() and $location.search(). + */ + redirectTo?: string | { ($routeParams?: angular.route.IRouteParamsService, $locationPath?: string, $locationSearch?: any): string }; + /** + * Reload route when only $location.search() or $location.hash() changes. + * + * This option defaults to true. If the option is set to false and url in the browser changes, then $routeUpdate event is broadcasted on the root scope. + */ + reloadOnSearch?: boolean; + /** + * Match routes without being case sensitive + * + * This option defaults to false. If the option is set to true, then the particular route can be matched without being case sensitive + */ + caseInsensitiveMatch?: boolean; + } + + // see http://docs.angularjs.org/api/ng.$route#current + interface ICurrentRoute extends IRoute { + locals: { + [index: string]: any; + $scope: angular.IScope; + $template: string; + }; + + params: any; + } + + interface IRouteProvider extends angular.IServiceProvider { + /** + * Match routes without being case sensitive + * + * This option defaults to false. If the option is set to true, then the particular route can be matched without being case sensitive + */ + caseInsensitiveMatch?: boolean; + /** + * Sets route definition that will be used on route change when no other route definition is matched. + * + * @params Mapping information to be assigned to $route.current. + */ + otherwise(params: IRoute): IRouteProvider; + /** + * Adds a new route definition to the $route service. + * + * @param path Route path (matched against $location.path). If $location.path contains redundant trailing slash or is missing one, the route will still match and the $location.path will be updated to add or drop the trailing slash to exactly match the route definition. + * + * - path can contain named groups starting with a colon: e.g. :name. All characters up to the next slash are matched and stored in $routeParams under the given name when the route matches. + * - path can contain named groups starting with a colon and ending with a star: e.g.:name*. All characters are eagerly stored in $routeParams under the given name when the route matches. + * - path can contain optional named groups with a question mark: e.g.:name?. + * + * For example, routes like /color/:color/largecode/:largecode*\/edit will match /color/brown/largecode/code/with/slashes/edit and extract: color: brown and largecode: code/with/slashes. + * + * @param route Mapping information to be assigned to $route.current on route match. + */ + when(path: string, route: IRoute): IRouteProvider; + } + } +} \ No newline at end of file diff --git a/angular-route/tsconfig.json b/angular-route/tsconfig.json new file mode 100644 index 00000000000000..96c224daafeb9d --- /dev/null +++ b/angular-route/tsconfig.json @@ -0,0 +1,19 @@ +{ + "files": [ + "index.d.ts", + "angular-route-tests.ts" + ], + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": false + } +} \ No newline at end of file diff --git a/angular/angular-sanitize-tests.ts b/angular-sanitize/angular-sanitize-tests.ts similarity index 99% rename from angular/angular-sanitize-tests.ts rename to angular-sanitize/angular-sanitize-tests.ts index 94bb6615ecdd3e..e002bdca377a9e 100644 --- a/angular/angular-sanitize-tests.ts +++ b/angular-sanitize/angular-sanitize-tests.ts @@ -1,5 +1,3 @@ - - var shouldBeString: string; declare var $sanitizeService: ng.sanitize.ISanitizeService; diff --git a/angular-sanitize/index.d.ts b/angular-sanitize/index.d.ts new file mode 100644 index 00000000000000..4dc09ead11c7d2 --- /dev/null +++ b/angular-sanitize/index.d.ts @@ -0,0 +1,38 @@ +// Type definitions for Angular JS 1.3 (ngSanitize module) +// Project: http://angularjs.org +// Definitions by: Diego Vilar +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare var _: string; +export = _; + +import * as angular from 'angular'; + +declare module 'angular' { + /////////////////////////////////////////////////////////////////////////////// + // ngSanitize module (angular-sanitize.js) + /////////////////////////////////////////////////////////////////////////////// + namespace sanitize { + /////////////////////////////////////////////////////////////////////////// + // SanitizeService + // see http://docs.angularjs.org/api/ngSanitize.$sanitize + /////////////////////////////////////////////////////////////////////////// + interface ISanitizeService { + (html: string): string; + } + + /////////////////////////////////////////////////////////////////////////// + // Filters included with the ngSanitize + // see https://github.com/angular/angular.js/tree/v1.2.0/src/ngSanitize/filter + /////////////////////////////////////////////////////////////////////////// + export namespace filter { + + // Finds links in text input and turns them into html links. + // Supports http/https/ftp/mailto and plain email address links. + // see http://code.angularjs.org/1.2.0/docs/api/ngSanitize.filter:linky + interface ILinky { + (text: string, target?: string): string; + } + } + } +} diff --git a/angular-sanitize/tsconfig.json b/angular-sanitize/tsconfig.json new file mode 100644 index 00000000000000..c029bece365573 --- /dev/null +++ b/angular-sanitize/tsconfig.json @@ -0,0 +1,19 @@ +{ + "files": [ + "index.d.ts", + "angular-sanitize-tests.ts" + ], + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": false + } +} \ No newline at end of file diff --git a/angular/angular-animate.d.ts b/angular/angular-animate.d.ts deleted file mode 100644 index 57eb6194054e7f..00000000000000 --- a/angular/angular-animate.d.ts +++ /dev/null @@ -1,298 +0,0 @@ -// Type definitions for Angular JS 1.5 (ngAnimate module) -// Project: http://angularjs.org -// Definitions by: Michel Salib , Adi Dahiya , Raphael Schweizer , Cody Schaaf -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - -declare module "angular-animate" { - var _: string; - export = _; -} - -/** - * ngAnimate module (angular-animate.js) - */ -declare namespace angular.animate { - interface IAnimateFactory { - (...args: any[]): IAnimateCallbackObject; - } - - interface IAnimateCallbackObject { - eventFn?: (element: IAugmentedJQuery, doneFunction: Function, options: IAnimationOptions) => any; - setClass?: (element: IAugmentedJQuery, addedClasses: string, removedClasses: string, doneFunction: Function, options: IAnimationOptions) => any; - addClass?: (element: IAugmentedJQuery, addedClasses: string, doneFunction: Function, options: IAnimationOptions) => any; - removeClass?: (element: IAugmentedJQuery, removedClasses: string, doneFunction: Function, options: IAnimationOptions) => any; - enter?: (element: IAugmentedJQuery, doneFunction: Function, options: IAnimationOptions) => any; - leave?: (element: IAugmentedJQuery, doneFunction: Function, options: IAnimationOptions) => any; - move?: (element: IAugmentedJQuery, doneFunction: Function, options: IAnimationOptions) => any; - animate?: (element: IAugmentedJQuery, fromStyles: string, toStyles: string, doneFunction: Function, options: IAnimationOptions) => any; - } - - interface IAnimationPromise extends IPromise {} - - /** - * AnimateService - * see http://docs.angularjs.org/api/ngAnimate/service/$animate - */ - interface IAnimateService { - /** - * Sets up an event listener to fire whenever the animation event has fired on the given element or among any of its children. - * - * @param event the animation event that will be captured (e.g. enter, leave, move, addClass, removeClass, etc...) - * @param container the container element that will capture each of the animation events that are fired on itself as well as among its children - * @param callback the callback function that will be fired when the listener is triggered - */ - on(event: string, container: JQuery, callback: Function): void; - - /** - * Deregisters an event listener based on the event which has been associated with the provided element. - * - * @param event the animation event (e.g. enter, leave, move, addClass, removeClass, etc...) - * @param container the container element the event listener was placed on - * @param callback the callback function that was registered as the listener - */ - off(event: string, container?: JQuery, callback?: Function): void; - - /** - * Associates the provided element with a host parent element to allow the element to be animated even if it exists outside of the DOM structure of the Angular application. - * - * @param element the external element that will be pinned - * @param parentElement the host parent element that will be associated with the external element - */ - pin(element: JQuery, parentElement: JQuery): void; - - /** - * Globally enables / disables animations. - * - * @param element If provided then the element will be used to represent the enable/disable operation. - * @param value If provided then set the animation on or off. - * @returns current animation state - */ - enabled(element: JQuery, value?: boolean): boolean; - enabled(value: boolean): boolean; - - /** - * Cancels the provided animation. - */ - cancel(animationPromise: IAnimationPromise): void; - - /** - * Performs an inline animation on the element. - * - * @param element the element that will be the focus of the animation - * @param from a collection of CSS styles that will be applied to the element at the start of the animation - * @param to a collection of CSS styles that the element will animate towards - * @param className an optional CSS class that will be added to the element for the duration of the animation (the default class is 'ng-inline-animate') - * @param options an optional collection of styles that will be picked up by the CSS transition/animation - * @returns the animation callback promise - */ - animate(element: JQuery, from: any, to: any, className?: string, options?: IAnimationOptions): IAnimationPromise; - - /** - * Appends the element to the parentElement element that resides in the document and then runs the enter animation. - * - * @param element the element that will be the focus of the enter animation - * @param parentElement the parent element of the element that will be the focus of the enter animation - * @param afterElement the sibling element (which is the previous element) of the element that will be the focus of the enter animation - * @param options an optional collection of styles that will be picked up by the CSS transition/animation - * @returns the animation callback promise - */ - enter(element: JQuery, parentElement: JQuery, afterElement?: JQuery, options?: IAnimationOptions): IAnimationPromise; - - /** - * Runs the leave animation operation and, upon completion, removes the element from the DOM. - * - * @param element the element that will be the focus of the leave animation - * @param options an optional collection of styles that will be picked up by the CSS transition/animation - * @returns the animation callback promise - */ - leave(element: JQuery, options?: IAnimationOptions): IAnimationPromise; - - /** - * Fires the move DOM operation. Just before the animation starts, the animate service will either append - * it into the parentElement container or add the element directly after the afterElement element if present. - * Then the move animation will be run. - * - * @param element the element that will be the focus of the move animation - * @param parentElement the parent element of the element that will be the focus of the move animation - * @param afterElement the sibling element (which is the previous element) of the element that will be the focus of the move animation - * @returns the animation callback promise - */ - move(element: JQuery, parentElement: JQuery, afterElement?: JQuery): IAnimationPromise; - - /** - * Triggers a custom animation event based off the className variable and then attaches the className - * value to the element as a CSS class. - * - * @param element the element that will be animated - * @param className the CSS class that will be added to the element and then animated - * @param options an optional collection of styles that will be picked up by the CSS transition/animation - * @returns the animation callback promise - */ - addClass(element: JQuery, className: string, options?: IAnimationOptions): IAnimationPromise; - - /** - * Triggers a custom animation event based off the className variable and then removes the CSS class - * provided by the className value from the element. - * - * @param element the element that will be animated - * @param className the CSS class that will be animated and then removed from the element - * @param options an optional collection of styles that will be picked up by the CSS transition/animation - * @returns the animation callback promise - */ - removeClass(element: JQuery, className: string, options?: IAnimationOptions): IAnimationPromise; - - /** - * Adds and/or removes the given CSS classes to and from the element. Once complete, the done() callback - * will be fired (if provided). - * - * @param element the element which will have its CSS classes changed removed from it - * @param add the CSS classes which will be added to the element - * @param remove the CSS class which will be removed from the element CSS classes have been set on the element - * @param options an optional collection of styles that will be picked up by the CSS transition/animation - * @returns the animation callback promise - */ - setClass(element: JQuery, add: string, remove: string, options?: IAnimationOptions): IAnimationPromise; - } - - /** - * AnimateProvider - * see http://docs.angularjs.org/api/ngAnimate/provider/$animateProvider - */ - interface IAnimateProvider { - /** - * Registers a new injectable animation factory function. - * - * @param name The name of the animation. - * @param factory The factory function that will be executed to return the animation object. - */ - register(name: string, factory: IAnimateFactory): void; - - /** - * Gets and/or sets the CSS class expression that is checked when performing an animation. - * - * @param expression The className expression which will be checked against all animations. - * @returns The current CSS className expression value. If null then there is no expression value. - */ - classNameFilter(expression?: RegExp): RegExp; - } - - /** - * 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 { - animation(name: string, animationFactory: angular.animate.IAnimateFactory): IModule; - animation(name: string, inlineAnnotatedFunction: any[]): IModule; - animation(object: Object): IModule; - } - -} diff --git a/angular/angular-cookies.d.ts b/angular/angular-cookies.d.ts deleted file mode 100644 index 1577ea6fefedba..00000000000000 --- a/angular/angular-cookies.d.ts +++ /dev/null @@ -1,90 +0,0 @@ -// Type definitions for Angular JS 1.4 (ngCookies module) -// Project: http://angularjs.org -// Definitions by: Diego Vilar , Anthony Ciccarello -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - - -declare module "angular-cookies" { - var _: string; - export = _; -} - -/** - * ngCookies module (angular-cookies.js) - */ -declare namespace angular.cookies { - - /** - * Cookies options - * see https://docs.angularjs.org/api/ngCookies/provider/$cookiesProvider#defaults - */ - interface ICookiesOptions { - /** - * The cookie will be available only for this path and its sub-paths. - * By default, this would be the URL that appears in your base tag. - */ - path?: string; - /** - * The cookie will be available only for this domain and its sub-domains. - * For obvious security reasons the user agent will not accept the cookie if the - * current domain is not a sub domain or equals to the requested domain. - */ - domain?: string; - /** - * String of the form "Wdy, DD Mon YYYY HH:MM:SS GMT" or a Date object - * indicating the exact date/time this cookie will expire. - */ - expires?: string|Date; - /** - * The cookie will be available only in secured connection. - */ - secure?: boolean; - } - - /** - * CookieService - * see http://docs.angularjs.org/api/ngCookies.$cookies - */ - interface ICookiesService { - [index: string]: any; - } - - /** - * CookieStoreService - * see http://docs.angularjs.org/api/ngCookies.$cookieStore - */ - interface ICookiesService { - get(key: string): string; - getObject(key: string): any; - getObject(key: string): T; - getAll(): any; - put(key: string, value: string, options?: ICookiesOptions): void; - putObject(key: string, value: any, options?: ICookiesOptions): void; - remove(key: string, options?: ICookiesOptions): 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/angular/angular-resource.d.ts b/angular/angular-resource.d.ts deleted file mode 100644 index bf9c8030cd6aa0..00000000000000 --- a/angular/angular-resource.d.ts +++ /dev/null @@ -1,195 +0,0 @@ -// Type definitions for Angular JS 1.5 (ngResource module) -// Project: http://angularjs.org -// Definitions by: Diego Vilar , Michael Jess -// Definitions: https://github.com/daptiv/DefinitelyTyped - - -declare module 'angular-resource' { - var _: string; - export = _; -} - -/////////////////////////////////////////////////////////////////////////////// -// ngResource module (angular-resource.js) -/////////////////////////////////////////////////////////////////////////////// -declare namespace angular.resource { - - /** - * Currently supported options for the $resource factory options argument. - */ - interface IResourceOptions { - /** - * If true then the trailing slashes from any calculated URL will be stripped (defaults to true) - */ - stripTrailingSlashes?: boolean; - /** - * If true, the request made by a "non-instance" call will be cancelled (if not already completed) by calling - * $cancelRequest() on the call's return value. This can be overwritten per action. (Defaults to false.) - */ - cancellable?: boolean; - } - - - /////////////////////////////////////////////////////////////////////////// - // ResourceService - // see http://docs.angularjs.org/api/ngResource.$resource - // Most part of the following definitions were achieved by analyzing the - // actual implementation, since the documentation doesn't seem to cover - // that deeply. - /////////////////////////////////////////////////////////////////////////// - interface IResourceService { - (url: string, paramDefaults?: any, - /** example: {update: { method: 'PUT' }, delete: deleteDescriptor } - where deleteDescriptor : IActionDescriptor */ - actions?: any, options?: IResourceOptions): IResourceClass>; - (url: string, paramDefaults?: any, - /** example: {update: { method: 'PUT' }, delete: deleteDescriptor } - where deleteDescriptor : IActionDescriptor */ - actions?: any, options?: IResourceOptions): U; - (url: string, paramDefaults?: any, - /** example: {update: { method: 'PUT' }, delete: deleteDescriptor } - where deleteDescriptor : IActionDescriptor */ - actions?: any, options?: IResourceOptions): IResourceClass; - } - - // Just a reference to facilitate describing new actions - interface IActionDescriptor { - method: string; - params?: any; - url?: string; - isArray?: boolean; - transformRequest?: angular.IHttpRequestTransformer | angular.IHttpRequestTransformer[]; - transformResponse?: angular.IHttpResponseTransformer | angular.IHttpResponseTransformer[]; - headers?: any; - cache?: boolean | angular.ICacheObject; - /** - * Note: In contrast to $http.config, promises are not supported in $resource, because the same value - * would be used for multiple requests. If you are looking for a way to cancel requests, you should - * use the cancellable option. - */ - timeout?: number - cancellable?: boolean; - withCredentials?: boolean; - responseType?: string; - interceptor?: IHttpInterceptor; - } - - // Allow specify more resource methods - // No need to add duplicates for all four overloads. - interface IResourceMethod { - (): T; - (params: Object): T; - (success: Function, error?: Function): T; - (params: Object, success: Function, error?: Function): T; - (params: Object, data: Object, success?: Function, error?: Function): T; - } - - // Allow specify resource moethod which returns the array - // No need to add duplicates for all four overloads. - interface IResourceArrayMethod { - (): IResourceArray; - (params: Object): IResourceArray; - (success: Function, error?: Function): IResourceArray; - (params: Object, success: Function, error?: Function): IResourceArray; - (params: Object, data: Object, success?: Function, error?: Function): IResourceArray; - } - - // Baseclass for everyresource with default actions. - // If you define your new actions for the resource, you will need - // to extend this interface and typecast the ResourceClass to it. - // - // In case of passing the first argument as anything but a function, - // it's gonna be considered data if the action method is POST, PUT or - // PATCH (in other words, methods with body). Otherwise, it's going - // to be considered as parameters to the request. - // https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L461-L465 - // - // Only those methods with an HTTP body do have 'data' as first parameter: - // https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L463 - // More specifically, those methods are POST, PUT and PATCH: - // https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L432 - // - // Also, static calls always return the IResource (or IResourceArray) retrieved - // https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L538-L549 - interface IResourceClass { - new(dataOrParams? : any) : T; - get: IResourceMethod; - - query: IResourceArrayMethod; - - save: IResourceMethod; - - remove: IResourceMethod; - - delete: IResourceMethod; - } - - // Instance calls always return the the promise of the request which retrieved the object - // https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L538-L546 - interface IResource { - $get(): angular.IPromise; - $get(params?: Object, success?: Function, error?: Function): angular.IPromise; - $get(success: Function, error?: Function): angular.IPromise; - - $query(): angular.IPromise>; - $query(params?: Object, success?: Function, error?: Function): angular.IPromise>; - $query(success: Function, error?: Function): angular.IPromise>; - - $save(): angular.IPromise; - $save(params?: Object, success?: Function, error?: Function): angular.IPromise; - $save(success: Function, error?: Function): angular.IPromise; - - $remove(): angular.IPromise; - $remove(params?: Object, success?: Function, error?: Function): angular.IPromise; - $remove(success: Function, error?: Function): angular.IPromise; - - $delete(): angular.IPromise; - $delete(params?: Object, success?: Function, error?: Function): angular.IPromise; - $delete(success: Function, error?: Function): angular.IPromise; - - $cancelRequest(): void; - - /** the promise of the original server interaction that created this instance. **/ - $promise : angular.IPromise; - $resolved : boolean; - toJSON(): T; - } - - /** - * Really just a regular Array object with $promise and $resolve attached to it - */ - interface IResourceArray extends Array> { - /** the promise of the original server interaction that created this collection. **/ - $promise : angular.IPromise>; - $resolved : boolean; - } - - /** when creating a resource factory via IModule.factory */ - interface IResourceServiceFactoryFunction { - ($resource: angular.resource.IResourceService): IResourceClass; - >($resource: angular.resource.IResourceService): U; - } - - // IResourceServiceProvider used to configure global settings - interface IResourceServiceProvider extends angular.IServiceProvider { - - defaults: IResourceOptions; - } - -} - -/** extensions to base ng based on using angular-resource */ -declare namespace angular { - - interface IModule { - /** creating a resource service factory */ - factory(name: string, resourceServiceFactoryFunction: angular.resource.IResourceServiceFactoryFunction): IModule; - } -} - -interface Array -{ - /** the promise of the original server interaction that created this collection. **/ - $promise : angular.IPromise>; - $resolved : boolean; -} diff --git a/angular/angular-route.d.ts b/angular/angular-route.d.ts deleted file mode 100644 index 569abc9df590c0..00000000000000 --- a/angular/angular-route.d.ts +++ /dev/null @@ -1,158 +0,0 @@ -// Type definitions for Angular JS 1.3 (ngRoute module) -// Project: http://angularjs.org -// Definitions by: Jonathan Park -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - -declare module "angular-route" { - var _: string; - export = _; -} - -/////////////////////////////////////////////////////////////////////////////// -// ngRoute module (angular-route.js) -/////////////////////////////////////////////////////////////////////////////// -declare namespace angular.route { - - /////////////////////////////////////////////////////////////////////////// - // RouteParamsService - // see http://docs.angularjs.org/api/ngRoute.$routeParams - /////////////////////////////////////////////////////////////////////////// - interface IRouteParamsService { - [key: string]: any; - } - - /////////////////////////////////////////////////////////////////////////// - // RouteService - // see http://docs.angularjs.org/api/ngRoute.$route - // see http://docs.angularjs.org/api/ngRoute.$routeProvider - /////////////////////////////////////////////////////////////////////////// - interface IRouteService { - reload(): void; - routes: any; - - // May not always be available. For instance, current will not be available - // to a controller that was not initialized as a result of a route maching. - current?: ICurrentRoute; - - /** - * Causes $route service to update the current URL, replacing current route parameters with those specified in newParams. - * Provided property names that match the route's path segment definitions will be interpolated into the - * location's path, while remaining properties will be treated as query params. - * - * @param newParams Object. mapping of URL parameter names to values - */ - updateParams(newParams:{[key:string]:string}): void; - - } - - type InlineAnnotatedFunction = Function|Array - - /** - * see http://docs.angularjs.org/api/ngRoute/provider/$routeProvider#when for API documentation - */ - interface IRoute { - /** - * {(string|function()=} - * Controller fn that should be associated with newly created scope or the name of a registered controller if passed as a string. - */ - controller?: string|InlineAnnotatedFunction; - /** - * A controller alias name. If present the controller will be published to scope under the controllerAs name. - */ - controllerAs?: string; - /** - * Undocumented? - */ - name?: string; - /** - * {string=|function()=} - * Html template as a string or a function that returns an html template as a string which should be used by ngView or ngInclude directives. This property takes precedence over templateUrl. - * - * If template is a function, it will be called with the following parameters: - * - * {Array.} - route parameters extracted from the current $location.path() by applying the current route - */ - template?: string|{($routeParams?: angular.route.IRouteParamsService) : string;} - /** - * {string=|function()=} - * Path or function that returns a path to an html template that should be used by ngView. - * - * If templateUrl is a function, it will be called with the following parameters: - * - * {Array.} - route parameters extracted from the current $location.path() by applying the current route - */ - templateUrl?: string|{ ($routeParams?: angular.route.IRouteParamsService): string; } - /** - * {Object.=} - An optional map of dependencies which should be injected into the controller. If any of these dependencies are promises, the router will wait for them all to be resolved or one to be rejected before the controller is instantiated. If all the promises are resolved successfully, the values of the resolved promises are injected and $routeChangeSuccess event is fired. If any of the promises are rejected the $routeChangeError event is fired. The map object is: - * - * - key - {string}: a name of a dependency to be injected into the controller. - * - factory - {string|function}: If string then it is an alias for a service. Otherwise if function, then it is injected and the return value is treated as the dependency. If the result is a promise, it is resolved before its value is injected into the controller. Be aware that ngRoute.$routeParams will still refer to the previous route within these resolve functions. Use $route.current.params to access the new route parameters, instead. - */ - resolve?: {[key: string]: any}; - /** - * {(string|function())=} - * Value to update $location path with and trigger route redirection. - * - * If redirectTo is a function, it will be called with the following parameters: - * - * - {Object.} - route parameters extracted from the current $location.path() by applying the current route templateUrl. - * - {string} - current $location.path() - * - {Object} - current $location.search() - * - The custom redirectTo function is expected to return a string which will be used to update $location.path() and $location.search(). - */ - redirectTo?: string|{($routeParams?: angular.route.IRouteParamsService, $locationPath?: string, $locationSearch?: any) : string}; - /** - * Reload route when only $location.search() or $location.hash() changes. - * - * This option defaults to true. If the option is set to false and url in the browser changes, then $routeUpdate event is broadcasted on the root scope. - */ - reloadOnSearch?: boolean; - /** - * Match routes without being case sensitive - * - * This option defaults to false. If the option is set to true, then the particular route can be matched without being case sensitive - */ - caseInsensitiveMatch?: boolean; - } - - // see http://docs.angularjs.org/api/ng.$route#current - interface ICurrentRoute extends IRoute { - locals: { - [index: string]: any; - $scope: IScope; - $template: string; - }; - - params: any; - } - - interface IRouteProvider extends IServiceProvider { - /** - * Match routes without being case sensitive - * - * This option defaults to false. If the option is set to true, then the particular route can be matched without being case sensitive - */ - caseInsensitiveMatch?: boolean; - /** - * Sets route definition that will be used on route change when no other route definition is matched. - * - * @params Mapping information to be assigned to $route.current. - */ - otherwise(params: IRoute): IRouteProvider; - /** - * Adds a new route definition to the $route service. - * - * @param path Route path (matched against $location.path). If $location.path contains redundant trailing slash or is missing one, the route will still match and the $location.path will be updated to add or drop the trailing slash to exactly match the route definition. - * - * - path can contain named groups starting with a colon: e.g. :name. All characters up to the next slash are matched and stored in $routeParams under the given name when the route matches. - * - path can contain named groups starting with a colon and ending with a star: e.g.:name*. All characters are eagerly stored in $routeParams under the given name when the route matches. - * - path can contain optional named groups with a question mark: e.g.:name?. - * - * For example, routes like /color/:color/largecode/:largecode*\/edit will match /color/brown/largecode/code/with/slashes/edit and extract: color: brown and largecode: code/with/slashes. - * - * @param route Mapping information to be assigned to $route.current on route match. - */ - when(path: string, route: IRoute): IRouteProvider; - } -} diff --git a/angular/angular-sanitize.d.ts b/angular/angular-sanitize.d.ts deleted file mode 100644 index d677af7b2f4509..00000000000000 --- a/angular/angular-sanitize.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -// Type definitions for Angular JS 1.3 (ngSanitize module) -// Project: http://angularjs.org -// Definitions by: Diego Vilar -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - - -declare module "angular-sanitize" { - var _: string; - export = _; -} - -/////////////////////////////////////////////////////////////////////////////// -// ngSanitize module (angular-sanitize.js) -/////////////////////////////////////////////////////////////////////////////// -declare namespace angular.sanitize { - - /////////////////////////////////////////////////////////////////////////// - // SanitizeService - // see http://docs.angularjs.org/api/ngSanitize.$sanitize - /////////////////////////////////////////////////////////////////////////// - interface ISanitizeService { - (html: string): string; - } - - /////////////////////////////////////////////////////////////////////////// - // Filters included with the ngSanitize - // see https://github.com/angular/angular.js/tree/v1.2.0/src/ngSanitize/filter - /////////////////////////////////////////////////////////////////////////// - export module filter { - - // Finds links in text input and turns them into html links. - // Supports http/https/ftp/mailto and plain email address links. - // see http://code.angularjs.org/1.2.0/docs/api/ngSanitize.filter:linky - interface ILinky { - (text: string, target?: string): string; - } - } -} diff --git a/angular/index.d.ts b/angular/index.d.ts index 9e2bcc1f5d7fad..bf99ef2572fe9f 100644 --- a/angular/index.d.ts +++ b/angular/index.d.ts @@ -3,8 +3,6 @@ // Definitions by: Diego Vilar // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// - /// declare var angular: angular.IAngularStatic;