diff --git a/.gitignore b/.gitignore index 99d816d44..95507aec0 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,6 @@ *.sln *.csproj *.txt -*.map \ No newline at end of file +*.map + +_Resharper.DefinitelyTyped \ No newline at end of file diff --git a/Definitions/angular-1.0.d.ts b/Definitions/angular-1.0.d.ts new file mode 100644 index 000000000..e56ebc61e --- /dev/null +++ b/Definitions/angular-1.0.d.ts @@ -0,0 +1,641 @@ +// Type definitions for Angular JS 1.0 +// Project: http://angularjs.org +// Definitions by: Diego Vilar +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +/// + +declare var angular: ng.IAngularStatic; + +/////////////////////////////////////////////////////////////////////////////// +// ng module (angular.js) +/////////////////////////////////////////////////////////////////////////////// +module ng { + + // For the sake of simplicity, let's assume jQuery is always preferred + interface IJQLiteOrBetter extends JQuery { } + + // All service providers extend this interface + interface IServiceProvider { + $get(): any; + } + + /////////////////////////////////////////////////////////////////////////// + // AngularStatic + // see http://docs.angularjs.org/api + /////////////////////////////////////////////////////////////////////////// + interface IAngularStatic { + bind(context: any, fn: Function, ...args: any[]): Function; + bootstrap(element: string, modules?: any[]): auto.IInjectorService; + bootstrap(element: IJQLiteOrBetter, modules?: any[]): auto.IInjectorService; + bootstrap(element: Element, modules?: any[]): auto.IInjectorService; + copy(source: any, destination?: any): any; + element: IJQLiteOrBetter; + equals(value1: any, value2: any): bool; + extend(destination: any, ...sources: any[]): any; + forEach(obj: any, iterator: (value, key) => any, context?: any): any; + fromJson(json: string): any; + identity(arg?: any): any; + injector(modules?: any[]): auto.IInjectorService; + isArray(value: any): bool; + isDate(value: any): bool; + isDefined(value: any): bool; + isElement(value: any): bool; + isFunction(value: any): bool; + isNumber(value: any): bool; + isObject(value: any): bool; + isString(value: any): bool; + isUndefined(value: any): bool; + lowercase(str: string): string; + module(name: string, requires?: string[], configFunction?: Function): IModule; + noop(...args: any[]): void; + toJson(obj: any, pretty?: bool): string; + uppercase(str: string): string; + version: { + full: string; + major: number; + minor: number; + dot: number; + codename: string; + }; + } + + /////////////////////////////////////////////////////////////////////////// + // Module + // see http://docs.angularjs.org/api/angular.Module + /////////////////////////////////////////////////////////////////////////// + interface IModule { + config(configFn: Function): IModule; + config(inlineAnnotadedFunction: any[]): IModule; + constant(name: string, value: any): IModule; + controller(name: string, controllerConstructor: Function): IModule; + controller(name: string, inlineAnnotadedConstructor: any[]): IModule; + directive(name: string, directiveFactory: Function): IModule; + directive(name: string, inlineAnnotadedFunction: any[]): IModule; + factory(name: string, serviceFactoryFunction: Function): IModule; + factory(name: string, inlineAnnotadedFunction: any[]): IModule; + filter(name: string, filterFactoryFunction: Function): IModule; + filter(name: string, inlineAnnotadedFunction: any[]): IModule; + provider(name: string, serviceProviderConstructor: Function): IModule; + provider(name: string, inlineAnnotadedConstructor: any[]): IModule; + run(initializationFunction: Function): IModule; + run(inlineAnnotadedFunction: any[]): IModule; + service(name: string, serviceConstructor: Function): IModule; + service(name: string, inlineAnnotadedConstructor: any[]): IModule; + value(name: string, value: any): IModule; + + // Properties + name: string; + requires: string[]; + } + + /////////////////////////////////////////////////////////////////////////// + // Attributes + // see http://docs.angularjs.org/api/ng.$compile.directive.Attributes + /////////////////////////////////////////////////////////////////////////// + interface IAttributes { + $set(name: string, value: any): void; + $attr: any; + } + + /////////////////////////////////////////////////////////////////////////// + // FormController + // see http://docs.angularjs.org/api/ng.directive:form.FormController + /////////////////////////////////////////////////////////////////////////// + interface IFormController { + $pristine: bool; + $dirty: bool; + $valid: bool; + $invalid: bool; + $error: any; + } + + /////////////////////////////////////////////////////////////////////////// + // NgModelController + // see http://docs.angularjs.org/api/ng.directive:ngModel.NgModelController + /////////////////////////////////////////////////////////////////////////// + interface INgModelController { + $render(): void; + $setValidity(validationErrorKey: string, isValid: bool): void; + $setViewValue(value: string): void; + + // XXX Not sure about the types here. Documentation states it's a string, but + // I've seen it receiving other types throughout the code. + // Falling back to any for now. + $viewValue: any; + + // XXX Same as avove + $modelValue: any; + + $parsers: IModelParser[]; + $formatters: IModelFormatter[]; + $error: any; + $pristine: bool; + $dirty: bool; + $valid: bool; + $invalid: bool; + } + + interface IModelParser { + (value: any): any; + } + + interface IModelFormatter { + (value: any): any; + } + + /////////////////////////////////////////////////////////////////////////// + // Scope + // see http://docs.angularjs.org/api/ng.$rootScope.Scope + /////////////////////////////////////////////////////////////////////////// + interface IScope { + // Documentation says exp is optional, but actual implementaton counts on it + $apply(exp: string): any; + $apply(exp: (scope: IScope) => any): any; + + $broadcast(name: string, ...args: any[]): IAngularEvent; + $destroy(): void; + $digest(): void; + $emit(name: string, ...args: any[]): IAngularEvent; + + // Documentation says exp is optional, but actual implementaton counts on it + $eval(expression: string): any; + $eval(expression: (scope: IScope) => any): any; + + // Documentation says exp is optional, but actual implementaton counts on it + $evalAsync(expression: string): void; + $evalAsync(expression: (scope: IScope) => any): void; + + // Defaults to false by the implementation checking strategy + $new(isolate?: bool): IScope; + + $on(name: string, listener: (event: IAngularEvent, ...args: any[]) => any): Function; + + $watch(watchExpression: string, listener?: string, objectEquality?: bool): Function; + $watch(watchExpression: string, listener?: (newValue: any, oldValue: any, scope: IScope) => any, objectEquality?: bool): Function; + $watch(watchExpression: (scope: IScope) => any, listener?: string, objectEquality?: bool): Function; + $watch(watchExpression: (scope: IScope) => any, listener?: (newValue: any, oldValue: any, scope: IScope) => any, objectEquality?: bool): Function; + + $id: number; + } + + interface IAngularEvent { + targetScope: IScope; + currentScope: IScope; + name: string; + preventDefault: Function; + defaultPrevented: bool; + + // Available only events that were $emit-ted + stopPropagation?: Function; + } + + /////////////////////////////////////////////////////////////////////////// + // WindowService + // see http://docs.angularjs.org/api/ng.$window + /////////////////////////////////////////////////////////////////////////// + interface IWindowService extends Window {} + + /////////////////////////////////////////////////////////////////////////// + // BrowserService + // TODO undocumented, so we need to get it from the source code + /////////////////////////////////////////////////////////////////////////// + interface IBrowserService {} + + /////////////////////////////////////////////////////////////////////////// + // TimeoutService + // see http://docs.angularjs.org/api/ng.$timeout + /////////////////////////////////////////////////////////////////////////// + interface ITimeoutService { + (func: Function, delay?: number, invokeApply?: bool): IPromise; + cancel(promise: IPromise): bool; + } + + /////////////////////////////////////////////////////////////////////////// + // FilterService + // see http://docs.angularjs.org/api/ng.$filter + // see http://docs.angularjs.org/api/ng.$filterProvider + /////////////////////////////////////////////////////////////////////////// + interface IFilterService { + (name: string): Function; + } + + interface IFilterProvider extends IServiceProvider { + register(name: string, filterFactory: Function): IServiceProvider; + } + + /////////////////////////////////////////////////////////////////////////// + // LocaleService + // see http://docs.angularjs.org/api/ng.$locale + /////////////////////////////////////////////////////////////////////////// + interface ILocaleService { + id: string; + + // These are not documented + // Check angular's i18n files for exemples + NUMBER_FORMATS: ILocaleNumberFormatDescriptor; + DATETIME_FORMATS: ILacaleDateTimeFormatDescriptor; + pluralCat: (num: any) => string; + } + + interface ILocaleNumberFormatDescriptor { + DECIMAL_SEP: string; + GROUP_SEP: string; + PATTERNS: ILocaleNumberPatternDescriptor[]; + CURRENCY_SYM: string; + } + + interface ILocaleNumberPatternDescriptor { + minInt: number; + minFrac: number; + maxFrac: number; + posPre: string; + posSuf: string; + negPre: string; + negSuf: string; + gSize: number; + lgSize: number; + } + + interface ILacaleDateTimeFormatDescriptor { + MONTH: string[]; + SHORTMONTH: string[]; + DAY: string[]; + SHORTDAY: string[]; + AMPMS: string[]; + medium: string; + short: string; + fullDate: string; + longDate: string; + mediumDate: string; + shortDate: string; + mediumTime: string; + shortTime: string; + } + + /////////////////////////////////////////////////////////////////////////// + // LogService + // see http://docs.angularjs.org/api/ng.$log + /////////////////////////////////////////////////////////////////////////// + interface ILogService { + error: ILogCall; + info: ILogCall; + log: ILogCall; + warn: ILogCall; + } + + // We define this as separete interface so we can reopen it later for + // the ngMock module. + interface ILogCall { + (...args: any[]): void; + } + + /////////////////////////////////////////////////////////////////////////// + // ParseService + // see http://docs.angularjs.org/api/ng.$parse + /////////////////////////////////////////////////////////////////////////// + interface IParseService { + (expression: string): ICompiledExpression; + } + + interface ICompiledExpression { + (context: any, locals?: any): any; + + // If value is not provided, undefined is gonna be used since the implementation + // does not check the parameter. Let's force a value for consistency. If consumer + // whants to undefine it, pass the undefined value explicitly. + assign(context: any, value: any): any; + } + + /////////////////////////////////////////////////////////////////////////// + // LocationService + // see http://docs.angularjs.org/api/ng.$location + // see http://docs.angularjs.org/api/ng.$locationProvider + // see http://docs.angularjs.org/guide/dev_guide.services.$location + /////////////////////////////////////////////////////////////////////////// + interface ILocationService { + absUrl(): string; + hash(): string; + hash(newHash: string): ILocationService; + host(): string; + path(): string; + path(newPath: string): ILocationService; + port(): number; + protocol(): string; + replace(): ILocationService; + search(): string; + search(parametersMap: any): ILocationService; + search(parameter: string, parameterValue: any): ILocationService; + url(): string; + url(url: string): ILocationService; + } + + interface ILocationProvider extends IServiceProvider { + hashPrefix(): string; + hashPrefix(prefix: string): ILocationProvider; + html5Mode(): bool; + + // Documentation states that parameter is string, but + // implementation tests it as boolean, which makes more sense + // since this is a toggler + html5Mode(active: bool): ILocationProvider; + } + + /////////////////////////////////////////////////////////////////////////// + // DocumentService + // see http://docs.angularjs.org/api/ng.$document + /////////////////////////////////////////////////////////////////////////// + interface IDocumentService extends Document {} + + /////////////////////////////////////////////////////////////////////////// + // ExceptionHandlerService + // see http://docs.angularjs.org/api/ng.$exceptionHandler + /////////////////////////////////////////////////////////////////////////// + interface IExceptionHandlerService { + (exception: Error, cause?: string): void; + } + + /////////////////////////////////////////////////////////////////////////// + // RootElementService + // see http://docs.angularjs.org/api/ng.$rootElement + /////////////////////////////////////////////////////////////////////////// + interface IRootElementService extends IJQLiteOrBetter {} + + /////////////////////////////////////////////////////////////////////////// + // QService + // see http://docs.angularjs.org/api/ng.$q + /////////////////////////////////////////////////////////////////////////// + interface IQService { + all(promises: IPromise[]): IPromise; + defer(): IDeferred; + reject(reason?: any): IPromise; + when(value: any): IPromise; + } + + interface IPromise { + then(successCallback: Function, errorCallback?: Function): IPromise; + } + + interface IDeferred { + resolve(value?: any): void; + reject(reason?: string): void; + promise: IPromise; + } + + /////////////////////////////////////////////////////////////////////////// + // AnchorScrollService + // see http://docs.angularjs.org/api/ng.$anchorScroll + /////////////////////////////////////////////////////////////////////////// + interface IAnchorScrollService { + (): void; + } + + interface IAnchorScrollProvider extends IServiceProvider { + disableAutoScrolling(): void; + } + + /////////////////////////////////////////////////////////////////////////// + // CacheFactoryService + // see http://docs.angularjs.org/api/ng.$cacheFactory + /////////////////////////////////////////////////////////////////////////// + interface ICacheFactoryService { + // Lets not foce the optionsMap to have the capacity member. Even though + // it's the ONLY option considered by the implementation today, a consumer + // might find it useful to associate some other options to the cache object. + //(cacheId: string, optionsMap?: { capacity: number; }): CacheObject; + (cacheId: string, optionsMap?: { capacity: number; }): ICacheObject; + + // Methods bellow are not documented + info(): any; + get(cacheId: string): ICacheObject; + } + + interface ICacheObject { + info(): { + id: string; + size: number; + + // Not garanteed to have, since it's a non-mandatory option + //capacity: number; + }; + put(key: string, value?: any): void; + get(key: string): any; + remove(key: string): void; + removeAll(): void; + destroy(): void; + } + + /////////////////////////////////////////////////////////////////////////// + // CompileService + // see http://docs.angularjs.org/api/ng.$compile + // see http://docs.angularjs.org/api/ng.$compileProvider + /////////////////////////////////////////////////////////////////////////// + interface ICompileService { + (element: string, transclude?: ITemplateLinkingFunction, maxPriority?: number): ITemplateLinkingFunction; + (element: Element, transclude?: ITemplateLinkingFunction, maxPriority?: number): ITemplateLinkingFunction; + (element: IJQLiteOrBetter, transclude?: ITemplateLinkingFunction, maxPriority?: number): ITemplateLinkingFunction; + } + + interface ICompileProvider extends IServiceProvider { + directive(name: string, directiveFactory: Function): ICompileProvider; + + // Undocumented, but it is there... + directive(directivesMap: any): ICompileProvider; + } + + interface ITemplateLinkingFunction { + // Let's hint but not force cloneAttachFn's signature + (scope: IScope, cloneAttachFn?: (clonedElement?: IJQLiteOrBetter, scope?: IScope) => any): IJQLiteOrBetter; + } + + /////////////////////////////////////////////////////////////////////////// + // ControllerService + // see http://docs.angularjs.org/api/ng.$controller + // see http://docs.angularjs.org/api/ng.$controllerProvider + /////////////////////////////////////////////////////////////////////////// + interface IControllerService { + // Although the documentation doesn't state this, locals are optional + (controllerConstructor: Function, locals?: any): any; + (controllerName: string, locals?: any): any; + } + + interface IControlerProvider extends IServiceProvider { + register(name: string, controllerConstructor: Function): void; + register(name: string, dependencyAnnotadedConstructor: any[]): void; + } + + /////////////////////////////////////////////////////////////////////////// + // HttpService + // see http://docs.angularjs.org/api/ng.$http + /////////////////////////////////////////////////////////////////////////// + interface IHttpService { + // At least moethod and url must be provided... + (config: IRequestConfig): IHttpPromise; + get(url: string, RequestConfig?: any): IHttpPromise; + delete(url: string, RequestConfig?: any): IHttpPromise; + head(url: string, RequestConfig?: any): IHttpPromise; + jsonp(url: string, RequestConfig?: any): IHttpPromise; + post(url: string, data: any, RequestConfig?: any): IHttpPromise; + put(url: string, data: any, RequestConfig?: any): IHttpPromise; + defaults: IRequestConfig; + + // For debugging, BUT it is documented as public, so... + pendingRequests: any[]; + } + + // This is just for hinting. + // Some opetions might not be available depending on the request. + // see http://docs.angularjs.org/api/ng.$http#Usage for options explanations + interface IRequestConfig { + method: string; + url: string; + params?: any; + + // XXX it has it's own structure... perhaps we should define it in the future + headers?: any; + + cache?: any; + timeout?: number; + withCredentials?: bool; + + // These accept multiple types, so let's defile them as any + data?: any; + transformRequest?: any; + transformResponse?: any; + } + + interface IHttpPromise extends IPromise { + success(callback: (data: any, status: number, headers: (headerName: string) => string, config: IRequestConfig) => any): IHttpPromise; + error(callback: (data: any, status: number, headers: (headerName: string) => string, config: IRequestConfig) => any): IHttpPromise; + } + + interface IHttpProvider extends IServiceProvider { + defaults: IRequestConfig; + } + + /////////////////////////////////////////////////////////////////////////// + // HttpBackendService + // see http://docs.angularjs.org/api/ng.$httpBackend + // You should never need to use this service directly. + /////////////////////////////////////////////////////////////////////////// + interface IHttpBackendService { + // XXX Perhaps define callback signature in the future + (method: string, url: string, post?: any, callback?: Function, headers?: any, timeout?: number, withCredentials?: bool); void; + } + + /////////////////////////////////////////////////////////////////////////// + // InterpolateService + // see http://docs.angularjs.org/api/ng.$interpolate + // see http://docs.angularjs.org/api/ng.$interpolateProvider + /////////////////////////////////////////////////////////////////////////// + interface IInterpolateService { + (text: string, mustHaveExpression?: bool): IInterpolationFunction; + endSymbol(): string; + startSymbol(): string; + } + + interface IInterpolationFunction { + (context: any): string; + } + + interface IInterpolateProvider extends IServiceProvider { + startSymbol(): string; + startSymbol(value: string): IInterpolateProvider; + endSymbol(): string; + endSymbol(value: string): IInterpolateProvider; + } + + /////////////////////////////////////////////////////////////////////////// + // RouteParamsService + // see http://docs.angularjs.org/api/ng.$routeParams + /////////////////////////////////////////////////////////////////////////// + interface IRouteParamsService {} + + /////////////////////////////////////////////////////////////////////////// + // TemplateCacheService + // see http://docs.angularjs.org/api/ng.$templateCache + /////////////////////////////////////////////////////////////////////////// + interface ITemplateCacheService extends ICacheObject {} + + /////////////////////////////////////////////////////////////////////////// + // RootScopeService + // see http://docs.angularjs.org/api/ng.$rootScope + /////////////////////////////////////////////////////////////////////////// + interface IRootScopeService extends IScope {} + + /////////////////////////////////////////////////////////////////////////// + // RouteService + // see http://docs.angularjs.org/api/ng.$route + // see http://docs.angularjs.org/api/ng.$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; + } + + // see http://docs.angularjs.org/api/ng.$routeProvider#when for options explanations + interface IRoute { + controller?: any; + template?: string; + templateUrl?: string; + resolve?: any; + redirectTo?: any; + reloadOnSearch?: bool; + } + + // see http://docs.angularjs.org/api/ng.$route#current + interface ICurrentRoute extends IRoute { + locals: { + $scope: IScope; + $template: string; + }; + } + + interface IRouteProviderProvider extends IServiceProvider { + otherwise(params: any): IRouteProviderProvider; + when(path: string, route: IRoute): IRouteProviderProvider; + } + + /////////////////////////////////////////////////////////////////////////// + // AUTO module (angular.js) + /////////////////////////////////////////////////////////////////////////// + export module auto { + + /////////////////////////////////////////////////////////////////////// + // InjectorService + // see http://docs.angularjs.org/api/AUTO.$injector + /////////////////////////////////////////////////////////////////////// + interface IInjectorService { + annotate(fn: Function): string[]; + annotate(inlineAnnotadedFunction: any[]): string[]; + get(name: string): any; + instantiate(typeConstructor: Function, locals?: any): any; + invoke(func: Function, context?: any, locals?: any): any; + } + + /////////////////////////////////////////////////////////////////////// + // ProvideService + // see http://docs.angularjs.org/api/AUTO.$provide + /////////////////////////////////////////////////////////////////////// + interface IProvideService { + // Documentation says it returns the registered instance, but actual + // implementation does not return anything. + // constant(name: string, value: any): any; + constant(name: string, value: any): void; + + decorator(name: string, decorator: Function): void; + factory(name: string, serviceFactoryFunction: Function): ng.IServiceProvider; + provider(name: string, provider: ng.IServiceProvider): ng.IServiceProvider; + provider(name: string, serviceProviderConstructor: Function): ng.IServiceProvider; + service(name: string, constructor: Function): ng.IServiceProvider; + value(name: string, value: any): ng.IServiceProvider; + } + + } + +} \ No newline at end of file diff --git a/Definitions/angular-cookies-1.0.d.ts b/Definitions/angular-cookies-1.0.d.ts new file mode 100644 index 000000000..5052774c6 --- /dev/null +++ b/Definitions/angular-cookies-1.0.d.ts @@ -0,0 +1,30 @@ +/// Type definitions for Angular JS 1.0 (ngCookies module) +// Project: http://angularjs.org +// Definitions by: Diego Vilar +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +/// + +/////////////////////////////////////////////////////////////////////////////// +// ngCookies module (angular-cookies.js) +/////////////////////////////////////////////////////////////////////////////// +module ng.cookies { + + /////////////////////////////////////////////////////////////////////////// + // CookieService + // see http://docs.angularjs.org/api/ngCookies.$cookies + /////////////////////////////////////////////////////////////////////////// + interface ICookiesService {} + + /////////////////////////////////////////////////////////////////////////// + // CookieStoreService + // see http://docs.angularjs.org/api/ngCookies.$cookieStore + /////////////////////////////////////////////////////////////////////////// + interface ICookieStoreService { + get(key: string): any; + put(key: string, value: any): void; + remove(key: string): void; + } + +} diff --git a/Definitions/angular-mocks-1.0.d.ts b/Definitions/angular-mocks-1.0.d.ts new file mode 100644 index 000000000..55661043d --- /dev/null +++ b/Definitions/angular-mocks-1.0.d.ts @@ -0,0 +1,154 @@ +// Type definitions for Angular JS 1.0 (ngMock, ngMockE2E module) +// Project: http://angularjs.org +// Definitions by: Diego Vilar +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +/// + +/////////////////////////////////////////////////////////////////////////////// +// ngMock module (angular-mocks.js) +/////////////////////////////////////////////////////////////////////////////// +module ng { + + /////////////////////////////////////////////////////////////////////////// + // AngularStatic + // We reopen it to add the MockStatic definition + /////////////////////////////////////////////////////////////////////////// + interface IAngularStatic { + mock: IMockStatic; + } + + interface IMockStatic { + // see http://docs.angularjs.org/api/angular.mock.debug + debug(obj: any): string; + + // see http://docs.angularjs.org/api/angular.mock.inject + inject(...fns: Function[]): void; + + // see http://docs.angularjs.org/api/angular.mock.module + module(...modules: any[]): any; + + // see http://docs.angularjs.org/api/angular.mock.TzDate + TzDate(offset: number, timestamp: number): Date; + TzDate(offset: number, timestamp: string): Date; + } + + /////////////////////////////////////////////////////////////////////////// + // ExceptionHandlerService + // see http://docs.angularjs.org/api/ngMock.$exceptionHandler + // see http://docs.angularjs.org/api/ngMock.$exceptionHandlerProvider + /////////////////////////////////////////////////////////////////////////// + interface IExceptionHandlerProvider extends IServiceProvider { + mode(mode: string): void; + } + + /////////////////////////////////////////////////////////////////////////// + // TimeoutService + // see http://docs.angularjs.org/api/ngMock.$timeout + // Augments the original service + /////////////////////////////////////////////////////////////////////////// + interface ITimeoutService { + flush(): void; + } + + /////////////////////////////////////////////////////////////////////////// + // LogService + // see http://docs.angularjs.org/api/ngMock.$log + // Augments the original service + /////////////////////////////////////////////////////////////////////////// + interface ILogService { + assertEmpty(): void; + reset(): void; + } + + interface LogCall { + logs: string[]; + } + + /////////////////////////////////////////////////////////////////////////// + // HttpBackendService + // see http://docs.angularjs.org/api/ngMock.$httpBackend + /////////////////////////////////////////////////////////////////////////// + interface IHttpBackendService { + flush(count: number): void; + resetExpectations(): void; + verifyNoOutstandingExpectation(): void; + verifyNoOutstandingRequest(): void; + + expect(method: string, url: string, data?: string, headers?: any): mock.IRequestHandler; + expect(method: string, url: RegExp, data?: string, headers?: any): mock.IRequestHandler; + expect(method: string, url: string, data?: RegExp, headers?: any): mock.IRequestHandler; + expect(method: string, url: RegExp, data?: RegExp, headers?: any): mock.IRequestHandler; + expect(method: RegExp, url: string, data?: string, headers?: any): mock.IRequestHandler; + expect(method: RegExp, url: RegExp, data?: string, headers?: any): mock.IRequestHandler; + expect(method: RegExp, url: string, data?: RegExp, headers?: any): mock.IRequestHandler; + expect(method: RegExp, url: RegExp, data?: RegExp, headers?: any): mock.IRequestHandler; + + when(method: string, url: string, data?: string, headers?: any): mock.IRequestHandler; + when(method: string, url: RegExp, data?: string, headers?: any): mock.IRequestHandler; + when(method: string, url: string, data?: RegExp, headers?: any): mock.IRequestHandler; + when(method: string, url: RegExp, data?: RegExp, headers?: any): mock.IRequestHandler; + when(method: RegExp, url: string, data?: string, headers?: any): mock.IRequestHandler; + when(method: RegExp, url: RegExp, data?: string, headers?: any): mock.IRequestHandler; + when(method: RegExp, url: string, data?: RegExp, headers?: any): mock.IRequestHandler; + when(method: RegExp, url: RegExp, data?: RegExp, headers?: any): mock.IRequestHandler; + + expectDELETE(url: string, headers?: any): mock.IRequestHandler; + expectDELETE(url: RegExp, headers?: any): mock.IRequestHandler; + expectGET(url: string, headers?: any): mock.IRequestHandler; + expectGET(url: RegExp, headers?: any): mock.IRequestHandler; + expectHEAD(url: string, headers?: any): mock.IRequestHandler; + expectHEAD(url: RegExp, headers?: any): mock.IRequestHandler; + expectJSONP(url: string): mock.IRequestHandler; + expectJSONP(url: RegExp): mock.IRequestHandler; + expectPATCH(url: string, data?: string, headers?: any): mock.IRequestHandler; + expectPATCH(url: RegExp, data?: string, headers?: any): mock.IRequestHandler; + expectPATCH(url: string, data?: RegExp, headers?: any): mock.IRequestHandler; + expectPATCH(url: RegExp, data?: RegExp, headers?: any): mock.IRequestHandler; + expectPOST(url: string, data?: string, headers?: any): mock.IRequestHandler; + expectPOST(url: RegExp, data?: string, headers?: any): mock.IRequestHandler; + expectPOST(url: string, data?: RegExp, headers?: any): mock.IRequestHandler; + expectPOST(url: RegExp, data?: RegExp, headers?: any): mock.IRequestHandler; + expectPUT(url: string, data?: string, headers?: any): mock.IRequestHandler; + expectPUT(url: RegExp, data?: string, headers?: any): mock.IRequestHandler; + expectPUT(url: string, data?: RegExp, headers?: any): mock.IRequestHandler; + expectPUT(url: RegExp, data?: RegExp, headers?: any): mock.IRequestHandler; + + whenDELETE(url: string, headers?: any): mock.IRequestHandler; + whenDELETE(url: RegExp, headers?: any): mock.IRequestHandler; + whenGET(url: string, headers?: any): mock.IRequestHandler; + whenGET(url: RegExp, headers?: any): mock.IRequestHandler; + whenHEAD(url: string, headers?: any): mock.IRequestHandler; + whenHEAD(url: RegExp, headers?: any): mock.IRequestHandler; + whenJSONP(url: string): mock.IRequestHandler; + whenJSONP(url: RegExp): mock.IRequestHandler; + whenPATCH(url: string, data?: string, headers?: any): mock.IRequestHandler; + whenPATCH(url: RegExp, data?: string, headers?: any): mock.IRequestHandler; + whenPATCH(url: string, data?: RegExp, headers?: any): mock.IRequestHandler; + whenPATCH(url: RegExp, data?: RegExp, headers?: any): mock.IRequestHandler; + whenPOST(url: string, data?: string, headers?: any): mock.IRequestHandler; + whenPOST(url: RegExp, data?: string, headers?: any): mock.IRequestHandler; + whenPOST(url: string, data?: RegExp, headers?: any): mock.IRequestHandler; + whenPOST(url: RegExp, data?: RegExp, headers?: any): mock.IRequestHandler; + whenPUT(url: string, data?: string, headers?: any): mock.IRequestHandler; + whenPUT(url: RegExp, data?: string, headers?: any): mock.IRequestHandler; + whenPUT(url: string, data?: RegExp, headers?: any): mock.IRequestHandler; + whenPUT(url: RegExp, data?: RegExp, headers?: any): mock.IRequestHandler; + } + + export module mock { + + // returned interface by the the mocked HttpBackendService expect/when methods + interface IRequestHandler { + respond(func: Function): void; + respond(status: number, data?: any, headers?: any): void; + respond(data: any, headers?: any): void; + + // Available wehn ngMockE2E is loaded + passThrough(): void; + } + + } + +} diff --git a/Definitions/angular-resource-1.0.d.ts b/Definitions/angular-resource-1.0.d.ts new file mode 100644 index 000000000..e67551761 --- /dev/null +++ b/Definitions/angular-resource-1.0.d.ts @@ -0,0 +1,66 @@ +// Type definitions for Angular JS 1.0 (ngResource module) +// Project: http://angularjs.org +// Definitions by: Diego Vilar +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + + +/////////////////////////////////////////////////////////////////////////////// +// ngResource module (angular-resource.js) +/////////////////////////////////////////////////////////////////////////////// +module ng.resource { + + /////////////////////////////////////////////////////////////////////////// + // 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, actionDescriptors?: any): IResourceClass; + } + + // Just a reference to facilitate describing new actions + interface IActionDescriptor { + method: string; + isArray?: bool; + params?: any; + headers?: any; + } + + // 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. + interface IResourceClass { + get: IActionCall; + save: IActionCall; + query: IActionCall; + remove: IActionCall; + delete: IActionCall; + } + + // 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. + interface IActionCall { + (): IResource; + (dataOrParams: any): IResource; + (dataOrParams: any, success: Function): IResource; + (success: Function, error?: Function): IResource; + (params: any, data: any, success?: Function, error?: Function): IResource; + } + + interface IResource { + $save: IActionCall; + $remove: IActionCall; + $delete: IActionCall; + + // No documented, but they are there, just as any custom action will be + $query: IActionCall; + $get: IActionCall; + } + +} diff --git a/Definitions/angular-sanitize-1.0.d.ts b/Definitions/angular-sanitize-1.0.d.ts new file mode 100644 index 000000000..cf977ca90 --- /dev/null +++ b/Definitions/angular-sanitize-1.0.d.ts @@ -0,0 +1,22 @@ +// Type definitions for Angular JS 1.0 (ngSanitize module) +// Project: http://angularjs.org +// Definitions by: Diego Vilar +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +/// + +/////////////////////////////////////////////////////////////////////////////// +// ngSanitize module (angular-sanitize.js) +/////////////////////////////////////////////////////////////////////////////// +module ng.sanitize { + + /////////////////////////////////////////////////////////////////////////// + // SanitizeService + // see http://docs.angularjs.org/api/ngSanitize.$sanitize + /////////////////////////////////////////////////////////////////////////// + interface ISanitizeService { + (html: string): string; + } + +} diff --git a/Definitions/async-0.1.d.ts b/Definitions/async-0.1.d.ts index 8c91d1882..835c10777 100644 --- a/Definitions/async-0.1.d.ts +++ b/Definitions/async-0.1.d.ts @@ -1,5 +1,6 @@ // Type definitions for Async 0.1 // Project: https://github.com/caolan/async +// Definitions by: Boris Yankov // Definitions: https://github.com/borisyankov/DefinitelyTyped diff --git a/Definitions/backbone-0.9.d.ts b/Definitions/backbone-0.9.d.ts index 64a9fe8e3..225b196fd 100644 --- a/Definitions/backbone-0.9.d.ts +++ b/Definitions/backbone-0.9.d.ts @@ -1,169 +1,226 @@ // Type definitions for Backbone 0.9 -// https://github.com/borisyankov/DefinitelyTyped +// Project: http://backbonejs.org/ +// Definitions by: Boris Yankov +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +/// declare module Backbone { - export class Events { - on(events: string, callback: (event) => any, context?: any): any; - off(events?: string, callback?: (event) => any, context?: any): any; - trigger(events: string, ...args: any[]): any; + export interface AddOptions extends Silenceable { + at: number; + } + + export interface CreateOptions extends Silenceable { + wait: bool; + } + + export interface HistoryOptions extends Silenceable { + pushState: bool; + root: string; } - export class Model { + export interface NavigateOptions { + trigger: bool; + } + + export interface RouterOptions { + routes: any; + } + + export interface Silenceable { + silent: bool; + } + + interface on { (eventName: string, callback: (...args: any[]) => void, context?: any): any; } + interface off { (eventName?: string, callback?: (...args: any[]) => void, context?: any): any; } + interface trigger { (eventName: string, ...args: any[]): any; } + interface bind { (eventName: string, callback: (...args: any[]) => void, context?: any): any; } + interface unbind { (eventName?: string, callback?: (...args: any[]) => void, context?: any): any; } + + declare class Events { + on(eventName: string, callback: (...args:any[]) => void, context?: any): any; + off(eventName?: string, callback?: (...args:any[]) => void, context?: any): any; + trigger(eventName: string, ...args: any[]): any; + bind(eventName: string, callback: (...args:any[]) => void, context?: any): any; + unbind(eventName?: string, callback?: (...args:any[]) => void, context?: any): any; + } + + export class ModelBase extends Events { + fetch(options?: JQueryAjaxSettings); + url: string; // or url(): string; + parse(response); + toJSON(): any; + } + + export class Model extends ModelBase { static extend(properties: any, classProperties?: any): any; // do not use, prefer TypeScript's extend functionality + attributes: any; + changed: any[]; + cid: string; + id: any; + idAttribute: string; + urlRoot: string; // or urlRoot() + constructor (attributes?: any, options?: any); + initialize(attributes?: any); get(attributeName: string): any; - set(attributeName: string, value: any): void; - set(obj: any): void; + set(attributeName: string, value: any); + set(obj: any); - escape(attribute); - has(attribute); - unset(attribute, options? ); - clear(options? ); - - id: any; - idAttribute: any; - cid; - attributes; - changed; - - bind(ev: string, f: Function, ctx?: any): void; /// ???? - - defaults; // or defaults(); - toJSON(): string; - fetch(options? ); - save(attributes? , options? ): void; - destroy(options? ): void; - validate(attributes); - isValid(); - url(); - urlRoot; // or urlRoot() - parse(response); - clone(); - isNew(); change(); - hasChanged(attribute? ); - changedAttributes(attributes? ); - previous(attribute); - previousAttributes(); + changedAttributes(attributes?: any): any[]; + clear(options?: Silenceable); + clone(): Model; + defaults(): any; + destroy(options?: JQueryAjaxSettings); + escape(attribute: string); + has(attribute: string): bool; + hasChanged(attribute?: string): bool; + isNew(): bool; + isValid(): string; + previous(attribute: string): any; + previousAttributes(): any[]; + save(attributes?: any, options?: JQueryAjaxSettings); + unset(attribute: string, options?: Silenceable); + validate(attributes: any): any; } - export class Collection { + export class Collection extends ModelBase { static extend(properties: any, classProperties?: any): any; // do not use, prefer TypeScript's extend functionality - model; - - constructor (models? , options? ); - - models; - toJSON(): any; - - ///// start UNDERSCORE 28: - bind(ev: string, f: Function, ctx?: any): void; + model: Model; + models: any; collection: Model; - create(attrs, opts? ): Collection; - each(f: (elem: any) => void ): void; - last(): any; - last(n: number): any[]; - filter(f: (elem: any) => any): Collection; - without(...values: any[]): Collection; - - // Underscore bindings - - each(object: any, iterator: (value, key, list? ) => void , context?: any): any[]; - forEach(object: any, iterator: (value, key, list? ) => void , context?: any): any[]; - map(object: any, iterator: (value, key, list? ) => void , context?: any): any[]; - reduce(list: any[], iterator: any, memo: (memo: any, element: any, index: number, list: any[]) => any, context?: any): any[]; - reduceRight(list: any[], iterator: (memo: any, element: any, index: number, list: any[]) => any, memo: any, context?: any): any[]; - find(list: any[], iterator: any, context?: any): any; // ??? - detect(list: any[], iterator: any, context?: any): any; // ??? - filter(list: any[], iterator: any, context?: any): any[]; - select(list: any[], iterator: any, context?: any): any[]; - reject(list: any[], iterator: any, context?: any): any[]; - every(list: any[], iterator: any, context?: any): bool; - all(list: any[], iterator: any, context?: any): bool; - any(list: any[], iterator?: any, context?: any): bool; - some(list: any[], iterator?: any, context?: any): bool; - contains(list: any, value: any): bool; - contains(list: any[], value: any): bool; - include(list: any, value: any): bool; - include(list: any[], value: any): bool; - invoke(list: any[], methodName: string, arguments: any[]): any; - invoke(object: any, methodName: string, ...arguments: any[]): any; - max(list: any[], iterator?: any, context?: any): any; - min(list: any[], iterator?: any, context?: any): any; - sortBy(list: any[], iterator?: any, context?: any): any; - sortedIndex(list: any[], valueL: any, iterator?: any): number; - toArray(list: any): any[]; - size(list: any): number; - first(array: any[], n?: number): any; - initial(array: any[], n?: number): any[]; - rest(array: any[], n?: number): any[]; - last(array: any[], n?: number): any; - without(array: any[], ...values: any[]): any[]; - indexOf(array: any[], value: any, isSorted?: bool): number; - shuffle(list: any[]): any[]; - lastIndexOf(array: any[], value: any, fromIndex?: number): number; - isEmpty(object: any): bool; - groupBy(list: any[], iterator: any): any; - - add(models, options? ); - remove(models, options? ); - get(id); - getByCid(cid); - at(index: number); - push(model, options? ); - pop(options? ); - unshift(model, options? ); - shift(options? ); length: number; - //comparator; - sort(options? ); - pluck(attribute); - where(attributes); - url; // or url() - parse(response); - fetch(options?: any): void; - reset(models, options? ); - create(attributes, options? ); + + constructor (models?: any, options?: any); + + comparator(element: Model): number; + comparator(element: Model): string; + comparator(compare: Model, to?: Model): number; + + add(model: Model, options?: AddOptions); + add(models: Model[], options?: AddOptions); + at(index: number): Model; + get(id: any): Model; + getByCid(cid): Model; + create(attributes: any, options?: CreateOptions): Model; + pluck(attribute: string): any[]; + push(model: Model, options?: AddOptions); + pop(options?: Silenceable); + remove(model: Model, options?: Silenceable); + remove(models: Model[], options?: Silenceable); + reset(models?: Model[], options?: Silenceable); + shift(options?: Silenceable); + sort(options?: Silenceable); + unshift(model: Model, options?: AddOptions); + where(properies: any): Model[]; + + all(iterator: (element: Model, index: number) => bool, context?: any): bool; + any(iterator: (element: Model, index: number) => bool, context?: any): bool; + collect(iterator: (element: Model, index: number, context?: any) => any[], context?: any): any[]; + compact(): Model[]; + contains(value: any): bool; + countBy(iterator: (element: Model, index: number) => any): any[]; + countBy(attribute: string): any[]; + detect(iterator: (item: any) => bool, context?: any): any; // ??? + difference(...model: Model[]): Model[]; + drop(): Model; + drop(n: number): Model[]; + each(iterator: (element: Model, index: number, list?: any) => void, context?: any); + every(iterator: (element: Model, index: number) => bool, context?: any): bool; + filter(iterator: (element: Model, index: number) => bool, context?: any): Model[]; + find(iterator: (element: Model, index: number) => bool, context?: any): Model; + first(): Model; + first(n: number): Model[]; + flatten(shallow?: bool): Model[]; + foldl(iterator: (memo: any, element: Model, index: number) => any, initialMemo: any, context?: any): any; + forEach(iterator: (element: Model, index: number, list?: any) => void, context?: any); + groupBy(iterator: (element: Model, index: number) => any): any[]; + groupBy(attribute: string): any[]; + include(value: any): bool; + indexOf(element: Model, isSorted?: bool): number; + initial(): Model; + initial(n: number): Model[]; + inject(iterator: (memo: any, element: Model, index: number) => any, initialMemo: any, context?: any): any; + intersection(...model: Model[]): Model[]; + isEmpty(object: any): bool; + invoke(methodName: string, arguments?: any[]); + last(): Model; + last(n: number): Model[]; + lastIndexOf(element: Model, fromIndex?: number): number; + map(iterator: (element: Model, index: number, context?: any) => any[], context?: any): any[]; + max(iterator?: (element: Model, index: number) => any, context?: any): Model; + min(iterator?: (element: Model, index: number) => any, context?: any): Model; + object(...values: any[]): any[]; + reduce(iterator: (memo: any, element: Model, index: number) => any, initialMemo: any, context?: any): any; + select(iterator: any, context?: any): any[]; + size(): number; + shuffle(): any[]; + some(iterator: (element: Model, index: number) => bool, context?: any): bool; + sortBy(iterator: (element: Model, index: number) => number, context?: any): Model[]; + sortBy(attribute: string, context?: any): Model[]; + sortedIndex(element: Model, iterator?: (element: Model, index: number) => number): number; + range(stop: number, step?: number); + range(start: number, stop: number, step?: number); + reduceRight(iterator: (memo: any, element: Model, index: number) => any, initialMemo: any, context?: any): any[]; + reject(iterator: (element: Model, index: number) => bool, context?: any): Model[]; + rest(): Model; + rest(n: number): Model[]; + tail(): Model; + tail(n: number): Model[]; + toArray(): any[]; + union(...model: Model[]): Model[]; + uniq(isSorted?: bool, iterator?: (element: Model, index: number) => bool): Model[]; + without(...values: any[]): Model[]; + zip(...model: Model[]): Model[]; } export class Router { static extend(properties: any, classProperties?: any): any; // do not use, prefer TypeScript's extend functionality - routes; - constructor (options? ); - route(route, name, callback? ); - navigate(fragment, options? ); + routes: any; + + constructor (options?: RouterOptions); + initialize (options?: RouterOptions); + route(route: string, name: string, callback?: (...parameter: any[]) => void); + navigate(fragment: string, options?: NavigateOptions); } export var history: History; - export class History { - start(options? ); + start(options?: HistoryOptions); + navigate(fragment: string, options: any); + pushSate(); } - export class Sync { - sync(method, model, options? ); - emulateHTTP: bool; - emulateJSONBackbone: bool; + export interface ViewOptions { + model?: Backbone.Model; + collection?: Backbone.Collection; + el?: Element; + id?: string; + className?: string; + tagName?: string; + attributes?: any[]; } - export class View { + export class View extends Events { static extend(properties: any, classProperties?: any): any; // do not use, prefer TypeScript's extend functionality - constructor (options?: any); + constructor (options?: ViewOptions); $(selector: string): any; model: Model; - make(tagName: string, attrs? , opts? ): View; - setElement(element: HTMLElement, delegate?: bool): void; + make(tagName: string, attrs?, opts?): View; + setElement(element: HTMLElement, delegate?: bool); tagName: string; events: any; @@ -173,15 +230,19 @@ declare module Backbone { attributes; $(selector); render(); - remove(): void;; - make(tagName, attributes? , content? ); + remove(); + make(tagName, attributes?, content?); //delegateEvents: any; delegateEvents(events?: any): any; undelegateEvents(); } - export class Utility { - noConflict(): any; - setDomLibrary(jQueryNew); - } -} \ No newline at end of file + // SYNC + function sync(method, model, options?: JQueryAjaxSettings); + var emulateHTTP: bool; + var emulateJSONBackbone: bool; + + // Utility + function noConflict(): Backbone; + function setDomLibrary(jQueryNew); +} diff --git a/Definitions/bootstrap-2.1.d.ts b/Definitions/bootstrap-2.1.d.ts index 8e475e732..2766919cb 100644 --- a/Definitions/bootstrap-2.1.d.ts +++ b/Definitions/bootstrap-2.1.d.ts @@ -1,7 +1,9 @@ // Type definitions for Bootstrap 2.1 -// https://github.com/borisyankov/DefinitelyTyped +// Project: http://twitter.github.com/bootstrap/ +// Definitions by: Boris Yankov +// Definitions: https://github.com/borisyankov/DefinitelyTyped -/// +/// interface ModalOptions { backdrop?: bool; diff --git a/Definitions/chosen-0.9.d.ts b/Definitions/chosen-0.9.d.ts new file mode 100644 index 000000000..29b2ca4ff --- /dev/null +++ b/Definitions/chosen-0.9.d.ts @@ -0,0 +1,25 @@ +// Type definitions for Chosen.JQuery 0.9 +// Project: http://harvesthq.github.com/chosen/ +// Definitions by: Boris Yankov +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +/// + +interface ChosenOptions { + allow_single_deselect?: bool; + disable_search_threshold?: number; + disable_search?: bool; + search_contains?: bool; + single_backstroke_delete?: bool; + max_selected_options?: number; + placeholder_text_multiple?: string; + placeholder_text?: string; + placeholder_text_single?: string; + no_results_text?: string; +} + +interface JQuery { + chosen(): JQuery; + chosen(options: ChosenOptions): JQuery; +} \ No newline at end of file diff --git a/Definitions/codemirror-3.0.d.ts b/Definitions/codemirror-3.0.d.ts new file mode 100644 index 000000000..0db876824 --- /dev/null +++ b/Definitions/codemirror-3.0.d.ts @@ -0,0 +1,220 @@ +// Type definitions for CodeMirror 3.0 +// Project: http://codemirror.net +// Definitions by: https://github.com/fdecampredon +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +interface CodeMirrorScrollInfo { + x: number; + y: number; + width: number; + height: number; +} + +interface CodeMirrorCoords { + x: number; + y: number; + yBot: number; +} + +interface CodeMirrorPosition { + line: number; + ch: number; +} + +interface CodeMirrorHistorySize { + undo: number; + redo: number; +} + +interface CodeMirrorToken { + start: number; + end: number; + string: string; + className: string; + state: any; +} + +interface CodeMirrorMarkTextOptions { + inclusiveLeft: bool; + inclusiveRight: bool; + startStype: string; + endStyle: string; +} + + +interface CodeMirrorBookMark { + clear(): void; + find(): CodeMirrorPosition; +} + +interface CodeMirrorLineHandle { + +} + +interface CodeMirrorLineInfo { + line: number; + handler: CodeMirrorLineHandle; + text: string; + markerText: string; + markerClass: string; + lineClass: string; + bgClass: string; +} + + +interface CodeMirrorViewPort { + from: number; + to: number; +} + + +interface CodeMirrorChange { + from: CodeMirrorPosition; + to: CodeMirrorPosition; + text: string[]; + next: CodeMirrorChange; +} + +interface CodeMirrorChangeListener { + (editor: CodeMirrorEditor, change: CodeMirrorChange): void; +} + +interface CodeMirrorViewPortChangeListener { + (editor: CodeMirrorEditor, from: CodeMirrorPosition, to: CodeMirrorPosition): void; +} + + +interface CodeMirrorStream { + eol(): bool; + sol(): bool; + peek(): string; + next(): string; + eat(match: any): string; + eatWhile(match: any): bool; + eatSpace(): bool; + skipToEnd(): void; + skipTo(ch: string): bool; + match(pattern: RegExp, consume: bool, caseFold: bool): bool; + backUp(n: number): void; + column(): number; + indentation(): number; + current(): string; + string: string; + pos: number; +} + + +interface CodeMirrorModeDefition { + (options: CodeMirrorOptions, modeOptions: any): CodeMirrorMode; +} + + + +interface CodeMirrorMode { + startState(): any; + token(stream: CodeMirrorStream, state: any): string; + blankLine? (state: any): string; + copyState? (state: any): any; + indent? (state: any, textAfter: string, text: String): number; + electricChars?: string; +} + + +interface CodeMirrorEditor { + getValue(): string; + setValue(valu: string): void; + getSelection(): string; + replaceSelection(value: string): void; + setSize(width: number, height: number): void; + focus(): void; + scrollTo(x: number, y: number): void; + getScrollInfo(): CodeMirrorScrollInfo; + setOption(option: string, value: any); + getOption(option: string): any; + getMode(): CodeMirrorMode; + cursorCoords(start: bool, mode: string): CodeMirrorCoords; + charCoords(pos: CodeMirrorPosition, mode: string): CodeMirrorCoords; + undo(): void; + redo(): void; + historySize(): CodeMirrorHistorySize; + clearHistory(): void; + getHistory(): any; + setHistory(history: any); + indentLine(line: number, dir?: bool); + getTokenAt(pos: CodeMirrorPosition): CodeMirrorToken; + markText(from: CodeMirrorPosition, to: CodeMirrorPosition, className: string, + option?: CodeMirrorMarkTextOptions): CodeMirrorBookMark; + setBookmark(pos: CodeMirrorPosition): CodeMirrorBookMark; + findMarksAt(pos: CodeMirrorPosition): CodeMirrorBookMark[]; + setMarker(line: number, text: string, className: string): CodeMirrorLineHandle; + clarMarker(line: number): void; + setLineClass(line: number, className: string, backgroundClassName: string): CodeMirrorLineHandle; + hideLine(line: number): CodeMirrorLineHandle; + showLine(line: number): CodeMirrorLineHandle; + onDeleteLine(line: number, callBack: Function); + lineInfo(line: number): CodeMirrorLineInfo; + getLineHandler(line: number): CodeMirrorLineHandle; + getViewPort(): CodeMirrorViewPort; + addWidget(pos: CodeMirrorPosition, node: Node, scrollIntoView: bool); + matchBrackets(): void; + lineCount(): number; + getCursor(start?: bool): CodeMirrorPosition; + somethingSelected(): bool; + setCursor(pos: CodeMirrorPosition): void; + setSelection(start: CodeMirrorPosition, end: CodeMirrorPosition): void; + getLine(n: number): string; + setLine(n: string, text: string): void; + removeLine(n: number): void; + getRange(from: CodeMirrorPosition, to: CodeMirrorPosition): string; + replaceRange(text: string, from: CodeMirrorPosition, to?: CodeMirrorPosition): void; + posFromIndex(index: number): CodeMirrorPosition; + indexFromPos(pos: CodeMirrorPosition): number; + operation(func: Function): any; + compundChange(func: Function): any; + refresh(): void; + getInputField(): HTMLTextAreaElement; + getWrapperElement(): HTMLElement; + getScrollerElement(): HTMLElement; + getGutterElement(): HTMLElement; + getStateAfter(line): any; +} + + +interface CodeMirrorOptions { + value?: string; + mode?: string; + them?: string; + indentUnit?: number; + smartIndend?: number; + tabSize?: number; + indentWithTabs?: bool; + electricsChars?: bool; + autoClearEmptyLines?: bool; + keyMap?: string; + extraKeys?: any; + lineWrapping?: bool; + lineNumbers?: bool; + firstLineNumber?: bool; + lineNumberFormatter?: Function; + gutter?: bool; + fixedGutter?: bool; + readOnly?: bool; + onChange?: CodeMirrorChangeListener; + onCursorActivity?: Function; + onViewportChange?: CodeMirrorViewPortChangeListener; + //**todo finish +} + + +declare var CodeMirror: { + (element: HTMLElement, options?: CodeMirrorOptions): CodeMirrorEditor; + (element: Function, options?: CodeMirrorOptions): CodeMirrorEditor; + version: string; + defaults: CodeMirrorOptions; + fromTextArea(textArea: HTMLTextAreaElement, options?: CodeMirrorOptions): CodeMirrorEditor; + defineMode(name: string, func: CodeMirrorModeDefition); + defineMIME(mime: string, mode: string); + connect(target: EventTarget, event: String, func: Function); + commands: any; +} diff --git a/Definitions/easeljs-0.5.d.ts b/Definitions/easeljs-0.5.d.ts new file mode 100644 index 000000000..46caa678a --- /dev/null +++ b/Definitions/easeljs-0.5.d.ts @@ -0,0 +1,571 @@ +// Type definitions for EaselJS 0.5 +// Project: http://www.createjs.com/#!/EaselJS +// Definitions by: Pedro Ferreira +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/* + Copyright (c) 2012 Pedro Ferreira + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + + +/// + +// rename the native MouseEvent, to avoid conflit with createjs's MouseEvent +interface NativeMouseEvent extends MouseEvent { + +} + +module createjs { + // :: base classes :: // + + export class DisplayObject { + // properties + alpha: number; + cacheCanvas: HTMLCanvasElement; + cacheID: number; + compositeOperation: string; + filters: Filter[]; + hitArea: DisplayObject; + id: number; + mask: Shape; + mouseEnabled: bool; + name: string; + parent: DisplayObject; + regX: number; + regY: number; + rotation: number; + scaleX: number; + scaleY: number; + shadow: Shadow; + skewX: number; + skewY: number; + snapToPixel: bool; + static suppressCrossDomainErrors: bool; + visible: bool; + x: number; + y: number; + + // methods + cache(x: number, y: number, width: number, height: number, scale?: number): void; + clone(): DisplayObject; + draw(ctx: CanvasRenderingContext2D, ignoreCache?: bool): void; + getCacheDataURL(): string; + getConcatenatedMatrix(mtx: Matrix2D): Matrix2D; + getMatrix(matrix: Matrix2D): Matrix2D; + getStage(): Stage; + globalToLocal(x: number, y: number): Point; + hitTest(x: number, y: number): bool; + isVisible(): bool; + localToGlobal(x: number, y: number): Point; + localToLocal(x: number, y: number, target: DisplayObject): Point; + setTransform(x: number, y: number, scaleX: number, scaleY: number, rotation: number, skewX: number, skewY: number, regX: number, regY: number): DisplayObject; + setupContext(ctx: CanvasRenderingContext2D): void; + toString(): string; + uncache(): void; + updateCache(compositeOperation: string): void; + + // events + onClick: (event: MouseEvent) => any; + onDoubleClick: (event: MouseEvent) => any; + onMouseOut: (event: MouseEvent) => any; + onMouseOver: (event: MouseEvent) => any; + onPress: (event: MouseEvent) => any; + onTick: () => any; + } + + + export class Filter { + constructor (); + applyFilter(ctx: CanvasRenderingContext2D, x: number, y: number, width: number, height: number, targetCtx?: CanvasRenderingContext2D, targetX?: number, targetY?: number): bool; + clone(): Filter; + getBounds(): Rectangle; + toString(): string; + } + + + // :: The rest :: // + + export class AlphaMapFilter extends Filter { + // properties + alphaMap: any; //Image or HTMLCanvasElement + + // methods + constructor (alphaMap: HTMLImageElement); + constructor (alphaMap: HTMLCanvasElement); + clone(): AlphaMapFilter; + } + + + export class AlphaMaskFilter extends Filter { + // properties + mask: any; // HTMLImageElement or HTMLCanvasElement + + // methods + constructor (mask: HTMLImageElement); + constructor (mask: HTMLCanvasElement); + clone(): AlphaMaskFilter; + } + + + export class Bitmap extends DisplayObject { + // properties + image: any; // HTMLImageElement or HTMLCanvasElement or HTMLVideoElement + snapToPixel: bool; + sourceRect: Rectangle; + + // methods + constructor (imageOrUrl: HTMLImageElement); + constructor (imageOrUrl: HTMLCanvasElement); + constructor (imageOrUrl: HTMLVideoElement); + constructor (imageOrUrl: string); + + clone(): Bitmap; + updateCache(): void; + } + + + export class BitmapAnimation extends DisplayObject { + // properties + currentAnimation: string; + currentAnimationFrame: number; + currentFrame: number; + offset: number; + paused: bool; + snapToPixel: bool; + spriteSheet: SpriteSheet; + + // methods + constructor (spriteSheet: SpriteSheet); + advance(): void; + cache(): void; + clone(): BitmapAnimation; + gotoAndPlay(frameOrAnimation: string): void; + gotoAndPlay(frameOrAnimation: number): void; + play(): void; + stop(): void; + updateCache(): void; + + // events + onAnimationEnd: (reference: BitmapAnimation, animationEnded: string) => any; + } + + + export class BoxBlurFilter extends Filter { + // properties + blurX: number; + blurY: number; + quality: number; + + // methods + constructor (blurX: number, blurY: number, quality: number); + clone(): BoxBlurFilter; + } + + + export class ColorFilter extends Filter { + // properties + alphaOffset: number; + blueMultiplier: number; + blueOffset: number; + greenMultiplier: number; + greenOffset: number; + redMultiplier: number; + redOffset: number; + + // methods + constructor (redMultiplier?: number, greenMultiplier?: number, blueMultiplier?: number, alphaMultiplier?: number, redOffset?: number, greenOffset?: number, blueOffset?: number, alphaOffset?: number); + clone(): ColorFilter; + } + + + export class ColorMatrix { + // properties + DELTA_INDEX: number[]; + IDENTITY_MATRIX: number[]; + LENGTH: number; + + // methods + constructor (brightness: number, contrast: number, saturation: number, hue: number); + adjustBrightness(value: number): ColorMatrix; + adjustColor(brightness: number, contrast: number, saturation: number, hue: number): ColorMatrix; + adjustContrast(value: number): ColorMatrix; + adjustHue(value: number): ColorMatrix; + adjustSaturation(value: number): ColorMatrix; + clone(): ColorMatrix; + concat(matrix: ColorMatrix[]): ColorMatrix; + copyMatrix(matrix: ColorMatrix[]): ColorMatrix; + reset(): ColorMatrix; + toArray(): number[]; + } + + + export class ColorMatrixFilter extends Filter { + // methods + constructor (matrix: number[]); + clone(): ColorMatrixFilter; + } + + + export class Command + { + // methods + constructor (f, params, path); + exec(scope: any): void; + } + + + export class Container extends DisplayObject { + // properties + children: DisplayObject[]; + + // methods + addChild(...child: DisplayObject[]): DisplayObject; + addChildAt(...childOrIndex: any[]): DisplayObject; // actually (...child: DisplayObject[], index: number) + clone(recursive?: bool): Container; + contains(child: DisplayObject): bool; + getChildAt(index: number): DisplayObject; + getChildIndex(child: DisplayObject): number; + getNumChildren(): number; + getObjectsUnderPoint(x, number, y: number): DisplayObject[]; + getObjectUnderPoint(x: number, y: number): DisplayObject; + hitTest(x: number, y: number): bool; + removeAllChildren(): void; + removeChild(...child: DisplayObject[]): bool; + removeChildAt(...index: number[]): bool; + setChildIndex(child: DisplayObject, index: number): void; + sortChildren(sortFunction: (a: DisplayObject, b: DisplayObject) => number): void; + swapChildren(child1: DisplayObject, child2: DisplayObject): void; + swapChildrenAt(index1: number, index2: number): void; + } + + + export class DOMElement extends DisplayObject { + // properties + htmlElement: HTMLElement; + + // methods + constructor (htmlElement: HTMLElement); + clone(): DOMElement; + } + + + export class Graphics { + // properties + BASE_64: Object; + curveTo(cpx: number, cpy: number, x: number, y: number): Graphics; // same as quadraticCurveTo() + drawRect(x: number, y: number, width: number, height: number): Graphics; // same as rect() + STROKE_CAPS_MAP: string[]; + STROKE_JOINTS_MAP: string[]; + + // methods + arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise: bool): Graphics; + arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): Graphics; + beginBitmapFill(image: Object, repetition?: string): Graphics; + beginBitmapStroke(image: Object, repetition?: string): Graphics; + beginFill(color: string): Graphics; + beginLinearGradientFill(colors: string[], ratios: number[], x0: number, y0: number, x1: number, y1: number): Graphics; + beginLinearGradientStroke(colors: string[], ratios: number[], x0: number, y0: number, x1: number, y1: number): Graphics; + beginRadialGradientFill(colors: string[], ratios: number[], x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): Graphics; + beginRadialGradientStroke(colors: string[], ratios: number[], x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): Graphics; + beginStroke(color: string): Graphics; + bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): Graphics; + clear(): Graphics; + clone(): Graphics; + closePath(): Graphics; + decodePath(str: string): Graphics; + draw(ctx: CanvasRenderingContext2D): void; + drawAsPath(ctx: CanvasRenderingContext2D): void; + drawCircle(x: number, y: number, radius: number): Graphics; + drawEllipse(x: number, y: number, width: number, height: number): Graphics; + drawPolyStar(x: number, y: number, radius: number, sides: number, pointSize: number, angle: number): Graphics; + drawRoundRect(x: number, y: number, width: number, height: number, radius: number): Graphics; + drawRoundRectComplex(x: number, y: number, width: number, height: number, radiusTL: number, radiusTR: number, radiusBR: number, radisBL: number): Graphics; + endFill(): Graphics; + endStroke(): Graphics; + static getHSL(hue: number, saturation: number, lightness: number, alpha?: number): string; + static getRGB(red: number, green: number, blue: number, alpha?: number): string; + lineTo(x: number, y: number): Graphics; + moveTo(x: number, y: number): Graphics; + quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): Graphics; + rect(x: number, y: number, width: number, height: number): Graphics; + setStrokeStyle(thickness: number, caps?: string, joints?: string, miter?: number): Graphics; // caps and joints can be a string or number + setStrokeStyle(thickness: number, caps?: number, joints?: string, miter?: number): Graphics; + setStrokeStyle(thickness: number, caps?: string, joints?: number, miter?: number): Graphics; + setStrokeStyle(thickness: number, caps?: number, joints?: number, miter?: number): Graphics; + toString(): string; + } + + + export class Matrix2D { + // properties + a: number; + alpha: number; + atx: number; + b: number; + c: number; + compositeOperation: string; + d: number; + static DEG_TO_RAD: number; + static identity: Matrix2D; + shadow: Shadow; + ty: number; + + // methods + constructor (a: number, b: number, c: number, d: number, tx: number, ty: number); + append(a: number, b: number, c: number, d: number, tx: number, ty: number): Matrix2D; + appendMatrix(matrix: Matrix2D): Matrix2D; + appendProperties(a: number, b: number, c: number, d: number, tx: number, ty: number, alpha: number, shadow: Shadow, compositeOperation: string): Matrix2D; + appendTransform(x: number, y: number, scaleX: number, scaleY: number, rotation: number, skewX: number, skewY: number, regX?: number, regY?: number): Matrix2D; + clone(): Matrix2D; + decompose(target: Object): Matrix2D; + identity(): Matrix2D; + invert(): Matrix2D; + isIdentity(): bool; + prepend(a: number, b: number, c: number, d: number, tx: number, ty: number): Matrix2D; + prependMatrix(matrix: Matrix2D): Matrix2D; + prependProperties(alpha: number, shadow: Shadow, compositeOperation: string): Matrix2D; + prependTransform(x: number, y: number, scaleX: number, scaleY: number, rotation: number, skewX: number, skewY: number, regX?: number, regY?: number): Matrix2D; + rotate(angle: number): Matrix2D; + scale(x: number, y: number): Matrix2D; + skew(skewX: number, skewY: number): Matrix2D; + toString(): string; + translate(x: number, y: number): Matrix2D; + } + + + export class MouseEvent { + + // properties + nativeEvent: NativeMouseEvent; + pointerID: number; + primaryPointer: bool; + rawX: number; + rawY: number; + stageX: number; + stageY: number; + target: DisplayObject; + type: string; + + // methods + constructor (type: string, stageX: number, stageY: number, target: DisplayObject, nativeEvent: NativeMouseEvent, pointerID: number, primary: bool, rawX: number, rawY: number); + clone(): MouseEvent; + toString(): string; + + // events + onMouseMove: (event: MouseEvent) => any; + onMouseUp: (event: MouseEvent) => any; + } + + + export class MovieClip extends Container { + // properties + actionsEnabled: bool; + static INDEPENDENT: string; + loop: bool; + mode: string; + paused: bool; + static SINGLE_FRAME: string; + startPosition: number; + static SYNCHED: string; + timeline: Timeline; //HERE requires tweenJS + + // methods + constructor (mode: string, startPosition: number, loop: bool, labels: Object); + clone(recursive?: bool): MovieClip; + gotoAndPlay(positionOrLabel: string): void; + gotoAndPlay(positionOrLabel: number): void; + gotoAndStop(positionOrLabel: string): void; + gotoAndStop(positionOrLabel: number): void; + play(): void; + stop(): void; + } + + + export class Point { + // properties + x: number; + y: number; + + // methods + constructor (x: number, y: number); + clone(): Point; + toString(): string; + } + + + export class Rectangle { + // properties + x: number; + y: number; + width: number; + height: number; + + // methods + constructor (x: number, y: number, width: number, height: number); + clone(): Rectangle; + toString(): string; + } + + + export class Shadow { + // properties + blur: number; + color: string; + static identity: Shadow; + offsetX: number; + offsetY: number; + + // methods + constructor (color: string, offsetX: number, offsetY: number, blur: number); + clone(): Shadow; + toString(): string; + } + + + export class Shape extends DisplayObject { + // properties + graphics: Graphics; + + // methods + constructor (graphics?: Graphics); + clone(recursive?: bool): Shape; + } + + + // what is returned from .getAnimation() + interface SpriteSheetAnimation { + frames: number[]; + frequency: number; + name: string; + next: string; + } + + export class SpriteSheet { + // properties + complete: bool; + + // methods + constructor (data: Object); + clone(): SpriteSheet; + getAnimation(name: string): SpriteSheetAnimation; + getAnimations(): string[]; + getFrame(frameIndex: number): Object; + getNumFrames(animation: string): number; + toString(): string; + + // events + onComplete: () => any; + } + + + export class SpriteSheetBuilder { + // properties + defaultScale: number; + maxWidth: number; + maxHeight: number; + padding: number; + spriteSheet: SpriteSheet; + + // methods + addFrame(source: DisplayObject, sourceRect?: Rectangle, scale?: number, setupFunction?: () => any, setupParams?: any[], setupScope?: Object): any; //HERE returns number or null + addMovieClip(source: MovieClip, sourceRect?: Rectangle, scale?: number): void; + build(): void; + buildAsync(callback?: (reference: SpriteSheetBuilder) => any, timeSlice?: number): void; + clone(): SpriteSheetBuilder; + stopAsync(): void; + toString(): string; + } + + + export class SpriteSheetUtils { + static addFlippedFrames(spriteSheet: SpriteSheet, horizontal?: bool, vertical?: bool, both?: bool): void; + static extractFrame(spriteSheet: HTMLImageElement, frame: number): HTMLImageElement; + static flip(spriteSheet: HTMLImageElement, flipData: Object): void; + static mergeAlpha(rgbImage: HTMLImageElement, alphaImage: HTMLImageElement, canvas?: HTMLCanvasElement): HTMLCanvasElement; + } + + + export class Stage extends Container { + // properties + autoClear: bool; + canvas: HTMLCanvasElement; + mouseInBounds: bool; + mouseX: number; + mouseY: number; + snapToPixelEnabled: bool; + tickOnUpdate: bool; + + // methods + constructor (canvas: HTMLCanvasElement); + clone(): Stage; + enableMouseOver(frequency: number): void; + toDataURL(backgroundColor: string, mimeType: string): string; + + // events + onMouseDown: (event: MouseEvent) => any; + onMouseMove: (event: MouseEvent) => any; + onMouseUp: (event: MouseEvent) => any; + } + + + export class Text extends DisplayObject { + // properties + color: string; + font: string; + lineHeight: number; + lineWidth: number; + maxWidth: number; + outline: bool; + text: string; + textAlign: string; + textBaseline: string; + + // methods + constructor (text?: string, font?: string, color?: string); + clone(): Text; + getMeasuredHeight(): number; + getMeasuredLineHeight(): number; + getMeasuredWidth(): number; + } + + + export class Ticker { + // properties + static useRAF: bool; + + // methods + static addListener(o: Object, pauseable?: bool): void; + static getFPS(): number; + static getInterval(): number; + static getMeasuredFPS(ticks?: number): number; + static getPaused(): bool; + static getTicks(pauseable?: bool): number; + static getTime(pauseable: bool): number; + static init(): void; + static removeAllListeners(): void; + static removeListener(o: Object): void; + static setFPS(value: number): void; + static setInterval(interval: number): void; + static setPaused(value: bool): void; + + // events + tick: (timeElapsed: number) => any; + } + + + export class Touch { + // methods + static disable(stage: Stage): void; + static enable(stage: Stage, singleTouch?: bool, allowDefault?: bool): bool; + static isSupported(): bool; + } + + + export class UID { + // methods + static get(): number; + } +} \ No newline at end of file diff --git a/Definitions/ember-1.0.d.ts b/Definitions/ember-1.0.d.ts index 1ede154b1..3542b4723 100644 --- a/Definitions/ember-1.0.d.ts +++ b/Definitions/ember-1.0.d.ts @@ -1,50 +1,296 @@ -// Type definitions for Ember.js 1.0 +// Type definitions for Ember.js 1.0.pre // Project: http://emberjs.com/ +// Definitions by: Boris Yankov // Definitions: https://github.com/borisyankov/DefinitelyTyped -interface EmberApplication { - create(): EmberApplication; - MyView: EmberView; +declare module Ember { + + export class CoreObject { + isDestroyed: bool; + isDestroying: bool; + + destroy(): Object; + eachComputedProperty(callback: Function, binding: Object): void; + metaForProperty(key: string): any; + } + + export class Object extends CoreObject { + + static create(...arguments: any[]): Object; + + addObserver(key: string, target: Object, method: any): Object; + apply(obj: Object): Object; + beginPropertyChanges(): Observable; + cacheFor(keyName: string): Object; + decrementProperty(keyName: string, increment: Object): Object; + detect(obj: Object): bool; + endPropertyChanges(): Observable; + get(key: string): Object; + getProperties(...list: string[]): any; + getProperties(list: string[]): any; + getWithDefault(keyName: string, defaultValue: Object): Object; + hasObserverFor(key: string): bool; + incrementProperty(keyName: string, increment: Object): Object; + notifyPropertyChange(keyName: string): Observable; + propertyDidChange(keyName: string): Observable; + propertyWillChange(key: string): Observable; + removeObserver(key: string, target: Object, method: string): Observable; + removeObserver(key: string, target: Object, method: Function): Observable; + reopen(...arguments: any[]); + set(key: string, value: Object): Observable; + setProperties(hash: any): Observable; + setUnknownProperty(key: string, value: Object): void; + toggleProperty(keyName: string): Object; + unknownProperty(key: string): Object; + } + + export interface Mixin { + apply(obj: Object): Object; + create(obj: Object): Object; + detect(obj: Object): bool; + extend(first: Object, second: Object): Object; + reopen(...arguments: any[]): Mixin; + } + + export class View extends Object { + append(): View; + static create(...arguments: any[]): View; + } + + export interface Enumerable extends Mixin { + // Fields + firstObject: Object; + hasEnumerableObservers: bool; + lastObject: Object; + nextObject: Object; + + // Methods + addEnumerableObserver(target, opts); + compact(): any[]; + contains(obj: Object): bool; + enumerableContentDidChange(removing: number, adding: number): Object; + enumerableContentDidChange(removing: Ember.Enumerable, adding: Ember.Enumerable): Object; + enumerableContentDidChange(start: Number, removing: number, adding: number): Object; + enumerableContentDidChange(start: Number, removing: Ember.Enumerable, adding: Ember.Enumerable): Object; + + enumerableContentWillChange(removing: number, adding: number): Ember.Enumerable; + enumerableContentWillChange(removing: Ember.Enumerable, adding: Ember.Enumerable): Ember.Enumerable; + enumerableContentWillChange(start: Number, removing: number, adding: number): Ember.Enumerable; + enumerableContentWillChange(start: Number, removing: Ember.Enumerable, adding: Ember.Enumerable): Ember.Enumerable; + + every(callback: Function, target?: Object): bool; + everyProperty(key: string, value?: string): any[]; + filter(callback: Function, target?: Object): any[]; + filterProperty(key: string, value?: string): any[]; + find(callback: Function, target?: Object): Object; + findProperty(key: string, value?: string): Object; + /*forEach + getEach + invoke + map + mapProperty + reduce + removeEnumerableObserver + setEach + some + someProperty + toArray + uniq + without*/ + } + + export interface NativeArray extends Array { + activate(); + } + + + + export class Application extends Object { + customEvents: Object; + eventDispatcher: EventDispatcher; + // rootElement: DOMElement; + ready; + static create(...arguments: any[]): Application; + initialize(router: Router); + } + + export class Router { + + } + + export class EventDispatcher { + } + + export class Binding { + static from(); + static oneWay(path: string, flag?: bool); + static to(); + + connect(obj: Object): Binding; + copy(): Binding; + disconnect(obj: Object): Binding; + from(path: string): Binding; + oneWay(): Binding; + to(propertyPath: string): Binding; + } + + export interface ComputedProperty { + cacheable(aFlag?: bool): ComputedProperty; + meta(hash: any): ComputedProperty; + property(path: string): ComputedProperty; + volatile(): ComputedProperty; + } + + export interface Map { + + } + + export interface Observable extends Mixin { + addBeforeObserver(key, target, method); + addObject(obj: Object); + addObserver(key: string, target: Object, method: Function): Ember.Object; + addObserver(key: string, target: Object, method: string): Ember.Object; + beginPropertyChanges(): Ember.Observable; + cacheFor(keyName: string): Object; + contentArrayDidChange(array, idx, removedCount, addedCount); + contentArrayWillChange(array, idx, removedCount, addedCount); + contentItemSortPropertyDidChange(item); + decrementProperty(keyName: string, increment: Object): Object; + destroy(); + endPropertyChanges(): Ember.Observable; + get(key: string): Object; + getPath(path: string): Object; + getProperties(...list: string[]): any; + getProperties(list: any[]): any; + getWithDefault(keyName: string, defaultValue: Object): Object; + hasObserverFor(key: string): bool; + incrementProperty(keyName: string, increment: Object): Object; + insertItemSorted(item); + notifyPropertyChange(keyName: string): Ember.Observable; + orderBy(item1, item2); + propertyDidChange(keyName: string): Ember.Observable; + propertyWillChange(key: string): Ember.Observable; + removeObject(obj: Object); + removeObserver(key: string, target: Object, method: string): Ember.Observable; + removeObserver(key: string, target: Object, method: Function): Ember.Observable; + set(key: string, value: Object): Ember.Observable; + setPath(path: string, value: Object): Ember.Observable; + setProperties(hash): Ember.Observable; + setUnknownProperty(key: string, value: Object); + toggleProperty(keyName: string): Object; + unknownProperty(key: string): Object; + } } -interface EmberAlias { -} - -interface EmberArrayController { -} - -interface EmberBinding { -} - -interface EmberDescriptor { -} - -interface EmberNativeArray { - activate(): void; -} - -interface EmberObject { -} - -interface EmberView { -} interface EmberStatic { - $; // jQuery - A(arr?: any[]): EmberNativeArray; - addListener(obj: any, eventName: string, targetOrMethod: any, method: any): void; - alias(methodName: EmberDescriptor): EmberAlias; - assert(desc: string, test: bool): void; - beforeObserver(func: Function, propertyNames: string): Function; - bind(obj: any, to: string, from: string): EmberBinding; - cacheFor(obj: any, key: string): void; + // Statics + CP_DEFAULT_CACHEABLE: bool; + ENV: Object; + EXTEND_PROTOTYPES: bool; + LOG_BINDINGS: bool; + LOG_STACKTRACE_ON_DEPRECATION: bool; + META_KEY: string; + SHIM_ES5: bool; + StringS: Object; + VERSION: string; + VIEW_PRESERVES_CONTEXT: bool; - Application: EmberApplication; - Object: EmberObject; - View: EmberView; + Application: Ember.Application; + View: Ember.View; + + $; // jQuery + + // API Doc Members + A(arr: any[]): Ember.NativeArray; + addBeforeObserver(obj: Object, path: string, target: Object, method: Function); + addListener(obj: Object, eventName: string, target: Object, method: Function); + addObserver(obj: Object, path: string, target: Object, method: Function); + alias(methodName: string); + assert(desc: string, test: bool); + beforeObserver(func: Function); + beginPropertyChanges(); + bind(obj: Object, to: string, from: string): Ember.Binding; + cacheFor(obj: Object, key: string); + canInvoke(obj: Object, methodName: string); + changeProperties(cb: Function, binding?: Ember.Binding); + compare(first: Object, second: Object): number; + computed(func: Function): Ember.ComputedProperty; + copy(obj: Object, deep: bool): Object; + create(obj: Object, props: any); + deferEvent(obj: Object, eventName: string, param: any); + deprecate(message: string, test?: bool); + deprecateFunc(message: string, func: Function); + destroy(obj: Object): void; + empty(obj: Object): bool; + endPropertyChanges(); + finishChains(obj: Object); + get(obj: Object, keyName: string): Object; + getMeta(obj: Object, property: any); + getWithDefault(root, key, defaultValue); + hasListeners(obj: Object, eventName: string): bool; + immediateObserver(); + inspect(obj: Object): string; + isArray(obj?: any): bool; + isEqual(a: Object, b: Object): bool; + isGlobalPath(path: string): bool; + isWatching(obj: Object, key): bool; + keys(obj: Object): any[]; + listenersFor(obj: Object, eventName: string): any[]; + makeArray(obj: Object): any[]; + + Map(); + MapWithDefault(options); + mixin(obj: Object); + none(obj: Object): bool; + observer(func: Function); + oneWay(obj: Object, to, from); + onLoad(name: string, callback: Function); + + OrderedSet(); + overrideChains(obj: Object, keyName: string, m: any); + propertyDidChange(obj: Object, keyName: string): void; + propertyWillChange(obj: Object, keyName: string, value: any): void; + removeBeforeObserver(obj, path, target, method); + removeListener(obj, eventName, target, method); + removeObserver(obj, path, target, method); + + required(); + runLoadHooks(name: string, object: Object); + sendEvent(obj: Object, eventName: string, params); + set(obj: Object, keyName: string, value, tolerant); + setMeta(obj: Object, property, value); + setProperties(self, hash); + toString(): string; + tryInvoke(obj: Object, methodName: string, args: any[]): bool; + trySet(root, path, value); + typeOf(item): string; + warn(message: string, test: bool); + watchedEvents(obj: Object); + + // Other public members not listed in API Doc + meta(obj, writable); + metaPath(obj, path, writable); + normalizeTuple(target, path); + notifyBeforeObservers(obj: Object, keyName: string); + notifyObservers(obj: Object, keyName: string); + observersFor(obj: Object, path: string); + rewatch(obj: Object); + run(target, method); + defineProperty(obj: Object, keyName: string, desc, data, meta); + beforeObserversFor(obj: Object, path: string); + generateGuid(obj: Object, prefix); + getPath(); + guidFor(obj: Object); + identifyNamespaces(); + setPath(); + trySetPath(); + unwatch(obj: Object, keyName: string); + watch(obj: Object, keyName: string); + wrap(func: Function, superFunc: Function); } -declare var Em: EmberStatic; -declare var Ember: EmberStatic; \ No newline at end of file +declare var Em: Ember; +//declare var Ember: EmberStatic; \ No newline at end of file diff --git a/Definitions/express-2.d.ts b/Definitions/express-2.d.ts deleted file mode 100644 index 187019640..000000000 --- a/Definitions/express-2.d.ts +++ /dev/null @@ -1,124 +0,0 @@ -/// - -declare module "express" { - export function createServer(): ExpressServer; - export function static(path: string): any; - import http = module("http"); - export var listen; - - // Connect middleware - export function bodyParser(options?:any): (req: ExpressServerRequest, res: ExpressServerResponse, next) =>void; - export function errorHandler(opts?:any): (req: ExpressServerRequest, res: ExpressServerResponse, next) =>void; - export function methodOverride(): (req: ExpressServerRequest, res: ExpressServerResponse, next) =>void; - - export interface ExpressSettings { - env?: string; - views?: string; - } - - export interface ExpressServer { - set(name: string): any; - set(name: string, val: any): any; - enable(name: string): ExpressServer; - disable(name: string): ExpressServer; - enabled(name: string): bool; - disabled(name: string): bool; - configure(env: string, callback: () => void): ExpressServer; - configure(env: string, env2: string, callback: () => void ): ExpressServer; - configure(callback: () => void): ExpressServer; - settings: ExpressSettings; - engine(ext: string, callback: any): void; - param(param: Function): ExpressServer; - param(name: string, callback: Function): ExpressServer; - param(name: string, expressParam: any): ExpressServer; - param(name: any[], callback: Function): ExpressServer; - get(name: string): any; - get(path: string, handler: (req: ExpressServerRequest, res: ExpressServerResponse) => void ): void; - get(path: RegExp, handler: (req: ExpressServerRequest, res: ExpressServerResponse) => void ): void; - get(path: string, callbacks: any, callback: () => void ): void; - post(path: string, handler: (req: ExpressServerRequest, res: ExpressServerResponse) => void ): void; - post(path: RegExp, handler: (req: ExpressServerRequest, res: ExpressServerResponse) => void ): void; - post(path: string, callbacks: any, callback: () => void ): void; - all(path: string, callback: Function): void; - all(path: string, callback: Function, callback2: Function): void; - locals: any; - render(view: string, callback: (err: Error, html) => void ): void; - render(view: string, opts: any, callback: (err: Error, html) => void ): void; - routes: any; - listen(port: number, hostname: string, backlog: number, callback: Function): void; - listen(port: number, callback: Function): void; - listen(path: string, callback?: Function): void; - listen(handle: any, listeningListener?: Function): void; - use(route: string, callback: Function): ExpressServer; - use(route: string, server: ExpressServer): ExpressServer; - use(callback: Function): ExpressServer; - use(server: ExpressServer): ExpressServer; - } - - export interface ExpressServerRequest extends http.ServerRequest { - params: any; - query: any; - body: any; - files: any; - param(name: string): any; - route: any; - cookies: any; - signedCookies: any; - get(field: string): string; - accepts(types: string): any; - accepts(types: string[]): any; - accepted: any; - is(type: string): bool; - ip: string; - ips: string[]; - path: string; - host: string; - fresh: bool; - stale: bool; - xhr: bool; - protocol: string; - secure: bool; - subdomains: string[]; - acceptedLanguages: string[]; - acceptedCharsets: string[]; - acceptsCharset(charset: string): bool; - acceptsLanguage(lang: string): bool; - } - - export interface ExpressServerResponse extends http.ServerResponse { - status(code: number): any; - set(field: any): void; - set(field: string, value: string): void; - header(field: any): void; - header(field: string, value: string): void; - get(field: string): any; - cookie(name: string, value: any, options?: any): void; - clearcookie(name: string, options?: any): void; - redirect(status: number, url: string): void; - redirect(url: string): void; - charset: string; - send(bodyOrStatus: any); - send(body: any, status: any); - send(body: any, headers: any, status: number); - json(bodyOrStatus: any); - json(body: any, status: any); - json(body: any, headers: any, status: number); - jsonp(bodyOrStatus: any); - jsonp(body: any, status: any); - jsonp(body: any, headers: any, status: number); - type(type: string): void; - format(object: any): void; - attachment(filename?: string); - sendfile(path: string): void; - sendfile(path: string, options: any): void; - sendfile(path: string, options: any, fn: (err: Error) =>void ): void; - download(path: string): void; - download(path: string, filename: string): void; - download(path: string, filename: string, fn: (err: Error) =>void ): void; - links(links: any): void; - locals: any; - render(view: string, locals: any): void; - render(view: string, callback: (err: Error, html: any) =>void ): void; - render(view: string, locals: any, callback: (err: Error, html: any) =>void ): void; - } -} diff --git a/Definitions/express-3.0.d.ts b/Definitions/express-3.0.d.ts new file mode 100644 index 000000000..efe64e9ab --- /dev/null +++ b/Definitions/express-3.0.d.ts @@ -0,0 +1,188 @@ +// Type definitions for Express 3.0 +// Project: http://expressjs.com +// Definitions by: Boris Yankov +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +/// + +declare module "express" { + export function createServer(): ServerApplication; + export function static(path: string): any; + import http = module("http"); + export var listen; + + interface ReqResNext { + (req: ServerRequest, res: ServerResponse, next: Function): void; + } + + interface Errback { (err: Error): void; } + + interface CookieOptions { + maxAge?: number; + signed?: bool; + expires?: Date; + httpOnly?: bool; + path?: string; + domain?: string; + secure?: bool; + } + + // Connect middleware + export function bodyParser(options?: any): ReqResNext; + export function errorHandler(opts?: any): ReqResNext; + export function methodOverride(): ReqResNext; + + export interface ExpressSettings { + env?: string; + views?: string; + } + + export interface ServerApplication { + + settings: ExpressSettings; + locals: any; + routes: any; + + (): ServerApplication; + + router: ReqResNext; + + use(route: string, callback: Function): ServerApplication; + use(route: string, server: ServerApplication): ServerApplication; + use(callback: Function): ServerApplication; + use(server: ServerApplication): ServerApplication; + + engine(ext: string, callback: Function): ServerApplication; + + param(param: Function): ServerApplication; + param(name: string, callback: Function): ServerApplication; + param(name: string, expressParam: any): ServerApplication; + param(name: any[], callback: Function): ServerApplication; + + set(name: string): ServerApplication; + set(name: string, val: any): ServerApplication; + + enabled(name: string): bool; + disabled(name: string): bool; + + enable(name: string): ServerApplication; + disable(name: string): ServerApplication; + + configure(env: string, callback: () => void ): ServerApplication; + configure(...params: any[]): ServerApplication; // covering this case: (...env: string[], callback: () => void) + configure(callback: () => void ): ServerApplication; + + all(path: string, ...callbacks: Function[]): void; + + render(view: string, callback: (err: Error, html) => void ): void; + render(view: string, optionss: any, callback: (err: Error, html) => void ): void; + + listen(port: number, hostname: string, backlog: number, callback: Function): void; + listen(port: number, callback: Function): void; + listen(path: string, callback?: Function): void; + listen(handle: any, listeningListener?: Function): void; + + get(name: string): any; + get(path: string, handler: (req: ServerRequest, res: ServerResponse) => void ): void; + get(path: RegExp, handler: (req: ServerRequest, res: ServerResponse) => void ): void; + get(path: string, callbacks: any, callback: () => void ): void; + + post(path: string, handler: (req: ServerRequest, res: ServerResponse) => void ): void; + post(path: RegExp, handler: (req: ServerRequest, res: ServerResponse) => void ): void; + post(path: string, callbacks: any, callback: () => void ): void; + } + + export interface ServerRequest extends http.ServerRequest { + + accepted: any[]; + acceptedLanguages: string[]; + acceptedCharsets: string[]; + + params: any; + query: any; + body: any; + files: any; + + route: any; + cookies: any; + signedCookies: any; + + get(field: string): string; + header(field: string): string; + + accepts(types: string): any; + accepts(types: string[]): any; + acceptsCharset(charset: string): bool; + acceptsLanguage(lang: string): bool; + + range(size: number): number[]; + + param(name: string, defaultValue?: any): string; + is(type: string): bool; + + protocol: string; + secure: bool; + ip: string; + ips: string[]; + auth: any; + subdomains: string[]; + path: string; + host: string; + fresh: bool; + stale: bool; + xhr: bool; + } + + export interface ServerResponse extends http.ServerResponse { + + charset: string; + locals: any; + + status(code: number): ServerResponse; + links(links: any): ServerResponse; + + send(status: number): ServerResponse; + send(bodyOrStatus: any): ServerResponse; + send(status: number, body: any): ServerResponse; + json(status: number): ServerResponse; + json(bodyOrStatus: any): ServerResponse; + json(status: number, body: any): ServerResponse; + jsonp(status: number): ServerResponse; + jsonp(bodyOrStatus: any): ServerResponse; + jsonp(status: number, body: any): ServerResponse; + + sendfile(path: string): void; + sendfile(path: string, options: any): void; + sendfile(path: string, fn: Errback): void; + sendfile(path: string, options: any, fn: Errback): void; + download(path: string): void; + download(path: string, filename: string): void; + download(path: string, fn: Errback): void; + download(path: string, filename: string, fn: Errback): void; + + type(type: string): ServerResponse; + contentType(type: string): ServerResponse; + + format(object: any): ServerResponse; + attachment(filename?: string): ServerResponse; + + set(field: any): void; + set(field: string, value: string): void; + header(field: any): void; + header(field: string, value: string): void; + + get(field: string): string; + + clearCookie(name: string, options?: any): ServerResponse; + cookie(name: string, value: any, options?: CookieOptions): ServerResponse; + + redirect(url: string): void; + redirect(status: number, url: string): void; + redirect(url: string, status: number): void; + + render(view: string, options: any): void; + render(view: string, callback: (err: Error, html: any) => void ): void; + render(view: string, options: any, callback: (err: Error, html: any) => void ): void; + } +} \ No newline at end of file diff --git a/Definitions/fancybox-2.1.d.ts b/Definitions/fancybox-2.1.d.ts index c9892c96b..efe41273e 100644 --- a/Definitions/fancybox-2.1.d.ts +++ b/Definitions/fancybox-2.1.d.ts @@ -1,5 +1,6 @@ // Type definitions for fancyBox 2.1 // Project: https://github.com/fancyapps/fancyBox +// Definitions by: Boris Yankov // Definitions: https://github.com/borisyankov/DefinitelyTyped diff --git a/Definitions/globalize.d.ts b/Definitions/globalize.d.ts index 7cd83b8b6..016b3e0de 100644 --- a/Definitions/globalize.d.ts +++ b/Definitions/globalize.d.ts @@ -1,42 +1,45 @@ // Type definitions for Globalize -// https://github.com/borisyankov/DefinitelyTyped +// Project: https://github.com/jquery/globalize +// Definitions by: Boris Yankov +// Definitions: https://github.com/borisyankov/DefinitelyTyped + interface GlobalizePercent { - pattern: string[]; - decimals: number; - groupSizes: number[]; - //",": string; - //".": string; + pattern: string[]; + decimals: number; + groupSizes: number[]; + //",": string; + //".": string; symbol: string; } interface GlobalizeCurrency { - pattern: string[]; - decimals: number; - groupSizes: number[]; - //",": string; - //".": string; + pattern: string[]; + decimals: number; + groupSizes: number[]; + //",": string; + //".": string; symbol: string; } interface GlobalizeNumberFormat { - pattern: string[]; - decimals: string; - //",": string; - //".": string; - groupSizes: number[]; - //"+": string; - //"-": string; - NaN: string; - negativeInfinity: string; - positiveInfinity: string; - percent: GlobalizePercent; + pattern: string[]; + decimals: string; + //",": string; + //".": string; + groupSizes: number[]; + //"+": string; + //"-": string; + NaN: string; + negativeInfinity: string; + positiveInfinity: string; + percent: GlobalizePercent; currency: GlobalizeCurrency; } interface GlobalizeEra { - name: string; - start: any; + name: string; + start: any; offset: number; } @@ -47,28 +50,28 @@ interface GlobalizeDays { } interface GlobalizePatterns { - d: string; - D: string; - t: string; - T: string; - f: string; - F: string; - M: string; - Y: string; + d: string; + D: string; + t: string; + T: string; + f: string; + F: string; + M: string; + Y: string; S: string; } interface GlobalizeCalendar { - name: string; - // "/": string, - // ":": string, - firstDay: number; - days: GlobalizeDays; - months: any[]; - AM: string[]; - PM: string[]; - eras: GlobalizeEra[]; - twoDigitYearMax: number; + name: string; + // "/": string, + // ":": string, + firstDay: number; + days: GlobalizeDays; + months: any[]; + AM: string[]; + PM: string[]; + eras: GlobalizeEra[]; + twoDigitYearMax: number; patterns: GlobalizePatterns; } @@ -77,11 +80,11 @@ interface GlobalizeCalendars { } interface GlobalizeCulture { - name: string; - englishName: string; - nativeName: string; - isRTL: bool; - language: string; + name: string; + englishName: string; + nativeName: string; + isRTL: bool; + language: string; numberFormat: GlobalizeNumberFormat; calendars: GlobalizeCalendars; messages: any; diff --git a/Definitions/google.maps.d.ts b/Definitions/google.maps.d.ts new file mode 100644 index 000000000..93096deab --- /dev/null +++ b/Definitions/google.maps.d.ts @@ -0,0 +1,1542 @@ +/* +The MIT License + +Copyright (c) 2012 Folia A/S. http://www.folia.dk + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +declare module google.maps { + + /***** MVC *****/ + export class MVCObject { + constructor (); + bindTo(key: string, target: MVCObject, targetKey?: string, noNotify?: bool): void; + changed(key: string): void; + get(key: string): any; + notify(key: string): void; + set(key: string, value: any): void; + setValues(values: any): void; + setValues(values: undefined); + unbind(key: string): void; + unbindAll(): void; + } + + export class MVCArray extends MVCObject { + constructor (array?: any[]); + clear(): void; + forEach(callback: (elem: any, index: number) => void ): void; + getArray(): any[]; + getAt(i: number): any; + getLength(): number; + insertAt(i: number, elem: any): void; + pop(): void; + push(elem: any): number; + removeAt(i: number): any; + setAt(i: number, elem: any): void; + } + + /***** Map *****/ + export class Map extends MVCObject { + constructor (mapDiv: Element, opts?: MapOptions); + fitBounds(bounds: LatLngBounds); + getBounds(): LatLngBounds; + getCenter(): LatLng; + getDiv(): Element; + getHeading(): number; + getMapTypeId(): MapTypeId; + getProjection(): Projection; + getStreetView(): StreetViewPanorama; + getTilt(): number; + getZoom(): number; + panBy(x: number, y: number): void; + panTo(latLng: LatLng): void; + panToBounds(latLngBounds: LatLngBounds): void; + setCenter(latlng: LatLng): void; + setHeading(heading: number): void; + setMapTypeId(mapTypeId: MapTypeId): void; + setOptions(options: MapOptions): void; + setStreetView(panorama: StreetViewPanorama): void; + setTilt(tilt: number): void; + setZoom(zoom: number): void; + } + + export interface MapOptions { + backgroundColor?: string; + center?: LatLng; + disableDefaultUI?: bool; + disableDoubleClickZoom?: bool; + draggable?: bool; + draggableCursor?: string; + draggingCursor?: string; + heading?: number; + keyboardShortcuts?: bool; + mapMaker?: bool; + mapTypeControl?: bool; + mapTypeControlOptions?: MapTypeControlOptions; + mapTypeId?: MapTypeId; + maxZoom?: number; + minZoom?: number; + noClear?: bool; + overviewMapControl?: bool; + overviewMapControlOptions?: OverviewMapControlOptions; + panControl?: bool; + panControlOptions?: PanControlOptions; + rotateControl?: bool; + rotateControlOptions?: RotateControlOptions; + scaleControl?: bool; + scaleControlOptions?: ScaleControlOptions; + scrollwheel?: bool; + streetView?: bool; + streetViewControlOptions?: StreetViewControlOptions; + styles?: MapTypeStyle[]; + tilt?: number; + zoom?: number; + zoomControl?: bool; + zoomControlOptions?: ZoomControlOptions; + } + + export enum MapTypeId { + HYBRID, + ROADMAP, + SATELLITE, + TERRAIN + } + + /***** Controls *****/ + export interface MapTypeControlOptions { + mapTypeIds?: MapTypeId[]; + position?: ControlPosition; + style?: MapTypeControlStyle; + } + + export enum MapTypeControlStyle { + DEFAULT, + DROPDOWN_MENU, + HORIZONTAL_BAR + } + + export interface OverviewMapControlOptions { + opened?: bool; + } + + export interface PanControlOptions { + position: ControlPosition; + } + + export interface RotateControlOptions { + position: ControlPosition; + } + + export interface ScaleControlOptions { + position?: ControlPosition; + style?: ScaleControlStyle; + } + + export enum ScaleControlStyle { + DEFAULT + } + + export interface StreetViewControlOptions { + position: ControlPosition; + } + + export interface ZoomControlOptions { + position?: ControlPosition; + style?: ZoomControlStyle; + } + + export enum ZoomControlStyle { + DEFAULT, + LARGE, + SMALL + } + + export enum ControlPosition { + BOTTOM_CENTER, + BOTTOM_LEFT, + BOTTOM_RIGHT, + LEFT_BOTTOM, + LEFT_CENTER, + LEFT_TOP, + RIGHT_BOTTOM, + RIGHT_CENTER, + RIGHT_TOP, + TOP_CENTER, + TOP_LEFT, + TOP_RIGHT + } + + /***** Overlays *****/ + export class Marker extends MVCObject { + constructor (opts?: MarkerOptions); + getAnimation(): Animation; + getClickable(): bool; + getCursor(): string; + getDraggable(): bool; + getFlat(): bool; + getIcon(): MarkerImage; + getMap(): Map; + getMap(): StreetViewPanorama; + getPosition(): LatLng; + getShadow(): MarkerImage; + getShape(): MarkerShape; + getTitle(): string; + getVisible(): bool; + getZIndex(): number; + setAnimation(animation: Animation): void; + setClickable(flag: bool): void; + setCursor(cursor: string): void; + setDraggable(flag: bool): void; + setFlat(flag: bool): void; + setIcon(icon: MarkerImage): void; + setIcon(icon: string): void; + setMap(map: Map): void; + setMap(map: StreetViewPanorama): void; + setOptions(options: MarkerOptions): void; + setPosition(latlng: LatLng): void; + setShadow(shadow: MarkerImage): void; + setShadow(shadow: string): void; + setShape(shape: MarkerShape): void; + setTitle(title: string): void; + setVisible(visible: bool): void; + setZIndex(zIndex: number): void; + } + + export interface MarkerOptions { + animation?: Animation; + clickable?: bool; + cursor?: string; + draggable?: bool; + flat?: bool; + icon?: any; + map?: any; + optimized?: bool; + position?: LatLng; + raiseOnDrag?: bool; + shadow?: any; + shape?: MarkerShape; + title?: string; + visible?: bool; + zIndex?: number; + } + + export class MarkerImage { + constructor (url: string, size?: Size, origin?: Point, anchor?: Point, scaledSize?: Size); + anchor: Point; + origin: Point; + scaledSize: Size; + size: Size; + url: string; + } + + export interface MarkerShape { + coords?: number[]; + type?: string; + } + + export interface Symbol { + anchor?: Point; + fillColor?: string; + fillOpacity?: number; + path?: any; + rotation?: number; + scale?: number; + strokeColor?: string; + strokeOpacity?: number; + strokeWeight?: number; + } + + export enum SymbolPath { + BACKWARD_CLOSED_ARROW, + BACKWARD_OPEN_ARROW, + CIRCLE, + FORWARD_CLOSED_ARROW, + FORWARD_OPEN_ARROW + } + + export enum Animation { + BOUNCE, + DROP + } + + export class InfoWindow extends MVCObject { + constructor (opts?: InfoWindowOptions); + close(): void; + getContent(): string; + getContent(): Element; + getPosition(): LatLng; + getZIndex(): number; + open(map?: Map, anchor?: MVCObject): void; + open(map?: StreetViewPanorama, anchor?: MVCObject): void; + setContent(content: Node): void; + setContent(content: string): void; + setOptions(options: InfoWindowOptions): void; + setPosition(position: LatLng): void; + setZIndex(zIndex: number): void; + } + + export interface InfoWindowOptions { + content?: any; + disableAutoPan?: bool; + maxWidth?: number; + pixelOffset?: Size; + position?: LatLng; + zIndex?: number; + } + + export class Polyline extends MVCObject { + constructor (opts?: PolylineOptions); + getEditable(): bool; + getMap(): Map; + getPath(): MVCArray[]; + getVisible(): bool; + setEditable(editable: bool): void; + setMap(map: Map): void; + setOptions(options: PolylineOptions): void; + setPath(path: MVCArray[]): void; + setPath(path: LatLng[]): void; + setVisible(visible: bool): void; + } + + export interface PolylineOptions { + clickable?: bool; + editable?: bool; + geodesic?: bool; + icons?: IconSequence[]; + map?: Map; + path?: any[]; + strokeColor?: string; + strokeOpacity?: number; + strokeWeight?: number; + visible?: bool; + zIndex?: number; + } + + export interface IconSequence { + icon?: Symbol; + offset?: string; + repeat?: string; + } + + export class Polygon extends MVCObject { + constructor (opts?: PolygonOptions); + getEditable(): bool; + getMap(): Map; + getPath(): MVCArray[]; + getPaths(): MVCArray[][]; + getVisible(): bool; + setEditable(editable: bool): void; + setMap(map: Map): void; + setOptions(options: PolygonOptions): void; + setPath(path: MVCArray[]): void; + setPath(path: LatLng[]): void; + setPaths(paths: MVCArray[]): void; + setPaths(paths: MVCArray[][]): void; + setPaths(path: LatLng[]): void; + setPaths(path: LatLng[][]): void; + setVisible(visible: bool): void; + } + + export interface PolygonOptions { + clickable?: bool; + editable?: bool; + fillColor?: string; + fillOpacity?: number; + geodesic?: bool; + map?: Map; + paths?: any[]; + strokeColor?: string; + strokeOpacity?: number; + strokeWeight?: number; + visible?: bool; + zIndex?: number; + } + + export interface PolyMouseEvent { + edge?: number; + path?: number; + vertex?: number; + } + + export class Rectangle extends MVCObject { + constructor (opts?: RectangleOptions); + getBounds(): LatLngBounds; + getEditable(): bool; + getMap(): Map; + getVisible(): bool; + setBounds(bounds: LatLngBounds): void; + setEditable(editable: bool): void; + setMap(map: Map): void; + setOptions(options: RectangleOptions): void; + setVisible(visible: bool): void; + } + + export interface RectangleOptions { + bounds?: LatLngBounds; + clickable?: bool; + editable?: bool; + fillColor?: string; + fillOpacity?: number; + map?: Map; + strokeColor?: string; + strokeOpacity?: number; + strokeWeight?: number; + visible?: bool; + zIndex?: number; + } + + export class Circle extends MVCObject { + constructor (opts?: CircleOptions); + getBounds(): LatLngBounds; + getCenter(): LatLng; + getEditable(): bool; + getMap(): Map; + getRadius(): number; + getVisible(): bool; + setCenter(center: LatLng): void; + setEditable(editable: bool): void; + setMap(map: Map): void; + setOptions(options: CircleOptions): void; + setRadius(radius: number): void; + setVisible(visible: bool): void; + } + + export interface CircleOptions { + center?: LatLng; + clickable?: bool; + editable?: bool; + fillColor?: string; + fillOpacity?: number; + map?: Map; + radius?: number; + strokeColor?: string; + strokeOpacity?: number; + strokeWeight?: number; + visible?: bool; + zIndex?: number; + } + + export class GroundOverlay extends MVCObject { + constructor (url: string, bounds: LatLngBounds, opts?: GroundOverlayOptions); + getBounds(): LatLngBounds; + getMap(): Map; + getOpacity(): number; + getUrl(): string; + setMap(map: Map): void; + setOpacity(opacity: number): void; + } + + export interface GroundOverlayOptions { + clickable?: bool; + map?: Map; + opacity?: number; + } + + export class OverlayView extends MVCObject { + draw(): void; + getMap(): Map; + getPanes(): MapPanes; + getProjection(): MapCanvasProjection; + onAdd(): void; + onRemove(): void; + setMap(map: Map): void; + setMap(map: StreetViewPanorama): void; + } + + export interface MapPanes { + floatPane: Element; + floatShadow: Element; + mapPane: Element; + overlayImage: Element; + overlayLayer: Element; + overlayMouseTarget: Element; + overlayShadow: Element; + } + + export class MapCanvasProjection extends MVCObject { + fromContainerPixelToLatLng(pixel: Point, nowrap?: bool): LatLng; + fromDivPixelToLatLng(pixel: Point, nowrap?: bool): LatLng; + fromLatLngToContainerPixel(latLng: LatLng): Point; + fromLatLngToDivPixel(latLng: LatLng): Point; + getWorldWidth(): number; + } + + /***** Services *****/ + export class Geocoder { + constructor (); + geocode(request: GeocoderRequest, callback: (results: GeocoderResult[], status: GeocoderStatus) => void ): void; + } + + export interface GeocoderRequest { + address: string; + bounds?: LatLngBounds; + location?: LatLng; + region?: string; + } + + export enum GeocoderStatus { + ERROR, + INVALID_REQUEST, + OK, + OVER_QUERY_LIMIT, + REQUEST_DENIED, + UNKNOWN_ERROR, + ZERO_RESULTS + } + + export interface GeocoderResult { + address_components: GeocoderAddressComponent[]; + formatted_address: string; + geometry: GeocoderGeometry; + types: string[]; + } + + export interface GeocoderAddressComponent { + long_name: string; + short_name: string; + types: string[]; + } + + export interface GeocoderGeometry { + bounds: LatLngBounds; + location: LatLng; + location_type: GeocoderLocationType; + viewport: LatLngBounds; + } + + export enum GeocoderLocationType { + APPROXIMATE, + GEOMETRIC_CENTER, + RANGE_INTERPOLATED, + ROOFTOP + } + + export class DirectionsRenderer extends MVCObject { + constructor (opts?: DirectionsRendererOptions); + getDirections(): DirectionsResult; + getMap(): Map; + getPanel(): Element; + getRouteIndex(): number; + setDirections(directions: DirectionsResult): void; + setMap(map: Map): void; + setOptions(options: DirectionsRendererOptions): void; + setPanel(panel: Element): void; + setRouteIndex(routeIndex: number): void; + } + + export interface DirectionsRendererOptions { + directions?: DirectionsResult; + draggable?: bool; + hideRouteList?: bool; + infoWindow?: InfoWindow; + map?: Map; + markerOptions?: MarkerOptions; + panel?: Element; + polylineOptions?: PolylineOptions; + preserveViewport?: bool; + routeIndex?: number; + suppressBicyclingLayer?: bool; + suppressInfoWindows?: bool; + suppressMarkers?: bool; + suppressPolylines?: bool; + } + + export class DirectionsService { + constructor (); + route(request: DirectionsRequest, callback: (result: DirectionsResult, status: DirectionsStatus) => void ): void; + } + + export interface DirectionsRequest { + avoidHighways?: bool; + avoidTolls?: bool; + destination?: any; + optimizeWaypoints?: bool; + origin?: any; + provideRouteAlternatives?: bool; + region?: string; + transitOptions?: TransitOptions; + travelMode?: TravelMode; + unitSystem?: UnitSystem; + waypoints?: DirectionsWaypoint[]; + } + + export enum TravelMode { + BICYCLING, + DRIVING, + TRANSIT, + WALKING + } + + export enum UnitSystem { + IMPERIAL, + METRIC + } + + export interface TransitOptions { + arrivalTime?: Date; + departureTime?: Date; + } + + export interface DirectionsWaypoint { + location: any; + stopover: bool; + } + + export enum DirectionsStatus { + INVALID_REQUEST, + MAX_WAYPOINTS_EXCEEDED, + NOT_FOUND, + OK, + OVER_QUERY_LIMIT, + REQUEST_DENIED, + UNKNOWN_ERROR, + ZERO_RESULTS + } + + export interface DirectionsResult { + routes: DirectionsRoute[]; + } + + export interface DirectionsRoute { + bounds: LatLngBounds; + copyrights: string; + legs: DirectionsLeg[]; + overview_path: LatLng[]; + warnings: string[]; + waypoint_order: number[]; + } + + export interface DirectionsLeg { + arrival_time: Distance; + departure_time: Duration; + distance: Distance; + duration: Duration; + end_address: string; + end_location: LatLng; + start_address: string; + start_location: LatLng; + steps: DirectionsStep[]; + via_waypoints: LatLng[]; + } + + export interface DirectionsStep { + distance: Distance; + duration: Duration; + end_location: LatLng; + instructions: string; + path: LatLng[]; + start_location: LatLng; + steps: DirectionsStep; + transit: TransitDetails; + travel_mode: TravelMode; + } + + export interface Distance { + text: string; + value: number; + } + + export interface Duration { + text: string; + value: number; + } + + export interface Time { + text: string; + time_zone: string; + value: Date; + } + + export interface TransitDetails { + arrival_stop: TransitStop; + arrival_time: Time; + departure_stop: TransitStop; + departure_time: Time; + headsign: string; + headway: number; + line: TransitLine; + num_stops: number; + } + + export interface TransitStop { + location: LatLng; + name: string; + } + + export interface TransitLine { + agencies: TransitAgency[]; + color: string; + icon: string; + name: string; + short_name: string; + text_color: string; + url: string; + vehicle: TransitVehicle; + } + + export interface TransitAgency { + name: string; + phone: string; + url: string; + } + + export interface TransitVehicle { + icon: string; + local_icon: string; + name: string; + type: string; + } + + export class ElevationService { + constructor (); + getElevationAlongPath(request: PathElevationRequest, callback: (results: ElevationResult[], status: ElevationStatus) => void ): void; + getElevationForLocations(request: LocationElevationRequest, callback: (results: ElevationResult[], status: ElevationStatus) => void ): void; + } + + export interface LocationElevationRequest { + locations: LatLng[]; + } + + export interface PathElevationRequest { + path?: LatLng[]; + samples?: number; + } + + export interface ElevationResult { + elevation: number; + location: LatLng; + resolution: number; + } + + export enum ElevationStatus { + INVALID_REQUEST, + OK, + OVER_QUERY_LIMIT, + REQUEST_DENIED, + UNKNOWN_ERROR + } + + export class MaxZoomService { + constructor (); + getMaxZoomAtLatLng(latlng: LatLng, callback: (result: MaxZoomResult) => void ): void; + } + + export interface MaxZoomResult { + status: MaxZoomStatus; + zoom: number; + } + + export enum MaxZoomStatus { + ERROR, + OK + } + + export class DistanceMatrixService { + constructor (); + getDistanceMatrix(request: DistanceMatrixRequest, callback: (response: DistanceMatrixResponse, status: DistanceMatrixStatus) => void ): void; + } + + export interface DistanceMatrixRequest { + avoidHighways?: bool; + avoidTolls?: bool; + destinations?: any[]; + origins?: any[]; + region?: string; + travelMode?: TravelMode; + unitSystem?: UnitSystem; + } + + export interface DistanceMatrixResponse { + destinationAddresses: string[]; + originAddresses: string[]; + rows: DistanceMatrixResponseRow[]; + } + + export interface DistanceMatrixResponseRow { + elements: DistanceMatrixResponseElement[]; + } + + export interface DistanceMatrixResponseElement { + distance: Distance; + duration: Duration; + status: DistanceMatrixElementStatus; + } + + export enum DistanceMatrixStatus { + INVALID_REQUEST, + MAX_DIMENSIONS_EXCEEDED, + MAX_ELEMENTS_EXCEEDED, + OK, + OVER_QUERY_LIMIT, + REQUEST_DENIED, + UNKNOWN_ERROR + } + + export enum DistanceMatrixElementStatus { + NOT_FOUND, + OK, + ZERO_RESULTS + } + + /***** Map Types *****/ + export interface MapType { + getTile(tileCoord: Point, zoom: number, ownerDocument: Document): Element; + releaseTile(tile: Element): void; + alt?: string; + maxZoom?: number; + minZoom?: number; + name?: string; + projection?: Projection; + radius?: number; + tileSize?: Size; + } + + export class MapTypeRegistry extends MVCObject { + constructor (); + set(id: string, mapType: MapType): void; + } + + export interface Projection { + fromLatLngToPoint(latLng: LatLng, point?: Point): Point; + fromPointToLatLng(pixel: Point, noWrap?: bool): LatLng; + } + + export class ImageMapType { + constructor (opts: ImageMapTypeOptions); + getOpacity(): number; + setOpacity(opacity: number): void; + } + + export interface ImageMapTypeOptions { + alt?: string; + getTileUrl: (Point, number) => string; + maxZoom?: number; + minZoom?: number; + name?: string; + opacity?: number; + tileSize?: Size; + } + + export class StyledMapType { + constructor (styles: MapTypeStyle[], options?: StyledMapTypeOptions); + } + + export interface StyledMapTypeOptions { + alt?: string; + maxZoom?: number; + minZoom?: number; + name?: string; + } + + export interface MapTypeStyle { + elementType?: MapTypeStyleElementType; + featureType?: MapTypeStyleFeatureType; + stylers?: MapTypeStyler[]; + } + + export interface MapTypeStyleFeatureType { + administrative?: { + country?: string; + land_parcel?: string; + locality?: string; + neighborhood?: string; + province?: string; + }; + all?: string; + landscape?: { + man_made?: string; + natural?: string; + }; + poi?: { + attraction?: string; + business?: string; + government?: string; + medical?: string; + park?: string; + place_of_worship?: string; + school?: string; + sports_complex?: string; + }; + road?: { + arterial?: string; + highway?: { + controlled_access?: string; + }; + local?: string; + }; + transit?: { + line?: string; + station?: { + airport?: string; + bus?: string; + rail?: string; + }; + }; + water?: string; + } + + export enum MapTypeStyleElementType { + all, + geometry, + labels + } + + export interface MapTypeStyler { + gamma?: number; + hue?: string; + invert_lightness?: bool; + lightness?: number; + saturation?: number; + visibility?: string; + } + + /***** Layers *****/ + export class BicyclingLayer extends MVCObject { + constructor (); + getMap(): Map; + setMap(map: Map): void; + } + + export class FusionTablesLayer extends MVCObject { + constructor (options: FusionTablesLayerOptions); + getMap(): Map; + setMap(map: Map): void; + setOptions(options: FusionTablesLayerOptions): void; + } + + export interface FusionTablesLayerOptions { + clickable?: bool; + heatmap?: FusionTablesHeatmap; + map?: Map; + query?: FusionTablesQuery; + styles?: FusionTablesStyle[]; + suppressInfoWindows?: bool; + } + + export interface FusionTablesQuery { + from?: string; + limit?: number; + offset?: number; + orderBy?: string; + select?: string; + where?: string; + } + + export interface FusionTablesStyle { + markerOptions?: FusionTablesMarkerOptions; + polygonOptions?: FusionTablesPolygonOptions; + polylineOptions?: FusionTablesPolylineOptions; + where?: string; + } + + export interface FusionTablesHeatmap { + enabled: bool; + } + + export interface FusionTablesMarkerOptions { + iconName: string; + } + + export interface FusionTablesPolygonOptions { + fillColor?: string; + fillOpacity?: number; + strokeColor?: string; + strokeOpacity?: number; + strokeWeight?: number; + } + + export interface FusionTablesPolylineOptions { + strokeColor?: string; + strokeOpacity?: number; + strokeWeight?: number; + } + + export interface FusionTablesMouseEvent { + infoWindowHtml: string; + latLng: LatLng; + pixelOffset: Size; + row: Object; + } + + export interface FusionTablesCell { + columnName: string; + value: string; + } + + export class KmlLayer extends MVCObject { + constructor (url: string, opts?: KmlLayerOptions); + getDefaultViewport(): LatLngBounds; + getMap(): Map; + getMetadata(): KmlLayerMetadata; + getStatus(): KmlLayerStatus; + getUrl(): string; + setMap(map: Map): void; + } + + export interface KmlLayerOptions { + clickable?: bool; + map?: Map; + preserveViewport?: bool; + suppressInfoWindows?: bool; + } + + export interface KmlLayerMetadata { + author: KmlAuthor; + description: string; + name: string; + snippet: string; + } + + export enum KmlLayerStatus { + DOCUMENT_NOT_FOUND, + DOCUMENT_TOO_LARGE, + FETCH_ERROR, + INVALID_DOCUMENT, + INVALID_REQUEST, + LIMITS_EXCEEDED, + OK, + TIMED_OUT, + UNKNOWN + } + + export interface KmlMouseEvent { + featureData: KmlFeatureData; + latLng: LatLng; + pixelOffset: Size; + } + + export interface KmlFeatureData { + author: KmlAuthor; + description: string; + id: string; + infoWindowHtml: string; + name: string; + snippet: string; + } + + export interface KmlAuthor { + email: string; + name: string; + uri: string; + } + + export class TrafficLayer extends MVCObject { + constructor (); + getMap(): void; + setMap(map: Map): void; + } + + export class TransitLayer extends MVCObject { + constructor (); + getMap(): void; + setMap(map: Map): void; + } + + /***** Street View *****/ + export class StreetViewPanorama { + constructor (container: Element, opts?: StreetViewPanoramaOptions); + controls: MVCArray[]; + getLinks(): StreetViewLink[]; + getPano(): string; + getPosition(): LatLng; + getPov(): StreetViewPov; + getVisible(): bool; + registerPanoProvider(provider: (input: string) => StreetViewPanoramaData); + setPano(pano: string): void; + setPosition(latLng: LatLng): void; + setPov(pov: StreetViewPov): void; + setVisible(flag: bool): void; + + } + + export interface StreetViewPanoramaOptions { + addressControl?: bool; + addressControlOptions?: StreetViewAddressControlOptions; + clickToGo?: bool; + disableDoubleClickZoom?: bool; + enableCloseButton?: bool; + imageDateControl?: bool; + linksControl?: bool; + panControl?: bool; + panControlOptions?: PanControlOptions; + pano?: string; + panoProvider?: (input: string) => StreetViewPanoramaData; + position?: LatLng; + pov?: StreetViewPov; + scrollwheel?: bool; + visible?: bool; + zoomControl?: bool; + zoomControlOptions?: ZoomControlOptions; + } + + export interface StreetViewAddressControlOptions { + position: ControlPosition; + } + + export interface StreetViewLink { + description?: string; + heading?: number; + pano?: string; + } + + export interface StreetViewPov { + heading?: number; + picth?: number; + zoom?: number; + } + + export interface StreetViewPanoramaData { + opyright?: string; + imageDate?: string; + links?: StreetViewLink[]; + location?: StreetViewLocation; + tiles?: StreetViewTileData; + } + + export interface StreetViewLocation { + description?: string; + latLng?: LatLng; + pano?: string; + } + + export interface StreetViewTileData { + centerHeading?: number; + tileSize?: Size; + worldSize?: Size; + } + + export interface StreetViewService { + getPanoramaById(pano: string, callback: (streetViewPanoramaData: StreetViewPanoramaData, streetViewStatus: StreetViewStatus) => void ); + getPanoramaByLocation(latlng: LatLng, radius: number, callback: (streetViewPanoramaData: StreetViewPanoramaData, streetViewStatus: StreetViewStatus) => void ); + } + + export enum StreetViewStatus { + OK, + UNKNOWN_ERROR, + ZERO_RESULTS + } + + /***** Event *****/ + export interface MapsEventListener { } + + export class event { + static addDomListener(instance: any, eventName: string, handler: (event?: any, ...args: any[]) => void , capture?: bool): MapsEventListener; + static addDomListener(instance: any, eventName: string, handler: Function, capture?: bool): MapsEventListener; + static addDomListenerOnce(instance: any, eventName: string, handler: (event?: any, ...args: any[]) => void , capture?: bool): MapsEventListener; + static addDomListenerOnce(instance: any, eventName: string, handler: Function, capture?: bool): MapsEventListener; + static addListener(instance: any, eventName: string, handler: (event?: any, ...args: any[]) => void ): MapsEventListener; + static addListener(instance: any, eventName: string, handler: Function): MapsEventListener; + static addListenerOnce(instance: any, eventName: string, handler: (event?: any, ...args: any[]) => void ): MapsEventListener; + static addListenerOnce(instance: any, eventName: string, handler: Function): MapsEventListener; + static clearInstanceListeners(instance: any): void; + static clearListeners(instance: any, eventName: string): void; + static removeListener(listener: MapsEventListener): void; + static trigger(instance: any, eventName: string, ...args: any[]): void; + } + + export interface MouseEvent { + stop(): void; + latLng: LatLng; + } + + /***** Base *****/ + export class LatLng { + constructor (lat: number, lng: number, noWrap?: bool); + equals(other: LatLng): bool; + lat(): number; + lng(): number; + toString(): string; + toUrlValue(precision?: number): string; + + } + + export class LatLngBounds { + constructor (sw?: LatLng, ne?: LatLng); + contains(latLng: LatLng): bool; + equals(other: LatLngBounds): bool; + extend(point: LatLng): LatLngBounds; + getCenter(): LatLng; + getNorthEast(): LatLng; + getSouthWest(): LatLng; + intersects(other: LatLngBounds): bool; + isEmpty(): bool; + toSpan(): LatLng; + toString(): string; + toUrlValue(precision?: number): string; + union(other: LatLngBounds): LatLngBounds; + } + + export class Point { + constructor (x: number, y: number); + x: number; + y: number; + equals(other: Point): bool; + toString(): string; + } + + export class Size { + constructor (width: number, height: number, widthUnit?: string, heightUnit?: string); + height: number; + width: number; + equals(other: Size): bool; + toString(): string; + } + + /***** Geometry Library *****/ + export module geometry { + export class encoding { + static decodePath(encodedPath: string): LatLng; + static encodePath(path: any[]): string; + } + + export class spherical { + static computeArea(path: any[], radius?: number): number; + static computeDistanceBetween(from: LatLng, to: LatLng, radius?: number): number; + static computeHeading(from: LatLng, to: LatLng): number; + static computeLength(path: any[], radius?: number): number; + static computeOffset(from: LatLng, distance: number, heading: number, radius?: number): LatLng; + static computeSignedArea(loop: any[], radius?: number): number; + static interpolate(from: LatLng, to: LatLng, fraction: number): LatLng; + } + + export class poly { + containsLocation(point: LatLng, polygon: Polygon): bool; + isLocationOnEdge(point: LatLng, poly: any, tolerance?: number): bool; + } + } + + /***** AdSense Library *****/ + export module adsense { + export class AdUnit extends MVCObject { + constructor (container: Element, opts: AdUnitOptions); + getChannelNumber(): string; + getContainer(): Element; + getFormat(): AdFormat; + getMap(): Map; + getPosition(): ControlPosition; + getPublisherId(): string; + setChannelNumber(channelNumber: string): void; + setFormat(format: AdFormat): void; + setMap(map: Map): void; + setPosition(position: ControlPosition): void; + } + + export interface AdUnitOptions { + channelNumber?: string; + format?: AdFormat; + map?: Map; + position?: ControlPosition; + publisherId?: string; + } + + export enum AdFormat { + BANNER, + BUTTON, + HALF_BANNER, + LARGE_RECTANGLE, + LEADERBOARD, + MEDIUM_RECTANGLE, + SKYSCRAPER, + SMALL_RECTANGLE, + SMALL_SQUARE, + SQUARE, + VERTICAL_BANNER, + WIDE_SKYSCRAPER + } + } + + /***** Panoramio Library *****/ + export module panoramio { + export class PanoramioLayer extends MVCObject { + constructor (opts?: PanoramioLayerOptions); + getMap(): Map; + getTag(): string; + getUserId(): string; + setMap(map: Map): void; + setOptions(options: PanoramioLayerOptions): void; + setTag(tag: string): void; + setUserId(userId: string): void; + } + + export interface PanoramioLayerOptions { + map?: Map; + suppressInfoWindows?: bool; + tag?: string; + userId?: string; + } + + export interface PanoramioFeature { + author: string; + photoId: string; + title: string; + url: string; + userId: string; + } + + export interface PanoramioMouseEvent { + featureDetails: PanoramioFeature; + infoWindowHtml: string; + latLng: LatLng; + pixelOffset: Size; + } + } + + export module places { + + export class Autocomplete extends MVCObject { + constructor (inputField: HTMLInputElement, opts?: AutocompleteOptions); + getBounds(): LatLngBounds; + getPlace(): PlaceResult; + setBounds(bounds: LatLngBounds): void; + setComponentRestrictions(restrictions: ComponentRestrictions): void; + setTypes(types: string[]): void; + } + + export interface AutocompleteOptions { + bounds: LatLngBounds; + componentRestrictions: ComponentRestrictions; + types: string[]; + } + + export interface ComponentRestrictions { + country: string; + } + + export interface PlaceDetailsRequest { + reference: string; + } + + export interface PlaceGeometry { + location: LatLng; + viewport: LatLngBounds; + } + + export interface PlaceResult { + address_components: GeocoderAddressComponent[]; + formatted_address: string; + formatted_phone_number: string; + geometry: PlaceGeometry; + html_attributions: string[]; + icon: string; + id: string; + international_phone_number: string; + name: string; + rating: number; + reference: string; + types: string[]; + url: string; + vicinity: string; + website: string; + } + + export interface PlaceSearchRequest { + bounds: LatLngBounds; + keyword: string; + location: LatLng; + name: string; + radius: number; + rankBy: RankBy; + types: string[]; + } + + export interface PlaceSearchPagination { + nextPage(): void; + hasNextPage: bool; + } + + export class PlacesService { + constructor (attrContainer: HTMLDivElement); + constructor (attrContainer: Map); + getDetails(request: PlaceDetailsRequest, callback: (result: PlaceResult, status: PlacesServiceStatus) => void ): void; + nearbySearch(request: PlaceSearchRequest, callback: (results: PlaceResult[], status: PlacesServiceStatus, pagination: PlaceSearchPagination) => void ): void; + textSearch(request: TextSearchRequest, callback: (results: PlaceResult[], status: PlacesServiceStatus) => void ): void; + } + + export enum PlacesServiceStatus { + INVALID_REQUEST, + OK, + OVER_QUERY_LIMIT, + REQUEST_DENIED, + UNKNOWN_ERROR, + ZERO_RESULTS + } + + export enum RankBy { + DISTANCE, + PROMINENCE + } + + export interface TextSearchRequest { + bounds: LatLngBounds; + location: LatLng; + query: string; + radius: number; + } + } + + export module drawing { + export class DrawingManager extends MVCObject { + constructor (options?: DrawingManagerOptions); + getDrawingMode(): OverlayType; + getMap(): Map; + setDrawingMode(drawingMode: OverlayType): void; + setMap(map: Map): void; + setOptions(options: DrawingManagerOptions): void; + } + + export interface DrawingManagerOptions { + circleOptions: CircleOptions; + drawingControl: bool; + drawingControlOptions: DrawingControlOptions; + drawingMode: OverlayType; + map: Map; + markerOptions: MarkerOptions; + polygonOptions: PolygonOptions; + polylineOptions: PolylineOptions; + rectangleOptions: RectangleOptions; + } + + export interface DrawingControlOptions { + drawingModes: OverlayType[]; + position: ControlPosition; + } + + export interface OverlayCompleteEvent { + overlay: MVCObject; + type: OverlayType; + } + + export enum OverlayType { + CIRCLE, + MARKER, + POLYGON, + POLYLINE, + RECTANGLE + } + } + + export module weather { + export class CloudLayer extends MVCObject { + constructor (); + getMap(): Map; + setMap(map: Map): void; + } + export class WeatherLayer extends MVCObject { + constructor (opts?: WeatherLayerOptions); + getMap(): Map; + setMap(map: Map): void; + setOptions(options: WeatherLayerOptions): void; + } + + export interface WeatherLayerOptions { + clickable: bool; + labelColor: LabelColor; + map: Map; + suppressInfoWindows: bool; + temperatureUnits: TemperatureUnit; + windSpeedUnits: WindSpeedUnit; + } + + export enum TemperatureUnit { + CELSIUS, + FAHRENHEIT + } + + export enum WindSpeedUnit { + KILOMETERS_PER_HOUR, + METERS_PER_SECOND, + MILES_PER_HOUR + } + + export enum LabelColor { + BLACK, + WHITE + } + + export interface WeatherMouseEvent { + featureDetails: WeatherFeature; + infoWindowHtml: string; + latLng: LatLng; + pixelOffset: Size; + } + + export interface WeatherFeature { + current: WeatherConditions; + forecast: WeatherForecast[]; + location: string; + temperatureUnit: TemperatureUnit; + windSpeedUnit: WindSpeedUnit; + } + + export interface WeatherConditions { + day: string; + description: string; + high: number; + humidity: number; + low: number; + shortDay: string; + temperature: number; + windDirection: string; + windSpeed: number; + } + + export interface WeatherForecast { + day: string; + description: string; + high: number; + low: number; + shortDay: string; + } + } + export module visualization { + export class HeatmapLayer extends MVCObject { + constructor (opts?: HeatmapLayerOptions); + getData(): MVCArray; + getMap(): Map; + setData(data: MVCArray): void; + setData(data: LatLng[]): void; + setData(data: WeightedLocation[]): void; + setMap(map: Map): void; + } + + export interface HeatmapLayerOptions { + data: LatLng[]; + dissipating: bool; + gradient: string[]; + map: Map; + maxIntensity: number; + opacity: number; + radius: number; + } + + export interface WeightedLocation { + location: LatLng; + weight: number; + } + + export class MouseEvent { + stop(): void; + } + + export class MapsEventListener { + + } + } +} \ No newline at end of file diff --git a/Definitions/handlebars-1.0.d.ts b/Definitions/handlebars-1.0.d.ts new file mode 100644 index 000000000..aa5e72086 --- /dev/null +++ b/Definitions/handlebars-1.0.d.ts @@ -0,0 +1,23 @@ +// Type definitions for Handlebars 1.0 +// Project: http://handlebarsjs.com/ +// Definitions by: Boris Yankov +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +interface HandlebarsStatic { + registerHelper(name: string, fn: Function, inverse?: bool): void; + registerPartial(name: string, str): void; + K(); + createFrame(object); + + Exception(message: string): void; + SafeString(str: string): void; + + parse(string: string); + print(ast); + logger; + log(level, str): void; + compile(environment, options?, context?, asObject?); +} + +declare var Handlebars: HandlebarsStatic; \ No newline at end of file diff --git a/Definitions/history-1.7.d.ts b/Definitions/history-1.7.d.ts index 623dc6c6d..33855672a 100644 --- a/Definitions/history-1.7.d.ts +++ b/Definitions/history-1.7.d.ts @@ -1,7 +1,9 @@ // Type definitions for History.js // Project: https://github.com/balupton/History.js +// Definitions by: Boris Yankov // Definitions: https://github.com/borisyankov/DefinitelyTyped + interface HistoryAdapter { bind(element, event, callback); trigger(element, event); diff --git a/Definitions/humane-3.0.d.ts b/Definitions/humane-3.0.d.ts index aa3ff38e4..01c767a01 100644 --- a/Definitions/humane-3.0.d.ts +++ b/Definitions/humane-3.0.d.ts @@ -3,6 +3,7 @@ // Definitions by: https://github.com/jmvrbanac // DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped + interface HumaneOptions { queue?: string[]; baseCls?: string; diff --git a/Definitions/impress-0.5.d.ts b/Definitions/impress-0.5.d.ts index f80914425..58f82770f 100644 --- a/Definitions/impress-0.5.d.ts +++ b/Definitions/impress-0.5.d.ts @@ -1,7 +1,9 @@ // Type definitions for Impress.js 0.5 // Project: https://github.com/bartaz/impress.js +// Definitions by: Boris Yankov // Definitions: https://github.com/borisyankov/DefinitelyTyped + interface Impress { init(): void; getStep(step: any): any; diff --git a/Definitions/jasmine-1.2.d.ts b/Definitions/jasmine-1.2.d.ts index 4048cf0ed..1eb7dbfcb 100644 --- a/Definitions/jasmine-1.2.d.ts +++ b/Definitions/jasmine-1.2.d.ts @@ -1,247 +1,294 @@ // Type definitions for Jasmine 1.2 // Project: http://pivotal.github.com/jasmine/ +// Definitions by: Boris Yankov // DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped -declare function describe(description: string, specDefinitions: Function): JasmineEnv; -declare function xdescribe(description: string, specDefinitions: Function): JasmineEnv; -declare function it(expectation: string, assertion: Function); -declare function xit(expectation: string, assertion: Function); +declare function describe(description: string, specDefinitions: Function): void; +declare function xdescribe(description: string, specDefinitions: Function): void; -declare function beforeEach(action: Function); -declare function afterEach(action: Function); +declare function it(expectation: string, assertion: Function): void; +declare function xit(expectation: string, assertion: Function): void; -declare function expect(spy: Function): JasmineSpyMatchers; -declare function expect(spy: JasmineSpy): JasmineSpyMatchers; -declare function expect(actual: any): JasmineMatchers; +declare function beforeEach(action: Function): void; +declare function afterEach(action: Function): void; -declare function spyOn(object: any, method: string): JasmineSpyOn; +declare function expect(spy: Function): jasmine.Matchers; +//declare function expect(spy: jasmine.Spy): jasmine.Matchers; +declare function expect(actual: any): jasmine.Matchers; -declare function runs(asyncMethod: Function); -declare function waitsFor(latchMethod: () => bool, failureMessage: string, timeout: number); +declare function spyOn(object: any, method: string): jasmine.Spy; -interface JasmineAny { - constructor (expectedClass); - jasmineMatches(other); - jasmineToString(); -} - -interface JasmineBlock { - constructor (env: JasmineEnv, func: Function, spec: JasmineSpec); - execute(onComplete); -} - -interface JasmineClock { - reset(): void; - tick(millis): void; - runFunctionsWithinRange(oldMillis, nowMillis): void; - scheduleFunction(timeoutKey, funcToCall, millis, recurring): void; - useMock(): void; - installMock(): void; - uninstallMock(): void; - real; - assertInstalled(): void; - isInstalled(): bool; - installed: any; -}; - -interface JasmineEnv { - setTimeout; - clearTimeout; - setInterval; - clearInterval; - - version(); - versionString(): string; - nextSpecId(): number; - addReporter(reporter); - execute(); - describe(description, specDefinitions); - beforeEach(beforeEachFunction); - currentRunner(); - afterEach(afterEachFunction); - xdescribe(desc, specDefinitions); - it(description, func); - xit(desc, func); - compareObjects_(a, b, mismatchKeys, mismatchValues); - equals_(a, b, mismatchKeys, mismatchValues); - contains_(haystack, needle); - addEqualityTester(equalityTester); -} - -interface JasmineFakeTimer { - constructor (); - reset(): void; - tick(millis): void; - runFunctionsWithinRange(oldMillis, nowMillis): void; - scheduleFunction(timeoutKey, funcToCall, millis, recurring): void; -} - -interface JasmineHtmlReporter { - constructor (); -} - -interface JasmineNestedResults { - constructor (); - rollupCounts(result); - log(values); - getItems(); - addResult(result); - passed(); -} +declare function runs(asyncMethod: Function): void; +declare function waitsFor(latchMethod: () => bool, failureMessage: string, timeout?: number): void; +declare function waits(timeout?: number): void; -interface JasminePrettyPrinter { - constructor (); - format(value); - iterateObject(obj, fn); - emitScalar(value); - emitString(value); - emitArray(array); - emitObject(obj); - append(value); -} +declare module jasmine { -interface JasmineQueue { - constructor (env); - addBefore(block, ensure); - add(block, ensure); - insertNext(block, ensure); - start(onComplete); - isRunning(); - next_(); - results(); -} + var Clock: Clock; -interface JasmineMatchers { - constructor (env: JasmineEnv, actual, spec: JasmineEnv, isNot?: bool); - wrapInto_(prototype, matchersClass); - matcherFn_(matcherName, matcherFunction); - toBe(expected); - toNotBe(expected); - toEqual(expected); - toNotEqual(expected); - toMatch(expected); - toNotMatch(expected); - toBeDefined(); - toBeUndefined(); - toBeNull(); - toBeNaN(); - toBeTruthy(); - toBeFalsy(); - toHaveBeenCalled(); - wasNotCalled(); - toHaveBeenCalledWith(); - toContain(expected); - toNotContain(expected); - toBeLessThan(expected); - toBeGreaterThan(expected); - toBeCloseTo(expected, precision); - toThrow(expected); + function any(aclass: any); + function createSpy(name: string): any; + function createSpyObj(baseName: string, methodNames: any[]): any; - Any: JasmineAny; -} + function getEnv(): Env; -interface JasmineMultiReporter { - constructor (); - addReporter(reporter: JasmineReporter); -} + interface Any { -interface JasmineReporter { - constructor (); - reportRunnerStarting(runner); - reportRunnerResults(runner); - reportSuiteResults(suite); - reportSpecStarting(spec); - reportSpecResults(spec); - log(str); -} + new (expectedClass); -interface JasmineRunner { - constructor (env: JasmineEnv); - execute(); - beforeEach(beforeEachFunction); - afterEach(afterEachFunction); - finishCallback(); - addSuite(suite); - add(block); - specs(); - suites(); - topLevelSuites(); - results(); -} + jasmineMatches(other); + jasmineToString(); + } -interface JasmineSpec { - constructor (env: JasmineEnv, suite: JasmineSuite, description: string); - getFullName(): string; - results(); - log(); - runs(func: Function); - addToQueue(block); - addMatcherResult(result); - expect(actual); - // waits(timeout: number); // deprecated - waitsFor(latchFunction: Function, timeoutMessage?: string, timeout?: number); - fail(e); - getMatchersClass_(); - addMatchers(matchersPrototype); - finishCallback(); - finish(onComplete); - after(doAfter); - execute(onComplete); - addBeforesAndAftersToQueue(); - explodes(); - spyOn(obj, methodName, ignoreMethodDoesntExist); - removeAllSpies(); -} + interface Block { + + new (env: Env, func: Function, spec: Spec); + + execute(onComplete); + } + + interface Clock { + reset(): void; + tick(millis): void; + runFunctionsWithinRange(oldMillis, nowMillis): void; + scheduleFunction(timeoutKey, funcToCall, millis, recurring): void; + useMock(): void; + installMock(): void; + uninstallMock(): void; + real; + assertInstalled(): void; + isInstalled(): bool; + installed: any; + }; + + interface Env { + setTimeout; + clearTimeout; + setInterval; + clearInterval; + updateInterval; + + version(); + versionString(): string; + nextSpecId(): number; + addReporter(reporter); + execute(); + describe(description, specDefinitions); + beforeEach(beforeEachFunction); + currentRunner(); + afterEach(afterEachFunction); + xdescribe(desc, specDefinitions); + it(description, func); + xit(desc, func); + compareObjects_(a, b, mismatchKeys, mismatchValues); + equals_(a, b, mismatchKeys, mismatchValues); + contains_(haystack, needle); + addEqualityTester(equalityTester); + specFilter(spec): bool; + } + + interface FakeTimer { + + new (); + + reset(): void; + tick(millis): void; + runFunctionsWithinRange(oldMillis, nowMillis): void; + scheduleFunction(timeoutKey, funcToCall, millis, recurring): void; + } + + interface HtmlReporter { + new (); + } + + interface NestedResults { + + new (); + + rollupCounts(result); + log(values); + getItems(); + addResult(result); + passed(); + } -interface JasmineSuite { - constructor (env: JasmineEnv, description: string, specDefinitions: Function, parentSuite: JasmineSuite); + interface PrettyPrinter { - getFullName(); - finish(onComplete); - beforeEach(beforeEachFunction); - afterEach(afterEachFunction); - results(); - add(suiteOrSpec); - specs(); - suites(); - children(); - execute(onComplete); -} + new (); -interface JasmineUtil { - inherit(childClass: Function, parentClass: Function); - formatException(e); - htmlEscape(str: string): string; - argsToArray(args); - extend(destination, source); -} + format(value); + iterateObject(obj, fn); + emitScalar(value); + emitString(value); + emitArray(array); + emitObject(obj); + append(value); + } -interface JsApiReporter { - result; - messages; + interface Queue { - constructor (); - reportRunnerStarting(runner); - suites(); - summarize_(suiteOrSpec); - results(); - resultsForSpec(specId); - reportRunnerResults(runner); - reportSuiteResults(suite); - reportSpecResults(spec); - log(str); - resultsForSpecs(specIds); - summarizeResult_(result); -} + new (env); -interface Jasmine { - Spec: JasmineSpec; - Clock: JasmineClock; - HtmlReporter: JasmineHtmlReporter; - util: JasmineUtil; -} + addBefore(block, ensure); + add(block, ensure); + insertNext(block, ensure); + start(onComplete); + isRunning(); + next_(); + results(); + } -declare var jasmine: Jasmine; \ No newline at end of file + interface Matchers { + + new (env: Env, actual, spec: Env, isNot?: bool); + + toBe(expected): bool; + toNotBe(expected): bool; + toEqual(expected): bool; + toNotEqual(expected): bool; + toMatch(expected): bool; + toNotMatch(expected): bool; + toBeDefined(): bool; + toBeUndefined(): bool; + toBeNull(): bool; + toBeNaN(): bool; + toBeTruthy(): bool; + toBeFalsy(): bool; + toHaveBeenCalled(): bool; + wasNotCalled(): bool; + toHaveBeenCalledWith(...params: any[]): bool; + toContain(expected): bool; + toNotContain(expected): bool; + toBeLessThan(expected): bool; + toBeGreaterThan(expected): bool; + toBeCloseTo(expected, precision): bool; + toThrow(expected? ): bool; + not: Matchers; + + Any: Any; + } + + interface MultiReporter { + + new (); + + addReporter(reporter: Reporter); + } + + interface Reporter { + new (); + reportRunnerStarting(runner); + reportRunnerResults(runner); + reportSuiteResults(suite); + reportSpecStarting(spec); + reportSpecResults(spec); + log(str); + } + + interface Runner { + + new (env: Env); + + execute(); + beforeEach(beforeEachFunction); + afterEach(afterEachFunction); + finishCallback(); + addSuite(suite); + add(block); + specs(); + suites(); + topLevelSuites(); + results(); + } + + interface Spec { + + new (env: Env, suite: Suite, description: string); + + getFullName(): string; + results(); + log(); + runs(func: Function); + addToQueue(block); + addMatcherResult(result); + expect(actual); + waitsFor(latchFunction: Function, timeoutMessage?: string, timeout?: number); + fail(e); + getMatchersClass_(); + addMatchers(matchersPrototype); + finishCallback(); + finish(onComplete); + after(doAfter); + execute(onComplete); + addBeforesAndAftersToQueue(); + explodes(); + spyOn(obj, methodName, ignoreMethodDoesntExist); + removeAllSpies(); + } + + interface Spy { + identity: string; + calls: any[]; + mostRecentCall: { args: any[]; }; + argsForCall: any[]; + wasCalled: bool; + callCount: number; + + andReturn(value): void; + andCallThrough(): void; + andCallFake(fakeFunc: Function): void; + } + + interface Suite { + + new (env: Env, description: string, specDefinitions: Function, parentSuite: Suite); + + getFullName(); + finish(onComplete); + beforeEach(beforeEachFunction); + afterEach(afterEachFunction); + results(); + add(suiteOrSpec); + specs(); + suites(); + children(); + execute(onComplete); + } + + interface Util { + inherit(childClass: Function, parentClass: Function); + formatException(e); + htmlEscape(str: string): string; + argsToArray(args); + extend(destination, source); + } + + interface JsApiReporter { + + result; + messages; + + new (); + + reportRunnerStarting(runner); + suites(); + summarize_(suiteOrSpec); + results(); + resultsForSpec(specId); + reportRunnerResults(runner); + reportSuiteResults(suite); + reportSpecResults(spec); + log(str); + resultsForSpecs(specIds); + summarizeResult_(result); + } + + interface Jasmine { + Spec: Spec; + Clock: Clock; + util: Util; + } +} \ No newline at end of file diff --git a/Definitions/jquery-1.8.d.ts b/Definitions/jquery-1.8.d.ts index 597fbd065..8c2ce83eb 100644 --- a/Definitions/jquery-1.8.d.ts +++ b/Definitions/jquery-1.8.d.ts @@ -57,8 +57,8 @@ interface JQueryAjaxSettings { /* Interface for the jqXHR object */ -interface JQueryXHR extends XMLHttpRequest { - overrideMimeType(); +interface JQueryXHR extends XMLHttpRequest, JQueryPromise { + overrideMimeType(mimeType: string); } /* @@ -74,7 +74,7 @@ interface JQueryCallback { has(callback: any): bool; lock(): any; locked(): bool; - removed(...callbacks: any[]): any; + remove(...callbacks: any[]): any; } /* @@ -97,6 +97,7 @@ interface JQueryDeferred extends JQueryPromise { pipe(doneFilter?: any, failFilter?: any, progressFilter?: any): JQueryPromise; progress(...progressCallbacks: any[]): JQueryDeferred; + promise(target? ): JQueryDeferred; reject(...args: any[]): JQueryDeferred; rejectWith(context:any, ...args: any[]): JQueryDeferred; resolve(...args: any[]): JQueryDeferred; @@ -134,6 +135,7 @@ interface JQueryBrowserInfo { opera:bool; msie:bool; mozilla:bool; + webkit:bool; version:string; } @@ -167,12 +169,14 @@ interface JQueryStatic { /**** AJAX *****/ - ajax(settings: JQueryAjaxSettings); - ajax(url: string, settings: JQueryAjaxSettings); + ajax(settings: JQueryAjaxSettings): JQueryXHR; + ajax(url: string, settings?: JQueryAjaxSettings): JQueryXHR; ajaxPrefilter(dataTypes: string, handler: (opts: any, originalOpts: any, jqXHR: JQueryXHR) => any): any; ajaxPrefilter(handler: (opts: any, originalOpts: any, jqXHR: JQueryXHR) => any): any; + ajaxSettings: JQueryAjaxSettings; + ajaxSetup(options: any); get(url: string, data?: any, success?: any, dataType?: any): JQueryXHR; @@ -187,7 +191,7 @@ interface JQueryStatic { /********* CALLBACKS **********/ - Callbacks(flags: any): JQueryCallback; + Callbacks(flags?: string): JQueryCallback; /**** CORE @@ -200,6 +204,7 @@ interface JQueryStatic { (elementArray: Element[]): JQuery; (object: JQuery): JQuery; (func: Function): JQuery; + (array: any[]): JQuery; (): JQuery; noConflict(removeAll?: bool): Object; @@ -212,11 +217,14 @@ interface JQueryStatic { css(e: any, propertyName: string, value?: any); css(e: any, propertyName: any, value?: any); cssHooks: { [key: string]: any; }; + cssNumber: any; /**** DATA *****/ - data(element: Element, key: string, value: any): Object; + data(element: Element, key: string, value: any): any; + data(element: Element, key: string): any; + data(element: Element): any; dequeue(element: Element, queueName?: string): any; @@ -236,6 +244,7 @@ interface JQueryStatic { EVENTS *******/ proxy(context: any, name: any): any; + Deferred(): JQueryDeferred; /********* INTERNALS @@ -311,11 +320,11 @@ interface JQuery { AJAX *****/ ajaxComplete(handler: any): JQuery; - ajaxError(handler: (evt: any, xhr: any, opts: any) => any): JQuery; - ajaxSend(handler: (evt: any, xhr: any, opts: any) => any): JQuery; + ajaxError(handler: (event: any, jqXHR: any, settings: any, exception: any) => any): JQuery; + ajaxSend(handler: (event: any, jqXHR: any, settings: any, exception: any) => any): JQuery; ajaxStart(handler: () => any): JQuery; ajaxStop(handler: () => any): JQuery; - ajaxSuccess(handler: (evt: any, xml: any, opts: any) => any): JQuery; + ajaxSuccess(handler: (event: any, jqXHR: any, settings: any, exception: any) => any): JQuery; load(url: string, data?: any, complete?: any): JQuery; @@ -326,7 +335,7 @@ interface JQuery { ATTRIBUTES ***********/ addClass(classNames: string): JQuery; - addClass(func: (index: any, currentClass: any) => JQuery); + addClass(func: (index: any, currentClass: any) => string): JQuery; attr(attributeName: string): string; attr(attributeName: string, value: any): JQuery; @@ -338,7 +347,7 @@ interface JQuery { html(htmlString: string): JQuery; html(): string; - prop(propertyName: string): string; + prop(propertyName: string): bool; prop(propertyName: string, value: any): JQuery; prop(map: any): JQuery; prop(propertyName: string, func: (index: any, oldPropertyValue: any) => any): JQuery; @@ -362,11 +371,12 @@ interface JQuery { /*** CSS ****/ - css(propertyName: string, value?: any); - css(propertyName: any, value?: any); + css(propertyName: string, value?: any): any; + css(propertyName: any, value?: any): any; height(): number; height(value: number): JQuery; + height(value: string): JQuery; height(func: (index: any, height: any) => any): JQuery; innerHeight(): number; @@ -389,6 +399,7 @@ interface JQuery { width(): number; width(value: number): JQuery; + width(value: string): JQuery; width(func: (index: any, height: any) => any): JQuery; /**** @@ -412,6 +423,7 @@ interface JQuery { /******* EFFECTS ********/ + animate(properties: any, duration?: any, complete?: Function): JQuery; animate(properties: any, duration?: any, easing?: string, complete?: Function): JQuery; animate(properties: any, options: { duration?: any; easing?: string; complete?: Function; step?: Function; queue?: bool; specialEasing?: any; }); @@ -595,9 +607,10 @@ interface JQuery { replaceWith(func: any): JQuery; - text(textString: string): JQuery; text(): string; - + text(textString: string): JQuery; + text(textString: (index: number, text: string) => string): JQuery; + toArray(): any[]; unwrap(): JQuery; @@ -613,7 +626,7 @@ interface JQuery { /************* MISCELLANEOUS **************/ - each(func: (index: any, elem: Element) => JQuery); + each(func: (index: any, elem: Element) => any); get(index?: number): any; diff --git a/Definitions/jquery.dynatree-1.2.d.ts b/Definitions/jquery.dynatree-1.2.d.ts new file mode 100644 index 000000000..f4502aca7 --- /dev/null +++ b/Definitions/jquery.dynatree-1.2.d.ts @@ -0,0 +1,240 @@ +// Type definitions for jquery.dynagrid 1.2 +// Project: http://code.google.com/p/dynatree/ +// Definitions by: https://github.com/fdecampredon +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +interface JQuery { + dynatree(options?: DynatreeOptions): DynaTree; + dynatree(option?: string, ...rest: any[]): any; +} + +interface JQueryStatic { + ui: { + dynatree: DynatreeNamespace; + }; +} + +interface DynaTree { + activateKey(key: string): DynaTreeNode; + count(): number; + enable(): void; + disable(): void; + enableUpdate(enable: bool): void; + getActiveNode(): DynaTreeNode; + getNodeByKey(key: string): DynaTreeNode; + getPersistData(): any; + getRoot(): DynaTreeNode; + getSelectedNodes(stopOnParents: bool): DynaTreeNode[]; + initialize(): void; + isInitializing(): bool; + isReloading(): bool; + isUserEvent(): bool; + loadKeyPath(keyPath: string, callback: (node: DynaTreeNode, status: string) =>void ): void; + reactivate(setFocus: bool): void; + redraw(): void; + reload(): void; + renderInvisibleNodes(): void; + selectKey(key: string, flag: string): DynaTreeNode; + serializeArray(stopOnParents: bool): any[]; + toDict(): any; + visit(fn: (node: DynaTreeNode) =>bool, includeRoot: bool): void; +} + + +interface DynaTreeNode { + data: DynaTreeDataModel; + activate(): void; + activateSilently(): void; + addChild(nodeData: DynaTreeDataModel, beforeNode?: DynaTreeNode): void; + addChild(nodeData: DynaTreeDataModel[], beforeNode?: DynaTreeNode): void; + appendAjax(ajaxOptions: JQueryAjaxSettings): void; + countChildren(): number; + deactivate(): void; + expand(flag: string): void; + focus(): void; + getChildren(): DynaTreeNode[]; + getEventTargetType(event: Event): string; + getLevel(): number; + getNextSibling(): DynaTreeNode; + getParent(): DynaTreeNode; + getPrevSibling(): DynaTreeNode; + hasChildren(): bool; + isActive(): bool; + isChildOf(otherNode: DynaTreeNode): bool; + isDescendantOf(otherNode: DynaTreeNode): bool; + isExpanded(): bool; + isFirstSibling(): bool; + isFocused(): bool; + isLastSibling(): bool; + isLazy(): bool; + isLoading(): bool; + isSelected(): bool; + isStatusNode(): bool; + isVisible(): bool; + makeVisible(): bool; + move(targetNode: DynaTreeNode, mode: string): bool; + reload(force: bool): void; + remove(): void; + removeChildren(): void; + render(useEffects: bool, includeInvisible: bool): void; + resetLazy(): void; + scheduleAction(mode: string, ms: number); + select(flag: string): void; + setLazyNodeStatus(status: number): void; + setTitle(title: string): void; + sortChildren(cmp?: (a: DynaTreeNode, b: DynaTreeNode) =>number, deep?: bool); + toDict(recursive: bool, callback?: (node: any) =>any): any; + toggleExpand(): void; + toggleSelect(): void; + visit(fn: (node: DynaTreeNode) =>bool, includeSelf: bool): void; + visitParents(fn: (node: DynaTreeNode) =>bool, includeSelf: bool): void; +} + +interface DynatreeOptions { + title?: string; // Tree's name (only used for debug outpu) + minExpandLevel?: number; // 1: root node is not collapsible + imagePath?: string; // Path to a folder containing icons. Defaults to 'skin/' subdirectory. + children?: DynaTreeDataModel[]; // Init tree structure from this object array. + initId?: string; // Init tree structure from a