From eb3420c93c76638aadf8a5a6456f06611d4b061e Mon Sep 17 00:00:00 2001 From: Paulo Cesar Date: Wed, 12 Nov 2014 01:57:38 -0200 Subject: [PATCH 1/3] update angular to released version 1.3+ --- .gitignore | 2 + angularjs/angular-cookies.d.ts | 4 +- angularjs/angular-tests.ts | 43 +++++++++- angularjs/angular.d.ts | 141 +++++++++++++++++++++++++-------- 4 files changed, 157 insertions(+), 33 deletions(-) diff --git a/.gitignore b/.gitignore index d4bc5dd91..bbbef0357 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,5 @@ _infrastructure/tests/build !rx.js node_modules + +.sublimets diff --git a/angularjs/angular-cookies.d.ts b/angularjs/angular-cookies.d.ts index dc0c44908..0feffae83 100644 --- a/angularjs/angular-cookies.d.ts +++ b/angularjs/angular-cookies.d.ts @@ -15,7 +15,9 @@ declare module ng.cookies { // CookieService // see http://docs.angularjs.org/api/ngCookies.$cookies /////////////////////////////////////////////////////////////////////////// - interface ICookiesService {} + interface ICookiesService { + [index: string]: any; + } /////////////////////////////////////////////////////////////////////////// // CookieStoreService diff --git a/angularjs/angular-tests.ts b/angularjs/angular-tests.ts index 7adb0bab0..628b6d1d2 100644 --- a/angularjs/angular-tests.ts +++ b/angularjs/angular-tests.ts @@ -83,7 +83,7 @@ angular.module('http-auth-interceptor', []) } }]; - $httpProvider.responseInterceptors.push(interceptor); + $httpProvider.interceptors.push(interceptor); }]); @@ -326,6 +326,47 @@ class SampleDirective2 implements ng.IDirective { angular.module('SameplDirective', []).directive('sampleDirective', SampleDirective.instance).directive('sameplDirective2', SampleDirective2.instance); +angular.module('AnotherSampleDirective', []).directive('myDirective', ['$interpolate', '$q', ($interpolate: ng.IInterpolateService, $q: ng.IQService) => { + return { + restrict: 'A', + link: (scope: ng.IScope, el: ng.IAugmentedJQuery, attr: ng.IAttributes) => { + $interpolate(attr['test'])(scope); + $interpolate('', true)(scope); + $interpolate('', true, 'html')(scope); + $interpolate('', true, 'html', true)(scope); + var defer = $q.defer(); + defer.reject(); + defer.resolve(); + defer.promise.then(function(d) { + return d; + }).then(function(): any { + return null; + }, function(): any { + return null; + }) + .catch((): any => { + return null; + }) + .finally((): any => { + return null; + }); + var promise = new $q((resolve) => { + resolve(); + }); + + promise = new $q((resolve, reject) => { + reject(); + resolve(true); + }); + + promise = new $q((resolver, reject) => { + resolver(true); + reject(false); + }); + } + }; +}]); + // test from https://docs.angularjs.org/guide/directive angular.module('docsSimpleDirective', []) .controller('Controller', ['$scope', function($scope: any) { diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index 4659da761..b5cc51daf 100755 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -13,6 +13,11 @@ interface Function { $inject?: string[]; } +// Support AMD require +declare module 'angular' { + export = angular; +} + /////////////////////////////////////////////////////////////////////////////// // ng module (angular.js) /////////////////////////////////////////////////////////////////////////////// @@ -32,6 +37,10 @@ declare module ng { $get: any; } + interface IAngularBootstrapConfig { + strictDi?: boolean; + } + /////////////////////////////////////////////////////////////////////////// // AngularStatic // see http://docs.angularjs.org/api @@ -46,8 +55,10 @@ declare module ng { * @param modules An array of modules to load into the application. * Each item in the array should be the name of a predefined module or a (DI annotated) * function that will be invoked by the injector as a run block. + * @param config an object for defining configuration options for the application. The following keys are supported: + * - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code. */ - bootstrap(element: string, modules?: string): auto.IInjectorService; + bootstrap(element: string, modules?: string, config?: IAngularBootstrapConfig): auto.IInjectorService; /** * Use this function to manually start up angular application. * @@ -55,8 +66,10 @@ declare module ng { * @param modules An array of modules to load into the application. * Each item in the array should be the name of a predefined module or a (DI annotated) * function that will be invoked by the injector as a run block. + * @param config an object for defining configuration options for the application. The following keys are supported: + * - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code. */ - bootstrap(element: string, modules?: Function): auto.IInjectorService; + bootstrap(element: string, modules?: Function, config?: IAngularBootstrapConfig): auto.IInjectorService; /** * Use this function to manually start up angular application. * @@ -64,8 +77,10 @@ declare module ng { * @param modules An array of modules to load into the application. * Each item in the array should be the name of a predefined module or a (DI annotated) * function that will be invoked by the injector as a run block. + * @param config an object for defining configuration options for the application. The following keys are supported: + * - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code. */ - bootstrap(element: string, modules?: string[]): auto.IInjectorService; + bootstrap(element: string, modules?: string[], config?: IAngularBootstrapConfig): auto.IInjectorService; /** * Use this function to manually start up angular application. * @@ -73,8 +88,10 @@ declare module ng { * @param modules An array of modules to load into the application. * Each item in the array should be the name of a predefined module or a (DI annotated) * function that will be invoked by the injector as a run block. + * @param config an object for defining configuration options for the application. The following keys are supported: + * - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code. */ - bootstrap(element: JQuery, modules?: string): auto.IInjectorService; + bootstrap(element: JQuery, modules?: string, config?: IAngularBootstrapConfig): auto.IInjectorService; /** * Use this function to manually start up angular application. * @@ -82,8 +99,10 @@ declare module ng { * @param modules An array of modules to load into the application. * Each item in the array should be the name of a predefined module or a (DI annotated) * function that will be invoked by the injector as a run block. + * @param config an object for defining configuration options for the application. The following keys are supported: + * - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code. */ - bootstrap(element: JQuery, modules?: Function): auto.IInjectorService; + bootstrap(element: JQuery, modules?: Function, config?: IAngularBootstrapConfig): auto.IInjectorService; /** * Use this function to manually start up angular application. * @@ -91,8 +110,10 @@ declare module ng { * @param modules An array of modules to load into the application. * Each item in the array should be the name of a predefined module or a (DI annotated) * function that will be invoked by the injector as a run block. + * @param config an object for defining configuration options for the application. The following keys are supported: + * - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code. */ - bootstrap(element: JQuery, modules?: string[]): auto.IInjectorService; + bootstrap(element: JQuery, modules?: string[], config?: IAngularBootstrapConfig): auto.IInjectorService; /** * Use this function to manually start up angular application. * @@ -100,8 +121,10 @@ declare module ng { * @param modules An array of modules to load into the application. * Each item in the array should be the name of a predefined module or a (DI annotated) * function that will be invoked by the injector as a run block. + * @param config an object for defining configuration options for the application. The following keys are supported: + * - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code. */ - bootstrap(element: Element, modules?: string): auto.IInjectorService; + bootstrap(element: Element, modules?: string, config?: IAngularBootstrapConfig): auto.IInjectorService; /** * Use this function to manually start up angular application. * @@ -109,8 +132,10 @@ declare module ng { * @param modules An array of modules to load into the application. * Each item in the array should be the name of a predefined module or a (DI annotated) * function that will be invoked by the injector as a run block. + * @param config an object for defining configuration options for the application. The following keys are supported: + * - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code. */ - bootstrap(element: Element, modules?: Function): auto.IInjectorService; + bootstrap(element: Element, modules?: Function, config?: IAngularBootstrapConfig): auto.IInjectorService; /** * Use this function to manually start up angular application. * @@ -118,8 +143,10 @@ declare module ng { * @param modules An array of modules to load into the application. * Each item in the array should be the name of a predefined module or a (DI annotated) * function that will be invoked by the injector as a run block. + * @param config an object for defining configuration options for the application. The following keys are supported: + * - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code. */ - bootstrap(element: Element, modules?: string[]): auto.IInjectorService; + bootstrap(element: Element, modules?: string[], config?: IAngularBootstrapConfig): auto.IInjectorService; /** * Use this function to manually start up angular application. * @@ -127,8 +154,10 @@ declare module ng { * @param modules An array of modules to load into the application. * Each item in the array should be the name of a predefined module or a (DI annotated) * function that will be invoked by the injector as a run block. + * @param config an object for defining configuration options for the application. The following keys are supported: + * - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code. */ - bootstrap(element: Document, modules?: string): auto.IInjectorService; + bootstrap(element: Document, modules?: string, config?: IAngularBootstrapConfig): auto.IInjectorService; /** * Use this function to manually start up angular application. * @@ -136,8 +165,10 @@ declare module ng { * @param modules An array of modules to load into the application. * Each item in the array should be the name of a predefined module or a (DI annotated) * function that will be invoked by the injector as a run block. + * @param config an object for defining configuration options for the application. The following keys are supported: + * - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code. */ - bootstrap(element: Document, modules?: Function): auto.IInjectorService; + bootstrap(element: Document, modules?: Function, config?: IAngularBootstrapConfig): auto.IInjectorService; /** * Use this function to manually start up angular application. * @@ -145,8 +176,10 @@ declare module ng { * @param modules An array of modules to load into the application. * Each item in the array should be the name of a predefined module or a (DI annotated) * function that will be invoked by the injector as a run block. + * @param config an object for defining configuration options for the application. The following keys are supported: + * - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code. */ - bootstrap(element: Document, modules?: string[]): auto.IInjectorService; + bootstrap(element: Document, modules?: string[], config?: IAngularBootstrapConfig): auto.IInjectorService; /** * Creates a deep copy of source, which should be an object or an array. @@ -230,6 +263,7 @@ declare module ng { configFn?: Function): IModule; noop(...args: any[]): void; + reloadWithDebugInfo(): void; toJson(obj: any, pretty?: boolean): string; uppercase(str: string): string; version: { @@ -412,6 +446,7 @@ declare module ng { $commitViewValue(): void; $rollbackViewValue(): void; $setSubmitted(): void; + $setUntouched(): void; } /////////////////////////////////////////////////////////////////////////// @@ -423,13 +458,13 @@ declare module ng { $setValidity(validationErrorKey: string, isValid: boolean): void; // Documentation states viewValue and modelValue to be a string but other // types do work and it's common to use them. - $setViewValue(value: any): void; + $setViewValue(value: any, trigger?: string): void; $setPristine(): void; $validate(): void; $setTouched(): void; $setUntouched(): void; $rollbackViewValue(): void; - $commitViewValue(revalidate?: boolean): void; + $commitViewValue(): void; $isEmpty(value: any): boolean; $viewValue: any; @@ -448,6 +483,7 @@ declare module ng { $validators: IModelValidators; $asyncValidators: IAsyncModelValidators; + $pending: any; $pristine: boolean; $dirty: boolean; $valid: boolean; @@ -479,10 +515,13 @@ declare module ng { * see https://docs.angularjs.org/api/ng/type/$rootScope.Scope and https://docs.angularjs.org/api/ng/service/$rootScope */ interface IRootScopeService { + [index: string]: any; + $apply(): any; $apply(exp: string): any; $apply(exp: (scope: IScope) => any): any; - + + $applyAsync(): any; $applyAsync(exp: string): any; $applyAsync(exp: (scope: IScope) => any): any; @@ -491,14 +530,20 @@ declare module ng { $digest(): void; $emit(name: string, ...args: any[]): IAngularEvent; - $eval(expression?: string, args?: Object): any; - $eval(expression?: (scope: IScope) => any, args?: Object): any; + $eval(): any; + $eval(expression: string): any; + $eval(expression: string, locals: Object): any; + $eval(expression: (scope: IScope) => any): any; + $eval(expression: (scope: IScope) => any, locals: Object): any; - $evalAsync(expression?: string): void; - $evalAsync(expression?: (scope: IScope) => any): void; + $evalAsync(): void; + $evalAsync(expression: string): void; + $evalAsync(expression: (scope: IScope) => any): void; // Defaults to false by the implementation checking strategy - $new(isolate?: boolean): IScope; + $new(): IScope; + $new(isolate: boolean): IScope; + $new(isolate: boolean, parent: IScope): IScope; /** * Listens on events of a given type. See $emit for discussion of event life cycle. @@ -522,10 +567,7 @@ declare module ng { $watchGroup(watchExpressions: { (scope: IScope): any }[], listener: (newValue: any, oldValue: any, scope: IScope) => any): Function; $parent: IScope; - $root: IRootScopeService; - this: IRootScopeService; - $id: number; // Hidden members @@ -533,9 +575,7 @@ declare module ng { $$phase: any; } - interface IScope extends IRootScopeService { - [index: string]: any; - } + interface IScope extends IRootScopeService { } interface IAngularEvent { /** @@ -585,7 +625,9 @@ declare module ng { // see http://docs.angularjs.org/api/ng.$timeout /////////////////////////////////////////////////////////////////////////// interface ITimeoutService { - (func: Function, delay?: number, invokeApply?: boolean): IPromise; + (func: Function): IPromise; + (func: Function, delay: number): IPromise; + (func: Function, delay: number, invokeApply: boolean): IPromise; cancel(promise: IPromise): boolean; } @@ -594,7 +636,9 @@ declare module ng { // see http://docs.angularjs.org/api/ng.$interval /////////////////////////////////////////////////////////////////////////// interface IIntervalService { - (func: Function, delay: number, count?: number, invokeApply?: boolean): IPromise; + (func: Function, delay: number): IPromise; + (func: Function, delay: number, count: number): IPromise; + (func: Function, delay: number, count: number, invokeApply: boolean): IPromise; cancel(promise: IPromise): boolean; } @@ -812,6 +856,8 @@ declare module ng { */ search(search: string, paramValue: boolean): ILocationService; + state(): any; + state(state: any): ILocationService; url(): string; url(url: string): ILocationService; } @@ -847,12 +893,20 @@ declare module ng { /////////////////////////////////////////////////////////////////////////// interface IRootElementService extends JQuery {} + interface IQResolveReject { + (): void; + (value: T): void; + } /** * $q - service in module ng * A promise/deferred implementation inspired by Kris Kowal's Q. * See http://docs.angularjs.org/api/ng/service/$q */ interface IQService { + new (resolver: (resolve: IQResolveReject) => any): IPromise; + new (resolver: (resolve: IQResolveReject, reject: IQResolveReject) => any): IPromise; + new (resolver: (resolve: IQResolveReject, reject: IQResolveReject) => any): IPromise; + /** * Combines multiple promises into a single promise that is resolved when all of the input promises are resolved. * @@ -955,6 +1009,7 @@ declare module ng { /////////////////////////////////////////////////////////////////////////// interface IAnchorScrollService { (): void; + yOffset: any; } interface IAnchorScrollProvider extends IServiceProvider { @@ -1014,6 +1069,9 @@ declare module ng { imgSrcSanitizationWhitelist(): RegExp; imgSrcSanitizationWhitelist(regexp: RegExp): ICompileProvider; + + debugInfoEnabled(): any; + debugInfoEnabled(enabled: boolean): any; } interface ICloneAttachFunction { @@ -1048,6 +1106,7 @@ declare module ng { interface IControllerProvider extends IServiceProvider { register(name: string, controllerConstructor: Function): void; register(name: string, dependencyAnnotatedConstructor: any[]): void; + allowGlobals(): void; } /** @@ -1227,10 +1286,22 @@ declare module ng { then(successCallback: (response: IHttpPromiseCallbackArg) => TResult, errorCallback?: (response: IHttpPromiseCallbackArg) => any): IPromise; } + interface IHttpProviderDefaults { + xsrfCookieName?: string; + xsrfHeaderName?: string; + headers?: { + common?: any; + post?: any; + put?: any; + patch?: any; + } + } + interface IHttpProvider extends IServiceProvider { - defaults: IRequestConfig; + defaults: IHttpProviderDefaults; interceptors: any[]; - responseInterceptors: any[]; + useApplyAsync(): boolean; + useApplyAsync(value: boolean): IHttpProvider; } /////////////////////////////////////////////////////////////////////////// @@ -1249,7 +1320,10 @@ declare module ng { // see http://docs.angularjs.org/api/ng.$interpolateProvider /////////////////////////////////////////////////////////////////////////// interface IInterpolateService { - (text: string, mustHaveExpression?: boolean): IInterpolationFunction; + (text: string): IInterpolationFunction; + (text: string, mustHaveExpression: boolean): IInterpolationFunction; + (text: string, mustHaveExpression: boolean, trustedContext: string): IInterpolationFunction; + (text: string, mustHaveExpression: boolean, trustedContext: string, allOrNothing: boolean): IInterpolationFunction; endSymbol(): string; startSymbol(): string; } @@ -1345,6 +1419,11 @@ declare module ng { * @return A promise whose value is the template content. */ (tpl: string, ignoreRequestError?: boolean): IPromise; + /** + * total amount of pending template requests being downloaded. + * @type {number} + */ + totalPendingRequests: number; } /////////////////////////////////////////////////////////////////////////// From 91ea0ef4cec935d3777ff805f8beea695be98364 Mon Sep 17 00:00:00 2001 From: Paulo Cesar Date: Wed, 12 Nov 2014 06:04:00 -0200 Subject: [PATCH 2/3] squash! update angular to released version 1.3+ undo optionals --- angularjs/angular.d.ts | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index b5cc51daf..d28c40e21 100755 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -531,19 +531,15 @@ declare module ng { $emit(name: string, ...args: any[]): IAngularEvent; $eval(): any; - $eval(expression: string): any; - $eval(expression: string, locals: Object): any; - $eval(expression: (scope: IScope) => any): any; - $eval(expression: (scope: IScope) => any, locals: Object): any; + $eval(expression: string, locals?: Object): any; + $eval(expression: (scope: IScope) => any, locals?: Object): any; $evalAsync(): void; $evalAsync(expression: string): void; $evalAsync(expression: (scope: IScope) => any): void; // Defaults to false by the implementation checking strategy - $new(): IScope; - $new(isolate: boolean): IScope; - $new(isolate: boolean, parent: IScope): IScope; + $new(isolate?: boolean, parent?: IScope): IScope; /** * Listens on events of a given type. See $emit for discussion of event life cycle. @@ -625,9 +621,7 @@ declare module ng { // see http://docs.angularjs.org/api/ng.$timeout /////////////////////////////////////////////////////////////////////////// interface ITimeoutService { - (func: Function): IPromise; - (func: Function, delay: number): IPromise; - (func: Function, delay: number, invokeApply: boolean): IPromise; + (func: Function, delay?: number, invokeApply?: boolean): IPromise; cancel(promise: IPromise): boolean; } @@ -636,9 +630,7 @@ declare module ng { // see http://docs.angularjs.org/api/ng.$interval /////////////////////////////////////////////////////////////////////////// interface IIntervalService { - (func: Function, delay: number): IPromise; - (func: Function, delay: number, count: number): IPromise; - (func: Function, delay: number, count: number, invokeApply: boolean): IPromise; + (func: Function, delay?: number, count?: number, invokeApply?: boolean): IPromise; cancel(promise: IPromise): boolean; } @@ -747,8 +739,8 @@ declare module ng { } interface ILogProvider { - debugEnabled(enabled: boolean): ILogProvider; debugEnabled(): boolean; + debugEnabled(enabled: boolean): ILogProvider; } // We define this as separete interface so we can reopen it later for @@ -1070,8 +1062,7 @@ declare module ng { imgSrcSanitizationWhitelist(): RegExp; imgSrcSanitizationWhitelist(regexp: RegExp): ICompileProvider; - debugInfoEnabled(): any; - debugInfoEnabled(enabled: boolean): any; + debugInfoEnabled(enabled?: boolean): any; } interface ICloneAttachFunction { @@ -1320,10 +1311,7 @@ declare module ng { // see http://docs.angularjs.org/api/ng.$interpolateProvider /////////////////////////////////////////////////////////////////////////// interface IInterpolateService { - (text: string): IInterpolationFunction; - (text: string, mustHaveExpression: boolean): IInterpolationFunction; - (text: string, mustHaveExpression: boolean, trustedContext: string): IInterpolationFunction; - (text: string, mustHaveExpression: boolean, trustedContext: string, allOrNothing: boolean): IInterpolationFunction; + (text: string, mustHaveExpression?: boolean, trustedContext?: string, allOrNothing?: boolean): IInterpolationFunction; endSymbol(): string; startSymbol(): string; } @@ -1443,7 +1431,7 @@ declare module ng { instanceAttributes: IAttributes, controller: any, transclude: ITranscludeFunction - ): void; + ): void; } interface IDirectivePrePost { @@ -1456,7 +1444,7 @@ declare module ng { templateElement: IAugmentedJQuery, templateAttributes: IAttributes, transclude: ITranscludeFunction - ): IDirectivePrePost; + ): IDirectivePrePost; } interface IDirective { From 5ab1bd484034f61fbf688e14eecc28638c36f7ea Mon Sep 17 00:00:00 2001 From: Paulo Cesar Date: Wed, 12 Nov 2014 08:30:07 -0200 Subject: [PATCH 3/3] squash! squash! update angular to released version 1.3+ interval delay isnt optional --- angularjs/angular.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index d28c40e21..64a9d0652 100755 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -630,7 +630,7 @@ declare module ng { // see http://docs.angularjs.org/api/ng.$interval /////////////////////////////////////////////////////////////////////////// interface IIntervalService { - (func: Function, delay?: number, count?: number, invokeApply?: boolean): IPromise; + (func: Function, delay: number, count?: number, invokeApply?: boolean): IPromise; cancel(promise: IPromise): boolean; }