From 86bbeb0727634a4167760128de57790a5ccb1d2a Mon Sep 17 00:00:00 2001 From: Sergey Buturlakin Date: Tue, 29 Sep 2015 20:54:55 +0300 Subject: [PATCH 001/389] Update react-router 0.13.3 -> 1.0.0-rc1 --- react-router/history.d.ts | 152 ++++++++ react-router/react-router-test.ts | 425 ---------------------- react-router/react-router.d.ts | 570 ++++++++++++++---------------- 3 files changed, 423 insertions(+), 724 deletions(-) create mode 100644 react-router/history.d.ts delete mode 100644 react-router/react-router-test.ts diff --git a/react-router/history.d.ts b/react-router/history.d.ts new file mode 100644 index 000000000..ede3d719c --- /dev/null +++ b/react-router/history.d.ts @@ -0,0 +1,152 @@ +// Type definitions for history v1.11.1 +// Project: https://github.com/rackt/history +// Definitions by: Sergey Buturlakin +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +declare namespace HistoryModule { + + // types based on https://github.com/rackt/history/blob/master/docs/Terms.md + + type Action = string + + type BeforeUnloadHook = () => string + + type CreateHistory = (options: HistoryOptions) => History + + type CreateHistoryEnhancer = (createHistory: CreateHistory) => CreateHistory + + interface History { + listenBefore: (hook: TransitionHook) => Function + listen: (listener: LocationListener) => Function + transitionTo(location: Location): void + pushState(state: LocationState, path: Path): void + replaceState(state: LocationState, path: Path): void + setState(state: LocationState): void + go(n: number): void + goBack(): void + goForward(): void + createKey(): LocationKey + createPath(path: Path): Path + createHref(path: Path): Href + } + + type HistoryOptions = Object + + type Href = string + + type Location = { + pathname: Pathname + search: QueryString + query: Query + state: LocationState + action: Action + key: LocationKey + } + + type LocationKey = string + + type LocationListener = (location: Location) => void + + type LocationState = Object + + type Path = string // Pathname + QueryString + + type Pathname = string + + type QueryString = string + + type Query = Object + + type TransitionHook = (location: Location, callback: Function) => any + +} + + +declare module "history/lib/createBrowserHistory" { + + export default function createBrowserHistory(): HistoryModule.History + +} + + +declare module "history/lib/createHashHistory" { + + export default function createHashHistory(): HistoryModule.History + +} + + +declare module "history/lib/createMemoryHistory" { + + export default function createMemoryHistory(): HistoryModule.History + +} + + +declare module "history/lib/createLocation" { + + export default function createLocation(): HistoryModule.Location + +} + + +declare module "history/lib/useBasename" { + + export default function useBasename(enhancer: HistoryModule.CreateHistoryEnhancer): HistoryModule.CreateHistory + +} + + +declare module "history/lib/useBeforeUnload" { + + export default function useBeforeUnload(enhancer: HistoryModule.CreateHistoryEnhancer): HistoryModule.CreateHistory + +} + + +declare module "history/lib/useQueries" { + + export default function useQueries(enhancer: HistoryModule.CreateHistoryEnhancer): HistoryModule.CreateHistory + +} + + +declare module "history/lib/actions" { + + export const PUSH: string + + export const REPLACE: string + + export const POP: string + + export default { + PUSH, + REPLACE, + POP + } + +} + + +declare module "history" { + + export { default as createHistory } from "history/lib/createBrowserHistory" + + export { default as createHashHistory } from "history/lib/createHashHistory" + + export { default as createMemoryHistory } from "history/lib/createMemoryHistory" + + export { default as createLocation } from "history/lib/createLocation" + + export { default as useBasename } from "history/lib/useBasename" + + export { default as useBeforeUnload } from "history/lib/useBeforeUnload" + + export { default as useQueries } from "history/lib/useQueries" + + import * as Actions from "history/lib/actions" + + export { Actions } + +} diff --git a/react-router/react-router-test.ts b/react-router/react-router-test.ts deleted file mode 100644 index 115c8b77f..000000000 --- a/react-router/react-router-test.ts +++ /dev/null @@ -1,425 +0,0 @@ -/// -"use strict"; - -import React = require('react'); -import ReactAddons = require('react/addons'); -import Router = require('react-router'); - -// Mixin -class NavigationTest { - v: T; - - makePath() { - var v1: string = this.v.makePath('to'); - var v2: string = this.v.makePath('to', {id: 1}); - var v3: string = this.v.makePath('to', {id: 1}, {type: 'json'}); - } - makeHref() { - var v1: string = this.v.makeHref('to'); - var v2: string = this.v.makeHref('to', {id: 1}); - var v3: string = this.v.makeHref('to', {id: 1}, {type: 'json'}); - } - transitionTo() { - var v1: void = this.v.transitionTo('to'); - var v2: void = this.v.transitionTo('to', {id: 1}); - var v3: void = this.v.transitionTo('to', {id: 1}, {type: 'json'}); - } - replaceWith() { - var v1: void = this.v.replaceWith('to'); - var v2: void = this.v.replaceWith('to', {id: 1}); - var v3: void = this.v.replaceWith('to', {id: 1}, {type: 'json'}); - } - goBack() { - var v1: void = this.v.goBack(); - } -} - -class StateTest { - v: T; - - getPath() { - var v1: string = this.v.getPath(); - } - - getRoutes() { - var v1: Router.Route[] = this.v.getRoutes(); - } - - getPathname() { - var v1: string = this.v.getPathname(); - } - - getParams() { - var v1: {} = this.v.getParams(); - } - - getQuery() { - var v1: {} = this.v.getQuery(); - } - - isActive() { - var v1: boolean = this.v.isActive('to'); - var v2: boolean = this.v.isActive('to', {id: 1}); - var v3: boolean = this.v.isActive('to', {id: 1}, {type: 'json'}); - } -} - - -// Location -class LocationTest { - v: T; - - push() { - var v1: void = this.v.push('path/to/hoge'); - } - - replace() { - var v1: void = this.v.replace('path/to/hoge'); - } - - pop() { - var v1: void = this.v.pop(); - } - - getCurrentPath() { - var v1: void = this.v.getCurrentPath(); - } -} -new LocationTest(); -new LocationTest(); -new LocationTest(); - -class LocationListenerTest { - v: T; - - addChangeListener() { - var v1: void = this.v.addChangeListener(() => console.log(1)); - } - - removeChangeListener() { - var v1: void = this.v.removeChangeListener(() => console.log(1)); - } -} -new LocationListenerTest(); -new LocationListenerTest(); - - -// Behavior -class ScrollBehaviorTest { - v: T; - - updateScrollPosition() { - var v1: void = this.v.updateScrollPosition({x: 33, y: 102}, 'scrollTop'); - } -} -new ScrollBehaviorTest(); -new ScrollBehaviorTest(); - - -// Component -class DefaultRouteTest { - v: Router.DefaultRoute; - - props() { - var name: string = this.v.props.name; - var handler: React.ComponentClass = this.v.props.handler; - } - - createElement() { - var Handler: React.ComponentClass; - React.createElement(Router.DefaultRoute, null); - React.createElement(Router.DefaultRoute, {name: 'name', handler: Handler}); - - ReactAddons.createElement(Router.DefaultRoute, null); - ReactAddons.createElement(Router.DefaultRoute, {name: 'name', handler: Handler}); - } -} - -class LinkTest { - v: Router.Link; - - constructor() { - new NavigationTest(); - new StateTest(); - } - - props() { - var activeClassName: string = this.v.props.activeClassName; - var to: string = this.v.props.to; - var params: {} = this.v.props.params; - var query: {} = this.v.props.query; - var onClick: Function = this.v.props.onClick; - } - - getHref() { - var v1: string = this.v.getHref(); - } - - getClassName() { - var v1: string = this.v.getClassName(); - } - - createElement() { - React.createElement(Router.Link, null); - React.createElement(Router.Link, {to: 'home'}); - React.createElement(Router.Link, { - activeClassName: 'name', - to: 'home', - params: {}, - query: {}, - onClick: () => console.log(1) - }); - - ReactAddons.createElement(Router.Link, null); - ReactAddons.createElement(Router.Link, {to: 'home'}); - ReactAddons.createElement(Router.Link, { - activeClassName: 'name', - to: 'home', - params: {}, - query: {}, - onClick: () => console.log(1) - }); - } -} - -class NotFoundRouteTest { - v: Router.NotFoundRoute; - - props() { - var name: string = this.v.props.name; - var handler: React.ComponentClass = this.v.props.handler; - } - - createElement() { - var Handler: React.ComponentClass; - React.createElement(Router.NotFoundRoute, null); - React.createElement(Router.NotFoundRoute, {handler: Handler}); - React.createElement(Router.NotFoundRoute, {handler: Handler, name: "home"}); - - ReactAddons.createElement(Router.NotFoundRoute, null); - ReactAddons.createElement(Router.NotFoundRoute, {handler: Handler}); - ReactAddons.createElement(Router.NotFoundRoute, {handler: Handler, name: "home"}); - } -} - -class RedirectTest { - v: Router.Redirect; - - props() { - var path: string = this.v.props.path; - var from: string = this.v.props.from; - var to: string = this.v.props.to; - } - - createElement() { - React.createElement(Router.Redirect, null); - React.createElement(Router.Redirect, {}); - React.createElement(Router.Redirect, {path: 'a', from: 'a', to: 'b'}); - - ReactAddons.createElement(Router.Redirect, null); - ReactAddons.createElement(Router.Redirect, {}); - ReactAddons.createElement(Router.Redirect, {path: 'a', from: 'a', to: 'b'}); - } -} - -class RouteTest { - v: Router.Route; - - props() { - var name: string = this.v.props.name; - var path: string = this.v.props.path; - var handler: React.ComponentClass = this.v.props.handler; - var ignoreScrollBehavior: boolean = this.v.props.ignoreScrollBehavior; - } - - createElement() { - var Handler: React.ComponentClass; - React.createElement(Router.Route, null); - React.createElement(Router.Route, {}); - React.createElement(Router.Route, {name: "home", path: "/", handler: Handler, ignoreScrollBehavior: true}); - - ReactAddons.createElement(Router.Route, null); - ReactAddons.createElement(Router.Route, {}); - ReactAddons.createElement(Router.Route, {name: "home", path: "/", handler: Handler, ignoreScrollBehavior: true}); - } -} - -class RouteHandlerTest { - v: Router.RouteHandler; - - createElement() { - React.createElement(Router.RouteHandler, null); - React.createElement(Router.RouteHandler, {}); - - ReactAddons.createElement(Router.RouteHandler, null); - ReactAddons.createElement(Router.RouteHandler, {}); - } -} - - -// History -class HistoryTest { - v: Router.History; - - length() { - var v1: number = this.v.length; - } - - back() { - var v1: void = this.v.back(); - } -} - - -// Router -class CreateTest { - v: Router.Router; - - constructor() { - // React.createElement() version - this.v = Router.create({ - routes: React.createElement(Router.Route, null) - }); - this.v = Router.create({ - routes: React.createElement(Router.Route, null), - location: Router.HistoryLocation, - scrollBehavior: Router.ImitateBrowserBehavior - }); - - // React.createFactory() version - this.v = Router.create({ - routes: React.createFactory(Router.Route)() - }); - this.v = Router.create({ - routes: React.createFactory(Router.Route)(), - location: Router.HistoryLocation, - scrollBehavior: Router.ImitateBrowserBehavior - }); - } - - run() { - this.v.run((Handler) => console.log(Handler)); - this.v.run((Handler, state) => console.log(Handler, state)); - } -} - -class RunTest { - constructor() { - // React.createElement() version - var v1: Router.Router = Router.run(React.createElement(Router.Route, null), (Handler) => { - React.render(React.createElement(Handler, null), document.body); - }); - var v2: Router.Router = Router.run(React.createElement(Router.Route, null), Router.HistoryLocation, (Handler, state) => { - React.render(React.createElement(Handler, null), document.body); - }); - var v3: Router.Router = Router.run(React.createElement(Router.Route, null), '/foo/bar', (Handler, state) => { - React.render(React.createElement(Handler, null), document.body); - }); - - // React.createFactory() version - var v4: Router.Router = Router.run(React.createFactory(Router.Route)(), (Handler) => { - React.render(React.createElement(Handler, null), document.body); - }); - var v5: Router.Router = Router.run(React.createFactory(Router.Route)(), Router.HistoryLocation, (Handler, state) => { - React.render(React.createElement(Handler, null), document.body); - }); - var v6: Router.Router = Router.run(React.createFactory(Router.Route)(), '/foo/bar', (Handler, state) => { - React.render(React.createElement(Handler, null), document.body); - }); - } -} - - -// Transition -class TransitionTest { - constructor() { - var v1: Router.TransitionStaticLifecycle = { - willTransitionTo: (transition, params, query, callback) => { - transition.abort(); - transition.redirect('to'); - transition.redirect('to', {id: 1}); - transition.redirect('to', {id: 1}, {type: 'json'}); - transition.retry(); - }, - willTransitionFrom: (transition, component, callback) => {} - }; - var v2: Router.TransitionStaticLifecycle = { - willTransitionTo: (transition, params, query) => {}, - willTransitionFrom: (transition, component) => {} - }; - var v3: Router.TransitionStaticLifecycle = { - willTransitionTo: (transition, params) => {}, - willTransitionFrom: (transition) => {} - }; - var v4: Router.TransitionStaticLifecycle = { - willTransitionTo: (transition) => {}, - willTransitionFrom: () => {} - }; - var v5: Router.TransitionStaticLifecycle = { - willTransitionTo: () => {} - }; - var v6: Router.TransitionStaticLifecycle = { - willTransitionFrom: () => {} - }; - } -} - - -// Context -class ContextTest { - v: Router.Context - - makePath() { - var v1: string = this.v.makePath('home'); - var v2: string = this.v.makePath('home', {p1: 1}); - var v3: string = this.v.makePath('home', {p1: 1}, {q1: 1}); - } - - makeHref() { - var v1: string = this.v.makeHref('home'); - var v2: string = this.v.makeHref('home', {p1: 1}); - var v3: string = this.v.makeHref('home', {p1: 1}, {q1: 1}); - } - - transitionTo() { - var v1: void = this.v.transitionTo('home'); - var v2: void = this.v.transitionTo('home', {p1: 1}); - var v3: void = this.v.transitionTo('home', {p1: 1}, {q1: 1}); - } - - replaceWith() { - var v1: void = this.v.replaceWith('home'); - var v2: void = this.v.replaceWith('home', {p1: 1}); - var v3: void = this.v.replaceWith('home', {p1: 1}, {q1: 1}); - } - - goBack() { - var v: void = this.v.goBack(); - } - - getCurrentPath() { - var v: string = this.v.getCurrentPath(); - } - - getCurrentRoutes() { - var v: Router.Route[] = this.v.getCurrentRoutes(); - } - - getCurrentPathname() { - var v: string = this.v.getCurrentPathname(); - } - - getCurrentParams() { - var v: {} = this.v.getCurrentParams(); - } - - getCurrentQuery() { - var v: {} = this.v.getCurrentQuery(); - } - - isActive() { - var v1: boolean = this.v.isActive('home'); - var v2: boolean = this.v.isActive('home', {p1: 1}); - var v3: boolean = this.v.isActive('home', {p1: 1}, {q1: 1}); - } -} diff --git a/react-router/react-router.d.ts b/react-router/react-router.d.ts index 4cebcfab3..b1da6e006 100644 --- a/react-router/react-router.d.ts +++ b/react-router/react-router.d.ts @@ -1,354 +1,326 @@ -// Type definitions for React Router 0.13.3 +// Type definitions for history v1.0.0-rc1 // Project: https://github.com/rackt/react-router -// Definitions by: Yuichi Murata , Václav Ostrožlík +// Definitions by: Sergey Buturlakin // Definitions: https://github.com/borisyankov/DefinitelyTyped -/// -declare module ReactRouter { - import React = __React; +/// - // - // Transition - // ---------------------------------------------------------------------- - interface Transition { - path: string; - abortReason: any; - retry(): void; - abort(reason?: any): void; - redirect(to: string, params?: {}, query?: {}): void; - cancel(): void; - from: (transition: Transition, routes: Route[], components?: React.ReactElement[], callback?: (error?: any) => void) => void; - to: (transition: Transition, routes: Route[], params?: {}, query?: {}, callback?: (error?: any) => void) => void; + +declare namespace ReactRouter { + + // types based on https://github.com/rackt/react-router/blob/master/docs/Glossary.md + + type Action = string + + type Component = React.ReactType + + type EnterHook = (nextState: RouterState, replaceState: RedirectFunction, callback?: Function) => any + + type LeaveHook = () => any + + interface Location { + pathname: Pathname + search: QueryString + query: Query + state: LocationState + action: Action + key: LocationKey } - interface TransitionStaticLifecycle { - willTransitionTo?( - transition: Transition, - params: {}, - query: {}, - callback: Function - ): void; + type LocationKey = string - willTransitionFrom?( - transition: Transition, - component: React.ReactElement, - callback: Function - ): void; + type LocationListener = (location: Location) => void + + type LocationState = Object + + type Params = Object + + type Path = string // Pathname + QueryString + + type Pathname = string + + type Query = Object + + type QueryString = string + + type RedirectFunction = (state: LocationState, pathname: Pathname | Path, query?: Query) => void + + interface RouteComponentProps { + history?: RouterObject + location?: Location + params?: Params + route?: RouteObject + routeParams?: Params + routes?: PlainRoute[] } - // - // Route Configuration - // ---------------------------------------------------------------------- - // DefaultRoute - interface DefaultRouteProp { - name?: string; - handler: React.ComponentClass; - } - interface DefaultRoute extends React.ReactElement {} - interface DefaultRouteClass extends React.ComponentClass {} + type RouteComponent = React.ComponentClass - // NotFoundRoute - interface NotFoundRouteProp { - name?: string; - handler: React.ComponentClass; - } - interface NotFoundRoute extends React.ReactElement {} - interface NotFoundRouteClass extends React.ComponentClass {} + type RouteConfig = RouteObject[] - // Redirect - interface RedirectProp { - path?: string; - from?: string; - to?: string; - } - interface Redirect extends React.ReactElement {} - interface RedirectClass extends React.ComponentClass {} + type RouteHook = (nextLocation?: Location) => any - // Route - interface RouteProp { - name?: string; - path?: string; - handler?: React.ComponentClass; - ignoreScrollBehavior?: boolean; - } - interface Route extends React.ReactElement {} - interface RouteClass extends React.ComponentClass {} + type RoutePattern = string - var DefaultRoute: DefaultRouteClass; - var NotFoundRoute: NotFoundRouteClass; - var Redirect: RedirectClass; - var Route: RouteClass; - - interface CreateRouteOptions { - name?: string; - path?: string; - ignoreScrollBehavior?: boolean; - isDefault?: boolean; - isNotFound?: boolean; - onEnter?: (transition: Transition, params: {}, query: {}, callback: Function) => void; - onLeave?: (transition: Transition, wtf: any, callback: Function) => void; - handler?: Function; - parentRoute?: Route; + interface RouteObject { + component: RouteComponent + path: RoutePattern + onEnter: EnterHook + onLeave: LeaveHook } - type CreateRouteCallback = (route: Route) => void; - - function createRoute(callback: CreateRouteCallback): Route; - function createRoute(options: CreateRouteOptions | string, callback: CreateRouteCallback): Route; - function createDefaultRoute(options?: CreateRouteOptions | string): Route; - function createNotFoundRoute(options?: CreateRouteOptions | string): Route; - - interface CreateRedirectOptions extends CreateRouteOptions { - path?: string; - from?: string; - to: string; - params?: {}; - query?: {}; + interface RouterObject { + transitionTo: (location: Location) => void + pushState: (state: LocationState, pathname: Pathname | Path, query?: Query) => void + replaceState: (state: LocationState, pathname: Pathname | Path, query?: Query) => void + go(n: Number): void + listen(listener: RouterListener): Function + match(location: Location, callback: RouterListener): void } - function createRedirect(options: CreateRedirectOptions): Redirect; - function createRoutesFromReactChildren(children: Route): Route[]; - // - // Components - // ---------------------------------------------------------------------- - // Link - interface LinkProp extends React.HTMLAttributes { - activeClassName?: string; - activeStyle?: {}; - to: string; - params?: {}; - query?: {}; - } - interface Link extends React.ReactElement, Navigation, State { - handleClick(event: any): void; - getHref(): string; - getClassName(): string; - getActiveState(): boolean; - } - interface LinkClass extends React.ComponentClass {} - - // RouteHandler - interface RouteHandlerProp { } - interface RouteHandlerChildContext { - routeDepth: number; - } - interface RouteHandler extends React.ReactElement { - getChildContext(): RouteHandlerChildContext; - getRouteDepth(): number; - createChildRouteHandler(props: {}): RouteHandler; - } - interface RouteHandlerClass extends React.ComponentClass {} - - var Link: LinkClass; - var RouteHandler: RouteHandlerClass; - - - // - // Top-Level - // ---------------------------------------------------------------------- - interface Router extends React.ReactElement { - run(callback: RouterRunCallback): void; - } + type RouterListener = (error: Error, nextState: RouterState) => void interface RouterState { - path: string; - action: string; - pathname: string; - params: {}; - query: {}; - routes: Route[]; + location: Location + routes: RouteConfig + params: Params + components: Component[] } - interface RouterCreateOption { - routes: Route; - location?: LocationBase; - scrollBehavior?: ScrollBehaviorBase; - onError?: (error: any) => void; - onAbort?: (error: any) => void; + + interface HistoryProp { + listen(listener: LocationListener): Function + pushState(state: LocationState, path: Path): void + replaceState(state: LocationState, path: Path): void + go(n: number): void } - type RouterRunCallback = (Handler: RouteClass, state: RouterState) => void; + type RouteType = Route | IndexRoute | PlainRoute | Redirect - function create(options: RouterCreateOption): Router; - function run(routes: Route, callback: RouterRunCallback): Router; - function run(routes: Route, location: LocationBase | string, callback: RouterRunCallback): Router; + type Components = { [key: string]: Component } - // - // Location - // ---------------------------------------------------------------------- - interface LocationBase { - getCurrentPath(): void; - toString(): string; + interface RouterProps { + history?: HistoryProp + children?: RouteType[] + routes?: RouteType[] // alias for children + createElement?: (component: Component, props: Object) => any + onError?: (err: any) => any + onUpdate?: () => any + parseQueryString?: (queryString: QueryString) => Query + stringifyQuery?: (queryObject: Query) => QueryString } - interface Location extends LocationBase { - push(path: string): void; - replace(path: string): void; - pop(): void; + interface Router extends React.ComponentClass {} + interface RouterElement extends React.ReactElement {} + const Router: Router + + + interface LinkProps extends React.HTMLAttributesBase { + activeStyle?: React.CSSProperties + activeClassName?: string + onlyActiveOnIndex?: boolean + to: RoutePattern + query?: Query + state?: LocationState + } + interface Link extends React.ComponentClass {} + interface LinkElement extends React.DOMElement {} + const Link: Link + + + interface RoutePropsBase { + children?: RouteType[] + ignoreScrollBehavior?: boolean + component?: Component + components?: Components + getComponent?: (location: Location, cb: (err: any, component?: Component) => void) => void + getComponents?: (location: Location, cb: (err: any, components?: Components) => void) => void + onEnter?: EnterHook + onLeave?: LeaveHook } - interface LocationListener { - addChangeListener(listener: Function): void; - removeChangeListener(listener: Function): void; + interface RouteProps extends RoutePropsBase { + path?: RoutePattern + } + interface Route extends React.ComponentClass {} + interface RouteElement extends React.ReactElement {} + const Route: Route + + + interface PlainRoute extends RoutePropsBase { + childRoutes: RouteType[] + getChildRoutes: (location: Location, cb: (err: any, routesArray: RouteType[]) => void) => void } - interface HashLocation extends Location, LocationListener { } - interface HistoryLocation extends Location, LocationListener { } - interface RefreshLocation extends Location { } - interface StaticLocation extends LocationBase { } - interface TestLocation extends Location, LocationListener { } - var HashLocation: HashLocation; - var HistoryLocation: HistoryLocation; - var RefreshLocation: RefreshLocation; - var StaticLocation: StaticLocation; - var TestLocation: TestLocation; + interface RedirectProps { + path?: RoutePattern + from?: RoutePattern // alias for path + to: RoutePattern + query?: Query + state?: LocationState - - // - // Behavior - // ---------------------------------------------------------------------- - interface ScrollBehaviorBase { - updateScrollPosition(position: { x: number; y: number; }, actionType: string): void; } - interface ImitateBrowserBehavior extends ScrollBehaviorBase { } - interface ScrollToTopBehavior extends ScrollBehaviorBase { } - - var ImitateBrowserBehavior: ImitateBrowserBehavior; - var ScrollToTopBehavior: ScrollToTopBehavior; + interface Redirect extends React.ReactElement {} + interface RedirectELement extends React.ReactElement {} + const Redirect: Redirect - // - // Mixin - // ---------------------------------------------------------------------- - interface Navigation { - makePath(to: string, params?: {}, query?: {}): string; - makeHref(to: string, params?: {}, query?: {}): string; - transitionTo(to: string, params?: {}, query?: {}): void; - replaceWith(to: string, params?: {}, query?: {}): void; - goBack(): void; - } + interface IndexRouteProps extends RoutePropsBase {} + interface IndexRoute extends React.ComponentClass {} + interface IndexRouteElement extends React.ReactElement {} + const IndexRoute: IndexRoute - interface State { - getPath(): string; - getRoutes(): Route[]; - getPathname(): string; - getParams(): {}; - getQuery(): {}; - isActive(to: string, params?: {}, query?: {}): boolean; - } - - var Navigation: Navigation; - var State: State; - - - // - // History - // ---------------------------------------------------------------------- - interface History { - back(): void; - length: number; - } - var History: History; - - - // - // Context - // ---------------------------------------------------------------------- - interface Context { - makePath(to: string, params?: {}, query?: {}): string; - makeHref(to: string, params?: {}, query?: {}): string; - transitionTo(to: string, params?: {}, query?: {}): void; - replaceWith(to: string, params?: {}, query?: {}): void; - goBack(): void; - - getCurrentPath(): string; - getCurrentRoutes(): Route[]; - getCurrentPathname(): string; - getCurrentParams(): {}; - getCurrentQuery(): {}; - isActive(to: string, params?: {}, query?: {}): boolean; - } } + +declare module "react-router/lib/Router" { + + export default ReactRouter.Router + +} + + +declare module "react-router/lib/Link" { + + export default ReactRouter.Link + +} + + +declare module "react-router/lib/IndexRoute" { + + export default ReactRouter.IndexRoute + +} + + +declare module "react-router/lib/Redirect" { + + export default ReactRouter.Redirect + +} + + +declare module "react-router/lib/Route" { + + export default ReactRouter.Route + +} + + +declare module "react-router/lib/History" { + + const History: any + + export default History + +} + + +declare module "react-router/lib/Lifecycle" { + + const Lifecycle: any + + export default Lifecycle + +} + + +declare module "react-router/lib/RouteContext" { + + const RouteContext: any + + export default RouteContext + +} + + +declare module "react-router/lib/useRoutes" { + + const useRoutes: any + + export default useRoutes + +} + + +declare module "react-router/lib/RouteUtils" { + + export const createRoutes: any + +} + + +declare module "react-router/lib/RoutingContext" { + + const RoutingContext: any + + export default RoutingContext + +} + + +declare module "react-router/lib/PropTypes" { + + const PropTypes: any + + export default PropTypes + +} + + +declare module "react-router/lib/match" { + + const match: any + + export default match + +} + + declare module "react-router" { - export = ReactRouter; -} -declare module __React { + import Router from "react-router/lib/Router" - // for DefaultRoute - function createElement( - type: ReactRouter.DefaultRouteClass, - props: ReactRouter.DefaultRouteProp, - ...children: __React.ReactNode[]): ReactRouter.DefaultRoute; + import Link from "react-router/lib/Link" - // for Link - function createElement( - type: ReactRouter.LinkClass, - props: ReactRouter.LinkProp, - ...children: __React.ReactNode[]): ReactRouter.Link; + import IndexRoute from "react-router/lib/IndexRoute" - // for NotFoundRoute - function createElement( - type: ReactRouter.NotFoundRouteClass, - props: ReactRouter.NotFoundRouteProp, - ...children: __React.ReactNode[]): ReactRouter.NotFoundRoute; + import Redirect from "react-router/lib/Redirect" - // for Redirect - function createElement( - type: ReactRouter.RedirectClass, - props: ReactRouter.RedirectProp, - ...children: __React.ReactNode[]): ReactRouter.Redirect; + import Route from "react-router/lib/Route" - // for Route - function createElement( - type: ReactRouter.RouteClass, - props: ReactRouter.RouteProp, - ...children: __React.ReactNode[]): ReactRouter.Route; + import History from "react-router/lib/History" - // for RouteHandler - function createElement( - type: ReactRouter.RouteHandlerClass, - props: ReactRouter.RouteHandlerProp, - ...children: __React.ReactNode[]): ReactRouter.RouteHandler; -} + import Lifecycle from "react-router/lib/Lifecycle" -declare module "react/addons" { - // for DefaultRoute - function createElement( - type: ReactRouter.DefaultRouteClass, - props: ReactRouter.DefaultRouteProp, - ...children: __React.ReactNode[]): ReactRouter.DefaultRoute; + import RouteContext from "react-router/lib/RouteContext" - // for Link - function createElement( - type: ReactRouter.LinkClass, - props: ReactRouter.LinkProp, - ...children: __React.ReactNode[]): ReactRouter.Link; + import { createRoutes } from "react-router/lib/RouteUtils" - // for NotFoundRoute - function createElement( - type: ReactRouter.NotFoundRouteClass, - props: ReactRouter.NotFoundRouteProp, - ...children: __React.ReactNode[]): ReactRouter.NotFoundRoute; + import RoutingContext from "react-router/lib/RoutingContext" - // for Redirect - function createElement( - type: ReactRouter.RedirectClass, - props: ReactRouter.RedirectProp, - ...children: __React.ReactNode[]): ReactRouter.Redirect; + import PropTypes from "react-router/lib/PropTypes" - // for Route - function createElement( - type: ReactRouter.RouteClass, - props: ReactRouter.RouteProp, - ...children: __React.ReactNode[]): ReactRouter.Route; + import match from "react-router/lib/match" + + export { + Router, + Link, + IndexRoute, + Redirect, + Route, + History, + Lifecycle, + RouteContext, + createRoutes, + RoutingContext, + PropTypes, + match + } + + export default Router - // for RouteHandler - function createElement( - type: ReactRouter.RouteHandlerClass, - props: ReactRouter.RouteHandlerProp, - ...children: __React.ReactNode[]): ReactRouter.RouteHandler; } From fb14688db7ba1f2dd4cf5978ef03cbc318d45b40 Mon Sep 17 00:00:00 2001 From: Sergey Buturlakin Date: Wed, 30 Sep 2015 17:51:09 +0300 Subject: [PATCH 002/389] Update History for use as global and minor fixes --- react-router/history.d.ts | 40 ++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/react-router/history.d.ts b/react-router/history.d.ts index ede3d719c..e432a2418 100644 --- a/react-router/history.d.ts +++ b/react-router/history.d.ts @@ -12,13 +12,12 @@ declare namespace HistoryModule { type BeforeUnloadHook = () => string - type CreateHistory = (options: HistoryOptions) => History + type CreateHistory = (options?: HistoryOptions) => History type CreateHistoryEnhancer = (createHistory: CreateHistory) => CreateHistory - interface History { - listenBefore: (hook: TransitionHook) => Function - listen: (listener: LocationListener) => Function + interface HistoryBase { + listenBefore(hook: TransitionHook): Function transitionTo(location: Location): void pushState(state: LocationState, path: Path): void replaceState(state: LocationState, path: Path): void @@ -31,6 +30,10 @@ declare namespace HistoryModule { createHref(path: Path): Href } + interface History { + listen(listener: LocationListener): Function + } + type HistoryOptions = Object type Href = string @@ -54,32 +57,51 @@ declare namespace HistoryModule { type Pathname = string - type QueryString = string - type Query = Object + type QueryString = string + type TransitionHook = (location: Location, callback: Function) => any + // Global usage, without modules, needs the small trick, because lib.d.ts + // already has `history` and `History` global definitions: + // var history_: HistoryModule.Module = window['History']; + // history_.createHistory(); + interface Module { + createHistory: CreateHistory + createHashHistory: CreateHistory + createMemoryHistory: CreateHistory + createLocation(): Location + useBasename(enhancer: CreateHistoryEnhancer): CreateHistory + useBeforeUnload(enhancer: CreateHistoryEnhancer): CreateHistory + useQueries(enhancer: CreateHistoryEnhancer): CreateHistory + actions: { + PUSH: string + REPLACE: string + POP: string + } + } + } declare module "history/lib/createBrowserHistory" { - export default function createBrowserHistory(): HistoryModule.History + export default function createBrowserHistory(options?: HistoryModule.HistoryOptions): HistoryModule.History } declare module "history/lib/createHashHistory" { - export default function createHashHistory(): HistoryModule.History + export default function createHashHistory(options?: HistoryModule.HistoryOptions): HistoryModule.History } declare module "history/lib/createMemoryHistory" { - export default function createMemoryHistory(): HistoryModule.History + export default function createMemoryHistory(options?: HistoryModule.HistoryOptions): HistoryModule.History } From ef5f58533485fd056b4c642d9c49c92667d8f290 Mon Sep 17 00:00:00 2001 From: Sergey Buturlakin Date: Wed, 30 Sep 2015 17:52:15 +0300 Subject: [PATCH 003/389] Complete react-router v1.0.0-rc1 definitions --- react-router/react-router.d.ts | 215 ++++++++++++++++++++------------- 1 file changed, 132 insertions(+), 83 deletions(-) diff --git a/react-router/react-router.d.ts b/react-router/react-router.d.ts index b1da6e006..c96fe284d 100644 --- a/react-router/react-router.d.ts +++ b/react-router/react-router.d.ts @@ -1,17 +1,18 @@ -// Type definitions for history v1.0.0-rc1 +// Type definitions for react-router v1.0.0-rc1 // Project: https://github.com/rackt/react-router // Definitions by: Sergey Buturlakin // Definitions: https://github.com/borisyankov/DefinitelyTyped -/// +/// +/// declare namespace ReactRouter { // types based on https://github.com/rackt/react-router/blob/master/docs/Glossary.md - type Action = string + import H = HistoryModule type Component = React.ReactType @@ -19,38 +20,17 @@ declare namespace ReactRouter { type LeaveHook = () => any - interface Location { - pathname: Pathname - search: QueryString - query: Query - state: LocationState - action: Action - key: LocationKey - } - - type LocationKey = string - - type LocationListener = (location: Location) => void - - type LocationState = Object - type Params = Object - type Path = string // Pathname + QueryString + type ParseQueryString = (queryString: H.QueryString) => H.Query - type Pathname = string - - type Query = Object - - type QueryString = string - - type RedirectFunction = (state: LocationState, pathname: Pathname | Path, query?: Query) => void + type RedirectFunction = (state: H.LocationState, pathname: H.Pathname | H.Path, query?: H.Query) => void interface RouteComponentProps { - history?: RouterObject + history?: History location?: Location params?: Params - route?: RouteObject + route?: PlainRoute routeParams?: Params routes?: PlainRoute[] } @@ -63,20 +43,24 @@ declare namespace ReactRouter { type RoutePattern = string - interface RouteObject { - component: RouteComponent - path: RoutePattern - onEnter: EnterHook - onLeave: LeaveHook - } + type RouteObject = PlainRoute - interface RouterObject { - transitionTo: (location: Location) => void - pushState: (state: LocationState, pathname: Pathname | Path, query?: Query) => void - replaceState: (state: LocationState, pathname: Pathname | Path, query?: Query) => void - go(n: Number): void + type StringifyQuery = (queryObject: H.Query) => H.QueryString + + + interface History extends H.HistoryBase { + pushState(state: H.LocationState, pathname: H.Pathname | H.Path, query?: H.Query): void + replaceState(state: H.LocationState, pathname: H.Pathname | H.Path, query?: H.Query): void + createPath(path: H.Path, query?: H.Query): H.Path + createHref(path: H.Path, query?: H.Query): H.Href + isActive(pathname: H.Pathname, query: H.Query): boolean + registerRouteHook(route: PlainRoute, hook: H.LocationListener): void + unregisterRouteHook(route: PlainRoute, hook: H.LocationListener): void listen(listener: RouterListener): Function - match(location: Location, callback: RouterListener): void + match(location: H.Location, callback: (error: any, nextState: RouterState, nextLocation: H.Location) => void): void + routes: PlainRoute[] + parseQueryString?: ParseQueryString + stringifyQuery?: StringifyQuery } type RouterListener = (error: Error, nextState: RouterState) => void @@ -89,27 +73,22 @@ declare namespace ReactRouter { } - interface HistoryProp { - listen(listener: LocationListener): Function - pushState(state: LocationState, path: Path): void - replaceState(state: LocationState, path: Path): void - go(n: number): void - } - type RouteType = Route | IndexRoute | PlainRoute | Redirect + type RouteTypes = RouteType | RouteType[] + type Components = { [key: string]: Component } interface RouterProps { - history?: HistoryProp - children?: RouteType[] - routes?: RouteType[] // alias for children + history?: H.History + children?: RouteTypes + routes?: RouteTypes // alias for children createElement?: (component: Component, props: Object) => any onError?: (err: any) => any onUpdate?: () => any - parseQueryString?: (queryString: QueryString) => Query - stringifyQuery?: (queryObject: Query) => QueryString + parseQueryString?: ParseQueryString + stringifyQuery?: StringifyQuery } interface Router extends React.ComponentClass {} interface RouterElement extends React.ReactElement {} @@ -121,8 +100,8 @@ declare namespace ReactRouter { activeClassName?: string onlyActiveOnIndex?: boolean to: RoutePattern - query?: Query - state?: LocationState + query?: H.Query + state?: H.LocationState } interface Link extends React.ComponentClass {} interface LinkElement extends React.DOMElement {} @@ -130,7 +109,7 @@ declare namespace ReactRouter { interface RoutePropsBase { - children?: RouteType[] + children?: RouteTypes ignoreScrollBehavior?: boolean component?: Component components?: Components @@ -148,9 +127,9 @@ declare namespace ReactRouter { const Route: Route - interface PlainRoute extends RoutePropsBase { - childRoutes: RouteType[] - getChildRoutes: (location: Location, cb: (err: any, routesArray: RouteType[]) => void) => void + interface PlainRoute extends RouteProps { + childRoutes: RouteTypes + getChildRoutes: (location: Location, cb: (err: any, routesArray: RouteTypes) => void) => void } @@ -158,12 +137,11 @@ declare namespace ReactRouter { path?: RoutePattern from?: RoutePattern // alias for path to: RoutePattern - query?: Query - state?: LocationState - + query?: H.Query + state?: H.LocationState } interface Redirect extends React.ReactElement {} - interface RedirectELement extends React.ReactElement {} + interface RedirectElement extends React.ReactElement {} const Redirect: Redirect @@ -172,6 +150,51 @@ declare namespace ReactRouter { interface IndexRouteElement extends React.ReactElement {} const IndexRoute: IndexRoute + + interface RoutingContextProps { + history: H.History + createElement?: (component: Component, props: Object) => any + location: Location + routes: RouteTypes + params: Params + components?: Components + } + interface RoutingContext extends React.ReactElement {} + interface RoutingContextElement extends React.ReactElement {} + const RoutingContext: RoutingContext + + + interface LifecycleMixin { + routerWillLeave(nextLocation: Location): string | boolean + } + const Lifecycle: React.Mixin + + + const RouteContext: React.Mixin + + + interface HistoryMixin { + history: History + } + const History: React.Mixin + + + function useRoutes(enhancer: H.CreateHistoryEnhancer): H.CreateHistory + + function createRoutes(routes: RouteTypes): PlainRoute[] + + interface MatchArgs { + routes?: RouteTypes + history?: H.History + location?: Location + parseQueryString?: ParseQueryString + stringifyQuery?: StringifyQuery + } + interface MatchState extends RouterState { + history: History + } + function match(args: MatchArgs, cb: (error: any, nextLocation: H.Location, nextState: MatchState) => void): void + } @@ -189,6 +212,15 @@ declare module "react-router/lib/Link" { } +declare module "react-router/lib/IndexLink" { + + const IndexLink: ReactRouter.Link + + export default IndexLink + +} + + declare module "react-router/lib/IndexRoute" { export default ReactRouter.IndexRoute @@ -212,70 +244,87 @@ declare module "react-router/lib/Route" { declare module "react-router/lib/History" { - const History: any - - export default History + export default ReactRouter.History } declare module "react-router/lib/Lifecycle" { - const Lifecycle: any - - export default Lifecycle + export default ReactRouter.Lifecycle } declare module "react-router/lib/RouteContext" { - const RouteContext: any - - export default RouteContext + export default ReactRouter.RouteContext } declare module "react-router/lib/useRoutes" { - const useRoutes: any - - export default useRoutes + export default ReactRouter.useRoutes } declare module "react-router/lib/RouteUtils" { - export const createRoutes: any + type E = React.ReactElement + + export function isReactChildren(object: E | E[]): boolean + + export function createRouteFromReactElement(element: E): ReactRouter.PlainRoute + + export function createRoutesFromReactChildren(children: E | E[], parentRoute: ReactRouter.PlainRoute): ReactRouter.PlainRoute[] + + import createRoutes = ReactRouter.createRoutes + + export { createRoutes } } declare module "react-router/lib/RoutingContext" { - const RoutingContext: any - - export default RoutingContext + export default ReactRouter.RoutingContext } declare module "react-router/lib/PropTypes" { - const PropTypes: any + export function falsy(props: any, propName: string, componentName: string): Error; - export default PropTypes + export const history: React.Requireable + + export const location: React.Requireable + + export const component: React.Requireable + + export const components: React.Requireable + + export const route: React.Requireable + + export const routes: React.Requireable + + export default { + falsy, + history, + location, + component, + components, + route + } } declare module "react-router/lib/match" { - const match: any - - export default match + export default ReactRouter.match } From 4a33c914d17fd680916dc0dbfa27df1ce41aea26 Mon Sep 17 00:00:00 2001 From: Sergey Buturlakin Date: Wed, 30 Sep 2015 19:27:10 +0300 Subject: [PATCH 004/389] Add tests Restore old definitions as react-router-0.13.3.d.ts Update react-redux to use old definitions --- react-redux/react-redux-tests.tsx | 2 +- react-router/history.d.ts | 7 +- react-router/react-router-0.13.3.d.ts | 354 ++++++++++++++++++ react-router/react-router-tests.tsx | 67 ++++ react-router/react-router-tests.tsx.tscparams | 1 + react-router/react-router.d.ts | 8 +- 6 files changed, 430 insertions(+), 9 deletions(-) create mode 100644 react-router/react-router-0.13.3.d.ts create mode 100644 react-router/react-router-tests.tsx create mode 100644 react-router/react-router-tests.tsx.tscparams diff --git a/react-redux/react-redux-tests.tsx b/react-redux/react-redux-tests.tsx index 9bd662295..eb2a5b5bc 100644 --- a/react-redux/react-redux-tests.tsx +++ b/react-redux/react-redux-tests.tsx @@ -1,7 +1,7 @@ /// /// /// -/// +/// /// import { Component } from 'react'; diff --git a/react-router/history.d.ts b/react-router/history.d.ts index e432a2418..c982bd229 100644 --- a/react-router/history.d.ts +++ b/react-router/history.d.ts @@ -63,10 +63,9 @@ declare namespace HistoryModule { type TransitionHook = (location: Location, callback: Function) => any - // Global usage, without modules, needs the small trick, because lib.d.ts - // already has `history` and `History` global definitions: - // var history_: HistoryModule.Module = window['History']; - // history_.createHistory(); + // Global usage, without modules, needs the small trick, because lib.d.ts + // already has `history` and `History` global definitions: + // var createHistory = ((window as any).History as HistoryModule.Module).createHistory; interface Module { createHistory: CreateHistory createHashHistory: CreateHistory diff --git a/react-router/react-router-0.13.3.d.ts b/react-router/react-router-0.13.3.d.ts new file mode 100644 index 000000000..4cebcfab3 --- /dev/null +++ b/react-router/react-router-0.13.3.d.ts @@ -0,0 +1,354 @@ +// Type definitions for React Router 0.13.3 +// Project: https://github.com/rackt/react-router +// Definitions by: Yuichi Murata , Václav Ostrožlík +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module ReactRouter { + import React = __React; + + // + // Transition + // ---------------------------------------------------------------------- + interface Transition { + path: string; + abortReason: any; + retry(): void; + abort(reason?: any): void; + redirect(to: string, params?: {}, query?: {}): void; + cancel(): void; + from: (transition: Transition, routes: Route[], components?: React.ReactElement[], callback?: (error?: any) => void) => void; + to: (transition: Transition, routes: Route[], params?: {}, query?: {}, callback?: (error?: any) => void) => void; + } + + interface TransitionStaticLifecycle { + willTransitionTo?( + transition: Transition, + params: {}, + query: {}, + callback: Function + ): void; + + willTransitionFrom?( + transition: Transition, + component: React.ReactElement, + callback: Function + ): void; + } + + // + // Route Configuration + // ---------------------------------------------------------------------- + // DefaultRoute + interface DefaultRouteProp { + name?: string; + handler: React.ComponentClass; + } + interface DefaultRoute extends React.ReactElement {} + interface DefaultRouteClass extends React.ComponentClass {} + + // NotFoundRoute + interface NotFoundRouteProp { + name?: string; + handler: React.ComponentClass; + } + interface NotFoundRoute extends React.ReactElement {} + interface NotFoundRouteClass extends React.ComponentClass {} + + // Redirect + interface RedirectProp { + path?: string; + from?: string; + to?: string; + } + interface Redirect extends React.ReactElement {} + interface RedirectClass extends React.ComponentClass {} + + // Route + interface RouteProp { + name?: string; + path?: string; + handler?: React.ComponentClass; + ignoreScrollBehavior?: boolean; + } + interface Route extends React.ReactElement {} + interface RouteClass extends React.ComponentClass {} + + var DefaultRoute: DefaultRouteClass; + var NotFoundRoute: NotFoundRouteClass; + var Redirect: RedirectClass; + var Route: RouteClass; + + interface CreateRouteOptions { + name?: string; + path?: string; + ignoreScrollBehavior?: boolean; + isDefault?: boolean; + isNotFound?: boolean; + onEnter?: (transition: Transition, params: {}, query: {}, callback: Function) => void; + onLeave?: (transition: Transition, wtf: any, callback: Function) => void; + handler?: Function; + parentRoute?: Route; + } + + type CreateRouteCallback = (route: Route) => void; + + function createRoute(callback: CreateRouteCallback): Route; + function createRoute(options: CreateRouteOptions | string, callback: CreateRouteCallback): Route; + function createDefaultRoute(options?: CreateRouteOptions | string): Route; + function createNotFoundRoute(options?: CreateRouteOptions | string): Route; + + interface CreateRedirectOptions extends CreateRouteOptions { + path?: string; + from?: string; + to: string; + params?: {}; + query?: {}; + } + function createRedirect(options: CreateRedirectOptions): Redirect; + function createRoutesFromReactChildren(children: Route): Route[]; + + // + // Components + // ---------------------------------------------------------------------- + // Link + interface LinkProp extends React.HTMLAttributes { + activeClassName?: string; + activeStyle?: {}; + to: string; + params?: {}; + query?: {}; + } + interface Link extends React.ReactElement, Navigation, State { + handleClick(event: any): void; + getHref(): string; + getClassName(): string; + getActiveState(): boolean; + } + interface LinkClass extends React.ComponentClass {} + + // RouteHandler + interface RouteHandlerProp { } + interface RouteHandlerChildContext { + routeDepth: number; + } + interface RouteHandler extends React.ReactElement { + getChildContext(): RouteHandlerChildContext; + getRouteDepth(): number; + createChildRouteHandler(props: {}): RouteHandler; + } + interface RouteHandlerClass extends React.ComponentClass {} + + var Link: LinkClass; + var RouteHandler: RouteHandlerClass; + + + // + // Top-Level + // ---------------------------------------------------------------------- + interface Router extends React.ReactElement { + run(callback: RouterRunCallback): void; + } + + interface RouterState { + path: string; + action: string; + pathname: string; + params: {}; + query: {}; + routes: Route[]; + } + + interface RouterCreateOption { + routes: Route; + location?: LocationBase; + scrollBehavior?: ScrollBehaviorBase; + onError?: (error: any) => void; + onAbort?: (error: any) => void; + } + + type RouterRunCallback = (Handler: RouteClass, state: RouterState) => void; + + function create(options: RouterCreateOption): Router; + function run(routes: Route, callback: RouterRunCallback): Router; + function run(routes: Route, location: LocationBase | string, callback: RouterRunCallback): Router; + + + // + // Location + // ---------------------------------------------------------------------- + interface LocationBase { + getCurrentPath(): void; + toString(): string; + } + interface Location extends LocationBase { + push(path: string): void; + replace(path: string): void; + pop(): void; + } + + interface LocationListener { + addChangeListener(listener: Function): void; + removeChangeListener(listener: Function): void; + } + + interface HashLocation extends Location, LocationListener { } + interface HistoryLocation extends Location, LocationListener { } + interface RefreshLocation extends Location { } + interface StaticLocation extends LocationBase { } + interface TestLocation extends Location, LocationListener { } + + var HashLocation: HashLocation; + var HistoryLocation: HistoryLocation; + var RefreshLocation: RefreshLocation; + var StaticLocation: StaticLocation; + var TestLocation: TestLocation; + + + // + // Behavior + // ---------------------------------------------------------------------- + interface ScrollBehaviorBase { + updateScrollPosition(position: { x: number; y: number; }, actionType: string): void; + } + interface ImitateBrowserBehavior extends ScrollBehaviorBase { } + interface ScrollToTopBehavior extends ScrollBehaviorBase { } + + var ImitateBrowserBehavior: ImitateBrowserBehavior; + var ScrollToTopBehavior: ScrollToTopBehavior; + + + // + // Mixin + // ---------------------------------------------------------------------- + interface Navigation { + makePath(to: string, params?: {}, query?: {}): string; + makeHref(to: string, params?: {}, query?: {}): string; + transitionTo(to: string, params?: {}, query?: {}): void; + replaceWith(to: string, params?: {}, query?: {}): void; + goBack(): void; + } + + interface State { + getPath(): string; + getRoutes(): Route[]; + getPathname(): string; + getParams(): {}; + getQuery(): {}; + isActive(to: string, params?: {}, query?: {}): boolean; + } + + var Navigation: Navigation; + var State: State; + + + // + // History + // ---------------------------------------------------------------------- + interface History { + back(): void; + length: number; + } + var History: History; + + + // + // Context + // ---------------------------------------------------------------------- + interface Context { + makePath(to: string, params?: {}, query?: {}): string; + makeHref(to: string, params?: {}, query?: {}): string; + transitionTo(to: string, params?: {}, query?: {}): void; + replaceWith(to: string, params?: {}, query?: {}): void; + goBack(): void; + + getCurrentPath(): string; + getCurrentRoutes(): Route[]; + getCurrentPathname(): string; + getCurrentParams(): {}; + getCurrentQuery(): {}; + isActive(to: string, params?: {}, query?: {}): boolean; + } +} + +declare module "react-router" { + export = ReactRouter; +} + +declare module __React { + + // for DefaultRoute + function createElement( + type: ReactRouter.DefaultRouteClass, + props: ReactRouter.DefaultRouteProp, + ...children: __React.ReactNode[]): ReactRouter.DefaultRoute; + + // for Link + function createElement( + type: ReactRouter.LinkClass, + props: ReactRouter.LinkProp, + ...children: __React.ReactNode[]): ReactRouter.Link; + + // for NotFoundRoute + function createElement( + type: ReactRouter.NotFoundRouteClass, + props: ReactRouter.NotFoundRouteProp, + ...children: __React.ReactNode[]): ReactRouter.NotFoundRoute; + + // for Redirect + function createElement( + type: ReactRouter.RedirectClass, + props: ReactRouter.RedirectProp, + ...children: __React.ReactNode[]): ReactRouter.Redirect; + + // for Route + function createElement( + type: ReactRouter.RouteClass, + props: ReactRouter.RouteProp, + ...children: __React.ReactNode[]): ReactRouter.Route; + + // for RouteHandler + function createElement( + type: ReactRouter.RouteHandlerClass, + props: ReactRouter.RouteHandlerProp, + ...children: __React.ReactNode[]): ReactRouter.RouteHandler; +} + +declare module "react/addons" { + // for DefaultRoute + function createElement( + type: ReactRouter.DefaultRouteClass, + props: ReactRouter.DefaultRouteProp, + ...children: __React.ReactNode[]): ReactRouter.DefaultRoute; + + // for Link + function createElement( + type: ReactRouter.LinkClass, + props: ReactRouter.LinkProp, + ...children: __React.ReactNode[]): ReactRouter.Link; + + // for NotFoundRoute + function createElement( + type: ReactRouter.NotFoundRouteClass, + props: ReactRouter.NotFoundRouteProp, + ...children: __React.ReactNode[]): ReactRouter.NotFoundRoute; + + // for Redirect + function createElement( + type: ReactRouter.RedirectClass, + props: ReactRouter.RedirectProp, + ...children: __React.ReactNode[]): ReactRouter.Redirect; + + // for Route + function createElement( + type: ReactRouter.RouteClass, + props: ReactRouter.RouteProp, + ...children: __React.ReactNode[]): ReactRouter.Route; + + // for RouteHandler + function createElement( + type: ReactRouter.RouteHandlerClass, + props: ReactRouter.RouteHandlerProp, + ...children: __React.ReactNode[]): ReactRouter.RouteHandler; +} diff --git a/react-router/react-router-tests.tsx b/react-router/react-router-tests.tsx new file mode 100644 index 000000000..4c2abc7ef --- /dev/null +++ b/react-router/react-router-tests.tsx @@ -0,0 +1,67 @@ + +/// +/// +/// + + +import * as React from "react"; + +import { Router, Route, IndexRoute, Link } from "react-router"; + +import createHistory from "history/lib/createBrowserHistory" + + +class Master extends React.Component, {}> { + + render() { + return
+

Master

+ Dashboard Users +

{this.props.children}

+
+ } + +} + + +class Dashboard extends React.Component<{}, {}> { + + render() { + return
+ This is a dashboard +
+ } + +} + +class NotFound extends React.Component<{}, {}> { + + render() { + return
+ This path does not exists +
+ } + +} + + +class Users extends React.Component<{}, {}> { + + render() { + return
+ This is a user list +
+ } + +} + + +React.render(( + + + + + + + +), document.body) diff --git a/react-router/react-router-tests.tsx.tscparams b/react-router/react-router-tests.tsx.tscparams new file mode 100644 index 000000000..f47983778 --- /dev/null +++ b/react-router/react-router-tests.tsx.tscparams @@ -0,0 +1 @@ +--noImplicitAny -jsx react --target es5 \ No newline at end of file diff --git a/react-router/react-router.d.ts b/react-router/react-router.d.ts index c96fe284d..2a6445a3f 100644 --- a/react-router/react-router.d.ts +++ b/react-router/react-router.d.ts @@ -26,16 +26,16 @@ declare namespace ReactRouter { type RedirectFunction = (state: H.LocationState, pathname: H.Pathname | H.Path, query?: H.Query) => void - interface RouteComponentProps { + interface RouteComponentProps { history?: History location?: Location - params?: Params + params?: P route?: PlainRoute - routeParams?: Params + routeParams?: R routes?: PlainRoute[] } - type RouteComponent = React.ComponentClass + type RouteComponent = React.ComponentClass type RouteConfig = RouteObject[] From f0d5440f90b1c40292a1c345d75bdc8656cded18 Mon Sep 17 00:00:00 2001 From: Sergey Buturlakin Date: Thu, 1 Oct 2015 11:03:39 +0300 Subject: [PATCH 005/389] Micro update of createRoutes export --- react-router/react-router.d.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/react-router/react-router.d.ts b/react-router/react-router.d.ts index 2a6445a3f..386997876 100644 --- a/react-router/react-router.d.ts +++ b/react-router/react-router.d.ts @@ -280,9 +280,7 @@ declare module "react-router/lib/RouteUtils" { export function createRoutesFromReactChildren(children: E | E[], parentRoute: ReactRouter.PlainRoute): ReactRouter.PlainRoute[] - import createRoutes = ReactRouter.createRoutes - - export { createRoutes } + export import createRoutes = ReactRouter.createRoutes } From 0d64ea1b82ad1d804892ceec14d98a9be85f64fb Mon Sep 17 00:00:00 2001 From: Sergey Buturlakin Date: Thu, 1 Oct 2015 12:31:03 +0300 Subject: [PATCH 006/389] History enhancers definitions improved using union types --- react-router/history.d.ts | 42 ++++++++++++++++++------------ react-router/react-router.d.ts | 47 +++++++++++++++++++--------------- 2 files changed, 52 insertions(+), 37 deletions(-) diff --git a/react-router/history.d.ts b/react-router/history.d.ts index c982bd229..2d88184e6 100644 --- a/react-router/history.d.ts +++ b/react-router/history.d.ts @@ -12,12 +12,13 @@ declare namespace HistoryModule { type BeforeUnloadHook = () => string - type CreateHistory = (options?: HistoryOptions) => History + type CreateHistory = (options?: HistoryOptions) => T - type CreateHistoryEnhancer = (createHistory: CreateHistory) => CreateHistory + type CreateHistoryEnhancer = (createHistory: CreateHistory) => CreateHistory - interface HistoryBase { + interface History { listenBefore(hook: TransitionHook): Function + listen(listener: LocationListener): Function transitionTo(location: Location): void pushState(state: LocationState, path: Path): void replaceState(state: LocationState, path: Path): void @@ -30,10 +31,6 @@ declare namespace HistoryModule { createHref(path: Path): Href } - interface History { - listen(listener: LocationListener): Function - } - type HistoryOptions = Object type Href = string @@ -63,17 +60,30 @@ declare namespace HistoryModule { type TransitionHook = (location: Location, callback: Function) => any + + interface HistoryBeforeUnload { + listenBeforeUnload(hook: () => string | boolean): Function + } + + interface HistoryQueries { + pushState(state: LocationState, pathname: Pathname | Path, query?: Query): void + replaceState(state: LocationState, pathname: Pathname | Path, query?: Query): void + createPath(path: Path, query?: Query): Path + createHref(path: Path, query?: Query): Href + } + + // Global usage, without modules, needs the small trick, because lib.d.ts // already has `history` and `History` global definitions: // var createHistory = ((window as any).History as HistoryModule.Module).createHistory; interface Module { - createHistory: CreateHistory - createHashHistory: CreateHistory - createMemoryHistory: CreateHistory + createHistory: CreateHistory + createHashHistory: CreateHistory + createMemoryHistory: CreateHistory createLocation(): Location - useBasename(enhancer: CreateHistoryEnhancer): CreateHistory - useBeforeUnload(enhancer: CreateHistoryEnhancer): CreateHistory - useQueries(enhancer: CreateHistoryEnhancer): CreateHistory + useBasename(createHistory: CreateHistory): CreateHistory + useBeforeUnload(createHistory: CreateHistory): CreateHistory + useQueries(createHistory: CreateHistory): CreateHistory actions: { PUSH: string REPLACE: string @@ -114,21 +124,21 @@ declare module "history/lib/createLocation" { declare module "history/lib/useBasename" { - export default function useBasename(enhancer: HistoryModule.CreateHistoryEnhancer): HistoryModule.CreateHistory + export default function useBasename(createHistory: HistoryModule.CreateHistory): HistoryModule.CreateHistory } declare module "history/lib/useBeforeUnload" { - export default function useBeforeUnload(enhancer: HistoryModule.CreateHistoryEnhancer): HistoryModule.CreateHistory + export default function useBeforeUnload(createHistory: HistoryModule.CreateHistory): HistoryModule.CreateHistory } declare module "history/lib/useQueries" { - export default function useQueries(enhancer: HistoryModule.CreateHistoryEnhancer): HistoryModule.CreateHistory + export default function useQueries(createHistory: HistoryModule.CreateHistory): HistoryModule.CreateHistory } diff --git a/react-router/react-router.d.ts b/react-router/react-router.d.ts index 386997876..083495404 100644 --- a/react-router/react-router.d.ts +++ b/react-router/react-router.d.ts @@ -16,6 +16,8 @@ declare namespace ReactRouter { type Component = React.ReactType + type Components = { [key: string]: Component } + type EnterHook = (nextState: RouterState, replaceState: RedirectFunction, callback?: Function) => any type LeaveHook = () => any @@ -47,24 +49,6 @@ declare namespace ReactRouter { type StringifyQuery = (queryObject: H.Query) => H.QueryString - - interface History extends H.HistoryBase { - pushState(state: H.LocationState, pathname: H.Pathname | H.Path, query?: H.Query): void - replaceState(state: H.LocationState, pathname: H.Pathname | H.Path, query?: H.Query): void - createPath(path: H.Path, query?: H.Query): H.Path - createHref(path: H.Path, query?: H.Query): H.Href - isActive(pathname: H.Pathname, query: H.Query): boolean - registerRouteHook(route: PlainRoute, hook: H.LocationListener): void - unregisterRouteHook(route: PlainRoute, hook: H.LocationListener): void - listen(listener: RouterListener): Function - match(location: H.Location, callback: (error: any, nextState: RouterState, nextLocation: H.Location) => void): void - routes: PlainRoute[] - parseQueryString?: ParseQueryString - stringifyQuery?: StringifyQuery - } - - type RouterListener = (error: Error, nextState: RouterState) => void - interface RouterState { location: Location routes: RouteConfig @@ -72,12 +56,18 @@ declare namespace ReactRouter { components: Component[] } - type RouteType = Route | IndexRoute | PlainRoute | Redirect type RouteTypes = RouteType | RouteType[] - type Components = { [key: string]: Component } + + interface HistoryBase extends H.History { + routes: PlainRoute[] + parseQueryString?: ParseQueryString + stringifyQuery?: StringifyQuery + } + + type History = HistoryBase & H.HistoryQueries & HistoryRoutes interface RouterProps { @@ -179,10 +169,22 @@ declare namespace ReactRouter { const History: React.Mixin - function useRoutes(enhancer: H.CreateHistoryEnhancer): H.CreateHistory + type RouterListener = (error: Error, nextState: RouterState) => void + + interface HistoryRoutes { + isActive(pathname: H.Pathname, query: H.Query): boolean + registerRouteHook(route: PlainRoute, hook: H.LocationListener): void + unregisterRouteHook(route: PlainRoute, hook: H.LocationListener): void + listen(listener: RouterListener): Function + match(location: H.Location, callback: (error: any, nextState: RouterState, nextLocation: H.Location) => void): void + } + + function useRoutes(createHistory: HistoryModule.CreateHistory): HistoryModule.CreateHistory + function createRoutes(routes: RouteTypes): PlainRoute[] + interface MatchArgs { routes?: RouteTypes history?: H.History @@ -345,6 +347,8 @@ declare module "react-router" { import RouteContext from "react-router/lib/RouteContext" + import useRoutes from "react-router/lib/useRoutes" + import { createRoutes } from "react-router/lib/RouteUtils" import RoutingContext from "react-router/lib/RoutingContext" @@ -362,6 +366,7 @@ declare module "react-router" { History, Lifecycle, RouteContext, + useRoutes, createRoutes, RoutingContext, PropTypes, From 158f0715ab75c32dcef74c361b64d79a1fa305b9 Mon Sep 17 00:00:00 2001 From: Tadeusz Hucal Date: Sat, 3 Oct 2015 18:58:28 +0200 Subject: [PATCH 007/389] Restangular: restore synchronization with Angular's request configuration --- restangular/restangular.d.ts | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/restangular/restangular.d.ts b/restangular/restangular.d.ts index b09e4affd..b407cefd4 100644 --- a/restangular/restangular.d.ts +++ b/restangular/restangular.d.ts @@ -29,17 +29,6 @@ declare module restangular { $object: T[]; } - interface IRequestConfig { - params?: any; - headers?: any; - cache?: any; - withCredentials?: boolean; - data?: any; - transformRequest?: any; - transformResponse?: any; - timeout?: any; // number | promise - } - interface IResponse { status: number; data: any; @@ -65,8 +54,8 @@ declare module restangular { addResponseInterceptor(responseInterceptor: (data: any, operation: string, what: string, url: string, response: IResponse, deferred: ng.IDeferred) => any): void; setRequestInterceptor(requestInterceptor: (element: any, operation: string, what: string, url: string) => any): void; addRequestInterceptor(requestInterceptor: (element: any, operation: string, what: string, url: string) => any): void; - setFullRequestInterceptor(fullRequestInterceptor: (element: any, operation: string, what: string, url: string, headers: any, params: any, httpConfig: IRequestConfig) => {element: any; headers: any; params: any}): void; - addFullRequestInterceptor(requestInterceptor: (element: any, operation: string, what: string, url: string, headers: any, params: any, httpConfig: IRequestConfig) => {headers: any; params: any; element: any; httpConfig: IRequestConfig}): void; + setFullRequestInterceptor(fullRequestInterceptor: (element: any, operation: string, what: string, url: string, headers: any, params: any, httpConfig: ng.IRequestShortcutConfig) => {element: any; headers: any; params: any}): void; + addFullRequestInterceptor(requestInterceptor: (element: any, operation: string, what: string, url: string, headers: any, params: any, httpConfig: ng.IRequestShortcutConfig) => {headers: any; params: any; element: any; httpConfig: ng.IRequestShortcutConfig}): void; setErrorInterceptor(errorInterceptor: (response: IResponse, deferred: ng.IDeferred) => any): void; setRestangularFields(fields: {[fieldName: string]: string}): void; setMethodOverriders(overriders: string[]): void; @@ -124,7 +113,7 @@ declare module restangular { clone(): IElement; plain(): any; plain(): T; - withHttpConfig(httpConfig: IRequestConfig): IElement; + withHttpConfig(httpConfig: ng.IRequestShortcutConfig): IElement; save(queryParams?: any, headers?: any): IPromise; getRestangularUrl(): string; } @@ -139,7 +128,7 @@ declare module restangular { options(queryParams?: any, headers?: any): IPromise; patch(queryParams?: any, headers?: any): IPromise; putElement(idx: any, params: any, headers: any): IPromise; - withHttpConfig(httpConfig: IRequestConfig): ICollection; + withHttpConfig(httpConfig: ng.IRequestShortcutConfig): ICollection; clone(): ICollection; plain(): any; plain(): T[]; From 1c1d000362c240f6a6f9318e6325de9fbfce052c Mon Sep 17 00:00:00 2001 From: Per Kastman Date: Sun, 4 Oct 2015 15:20:31 +0200 Subject: [PATCH 008/389] Added typings for jquery cropbox plugin --- jquery.cropbox/jquery.cropbox.d.ts | 115 +++++++++++++++++++++++++ jquery.cropbox/jquery.cropbox.tests.ts | 39 +++++++++ 2 files changed, 154 insertions(+) create mode 100644 jquery.cropbox/jquery.cropbox.d.ts create mode 100644 jquery.cropbox/jquery.cropbox.tests.ts diff --git a/jquery.cropbox/jquery.cropbox.d.ts b/jquery.cropbox/jquery.cropbox.d.ts new file mode 100644 index 000000000..70e09a46a --- /dev/null +++ b/jquery.cropbox/jquery.cropbox.d.ts @@ -0,0 +1,115 @@ +// Type definitions for jQuery cropbox +// Project: https://github.com/acornejo/jquery-cropbox +// Definitions by: Per Kastman +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module jQueryCropBox { + + enum ShowControls { + never, + always, + hover, + auto + } + + interface CropboxArea { + cropX: number; + cropY: number; + cropW: number; + cropH: number; + } + + interface CropboxOptions { + /** + * Width in pixels of the cropping window + */ + width?: number; + /** + * Height in pixels of the cropping window + */ + height?: number; + /** + * Number of incremental zoom steps. With the default of 10, you have to click the zoom-in button 9 times to reach 100%. + */ + zoom?: number; + /** + * Maximum zoom value. With the default of 1.0 users can't zoom beyond the maximum image resolution. + */ + maxZoom?: number; + /** + * If not null, this is the entire html block that should appear on hover over the image for instructions and/or buttons (could include the zoom in/out buttons for example). If null, the default html block is used which has the text "Click to drag" and the zoom in/out buttons. Use false to disable controls. + */ + controls?: any; + /** + * Set the initial cropping area + */ + result?: CropboxArea; + /** + * This flag is used to determine when to display the controls. Never, always and hover do exactly what you would expect (never show them, always show them, show them on hover). The auto flag is the same as the hover flag, except that on mobile devices it always shows the controls (since there is no hover event). + */ + showControls?: ShowControls + } + + interface CropboxDragOptions { + startX: number, + startY: number, + dx: number, + dy: number + } + + interface CropboxSetCropOptions { + cropX: number, + cropY: number, + cropW: number, + cropH: number + } + + interface Cropbox { + /** + * Increase image zoom level by one step + */ + zoomIn(): void; + /** + * Decrease image zoom level by one step + */ + zoomOut(): void; + /** + * Set zoom leevl to a value between 0 and 1. Need to call update to reflect the changes. + */ + zoom(percent: number): void; + /** + * Simulate image dragging, starting from (startX,startY) and moving a delta of (dx,dy). Need to call update to reflect the changes. + */ + drag(options: CropboxDragOptions): void; + /** + * Set crop window. + */ + setCrop(options: CropboxSetCropOptions): void; + /** + * Update the cropped result (must call after zoom and drag). + */ + update(): void; + /** + * Generate a URL for the cropped image on the client (requires HTML5 compliant browser). + */ + getDataURL(): string; + /** + * Generate a Blob with the cropped image (requires HTML5 compliant browser). + */ + getBlob(): any; + /** + * Remove the cropbox functionality from the image. + */ + remove(): void; + } + +} +interface JQuery { + cropbox(params?: jQueryCropBox.CropboxOptions): jQueryCropBox.Cropbox +} + +interface JQueryStatic { + cropbox(params?: jQueryCropBox.CropboxOptions): jQueryCropBox.Cropbox +} diff --git a/jquery.cropbox/jquery.cropbox.tests.ts b/jquery.cropbox/jquery.cropbox.tests.ts new file mode 100644 index 000000000..cb8f0be5a --- /dev/null +++ b/jquery.cropbox/jquery.cropbox.tests.ts @@ -0,0 +1,39 @@ +/// +/// + +var cropboxWithDefaultSettings = $("#element").cropbox(); + +var cropboxOptions: jQueryCropBox.CropboxOptions = { + height: 500, + zoom: 5, + width: 0.5, +}; + +var cropboxWithOptions = $("#element").cropbox(cropboxOptions); + +cropboxWithOptions.zoomIn(); +cropboxWithOptions.zoomOut(); +cropboxWithOptions.zoom(50); + +var cropDragOption: jQueryCropBox.CropboxDragOptions = { + startX: 10, + startY: 0, + dx: 100, + dy: 100 +}; + +cropboxWithOptions.drag(cropDragOption); + +var cropboxSetCropOption: jQueryCropBox.CropboxSetCropOptions = { + cropX: 10, + cropY: 10, + cropW: 50, + cropH: 50 +}; + +cropboxWithOptions.setCrop(cropboxSetCropOption); + +cropboxWithOptions.update(); +cropboxWithOptions.getDataURL(); +cropboxWithOptions.getBlob(); +cropboxWithOptions.remove(); From 10c7ec397f4617dfb0fc7274fa9a8c054ff362b2 Mon Sep 17 00:00:00 2001 From: Per Kastman Date: Sun, 4 Oct 2015 15:25:44 +0200 Subject: [PATCH 009/389] Cleanup --- jquery.cropbox/jquery.cropbox.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.cropbox/jquery.cropbox.d.ts b/jquery.cropbox/jquery.cropbox.d.ts index 70e09a46a..82b550bf3 100644 --- a/jquery.cropbox/jquery.cropbox.d.ts +++ b/jquery.cropbox/jquery.cropbox.d.ts @@ -104,8 +104,8 @@ declare module jQueryCropBox { */ remove(): void; } - } + interface JQuery { cropbox(params?: jQueryCropBox.CropboxOptions): jQueryCropBox.Cropbox } From b9a7194092297ca857f96d971e290612bc2618d7 Mon Sep 17 00:00:00 2001 From: Per Kastman Date: Tue, 6 Oct 2015 18:56:29 +0200 Subject: [PATCH 010/389] Renamed according to naming convention --- .../jquery.cropbox.d.ts => jquery-cropbox/jquery-cropbox.d.ts | 4 ++-- .../jquery-cropbox.tests.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename jquery.cropbox/jquery.cropbox.d.ts => jquery-cropbox/jquery-cropbox.d.ts (96%) rename jquery.cropbox/jquery.cropbox.tests.ts => jquery-cropbox/jquery-cropbox.tests.ts (94%) diff --git a/jquery.cropbox/jquery.cropbox.d.ts b/jquery-cropbox/jquery-cropbox.d.ts similarity index 96% rename from jquery.cropbox/jquery.cropbox.d.ts rename to jquery-cropbox/jquery-cropbox.d.ts index 82b550bf3..fba9846bb 100644 --- a/jquery.cropbox/jquery.cropbox.d.ts +++ b/jquery-cropbox/jquery-cropbox.d.ts @@ -107,9 +107,9 @@ declare module jQueryCropBox { } interface JQuery { - cropbox(params?: jQueryCropBox.CropboxOptions): jQueryCropBox.Cropbox + cropbox(params?: jQueryCropBox.CropboxOptions): JQuery } interface JQueryStatic { - cropbox(params?: jQueryCropBox.CropboxOptions): jQueryCropBox.Cropbox + cropbox(params?: jQueryCropBox.CropboxOptions): JQueryStatic } diff --git a/jquery.cropbox/jquery.cropbox.tests.ts b/jquery-cropbox/jquery-cropbox.tests.ts similarity index 94% rename from jquery.cropbox/jquery.cropbox.tests.ts rename to jquery-cropbox/jquery-cropbox.tests.ts index cb8f0be5a..e8db3847c 100644 --- a/jquery.cropbox/jquery.cropbox.tests.ts +++ b/jquery-cropbox/jquery-cropbox.tests.ts @@ -1,5 +1,5 @@ /// -/// +/// var cropboxWithDefaultSettings = $("#element").cropbox(); From 68d3c81d8d635bd03136a19fd2d40d3dc500c7b9 Mon Sep 17 00:00:00 2001 From: Per Kastman Date: Tue, 6 Oct 2015 19:16:44 +0200 Subject: [PATCH 011/389] Fixed incorrect return type --- jquery-cropbox/jquery-cropbox.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jquery-cropbox/jquery-cropbox.d.ts b/jquery-cropbox/jquery-cropbox.d.ts index fba9846bb..82b550bf3 100644 --- a/jquery-cropbox/jquery-cropbox.d.ts +++ b/jquery-cropbox/jquery-cropbox.d.ts @@ -107,9 +107,9 @@ declare module jQueryCropBox { } interface JQuery { - cropbox(params?: jQueryCropBox.CropboxOptions): JQuery + cropbox(params?: jQueryCropBox.CropboxOptions): jQueryCropBox.Cropbox } interface JQueryStatic { - cropbox(params?: jQueryCropBox.CropboxOptions): JQueryStatic + cropbox(params?: jQueryCropBox.CropboxOptions): jQueryCropBox.Cropbox } From 1e9273d62eb6e2c2de01116c6446f006b47916b7 Mon Sep 17 00:00:00 2001 From: Per Kastman Date: Tue, 6 Oct 2015 19:29:47 +0200 Subject: [PATCH 012/389] Updated according to naming convention --- .../{jquery-cropbox.tests.ts => jquery-cropbox-tests.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename jquery-cropbox/{jquery-cropbox.tests.ts => jquery-cropbox-tests.ts} (100%) diff --git a/jquery-cropbox/jquery-cropbox.tests.ts b/jquery-cropbox/jquery-cropbox-tests.ts similarity index 100% rename from jquery-cropbox/jquery-cropbox.tests.ts rename to jquery-cropbox/jquery-cropbox-tests.ts From da4f02bd35aaac24b62debfac86e054520191af4 Mon Sep 17 00:00:00 2001 From: Luigi Trabacchin Date: Wed, 14 Oct 2015 14:42:17 +0200 Subject: [PATCH 013/389] Typeahead: added missing options, and missing parameters, normalized some comments and code style --- typeahead/typeahead-tests.ts | 64 +++-- typeahead/typeahead.d.ts | 507 +++++++++++++++++------------------ 2 files changed, 281 insertions(+), 290 deletions(-) diff --git a/typeahead/typeahead-tests.ts b/typeahead/typeahead-tests.ts index 2bcb016c0..3864865c9 100644 --- a/typeahead/typeahead-tests.ts +++ b/typeahead/typeahead-tests.ts @@ -6,14 +6,10 @@ // var substringMatcher = function (strs: any) { - return function findMatches(q: any, cb: any) { - var matches: any, substrRegex: any; - - // an array that will be populated with substring matches - matches = []; - + return function findMatches(q: string, syncResults: (x: any) => void) { + var matches: Array<{ value: string }> = []; // regex used to determine if a string contains the substring `q` - substrRegex = new RegExp(q, 'i'); + var substrRegex = new RegExp(q, 'i'); // iterate through the pool of strings and for any string that // contains the substring `q`, add it to the `matches` array @@ -25,7 +21,7 @@ var substringMatcher = function (strs: any) { } }); - cb(matches); + syncResults(matches); } } @@ -46,14 +42,14 @@ function test_method_names() { $('#the-basics .typeahead').typeahead('open'); $('#the-basics .typeahead').typeahead('close'); $('#the-basics .typeahead').typeahead('val'); - $('#the-basics .typeahead').typeahead('val', 'test value'); + $('#the-basics .typeahead').typeahead('val', 'test value'); } function test_options() { var dataSets: Twitter.Typeahead.Dataset[] = []; - + function with_empty_options() { $('#the-basics .typeahead').typeahead({}, dataSets); } @@ -72,10 +68,10 @@ function test_options() { function with_all_options() { $('#the-basics .typeahead').typeahead({ - hint: true, - highlight: true, - minLength: 1 - }, + hint: true, + highlight: true, + minLength: 1 + }, dataSets ); } @@ -101,33 +97,33 @@ function test_datasets_array() { function with_displayKey_option() { $('#the-basics .typeahead').typeahead(options, [{ - displayKey: 'value', - source: substringMatcher(states) - }] + displayKey: 'value', + source: substringMatcher(states) + }] ); } function with_templates_option() { $('#the-basics .typeahead').typeahead(options, [{ - templates: {}, - source: substringMatcher(states) - }] + templates: {}, + source: substringMatcher(states) + }] ); } function with_all_options() { $('#the-basics .typeahead').typeahead(options, [{ - name: 'states', - displayKey: 'value', - templates: {}, - source: substringMatcher(states) - }] + name: 'states', + displayKey: 'value', + templates: {}, + source: substringMatcher(states) + }] ); } function with_multiple_datasets() { $('#the-basics .typeahead').typeahead(options, [ - { + { name: 'states', displayKey: 'value', templates: {}, @@ -192,7 +188,7 @@ function test_datasets_objects() { } function with_multiple_objects() { - $('#the-basics .typeahead').typeahead(options, + $('#the-basics .typeahead').typeahead(options, { name: 'states', displayKey: 'value', @@ -231,7 +227,7 @@ function test_dataset_templates() { $('#the-basics .typeahead').typeahead(options, { source: substringMatcher(states), templates: { - empty: function(context: any) { + empty: function (context: any) { return context.name; } } @@ -249,7 +245,7 @@ function test_dataset_templates() { $('#the-basics .typeahead').typeahead(options, { source: substringMatcher(states), templates: { - footer: function(context: any) { + footer: function (context: any) { return context.name; } } @@ -267,7 +263,7 @@ function test_dataset_templates() { $('#the-basics .typeahead').typeahead(options, { source: substringMatcher(states), templates: { - header: function(context: any) { + header: function (context: any) { return context.name; } } @@ -277,8 +273,8 @@ function test_dataset_templates() { function with_suggestion_option() { $('#the-basics .typeahead').typeahead(options, { source: substringMatcher(states), - templates: { - suggestion: function(context) { + templates: { + suggestion: function (context) { return context.name; } } @@ -289,10 +285,10 @@ function test_dataset_templates() { $('#the-basics .typeahead').typeahead(options, { source: substringMatcher(states), templates: { - empty: 'no results', + empty: 'no results', footer: 'custom footer', header: 'custom header', - suggestion: function(context) { + suggestion: function (context) { return context.name; } } diff --git a/typeahead/typeahead.d.ts b/typeahead/typeahead.d.ts index a8b139937..cde3a9277 100644 --- a/typeahead/typeahead.d.ts +++ b/typeahead/typeahead.d.ts @@ -10,19 +10,19 @@ interface JQuery { /** * Destroys previously initialized typeaheads. This entails reverting * DOM modifications and removing event handlers. - * - * @constructor + * + * @constructor * @param methodName Method 'destroy' - */ + */ typeahead(methodName: 'destroy'): JQuery; /** * Opens the dropdown menu of typeahead. Note that being open does not mean that the menu is visible. * The menu is only visible when it is open and has content. - * - * @constructor + * + * @constructor * @param methodName Method 'open' - */ + */ typeahead(methodName: 'open'): JQuery; /** @@ -36,10 +36,10 @@ interface JQuery { /** * Returns the current value of the typeahead. * The value is the text the user has entered into the input element. - * - * @constructor + * + * @constructor * @param methodName Method 'val' - */ + */ typeahead(methodName: 'val'): string; /** @@ -87,7 +87,7 @@ interface JQuery { * @param options ('hint' or 'highlight' or 'minLength' all of which are optional) * @param datasets One or more datasets passed in as arguments. */ - typeahead(options: Twitter.Typeahead.Options, ... datasets: Twitter.Typeahead.Dataset[]): JQuery; + typeahead(options: Twitter.Typeahead.Options, ...datasets: Twitter.Typeahead.Dataset[]): JQuery; } declare module Twitter.Typeahead { @@ -104,8 +104,8 @@ declare module Twitter.Typeahead { * It is expected that the function will compute the suggestion set (i.e. an array of JavaScript objects) for query and then invoke cb with said set. * cb can be invoked synchronously or asynchronously. * - */ - source: (query: string, cb: (result: any) => void) => void; + */ + source: ((query: string, syncResults: (result: any) => void, asyncResults?: (result: any) => void) => void); /** * The name of the dataset. @@ -125,32 +125,33 @@ declare module Twitter.Typeahead { /** * A hash of templates to be used when rendering the dataset. * Note a precompiled template is a function that takes a JavaScript object as its first argument and returns a HTML string. - */ + */ templates?: Templates; + async?: boolean; + display?: boolean | ((x: any) => boolean); } interface Templates { - /** * Rendered when 0 suggestions are available for the given query. * Can be either a HTML string or a precompiled template. * If it's a precompiled template, the passed in context will contain query - */ + */ empty?: any; /** * Rendered at the bottom of the dataset. * Can be either a HTML string or a precompiled template. * If it's a precompiled template, the passed in context will contain query and isEmpty. - */ + */ footer?: any; /** * Rendered at the top of the dataset. * Can be either a HTML string or a precompiled template. * If it's a precompiled template, the passed in context will contain query and isEmpty. - */ + */ header?: any; /** @@ -158,273 +159,267 @@ declare module Twitter.Typeahead { * If set, this has to be a precompiled template. * The associated suggestion object will serve as the context. * Defaults to the value of displayKey wrapped in a p tag i.e.

{{value}}

. - */ + */ suggestion?: (datum: any) => string; } - /** - * When initializing a typeahead, there are a number of options you can configure. - */ + /** + * When initializing a typeahead, there are a number of options you can configure. + */ interface Options { - /** - * highlight: If true, when suggestions are rendered, - * pattern matches for the current query in text nodes will be wrapped in a strong element. - * Defaults to false. - */ - highlight?: boolean; + /** + * highlight: If true, when suggestions are rendered, + * pattern matches for the current query in text nodes will be wrapped in a strong element. + * Defaults to false. + */ + highlight?: boolean; - /** - * If false, the typeahead will not show a hint. Defaults to true. - */ - hint?: boolean; + /** + * If false, the typeahead will not show a hint. Defaults to true. + */ + hint?: boolean; - /** - * The minimum character length needed before suggestions start getting rendered. Defaults to 1. - */ - minLength?: number; + /** + * The minimum character length needed before suggestions start getting rendered. Defaults to 1. + */ + minLength?: number; } } -declare module Bloodhound -{ - interface BloodhoundOptions - { - /** - * Transforms a datum into an array of string tokens - * - * @constructor - * @param datum individual units that compose the dataset - */ - datumTokenizer?: any; - /** - * Transforms a query into an array of string tokens - * - * @constructor - * @param query tokenizer query - */ - queryTokenizer?: any; - /** - * The max number of suggestions to return from Bloodhound#get. - * If not reached, the data source will attempt to backfill the suggestions from remote. Defaults to 5 - */ - limit?: number; - /** - * If set, this is expected to be a function with the signature (remoteMatch, localMatch) that returns true if the datums are duplicates or false otherwise. - * If not set, duplicate detection will not be performed. - */ - dupDetector?: (remoteMatch: T, localMatch: T) => boolean; - /** - * A compare function used to sort matched datums for a given query. - */ - sorter?: (a: T, b: T) => number; - /** - *An array of datums or a function that returns an array of datums. - */ - local?: () => T[]; - /** - * Can be a URL to a JSON file containing an array of datums or, if more configurability is needed, a prefetch options hash. - */ - prefetch?: PrefetchOptions; - /** - * Can be a URL to fetch suggestions from when the data provided by local and prefetch is insufficient or, if more configurability is needed, a remote options hash. - */ - remote?: RemoteOptions; - } - - /** - * Prefetched data is fetched and processed on initialization. - * If the browser supports localStorage, the processed data will be cached - * there to prevent additional network requests on subsequent page loads. - */ - interface PrefetchOptions - { - /** - * A URL to a JSON file containing an array of datums. Required. - */ - url: string; - /** - * The time (in milliseconds) the prefetched data should be cached - * in localStorage. Defaults to 86400000 (1 day). - */ - ttl?: number; - /** - * A function that transforms the response body into an array of datums. - * - * @param parsedResponse Response body - */ - filter?: (parsedResponse: any) => T[]; - /** The key that data will be stored in local storage under. Defaults to value of url. - * - */ - cacheKey?: string; - /** - * A string used for thumbprinting prefetched data. If this doesn't match what's stored in local storage, the data will be refetched. - */ - thumbprint?: string; - /** - * The ajax settings object passed to jQuery.ajax. - */ - ajax?: JQueryAjaxSettings; - } - - /** - * Remote data is only used when the data provided by local and prefetch - * is insufficient. In order to prevent an obscene number of requests - * being made to remote endpoint, typeahead.js rate-limits remote requests. - */ - interface RemoteOptions - { - /** - * A URL to make requests to when the data provided by local and - * prefetch is insufficient. Required. - */ - url: string; - /** - * The pattern in url that will be replaced with the user's query - * when a request is made. Defaults to %QUERY. - */ - wildcard?: string; - /** - * Overrides the request URL. If set, no wildcard substitution will - * be performed on url. - * - * @param url Replacement URL - * @param uriEncodedQuery Encoded query - * @returns A valid URL - */ - replace?: (url: string, uriEncodedQuery: string) => string; - /** - * The function used for rate-limiting network requests. - * Can be either 'debounce' or 'throttle'. Defaults to 'debounce'. - */ - rateLimitby?: string; - /** - * The time interval in milliseconds that will be used by rateLimitFn. - * Defaults to 300. - */ - rateLimitWait?: number; +declare module Bloodhound { + interface BloodhoundOptions { + /** + * Transforms a datum into an array of string tokens + * + * @constructor + * @param datum individual units that compose the dataset + */ + datumTokenizer?: any; + /** + * Transforms a query into an array of string tokens + * + * @constructor + * @param query tokenizer query + */ + queryTokenizer?: any; + /** + * The max number of suggestions to return from Bloodhound#get. + * If not reached, the data source will attempt to backfill the suggestions from remote. Defaults to 5 + */ + limit?: number; + /** + * If set, this is expected to be a function with the signature (remoteMatch, localMatch) that returns true if the datums are duplicates or false otherwise. + * If not set, duplicate detection will not be performed. + */ + dupDetector?: (remoteMatch: T, localMatch: T) => boolean; + /** + * A compare function used to sort matched datums for a given query. + */ + sorter?: (a: T, b: T) => number; + /** + * An array of datums or a function that returns an array of datums. + */ + local?: () => T[]; + /** + * Can be a URL to a JSON file containing an array of datums or, if more configurability is needed, a prefetch options hash. + */ + prefetch?: PrefetchOptions; + /** + * Can be a URL to fetch suggestions from when the data provided by local and prefetch is insufficient or, if more configurability is needed, a remote options hash. + */ + remote?: RemoteOptions; + } /** - * Transforms the response body into an array of datums. - * - * @param parsedResponse Response body + * Prefetched data is fetched and processed on initialization. + * If the browser supports localStorage, the processed data will be cached + * there to prevent additional network requests on subsequent page loads. */ - filter?: (parsedResponse: any) => T[]; + interface PrefetchOptions { + /** + * A URL to a JSON file containing an array of datums. Required. + */ + url: string; + /** + * The time (in milliseconds) the prefetched data should be cached + * in localStorage. Defaults to 86400000 (1 day). + */ + ttl?: number; + /** + * A function that transforms the response body into an array of datums. + * + * @param parsedResponse Response body + */ + filter?: (parsedResponse: any) => T[]; + /** The key that data will be stored in local storage under. Defaults to value of url. + * + */ + cacheKey?: string; + /** + * A string used for thumbprinting prefetched data. If this doesn't match what's stored in local storage, the data will be refetched. + */ + thumbprint?: string; + /** + * The ajax settings object passed to jQuery.ajax. + */ + ajax?: JQueryAjaxSettings; + } + /** - * The ajax settings object passed to jQuery.ajax. + * Remote data is only used when the data provided by local and prefetch + * is insufficient. In order to prevent an obscene number of requests + * being made to remote endpoint, typeahead.js rate-limits remote requests. */ - ajax?: JQueryAjaxSettings; + interface RemoteOptions { + /** + * A URL to make requests to when the data provided by local and + * prefetch is insufficient. Required. + */ + url: string; + /** + * The pattern in url that will be replaced with the user's query + * when a request is made. Defaults to %QUERY. + */ + wildcard?: string; + /** + * Overrides the request URL. If set, no wildcard substitution will + * be performed on url. + * + * @param url Replacement URL + * @param uriEncodedQuery Encoded query + * @returns A valid URL + */ + replace?: (url: string, uriEncodedQuery: string) => string; + /** + * The function used for rate-limiting network requests. + * Can be either 'debounce' or 'throttle'. Defaults to 'debounce'. + */ + rateLimitby?: string; + /** + * The time interval in milliseconds that will be used by rateLimitFn. + * Defaults to 300. + */ + rateLimitWait?: number; + + /** + * Transforms the response body into an array of datums. + * + * @param parsedResponse Response body + */ + filter?: (parsedResponse: any) => T[]; + /** + * The ajax settings object passed to jQuery.ajax. + */ + ajax?: JQueryAjaxSettings; - /** - * A function that provides a hook to allow you to prepare the settings object passed to transport - * when a request is about to be made. The function signature should be prepare(query, settings), - * where query is the query #search was called with and settings is the default settings object - * created internally by the Bloodhound instance. The prepare function should return a settings object. - * [Note: Added in 0.11.1] - * - * @param query The query #search was called with. - * @param settings The default settings object created internally by Bloodhound. - * @returns A JqueryAjaxSettings object. - */ - prepare?: (query: string, settings: JQueryAjaxSettings) => JQueryAjaxSettings; - } + /** + * A function that provides a hook to allow you to prepare the settings object passed to transport + * when a request is about to be made. The function signature should be prepare(query, settings), + * where query is the query #search was called with and settings is the default settings object + * created internally by the Bloodhound instance. The prepare function should return a settings object. + * [Note: Added in 0.11.1] + * + * @param query The query #search was called with. + * @param settings The default settings object created internally by Bloodhound. + * @returns A JqueryAjaxSettings object. + */ + prepare?: (query: string, settings: JQueryAjaxSettings) => JQueryAjaxSettings; + } - /** - * The most common tokenization methods. - */ - interface Tokenizers - { /** - * Split a given string on whitespace characters. + * The most common tokenization methods. */ - whitespace(query: string): string[]; - /** - * Split a given string on non-word characters. - */ - nonword(query: string): string[]; + interface Tokenizers { + /** + * Split a given string on whitespace characters. + */ + whitespace(query: string): string[]; + /** + * Split a given string on non-word characters. + */ + nonword(query: string): string[]; - /** - * Instances of the most common tokenization methods. - */ - obj: ObjTokenizer; - } + /** + * Instances of the most common tokenization methods. + */ + obj: ObjTokenizer; + } - interface ObjTokenizer - { - /** - * Split a given string on whitespace characters. - */ - whitespace(query: string): string[]; - /** - * Split a given string on non-word characters. - */ - nonword(query: string): string[]; - } + interface ObjTokenizer { + /** + * Split a given string on whitespace characters. + */ + whitespace(query: string): string[]; + /** + * Split a given string on non-word characters. + */ + nonword(query: string): string[]; + } } declare class Bloodhound { - constructor(options: Bloodhound.BloodhoundOptions); - /** - * wraps the suggestion engine in an adapter that is compatible with the typeahead jQuery plugin - */ - public ttAdapter(): any; - /** - * Kicks off the initialization of the suggestion engine. This includes processing the data provided through local and fetching/processing the data provided through prefetch. - * Until initialized, all other methods will behave as no-ops. - * Returns a jQuery promise which is resolved when engine has been initialized. - * - * After the initial call of initialize, how subsequent invocations of the method behave depends on the reinitialize argument. - * If reinitialize is falsy, the method will not execute the initialization logic and will just return the same jQuery promise returned by the initial invocation. - * If reinitialize is truthy, the method will behave as if it were being called for the first time. - * - * var promise1 = engine.initialize(); - * var promise2 = engine.initialize(); - * var promise3 = engine.initialize(true); - * - * promise1 === promise2; - * promise3 !== promise1 && promise3 !== promise2; - */ - public initialize(reinitialize?: boolean): JQueryPromise; - /** - * Takes one argument, datums, which is expected to be an array of datums. - * The passed in datums will get added to the search index that powers the suggestion engine. - */ - public add(datums: T[]): void; - /** - * Removes all suggestions from the search index. - */ - public clear(): void; - /** - * If you're using prefetch, data gets cached in local storage in an effort to cut down on unnecessary network requests. - * clearPrefetchCache offers a way to programmatically clear said cache. - */ - public clearPrefetchCache(): void; - /** - * If you're using remote, Bloodhound will cache the 10 most recent responses in an effort to provide a better user experience. - * clearRemoteCache offers a way to programmatically clear said cache. - */ - public clearRemoteCache(): void; - /** - * Returns a reference to the Bloodhound constructor and reverts window.Bloodhound to its previous value. Can be used to avoid naming collisions. - */ - public noConflict(): any; + constructor(options: Bloodhound.BloodhoundOptions); + /** + * wraps the suggestion engine in an adapter that is compatible with the typeahead jQuery plugin + */ + public ttAdapter(): any; + /** + * Kicks off the initialization of the suggestion engine. This includes processing the data provided through local and fetching/processing the data provided through prefetch. + * Until initialized, all other methods will behave as no-ops. + * Returns a jQuery promise which is resolved when engine has been initialized. + * + * After the initial call of initialize, how subsequent invocations of the method behave depends on the reinitialize argument. + * If reinitialize is falsy, the method will not execute the initialization logic and will just return the same jQuery promise returned by the initial invocation. + * If reinitialize is truthy, the method will behave as if it were being called for the first time. + * + * var promise1 = engine.initialize(); + * var promise2 = engine.initialize(); + * var promise3 = engine.initialize(true); + * + * promise1 === promise2; + * promise3 !== promise1 && promise3 !== promise2; + */ + public initialize(reinitialize?: boolean): JQueryPromise; + /** + * Takes one argument, datums, which is expected to be an array of datums. + * The passed in datums will get added to the search index that powers the suggestion engine. + */ + public add(datums: T[]): void; + /** + * Removes all suggestions from the search index. + */ + public clear(): void; + /** + * If you're using prefetch, data gets cached in local storage in an effort to cut down on unnecessary network requests. + * clearPrefetchCache offers a way to programmatically clear said cache. + */ + public clearPrefetchCache(): void; + /** + * If you're using remote, Bloodhound will cache the 10 most recent responses in an effort to provide a better user experience. + * clearRemoteCache offers a way to programmatically clear said cache. + */ + public clearRemoteCache(): void; + /** + * Returns a reference to the Bloodhound constructor and reverts window.Bloodhound to its previous value. Can be used to avoid naming collisions. + */ + public noConflict(): any; - /** - * Computes a set of suggestions for query. cb will be invoked with an array of datums that represent said set. - * cb will always be invoked once synchronously with suggestions that were available on the client. - * If those suggestions are insufficient (# of suggestions is less than limit) and remote was configured, cb may also be invoked asynchronously with the suggestions available on the client mixed with suggestions from the remote source. - */ - public get(query: string, cb: (datums: T[]) => void): void; + /** + * Computes a set of suggestions for query. cb will be invoked with an array of datums that represent said set. + * cb will always be invoked once synchronously with suggestions that were available on the client. + * If those suggestions are insufficient (# of suggestions is less than limit) and remote was configured, cb may also be invoked asynchronously with the suggestions available on the client mixed with suggestions from the remote source. + */ + public get(query: string, cb: (datums: T[]) => void): void; - /** - * The Bloodhound suggestion engine is token-based, so how datums and queries are tokenized plays a vital role in the quality of search results. - * Specify how you want datums and queries tokenized. - */ - public static tokenizers: Bloodhound.Tokenizers; + /** + * The Bloodhound suggestion engine is token-based, so how datums and queries are tokenized plays a vital role in the quality of search results. + * Specify how you want datums and queries tokenized. + */ + public static tokenizers: Bloodhound.Tokenizers; } declare module "bloodhound" { - export = Bloodhound; + export = Bloodhound; } From 7d715446377a65c491337c88efec1116507c2436 Mon Sep 17 00:00:00 2001 From: Luigi Trabacchin Date: Wed, 14 Oct 2015 14:45:35 +0200 Subject: [PATCH 014/389] Bootstrap.v3.datetimepicker: referenced moment.js less generic type parameters, updated some functions, added some missing parameters --- .../bootstrap.v3.datetimepicker-tests.ts | 14 +++---- .../bootstrap.v3.datetimepicker.d.ts | 39 ++++++++++++------- 2 files changed, 32 insertions(+), 21 deletions(-) diff --git a/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker-tests.ts b/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker-tests.ts index 6abf38f94..056c76dd6 100644 --- a/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker-tests.ts +++ b/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker-tests.ts @@ -6,17 +6,17 @@ function test_cases() { $('#datetimepicker').datetimepicker({ pickDate: false }); - $('#datetimepicker').datetimepicker({ + $('#datetimepicker').datetimepicker({ pickTime: false }); - $('#datetimepicker').datetimepicker({ + $('#datetimepicker').datetimepicker({ minDate: '2012-12-31' }); - - $('#datetimepicker').data("DateTimePicker").setMaxDate('2012-12-31'); - - var startDate = new Date(2012, 1, 20); - var endDate = new Date(2012, 1, 25); + + $('#datetimepicker').data("DateTimePicker").setMaxDate('2012-12-31'); + + var startDate = moment(new Date(2012, 1, 20)); + var endDate = moment(new Date(2012, 1, 25)); $('#datetimepicker2') .datetimepicker() .on("dp.change", function (ev) { diff --git a/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker.d.ts b/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker.d.ts index 228b7537f..0db3f7b3f 100644 --- a/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker.d.ts +++ b/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker.d.ts @@ -10,15 +10,22 @@ */ /// +/// declare module BootstrapV3DatetimePicker { - interface DatetimepickerChangeEventObject extends JQueryEventObject { - date: any; - oldDate: any; + enum ViewMode { + 'days', + 'months', + 'years', + 'decades' + } + + interface DatetimepickerChangeEventObject extends DatetimepickerEventObject { + oldDate: moment.Moment; } interface DatetimepickerEventObject extends JQueryEventObject { - date: any; + date: moment.Moment; } interface DatetimepickerIcons { @@ -35,33 +42,37 @@ declare module BootstrapV3DatetimePicker { useSeconds?: boolean; useCurrent?: boolean; minuteStepping?: number; - minDate?: any; - maxDate?: any; + minDate?: moment.Moment | Date | string; + maxDate?: moment.Moment | Date | string; showToday?: boolean; collapse?: boolean; language?: string; - defaultDate?: string; - disabledDates?: Array; - enabledDates?: Array; + defaultDate?: moment.Moment | Date | string; + disabledDates?: Array; + enabledDates?: Array; icons?: DatetimepickerIcons; useStrict?: boolean; direction?: string; sideBySide?: boolean; - daysOfWeekDisabled?: Array; + daysOfWeekDisabled?: Array; calendarWeeks?: boolean; format?: string | boolean; locale?: string; showTodayButton?: boolean; + viewMode?: string; + inline?: boolean; } interface Datetimepicker { - setDate(date: any): void; - setMinDate(date: any): void; - setMaxDate(date: any): void; + date(date: moment.Moment | Date | string): void; + date(): moment.Moment; + minDate(date: moment.Moment | Date | string): void; + minDate(): moment.Moment | boolean; + maxDate(date: moment.Moment | Date | string): void; + maxDate(): moment.Moment | boolean; show(): void; disable(): void; enable(): void; - getDate(): void; } } From fd6b794520e5258ff59c7501d7d155fad3dad21a Mon Sep 17 00:00:00 2001 From: Luigi Trabacchin Date: Wed, 14 Oct 2015 14:49:50 +0200 Subject: [PATCH 015/389] FullCalendar: updated to last version, updated some interfaces names to fit documentation, less generic arguments and options, referenced moment.js --- fullCalendar/fullCalendar-tests.ts | 43 ++++----- fullCalendar/fullCalendar.d.ts | 146 +++++++++++++++++------------ 2 files changed, 107 insertions(+), 82 deletions(-) diff --git a/fullCalendar/fullCalendar-tests.ts b/fullCalendar/fullCalendar-tests.ts index 6890cbe42..b3ec7973c 100644 --- a/fullCalendar/fullCalendar-tests.ts +++ b/fullCalendar/fullCalendar-tests.ts @@ -4,11 +4,10 @@ // All examples from http://arshaw.com/fullcalendar/docs/ -$('#calendar').fullCalendar({ -}) +$('#calendar').fullCalendar({}); $('#calendar').fullCalendar({ - weekends: false + weekends: false }); $('#calendar').fullCalendar({ @@ -67,7 +66,7 @@ $('#calendar').fullCalendar({ $('#calendar').fullCalendar('option', 'aspectRatio', 1.8); $('#calendar').fullCalendar({ - viewRender: function(view) { + viewRender: function (view) { alert('The new title of the view is ' + view.title); } }); @@ -81,22 +80,19 @@ $('#calendar').fullCalendar({ $('#calendar').fullCalendar('render'); $('#calendar').fullCalendar({ - dragOpacity: { - month: .2, - '': .5 - } + dragOpacity: .5 }); var view = $('#calendar').fullCalendar('getView'); alert("The view's title is " + view.title); $(document).ready(function () { - + var date = new Date(); var d = date.getDate(); var m = date.getMonth(); var y = date.getFullYear(); - + $('#calendar').fullCalendar({ header: { left: 'prev,next today', @@ -155,12 +151,12 @@ $(document).ready(function () { }); $(document).ready(function () { - + var date = new Date(); var d = date.getDate(); var m = date.getMonth(); var y = date.getFullYear(); - + $('#calendar').fullCalendar({ header: { left: 'prev,next today', @@ -220,12 +216,12 @@ $(document).ready(function () { }); $(document).ready(function () { - + var date = new Date(); var d = date.getDate(); var m = date.getMonth(); var y = date.getFullYear(); - + $('#calendar').fullCalendar({ header: { left: 'prev,next today', @@ -274,12 +270,12 @@ $(document).ready(function () { }); $(document).ready(function () { - + var date = new Date(); var d = date.getDate(); var m = date.getMonth(); var y = date.getFullYear(); - + $('#calendar').fullCalendar({ editable: true, header: { @@ -339,12 +335,12 @@ $(document).ready(function () { }); $(document).ready(function () { - + var date = new Date(); var d = date.getDate(); var m = date.getMonth(); var y = date.getFullYear(); - + $('#calendar').fullCalendar({ header: { left: 'prev,next today', @@ -715,12 +711,12 @@ $('#draggable1').draggable(); $('#draggable2').draggable(); $(document).ready(function () { - + var date = new Date(); var d = date.getDate(); var m = date.getMonth(); var y = date.getFullYear(); - + $('#calendar').fullCalendar({ theme: true, header: { @@ -799,11 +795,11 @@ $(document).ready(function () { revert: true, // will cause the event to go back to its revertDuration: 0 // original position after the drag }); - + }); /* initialize the calendar -----------------------------------------------------------------*/ - + $('#calendar').fullCalendar({ header: { left: 'prev,next today', @@ -833,9 +829,8 @@ $(document).ready(function () { // if so, remove the element from the "Draggable Events" list $(this).remove(); } - } }); }); -$('#calendar').fullCalendar('refetchEvents') \ No newline at end of file +$('#calendar').fullCalendar('refetchEvents'); diff --git a/fullCalendar/fullCalendar.d.ts b/fullCalendar/fullCalendar.d.ts index f73dc2d8b..7552d5bfd 100644 --- a/fullCalendar/fullCalendar.d.ts +++ b/fullCalendar/fullCalendar.d.ts @@ -4,6 +4,7 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped /// +/// declare module FullCalendar { export interface Calendar { @@ -34,7 +35,18 @@ declare module FullCalendar { version: string; } - export interface Options { + export interface BusinessHours { + start: moment.Duration; + end: moment.Duration; + dow: Array; + } + + export interface Timespan { + start: moment.Moment; + end: moment.Moment; + } + + export interface Options extends AgendaOptions, EventDraggingResizingOptions, DroppingExternalElementsOptions, SelectionOptions { // General display - http://arshaw.com/fullcalendar/docs/display/ @@ -55,14 +67,19 @@ declare module FullCalendar { weekMode?: string; weekNumbers?: boolean; weekNumberCalculation?: any; // String/Function + businessHours?: boolean | BusinessHours; height?: number; contentHeight?: number; aspectRatio?: number; handleWindowResize?: boolean; - viewRender?: (view: View, element: JQuery) => void; - viewDestroy?: (view: View, element: JQuery) => void; + viewRender?: (view: ViewObject, element: JQuery) => void; + viewDestroy?: (view: ViewObject, element: JQuery) => void; dayRender?: (date: Date, cell: HTMLTableDataCellElement) => void; - windowResize?: (view: View) => void; + windowResize?: (view: ViewObject) => void; + + // Timezone + timezone?: string | boolean; + now?: moment.Moment | Date | string | (() => moment.Moment) // Views - http://arshaw.com/fullcalendar/docs/views/ @@ -70,6 +87,7 @@ declare module FullCalendar { // Current Date - http://arshaw.com/fullcalendar/docs/current_date/ + defaultDate?: moment.Moment | Date | string; year?: number; month?: number; date?: number; @@ -79,6 +97,7 @@ declare module FullCalendar { timeFormat?: any; // String/ViewOptionHash columnFormat?: any; // String/ViewOptionHash titleFormat?: any; // String/ViewOptionHash + buttonText?: ButtonTextObject; monthNames?: Array; monthNamesShort?: Array; @@ -88,19 +107,10 @@ declare module FullCalendar { // Clicking & Hovering - http://arshaw.com/fullcalendar/docs/mouse/ - dayClick?: (date: Date, allDay: boolean, jsEvent: MouseEvent, view: View) => void; - eventClick?: (event: EventObject, jsEvent: MouseEvent, view: View) => any; // return type boolean or void - eventMouseover?: (event: EventObject, jsEvent: MouseEvent, view: View) => void; - eventMouseout?: (event: EventObject, jsEvent: MouseEvent, view: View) => void; - - // Selection - http://arshaw.com/fullcalendar/docs/selection/ - - selectable?: any; // Boolean/ViewOptionHash - selectHelper?: any; // Boolean/Function - unselectAuto?: boolean; - unselectCancel?: string; - select?: (startDate: Date | string, endDate: Date | string, allDay: boolean, jsEvent: MouseEvent, view: View) => void; - unselect?: (view: View, jsEvent: Event) => void; + dayClick?: (date: Date, allDay: boolean, jsEvent: MouseEvent, view: ViewObject) => void; + eventClick?: (event: EventObject, jsEvent: MouseEvent, view: ViewObject) => any; // return type boolean or void + eventMouseover?: (event: EventObject, jsEvent: MouseEvent, view: ViewObject) => void; + eventMouseout?: (event: EventObject, jsEvent: MouseEvent, view: ViewObject) => void; // Event Data - http://arshaw.com/fullcalendar/docs/event_data/ @@ -129,7 +139,7 @@ declare module FullCalendar { endParam?: string lazyFetching?: boolean; eventDataTransform?: (eventData: any) => EventObject; - loading?: (isLoading: boolean, view: View) => void; + loading?: (isLoading: boolean, view: ViewObject) => void; // Event Rendering - http://arshaw.com/fullcalendar/docs/event_rendering/ @@ -137,37 +147,12 @@ declare module FullCalendar { eventBackgroundColor?: string; eventBorderColor?: string; eventTextColor?: string; - eventRender?: (event: EventObject, element: HTMLDivElement, view: View) => void; - eventAfterRender?: (event: EventObject, element: HTMLDivElement, view: View) => void; - eventAfterAllRender?: (view: View) => void; - eventDestroy?: (event: EventObject, element: JQuery, view: View) => void; + eventRender?: (event: EventObject, element: HTMLDivElement, view: ViewObject) => void; + eventAfterRender?: (event: EventObject, element: HTMLDivElement, view: ViewObject) => void; + eventAfterAllRender?: (view: ViewObject) => void; + eventDestroy?: (event: EventObject, element: JQuery, view: ViewObject) => void; - // Event Dragging & Resizing - editable?: boolean; - eventStartEditable?: boolean; - eventDurationEditable?: boolean; - dragRevertDuration?: number; - dragOpacity?: any; // Float/ViewOptionHash - eventDragStart?: (event: EventObject, jsEvent: MouseEvent, ui: any, view: View) => void; - eventDragStop?: (event: EventObject, jsEvent: MouseEvent, ui: any, view: View) => void; - eventDrop?: (event: EventObject, dayDelta: number, minuteDelta: number, revertFunc: Function, jsEvent: Event, ui: any, view: View) => void; - eventResizeStart?: (event: EventObject, jsEvent: MouseEvent, ui: any, view: View) => void; - eventResizeStop?: (event: EventObject, jsEvent: MouseEvent, ui: any, view: View) => void; - eventResize?: (event: EventObject, dayDelta: number, minuteDelta: number, revertFunc: Function, jsEvent: Event, ui: any, view: View) => void; - - droppable?: boolean; - dropAccept?: any; // String/Function - drop?: (date: Date, allDay: boolean, jsEvent: MouseEvent, ui: any) => void; - } - - export interface View { - name: string; - title: string; - start: Date | string; - end: Date | string; - visStart: Date; - visEnd: Date; } export interface ViewOptionHash { @@ -189,16 +174,56 @@ declare module FullCalendar { export interface AgendaOptions { allDaySlot?: boolean; allDayText?: string; - axisFormat?: string; - slotMinutes?: number; - snapMinutes?: number; - defaultEventMinutes?: number; - firstHour?: number; - minTime?: any; // Integer/String - maxTime?: any; // Integer/String + slotDuration?: moment.Duration; + slotLabelFormat?: string; + slotLabelInterval?: moment.Duration; + snapDuration?: moment.Duration; + scrollTime?: moment.Duration; + minTime?: moment.Duration; // Integer/String + maxTime?: moment.Duration; // Integer/String slotEventOverlap?: boolean; } + /* + * Event Dragging & Resizing + */ + export interface EventDraggingResizingOptions { + editable?: boolean; + eventStartEditable?: boolean; + eventDurationEditable?: boolean; + dragRevertDuration?: number; // integer, milliseconds + dragOpacity?: number; // float + dragScroll?: boolean; + eventOverlap?: boolean | ((stillEvent: EventObject, movingEvent: EventObject) => boolean); + eventConstraint?: BusinessHours | Timespan; + eventDragStart?: (event: EventObject, jsEvent: MouseEvent, ui: any, view: ViewObject) => void; + eventDragStop?: (event: EventObject, jsEvent: MouseEvent, ui: any, view: ViewObject) => void; + eventDrop?: (event: EventObject, dayDelta: number, minuteDelta: number, revertFunc: Function, jsEvent: Event, ui: any, view: ViewObject) => void; + eventResizeStart?: (event: EventObject, jsEvent: MouseEvent, ui: any, view: ViewObject) => void; + eventResizeStop?: (event: EventObject, jsEvent: MouseEvent, ui: any, view: ViewObject) => void; + eventResize?: (event: EventObject, dayDelta: number, minuteDelta: number, revertFunc: Function, jsEvent: Event, ui: any, view: ViewObject) => void; + } + /* + * Selection - http://arshaw.com/fullcalendar/docs/selection/ + */ + export interface SelectionOptions { + selectable?: boolean; + selectHelper?: boolean | ((start: moment.Moment, end: moment.Moment) => HTMLElement); + unselectAuto?: boolean; + unselectCancel?: string; + selectOverlap?: boolean | ((event: EventObject) => boolean); + selectConstraint?: Timespan | BusinessHours; + select?: (start: moment.Moment, end: moment.Moment, jsEvent: MouseEvent, view: ViewObject, resource?: any) => void; + unselect?: (view: ViewObject, jsEvent: Event) => void; + } + + export interface DroppingExternalElementsOptions { + droppable?: boolean; + dropAccept?: string | ((draggable: any) => boolean); + drop?: (date: moment.Moment, jsEvent: MouseEvent, ui: any) => void; + eventReceive?: (event: EventObject) => void + } + export interface ButtonTextObject { prev?: string; next?: string; @@ -210,12 +235,10 @@ declare module FullCalendar { day?: string; } - export interface EventObject { + export interface EventObject extends Timespan { id?: any // String/number title: string; allDay?: boolean; - start: Date | string; - end?: Date | string; url?: string; className?: any; // string/Array editable?: boolean; @@ -226,6 +249,13 @@ declare module FullCalendar { textColor?: string; } + export interface ViewObject extends Timespan { + name: string; + title: string; + intervalStart: moment.Moment; + intervalEnd: moment.Moment; + } + export interface EventSource extends JQueryAjaxSettings { /** @@ -272,7 +302,7 @@ interface JQuery { /** * Returns the View Object for the current view. */ - fullCalendar(method: 'getView'): FullCalendar.View; + fullCalendar(method: 'getView'): FullCalendar.ViewObject; /** * Immediately switches to a different view. From 3eed85776e25068f0234c0827230d05d1bd412bc Mon Sep 17 00:00:00 2001 From: Luigi Trabacchin Date: Wed, 14 Oct 2015 14:59:22 +0200 Subject: [PATCH 016/389] setMaxDate has been changed to getter and setters so it is now maxDate https://github.com/Eonasdan/bootstrap-datetimepicker/blob/master/docs/Functions.md#minmaxdate --- .../bootstrap.v3.datetimepicker-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker-tests.ts b/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker-tests.ts index 056c76dd6..e17b7b10c 100644 --- a/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker-tests.ts +++ b/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker-tests.ts @@ -13,7 +13,7 @@ function test_cases() { minDate: '2012-12-31' }); - $('#datetimepicker').data("DateTimePicker").setMaxDate('2012-12-31'); + $('#datetimepicker').data("DateTimePicker").maxDate('2012-12-31'); var startDate = moment(new Date(2012, 1, 20)); var endDate = moment(new Date(2012, 1, 25)); From d7b3d781a82a3a19fcc9eb7916e247156ab432ee Mon Sep 17 00:00:00 2001 From: Luigi Trabacchin Date: Wed, 14 Oct 2015 15:36:34 +0200 Subject: [PATCH 017/389] Typeahead : DisplayKey is now Display --- typeahead/typeahead-tests.ts | 20 ++++++++++---------- typeahead/typeahead.d.ts | 5 ++--- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/typeahead/typeahead-tests.ts b/typeahead/typeahead-tests.ts index 3864865c9..ec2b2e2f3 100644 --- a/typeahead/typeahead-tests.ts +++ b/typeahead/typeahead-tests.ts @@ -6,7 +6,7 @@ // var substringMatcher = function (strs: any) { - return function findMatches(q: string, syncResults: (x: any) => void) { + return function findMatches(q: string, syncResults: (x: Array) => void) { var matches: Array<{ value: string }> = []; // regex used to determine if a string contains the substring `q` var substrRegex = new RegExp(q, 'i'); @@ -97,7 +97,7 @@ function test_datasets_array() { function with_displayKey_option() { $('#the-basics .typeahead').typeahead(options, [{ - displayKey: 'value', + display: 'value', source: substringMatcher(states) }] ); @@ -114,7 +114,7 @@ function test_datasets_array() { function with_all_options() { $('#the-basics .typeahead').typeahead(options, [{ name: 'states', - displayKey: 'value', + display: 'value', templates: {}, source: substringMatcher(states) }] @@ -125,13 +125,13 @@ function test_datasets_array() { $('#the-basics .typeahead').typeahead(options, [ { name: 'states', - displayKey: 'value', + display: 'value', templates: {}, source: substringMatcher(states) }, { name: 'states alternative', - displayKey: 'value', + display: 'value', templates: {}, source: substringMatcher(states) } @@ -161,7 +161,7 @@ function test_datasets_objects() { function with_displayKey_option() { $('#the-basics .typeahead').typeahead(options, { - displayKey: 'value', + display: 'value', source: substringMatcher(states) } ); @@ -180,7 +180,7 @@ function test_datasets_objects() { $('#the-basics .typeahead').typeahead(options, { name: 'states', - displayKey: 'value', + display: x => x.value, templates: {}, source: substringMatcher(states) } @@ -191,13 +191,13 @@ function test_datasets_objects() { $('#the-basics .typeahead').typeahead(options, { name: 'states', - displayKey: 'value', + display: 'value', templates: {}, source: substringMatcher(states) }, { name: 'states alternative', - displayKey: 'value', + display: 'value', templates: {}, source: substringMatcher(states) } @@ -291,7 +291,7 @@ function test_dataset_templates() { suggestion: function (context) { return context.name; } - } + }, }); } } diff --git a/typeahead/typeahead.d.ts b/typeahead/typeahead.d.ts index cde3a9277..7ffbe5b50 100644 --- a/typeahead/typeahead.d.ts +++ b/typeahead/typeahead.d.ts @@ -105,7 +105,7 @@ declare module Twitter.Typeahead { * cb can be invoked synchronously or asynchronously. * */ - source: ((query: string, syncResults: (result: any) => void, asyncResults?: (result: any) => void) => void); + source: ((query: string, syncResults: (result: Array) => void, asyncResults?: (result: Array) => void) => void); /** * The name of the dataset. @@ -120,7 +120,7 @@ declare module Twitter.Typeahead { * This will be used when setting the value of the input control after a suggestion is selected. Can be either a key string or a function that transforms a suggestion object into a string. * Defaults to value. */ - displayKey?: string | ((obj: any) => string); + display?: string | ((obj: any) => string); /** * A hash of templates to be used when rendering the dataset. @@ -128,7 +128,6 @@ declare module Twitter.Typeahead { */ templates?: Templates; async?: boolean; - display?: boolean | ((x: any) => boolean); } From bf24ad882812478d35937c70782624bfe2ac95eb Mon Sep 17 00:00:00 2001 From: Luigi Trabacchin Date: Wed, 14 Oct 2015 20:13:45 +0200 Subject: [PATCH 018/389] typeahead: Added support for some of the custom events --- typeahead/typeahead.d.ts | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/typeahead/typeahead.d.ts b/typeahead/typeahead.d.ts index 7ffbe5b50..136f9650b 100644 --- a/typeahead/typeahead.d.ts +++ b/typeahead/typeahead.d.ts @@ -88,6 +88,41 @@ interface JQuery { * @param datasets One or more datasets passed in as arguments. */ typeahead(options: Twitter.Typeahead.Options, ...datasets: Twitter.Typeahead.Dataset[]): JQuery; + + on(events: "typeahead:active", selector: string, data: any, handler: (ev: JQueryEventObject) => any): JQuery; + on(events: "typeahead:active", selector: string, handler: (ev: JQueryEventObject) => any): JQuery; + on(events: "typeahead:active", handler: (ev: JQueryEventObject) => any): JQuery; + off(events: "typeahead:active", handler: (ev: JQueryEventObject) => any): JQuery; + + on(events: "typeahead:idle", selector: string, data: any, handler: (ev: JQueryEventObject) => any): JQuery; + on(events: "typeahead:idle", selector: string, handler: (ev: JQueryEventObject) => any): JQuery; + on(events: "typeahead:idle", handler: (ev: JQueryEventObject) => any): JQuery; + off(events: "typeahead:idle", handler: (ev: JQueryEventObject) => any): JQuery; + + on(events: "typeahead:open", selector: string, data: any, handler: (ev: JQueryEventObject) => any): JQuery; + on(events: "typeahead:open", selector: string, handler: (ev: JQueryEventObject) => any): JQuery; + on(events: "typeahead:open", handler: (ev: JQueryEventObject) => any): JQuery; + off(events: "typeahead:open", handler: (ev: JQueryEventObject) => any): JQuery; + + on(events: "typeahead:close", selector: string, data: any, handler: (ev: JQueryEventObject) => any): JQuery; + on(events: "typeahead:close", selector: string, handler: (ev: JQueryEventObject) => any): JQuery; + on(events: "typeahead:close", handler: (ev: JQueryEventObject) => any): JQuery; + off(events: "typeahead:close", handler: (ev: JQueryEventObject) => any): JQuery; + + on(events: "typeahead:change", selector: string, data: any, handler: (ev: JQueryEventObject) => any): JQuery; + on(events: "typeahead:change", selector: string, handler: (ev: JQueryEventObject) => any): JQuery; + on(events: "typeahead:change", handler: (ev: JQueryEventObject) => any): JQuery; + off(events: "typeahead:change", handler: (ev: JQueryEventObject) => any): JQuery; + + on(events: "typeahead:render", selector: string, data: any, handler: (ev: JQueryEventObject, suggestions: Array, async: boolean, datasetName: string) => any): JQuery; + on(events: "typeahead:render", selector: string, handler: (ev: JQueryEventObject, suggestions: Array, async: boolean, datasetName: string) => any): JQuery; + on(events: "typeahead:render", handler: (ev: JQueryEventObject, suggestions: Array, async: boolean, datasetName: string) => any): JQuery; + off(events: "typeahead:render", handler: (ev: JQueryEventObject, suggestions: Array, async: boolean, datasetName: string) => any): JQuery; + + on(events: "typeahead:select", selector: string, data: any, handler: (ev: JQueryEventObject, suggestion: any) => any): JQuery; + on(events: "typeahead:select", selector: string, handler: (ev: JQueryEventObject, suggestion: any) => any): JQuery; + on(events: "typeahead:select", handler: (ev: JQueryEventObject, suggestion: any) => any): JQuery; + off(events: "typeahead:select", handler: (ev: JQueryEventObject, suggestion: any) => any): JQuery; } declare module Twitter.Typeahead { From b7257e1d4c9eec50396df8d9759123060e5c8d7c Mon Sep 17 00:00:00 2001 From: Luigi Trabacchin Date: Wed, 14 Oct 2015 20:54:29 +0200 Subject: [PATCH 019/389] typeahead: added all the events, tests coming soon --- typeahead/typeahead.d.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/typeahead/typeahead.d.ts b/typeahead/typeahead.d.ts index 136f9650b..ce401c213 100644 --- a/typeahead/typeahead.d.ts +++ b/typeahead/typeahead.d.ts @@ -123,6 +123,31 @@ interface JQuery { on(events: "typeahead:select", selector: string, handler: (ev: JQueryEventObject, suggestion: any) => any): JQuery; on(events: "typeahead:select", handler: (ev: JQueryEventObject, suggestion: any) => any): JQuery; off(events: "typeahead:select", handler: (ev: JQueryEventObject, suggestion: any) => any): JQuery; + + on(events: "typeahead:autocomplete", selector: string, data: any, handler: (ev: JQueryEventObject, suggestion: any) => any): JQuery; + on(events: "typeahead:autocomplete", selector: string, handler: (ev: JQueryEventObject, suggestion: any) => any): JQuery; + on(events: "typeahead:autocomplete", handler: (ev: JQueryEventObject, suggestion: any) => any): JQuery; + off(events: "typeahead:autocomplete", handler: (ev: JQueryEventObject, suggestion: any) => any): JQuery; + + on(events: "typeahead:cursorchange", selector: string, data: any, handler: (ev: JQueryEventObject, suggestion: any) => any): JQuery; + on(events: "typeahead:cursorchange", selector: string, handler: (ev: JQueryEventObject, suggestion: any) => any): JQuery; + on(events: "typeahead:cursorchange", handler: (ev: JQueryEventObject, suggestion: any) => any): JQuery; + off(events: "typeahead:cursorchange", handler: (ev: JQueryEventObject, suggestion: any) => any): JQuery; + + on(events: "typeahead:asyncrequest", selector: string, data: any, handler: (ev: JQueryEventObject, query: string, datasetName: string) => any): JQuery; + on(events: "typeahead:asyncrequest", selector: string, handler: (ev: JQueryEventObject, query: string, datasetName: string) => any): JQuery; + on(events: "typeahead:asyncrequest", handler: (ev: JQueryEventObject, query: string, datasetName: string) => any): JQuery; + off(events: "typeahead:asyncrequest", handler: (ev: JQueryEventObject, query: string, datasetName: string) => any): JQuery; + + on(events: "typeahead:asynccancel", selector: string, data: any, handler: (ev: JQueryEventObject, query: string, datasetName: string) => any): JQuery; + on(events: "typeahead:asynccancel", selector: string, handler: (ev: JQueryEventObject, query: string, datasetName: string) => any): JQuery; + on(events: "typeahead:asynccancel", handler: (ev: JQueryEventObject, query: string, datasetName: string) => any): JQuery; + off(events: "typeahead:asynccancel", handler: (ev: JQueryEventObject, query: string, datasetName: string) => any): JQuery; + + on(events: "typeahead:asyncreceive", selector: string, data: any, handler: (ev: JQueryEventObject, query: string, datasetName: string) => any): JQuery; + on(events: "typeahead:asyncreceive", selector: string, handler: (ev: JQueryEventObject, query: string, datasetName: string) => any): JQuery; + on(events: "typeahead:asyncreceive", handler: (ev: JQueryEventObject, query: string, datasetName: string) => any): JQuery; + off(events: "typeahead:asyncreceive", handler: (ev: JQueryEventObject, query: string, datasetName: string) => any): JQuery; } declare module Twitter.Typeahead { From 99fe3fa43b31bea4a9a3137b748e6474cc936e63 Mon Sep 17 00:00:00 2001 From: Luigi Trabacchin Date: Thu, 15 Oct 2015 11:56:18 +0200 Subject: [PATCH 020/389] Fullcalendar: Fixed callback parameters on eventDrop and eventResize --- fullCalendar/fullCalendar.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fullCalendar/fullCalendar.d.ts b/fullCalendar/fullCalendar.d.ts index 7552d5bfd..6400dba7e 100644 --- a/fullCalendar/fullCalendar.d.ts +++ b/fullCalendar/fullCalendar.d.ts @@ -198,10 +198,10 @@ declare module FullCalendar { eventConstraint?: BusinessHours | Timespan; eventDragStart?: (event: EventObject, jsEvent: MouseEvent, ui: any, view: ViewObject) => void; eventDragStop?: (event: EventObject, jsEvent: MouseEvent, ui: any, view: ViewObject) => void; - eventDrop?: (event: EventObject, dayDelta: number, minuteDelta: number, revertFunc: Function, jsEvent: Event, ui: any, view: ViewObject) => void; + eventDrop?: (event: EventObject, delta: moment.Duration, revertFunc: Function, jsEvent: Event, ui: any, view: ViewObject) => void; eventResizeStart?: (event: EventObject, jsEvent: MouseEvent, ui: any, view: ViewObject) => void; eventResizeStop?: (event: EventObject, jsEvent: MouseEvent, ui: any, view: ViewObject) => void; - eventResize?: (event: EventObject, dayDelta: number, minuteDelta: number, revertFunc: Function, jsEvent: Event, ui: any, view: ViewObject) => void; + eventResize?: (event: EventObject, delta: moment.Duration, revertFunc: Function, jsEvent: Event, ui: any, view: ViewObject) => void; } /* * Selection - http://arshaw.com/fullcalendar/docs/selection/ From 640536586ae4f3a7db43b041a44caf64021c7610 Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Thu, 15 Oct 2015 15:17:03 +0300 Subject: [PATCH 021/389] flux-utils definitions added. --- flux/flux-utils.d.ts | 130 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 flux/flux-utils.d.ts diff --git a/flux/flux-utils.d.ts b/flux/flux-utils.d.ts new file mode 100644 index 000000000..8437f9d4b --- /dev/null +++ b/flux/flux-utils.d.ts @@ -0,0 +1,130 @@ +// Type definitions for Flux/utils +// Project: http://facebook.github.io/flux/ +// Definitions by: Giedrius Grabauskas +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module FluxUtils { + + export class Container { + /** + * Create is used to transform a react class into a container + * that updates its state when relevant stores change. + * The provided base class must have static methods getStores() and calculateState(). + */ + static create(base: React.ComponentClass, options?: Object): React.ComponentClass; + } + + /** + * This class extends ReduceStore and defines the state as an immutable map. + */ + export class MapStore extends ReduceStore> { + + /** + * Access the value at the given key. + * Throws an error if the key does not exist in the cache. + */ + at(key: K): V; + + /** + * Check if the cache has a particular key + */ + has(key: K): boolean; + + /** + * Get the value of a particular key. + * Returns undefined if the key does not exist in the cache. + */ + get(key: K): V; + + /** + * Gets an array of keys and puts the values in a map if they exist, + * it allows providing a previous result to update instead of generating a new map. + * Providing a previous result allows the possibility of keeping the same reference if the keys did not change. + */ + getAll(keys: Iterable, prev?: Immutable.Map): Immutable.Map; + } + + export class ReduceStore extends Store { + /** + * Getter that exposes the entire state of this store. + * If your state is not immutable you should override this and not expose state directly. + */ + getState(): T; + + /** + * Constructs the initial state for this store. + * This is called once during construction of the store. + */ + getInitialState(): T; + + /** + * Reduces the current state, and an action to the new state of this store. + * All subclasses must implement this method. + * This method should be pure and have no side-effects. + */ + reduce(state: T, action: Object): T; + + /** + * Checks if two versions of state are the same. + * You do not need to override this if your state is immutable. + */ + areEqual(one: T, two: T): boolean; + + } + + export class Store { + + /** + * Constructs and registers an instance of this store with the given dispatcher. + */ + constructor(dispatcher: Flux.Dispatcher); + + /** + * Adds a listener to the store, when the store changes the given callback will be called. + * A token is returned that can be used to remove the listener. + * Calling the remove() function on the returned token will remove the listener. + */ + addListener(callback: Function): { remove: Function }; + + /** + * Returns the dispatcher this store is registered with. + */ + getDispatcher(): Flux.Dispatcher; + + /** + * Returns the dispatch token that the dispatcher recognizes this store by. + * Can be used to waitFor() this store. + */ + getDispatchToken(): string; + + /** + * Ask if a store has changed during the current dispatch. + * Can only be invoked while dispatching. + * This can be used for constructing derived stores that depend on data from other stores. + */ + hasChanged(): boolean; + + /** + *Emit an event notifying all listeners that this store has changed. + * This can only be invoked when dispatching. + * Changes are de-duplicated and resolved at the end of this store's __onDispatch function. + */ + __emitChange(): void; + + /** + * Subclasses must override this method. + * This is how the store receives actions from the dispatcher. + * All state mutation logic must be done during this method. + */ + __onDispatch(payload: Object): void; + } + + + +} + +declare module 'flux/utils' { + export = FluxUtils; +} From d28dd90af5a7ba2b4f18b107ddba3321a5a1f629 Mon Sep 17 00:00:00 2001 From: Luigi Trabacchin Date: Sat, 17 Oct 2015 12:14:39 +0200 Subject: [PATCH 022/389] Typeahead: Received an update through nuget, incorporated the differences --- typeahead/typeahead.d.ts | 44 ++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/typeahead/typeahead.d.ts b/typeahead/typeahead.d.ts index ce401c213..e01e0d509 100644 --- a/typeahead/typeahead.d.ts +++ b/typeahead/typeahead.d.ts @@ -10,19 +10,19 @@ interface JQuery { /** * Destroys previously initialized typeaheads. This entails reverting * DOM modifications and removing event handlers. - * - * @constructor + * + * @constructor * @param methodName Method 'destroy' - */ + */ typeahead(methodName: 'destroy'): JQuery; /** * Opens the dropdown menu of typeahead. Note that being open does not mean that the menu is visible. * The menu is only visible when it is open and has content. - * - * @constructor + * + * @constructor * @param methodName Method 'open' - */ + */ typeahead(methodName: 'open'): JQuery; /** @@ -36,10 +36,10 @@ interface JQuery { /** * Returns the current value of the typeahead. * The value is the text the user has entered into the input element. - * - * @constructor + * + * @constructor * @param methodName Method 'val' - */ + */ typeahead(methodName: 'val'): string; /** @@ -164,7 +164,7 @@ declare module Twitter.Typeahead { * It is expected that the function will compute the suggestion set (i.e. an array of JavaScript objects) for query and then invoke cb with said set. * cb can be invoked synchronously or asynchronously. * - */ + */ source: ((query: string, syncResults: (result: Array) => void, asyncResults?: (result: Array) => void) => void); /** @@ -185,7 +185,7 @@ declare module Twitter.Typeahead { /** * A hash of templates to be used when rendering the dataset. * Note a precompiled template is a function that takes a JavaScript object as its first argument and returns a HTML string. - */ + */ templates?: Templates; async?: boolean; } @@ -196,29 +196,43 @@ declare module Twitter.Typeahead { * Rendered when 0 suggestions are available for the given query. * Can be either a HTML string or a precompiled template. * If it's a precompiled template, the passed in context will contain query - */ + */ empty?: any; /** * Rendered at the bottom of the dataset. * Can be either a HTML string or a precompiled template. * If it's a precompiled template, the passed in context will contain query and isEmpty. - */ + */ footer?: any; /** * Rendered at the top of the dataset. * Can be either a HTML string or a precompiled template. * If it's a precompiled template, the passed in context will contain query and isEmpty. - */ + */ header?: any; + + /** + * Rendered when 0 suggestions are available for the given query. + * Can be either a HTML string or a precompiled template. + * If it's a precompiled template, the passed in context will contain query. + */ + notFound?: (query: string) => string; + + /** + * Rendered when 0 synchronous suggestions are available but asynchronous suggestions are expected. + * Can be either a HTML string or a precompiled template. + * If it's a precompiled template, the passed in context will contain query. + */ + pending?: (query: string) => string; /** * Used to render a single suggestion. * If set, this has to be a precompiled template. * The associated suggestion object will serve as the context. * Defaults to the value of displayKey wrapped in a p tag i.e.

{{value}}

. - */ + */ suggestion?: (datum: any) => string; } From 438f5535c7f5cc7653cceb91d1d3a7f85b82a507 Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Mon, 19 Oct 2015 18:55:20 +0300 Subject: [PATCH 023/389] Delete flux-utils.d.ts --- flux/flux-utils.d.ts | 130 ------------------------------------------- 1 file changed, 130 deletions(-) delete mode 100644 flux/flux-utils.d.ts diff --git a/flux/flux-utils.d.ts b/flux/flux-utils.d.ts deleted file mode 100644 index 8437f9d4b..000000000 --- a/flux/flux-utils.d.ts +++ /dev/null @@ -1,130 +0,0 @@ -// Type definitions for Flux/utils -// Project: http://facebook.github.io/flux/ -// Definitions by: Giedrius Grabauskas -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/// - -declare module FluxUtils { - - export class Container { - /** - * Create is used to transform a react class into a container - * that updates its state when relevant stores change. - * The provided base class must have static methods getStores() and calculateState(). - */ - static create(base: React.ComponentClass, options?: Object): React.ComponentClass; - } - - /** - * This class extends ReduceStore and defines the state as an immutable map. - */ - export class MapStore extends ReduceStore> { - - /** - * Access the value at the given key. - * Throws an error if the key does not exist in the cache. - */ - at(key: K): V; - - /** - * Check if the cache has a particular key - */ - has(key: K): boolean; - - /** - * Get the value of a particular key. - * Returns undefined if the key does not exist in the cache. - */ - get(key: K): V; - - /** - * Gets an array of keys and puts the values in a map if they exist, - * it allows providing a previous result to update instead of generating a new map. - * Providing a previous result allows the possibility of keeping the same reference if the keys did not change. - */ - getAll(keys: Iterable, prev?: Immutable.Map): Immutable.Map; - } - - export class ReduceStore extends Store { - /** - * Getter that exposes the entire state of this store. - * If your state is not immutable you should override this and not expose state directly. - */ - getState(): T; - - /** - * Constructs the initial state for this store. - * This is called once during construction of the store. - */ - getInitialState(): T; - - /** - * Reduces the current state, and an action to the new state of this store. - * All subclasses must implement this method. - * This method should be pure and have no side-effects. - */ - reduce(state: T, action: Object): T; - - /** - * Checks if two versions of state are the same. - * You do not need to override this if your state is immutable. - */ - areEqual(one: T, two: T): boolean; - - } - - export class Store { - - /** - * Constructs and registers an instance of this store with the given dispatcher. - */ - constructor(dispatcher: Flux.Dispatcher); - - /** - * Adds a listener to the store, when the store changes the given callback will be called. - * A token is returned that can be used to remove the listener. - * Calling the remove() function on the returned token will remove the listener. - */ - addListener(callback: Function): { remove: Function }; - - /** - * Returns the dispatcher this store is registered with. - */ - getDispatcher(): Flux.Dispatcher; - - /** - * Returns the dispatch token that the dispatcher recognizes this store by. - * Can be used to waitFor() this store. - */ - getDispatchToken(): string; - - /** - * Ask if a store has changed during the current dispatch. - * Can only be invoked while dispatching. - * This can be used for constructing derived stores that depend on data from other stores. - */ - hasChanged(): boolean; - - /** - *Emit an event notifying all listeners that this store has changed. - * This can only be invoked when dispatching. - * Changes are de-duplicated and resolved at the end of this store's __onDispatch function. - */ - __emitChange(): void; - - /** - * Subclasses must override this method. - * This is how the store receives actions from the dispatcher. - * All state mutation logic must be done during this method. - */ - __onDispatch(payload: Object): void; - } - - - -} - -declare module 'flux/utils' { - export = FluxUtils; -} From 3d4207f11f34df6bcc5cdbece92b69fffed8fde6 Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Mon, 19 Oct 2015 18:56:13 +0300 Subject: [PATCH 024/389] Update flux.d.ts Content moved from flux-utils.d.ts --- flux/flux.d.ts | 122 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) diff --git a/flux/flux.d.ts b/flux/flux.d.ts index bf5bafac4..8a00eb1e1 100644 --- a/flux/flux.d.ts +++ b/flux/flux.d.ts @@ -65,3 +65,125 @@ declare module Flux { declare module "flux" { export = Flux; } + +declare module FluxUtils { + + export class Container { + constructor(); + /** + * Create is used to transform a react class into a container + * that updates its state when relevant stores change. + * The provided base class must have static methods getStores() and calculateState(). + */ + static create(base: React.ComponentClass, options?: Object): React.ComponentClass; + } + + /** + * This class extends ReduceStore and defines the state as an immutable map. + */ + export class MapStore extends ReduceStore> { + + /** + * Access the value at the given key. + * Throws an error if the key does not exist in the cache. + */ + at(key: K): V; + + /** + * Check if the cache has a particular key + */ + has(key: K): boolean; + + /** + * Get the value of a particular key. + * Returns undefined if the key does not exist in the cache. + */ + get(key: K): V; + + /** + * Gets an array of keys and puts the values in a map if they exist, + * it allows providing a previous result to update instead of generating a new map. + * Providing a previous result allows the possibility of keeping the same reference if the keys did not change. + */ + getAll(keys: Immutable.IndexedIterable, prev?: Immutable.Map): Immutable.Map; + } + + export class ReduceStore extends Store { + /** + * Getter that exposes the entire state of this store. + * If your state is not immutable you should override this and not expose state directly. + */ + getState(): T; + + /** + * Constructs the initial state for this store. + * This is called once during construction of the store. + */ + getInitialState(): T; + + /** + * Reduces the current state, and an action to the new state of this store. + * All subclasses must implement this method. + * This method should be pure and have no side-effects. + */ + reduce(state: T, action: Object): T; + + /** + * Checks if two versions of state are the same. + * You do not need to override this if your state is immutable. + */ + areEqual(one: T, two: T): boolean; + + } + + export class Store { + + /** + * Constructs and registers an instance of this store with the given dispatcher. + */ + constructor(dispatcher: Flux.Dispatcher); + + /** + * Adds a listener to the store, when the store changes the given callback will be called. + * A token is returned that can be used to remove the listener. + * Calling the remove() function on the returned token will remove the listener. + */ + addListener(callback: Function): { remove: Function }; + + /** + * Returns the dispatcher this store is registered with. + */ + getDispatcher(): Flux.Dispatcher; + + /** + * Returns the dispatch token that the dispatcher recognizes this store by. + * Can be used to waitFor() this store. + */ + getDispatchToken(): string; + + /** + * Ask if a store has changed during the current dispatch. + * Can only be invoked while dispatching. + * This can be used for constructing derived stores that depend on data from other stores. + */ + hasChanged(): boolean; + + /** + *Emit an event notifying all listeners that this store has changed. + * This can only be invoked when dispatching. + * Changes are de-duplicated and resolved at the end of this store's __onDispatch function. + */ + __emitChange(): void; + + /** + * Subclasses must override this method. + * This is how the store receives actions from the dispatcher. + * All state mutation logic must be done during this method. + */ + __onDispatch(payload: Object): void; + } +} + +declare module 'flux/utils' { + export = FluxUtils; +} From 96173498302aeab1a726f8927bc7314d0b42db85 Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Mon, 19 Oct 2015 19:06:19 +0300 Subject: [PATCH 025/389] Added references Added immutable and react references. --- flux/flux.d.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/flux/flux.d.ts b/flux/flux.d.ts index 8a00eb1e1..5b6079d50 100644 --- a/flux/flux.d.ts +++ b/flux/flux.d.ts @@ -1,8 +1,11 @@ // Type definitions for Flux // Project: http://facebook.github.io/flux/ -// Definitions by: Steve Baker +// Definitions by: Steve Baker , Giedrius Grabauskas // Definitions: https://github.com/borisyankov/DefinitelyTyped +/// +/// + declare module Flux { /** From 392f2699d0aee7ef7da3227614e641600c1e1af1 Mon Sep 17 00:00:00 2001 From: Maxime LUCE Date: Sun, 25 Oct 2015 01:01:01 +0200 Subject: [PATCH 026/389] Update opn typings for version 3.0.2 --- opn/opn-tests.ts | 18 ++++++++--- opn/opn.d.ts | 84 ++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 91 insertions(+), 11 deletions(-) diff --git a/opn/opn-tests.ts b/opn/opn-tests.ts index 361725970..2b39f1950 100644 --- a/opn/opn-tests.ts +++ b/opn/opn-tests.ts @@ -1,10 +1,18 @@ /// -import opn = require('opn'); +import * as opn from "opn"; var errorCallback: (err: Error) => void; -opn('foo'); -opn('foo', 'bar'); -opn('foo', errorCallback); -opn('foo', 'bar', errorCallback); +opn("foo"); +opn("foo", errorCallback); + +opn("foo", { app: "bar" }); +opn("foo", { app: ["bar", "--arg"] }); +opn("foo", { app: "bar", wait: false }); +opn("foo", { app: ["bar", "--arg"] , wait: false}); + +opn("foo", { app: "bar" }, errorCallback); +opn("foo", { app: ["bar", "--arg"] }, errorCallback); +opn("foo", { app: "bar", wait: false }, errorCallback); +opn("foo", { app: ["bar", "--arg"], wait: false }, errorCallback); diff --git a/opn/opn.d.ts b/opn/opn.d.ts index 10a34ce60..6e6a5a178 100644 --- a/opn/opn.d.ts +++ b/opn/opn.d.ts @@ -1,10 +1,82 @@ -// Type definitions for opn 1.0.0 +// Type definitions for opn 3.0.2 // Project: https://github.com/sindresorhus/opn -// Definitions by: Shinnosuke Watanabe +// Definitions by: Shinnosuke Watanabe , +// Maxime LUCE // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare module 'opn' { - function opn(target: string, callback?: (err: Error) => void): void; - function opn(target: string, app: string, callback?: (err: Error) => void): void; - export = opn; +/// + +declare namespace Opn { + export interface Options { + /** + * Wait for the opened app to exit before calling the `callback`. + * If `false` it's called immediately when opening the app. + * On Windows you have to explicitly specify an app for it to be able to wait. + */ + wait?: boolean; + + /** + * Specify the app to open the target with, or an array with the app and app arguments. + * The app name is platform dependent. Don't hard code it in reusable modules. + * Eg. Chrome is `google chrome` on OS X, `google-chrome` on Linux and `chrome` on Windows. + */ + app?: string | string[]; + } +} + +declare module "opn" { + import * as cp from "child_process"; + + interface DefaultFunction { + /** + * Uses the command open on OS X, start on Windows and xdg-open on other platforms. + * + * Returns the spawned child process. + * You'd normally not need to use this for anything, but it can be useful if you'd like + * to attach custom event listeners or perform other operations directly on the spawned process. + * + * @param target - The thing you want to open. Can be a URL, file, or executable. Opens in the default app for the file type. Eg. URLs opens in your default browser. + */ + (target: string): cp.ChildProcess; + + /** + * Uses the command open on OS X, start on Windows and xdg-open on other platforms. + * + * Returns the spawned child process. + * You'd normally not need to use this for anything, but it can be useful if you'd like + * to attach custom event listeners or perform other operations directly on the spawned process. + * + * @param target - The thing you want to open. Can be a URL, file, or executable. Opens in the default app for the file type. Eg. URLs opens in your default browser. + * @param callback- Called when the opened app exits, or if `wait: false`, immediately when opening. + */ + (target: string, callback: (err: Error) => void): cp.ChildProcess; + + /** + * Uses the command open on OS X, start on Windows and xdg-open on other platforms. + * + * Returns the spawned child process. + * You'd normally not need to use this for anything, but it can be useful if you'd like + * to attach custom event listeners or perform other operations directly on the spawned process. + * + * @param target - The thing you want to open. Can be a URL, file, or executable. Opens in the default app for the file type. Eg. URLs opens in your default browser. + * @param options - Options to be passed to opn. + */ + (target: string, options: Opn.Options): cp.ChildProcess; + + /** + * Uses the command open on OS X, start on Windows and xdg-open on other platforms. + * + * Returns the spawned child process. + * You'd normally not need to use this for anything, but it can be useful if you'd like + * to attach custom event listeners or perform other operations directly on the spawned process. + * + * @param target - The thing you want to open. Can be a URL, file, or executable. Opens in the default app for the file type. Eg. URLs opens in your default browser. + * @param options - Options to be passed to opn. + * @param callback- Called when the opened app exits, or if `wait: false`, immediately when opening. + */ + (target: string, options: Opn.Options, callback: (err: Error) => void): cp.ChildProcess; + } + + const opn: DefaultFunction; + export = opn; } From a029b45c6db83de4b58baed4611fb804ee721ae1 Mon Sep 17 00:00:00 2001 From: Sixin Li Date: Thu, 5 Nov 2015 15:54:34 -0500 Subject: [PATCH 027/389] `state` properties belongs to CodeMirror.Editor, not CodeMorrir.Doc --- codemirror/codemirror-showhint.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/codemirror/codemirror-showhint.d.ts b/codemirror/codemirror-showhint.d.ts index 48a904a3b..9573f95bc 100644 --- a/codemirror/codemirror-showhint.d.ts +++ b/codemirror/codemirror-showhint.d.ts @@ -39,11 +39,11 @@ declare module CodeMirror { /** An extension of the existing CodeMirror typings for the Editor.on("keyup", func) syntax */ on(eventName: string, handler: (doc: CodeMirror.Doc, event: any) => void): void; off(eventName: string, handler: (doc: CodeMirror.Doc, event: any) => void): void; + /** Extend CodeMirror.Editor with a state object, so that the Editor.state.completionActive property is reachable*/ + state: any; } - /** Extend CodeMirror.Doc with a state object, so that the Doc.state.completionActive property is reachable*/ interface Doc { - state: any; showHint: (options: ShowHintOptions) => void; } From c7a2374b86f8cb79d293be28dd53346a8627705f Mon Sep 17 00:00:00 2001 From: Sam Vloeberghs Date: Sun, 8 Nov 2015 12:08:32 +0100 Subject: [PATCH 028/389] added media queries utils conform to foundation spec --- foundation/foundation.d.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/foundation/foundation.d.ts b/foundation/foundation.d.ts index a51e47ae9..ce782fd92 100644 --- a/foundation/foundation.d.ts +++ b/foundation/foundation.d.ts @@ -304,6 +304,16 @@ declare module Foundation { add_custom_rule(rule : string, media : string) : void; image_loaded(images : JQuery, callback : (...args : any[]) => any) : void; random_str(length? : number) : string; + is_small_only(): boolean; + is_small_up(): boolean; + is_medium_only(): boolean; + is_medium_up(): boolean; + is_large_only(): boolean; + is_large_up(): boolean; + is_xlarge_only(): boolean; + is_xlarge_up(): boolean; + is_xxlarge_only(): boolean; + is_xxlarge_up(): boolean; }; } } From ced9f3bb50955947e4ae2e4b9d736602f9f3a4a8 Mon Sep 17 00:00:00 2001 From: Sixin Li Date: Wed, 11 Nov 2015 23:52:19 -0500 Subject: [PATCH 029/389] move `state` from codemirror-showhint.d.ts to codemirror.d.ts --- codemirror/codemirror-showhint.d.ts | 2 -- codemirror/codemirror.d.ts | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/codemirror/codemirror-showhint.d.ts b/codemirror/codemirror-showhint.d.ts index 9573f95bc..8b620a414 100644 --- a/codemirror/codemirror-showhint.d.ts +++ b/codemirror/codemirror-showhint.d.ts @@ -39,8 +39,6 @@ declare module CodeMirror { /** An extension of the existing CodeMirror typings for the Editor.on("keyup", func) syntax */ on(eventName: string, handler: (doc: CodeMirror.Doc, event: any) => void): void; off(eventName: string, handler: (doc: CodeMirror.Doc, event: any) => void): void; - /** Extend CodeMirror.Editor with a state object, so that the Editor.state.completionActive property is reachable*/ - state: any; } interface Doc { diff --git a/codemirror/codemirror.d.ts b/codemirror/codemirror.d.ts index 2ca58c702..3fb29e425 100644 --- a/codemirror/codemirror.d.ts +++ b/codemirror/codemirror.d.ts @@ -390,6 +390,9 @@ declare module CodeMirror { The handler may mess with the style of the resulting element, or add event handlers, but should not try to change the state of the editor. */ on(eventName: 'renderLine', handler: (instance: CodeMirror.Editor, line: number, element: HTMLElement) => void ): void; off(eventName: 'renderLine', handler: (instance: CodeMirror.Editor, line: number, element: HTMLElement) => void ): void; + + /** Expose the state object, so that the Editor.state.completionActive property is reachable*/ + state: any; } interface EditorFromTextArea extends Editor { @@ -589,6 +592,8 @@ declare module CodeMirror { /** The reverse of posFromIndex. */ indexFromPos(object: CodeMirror.Position): number; + /** Expose the state object, so that the Doc.state.completionActive property is reachable*/ + state: any; } interface LineHandle { From 506e79788f825cc28f54c11466ae3ec7828de830 Mon Sep 17 00:00:00 2001 From: dencap Date: Thu, 12 Nov 2015 15:30:55 +0100 Subject: [PATCH 030/389] Added definition for bytebuffer.js (with long.js) --- bytebuffer/bytebuffer.d.ts | 612 +++++++++++++++++++++++++++++++++++++ bytebuffer/long.d.ts | 349 +++++++++++++++++++++ 2 files changed, 961 insertions(+) create mode 100644 bytebuffer/bytebuffer.d.ts create mode 100644 bytebuffer/long.d.ts diff --git a/bytebuffer/bytebuffer.d.ts b/bytebuffer/bytebuffer.d.ts new file mode 100644 index 000000000..6123ed50b --- /dev/null +++ b/bytebuffer/bytebuffer.d.ts @@ -0,0 +1,612 @@ +// Type definitions for ByteBuffer.js 5.0.0 +// Project: https://github.com/dcodeIO/bytebuffer.js + +/// + +declare class ByteBuffer +{ + /** + * Constructs a new ByteBuffer. + */ + constructor( capacity?: number, littleEndian?: boolean, noAssert?: boolean ); + + /** + * Big endian constant that can be used instead of its boolean value. Evaluates to false. + */ + static BIG_ENDIAN: boolean; + + /** + * Default initial capacity of 16. + */ + static DEFAULT_CAPACITY: number; + + /** + * Default no assertions flag of false. + */ + static DEFAULT_NOASSERT + + /** + * Little endian constant that can be used instead of its boolean value. Evaluates to true. + */ + static LITTLE_ENDIAN: boolean; + + /** + * Maximum number of bytes required to store a 32bit base 128 variable-length integer. + */ + static MAX_VARINT32_BYTES: number; + + /** + * Maximum number of bytes required to store a 64bit base 128 variable-length integer. + */ + static MAX_VARINT64_BYTES: number; + + /** + * Metrics representing number of bytes.Evaluates to 2. + */ + static METRICS_BYTES: number; + + /** + * Metrics representing number of UTF8 characters.Evaluates to 1. + */ + static METRICS_CHARS + + /** + * ByteBuffer version. + */ + static VERSION: string; + + /** + * Backing buffer. + */ + buffer: ArrayBuffer; + + /** + * Absolute limit of the contained data. Set to the backing buffer's capacity upon allocation. + */ + limit: number; + + /** + * Whether to use little endian byte order, defaults to false for big endian. + */ + littleEndian: boolean; + + /** + * Marked offset. + */ + markedOffset: number; + + /** + * Whether to skip assertions of offsets and values, defaults to false. + */ + noAssert: boolean; + + /** + * Absolute read/write offset. + */ + offset: number; + + /** + * Data view to manipulate the backing buffer. Becomes null if the backing buffer has a capacity of 0. + */ + view: DataView; + + /** + * Allocates a new ByteBuffer backed by a buffer of the specified capacity. + */ + static allocate( capacity?: number, littleEndian?: number, noAssert?: boolean ): ByteBuffer; + + /** + * Decodes a base64 encoded string to binary like window.atob does. + */ + static atob( b64: string ): string; + + /** + * Encodes a binary string to base64 like window.btoa does. + */ + static btoa( str: string ): string; + + /** + * Calculates the number of UTF8 bytes of a string. + */ + static calculateUTF8Byte( str: string ): number; + + /** + * Calculates the number of UTF8 characters of a string.JavaScript itself uses UTF- 16, so that a string's length property does not reflect its actual UTF8 size if it contains code points larger than 0xFFFF. + */ + static calculateUTF8Char( str: string ): number; + + /** + * Calculates the actual number of bytes required to store a 32bit base 128 variable-length integer. + */ + static calculateVariant32( value: number ): number; + + /** + * Calculates the actual number of bytes required to store a 64bit base 128 variable-length integer. + */ + static calculateVariant64( value: number | Long ): number; + + /** + * Concatenates multiple ByteBuffers into one. + */ + static concat( buffers: Array | ArrayBuffer | Uint8Array | string, encoding?: string | boolean, litteEndian?: boolean, noAssert?: boolean ): ByteBuffer; + + /** + * Decodes a base64 encoded string to a ByteBuffer. + */ + static fromBase64( str: string, littleEndian?: boolean, noAssert?: boolean ): ByteBuffer; + + /** + * Decodes a binary encoded string, that is using only characters 0x00-0xFF as bytes, to a ByteBuffer. + */ + static fromBinary( str: string, littleEndian?: boolean, noAssert?: boolean ): ByteBuffer; + + /** + * Decodes a hex encoded string with marked offsets to a ByteBuffer. + */ + static fromDebug( str: string, littleEndian?: boolean, noAssert?: boolean ): ByteBuffer; + + /** + * Decodes a hex encoded string to a ByteBuffer. + */ + static fromHex( str: string, littleEndian?: boolean, noAssert?: boolean ): ByteBuffer; + + /** + * Decodes an UTF8 encoded string to a ByteBuffer. + */ + static fromUTF8( str: string, littleEndian?: boolean, noAssert?: boolean ): ByteBuffer; + + /** + * Gets the backing buffer type. + */ + static isByteBuffer( bb: any ): boolean; + + /** + * Wraps a buffer or a string. Sets the allocated ByteBuffer's ByteBuffer#offset to 0 and its ByteBuffer#limit to the length of the wrapped data. + * @param buffer Anything that can be wrapped + * @param encoding String encoding if buffer is a string ("base64", "hex", "binary", defaults to "utf8") + * @param littleEndian Whether to use little or big endian byte order. Defaults to ByteBuffer.DEFAULT_ENDIAN. + * @param noAssert Whether to skip assertions of offsets and values. Defaults to ByteBuffer.DEFAULT_NOASSERT. + */ + static wrap( buffer: ByteBuffer | ArrayBuffer | Uint8Array | string, enc?: string | boolean, littleEndian?: boolean, noAssert?: boolean ): ByteBuffer; + + /** + * Decodes a zigzag encoded signed 32bit integer. + */ + static zigZagDecode32( n: number ): number; + + /** + * Decodes a zigzag encoded signed 64bit integer. + */ + static zigZagDecode64( n: number | Long ): Long; + + /** + * Zigzag encodes a signed 32bit integer so that it can be effectively used with varint encoding. + */ + static zigZagEncode32( n: number ): number; + + /** + * Zigzag encodes a signed 64bit integer so that it can be effectively used with varint encoding. + */ + static zigZagEncode64( n: number | Long ): Long; + + /** + * Switches (to) big endian byte order. + */ + BE( bigEndian?: boolean ): ByteBuffer; + + /** + * Switches (to) little endian byte order. + */ + LE( bigEndian?: boolean ): ByteBuffer; + + /** + * Appends some data to this ByteBuffer. This will overwrite any contents behind the specified offset up to the appended data's length. + */ + append( source: ByteBuffer | ArrayBuffer | Uint8Array | string, encoding?: string | number, offset?: number ): ByteBuffer; + + /** + * Appends this ByteBuffer's contents to another ByteBuffer. This will overwrite any contents behind the specified offset up to the length of this ByteBuffer's data. + */ + appendTo( target: ByteBuffer, offset?: number ): ByteBuffer; + + /** + * Enables or disables assertions of argument types and offsets. Assertions are enabled by default but you can opt to disable them if your code already makes sure that everything is valid. + */ + assert( assert: boolean ): ByteBuffer; + + /** + * Gets the capacity of this ByteBuffer's backing buffer. + */ + capacity(): number; + + /** + * Clears this ByteBuffer's offsets by setting ByteBuffer#offset to 0 and + * ByteBuffer#limit to the backing buffer's capacity. Discards ByteBuffer#markedOffset. + */ + clear(): ByteBuffer; + + /** + * Creates a cloned instance of this ByteBuffer, preset with this ByteBuffer's values for ByteBuffer#offset, ByteBuffer#markedOffset and ByteBuffer#limit. + */ + clone( copy?: boolean ): ByteBuffer; + + /** + * Compacts this ByteBuffer to be backed by a ByteBuffer#buffer of its contents' length. Contents are the bytes between ByteBuffer#offset and ByteBuffer#limit. Will set offset = 0 and limit = capacity and adapt ByteBuffer#markedOffset to the same relative position if set. + */ + compact( begin?: number, end?: number ): ByteBuffer; + + /** + * Creates a copy of this ByteBuffer's contents. Contents are the bytes between ByteBuffer#offset and ByteBuffer#limit. + */ + copy( begin?: number, end?: number ): ByteBuffer; + + /** + * Copies this ByteBuffer's contents to another ByteBuffer. Contents are the bytes between ByteBuffer#offset and ByteBuffer#limit. + */ + copyTo( target: ByteBuffer, targetOffset?: number, sourceOffset?: number, sourceLimit?: number ): ByteBuffer; + + /** + * Makes sure that this ByteBuffer is backed by a ByteBuffer#buffer of at least the specified capacity. If the current capacity is exceeded, it will be doubled. If double the current capacity is less than the required capacity, the required capacity will be used instead. + */ + ensureCapacity( capacity: number ): ByteBuffer; + + /** + * Overwrites this ByteBuffer's contents with the specified value. Contents are the bytes between ByteBuffer#offset and ByteBuffer#limit. + */ + fill( value: number | string, begin?: number, end?: number ): ByteBuffer; + + /** + * Makes this ByteBuffer ready for a new sequence of write or relative read operations. Sets limit = offset and offset = 0. Make sure always to flip a ByteBuffer when all relative read or write operations are complete. + */ + flip(): ByteBuffer; + + /** + * Marks an offset on this ByteBuffer to be used later. + */ + mark( offset?: number ): ByteBuffer; + + /** + * Sets the byte order. + */ + order( littleEndian: boolean ): ByteBuffer; + + /** + * Prepends some data to this ByteBuffer. This will overwrite any contents before the specified offset up to the prepended data's length. If there is not enough space available before the specified offset, the backing buffer will be resized and its contents moved accordingly. + */ + prepend( source: ByteBuffer | string | ArrayBuffer, encoding?: string | number, offset?: number ): ByteBuffer; + + /** + * Prepends this ByteBuffer to another ByteBuffer. This will overwrite any contents before the specified offset up to the prepended data's length. If there is not enough space available before the specified offset, the backing buffer will be resized and its contents moved accordingly. + */ + prependTo( target: ByteBuffer, offset?: number ): ByteBuffer; + + /** + * Prints debug information about this ByteBuffer's contents. + */ + printDebug( out?: ( string ) => void ): void; + + /** + * Reads an 8bit signed integer. This is an alias of ByteBuffer#readInt8. + */ + readByte( offset?: number ): number; + + /** + * Reads a NULL-terminated UTF8 encoded string. For this to work the string read must not contain any NULL characters itself. + */ + readCString( offset?: number ): string; + + /** + * Reads a 64bit float. This is an alias of ByteBuffer#readFloat64. + */ + readDouble( offset?: number ): number; + + /** + * Reads a 32bit float. This is an alias of ByteBuffer#readFloat32. + */ + readFloat( offset?: number ): number; + + /** + * Reads a 32bit float. + */ + readFloat32( offset?: number ): number; + + /** + * Reads a 64bit float. + */ + readFloat64( offset?: number ): number; + + /** + * Reads a length as uint32 prefixed UTF8 encoded string. + */ + readIString( offset?: number ): string; + + /** + * Reads a 32bit signed integer.This is an alias of ByteBuffer#readInt32. + */ + readInt( offset?: number ): number; + + /** + * Reads a 16bit signed integer. + */ + readInt16( offset?: number ): number; + + /** + * Reads a 32bit signed integer. + */ + readInt32( offset?: number ): number; + + /** + * Reads a 64bit signed integer. + */ + readInt64( offset?: number ): Long; + + /** + * Reads an 8bit signed integer. + */ + readInt8( offset?: number ): number; + + /** + * Reads a 64bit signed integer. This is an alias of ByteBuffer#readInt64. + */ + readLong( offset?: number ): Long; + + /** + * Reads a 16bit signed integer. This is an alias of ByteBuffer#readInt16. + */ + readShort( offset?: number ): number; + + /** + * Reads an UTF8 encoded string. This is an alias of ByteBuffer#readUTF8String. + */ + readString( length: number, metrics?: number, offset?: number ): string; + + /** + * Reads an UTF8 encoded string. + */ + readUTF8String( chars: number, offset?: number ): string; + + /** + * Reads a 16bit unsigned integer. + */ + readUint16( offset?: number ): number; + + /** + * Reads a 32bit unsigned integer. + */ + readUint32( offset?: number ): number; + + /** + * Reads a 64bit unsigned integer. + */ + readUint64( offset?: number ): Long; + /** + * Reads an 8bit unsigned integer. + */ + readUint8( offset?: number ): number; + + /** + * Reads a length as varint32 prefixed UTF8 encoded string. + */ + readVString( offset?: number ): string; + + /** + * Reads a 32bit base 128 variable-length integer. + */ + readVarint32( offset?: number ): number; + + /** + * Reads a zig-zag encoded 32bit base 128 variable-length integer. + */ + readVarint32ZiZag( offset?: number ): number; + + /** + * Reads a 64bit base 128 variable-length integer. Requires Long.js. + */ + readVarint64( offset?: number ): Long; + + /** + * Reads a zig-zag encoded 64bit base 128 variable-length integer. Requires Long.js. + */ + readVarint64ZigZag( offset?: number ): Long; + + /** + * Gets the number of remaining readable bytes. Contents are the bytes between ByteBuffer#offset and ByteBuffer#limit, so this returns limit - offset. + */ + remaining(): number; + + /** + * Resets this ByteBuffer's ByteBuffer#offset. If an offset has been marked through ByteBuffer#mark before, offset will be set to ByteBuffer#markedOffset, which will then be discarded. If no offset has been marked, sets offset = 0. + */ + reset(): ByteBuffer; + + /** + * Resizes this ByteBuffer to be backed by a buffer of at least the given capacity. Will do nothing if already that large or larger. + */ + resize( capacity: number ): ByteBuffer; + + /** + * Reverses this ByteBuffer's contents + */ + reverse( begin?: number, end?: number ): ByteBuffer; + + /** + * Skips the next length bytes. This will just advance + */ + skip( length: number ): ByteBuffer; + + /** + * Slices this ByteBuffer by creating a cloned instance with offset = begin and limit = end. + */ + slice( begin?: number, end?: number ): ByteBuffer; + + /** + * Returns a raw buffer compacted to contain this ByteBuffer's contents. Contents are the bytes between ByteBuffer#offset and ByteBuffer#limit. Will transparently ByteBuffer#flip this ByteBuffer if offset > limit but the actual offsets remain untouched. This is an alias of ByteBuffer#toBuffer. + */ + toArrayBuffer( forceCopy?: boolean ): ArrayBuffer; + + /** + * Encodes this ByteBuffer's contents to a base64 encoded string. + */ + toBase64( begin?: number, end?: number ): string; + + /** + * Encodes this ByteBuffer to a binary encoded string, that is using only characters 0x00-0xFF as bytes. + */ + toBinary( begin?: number, end?: number ): string; + + /** + * Returns a copy of the backing buffer that contains this ByteBuffer's contents. Contents are the bytes between ByteBuffer#offset and ByteBuffer#limit. Will transparently ByteBuffer#flip this ByteBuffer if offset > limit but the actual offsets remain untouched. + */ + toBuffer( forceCopy?: boolean ): ArrayBuffer; + + /** + *Encodes this ByteBuffer to a hex encoded string with marked offsets. Offset symbols are: + * < : offset, + * ' : markedOffset, + * > : limit, + * | : offset and limit, + * [ : offset and markedOffset, + * ] : markedOffset and limit, + * ! : offset, markedOffset and limit + */ + toDebug( columns?: boolean ): string | Array + + /** + * Encodes this ByteBuffer's contents to a hex encoded string. + */ + toHex( begin?: number, end?: number ): string; + + /** + * Converts the ByteBuffer's contents to a string. + */ + toString( encoding?: string ): string; + + /** + * Encodes this ByteBuffer's contents between ByteBuffer#offset and ByteBuffer#limit to an UTF8 encoded string. + */ + toUTF8(): string; + + /** + * Writes an 8bit signed integer. This is an alias of ByteBuffer#writeInt8. + */ + writeByte( value: number, offset?: number ): ByteBuffer; + + /** + * Writes a NULL-terminated UTF8 encoded string. For this to work the specified string must not contain any NULL characters itself. + */ + writeCString( str: string, offset?: number ): ByteBuffer; + + /** + * Writes a 64bit float. This is an alias of ByteBuffer#writeFloat64. + */ + writeDouble( value: number, offset?: number ): ByteBuffer; + + /** + * Writes a 32bit float. This is an alias of ByteBuffer#writeFloat32. + */ + writeFloat( value: number, offset?: number ): ByteBuffer; + + /** + * Writes a 32bit float. + */ + writeFloat32( value: number, offset?: number ): ByteBuffer; + + /** + * Writes a 64bit float. + */ + writeFloat64( value: number, offset?: number ): ByteBuffer; + + /** + * Writes a length as uint32 prefixed UTF8 encoded string. + */ + writeIString( str: string, offset?: number ): ByteBuffer; + + /** + * Writes a 32bit signed integer. This is an alias of ByteBuffer#writeInt32. + */ + writeInt( value: number, offset?: number ): ByteBuffer; + + /** + * Writes a 16bit signed integer. + */ + writeInt16( value: number, offset?: number ): ByteBuffer; + + /** + * Writes a 32bit signed integer. + */ + writeInt32( value: number, offset?: number ): ByteBuffer; + + /** + * Writes a 64bit signed integer. + */ + writeInt64( value: number | Long, offset?: number ): ByteBuffer; + + /** + * Writes an 8bit signed integer. + */ + writeInt8( value: number, offset?: number ): ByteBuffer; + + /** + * Writes a 16bit signed integer. This is an alias of ByteBuffer#writeInt16. + */ + writeShort( value: number, offset?: number ): ByteBuffer; + + /** + * Writes an UTF8 encoded string.This is an alias of ByteBuffer#writeUTF8String. + */ + WriteString( str: string, offset?: number ): ByteBuffer | number; + + /** + * Writes an UTF8 encoded string. + */ + writeUTF8String( str: string, offset?: number ): ByteBuffer | number; + + /** + * Writes a 16bit unsigned integer. + */ + writeUint16( value: number, offset?: number ): ByteBuffer; + + /** + * Writes a 32bit unsigned integer. + */ + writeUint32( value: number, offset?: number ): ByteBuffer; + + /** + * Writes a 64bit unsigned integer. + */ + writeUint64( value: number | Long, offset?: number ): ByteBuffer; + + /** + * Writes an 8bit unsigned integer. + */ + writeUint8( value: number, offset?: number ): ByteBuffer; + + /** + * Writes a length as varint32 prefixed UTF8 encoded string. + */ + writeVString( str: string, offset?: number ): ByteBuffer | number; + + /** + * Writes a 32bit base 128 variable-length integer. + */ + writeVarint32( value: number, offset?: number ): ByteBuffer | number; + + /** + * Writes a zig-zag encoded 32bit base 128 variable-length integer. + */ + writeVarint32ZigZag( value: number, offset?: number ): ByteBuffer | number; + + /** + * Writes a 64bit base 128 variable-length integer. + */ + writeVarint64( value: number | Long, offset?: number ): ByteBuffer; + + /** + * Writes a zig-zag encoded 64bit base 128 variable-length integer. + */ + writeVarint64ZigZag( value: number | Long, offset?: number ): ByteBuffer | number; +} + +declare module 'bytebuffer' { + export = ByteBuffer; +} diff --git a/bytebuffer/long.d.ts b/bytebuffer/long.d.ts new file mode 100644 index 000000000..f5825ffe7 --- /dev/null +++ b/bytebuffer/long.d.ts @@ -0,0 +1,349 @@ +// Type definitions for ByteBuffer.js 5.0.0 +// Project: https://github.com/dcodeIO/bytebuffer.js + +declare class Long +{ + /** + * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as signed integers. See the from* functions below for more convenient ways of constructing Longs. + */ + constructor( low: number, high?: number, unsigned?: number ); + + /** + * Maximum unsigned value. + */ + static MAX_UNSIGNED_VALUE: Long; + + /** + * Maximum signed value. + */ + static MAX_VALUE: Long; + + /** + * Minimum signed value. + */ + static MIN_VALUE: Long; + + /** + * Signed negative one. + */ + static NEG_ONE: Long; + + /** + * Signed one. + */ + static ONE: Long; + + /** + * Unsigned one. + */ + static UONE: Long; + + /** + * Unsigned zero. + */ + static UZERO: Long; + + /** + * Signed zero + */ + static ZERO: Long; + + /** + * The high 32 bits as a signed value. + */ + high: number; + + /** + * The low 32 bits as a signed value. + */ + low: number; + + /** + * Whether unsigned or not. + */ + unsigned: number; + + /** + * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is assumed to use 32 bits. + */ + static fromBits( lowBits:number, highBits:number, unsigned?:boolean ): Long; + + /** + * Returns a Long representing the given 32 bit integer value. + */ + static fromInt( value: number, unsigned?: boolean ): Long; + + /** + * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned. + */ + static fromNumber( value: number, unsigned?: boolean ): Long; + + /** + * Returns a Long representation of the given string, written using the specified radix. + */ + static fromString( str: string, unsigned?: boolean | number, radix?: number ): Long; + + /** + * Tests if the specified object is a Long. + */ + static isLong( obj: any ): boolean; + + /** + * Converts the specified value to a Long. + */ + static fromValue( val: Long | number | string | {low: number, high: number, unsigned: boolean} ): Long; + + /** + * Returns the sum of this and the specified Long. + */ + add( addend: number | Long | string ): Long; + + /** + * Returns the bitwise AND of this Long and the specified. + */ + and( other: Long | number | string ): Long; + + /** + * Compares this Long's value with the specified's. + */ + compare( other: Long | number | string ): number; + + /** + * Compares this Long's value with the specified's. + */ + comp( other: Long | number | string ): number; + + /** + * Returns this Long divided by the specified. + */ + divide( divisor: Long | number | string ): Long; + + /** + * Returns this Long divided by the specified. + */ + div( divisor: Long | number | string ): Long; + + /** + * Tests if this Long's value equals the specified's. + */ + equals( other: Long | number | string ): boolean; + + /** + * Tests if this Long's value equals the specified's. + */ + eq( other: Long | number | string ): boolean; + + /** + * Gets the high 32 bits as a signed integer. + */ + getHighBits(): number; + + /** + * Gets the high 32 bits as an unsigned integer. + */ + getHighBitsUnsigned(): number; + + /** + * Gets the low 32 bits as a signed integer. + */ + getLowBits(): number; + + /** + * Gets the low 32 bits as an unsigned integer. + */ + getLowBitsUnsigned(): number; + + /** + * Gets the number of bits needed to represent the absolute value of this Long. + */ + getNumBitsAbs(): number; + + /** + * Tests if this Long's value is greater than the specified's. + */ + greaterThan( other: Long | number | string ): boolean; + + /** + * Tests if this Long's value is greater than the specified's. + */ + gt( other: Long | number | string ): boolean; + + /** + * Tests if this Long's value is greater than or equal the specified's. + */ + greaterThanOrEqual( other: Long | number | string ): boolean; + + /** + * Tests if this Long's value is greater than or equal the specified's. + */ + gte( other: Long | number | string ): boolean; + + /** + * Tests if this Long's value is even. + */ + isEven(): boolean; + + /** + * Tests if this Long's value is negative. + */ + isNegative(): boolean; + + /** + * Tests if this Long's value is odd. + */ + isOdd(): boolean; + + /** + * Tests if this Long's value is positive. + */ + isPositive(): boolean; + + /** + * Tests if this Long's value equals zero. + */ + isZero(): boolean; + + /** + * Tests if this Long's value is less than the specified's. + */ + lessThan( other: Long | number | string ): boolean; + + /** + * Tests if this Long's value is less than the specified's. + */ + lt( other: Long | number | string ): boolean; + + /** + * Tests if this Long's value is less than or equal the specified's. + */ + lessThanOrEqual( other: Long | number | string ): boolean; + + /** + * Tests if this Long's value is less than or equal the specified's. + */ + lte( other: Long | number | string ): boolean; + + /** + * Returns this Long modulo the specified. + */ + modulo( other: Long | number | string ): Long; + + /** + * Returns this Long modulo the specified. + */ + mod( other: Long | number | string ): Long; + + /** + * Returns the product of this and the specified Long. + */ + multiply( multiplier: Long | number | string ): Long; + + /** + * Returns the product of this and the specified Long. + */ + mul( multiplier: Long | number | string ): Long; + + /** + * Negates this Long's value. + */ + negate(): Long; + + /** + * Negates this Long's value. + */ + neg(): Long; + + /** + * Returns the bitwise NOT of this Long. + */ + not(): Long; + + /** + * Tests if this Long's value differs from the specified's. + */ + notEquals( other: Long | number | string ): boolean; + + /** + * Tests if this Long's value differs from the specified's. + */ + neq( other: Long | number | string ): boolean; + + /** + * Returns the bitwise OR of this Long and the specified. + */ + or( other: Long | number | string ): Long; + + /** + * Returns this Long with bits shifted to the left by the given amount. + */ + shiftLeft( numBits: number | Long ): Long; + + /** + * Returns this Long with bits shifted to the left by the given amount. + */ + shl( numBits: number | Long ): Long; + + /** + * Returns this Long with bits arithmetically shifted to the right by the given amount. + */ + shiftRight( numBits: number | Long ): Long; + + /** + * Returns this Long with bits arithmetically shifted to the right by the given amount. + */ + shr( numBits: number | Long ): Long; + + /** + * Returns this Long with bits logically shifted to the right by the given amount. + */ + shiftRightUnsigned( numBits: number | Long ): Long; + + /** + * Returns this Long with bits logically shifted to the right by the given amount. + */ + shru( numBits: number | Long ): Long; + + /** + * Returns the difference of this and the specified Long. + */ + subtract( subtrahend: number | Long ): Long; + + /** + * Returns the difference of this and the specified Long. + */ + sub( subtrahend: number | Long ): Long; + + /** + * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer. + */ + toInt(): number; + + /** + * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa). + */ + toNumber(): number; + + /** + * Converts this Long to signed. + */ + toSigned(): Long; + + /** + * Converts the Long to a string written in the specified radix. + */ + toString( radix?: number ): string; + + /** + * Converts this Long to unsigned. + */ + toUnsigned(): Long; + + /** + * Returns the bitwise XOR of this Long and the given one. + */ + xor( other: Long | number | string ): Long; +} + +declare module 'long' { + export = Long; +} From d6ff5f59462d27165cde268db5e400e18b02b1ce Mon Sep 17 00:00:00 2001 From: dencap Date: Thu, 12 Nov 2015 15:37:37 +0100 Subject: [PATCH 031/389] Fixed comments in header --- bytebuffer/bytebuffer.d.ts | 3 +++ bytebuffer/long.d.ts | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/bytebuffer/bytebuffer.d.ts b/bytebuffer/bytebuffer.d.ts index 6123ed50b..71782bcb1 100644 --- a/bytebuffer/bytebuffer.d.ts +++ b/bytebuffer/bytebuffer.d.ts @@ -1,5 +1,8 @@ // Type definitions for ByteBuffer.js 5.0.0 // Project: https://github.com/dcodeIO/bytebuffer.js +// Definitions by: SINTEF-9012 +// Definitions by: Denis Cappellin +// Definitions: https://github.com/borisyankov/DefinitelyTyped /// diff --git a/bytebuffer/long.d.ts b/bytebuffer/long.d.ts index f5825ffe7..1d2e9f388 100644 --- a/bytebuffer/long.d.ts +++ b/bytebuffer/long.d.ts @@ -1,5 +1,7 @@ -// Type definitions for ByteBuffer.js 5.0.0 -// Project: https://github.com/dcodeIO/bytebuffer.js +// Type definitions for long.js 3.0.2 +// Project: https://github.com/dcodeIO/long.js +// Definitions by: Denis Cappellin +// Definitions: https://github.com/borisyankov/DefinitelyTyped declare class Long { From b9536c14d6030b3b99261b35fc3602e54dd838e6 Mon Sep 17 00:00:00 2001 From: dencap Date: Thu, 12 Nov 2015 17:02:21 +0100 Subject: [PATCH 032/389] Fixed problems suggested by Travis --- bytebuffer/bytebuffer-tests.ts | 8 ++++++++ bytebuffer/bytebuffer.d.ts | 12 ++++++------ bytebuffer/long-tests.ts | 6 ++++++ 3 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 bytebuffer/bytebuffer-tests.ts create mode 100644 bytebuffer/long-tests.ts diff --git a/bytebuffer/bytebuffer-tests.ts b/bytebuffer/bytebuffer-tests.ts new file mode 100644 index 000000000..34db7368d --- /dev/null +++ b/bytebuffer/bytebuffer-tests.ts @@ -0,0 +1,8 @@ +/// + +import ByteBuffer = require("bytebuffer"); + +var bb = new ByteBuffer() + .writeIString("Hello world!") + .flip(); +console.log(bb.readIString()+" from bytebuffer.js"); \ No newline at end of file diff --git a/bytebuffer/bytebuffer.d.ts b/bytebuffer/bytebuffer.d.ts index 71782bcb1..bf1251e5f 100644 --- a/bytebuffer/bytebuffer.d.ts +++ b/bytebuffer/bytebuffer.d.ts @@ -1,10 +1,10 @@ -// Type definitions for ByteBuffer.js 5.0.0 +// Type definitions for bytebuffer.js 5.0.0 // Project: https://github.com/dcodeIO/bytebuffer.js -// Definitions by: SINTEF-9012 // Definitions by: Denis Cappellin // Definitions: https://github.com/borisyankov/DefinitelyTyped +// Definitions by: SINTEF-9012 -/// +/// declare class ByteBuffer { @@ -26,7 +26,7 @@ declare class ByteBuffer /** * Default no assertions flag of false. */ - static DEFAULT_NOASSERT + static DEFAULT_NOASSERT: boolean; /** * Little endian constant that can be used instead of its boolean value. Evaluates to true. @@ -51,7 +51,7 @@ declare class ByteBuffer /** * Metrics representing number of UTF8 characters.Evaluates to 1. */ - static METRICS_CHARS + static METRICS_CHARS: number; /** * ByteBuffer version. @@ -286,7 +286,7 @@ declare class ByteBuffer /** * Prints debug information about this ByteBuffer's contents. */ - printDebug( out?: ( string ) => void ): void; + printDebug( out?: ( text: string ) => void ): void; /** * Reads an 8bit signed integer. This is an alias of ByteBuffer#readInt8. diff --git a/bytebuffer/long-tests.ts b/bytebuffer/long-tests.ts new file mode 100644 index 000000000..35dd6d784 --- /dev/null +++ b/bytebuffer/long-tests.ts @@ -0,0 +1,6 @@ +/// + +import Long = require("long"); + +var longVal = new Long(0xFFFFFFFF, 0x7FFFFFFF); +console.log(longVal.toString()); \ No newline at end of file From ac7e775d9818945d4903a96b5021bdc46eb330b9 Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Thu, 12 Nov 2015 13:18:53 -0800 Subject: [PATCH 033/389] Make HTMLProps generic; add Intrinsic Attribute types --- react/react-global-tests.ts | 2 +- react/react.d.ts | 241 +++++++++++++++++++----------------- 2 files changed, 126 insertions(+), 117 deletions(-) diff --git a/react/react-global-tests.ts b/react/react-global-tests.ts index 7caf82fdf..4aabed4dc 100644 --- a/react/react-global-tests.ts +++ b/react/react-global-tests.ts @@ -206,7 +206,7 @@ var divStyle: React.CSSProperties = { // CSSProperties flex: "1 1 main-size", backgroundImage: "url('hello.png')" }; -var htmlAttr: React.HTMLProps = { +var htmlAttr: React.HTMLProps = { key: 36, ref: "htmlComponent", children: children, diff --git a/react/react.d.ts b/react/react.d.ts index e3d0f43f7..0a3b0fdfa 100644 --- a/react/react.d.ts +++ b/react/react.d.ts @@ -27,7 +27,7 @@ declare namespace __React { ref: string | ((element: Element) => any); } - interface ReactHTMLElement extends DOMElement { + interface ReactHTMLElement extends DOMElement> { ref: string | ((element: HTMLElement) => any); } @@ -51,7 +51,7 @@ declare namespace __React { (props?: P, ...children: ReactNode[]): DOMElement

; } - type HTMLFactory = DOMFactory; + type HTMLFactory = DOMFactory>; type SVGFactory = DOMFactory; // @@ -323,7 +323,7 @@ declare namespace __React { ref?: string | ((component: T) => any); } - interface HTMLProps extends HTMLAttributes, Props { + interface HTMLProps extends HTMLAttributes, Props { } interface SVGProps extends SVGAttributes, Props { @@ -887,122 +887,132 @@ declare namespace JSX { } interface ElementAttributesProperty { props: {}; } + interface IntrinsicAttributes { + key?: string | number; + } + + interface IntrinsicClassAttributes { + ref?: string | ((classInstance: T) => void); + } + interface IntrinsicElements { // HTML - a: React.HTMLProps; - abbr: React.HTMLProps; - address: React.HTMLProps; - area: React.HTMLProps; - article: React.HTMLProps; - aside: React.HTMLProps; - audio: React.HTMLProps; - b: React.HTMLProps; - base: React.HTMLProps; - bdi: React.HTMLProps; - bdo: React.HTMLProps; - big: React.HTMLProps; - blockquote: React.HTMLProps; - body: React.HTMLProps; - br: React.HTMLProps; - button: React.HTMLProps; - canvas: React.HTMLProps; - caption: React.HTMLProps; - cite: React.HTMLProps; - code: React.HTMLProps; - col: React.HTMLProps; - colgroup: React.HTMLProps; - data: React.HTMLProps; - datalist: React.HTMLProps; - dd: React.HTMLProps; - del: React.HTMLProps; - details: React.HTMLProps; - dfn: React.HTMLProps; - dialog: React.HTMLProps; - div: React.HTMLProps; - dl: React.HTMLProps; - dt: React.HTMLProps; - em: React.HTMLProps; - embed: React.HTMLProps; - fieldset: React.HTMLProps; - figcaption: React.HTMLProps; - figure: React.HTMLProps; - footer: React.HTMLProps; - form: React.HTMLProps; - h1: React.HTMLProps; - h2: React.HTMLProps; - h3: React.HTMLProps; - h4: React.HTMLProps; - h5: React.HTMLProps; - h6: React.HTMLProps; - head: React.HTMLProps; - header: React.HTMLProps; - hr: React.HTMLProps; - html: React.HTMLProps; - i: React.HTMLProps; - iframe: React.HTMLProps; - img: React.HTMLProps; - input: React.HTMLProps; - ins: React.HTMLProps; - kbd: React.HTMLProps; - keygen: React.HTMLProps; - label: React.HTMLProps; - legend: React.HTMLProps; - li: React.HTMLProps; - link: React.HTMLProps; - main: React.HTMLProps; - map: React.HTMLProps; - mark: React.HTMLProps; - menu: React.HTMLProps; - menuitem: React.HTMLProps; - meta: React.HTMLProps; - meter: React.HTMLProps; - nav: React.HTMLProps; - noscript: React.HTMLProps; - object: React.HTMLProps; - ol: React.HTMLProps; - optgroup: React.HTMLProps; - option: React.HTMLProps; - output: React.HTMLProps; - p: React.HTMLProps; - param: React.HTMLProps; - picture: React.HTMLProps; - pre: React.HTMLProps; - progress: React.HTMLProps; - q: React.HTMLProps; - rp: React.HTMLProps; - rt: React.HTMLProps; - ruby: React.HTMLProps; - s: React.HTMLProps; - samp: React.HTMLProps; - script: React.HTMLProps; - section: React.HTMLProps; - select: React.HTMLProps; - small: React.HTMLProps; - source: React.HTMLProps; - span: React.HTMLProps; - strong: React.HTMLProps; - style: React.HTMLProps; - sub: React.HTMLProps; - summary: React.HTMLProps; - sup: React.HTMLProps; - table: React.HTMLProps; - tbody: React.HTMLProps; - td: React.HTMLProps; - textarea: React.HTMLProps; - tfoot: React.HTMLProps; - th: React.HTMLProps; - thead: React.HTMLProps; - time: React.HTMLProps; - title: React.HTMLProps; - tr: React.HTMLProps; - track: React.HTMLProps; - u: React.HTMLProps; - ul: React.HTMLProps; - "var": React.HTMLProps; - video: React.HTMLProps; - wbr: React.HTMLProps; + a: React.HTMLProps; + abbr: React.HTMLProps; + address: React.HTMLProps; + area: React.HTMLProps; + article: React.HTMLProps; + aside: React.HTMLProps; + audio: React.HTMLProps; + b: React.HTMLProps; + base: React.HTMLProps; + bdi: React.HTMLProps; + bdo: React.HTMLProps; + big: React.HTMLProps; + blockquote: React.HTMLProps; + body: React.HTMLProps; + br: React.HTMLProps; + button: React.HTMLProps; + canvas: React.HTMLProps; + caption: React.HTMLProps; + cite: React.HTMLProps; + code: React.HTMLProps; + col: React.HTMLProps; + colgroup: React.HTMLProps; + data: React.HTMLProps; + datalist: React.HTMLProps; + dd: React.HTMLProps; + del: React.HTMLProps; + details: React.HTMLProps; + dfn: React.HTMLProps; + dialog: React.HTMLProps; + div: React.HTMLProps; + dl: React.HTMLProps; + dt: React.HTMLProps; + em: React.HTMLProps; + embed: React.HTMLProps; + fieldset: React.HTMLProps; + figcaption: React.HTMLProps; + figure: React.HTMLProps; + footer: React.HTMLProps; + form: React.HTMLProps; + h1: React.HTMLProps; + h2: React.HTMLProps; + h3: React.HTMLProps; + h4: React.HTMLProps; + h5: React.HTMLProps; + h6: React.HTMLProps; + head: React.HTMLProps; + header: React.HTMLProps; + hr: React.HTMLProps; + html: React.HTMLProps; + i: React.HTMLProps; + iframe: React.HTMLProps; + img: React.HTMLProps; + input: React.HTMLProps; + ins: React.HTMLProps; + kbd: React.HTMLProps; + keygen: React.HTMLProps; + label: React.HTMLProps; + legend: React.HTMLProps; + li: React.HTMLProps; + link: React.HTMLProps; + main: React.HTMLProps; + map: React.HTMLProps; + mark: React.HTMLProps; + menu: React.HTMLProps; + menuitem: React.HTMLProps; + meta: React.HTMLProps; + meter: React.HTMLProps; + nav: React.HTMLProps; + noscript: React.HTMLProps; + object: React.HTMLProps; + ol: React.HTMLProps; + optgroup: React.HTMLProps; + option: React.HTMLProps; + output: React.HTMLProps; + p: React.HTMLProps; + param: React.HTMLProps; + picture: React.HTMLProps; + pre: React.HTMLProps; + progress: React.HTMLProps; + q: React.HTMLProps; + rp: React.HTMLProps; + rt: React.HTMLProps; + ruby: React.HTMLProps; + s: React.HTMLProps; + samp: React.HTMLProps; + script: React.HTMLProps; + section: React.HTMLProps; + select: React.HTMLProps; + small: React.HTMLProps; + source: React.HTMLProps; + span: React.HTMLProps; + strong: React.HTMLProps; + style: React.HTMLProps; + sub: React.HTMLProps; + summary: React.HTMLProps; + sup: React.HTMLProps; + table: React.HTMLProps; + tbody: React.HTMLProps; + td: React.HTMLProps; + textarea: React.HTMLProps; + tfoot: React.HTMLProps; + th: React.HTMLProps; + thead: React.HTMLProps; + time: React.HTMLProps; + title: React.HTMLProps; + tr: React.HTMLProps; + track: React.HTMLProps; + u: React.HTMLProps; + ul: React.HTMLProps; + "var": React.HTMLProps; + video: React.HTMLProps; + wbr: React.HTMLProps; // SVG + svg: React.SVGProps; + circle: React.SVGProps; defs: React.SVGProps; ellipse: React.SVGProps; @@ -1018,7 +1028,6 @@ declare namespace JSX { radialGradient: React.SVGProps; rect: React.SVGProps; stop: React.SVGProps; - svg: React.SVGProps; text: React.SVGProps; tspan: React.SVGProps; } From f4e53f321c0994c553a3885d38a182c3ed77d5c7 Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Thu, 12 Nov 2015 15:20:28 -0800 Subject: [PATCH 034/389] Update react-tests.ts --- react/react-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react/react-tests.ts b/react/react-tests.ts index ef505f85e..90f9a237e 100644 --- a/react/react-tests.ts +++ b/react/react-tests.ts @@ -281,7 +281,7 @@ var divStyle: React.CSSProperties = { // CSSProperties flex: "1 1 main-size", backgroundImage: "url('hello.png')" }; -var htmlAttr: React.HTMLProps = { +var htmlAttr: React.HTMLProps = { key: 36, ref: "htmlComponent", children: children, From b9a05cb4c96ae9961bbc41fbd7df9105c3b8fbd0 Mon Sep 17 00:00:00 2001 From: Luigi Trabacchin Date: Fri, 13 Nov 2015 10:40:30 +0100 Subject: [PATCH 035/389] removed unused enum --- .../bootstrap.v3.datetimepicker.d.ts | 7 ------- 1 file changed, 7 deletions(-) diff --git a/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker.d.ts b/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker.d.ts index 0db3f7b3f..fb0b1b389 100644 --- a/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker.d.ts +++ b/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker.d.ts @@ -13,13 +13,6 @@ /// declare module BootstrapV3DatetimePicker { - enum ViewMode { - 'days', - 'months', - 'years', - 'decades' - } - interface DatetimepickerChangeEventObject extends DatetimepickerEventObject { oldDate: moment.Moment; } From f2ae460e1751bb6668d291d4eb9255f047dd0ac5 Mon Sep 17 00:00:00 2001 From: Tadeusz Hucal Date: Fri, 13 Nov 2015 19:24:04 +0100 Subject: [PATCH 036/389] Update module name from ng to angular --- restangular/restangular-tests.ts | 2 +- restangular/restangular.d.ts | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/restangular/restangular-tests.ts b/restangular/restangular-tests.ts index 9b5a9c30b..dba7099da 100644 --- a/restangular/restangular-tests.ts +++ b/restangular/restangular-tests.ts @@ -50,7 +50,7 @@ myApp.config((RestangularProvider: restangular.IProvider) => { }); -interface MyAppScope extends ng.IScope { +interface MyAppScope extends angular.IScope { accounts: string[]; allAccounts: any[]; account: any; diff --git a/restangular/restangular.d.ts b/restangular/restangular.d.ts index b407cefd4..db17e51cf 100644 --- a/restangular/restangular.d.ts +++ b/restangular/restangular.d.ts @@ -16,13 +16,13 @@ declare module 'restangular' { declare module restangular { - interface IPromise extends ng.IPromise { + interface IPromise extends angular.IPromise { call(methodName: string, params?: any): IPromise; get(fieldName: string): IPromise; $object: T; } - interface ICollectionPromise extends ng.IPromise { + interface ICollectionPromise extends angular.IPromise { push(object: any): ICollectionPromise; call(methodName: string, params?: any): ICollectionPromise; get(fieldName: string): ICollectionPromise; @@ -49,14 +49,14 @@ declare module restangular { addElementTransformer(route: string, isCollection: boolean, transformer: Function): void; setTransformOnlyServerElements(active: boolean): void; setOnElemRestangularized(callback: (elem: any, isCollection: boolean, what: string, restangular: IService) => any): void; - setResponseInterceptor(responseInterceptor: (data: any, operation: string, what: string, url: string, response: IResponse, deferred: ng.IDeferred) => any): void; - setResponseExtractor(responseInterceptor: (data: any, operation: string, what: string, url: string, response: IResponse, deferred: ng.IDeferred) => any): void; - addResponseInterceptor(responseInterceptor: (data: any, operation: string, what: string, url: string, response: IResponse, deferred: ng.IDeferred) => any): void; + setResponseInterceptor(responseInterceptor: (data: any, operation: string, what: string, url: string, response: IResponse, deferred: angular.IDeferred) => any): void; + setResponseExtractor(responseInterceptor: (data: any, operation: string, what: string, url: string, response: IResponse, deferred: angular.IDeferred) => any): void; + addResponseInterceptor(responseInterceptor: (data: any, operation: string, what: string, url: string, response: IResponse, deferred: angular.IDeferred) => any): void; setRequestInterceptor(requestInterceptor: (element: any, operation: string, what: string, url: string) => any): void; addRequestInterceptor(requestInterceptor: (element: any, operation: string, what: string, url: string) => any): void; - setFullRequestInterceptor(fullRequestInterceptor: (element: any, operation: string, what: string, url: string, headers: any, params: any, httpConfig: ng.IRequestShortcutConfig) => {element: any; headers: any; params: any}): void; - addFullRequestInterceptor(requestInterceptor: (element: any, operation: string, what: string, url: string, headers: any, params: any, httpConfig: ng.IRequestShortcutConfig) => {headers: any; params: any; element: any; httpConfig: ng.IRequestShortcutConfig}): void; - setErrorInterceptor(errorInterceptor: (response: IResponse, deferred: ng.IDeferred) => any): void; + setFullRequestInterceptor(fullRequestInterceptor: (element: any, operation: string, what: string, url: string, headers: any, params: any, httpConfig: angular.IRequestShortcutConfig) => {element: any; headers: any; params: any}): void; + addFullRequestInterceptor(requestInterceptor: (element: any, operation: string, what: string, url: string, headers: any, params: any, httpConfig: angular.IRequestShortcutConfig) => {headers: any; params: any; element: any; httpConfig: angular.IRequestShortcutConfig}): void; + setErrorInterceptor(errorInterceptor: (response: IResponse, deferred: angular.IDeferred) => any): void; setRestangularFields(fields: {[fieldName: string]: string}): void; setMethodOverriders(overriders: string[]): void; setJsonp(jsonp: boolean): void; @@ -113,7 +113,7 @@ declare module restangular { clone(): IElement; plain(): any; plain(): T; - withHttpConfig(httpConfig: ng.IRequestShortcutConfig): IElement; + withHttpConfig(httpConfig: angular.IRequestShortcutConfig): IElement; save(queryParams?: any, headers?: any): IPromise; getRestangularUrl(): string; } @@ -128,7 +128,7 @@ declare module restangular { options(queryParams?: any, headers?: any): IPromise; patch(queryParams?: any, headers?: any): IPromise; putElement(idx: any, params: any, headers: any): IPromise; - withHttpConfig(httpConfig: ng.IRequestShortcutConfig): ICollection; + withHttpConfig(httpConfig: angular.IRequestShortcutConfig): ICollection; clone(): ICollection; plain(): any; plain(): T[]; From f297bc50a4310c58bde65a6de686ab840dbee3e3 Mon Sep 17 00:00:00 2001 From: dreamair Date: Fri, 13 Nov 2015 22:17:05 +0100 Subject: [PATCH 037/389] Update some options for gulp-typescript 2.9.2. --- gulp-typescript/gulp-typescript.d.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/gulp-typescript/gulp-typescript.d.ts b/gulp-typescript/gulp-typescript.d.ts index 7b16d0a5a..f85245a30 100644 --- a/gulp-typescript/gulp-typescript.d.ts +++ b/gulp-typescript/gulp-typescript.d.ts @@ -20,10 +20,21 @@ declare module "gulp-typescript" { noImplicitAny?: boolean; noLib?: boolean; removeComments?: boolean; - sourceRoot?: string; + sourceRoot?: string; // use gulp-sourcemaps instead sortOutput?: boolean; target?: string; typescript?: any; + outFile?: string; + outDir?: string; + suppressImplicitAnyIndexErrors?: boolean; + jsx?: string; + declaration?: boolean; + emitDecoratorMetadata?: boolean; + experimentalAsyncFunctions?: boolean; + moduleResolution?: string; + noEmitHelpers?: boolean; + preserveConstEnums?: boolean; + isolatedModules?: boolean; } interface Project { @@ -51,4 +62,4 @@ declare module "gulp-typescript" { } export = GulpTypescript; -} \ No newline at end of file +} From 6fa38f480230cba63f82c6d2d2f634846ae95f55 Mon Sep 17 00:00:00 2001 From: Ali Taheri Date: Sat, 7 Nov 2015 12:00:23 +0330 Subject: [PATCH 038/389] [material-ui] added missing style prop and isRtl on theme --- material-ui/material-ui.d.ts | 49 ++++++++++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 8 deletions(-) diff --git a/material-ui/material-ui.d.ts b/material-ui/material-ui.d.ts index c31925d6f..f90e6f5d9 100644 --- a/material-ui/material-ui.d.ts +++ b/material-ui/material-ui.d.ts @@ -158,6 +158,7 @@ declare namespace __MaterialUI { interface CardActionsProps extends React.Props { expandable?: boolean; showExpandableButton?: boolean; + style?: React.CSSProperties; } export class CardActions extends React.Component { } @@ -165,6 +166,7 @@ declare namespace __MaterialUI { interface CardExpandableProps extends React.Props { onExpanding?: (isExpanded: boolean) => void; expanded?: boolean; + style?: React.CSSProperties; } export class CardExpandable extends React.Component { } @@ -288,6 +290,7 @@ declare namespace __MaterialUI { size?: number; color?: string; innerStyle?: React.CSSProperties; + style?: React.CSSProperties; } export class CircularProgress extends React.Component { @@ -351,6 +354,7 @@ declare namespace __MaterialUI { actionFocus?: string; autoDetectWindowHeight?: boolean; autoScrollBodyContent?: boolean; + style?: React.CSSProperties; bodyStyle?: React.CSSProperties; contentClassName?: string; contentInnerStyle?: React.CSSProperties; @@ -502,6 +506,7 @@ declare namespace __MaterialUI { menuItemClassName?: string; menuItemClassNameSubheader?: string; menuItemClassNameLink?: string; + style?: React.CSSProperties; } export class LeftNav extends React.Component { } @@ -521,6 +526,7 @@ declare namespace __MaterialUI { subheader?: string; subheaderStyle?: React.CSSProperties; zDepth?: number; + style?: React.CSSProperties; } export class List extends React.Component { } @@ -552,6 +558,7 @@ declare namespace __MaterialUI { primaryText?: React.ReactNode; secondaryText?: React.ReactNode; secondaryTextLines?: number; + style?: React.CSSProperties; } export class ListItem extends React.Component { } @@ -577,6 +584,7 @@ declare namespace __MaterialUI { toggle?: boolean; onTouchTap?: TouchTapEventHandler; isDisabled?: boolean; + style?: React.CSSProperties; // for MenuItems.Types.NESTED items?: MenuItemRequest[]; @@ -593,6 +601,7 @@ declare namespace __MaterialUI { active?: boolean; onItemTap?: ItemTapEventHandler; menuItemStyle?: React.CSSProperties; + style?: React.CSSProperties; } export class Menu extends React.Component { } @@ -612,6 +621,7 @@ declare namespace __MaterialUI { onToggle?: (e: React.MouseEvent, key: number, toggled: boolean) => void; selected?: boolean; active?: boolean; + style?: React.CSSProperties; } export class MenuItem extends React.Component { static Types: { LINK: string, SUBHEADER: string, NESTED: string, } @@ -705,6 +715,7 @@ declare namespace __MaterialUI { size?: number; status?: string; top: number; + style?: React.CSSProperties; } export class RefreshIndicator extends React.Component { } @@ -713,12 +724,14 @@ declare namespace __MaterialUI { interface CircleRippleProps extends React.Props { color?: string; opacity?: number; + style?: React.CSSProperties; } export class CircleRipple extends React.Component { } interface FocusRippleProps extends React.Props { color?: string; + style?: React.CSSProperties; innerStyle?: React.CSSProperties; opacity?: number; show?: boolean; @@ -730,6 +743,7 @@ declare namespace __MaterialUI { centerRipple?: boolean; color?: string; opacity?: number; + style?: React.CSSProperties; } export class TouchRipple extends React.Component { } @@ -782,6 +796,7 @@ declare namespace __MaterialUI { required?: boolean; step?: number; value?: number; + style?: React.CSSProperties; } export class Slider extends React.Component { } @@ -790,6 +805,7 @@ declare namespace __MaterialUI { color?: string; hoverColor?: string; viewBox?: string; + style?: React.CSSProperties; } export class SvgIcon extends React.Component { } @@ -1037,6 +1053,7 @@ declare namespace __MaterialUI { backgroundColor?: string; borderColor?: string; }; + isRtl: boolean; } interface RawTheme { @@ -1064,7 +1081,7 @@ declare namespace __MaterialUI { export var Transitions: Transitions; interface Typography { - textFullBlack:string; + textFullBlack: string; textDarkBlack: string; textLightBlack: string; textMinBlack: string; @@ -1093,6 +1110,7 @@ declare namespace __MaterialUI { onShow?: () => void; onDismiss?: () => void; openOnMount?: boolean; + style?: React.CSSProperties; } export class Snackbar extends React.Component { } @@ -1103,6 +1121,7 @@ declare namespace __MaterialUI { value?: string; selected?: boolean; width?: string; + style?: React.CSSProperties; // Called by Tabs component onActive?: (tab: Tab) => void; @@ -1139,8 +1158,9 @@ declare namespace __MaterialUI { onCellHoverExit?: (row: number, column: number) => void; onRowHover?: (row: number) => void; onRowHoverExit?: (row: number) => void; - onRowSelection?: (selectedRows: number[])=> void; + onRowSelection?: (selectedRows: number[]) => void; selectable?: boolean; + style?: React.CSSProperties; } export class Table extends React.Component { } @@ -1155,17 +1175,19 @@ declare namespace __MaterialUI { onCellHoverExit?: (row: number, column: number) => void; onRowHover?: (row: number) => void; onRowHoverExit?: (row: number) => void; - onRowSelection?: (selectedRows: number[])=> void; + onRowSelection?: (selectedRows: number[]) => void; preScanRows?: boolean; selectable?: boolean; showRowHover?: boolean; stripedRows?: boolean; + style?: React.CSSProperties; } export class TableBody extends React.Component { } interface TableFooterProps extends React.Props { adjustForCheckbox?: boolean; + style?: React.CSSProperties; } export class TableFooter extends React.Component { } @@ -1176,15 +1198,17 @@ declare namespace __MaterialUI { enableSelectAll?: boolean; onSelectAll?: (event: React.MouseEvent) => void; selectAllSelected?: boolean; + style?: React.CSSProperties; } export class TableHeader extends React.Component { } interface TableHeaderColumnProps extends React.Props { columnNumber?: number; - onClick?: (e: React.MouseEvent, column: number) => void; + onClick?: (e: React.MouseEvent, column: number) => void; tooltip?: string; tooltipStyle?: React.CSSProperties; + style?: React.CSSProperties; } export class TableHeaderColumn extends React.Component { } @@ -1202,6 +1226,7 @@ declare namespace __MaterialUI { selectable?: boolean; selected?: boolean; striped?: boolean; + style?: React.CSSProperties; } export class TableRow extends React.Component { } @@ -1211,6 +1236,7 @@ declare namespace __MaterialUI { hoverable?: boolean; onHover?: (e: React.MouseEvent, column: number) => void; onHoverExit?: (e: React.MouseEvent, column: number) => void; + style?: React.CSSProperties; } export class TableRowColumn extends React.Component { } @@ -1289,23 +1315,27 @@ declare namespace __MaterialUI { namespace Toolbar { interface ToolbarProps extends React.Props { + style?: React.CSSProperties; } export class Toolbar extends React.Component { } interface ToolbarGroupProps extends React.Props { float?: string; + style?: React.CSSProperties; } export class ToolbarGroup extends React.Component { } interface ToolbarSeparatorProps extends React.Props { + style?: React.CSSProperties; } export class ToolbarSeparator extends React.Component { } interface ToolbarTitleProps extends React.HTMLAttributes, React.Props { - text?: string; + text?: string; + style?: React.CSSProperties; } export class ToolbarTitle extends React.Component { } @@ -1327,9 +1357,9 @@ declare namespace __MaterialUI { color: string; } interface ColorManipulator { - fade(color: string, amount: string|number): string; - lighten(color: string, amount: string|number): string; - darken(color: string, amount: string|number): string; + fade(color: string, amount: string | number): string; + lighten(color: string, amount: string | number): string; + darken(color: string, amount: string | number): string; contrastRatio(background: string, foreground: string): number; contrastRatioLevel(background: string, foreground: string): ContrastLevel; } @@ -1421,6 +1451,7 @@ declare namespace __MaterialUI { value?: string | Array; width?: string | number; touchTapCloseDelay?: number; + style?: React.CSSProperties; onKeyboardFocus?: React.FocusEventHandler; onItemTouchTap?: (e: TouchTapEvent, item: React.ReactElement) => void; @@ -1440,6 +1471,7 @@ declare namespace __MaterialUI { value?: string | Array; width?: string | number; zDepth?: number; + style?: React.CSSProperties; } export class Menu extends React.Component{ } @@ -1455,6 +1487,7 @@ declare namespace __MaterialUI { rightIcon?: React.ReactElement; secondaryText?: React.ReactNode; value?: string; + style?: React.CSSProperties; onEscKeyDown?: React.KeyboardEventHandler; onItemTouchTap?: (e: TouchTapEvent, item: React.ReactElement) => void; From ec2915345b5e5bd7817c09b6094810d3f26ffc6c Mon Sep 17 00:00:00 2001 From: dencap Date: Mon, 16 Nov 2015 15:15:58 +0100 Subject: [PATCH 039/389] Removed long.js files from folder bytebuffer, fixed some function signatures and updated the version of long available in folder long --- bytebuffer/bytebuffer.d.ts | 2 +- long/long-tests.ts | 2 +- long/long.d.ts | 405 +++++++++++++++++++++++++++++++------ 3 files changed, 343 insertions(+), 66 deletions(-) diff --git a/bytebuffer/bytebuffer.d.ts b/bytebuffer/bytebuffer.d.ts index bf1251e5f..0bfaed7c1 100644 --- a/bytebuffer/bytebuffer.d.ts +++ b/bytebuffer/bytebuffer.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped // Definitions by: SINTEF-9012 -/// +/// declare class ByteBuffer { diff --git a/long/long-tests.ts b/long/long-tests.ts index f70835f66..928cc9453 100644 --- a/long/long-tests.ts +++ b/long/long-tests.ts @@ -2,7 +2,7 @@ import Long = require("long"); -var val: dcodeIO.Long; +var val: Long; var n: number = 42; var b: boolean = true; var s: string = "1337"; diff --git a/long/long.d.ts b/long/long.d.ts index 32d773b9d..f059ff565 100644 --- a/long/long.d.ts +++ b/long/long.d.ts @@ -1,75 +1,352 @@ -// Type definitions for Long.js v2.2.5 -// Project: https://github.com/dcodeIO/Long.js -// Definitions by: Peter Kooijmans +// Type definitions for long.js 3.0.2 +// Project: https://github.com/dcodeIO/long.js +// Definitions by: Denis Cappellin // Definitions: https://github.com/borisyankov/DefinitelyTyped +// Definitions by: Peter Kooijmans -declare module dcodeIO { - interface LongStatic { - new (low: number, high?: number, unsigned?: boolean): Long; +declare class Long +{ + /** + * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as signed integers. See the from* functions below for more convenient ways of constructing Longs. + */ + constructor( low: number, high?: number, unsigned?: boolean ); - MAX_UNSIGNED_VALUE: Long; - MAX_VALUE: Long; - MIN_VALUE: Long; - NEG_ONE: Long; - ONE: Long; - UONE: Long; - UZERO: Long; - ZERO: Long; + /** + * Maximum unsigned value. + */ + static MAX_UNSIGNED_VALUE: Long; - fromBits(lowBits: number, highBits: number, unsigned?: boolean): Long; - fromInt(value: number, unsigned?: boolean): Long; - fromNumber(value: number, unsigned?: boolean): Long; - fromString(str: string, unsigned?: boolean | number, radix?: number): Long; - fromValue(val: Long | number | string): Long; - isLong(obj: any): boolean; - } + /** + * Maximum signed value. + */ + static MAX_VALUE: Long; - interface Long { - high: number; - low: number; - unsigned: boolean; + /** + * Minimum signed value. + */ + static MIN_VALUE: Long; - add(other: Long | number | string): Long; - and(other: Long | number | string): Long; - compare(other: Long | number | string): number; - div(divisor: Long | number | string): Long; - equals(other: Long | number | string): boolean; - getHighBits(): number; - getHighBitsUnsigned(): number; - getLowBits(): number; - getLowBitsUnsigned(): number; - getNumBitsAbs(): number; - greaterThan(other: Long | number | string): boolean; - greaterThanOrEqual(other: Long | number | string): boolean; - isEven(): boolean; - isNegative(): boolean; - isOdd(): boolean; - isPositive(): boolean; - isZero(): boolean; - lessThan(other: Long | number | string): boolean; - lessThanOrEqual(other: Long | number | string): boolean; - modulo(divisor: Long | number | string): Long; - multiply(multiplier: Long | number | string): Long; - negate(): Long; - not(): Long; - notEquals(other: Long | number | string): boolean; - or(other: Long | number | string): Long; - shiftLeft(numBits: number | Long): Long; - shiftRight(numBits: number | Long): Long; - shiftRightUnsigned(numBits: number | Long): Long; - subtract(other: Long | number | string): Long; - toInt(): number; - toNumber(): number; - toSigned(): Long; - toString(radix?: number): string; - toUnsigned(): Long; - xor(other: Long | number | string): Long; - } + /** + * Signed negative one. + */ + static NEG_ONE: Long; - export var Long: LongStatic; + /** + * Signed one. + */ + static ONE: Long; + + /** + * Unsigned one. + */ + static UONE: Long; + + /** + * Unsigned zero. + */ + static UZERO: Long; + + /** + * Signed zero + */ + static ZERO: Long; + + /** + * The high 32 bits as a signed value. + */ + high: number; + + /** + * The low 32 bits as a signed value. + */ + low: number; + + /** + * Whether unsigned or not. + */ + unsigned: boolean; + + /** + * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is assumed to use 32 bits. + */ + static fromBits( lowBits:number, highBits:number, unsigned?:boolean ): Long; + + /** + * Returns a Long representing the given 32 bit integer value. + */ + static fromInt( value: number, unsigned?: boolean ): Long; + + /** + * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned. + */ + static fromNumber( value: number, unsigned?: boolean ): Long; + + /** + * Returns a Long representation of the given string, written using the specified radix. + */ + static fromString( str: string, unsigned?: boolean | number, radix?: number ): Long; + + /** + * Tests if the specified object is a Long. + */ + static isLong( obj: any ): boolean; + + /** + * Converts the specified value to a Long. + */ + static fromValue( val: Long | number | string | {low: number, high: number, unsigned: boolean} ): Long; + + /** + * Returns the sum of this and the specified Long. + */ + add( addend: number | Long | string ): Long; + + /** + * Returns the bitwise AND of this Long and the specified. + */ + and( other: Long | number | string ): Long; + + /** + * Compares this Long's value with the specified's. + */ + compare( other: Long | number | string ): number; + + /** + * Compares this Long's value with the specified's. + */ + comp( other: Long | number | string ): number; + + /** + * Returns this Long divided by the specified. + */ + divide( divisor: Long | number | string ): Long; + + /** + * Returns this Long divided by the specified. + */ + div( divisor: Long | number | string ): Long; + + /** + * Tests if this Long's value equals the specified's. + */ + equals( other: Long | number | string ): boolean; + + /** + * Tests if this Long's value equals the specified's. + */ + eq( other: Long | number | string ): boolean; + + /** + * Gets the high 32 bits as a signed integer. + */ + getHighBits(): number; + + /** + * Gets the high 32 bits as an unsigned integer. + */ + getHighBitsUnsigned(): number; + + /** + * Gets the low 32 bits as a signed integer. + */ + getLowBits(): number; + + /** + * Gets the low 32 bits as an unsigned integer. + */ + getLowBitsUnsigned(): number; + + /** + * Gets the number of bits needed to represent the absolute value of this Long. + */ + getNumBitsAbs(): number; + + /** + * Tests if this Long's value is greater than the specified's. + */ + greaterThan( other: Long | number | string ): boolean; + + /** + * Tests if this Long's value is greater than the specified's. + */ + gt( other: Long | number | string ): boolean; + + /** + * Tests if this Long's value is greater than or equal the specified's. + */ + greaterThanOrEqual( other: Long | number | string ): boolean; + + /** + * Tests if this Long's value is greater than or equal the specified's. + */ + gte( other: Long | number | string ): boolean; + + /** + * Tests if this Long's value is even. + */ + isEven(): boolean; + + /** + * Tests if this Long's value is negative. + */ + isNegative(): boolean; + + /** + * Tests if this Long's value is odd. + */ + isOdd(): boolean; + + /** + * Tests if this Long's value is positive. + */ + isPositive(): boolean; + + /** + * Tests if this Long's value equals zero. + */ + isZero(): boolean; + + /** + * Tests if this Long's value is less than the specified's. + */ + lessThan( other: Long | number | string ): boolean; + + /** + * Tests if this Long's value is less than the specified's. + */ + lt( other: Long | number | string ): boolean; + + /** + * Tests if this Long's value is less than or equal the specified's. + */ + lessThanOrEqual( other: Long | number | string ): boolean; + + /** + * Tests if this Long's value is less than or equal the specified's. + */ + lte( other: Long | number | string ): boolean; + + /** + * Returns this Long modulo the specified. + */ + modulo( other: Long | number | string ): Long; + + /** + * Returns this Long modulo the specified. + */ + mod( other: Long | number | string ): Long; + + /** + * Returns the product of this and the specified Long. + */ + multiply( multiplier: Long | number | string ): Long; + + /** + * Returns the product of this and the specified Long. + */ + mul( multiplier: Long | number | string ): Long; + + /** + * Negates this Long's value. + */ + negate(): Long; + + /** + * Negates this Long's value. + */ + neg(): Long; + + /** + * Returns the bitwise NOT of this Long. + */ + not(): Long; + + /** + * Tests if this Long's value differs from the specified's. + */ + notEquals( other: Long | number | string ): boolean; + + /** + * Tests if this Long's value differs from the specified's. + */ + neq( other: Long | number | string ): boolean; + + /** + * Returns the bitwise OR of this Long and the specified. + */ + or( other: Long | number | string ): Long; + + /** + * Returns this Long with bits shifted to the left by the given amount. + */ + shiftLeft( numBits: number | Long ): Long; + + /** + * Returns this Long with bits shifted to the left by the given amount. + */ + shl( numBits: number | Long ): Long; + + /** + * Returns this Long with bits arithmetically shifted to the right by the given amount. + */ + shiftRight( numBits: number | Long ): Long; + + /** + * Returns this Long with bits arithmetically shifted to the right by the given amount. + */ + shr( numBits: number | Long ): Long; + + /** + * Returns this Long with bits logically shifted to the right by the given amount. + */ + shiftRightUnsigned( numBits: number | Long ): Long; + + /** + * Returns this Long with bits logically shifted to the right by the given amount. + */ + shru( numBits: number | Long ): Long; + + /** + * Returns the difference of this and the specified Long. + */ + subtract( subtrahend: number | Long | string ): Long; + + /** + * Returns the difference of this and the specified Long. + */ + sub( subtrahend: number | Long |string ): Long; + + /** + * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer. + */ + toInt(): number; + + /** + * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa). + */ + toNumber(): number; + + /** + * Converts this Long to signed. + */ + toSigned(): Long; + + /** + * Converts the Long to a string written in the specified radix. + */ + toString( radix?: number ): string; + + /** + * Converts this Long to unsigned. + */ + toUnsigned(): Long; + + /** + * Returns the bitwise XOR of this Long and the given one. + */ + xor( other: Long | number | string ): Long; } -declare module "long" { - var Long: dcodeIO.LongStatic; +declare module 'long' { export = Long; } \ No newline at end of file From bf9c2fe2143a2b0a874b0589dee819773925b3a5 Mon Sep 17 00:00:00 2001 From: dencap Date: Mon, 16 Nov 2015 16:44:35 +0100 Subject: [PATCH 040/389] Removed long.js filed from bytebuffer folder and restored original author name in long.js --- bytebuffer/long-tests.ts | 6 - bytebuffer/long.d.ts | 351 --------------------------------------- long/long.d.ts | 4 +- 3 files changed, 2 insertions(+), 359 deletions(-) delete mode 100644 bytebuffer/long-tests.ts delete mode 100644 bytebuffer/long.d.ts diff --git a/bytebuffer/long-tests.ts b/bytebuffer/long-tests.ts deleted file mode 100644 index 35dd6d784..000000000 --- a/bytebuffer/long-tests.ts +++ /dev/null @@ -1,6 +0,0 @@ -/// - -import Long = require("long"); - -var longVal = new Long(0xFFFFFFFF, 0x7FFFFFFF); -console.log(longVal.toString()); \ No newline at end of file diff --git a/bytebuffer/long.d.ts b/bytebuffer/long.d.ts deleted file mode 100644 index 1d2e9f388..000000000 --- a/bytebuffer/long.d.ts +++ /dev/null @@ -1,351 +0,0 @@ -// Type definitions for long.js 3.0.2 -// Project: https://github.com/dcodeIO/long.js -// Definitions by: Denis Cappellin -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -declare class Long -{ - /** - * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as signed integers. See the from* functions below for more convenient ways of constructing Longs. - */ - constructor( low: number, high?: number, unsigned?: number ); - - /** - * Maximum unsigned value. - */ - static MAX_UNSIGNED_VALUE: Long; - - /** - * Maximum signed value. - */ - static MAX_VALUE: Long; - - /** - * Minimum signed value. - */ - static MIN_VALUE: Long; - - /** - * Signed negative one. - */ - static NEG_ONE: Long; - - /** - * Signed one. - */ - static ONE: Long; - - /** - * Unsigned one. - */ - static UONE: Long; - - /** - * Unsigned zero. - */ - static UZERO: Long; - - /** - * Signed zero - */ - static ZERO: Long; - - /** - * The high 32 bits as a signed value. - */ - high: number; - - /** - * The low 32 bits as a signed value. - */ - low: number; - - /** - * Whether unsigned or not. - */ - unsigned: number; - - /** - * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is assumed to use 32 bits. - */ - static fromBits( lowBits:number, highBits:number, unsigned?:boolean ): Long; - - /** - * Returns a Long representing the given 32 bit integer value. - */ - static fromInt( value: number, unsigned?: boolean ): Long; - - /** - * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned. - */ - static fromNumber( value: number, unsigned?: boolean ): Long; - - /** - * Returns a Long representation of the given string, written using the specified radix. - */ - static fromString( str: string, unsigned?: boolean | number, radix?: number ): Long; - - /** - * Tests if the specified object is a Long. - */ - static isLong( obj: any ): boolean; - - /** - * Converts the specified value to a Long. - */ - static fromValue( val: Long | number | string | {low: number, high: number, unsigned: boolean} ): Long; - - /** - * Returns the sum of this and the specified Long. - */ - add( addend: number | Long | string ): Long; - - /** - * Returns the bitwise AND of this Long and the specified. - */ - and( other: Long | number | string ): Long; - - /** - * Compares this Long's value with the specified's. - */ - compare( other: Long | number | string ): number; - - /** - * Compares this Long's value with the specified's. - */ - comp( other: Long | number | string ): number; - - /** - * Returns this Long divided by the specified. - */ - divide( divisor: Long | number | string ): Long; - - /** - * Returns this Long divided by the specified. - */ - div( divisor: Long | number | string ): Long; - - /** - * Tests if this Long's value equals the specified's. - */ - equals( other: Long | number | string ): boolean; - - /** - * Tests if this Long's value equals the specified's. - */ - eq( other: Long | number | string ): boolean; - - /** - * Gets the high 32 bits as a signed integer. - */ - getHighBits(): number; - - /** - * Gets the high 32 bits as an unsigned integer. - */ - getHighBitsUnsigned(): number; - - /** - * Gets the low 32 bits as a signed integer. - */ - getLowBits(): number; - - /** - * Gets the low 32 bits as an unsigned integer. - */ - getLowBitsUnsigned(): number; - - /** - * Gets the number of bits needed to represent the absolute value of this Long. - */ - getNumBitsAbs(): number; - - /** - * Tests if this Long's value is greater than the specified's. - */ - greaterThan( other: Long | number | string ): boolean; - - /** - * Tests if this Long's value is greater than the specified's. - */ - gt( other: Long | number | string ): boolean; - - /** - * Tests if this Long's value is greater than or equal the specified's. - */ - greaterThanOrEqual( other: Long | number | string ): boolean; - - /** - * Tests if this Long's value is greater than or equal the specified's. - */ - gte( other: Long | number | string ): boolean; - - /** - * Tests if this Long's value is even. - */ - isEven(): boolean; - - /** - * Tests if this Long's value is negative. - */ - isNegative(): boolean; - - /** - * Tests if this Long's value is odd. - */ - isOdd(): boolean; - - /** - * Tests if this Long's value is positive. - */ - isPositive(): boolean; - - /** - * Tests if this Long's value equals zero. - */ - isZero(): boolean; - - /** - * Tests if this Long's value is less than the specified's. - */ - lessThan( other: Long | number | string ): boolean; - - /** - * Tests if this Long's value is less than the specified's. - */ - lt( other: Long | number | string ): boolean; - - /** - * Tests if this Long's value is less than or equal the specified's. - */ - lessThanOrEqual( other: Long | number | string ): boolean; - - /** - * Tests if this Long's value is less than or equal the specified's. - */ - lte( other: Long | number | string ): boolean; - - /** - * Returns this Long modulo the specified. - */ - modulo( other: Long | number | string ): Long; - - /** - * Returns this Long modulo the specified. - */ - mod( other: Long | number | string ): Long; - - /** - * Returns the product of this and the specified Long. - */ - multiply( multiplier: Long | number | string ): Long; - - /** - * Returns the product of this and the specified Long. - */ - mul( multiplier: Long | number | string ): Long; - - /** - * Negates this Long's value. - */ - negate(): Long; - - /** - * Negates this Long's value. - */ - neg(): Long; - - /** - * Returns the bitwise NOT of this Long. - */ - not(): Long; - - /** - * Tests if this Long's value differs from the specified's. - */ - notEquals( other: Long | number | string ): boolean; - - /** - * Tests if this Long's value differs from the specified's. - */ - neq( other: Long | number | string ): boolean; - - /** - * Returns the bitwise OR of this Long and the specified. - */ - or( other: Long | number | string ): Long; - - /** - * Returns this Long with bits shifted to the left by the given amount. - */ - shiftLeft( numBits: number | Long ): Long; - - /** - * Returns this Long with bits shifted to the left by the given amount. - */ - shl( numBits: number | Long ): Long; - - /** - * Returns this Long with bits arithmetically shifted to the right by the given amount. - */ - shiftRight( numBits: number | Long ): Long; - - /** - * Returns this Long with bits arithmetically shifted to the right by the given amount. - */ - shr( numBits: number | Long ): Long; - - /** - * Returns this Long with bits logically shifted to the right by the given amount. - */ - shiftRightUnsigned( numBits: number | Long ): Long; - - /** - * Returns this Long with bits logically shifted to the right by the given amount. - */ - shru( numBits: number | Long ): Long; - - /** - * Returns the difference of this and the specified Long. - */ - subtract( subtrahend: number | Long ): Long; - - /** - * Returns the difference of this and the specified Long. - */ - sub( subtrahend: number | Long ): Long; - - /** - * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer. - */ - toInt(): number; - - /** - * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa). - */ - toNumber(): number; - - /** - * Converts this Long to signed. - */ - toSigned(): Long; - - /** - * Converts the Long to a string written in the specified radix. - */ - toString( radix?: number ): string; - - /** - * Converts this Long to unsigned. - */ - toUnsigned(): Long; - - /** - * Returns the bitwise XOR of this Long and the given one. - */ - xor( other: Long | number | string ): Long; -} - -declare module 'long' { - export = Long; -} diff --git a/long/long.d.ts b/long/long.d.ts index f059ff565..492dc3362 100644 --- a/long/long.d.ts +++ b/long/long.d.ts @@ -1,8 +1,8 @@ // Type definitions for long.js 3.0.2 // Project: https://github.com/dcodeIO/long.js -// Definitions by: Denis Cappellin -// Definitions: https://github.com/borisyankov/DefinitelyTyped // Definitions by: Peter Kooijmans +// Definitions: https://github.com/borisyankov/DefinitelyTyped +// Definitions by: Denis Cappellin declare class Long { From c5179cd689fbd58f3ba0e9d8337caaac202843ed Mon Sep 17 00:00:00 2001 From: Sergey Buturlakin Date: Mon, 16 Nov 2015 19:02:38 +0200 Subject: [PATCH 041/389] update definitions to history v1.13.1 --- react-router/history.d.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/react-router/history.d.ts b/react-router/history.d.ts index 2d88184e6..4fd7c5a0f 100644 --- a/react-router/history.d.ts +++ b/react-router/history.d.ts @@ -1,4 +1,4 @@ -// Type definitions for history v1.11.1 +// Type definitions for history v1.13.1 // Project: https://github.com/rackt/history // Definitions by: Sergey Buturlakin // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -22,13 +22,14 @@ declare namespace HistoryModule { transitionTo(location: Location): void pushState(state: LocationState, path: Path): void replaceState(state: LocationState, path: Path): void - setState(state: LocationState): void + setState(state: LocationState): void // deprecated go(n: number): void goBack(): void goForward(): void createKey(): LocationKey createPath(path: Path): Path createHref(path: Path): Href + createLocation(path?: Path, state?: LocationState, action?: Action, key?: LocationKey): Location } type HistoryOptions = Object @@ -80,7 +81,7 @@ declare namespace HistoryModule { createHistory: CreateHistory createHashHistory: CreateHistory createMemoryHistory: CreateHistory - createLocation(): Location + createLocation(path?: Path, state?: LocationState, action?: Action, key?: LocationKey): Location useBasename(createHistory: CreateHistory): CreateHistory useBeforeUnload(createHistory: CreateHistory): CreateHistory useQueries(createHistory: CreateHistory): CreateHistory @@ -117,7 +118,7 @@ declare module "history/lib/createMemoryHistory" { declare module "history/lib/createLocation" { - export default function createLocation(): HistoryModule.Location + export default function createLocation(path?: HistoryModule.Path, state?: HistoryModule.LocationState, action?: HistoryModule.Action, key?: HistoryModule.LocationKey): HistoryModule.Location } From 352d8a7f1923d66f939b312b39c6414f9d2761ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elis=C3=A9e?= Date: Wed, 18 Nov 2015 18:28:06 +0100 Subject: [PATCH 042/389] three: Add missing shadowMap WebGLRenderer member --- threejs/three.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/threejs/three.d.ts b/threejs/three.d.ts index b01c38c63..fb890afe6 100644 --- a/threejs/three.d.ts +++ b/threejs/three.d.ts @@ -4588,6 +4588,8 @@ declare module THREE { }; }; + shadowMap: WebGLShadowMapInstance; + /** * Return the WebGL context. */ From ca5bfe76d2d9bf6852cbc712d9f3e0047c93486e Mon Sep 17 00:00:00 2001 From: Adi Dahiya Date: Mon, 16 Nov 2015 17:38:29 -0500 Subject: [PATCH 043/389] Fix linting errors in react typings --- react/react-0.13.3.d.ts | 8 ++-- react/react-addons-css-transition-group.d.ts | 7 ++-- react/react-addons-linked-state-mixin.d.ts | 4 +- react/react-addons-perf.d.ts | 2 +- react/react-addons-pure-render-mixin.d.ts | 2 +- react/react-addons-test-utils.d.ts | 24 ++++++------ react/react-addons-update.d.ts | 2 +- react/react-dom.d.ts | 13 +++---- react/react-global-tests.ts | 40 ++++++++++---------- react/react-tests.ts | 17 +++++---- react/react.d.ts | 4 +- 11 files changed, 61 insertions(+), 62 deletions(-) diff --git a/react/react-0.13.3.d.ts b/react/react-0.13.3.d.ts index de8ba6732..794ec8cc2 100644 --- a/react/react-0.13.3.d.ts +++ b/react/react-0.13.3.d.ts @@ -212,7 +212,7 @@ declare namespace __React { displayName?: string; propTypes?: ValidationMap; contextTypes?: ValidationMap; - childContextTypes?: ValidationMap + childContextTypes?: ValidationMap; getDefaultProps?(): P; getInitialState?(): S; @@ -591,7 +591,7 @@ declare namespace __React { x2?: number | string; x?: number | string; y1?: number | string; - y2?: number | string + y2?: number | string; y?: number | string; } @@ -1021,7 +1021,7 @@ declare module "react/addons" { displayName?: string; propTypes?: ValidationMap; contextTypes?: ValidationMap; - childContextTypes?: ValidationMap + childContextTypes?: ValidationMap; getDefaultProps?(): P; getInitialState?(): S; @@ -1399,7 +1399,7 @@ declare module "react/addons" { x2?: number | string; x?: number | string; y1?: number | string; - y2?: number | string + y2?: number | string; y?: number | string; } diff --git a/react/react-addons-css-transition-group.d.ts b/react/react-addons-css-transition-group.d.ts index c9b40476d..49891d22f 100644 --- a/react/react-addons-css-transition-group.d.ts +++ b/react/react-addons-css-transition-group.d.ts @@ -7,7 +7,6 @@ /// declare namespace __React { - interface CSSTransitionGroupTransitionName { enter: string; enterActive?: string; @@ -16,16 +15,16 @@ declare namespace __React { appear?: string; appearActive?: string; } - + interface CSSTransitionGroupProps extends TransitionGroupProps { transitionName: string | CSSTransitionGroupTransitionName; transitionAppear?: boolean; transitionEnter?: boolean; transitionLeave?: boolean; } - + type CSSTransitionGroup = ComponentClass; - + namespace __Addons { export var CSSTransitionGroup: __React.CSSTransitionGroup; } diff --git a/react/react-addons-linked-state-mixin.d.ts b/react/react-addons-linked-state-mixin.d.ts index cbaa37958..52fd17930 100644 --- a/react/react-addons-linked-state-mixin.d.ts +++ b/react/react-addons-linked-state-mixin.d.ts @@ -10,7 +10,7 @@ declare namespace __React { value: T; requestChange(newValue: T): void; } - + interface LinkedStateMixin extends Mixin { linkState(key: string): ReactLink; } @@ -19,7 +19,7 @@ declare namespace __React { checkedLink?: ReactLink; valueLink?: ReactLink; } - + namespace __Addons { export var LinkedStateMixin: LinkedStateMixin; } diff --git a/react/react-addons-perf.d.ts b/react/react-addons-perf.d.ts index 22a9381ef..20416a060 100644 --- a/react/react-addons-perf.d.ts +++ b/react/react-addons-perf.d.ts @@ -26,7 +26,7 @@ declare namespace __React { }; totalTime: number; } - + namespace __Addons { namespace Perf { export function start(): void; diff --git a/react/react-addons-pure-render-mixin.d.ts b/react/react-addons-pure-render-mixin.d.ts index 83b4aee3d..3c154e6b5 100644 --- a/react/react-addons-pure-render-mixin.d.ts +++ b/react/react-addons-pure-render-mixin.d.ts @@ -7,7 +7,7 @@ declare namespace __React { interface PureRenderMixin extends Mixin {} - + namespace __Addons { export var PureRenderMixin: PureRenderMixin; } diff --git a/react/react-addons-test-utils.d.ts b/react/react-addons-test-utils.d.ts index 0b3f8c0f6..3b77ac4c5 100644 --- a/react/react-addons-test-utils.d.ts +++ b/react/react-addons-test-utils.d.ts @@ -44,18 +44,18 @@ declare namespace __React { (element: Element, eventData?: SyntheticEventData): void; (component: Component, eventData?: SyntheticEventData): void; } - + interface MockedComponentClass { new(): any; } - + class ShallowRenderer { getRenderOutput>(): E; getRenderOutput(): ReactElement; render(element: ReactElement, context?: any): void; unmount(): void; } - + namespace __Addons { namespace TestUtils { namespace Simulate { @@ -93,17 +93,17 @@ declare namespace __React { export var touchStart: EventSimulator; export var wheel: EventSimulator; } - + export function renderIntoDocument( element: DOMElement): Element; export function renderIntoDocument

( element: ReactElement

): Component; export function renderIntoDocument>( element: ReactElement): C; - + export function mockComponent( mocked: MockedComponentClass, mockTagName?: string): typeof TestUtils; - + export function isElementOfType( element: ReactElement, type: ReactType): boolean; export function isDOMComponent(instance: ReactInstance): boolean; @@ -111,39 +111,39 @@ declare namespace __React { export function isCompositeComponentWithType( instance: ReactInstance, type: ComponentClass): boolean; - + export function findAllInRenderedTree( root: Component, fn: (i: ReactInstance) => boolean): ReactInstance[]; - + export function scryRenderedDOMComponentsWithClass( root: Component, className: string): Element[]; export function findRenderedDOMComponentWithClass( root: Component, className: string): Element; - + export function scryRenderedDOMComponentsWithTag( root: Component, tagName: string): Element[]; export function findRenderedDOMComponentWithTag( root: Component, tagName: string): Element; - + export function scryRenderedComponentsWithType

( root: Component, type: ComponentClass

): Component[]; export function scryRenderedComponentsWithType>( root: Component, type: ComponentClass): C[]; - + export function findRenderedComponentWithType

( root: Component, type: ComponentClass

): Component; export function findRenderedComponentWithType>( root: Component, type: ComponentClass): C; - + export function createRenderer(): ShallowRenderer; } } diff --git a/react/react-addons-update.d.ts b/react/react-addons-update.d.ts index 2140e2908..11649799d 100644 --- a/react/react-addons-update.d.ts +++ b/react/react-addons-update.d.ts @@ -23,7 +23,7 @@ declare namespace __React { $unshift?: any[]; $splice?: any[][]; } - + namespace __Addons { export function update(value: any[], spec: UpdateArraySpec): any[]; export function update(value: {}, spec: UpdateSpec): any; diff --git a/react/react-dom.d.ts b/react/react-dom.d.ts index f8fd1d5c6..80a0c604e 100644 --- a/react/react-dom.d.ts +++ b/react/react-dom.d.ts @@ -6,11 +6,10 @@ /// declare namespace __React { - namespace __DOM { function findDOMNode(instance: ReactInstance): E; function findDOMNode(instance: ReactInstance): Element; - + function render

( element: DOMElement

, container: Element, @@ -23,15 +22,15 @@ declare namespace __React { element: ReactElement

, container: Element, callback?: (component: Component) => any): Component; - + function unmountComponentAtNode(container: Element): boolean; - + var version: string; - + function unstable_batchedUpdates(callback: (a: A, b: B) => any, a: A, b: B): void; function unstable_batchedUpdates(callback: (a: A) => any, a: A): void; function unstable_batchedUpdates(callback: () => any): void; - + function unstable_renderSubtreeIntoContainer

( parentComponent: Component, nextElement: DOMElement

, @@ -48,7 +47,7 @@ declare namespace __React { container: Element, callback?: (component: Component) => any): Component; } - + namespace __DOMServer { function renderToString(element: ReactElement): string; function renderToStaticMarkup(element: ReactElement): string; diff --git a/react/react-global-tests.ts b/react/react-global-tests.ts index 7caf82fdf..da3c7be33 100644 --- a/react/react-global-tests.ts +++ b/react/react-global-tests.ts @@ -68,34 +68,34 @@ var ClassicComponent: React.ClassicComponentClass = class ModernComponent extends React.Component implements React.ChildContextProvider { - + static propTypes: React.ValidationMap = { foo: React.PropTypes.number - } - + }; + static contextTypes: React.ValidationMap = { someValue: React.PropTypes.string - } - + }; + static childContextTypes: React.ValidationMap = { someOtherValue: React.PropTypes.string - } - + }; + static defaultProps: Props; - + context: Context; - + getChildContext() { return { - someOtherValue: 'foo' - } + someOtherValue: "foo" + }; } - + state = { inputValue: this.context.someValue, seconds: this.props.foo - } - + }; + reset() { this.setState({ inputValue: this.context.someValue, @@ -104,7 +104,7 @@ class ModernComponent extends React.Component } private _input: HTMLInputElement; - + render() { return React.DOM.div(null, React.DOM.input({ @@ -342,7 +342,7 @@ interface TimerState { class Timer extends React.Component<{}, TimerState> { state = { secondsElapsed: 0 - } + }; private _interval: number; tick() { this.setState((prevState, props) => ({ @@ -392,7 +392,7 @@ React.createFactory(React.addons.CSSTransitionGroup)({ // -------------------------------------------------------------------------- React.createClass({ mixins: [React.addons.LinkedStateMixin], - render: function() { return React.DOM.div(null) } + render: function() { return React.DOM.div(null); } }); // @@ -411,7 +411,7 @@ React.addons.Perf.printDOM(measurements); // -------------------------------------------------------------------------- React.createClass({ mixins: [React.addons.PureRenderMixin], - render: function() { return React.DOM.div(null) } + render: function() { return React.DOM.div(null); } }); // @@ -427,7 +427,7 @@ var renderer: React.ShallowRenderer = renderer.render(React.createElement(Timer)); var output: React.ReactElement> = renderer.getRenderOutput(); - + // // TransitionGroup addon // -------------------------------------------------------------------------- @@ -437,7 +437,7 @@ React.createFactory(React.addons.TransitionGroup)({ component: "div" }); // update addon // -------------------------------------------------------------------------- { -// These are copied from https://facebook.github.io/react/docs/update.html +// These are copied from https://facebook.github.io/react/docs/update.html let initialArray = [1, 2, 3]; let newArray = React.addons.update(initialArray, {$push: [4]}); // => [1, 2, 3, 4] diff --git a/react/react-tests.ts b/react/react-tests.ts index ef505f85e..a913f4b32 100644 --- a/react/react-tests.ts +++ b/react/react-tests.ts @@ -9,6 +9,7 @@ /// /// /// + import React = require("react"); import ReactDOM = require("react-dom"); import ReactDOMServer = require("react-dom/server"); @@ -90,28 +91,28 @@ class ModernComponent extends React.Component static propTypes: React.ValidationMap = { foo: React.PropTypes.number - } + }; static contextTypes: React.ValidationMap = { someValue: React.PropTypes.string - } + }; static childContextTypes: React.ValidationMap = { someOtherValue: React.PropTypes.string - } + }; context: Context; getChildContext() { return { - someOtherValue: 'foo' - } + someOtherValue: "foo" + }; } state = { inputValue: this.context.someValue, seconds: this.props.foo - } + }; reset() { this._myComponent.reset(); @@ -417,7 +418,7 @@ interface TimerState { class Timer extends React.Component<{}, TimerState> { state = { secondsElapsed: 0 - } + }; private _interval: number; tick() { this.setState((prevState, props) => ({ @@ -514,7 +515,7 @@ Perf.printDOM(measurements); // -------------------------------------------------------------------------- React.createClass({ mixins: [PureRenderMixin], - render: function() { return React.DOM.div(null) } + render: function() { return React.DOM.div(null); } }); // diff --git a/react/react.d.ts b/react/react.d.ts index e3d0f43f7..914fc1bb2 100644 --- a/react/react.d.ts +++ b/react/react.d.ts @@ -187,7 +187,7 @@ declare namespace __React { displayName?: string; propTypes?: ValidationMap; contextTypes?: ValidationMap; - childContextTypes?: ValidationMap + childContextTypes?: ValidationMap; getDefaultProps?(): P; getInitialState?(): S; @@ -655,7 +655,7 @@ declare namespace __React { xmlLang?: string; xmlSpace?: string; y1?: number | string; - y2?: number | string + y2?: number | string; y?: number | string; } From 097e6616f04a7ab2a507ecce2afd36e63ca2a36e Mon Sep 17 00:00:00 2001 From: Adi Dahiya Date: Mon, 16 Nov 2015 17:38:53 -0500 Subject: [PATCH 044/389] Add transition timeout props to React CSSTransitionGroup --- react/react-addons-css-transition-group.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/react/react-addons-css-transition-group.d.ts b/react/react-addons-css-transition-group.d.ts index 49891d22f..f55335ccb 100644 --- a/react/react-addons-css-transition-group.d.ts +++ b/react/react-addons-css-transition-group.d.ts @@ -19,8 +19,11 @@ declare namespace __React { interface CSSTransitionGroupProps extends TransitionGroupProps { transitionName: string | CSSTransitionGroupTransitionName; transitionAppear?: boolean; + transitionAppearTimeout?: number; transitionEnter?: boolean; + transitionEnterTimeout?: number; transitionLeave?: boolean; + transitionLeaveTimeout?: number; } type CSSTransitionGroup = ComponentClass; From 2a59c6071d43937a6af8db95359f28fa84942b91 Mon Sep 17 00:00:00 2001 From: Adi Dahiya Date: Wed, 18 Nov 2015 17:10:32 -0500 Subject: [PATCH 045/389] Make material-ui legacy typings use react-0.13.3.d.ts --- material-ui/legacy/material-ui-0.11.1.d.ts | 2 +- material-ui/legacy/material-ui-0.12.1.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/material-ui/legacy/material-ui-0.11.1.d.ts b/material-ui/legacy/material-ui-0.11.1.d.ts index f974c33be..d4fd93b02 100644 --- a/material-ui/legacy/material-ui-0.11.1.d.ts +++ b/material-ui/legacy/material-ui-0.11.1.d.ts @@ -3,7 +3,7 @@ // Definitions by: Nathan Brown // Definitions: https://github.com/borisyankov/DefinitelyTyped -/// +/// declare module "material-ui" { // The reason for exporting the namespace types (__MaterialUI.*) is to also export the type for casting variable. diff --git a/material-ui/legacy/material-ui-0.12.1.d.ts b/material-ui/legacy/material-ui-0.12.1.d.ts index 658a37ec4..23b438357 100644 --- a/material-ui/legacy/material-ui-0.12.1.d.ts +++ b/material-ui/legacy/material-ui-0.12.1.d.ts @@ -3,7 +3,7 @@ // Definitions by: Nathan Brown // Definitions: https://github.com/borisyankov/DefinitelyTyped -/// +/// declare module "material-ui" { export import AppBar = __MaterialUI.AppBar; // require('material-ui/lib/app-bar'); From 4c0eb8b492ecdb54e85a3b3bda1dd35fca117b70 Mon Sep 17 00:00:00 2001 From: Adi Dahiya Date: Wed, 18 Nov 2015 18:38:38 -0500 Subject: [PATCH 046/389] More fixes to material-ui react typings --- material-ui/legacy/material-ui-0.11.1-tests.tsx | 9 ++++----- material-ui/legacy/material-ui-0.11.1.d.ts | 4 ++-- ...ui-0.12.1-tests .tsx => material-ui-0.12.1-tests.tsx} | 4 ++-- 3 files changed, 8 insertions(+), 9 deletions(-) rename material-ui/legacy/{material-ui-0.12.1-tests .tsx => material-ui-0.12.1-tests.tsx} (99%) diff --git a/material-ui/legacy/material-ui-0.11.1-tests.tsx b/material-ui/legacy/material-ui-0.11.1-tests.tsx index ffc360963..7f81cf177 100644 --- a/material-ui/legacy/material-ui-0.11.1-tests.tsx +++ b/material-ui/legacy/material-ui-0.11.1-tests.tsx @@ -1,9 +1,8 @@ -/// -/// +/// /// -import * as React from "react"; -import * as LinkedStateMixin from "react-addons-linked-state-mixin"; +import * as React from "react/addons"; + import mui = require("material-ui"); import Colors = require("material-ui/lib/styles/colors"); import AppBar = require("material-ui/lib/app-bar"); @@ -475,4 +474,4 @@ class MaterialUiTests extends React.Component<{}, {}> implements React.LinkedSta return element; } -} \ No newline at end of file +} diff --git a/material-ui/legacy/material-ui-0.11.1.d.ts b/material-ui/legacy/material-ui-0.11.1.d.ts index d4fd93b02..706a98537 100644 --- a/material-ui/legacy/material-ui-0.11.1.d.ts +++ b/material-ui/legacy/material-ui-0.11.1.d.ts @@ -233,7 +233,7 @@ declare namespace __MaterialUI { } // what's not commonly overridden by Checkbox, RadioButton, or Toggle - interface CommonEnhancedSwitchProps extends React.HTMLAttributes, React.Props { + interface CommonEnhancedSwitchProps extends React.HTMLAttributesBase { // is root element id?: string; iconStyle?: React.CSSProperties; @@ -412,7 +412,7 @@ declare namespace __MaterialUI { } // non generally overridden elements of EnhancedButton - interface SharedEnhancedButtonProps extends React.HTMLAttributes, React.Props { + interface SharedEnhancedButtonProps extends React.HTMLAttributesBase { centerRipple?: boolean; containerElement?: string | React.ReactElement; disabled?: boolean; diff --git a/material-ui/legacy/material-ui-0.12.1-tests .tsx b/material-ui/legacy/material-ui-0.12.1-tests.tsx similarity index 99% rename from material-ui/legacy/material-ui-0.12.1-tests .tsx rename to material-ui/legacy/material-ui-0.12.1-tests.tsx index aa094c424..6792e9f4f 100644 --- a/material-ui/legacy/material-ui-0.12.1-tests .tsx +++ b/material-ui/legacy/material-ui-0.12.1-tests.tsx @@ -1,4 +1,4 @@ -/// +/// /// import * as React from "react/addons"; @@ -465,4 +465,4 @@ class MaterialUiTests extends React.Component<{}, {}> implements React.LinkedSta return element; } -} \ No newline at end of file +} From 91e9c035e1968ec4d07e095968db5acdb3a79388 Mon Sep 17 00:00:00 2001 From: Sergey Buturlakin Date: Thu, 19 Nov 2015 14:15:44 +0200 Subject: [PATCH 047/389] update to React Router v1.0.0 --- react-router/react-router.d.ts | 185 +++++++++++++++++++++------------ 1 file changed, 116 insertions(+), 69 deletions(-) diff --git a/react-router/react-router.d.ts b/react-router/react-router.d.ts index 083495404..42a524a96 100644 --- a/react-router/react-router.d.ts +++ b/react-router/react-router.d.ts @@ -1,22 +1,22 @@ -// Type definitions for react-router v1.0.0-rc1 +// Type definitions for react-router v1.0.0 // Project: https://github.com/rackt/react-router -// Definitions by: Sergey Buturlakin +// Definitions by: Sergey Buturlakin , Yuichi Murata , Václav Ostrožlík // Definitions: https://github.com/borisyankov/DefinitelyTyped -/// +/// /// declare namespace ReactRouter { - // types based on https://github.com/rackt/react-router/blob/master/docs/Glossary.md + import React = __React import H = HistoryModule - type Component = React.ReactType + // types based on https://github.com/rackt/react-router/blob/master/docs/Glossary.md - type Components = { [key: string]: Component } + type Component = React.ReactType type EnterHook = (nextState: RouterState, replaceState: RedirectFunction, callback?: Function) => any @@ -28,38 +28,44 @@ declare namespace ReactRouter { type RedirectFunction = (state: H.LocationState, pathname: H.Pathname | H.Path, query?: H.Query) => void + type RouteComponent = Component + + // use the following interface in an app code to get access to route param values, history, location... + // interface MyComponentProps extends ReactRouter.RouteComponentProps<{}, { id: number }> {} + // somewhere in MyComponent + // ... + // let id = this.props.routeParams.id + // ... + // this.props.history. ... + // ... interface RouteComponentProps { history?: History - location?: Location + location?: H.Location params?: P route?: PlainRoute routeParams?: R routes?: PlainRoute[] } - type RouteComponent = React.ComponentClass + type RouteComponents = { [key: string]: RouteComponent } - type RouteConfig = RouteObject[] + type RouteConfig = React.ReactNode | PlainRoute | PlainRoute[] - type RouteHook = (nextLocation?: Location) => any + type RouteHook = (nextLocation?: H.Location) => any type RoutePattern = string - type RouteObject = PlainRoute - type StringifyQuery = (queryObject: H.Query) => H.QueryString + type RouterListener = (error: Error, nextState: RouterState) => void + interface RouterState { - location: Location - routes: RouteConfig + location: H.Location + routes: PlainRoute[] params: Params - components: Component[] + components: RouteComponent[] } - type RouteType = Route | IndexRoute | PlainRoute | Redirect - - type RouteTypes = RouteType | RouteType[] - interface HistoryBase extends H.History { routes: PlainRoute[] @@ -70,11 +76,12 @@ declare namespace ReactRouter { type History = HistoryBase & H.HistoryQueries & HistoryRoutes - interface RouterProps { + /* components */ + + interface RouterProps extends React.Props { history?: H.History - children?: RouteTypes - routes?: RouteTypes // alias for children - createElement?: (component: Component, props: Object) => any + routes?: RouteConfig // alias for children + createElement?: (component: RouteComponent, props: Object) => any onError?: (err: any) => any onUpdate?: () => any parseQueryString?: ParseQueryString @@ -85,7 +92,7 @@ declare namespace ReactRouter { const Router: Router - interface LinkProps extends React.HTMLAttributesBase { + interface LinkProps extends React.HTMLAttributes, React.Props { activeStyle?: React.CSSProperties activeClassName?: string onlyActiveOnIndex?: boolean @@ -94,74 +101,93 @@ declare namespace ReactRouter { state?: H.LocationState } interface Link extends React.ComponentClass {} - interface LinkElement extends React.DOMElement {} + interface LinkElement extends React.ReactElement {} const Link: Link - interface RoutePropsBase { - children?: RouteTypes - ignoreScrollBehavior?: boolean - component?: Component - components?: Components - getComponent?: (location: Location, cb: (err: any, component?: Component) => void) => void - getComponents?: (location: Location, cb: (err: any, components?: Components) => void) => void + const IndexLink: Link + + + interface RoutingContextProps extends React.Props { + history: H.History + createElement: (component: RouteComponent, props: Object) => any + location: H.Location + routes: RouteConfig + params: Params + components?: RouteComponent[] + } + interface RoutingContext extends React.ComponentClass {} + interface RoutingContextElement extends React.ReactElement {} + const RoutingContext: RoutingContext + + + /* components (configuration) */ + + interface RouteProps extends React.Props { + path?: RoutePattern + component?: RouteComponent + components?: RouteComponents + getComponent?: (location: H.Location, cb: (err: any, component?: RouteComponent) => void) => void + getComponents?: (location: H.Location, cb: (err: any, components?: RouteComponents) => void) => void onEnter?: EnterHook onLeave?: LeaveHook } - - interface RouteProps extends RoutePropsBase { - path?: RoutePattern - } interface Route extends React.ComponentClass {} interface RouteElement extends React.ReactElement {} const Route: Route - interface PlainRoute extends RouteProps { - childRoutes: RouteTypes - getChildRoutes: (location: Location, cb: (err: any, routesArray: RouteTypes) => void) => void + interface PlainRoute { + path?: RoutePattern + component?: RouteComponent + components?: RouteComponents + getComponent?: (location: H.Location, cb: (err: any, component?: RouteComponent) => void) => void + getComponents?: (location: H.Location, cb: (err: any, components?: RouteComponents) => void) => void + onEnter?: EnterHook + onLeave?: LeaveHook + indexRoute?: PlainRoute + getIndexRoute?: (location: H.Location, cb: (err: any, indexRoute: RouteConfig) => void) => void + childRoutes?: PlainRoute[] + getChildRoutes?: (location: H.Location, cb: (err: any, childRoutes: RouteConfig) => void) => void } - interface RedirectProps { + interface RedirectProps extends React.Props { path?: RoutePattern from?: RoutePattern // alias for path to: RoutePattern query?: H.Query state?: H.LocationState } - interface Redirect extends React.ReactElement {} + interface Redirect extends React.ComponentClass {} interface RedirectElement extends React.ReactElement {} const Redirect: Redirect - interface IndexRouteProps extends RoutePropsBase {} + interface IndexRouteProps extends React.Props { + component?: RouteComponent + components?: RouteComponents + getComponent?: (location: H.Location, cb: (err: any, component?: RouteComponent) => void) => void + getComponents?: (location: H.Location, cb: (err: any, components?: RouteComponents) => void) => void + onEnter?: EnterHook + onLeave?: LeaveHook + } interface IndexRoute extends React.ComponentClass {} interface IndexRouteElement extends React.ReactElement {} const IndexRoute: IndexRoute - interface RoutingContextProps { - history: H.History - createElement?: (component: Component, props: Object) => any - location: Location - routes: RouteTypes - params: Params - components?: Components + interface IndexRedirectProps extends React.Props { + to: RoutePattern + query?: H.Query + state?: H.LocationState } - interface RoutingContext extends React.ReactElement {} - interface RoutingContextElement extends React.ReactElement {} - const RoutingContext: RoutingContext + interface IndexRedirect extends React.ComponentClass {} + interface IndexRedirectElement extends React.ReactElement {} + const IndexRedirect: IndexRedirect - interface LifecycleMixin { - routerWillLeave(nextLocation: Location): string | boolean - } - const Lifecycle: React.Mixin - - - const RouteContext: React.Mixin - + /* mixins */ interface HistoryMixin { history: History @@ -169,12 +195,21 @@ declare namespace ReactRouter { const History: React.Mixin - type RouterListener = (error: Error, nextState: RouterState) => void + interface LifecycleMixin { + routerWillLeave(nextLocation: H.Location): string | boolean + } + const Lifecycle: React.Mixin + + + const RouteContext: React.Mixin + + + /* utils */ interface HistoryRoutes { isActive(pathname: H.Pathname, query: H.Query): boolean - registerRouteHook(route: PlainRoute, hook: H.LocationListener): void - unregisterRouteHook(route: PlainRoute, hook: H.LocationListener): void + registerRouteHook(route: PlainRoute, hook: RouteHook): void + unregisterRouteHook(route: PlainRoute, hook: RouteHook): void listen(listener: RouterListener): Function match(location: H.Location, callback: (error: any, nextState: RouterState, nextLocation: H.Location) => void): void } @@ -182,13 +217,13 @@ declare namespace ReactRouter { function useRoutes(createHistory: HistoryModule.CreateHistory): HistoryModule.CreateHistory - function createRoutes(routes: RouteTypes): PlainRoute[] + function createRoutes(routes: RouteConfig): PlainRoute[] interface MatchArgs { - routes?: RouteTypes + routes?: RouteConfig history?: H.History - location?: Location + location?: H.Location parseQueryString?: ParseQueryString stringifyQuery?: StringifyQuery } @@ -216,9 +251,14 @@ declare module "react-router/lib/Link" { declare module "react-router/lib/IndexLink" { - const IndexLink: ReactRouter.Link + export default ReactRouter.IndexLink - export default IndexLink +} + + +declare module "react-router/lib/IndexRedirect" { + + export default ReactRouter.IndexRedirect } @@ -274,7 +314,7 @@ declare module "react-router/lib/useRoutes" { declare module "react-router/lib/RouteUtils" { - type E = React.ReactElement + type E = __React.ReactElement export function isReactChildren(object: E | E[]): boolean @@ -296,6 +336,8 @@ declare module "react-router/lib/RoutingContext" { declare module "react-router/lib/PropTypes" { + import React = __React + export function falsy(props: any, propName: string, componentName: string): Error; export const history: React.Requireable @@ -335,6 +377,10 @@ declare module "react-router" { import Link from "react-router/lib/Link" + import IndexLink from "react-router/lib/IndexLink" + + import IndexRedirect from "react-router/lib/IndexRedirect" + import IndexRoute from "react-router/lib/IndexRoute" import Redirect from "react-router/lib/Redirect" @@ -361,6 +407,7 @@ declare module "react-router" { Router, Link, IndexRoute, + IndexRedirect, Redirect, Route, History, From 9962a6144e28da747849dcdf0709a1e4f1960bf1 Mon Sep 17 00:00:00 2001 From: Sergey Buturlakin Date: Thu, 19 Nov 2015 19:13:28 +0200 Subject: [PATCH 048/389] add IndexLink to the default export --- react-router/react-router.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/react-router/react-router.d.ts b/react-router/react-router.d.ts index 42a524a96..c36376077 100644 --- a/react-router/react-router.d.ts +++ b/react-router/react-router.d.ts @@ -406,8 +406,9 @@ declare module "react-router" { export { Router, Link, - IndexRoute, + IndexLink, IndexRedirect, + IndexRoute, Redirect, Route, History, From 8dedcf938ab0090ee04a5e4ba27abfbef575085a Mon Sep 17 00:00:00 2001 From: Sergey Buturlakin Date: Thu, 19 Nov 2015 19:45:21 +0200 Subject: [PATCH 049/389] update tests --- react-router/react-router-tests.ts | 398 ---------------------------- react-router/react-router-tests.tsx | 10 +- 2 files changed, 6 insertions(+), 402 deletions(-) delete mode 100644 react-router/react-router-tests.ts diff --git a/react-router/react-router-tests.ts b/react-router/react-router-tests.ts deleted file mode 100644 index 7c80d740a..000000000 --- a/react-router/react-router-tests.ts +++ /dev/null @@ -1,398 +0,0 @@ -/// -/// -"use strict"; - -import React = require('react'); -import ReactDOM = require('react-dom'); -import Router = require('react-router'); - -// Mixin -class NavigationTest { - v: T; - - makePath() { - var v1: string = this.v.makePath('to'); - var v2: string = this.v.makePath('to', {id: 1}); - var v3: string = this.v.makePath('to', {id: 1}, {type: 'json'}); - } - makeHref() { - var v1: string = this.v.makeHref('to'); - var v2: string = this.v.makeHref('to', {id: 1}); - var v3: string = this.v.makeHref('to', {id: 1}, {type: 'json'}); - } - transitionTo() { - var v1: void = this.v.transitionTo('to'); - var v2: void = this.v.transitionTo('to', {id: 1}); - var v3: void = this.v.transitionTo('to', {id: 1}, {type: 'json'}); - } - replaceWith() { - var v1: void = this.v.replaceWith('to'); - var v2: void = this.v.replaceWith('to', {id: 1}); - var v3: void = this.v.replaceWith('to', {id: 1}, {type: 'json'}); - } - goBack() { - var v1: void = this.v.goBack(); - } -} - -class StateTest { - v: T; - - getPath() { - var v1: string = this.v.getPath(); - } - - getRoutes() { - var v1: Router.Route[] = this.v.getRoutes(); - } - - getPathname() { - var v1: string = this.v.getPathname(); - } - - getParams() { - var v1: {} = this.v.getParams(); - } - - getQuery() { - var v1: {} = this.v.getQuery(); - } - - isActive() { - var v1: boolean = this.v.isActive('to'); - var v2: boolean = this.v.isActive('to', {id: 1}); - var v3: boolean = this.v.isActive('to', {id: 1}, {type: 'json'}); - } -} - - -// Location -class LocationTest { - v: T; - - push() { - var v1: void = this.v.push('path/to/hoge'); - } - - replace() { - var v1: void = this.v.replace('path/to/hoge'); - } - - pop() { - var v1: void = this.v.pop(); - } - - getCurrentPath() { - var v1: void = this.v.getCurrentPath(); - } -} -new LocationTest(); -new LocationTest(); -new LocationTest(); - -class LocationListenerTest { - v: T; - - addChangeListener() { - var v1: void = this.v.addChangeListener(() => console.log(1)); - } - - removeChangeListener() { - var v1: void = this.v.removeChangeListener(() => console.log(1)); - } -} -new LocationListenerTest(); -new LocationListenerTest(); - - -// Behavior -class ScrollBehaviorTest { - v: T; - - updateScrollPosition() { - var v1: void = this.v.updateScrollPosition({x: 33, y: 102}, 'scrollTop'); - } -} -new ScrollBehaviorTest(); -new ScrollBehaviorTest(); - - -// Component -class DefaultRouteTest { - v: Router.DefaultRoute; - - props() { - var name: string = this.v.props.name; - var handler: React.ComponentClass = this.v.props.handler; - } - - createElement() { - var Handler: React.ComponentClass; - React.createElement(Router.DefaultRoute, null); - React.createElement(Router.DefaultRoute, {name: 'name', handler: Handler}); - } -} - -class LinkTest { - v: Router.Link; - - constructor() { - new NavigationTest(); - new StateTest(); - } - - props() { - var activeClassName: string = this.v.props.activeClassName; - var to: string = this.v.props.to; - var params: {} = this.v.props.params; - var query: {} = this.v.props.query; - var onClick: Function = this.v.props.onClick; - } - - getHref() { - var v1: string = this.v.getHref(); - } - - getClassName() { - var v1: string = this.v.getClassName(); - } - - createElement() { - React.createElement(Router.Link, null); - React.createElement(Router.Link, {to: 'home'}); - React.createElement(Router.Link, { - activeClassName: 'name', - to: 'home', - params: {}, - query: {}, - onClick: () => console.log(1) - }); - } -} - -class NotFoundRouteTest { - v: Router.NotFoundRoute; - - props() { - var name: string = this.v.props.name; - var handler: React.ComponentClass = this.v.props.handler; - } - - createElement() { - var Handler: React.ComponentClass; - React.createElement(Router.NotFoundRoute, null); - React.createElement(Router.NotFoundRoute, {handler: Handler}); - React.createElement(Router.NotFoundRoute, {handler: Handler, name: "home"}); - } -} - -class RedirectTest { - v: Router.Redirect; - - props() { - var path: string = this.v.props.path; - var from: string = this.v.props.from; - var to: string = this.v.props.to; - } - - createElement() { - React.createElement(Router.Redirect, null); - React.createElement(Router.Redirect, {}); - React.createElement(Router.Redirect, {path: 'a', from: 'a', to: 'b'}); - } -} - -class RouteTest { - v: Router.Route; - - props() { - var name: string = this.v.props.name; - var path: string = this.v.props.path; - var handler: React.ComponentClass = this.v.props.handler; - var ignoreScrollBehavior: boolean = this.v.props.ignoreScrollBehavior; - } - - createElement() { - var Handler: React.ComponentClass; - React.createElement(Router.Route, null); - React.createElement(Router.Route, {}); - React.createElement(Router.Route, {name: "home", path: "/", handler: Handler, ignoreScrollBehavior: true}); - } -} - -class RouteHandlerTest { - v: Router.RouteHandler; - - createElement() { - React.createElement(Router.RouteHandler, null); - React.createElement(Router.RouteHandler, {}); - } -} - - -// History -class HistoryTest { - v: Router.History; - - length() { - var v1: number = this.v.length; - } - - back() { - var v1: void = this.v.back(); - } -} - - -// Router -class CreateTest { - v: Router.Router; - - constructor() { - // React.createElement() version - this.v = Router.create({ - routes: React.createElement(Router.Route, null) - }); - this.v = Router.create({ - routes: React.createElement(Router.Route, null), - location: Router.HistoryLocation, - scrollBehavior: Router.ImitateBrowserBehavior - }); - - // React.createFactory() version - this.v = Router.create({ - routes: React.createFactory(Router.Route)() - }); - this.v = Router.create({ - routes: React.createFactory(Router.Route)(), - location: Router.HistoryLocation, - scrollBehavior: Router.ImitateBrowserBehavior - }); - } - - run() { - this.v.run((Handler) => console.log(Handler)); - this.v.run((Handler, state) => console.log(Handler, state)); - } -} - -class RunTest { - constructor() { - // React.createElement() version - var v1: Router.Router = Router.run(React.createElement(Router.Route, null), (Handler) => { - ReactDOM.render(React.createElement(Handler, null), document.body); - }); - var v2: Router.Router = Router.run(React.createElement(Router.Route, null), Router.HistoryLocation, (Handler, state) => { - ReactDOM.render(React.createElement(Handler, null), document.body); - }); - var v3: Router.Router = Router.run(React.createElement(Router.Route, null), '/foo/bar', (Handler, state) => { - ReactDOM.render(React.createElement(Handler, null), document.body); - }); - - // React.createFactory() version - var v4: Router.Router = Router.run(React.createFactory(Router.Route)(), (Handler) => { - ReactDOM.render(React.createElement(Handler, null), document.body); - }); - var v5: Router.Router = Router.run(React.createFactory(Router.Route)(), Router.HistoryLocation, (Handler, state) => { - ReactDOM.render(React.createElement(Handler, null), document.body); - }); - var v6: Router.Router = Router.run(React.createFactory(Router.Route)(), '/foo/bar', (Handler, state) => { - ReactDOM.render(React.createElement(Handler, null), document.body); - }); - } -} - - -// Transition -class TransitionTest { - constructor() { - var v1: Router.TransitionStaticLifecycle = { - willTransitionTo: (transition, params, query, callback) => { - transition.abort(); - transition.redirect('to'); - transition.redirect('to', {id: 1}); - transition.redirect('to', {id: 1}, {type: 'json'}); - transition.retry(); - }, - willTransitionFrom: (transition, component, callback) => {} - }; - var v2: Router.TransitionStaticLifecycle = { - willTransitionTo: (transition, params, query) => {}, - willTransitionFrom: (transition, component) => {} - }; - var v3: Router.TransitionStaticLifecycle = { - willTransitionTo: (transition, params) => {}, - willTransitionFrom: (transition) => {} - }; - var v4: Router.TransitionStaticLifecycle = { - willTransitionTo: (transition) => {}, - willTransitionFrom: () => {} - }; - var v5: Router.TransitionStaticLifecycle = { - willTransitionTo: () => {} - }; - var v6: Router.TransitionStaticLifecycle = { - willTransitionFrom: () => {} - }; - } -} - - -// Context -class ContextTest { - v: Router.Context - - makePath() { - var v1: string = this.v.makePath('home'); - var v2: string = this.v.makePath('home', {p1: 1}); - var v3: string = this.v.makePath('home', {p1: 1}, {q1: 1}); - } - - makeHref() { - var v1: string = this.v.makeHref('home'); - var v2: string = this.v.makeHref('home', {p1: 1}); - var v3: string = this.v.makeHref('home', {p1: 1}, {q1: 1}); - } - - transitionTo() { - var v1: void = this.v.transitionTo('home'); - var v2: void = this.v.transitionTo('home', {p1: 1}); - var v3: void = this.v.transitionTo('home', {p1: 1}, {q1: 1}); - } - - replaceWith() { - var v1: void = this.v.replaceWith('home'); - var v2: void = this.v.replaceWith('home', {p1: 1}); - var v3: void = this.v.replaceWith('home', {p1: 1}, {q1: 1}); - } - - goBack() { - var v: void = this.v.goBack(); - } - - getCurrentPath() { - var v: string = this.v.getCurrentPath(); - } - - getCurrentRoutes() { - var v: Router.Route[] = this.v.getCurrentRoutes(); - } - - getCurrentPathname() { - var v: string = this.v.getCurrentPathname(); - } - - getCurrentParams() { - var v: {} = this.v.getCurrentParams(); - } - - getCurrentQuery() { - var v: {} = this.v.getCurrentQuery(); - } - - isActive() { - var v1: boolean = this.v.isActive('home'); - var v2: boolean = this.v.isActive('home', {p1: 1}); - var v3: boolean = this.v.isActive('home', {p1: 1}, {q1: 1}); - } -} diff --git a/react-router/react-router-tests.tsx b/react-router/react-router-tests.tsx index 4c2abc7ef..42ee3236f 100644 --- a/react-router/react-router-tests.tsx +++ b/react-router/react-router-tests.tsx @@ -1,12 +1,14 @@ /// -/// +/// /// +/// -import * as React from "react"; +import * as React from "react" +import * as ReactDOM from "react-dom" -import { Router, Route, IndexRoute, Link } from "react-router"; +import { Router, Route, IndexRoute, Link } from "react-router" import createHistory from "history/lib/createBrowserHistory" @@ -56,7 +58,7 @@ class Users extends React.Component<{}, {}> { } -React.render(( +ReactDOM.render(( From 161d514d1259011b6c194ef4c4b456d64f25a1f1 Mon Sep 17 00:00:00 2001 From: John Vilk Date: Thu, 19 Nov 2015 00:54:36 -0500 Subject: [PATCH 050/389] [browserify] Update definitions to match latest API. Add comments from documentation. I've also inferred extra information through examining the source code, as particular options are not well-documented. This also updates envify's typings to be more specific. --- browserify/browserify-tests.ts | 48 +++++++- browserify/browserify.d.ts | 197 ++++++++++++++++++++++++++++----- envify/envify.d.ts | 6 +- 3 files changed, 217 insertions(+), 34 deletions(-) diff --git a/browserify/browserify-tests.ts b/browserify/browserify-tests.ts index 524901566..b4096a7f9 100644 --- a/browserify/browserify-tests.ts +++ b/browserify/browserify-tests.ts @@ -2,11 +2,51 @@ import browserify = require("browserify"); import fs = require("fs"); +import stream = require('stream'); -var b: BrowserifyObject = browserify(); +var bNoArg = browserify(); + +var b = browserify({ + baseDir: 'somewhere' +}); b.add('./browser/main.js'); -b.transform('deamdify'); -b.bundle().pipe(fs.createWriteStream('bundle.js')); +b.transform('deamdify') + .transform(function (file) { + return new stream.Transform(); + }).plugin((b, opts) => { return opts.l; }, {l: 3}) + .require('foo', { expose: 'bar' }) + .exclude('baz') + .ignore('bat') + .reset({ basedir: 'elsewhere' }); -var customBrowsify: Browserify = require("browserify"); +b.on('file', (file) => { + file += ""; +}); + +b.external(bNoArg); + +var b2 = new browserify(['/some/File', {file: '/some/file' }, fs.createReadStream('/somewhere')], { builtins: ['buffer']}) + .reset({ + builtins: { + 'buffer': './customBuffer' + } + }); + +var customBrowsify = require("browserify"); customBrowsify({entries: []}); + +var b = browserify('./browser/main.js', { + noParse: ['jquery'], + debug: true, + foo: 'bar' +}); +b.add('./browser/other.js'); +b.transform(function(file: string): NodeJS.ReadWriteStream { + return new stream.PassThrough(); +}); + +var record_pipeline = b.pipeline.get('record'); + +b.bundle().pipe(process.stdout); + + diff --git a/browserify/browserify.d.ts b/browserify/browserify.d.ts index c301df51e..1ce6b653d 100644 --- a/browserify/browserify.d.ts +++ b/browserify/browserify.d.ts @@ -1,41 +1,182 @@ -// Type definitions for Browserify +// Type definitions for Browserify v12.0.1 // Project: http://browserify.org/ -// Definitions by: Andrew Gaspar +// Definitions by: Andrew Gaspar , John Vilk // Definitions: https://github.com/borisyankov/DefinitelyTyped /// -interface BrowserifyObject extends NodeJS.EventEmitter { - add(file:string, opts?:any): BrowserifyObject; - require(file:string, opts?:{ - expose: string; - }): BrowserifyObject; - bundle(opts?:{ - insertGlobals?: boolean; - detectGlobals?: boolean; - debug?: boolean; - standalone?: string; - insertGlobalVars?: any; - }, cb?:(err:any, src:any) => void): NodeJS.ReadableStream; +declare module Browserify { + /** + * Options pertaining to an individual file. + */ + interface FileOptions { + // If true, this is considered an entry point to your app. + entry?: boolean; + // Expose this file under a custom dependency name. + // require('./vendor/angular/angular.js', {expose: 'angular'}) enables require('angular') + expose?: string; + // Basedir to use to resolve this file's path. + basedir?: string; + // The name/path to the file. + file?: string; + // Forward file to external() to be externalized. + external?: boolean; + // Disable transforms on file if set to false. + transform?: boolean; + // The ID to use for require() statements. + id?: string; + } - external(file:string, opts?:any): BrowserifyObject; - ignore(file:string, opts?:any): BrowserifyObject; - transform(tr:string, opts?:any): BrowserifyObject; - transform(tr:Function, opts?:any): BrowserifyObject; - plugin(plugin:string, opts?:any): BrowserifyObject; - plugin(plugin:Function, opts?:any): BrowserifyObject; -} -interface Browserify { - (): BrowserifyObject; - (files:string[]): BrowserifyObject; - (opts:{ - entries?: string[]; + // Browserify accepts a filename, an input stream for file inputs, or a FileOptions configuration + // for each file in a bundle. + type InputFile = string | NodeJS.ReadableStream | FileOptions; + + /** + * Options pertaining to a Browserify instance. + */ + interface Options { + // Custom properties can be defined on Options. + // These options are forwarded along to module-deps and browser-pack directly. + [propName: string]: any; + // String, file object, or array of those types (they may be mixed) specifying entry file(s). + entries?: InputFile | InputFile[]; + // an array which will skip all require() and global parsing for each file in the array. + // Use this for giant libs like jquery or threejs that don't have any requires or node-style globals but take forever to parse. noParse?: string[]; - }): BrowserifyObject; + // an array of optional extra extensions for the module lookup machinery to use when the extension has not been specified. + // By default Browserify considers only .js and .json files in such cases. + extensions?: string[]; + // the directory that Browserify starts bundling from for filenames that start with .. + basedir?: string; + // an array of directories that Browserify searches when looking for modules which are not referenced using relative path. + // Can be absolute or relative to basedir. Equivalent of setting NODE_PATH environmental variable when calling Browserify command. + paths?: string[]; + // sets the algorithm used to parse out the common paths. Use false to turn this off, otherwise it uses the commondir module. + commondir?: boolean; + // disables converting module ids into numerical indexes. This is useful for preserving the original paths that a bundle was generated with. + fullPaths?: boolean; + // sets the list of built-ins to use, which by default is set in lib/builtins.js in this distribution. + builtins?: string[] | {[builtinName: string]: string} | boolean; + // set if external modules should be bundled. Defaults to true. + bundleExternal?: boolean; + // When true, always insert process, global, __filename, and __dirname without analyzing the AST for faster builds but larger output bundles. Default false. + insertGlobals?: boolean; + // When true, scan all files for process, global, __filename, and __dirname, defining as necessary. + // With this option npm modules are more likely to work but bundling takes longer. Default true. + detectGlobals?: boolean; + // When true, add a source map inline to the end of the bundle. This makes debugging easier because you can see all the original files if you are in a modern enough browser. + debug?: boolean; + // When a non-empty string, a standalone module is created with that name and a umd wrapper. + // You can use namespaces in the standalone global export using a . in the string name as a separator, for example 'A.B.C'. + // The global export will be sanitized and camel cased. + standalone?: string; + // will be passed to insert-module-globals as the opts.vars parameter. + insertGlobalVars?: {[globalName: string]: (file: string, basedir: string) => any}; + // defaults to 'require' in expose mode but you can use another name. + externalRequireName?: string; + } + + interface BrowserifyConstructor { + (files: InputFile[], opts?: Options): BrowserifyObject; + (file: InputFile, opts?: Options): BrowserifyObject; + (opts: Options): BrowserifyObject; + (): BrowserifyObject + new(files: InputFile[], opts?: Options): BrowserifyObject; + new(file: InputFile, opts?: Options): BrowserifyObject; + new(opts: Options): BrowserifyObject; + new(): BrowserifyObject + } + + interface BrowserifyObject extends NodeJS.EventEmitter { + /** + * Add an entry file from file that will be executed when the bundle loads. + * If file is an array, each item in file will be added as an entry file. + */ + add(file: InputFile[], opts?: FileOptions): BrowserifyObject; + add(file: InputFile, opts?: FileOptions): BrowserifyObject; + /** + * Make file available from outside the bundle with require(file). + * The file param is anything that can be resolved by require.resolve(). + * file can also be a stream, but you should also use opts.basedir so that relative requires will be resolvable. + * If file is an array, each item in file will be required. In file array form, you can use a string or object for each item. Object items should have a file property and the rest of the parameters will be used for the opts. + * Use the expose property of opts to specify a custom dependency name. require('./vendor/angular/angular.js', {expose: 'angular'}) enables require('angular') + */ + require(file: InputFile, opts?: FileOptions): BrowserifyObject; + /** + * Bundle the files and their dependencies into a single javascript file. + * Return a readable stream with the javascript file contents or optionally specify a cb(err, buf) to get the buffered results. + */ + bundle(cb?: (err: any, src: Buffer) => any): NodeJS.ReadableStream; + /** + * Prevent file from being loaded into the current bundle, instead referencing from another bundle. + * If file is an array, each item in file will be externalized. + * If file is another bundle, that bundle's contents will be read and excluded from the current bundle as the bundle in file gets bundled. + */ + external(file: string[], opts?: { basedir?: string }): BrowserifyObject; + external(file: string, opts?: { basedir?: string }): BrowserifyObject; + external(file: BrowserifyObject): BrowserifyObject; + /** + * Prevent the module name or file at file from showing up in the output bundle. + * Instead you will get a file with module.exports = {}. + */ + ignore(file: string, opts?: { basedir?: string }): BrowserifyObject; + /** + * Prevent the module name or file at file from showing up in the output bundle. + * If your code tries to require() that file it will throw unless you've provided another mechanism for loading it. + */ + exclude(file: string, opts?: { basedir?: string }): BrowserifyObject; + /** + * Transform source code before parsing it for require() calls with the transform function or module name tr. + * If tr is a function, it will be called with tr(file) and it should return a through-stream that takes the raw file contents and produces the transformed source. + * If tr is a string, it should be a module name or file path of a transform module + */ + transform(tr: string, opts?: T): BrowserifyObject; + transform(tr: (file: string, opts: T) => NodeJS.ReadWriteStream, opts?: T): BrowserifyObject; + /** + * Register a plugin with opts. Plugins can be a string module name or a function the same as transforms. + * plugin(b, opts) is called with the Browserify instance b. + */ + plugin(plugin: string, opts?: T): BrowserifyObject; + plugin(plugin: (b: BrowserifyObject, opts: T) => any, opts?: T): BrowserifyObject; + /** + * Reset the pipeline back to a normal state. This function is called automatically when bundle() is called multiple times. + * This function triggers a 'reset' event. + */ + reset(opts?: Options): void; + + /** + * When a file is resolved for the bundle, the bundle emits a 'file' event with the full file path, the id string passed to require(), and the parent object used by browser-resolve. + * You could use the file event to implement a file watcher to regenerate bundles when files change. + */ + on(event: 'file', listener: (file: string, id: string, parent: any) => any): BrowserifyObject; + /** + * When a package.json file is read, this event fires with the contents. + * The package directory is available at pkg.__dirname. + */ + on(event: 'package', listener: (pkg: any) => any): BrowserifyObject; + /** + * When .bundle() is called, this event fires with the bundle output stream. + */ + on(event: 'bundle', listener: (bundle: NodeJS.ReadableStream) => any): BrowserifyObject; + /** + * When the .reset() method is called or implicitly called by another call to .bundle(), this event fires. + */ + on(event: 'reset', listener: () => any): BrowserifyObject; + /** + * When a transform is applied to a file, the 'transform' event fires on the bundle stream with the transform stream tr and the file that the transform is being applied to. + */ + on(event: 'transform', listener: (tr: NodeJS.ReadWriteStream, file: string) => any): BrowserifyObject; + on(event: string, listener: Function): BrowserifyObject; + + /** + * Set to any until substack/labeled-stream-splicer is defined + */ + pipeline: any; + } } declare module "browserify" { - var browserify: Browserify; + var browserify: Browserify.BrowserifyConstructor; export = browserify; } diff --git a/envify/envify.d.ts b/envify/envify.d.ts index 39479f503..cc343ad33 100644 --- a/envify/envify.d.ts +++ b/envify/envify.d.ts @@ -3,12 +3,14 @@ // Definitions by: Qubo // Definitions: https://github.com/borisyankov/DefinitelyTyped +/// + declare module "envify" { - var envify: Function; + var envify: (file: string, environment: { [name: string]: any }) => NodeJS.ReadWriteStream; export = envify; } declare module "envify/custom" { - function envify(environment: { [name: string]: any }): Function; + function envify(environment: { [name: string]: any }): (file: string, environment: { [name: string]: any }) => NodeJS.ReadWriteStream; export = envify; } From ce92abb3f1083af6067b70506ec2b12e54f0ecb3 Mon Sep 17 00:00:00 2001 From: Chris Baker Date: Fri, 20 Nov 2015 00:44:01 +0000 Subject: [PATCH 051/389] Added cal-heatmap definition A JavaScript module to create a calendar heatmap https://github.com/wa0x6e/cal-heatmap http://cal-heatmap.com/ --- cal-heatmap/cal-heatmap-tests.ts | 723 +++++++++++++++++++++++++++++++ cal-heatmap/cal-heatmap.d.ts | 514 ++++++++++++++++++++++ 2 files changed, 1237 insertions(+) create mode 100644 cal-heatmap/cal-heatmap-tests.ts create mode 100644 cal-heatmap/cal-heatmap.d.ts diff --git a/cal-heatmap/cal-heatmap-tests.ts b/cal-heatmap/cal-heatmap-tests.ts new file mode 100644 index 000000000..4a7b0cb94 --- /dev/null +++ b/cal-heatmap/cal-heatmap-tests.ts @@ -0,0 +1,723 @@ +/// +/// +/// + +var cal = new CalHeatMap(); +cal.init(); +cal.init({}); + +cal.init({ itemSelector: "div" }); +cal.init({ itemSelector: "#id" }); +cal.init({ itemSelector: ".class" }); +cal.init({ itemSelector: "[title=hi]" }); +cal.init({ itemSelector: "div > span + b" }); + +cal.init({ itemSelector: document.getElementById("myId") }); +cal.init({ itemSelector: document.getElementsByClassName(".class")[0] }); +cal.init({ itemSelector: document.querySelector(".class") }); +cal.init({ itemSelector: $(".class")[0] }); +cal.init({ itemSelector: d3.select(".class")[0][0] }); + +cal.init({ + itemSelector: "#domain-a", + domain: "month", + subDomain: "day", + cellSize: 20, + subDomainTextFormat: "%d", + range: 1, + displayLegend: false +}); + +cal.init({ + itemSelector: "#domain-b", + domain: "month", + subDomain: "x_day", + cellSize: 20, subDomainTextFormat: "%d", + range: 1, + displayLegend: false +}); + +cal.init({ + itemSelector: "#cellSize-a", + domain: "day", + range: 1, + displayLegend: false +}); + +cal.init({ + itemSelector: "#cellSize-b", + domain: "day", + range: 1, + cellSize: 15, + displayLegend: false +}); + +cal.init({ + itemSelector: "#cellPadding-a", + domain: "day", + range: 1, + displayLegend: false +}); + +cal.init({ + itemSelector: "#cellPadding-b", + domain: "day", + range: 1, + cellPadding: 5, + displayLegend: false +}); + +cal.init({ + itemSelector: "#cellRadius-a", + cellSize: 15, + domain: "day", + range: 1, + displayLegend: false +}); + +cal.init({ + itemSelector: "#cellRadius-b", + cellSize: 15, + domain: "day", + range: 1, + cellRadius: 10, + displayLegend: false +}); + +cal.init({ + itemSelector: "#domainGutter-a", + domain: "day", + range: 2, + displayLegend: false +}); + +cal.init({ + itemSelector: "#domainGutter-b", + domain: "day", + range: 2, + domainGutter: 10, + displayLegend: false +}); + +cal.init({ + itemSelector: "#domainMargin-a", + domain: "day", + range: 2, + displayLegend: false +}); + +cal.init({ + itemSelector: "#domainMargin-b", + domain: "day", + range: 2, + displayLegend: false, + domainMargin: 10 +}); + +cal.init({ + itemSelector: "#domainDynamicDimension-a", + domain: "month", + range: 5, + cellSize: 8, + displayLegend: false, + nextSelector: "#domainDynamicDimension-next", + previousSelector: "#domainDynamicDimension-previous" +}); + +cal.init({ + itemSelector: "#domainDynamicDimension-b", + domain: "month", + range: 5, + cellSize: 8, + displayLegend: false, + domainDynamicDimension: false, + nextSelector: "#domainDynamicDimension-next", + previousSelector: "#domainDynamicDimension-previous", + itemNamespace: "domainDynamicDimension" +}); + +cal.init({ + itemSelector: "#verticalOrientation-a", + domain: "day", + range: 2, + displayLegend: false +}); + +cal.init({ + itemSelector: "#verticalOrientation-b", + domain: "day", + range: 2, + displayLegend: false, + verticalOrientation: true +}); + +cal.init({ + itemSelector: "#label-a", + domain: "day", + range: 2, + displayLegend: false +}); + +cal.init({ + itemSelector: "#label-b", + domain: "day", + range: 2, + displayLegend: false, + label: { + position: "top" + } +}); + +cal.init({ + itemSelector: "#label-c", + domain: "day", + range: 2, + displayLegend: false, + label: { + position: "left", + width: 46 + } +}); + +cal.init({ + itemSelector: "#label-d", + domain: "day", + range: 2, + displayLegend: false, + label: { + position: "right", + width: 46, + offset: { x: 10, y: 30 } + } +}); + +cal.init({ + itemSelector: "#label-e", + domain: "day", + range: 2, + displayLegend: false, + label: { + position: "left", + width: 46, + rotate: "left" + } +}); + +cal.init({ + itemSelector: "#label-f", + domain: "day", + range: 2, + displayLegend: false, + label: { + position: "right", + width: 150, + rotate: "left" + } +}); + +cal.init({ + itemSelector: "#label-g", + domain: "day", + range: 2, + displayLegend: false, + label: { + position: "right", + width: 46, + rotate: "left" + } +}); + +cal.init({ + itemSelector: "#label-h", + domain: "day", + range: 2, + displayLegend: false, + label: { + position: "right", + width: 46, + rotate: "right", + align: "right" + } +}); + +cal.init({ + itemSelector: "#colLimit-a", + domain: "day", + range: 1, + displayLegend: false +}); + +cal.init({ + itemSelector: "#colLimit-b", + domain: "day", + colLimit: 24, + range: 1, + displayLegend: false +}); + +cal.init({ + itemSelector: "#rowLimit-a", + domain: "month", + range: 1, + displayLegend: false +}); + +cal.init({ + itemSelector: "#rowLimit-b", + domain: "month", + rowLimit: 10, + range: 1, + displayLegend: false +}); + +cal.init({ + itemSelector: "#tooltip-a", + domain: "month", + range: 1, + displayLegend: false +}); + +cal.init({ + itemSelector: "#tooltip-b", + domain: "month", + range: 1, + displayLegend: false, + tooltip: true +}); + +cal.init({ + itemSelector: "#start-a", + domain: "day", + range: 2, + displayLegend: false +}); + +cal.init({ + itemSelector: "#start-b", + domain: "day", + range: 2, + start: new Date(2000, 0, 15), + displayLegend: false +}); + +cal.init({ + start: new Date(2000, 0), // January, 1st 2000 + range: 12, + domain: "year", + subDomain: "month", + data: "http://localhost/api?start={{d:start}}&stop={{d:end}}" +}); + +cal.init({ + data: "http://localhost/datas.csv", + dataType: "csv" +}); + +var dt = new Date(); +dt.setDate(dt.getDate() + 1); +cal.init({ + itemSelector: "#highlight-a", + domain: "day", + range: 2, + displayLegend: false, + highlight: ["now", dt] +}); + +cal.init({ + itemSelector: "#weekStartOnMonday-a", + domain: "month", + subDomain: "x_day", + cellSize: 20, + subDomainTextFormat: "%d", + range: 1, + displayLegend: false +}); + +cal.init({ + itemSelector: "#weekStartOnMonday-b", + domain: "month", + subDomain: "x_day", + cellSize: 20, + subDomainTextFormat: "%d", + range: 1, + weekStartOnMonday: false, + displayLegend: false +}); + +cal.init({ + itemSelector: "#minDate-a", + domain: "month", + start: new Date(2000, 4), + minDate: new Date(2000, 1), + maxDate: new Date(2000, 8), + subDomain: "day", + range: 4, + displayLegend: false +}); + +cal.init({ + itemSelector: "#legend-a", + domain: "day", + range: 2 +}); + +cal.init({ + itemSelector: "#legend-b", + domain: "day", + range: 2, legend: [-2.5, 0, 2.5] +}); + +cal.init({ + itemSelector: "#displayLegend-a", + domain: "day", + range: 2 +}); + +cal.init({ + itemSelector: "#displayLegend-b", + domain: "day", + range: 2, + displayLegend: false +}); + +cal.init({ + itemSelector: "#legendCellSize-a", + domain: "day", + range: 2 +}); + +cal.init({ + itemSelector: "#legendCellSize-b", + domain: "day", + range: 2, legendCellSize: 5 +}); + +cal.init({ + itemSelector: "#legendCellPadding-a", + domain: "day", + range: 3 +}); + +cal.init({ + itemSelector: "#legendCellPadding-b", + domain: "day", + range: 3, legendCellPadding: 5 +}); + +cal.init({ + itemSelector: "#legendMargin-a", + domain: "day", + range: 3 +}); + +cal.init({ + itemSelector: "#legendMargin-b", + domain: "day", + range: 3, + legendMargin: [50, 0, 0, 50] +}); + +cal.init({ + itemSelector: "#legendVerticalPosition-a", + domain: "day", + range: 2 +}); + +cal.init({ + itemSelector: "#legendVerticalPosition-b", + domain: "day", + range: 2, + legendVerticalPosition: "top", + legendMargin: [0, 0, 10, 0] +}); + +cal.init({ + itemSelector: "#legendVerticalPosition-c", + domain: "day", + range: 2, + legendVerticalPosition: "center", + legendMargin: [0, 10, 0, 0] +}); + +cal.init({ + itemSelector: "#legendVerticalPosition-d", + domain: "day", + range: 2, + legendVerticalPosition: "center", + legendHorizontalPosition: "right", + legendMargin: [0, 0, 0, 10] +}); + +cal.init({ + itemSelector: "#legendHorizontalPosition-a", + domain: "day", + range: 3 +}); + +cal.init({ + itemSelector: "#legendHorizontalPosition-b", + domain: "day", + range: 3, + legendHorizontalPosition: "right" +}); + +cal.init({ + itemSelector: "#legendOrientation-a", + domain: "day", + range: 3, + legendVerticalPosition: "center", + legendOrientation: "vertical", + legendMargin: [0, 10, 0, 0] +}); + +cal.init({ + itemSelector: "#legendOrientation-b", + domain: "month", + subDomain: "x_day", + range: 3, + verticalOrientation: true, + legendVerticalPosition: "center", + legendHorizontalPosition: "right", + legendOrientation: "vertical", + legendMargin: [0, 0, 0, 20] +}); + +cal.init({ + legendColors: { + min: "#efefef", + max: "steelblue", + empty: "white" + // Will use the CSS for the missing keys + } +}); + +cal.init({ + legendColors: ["#efefef", "steelblue"] +}); + +cal.init({ + itemName: ["cat", "cats"] +}); +cal.init({ + itemName: "cat" +}); +cal.init({ + itemName: ["cat"] +}); + +cal.init({ + subDomainDateFormat: function(date: Date): string + { + return date.toString(); + } +}); + +cal.init({ + itemSelector: "#subDomainTextFormat-a", + start: new Date(2000, 0, 1, 1), + domain: "month", + subDomain: "x_day", + cellSize: 20, + range: 1, + displayLegend: false, + subDomainTextFormat: "%d" +}); + +cal.init({ + itemSelector: "#subDomainTextFormat-b", + start: new Date(2000, 0, 1, 1), + data: "datas-years.json", + domain: "month", + subDomain: "x_day", + cellSize: 20, + range: 1, + displayLegend: false, + subDomainTextFormat: function(date: Date, value: number): number + { + return value; + } +}); + +cal.init({ + itemSelector: "#domainLabelFormat-a", + domain: "month", + subDomain: "day", + range: 1, + displayLegend: false +}); + +cal.init({ + itemSelector: "#domainLabelFormat-b", + domain: "month", + subDomain: "day", + range: 1, + displayLegend: false, + domainLabelFormat: "%m-%Y" +}); + +cal.init({ + itemSelector: "#legendTitleFormat-a", + domain: "day", + range: 3 +}); + +cal.init({ + itemSelector: "#animationDuration-a", + domain: "day", + range: 4, + previousSelector: "#animationDuration-previous", + nextSelector: "#animationDuration-next", + itemNamespace: "animationDuration-a" +}); + +cal.init({ + itemSelector: "#animationDuration-b", + domain: "day", + range: 4, animationDuration: 1500, + previousSelector: "#animationDuration-previous", + nextSelector: "#animationDuration-next", + itemNamespace: "animationDuration-b" +}); + +cal.init({ + itemSelector: "#previousSelector-a", + domain: "day", + range: 4, + previousSelector: "#previousSelector-a-previous", + nextSelector: "#previousSelector-a-next" +}); + +cal.init({ + itemSelector: "#previousSelector-b", + domain: "day", + range: 4, + previousSelector: "#example-previousSelector ul + p > em", + nextSelector: "#example-previousSelector [title=next] li" +}); + +cal.init({ + nextSelector: "#next" // Attach #next onClick event to cal.next() +}); + +cal.init({ + nextSelector: "#next", + // Attach #next.cal onClick event to cal.next() + itemNamespace: "cal" +}); + + +cal.previous(); +cal.previous(5); + +cal.next(); +cal.next(5); + +cal.jumpTo(new Date(2000, 4)); +cal.jumpTo(new Date(2000, 4), true); + +cal.rewind(); + +var randomData = {}; +cal.update(randomData); +cal.update(randomData, () => { }, cal.RESET_ALL_ON_UPDATE); +cal.update(randomData, false, cal.APPEND_ON_UPDATE); +cal.update(randomData, false, cal.RESET_SINGLE_ON_UPDATE); + +cal.highlight(new Date(2000, 0, 2)); + +// Add January 5th to already highlighted dates +cal.options.highlight.push(new Date(2000, 0, 5)); +cal.highlight(cal.options.highlight); + +var svg: string = cal.getSVG(); + + +cal.options.legendVerticalPosition = "center"; +cal.options.legendHorizontalPosition = "right"; +cal.options.legendOrientation = "vertical"; + + +cal.setLegend(); + +cal.removeLegend(); + +cal.showLegend(); + +cal = cal.destroy(); + + +cal.init({ + itemSelector: "#onClick-a", + domain: "day", + range: 5, data: "datas-years.json", + start: new Date(2000, 0), + onClick: function(date: Date, nb: number) + { + $("#onClick-placeholder").html("You just clicked
on " + + date + "
with " + + (nb === null ? "unknown" : nb) + " items" + ); + } +}); + +cal.init({ + itemSelector: "#afterLoad-a", + domain: "day", + range: 5, + afterLoad: function() { }, + onComplete: function() { } +}); + +cal.init({ + itemSelector: "#afterLoadPreviousDomain-a", + domain: "day", + range: 5, afterLoadPreviousDomain: function(date: Date) { }, + previousSelector: "#afterLoadPreviousDomain-selector" +}); + +cal.init({ + itemSelector: "#afterLoadNextDomain-a", + domain: "day", + range: 5, afterLoadNextDomain: function(date: Date) { }, + nextSelector: "#afterLoadNextDomain-selector" +}); + +cal.init({ + itemSelector: "#onComplete-a", + domain: "day", + range: 5, + onComplete: function() { } +}); + +var datas = [ + { date: 946702811, value: 15 }, + { date: 946702812, value: 25 }, + { date: 946702813, value: 10 } +] + +cal.init({ + data: datas, + afterLoadData: (data: any) => + { + var stats: CalHeatMap.DataFormat = {}; + for (var d in data) + { + stats[data[d].date] = data[d].value; + } + return stats; + } +}); + +cal.init({ + itemSelector: "#onMinDomainReached-a", + domain: "month", + range: 5, + start: new Date(2000, 4), + minDate: new Date(2000, 3), + maxDate: new Date(2000, 11), + onMinDomainReached: function(hit: boolean) { }, + onMaxDomainReached: function(hit: boolean) { }, + nextSelector: "#onMinDomainReached-next", + previousSelector: "#onMinDomainReached-previous", + displayLegend: false +}); diff --git a/cal-heatmap/cal-heatmap.d.ts b/cal-heatmap/cal-heatmap.d.ts new file mode 100644 index 000000000..b54e3a5bf --- /dev/null +++ b/cal-heatmap/cal-heatmap.d.ts @@ -0,0 +1,514 @@ +// Type definitions for cal-heatmap v3.5.4 +// Project: https://github.com/wa0x6e/cal-heatmap +// Definitions by: Chris Baker +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module CalHeatMap +{ + interface CalHeatMapStatic + { + new (): CalHeatMap; + } + + interface CalHeatMap + { + /** + * Initialise the CalHeatMap with the specified options + * @param {InitOptions} options The CalHeatMap options + */ + init(options?: InitOptions): void; + + options: RuntimeOptions; + + // Various update mode when using the update() API + /** Reset the whole calendar data before inserting the new data. */ + RESET_ALL_ON_UPDATE: number; + /** + * Update only the dates (subDomain) you pass in the data argument, replace their value by the new ones. + * All other dates are leaved untouched. + */ + RESET_SINGLE_ON_UPDATE: number; + /** + * Instead of replacing a date's value by a new one, increment it by the new value. All other dates are leaved untouched. + * That's the one you want to use of you're populating the calendar in realtime! + */ + APPEND_ON_UPDATE: number; + + /** + * Shift the calendar n domains back + * @param {number} n The number of domains to shift back. The default is 1. + */ + previous(n?: number): void; + /** + * Shift the calendar n domains forward + * @param {number} n The number of domains to shift forward. The default is 1. + */ + next(n?: number): void; + /** + * Jump the calendar to the specified date + * This method will shift the calendar backward or forward, until the domain containing the specified date is visible. + * @param {Date} date The date to jump to. + * @param {boolean} reset Whether to set the domain with the specified as the calendar's first domain. + */ + jumpTo(date: Date, reset?: boolean): void; + /** Reset the calendar back to the start date */ + rewind(): void; + /** + * Update the calendar with new data + * Use update() when you want to refresh the calendar with a new set of data. + * Particularly useful if you're filling the calendar in realtime, or if you want to display a subset of the current data. + * @param {string|Object} data Accept the same format as the data option. + * @param {} afterLoad Whether to execute the afterLoad() callback to convert your data into the json object, expected by cal-heatmap. + * It can also directly takes a function, in case your data can not be converted with the afterLoad() function you defined. + * @param {} updateMode Define how to insert the new data into the calendar. + * Accepted values are: + * Instance.RESET_ALL_ON_UPDATE (default) Reset the whole calendar data before inserting the new data. + * Instance.RESET_SINGLE_ON_UPDATE Update only the dates (subDomain) you pass in the data argument, + * replace their value by the new ones. All other dates are leaved untouched. + * Instance.APPEND_ON_UPDATE Instead of replacing a date's value by a new one, increment it by the new value. + * All other dates are leaved untouched. That's the one you want to use of you're + * populating the calendar in realtime! + */ + update(data: string | Object, afterLoad?: boolean | Function, updateMode?: number): void; + /** + * Change the highlighted dates. + * Takes an array of Date object. Can also accepts the now string, equivalent to Date.now(). + * @param {string|Date|Date[]} dates The date or dates to highlight. + */ + highlight(dates: string | Date | Date[]): void; + /** + * Return the SVG source code with the appropriate CSS + * The returned string code is valid and ready to be placed in a .svg file. + * @returns SVG source code with the appropriate CSS. + */ + getSVG(): string; + /** + * Change the legend settings and/or threshold + * When called without arguments, setLegend() will just redraw the legend. + * @param {} legend Same as legend : an array of thresholds + * @param {} legendColor Same as legendColors : an object with the heatmap's colors, or an array of 2 colors + */ + setLegend(legend?: number[], legendColors?: LegendColor | string[]): void; + /** + * Remove the legend from the calendar + * Settings are kept and you can re-add the legend with the same settings using showLegend(). + */ + removeLegend(): void; + /** Display the legend, if not already shown. */ + showLegend(): void; + /** + * Remove the calendar from the DOM + * Remember to self-assign the result of destroy() to your calendar instance, or it'll lead to a memory leak. + * @param {Function} callback function that will be executed when the calendar is removed from the DOM, at the end of the animation. + * @returns always returns null. + */ + destroy(callback?: Function): CalHeatMap; + } + + interface LegendColor + { + /** Color of the smallest value on the legend */ + min: string; + /** Color of the highest value on the legend */ + max: string; + /** Color for the dates with value == 0 */ + empty?: string; + /** Base color of the date cells */ + base?: string; + /** Color for the special value */ + overflow?: string; + } + + interface InitOptions + { + // ================================================ + // Presentation + // ================================================ + + /** DOM node to insert the calendar in. Default: "#cal-heatmap" */ + itemSelector?: string | HTMLElement | Element | EventTarget; + + /** + * Type of domain. Default: "hour" + * Valid domains: {"hour", "day", "week", "month", "year"} + */ + domain?: string; + + /** + * Type of subDomain. Default: "min" + * Valid subDomains: {"min", "x_min", "hour", "x_hour", "day", "x_day", "week", "x_week", "month", "x_month"} + */ + subDomain?: string; + + /** Number of domain to display. Default: 12 */ + range?: number; + + /** Size of each subDomain cell, in pixels. Default: 10 */ + cellSize?: number; + + /** Space between each subDomain cell, in pixel. Default: 2 */ + cellPadding?: number; + + /** subDomain cell's border radius, for rounder corner, in pixel. Default: 0 */ + cellRadius?: number; + + /** Space between each domain, in pixel. Default: 2 */ + domainGutter?: number; + + /** + * Margin around each domain, in pixel. Default: [0,0,0,0] + * Ordered like in CSS (top, right, bottom, left), it also accepts CSS like values + */ + domainMargin?: number | number[]; + + /** + * Whether to enable domain dynamic width and height. Default: true + * Some domain>subdomain couple, like month>days, doesn't always have the same number of + * subDomain cells. Some months have 6 weeks, some only 4. + * With dynamic dimension enabled, the domain width and height will be adjusted to fit the + * domain content, whereas when it's disabled, all domains will have the same dimension : the biggest. + */ + domainDynamicDimension?: boolean; + + /** To display the calendar vertically, with each domain one under the other. Default: false */ + verticalOrientation?: boolean; + + /** Position and alignment of the domain label. */ + label?: Label; + + /** + * Control the number of columns to split the domain dates into. Default: null + * Each domain is split into an arbitrary number of columns (or rows depending on the + * reading direction). You can overwrite that number with colLimit, and force all dates on the + * same line, or split them into more columns. + * That setting limit the maximum number of columns, and doesn't necessary means that each rows will + * contains that number of columns. + */ + colLimit?: number; + + /** Control the number of rows to split the domain dates into. Default: null + * If rowLimit and colLimit are both used, rowLimit will be ignored. */ + rowLimit?: number; + + /** Whether to display a tooltip when hovering over a date. Default: false */ + tooltip?: boolean; + + // ================================================ + // Data + // ================================================ + + /** + * Starting date of the calendar. Default: new Date() + * It doesn't have to be precise, the calendar will not start at that date, but at the first domain containing that date. + */ + start?: Date; + /** + * Data used to fill the calendar. Default: "" + * String is interpreted as a URL to an API, which should be returning the data used to fill the calendar. + */ + + data?: string | Object; + + /** + * Engine used to parse the data. Default: json + * Valid values: + * "json" - Interpret the data as json. + * "csv" - Interpret the data as csv. + * "tsv" - Interpret the data exactly like csv, but are delimited with a tab character, instead of comma. + * "txt" - Just return the data as a string. + */ + dataType?: string; + + /** + * Highlight selected subDomain cells. Default: false + * Takes an array of Date object. Can also accepts the now string, equivalent to Date.now(). + */ + highlight?: string | string[] | Date[] | any[]; + + /** Whether to start the week on Monday, instead of Sunday. Default: true */ + weekStartOnMonday?: boolean; + + /** + * Lower limit of the domain navigation, preventing navigating beyond a certain date. Default: null + * When set, calling previous() will only work only until the leftmost domain containing minDate. + * Like with start, minDate does not have to be precise, and just have to be a date inside the domain. + * previous() will always return true, unless the domain containing minDate is reached, in which case, it'll return false. + */ + minDate?: Date; + + /** Upper limit of the domain navigation, preventing navigating beyond a certain date. Default: null */ + maxDate?: Date; + + /** + * Whether to consider missing date:value couple in the data source as equal to 0. Default: false + * By default, when the a date is not associated to a value, it's considered as null, and rendered as a no value cell. + * You should ask yourself, if the API is not returning result for a date, is it because there is really no value + * associated to this date, or because it's supposed to be equal to 0, and it's skipped in order to save bandwidth ? + */ + considerMissingDataAsZero?: boolean; + + // ================================================ + // Legend + // ================================================ + + /** Assign each range of values to a color. Default: [10, 20, 30, 40] */ + legend?: number[]; + + /** Whether to display the legend. Default: true */ + displayLegend?: boolean; + + /** Size of the legend cells, in pixels. Default: 10 */ + legendCellSize?: number; + + /** Padding between each legend cell, in pixels. Default: 2 */ + legendCellPadding?: number; + + /** Margin around the legend, in pixels. Default: [10, 0, 0, 0] */ + legendMargin?: number | number[]; + + /** + * Vertical position of the legend. Default: "bottom" + * Valid values: + * "top" - Place the legend above the calendar + * "center" - Place the legend on the calendar's side + * Use with legendHorizontalPosition, to position the legend on the left (default) or on the right. + * "bottom" - Place the legend on below the calendar + */ + legendVerticalPosition?: string; + + /** + * Horizontal position of the legend. Default: "left" + * Valid values: + * "left" - Align the legend to the left + * "center" - Center the legend + * "right" - Align the legend to the right + */ + legendHorizontalPosition?: string; + + /** + * Orientation of the legend. Default: "horizontal" + * legendOrientation is best used together with legendHorizontalPosition when the legend is positioned on the side. + * Valid values: + * "horizontal" - Legend is displayed horizontally, from left to right + * "vertical" - Legend is displayed vertically, from top to bottom + */ + legendOrientation?: string; + + /** + * Set of colors to automagically compute the heatmap colors. + * Instead of relying on the CSS for your heatmap's colors, you can also set the heatmap's colors directly with + * cal-heatmap on initialization, or even dynamically change them after. + * All legend settings can be changed dynamically after calendar initialisation, with setLegend(). + */ + legendColors?: LegendColor | string[]; + + // ================================================ + // i18n + // ================================================ + + /** + * Name of the entity you're representing on the calendar. + * Takes an array of string, with the first index as the singular form, and the second index the plural form. + * For the lazy, you can also pass a simple string, ar a single element array, and it'll automatically guess + * the plural form, as long as it's the singular form plus the "s" suffix. + */ + itemName?: string | string[]; + /** + * Format of the title displayed when hovering a subDomain. + * Some template strings are available, and enclosed in braces. + * {name} Name of the entity represented in the calendar (see itemName) + * {count} The value associated to the date. + * {date} The date of the cell. It's automatically formatted according to the type of subDomain. + * See subDomainDateFormat to further customize that date formatting. + * {connector} An English preposition placed before a datetime (on Monday, at 15:00, etc.). Each subDomain + * have their own default connector, corresponding to the default date format. + */ + subDomainTitleFormat?: SubDomainFormatTemplates; + /** + * Format of the {date} template string inside subDomainTitleFormat. + * {date} is by default formatted according to the subDomain type. + * subDomainFormat can accept any string with directive accepted by d3.time.format(), like "%Y-%m-%d". + * As d3.time.format() will only output English dates, subDomainDateFormat can also accept a function, + * with the subDomain date as the argument. + */ + subDomainDateFormat?: string | Function; + /** + * Format of the text inside a subDomain cell. + * Disabled by default, you can display a text inside each subDomain cell. + * Works exactly like subDomainDateFormat, except that the function takes the cell value as second argument. + */ + subDomainTextFormat?: string | Function; + /** + * Format of the domain label. + * Works exactly like subDomainDateFormat, and will format the domain label with any string accepted by d3.time.format(), or a function. + * To not display the domain label, set domainLabelFormat to "" (empty string). + */ + domainLabelFormat?: string | Function; + /** + * Formatting of the legend title, displayed when hovering a legend cell. + * Some template strings are available, and enclosed in braces. + * {name} Name of the entity represented in the calendar (see itemName) + * {min} The first value of the legend array. + * {max} The last value of the legend array. + * {down} The lower bound of a color + * {up} The upper bound of a color + */ + legendTitleFormat?: LegendTitleTemplates; + + // ================================================ + // Other + // ================================================ + + /** Animation duration, in milliseconds. Default value: 500 */ + animationDuration?: number; + /** + * Will attach the previous() event to the specified element, on a mouse click, shifting the calendar one domain back. Default value: false + * If you want to shift by more than one domain, see the previous() method. + */ + previousSelector?: string | HTMLElement; + /** + * Will attach the next() event to the specified element, on a mouse click, shifting the calendar one domain forward. Default value: false + * If you want to shift by more than one domain, see the next() method. + */ + nextSelector?: string | HTMLElement; + /** + * The calendar instance namespace. + * If you have more than one instance of Cal-Heatmap, you should assign each instance its own namespace, in order to isolate each instance event handler. + */ + itemNamespace?: string; + + // ================================================ + // Events + // ================================================ + + /** Called after a mouse click event on a subDomain cell. */ + onClick?: (date: Date, value: number) => void; + /** Called after drawing the empty calendar, and before filling it with data. */ + afterLoad?: () => void; + /** + * Called after shifting the calendar one domain back. + * The date argument is the start date of the domain that was added. + */ + afterLoadPreviousDomain?: (date: Date) => void; + /** + * Called after shifting the calendar one domain forward. + * The date argument is the start date of the domain that was added. + */ + afterLoadNextDomain?: (date: Date) => void; + /** + * Called after drawing and filling the calendar. + * Useful in case you're loading data via ajax, as it's loading data asynchronously. This event will wait for the ajax + * request to complete before triggering. + * This event will only trigger once, on the initial setup. See afterLoadPreviousDomain and afterLoadNextDomain for + * callback events after a domain navigation. + */ + onComplete?: () => void; + /** + * Called after getting the data from source, but before filling the calendar. + * This callback must return a json object formatted in the expected data format. + * afterLoadData() is used to do some works on the data, especially when the data source is not returning data in the expected format. + */ + afterLoadData?: (data: any) => DataFormat; + /** + * Triggered after previous(), when the incoming domain is containing minDate. + * When the leftmost domain set by minDate is loaded into the calendar, onMinDomainReached() will be triggered with true as argument. + * This event is useful if you want to disable your previous button, since there is no more previous domains to load. + * In order to reverse the action, onMinDomainReached() will be called with false as argument afer next(), only once, and only if the + * leftmost domain is not the lower limit domain anymore. + */ + onMinDomainReached?: (reached: boolean) => void; + /** + * Triggered after next(), when the incoming domain is containing maxDate. + * See onMinDomainReached(). + */ + onMaxDomainReached?: (reached: boolean) => void; + } + + interface RuntimeOptions extends InitOptions + { + /** Margin around each domain, in pixels. Ordered like in CSS (top, right, bottom, left) */ + domainMargin: number[]; + /** Margin around the legend, in pixels. Ordered like in CSS (top, right, bottom, left) */ + legendMargin: number[]; + /** List of dates to highlight */ + highlight: Date[]; + /** + * Name of the items to represent in the calendar. + * First index is singular form, and the second index, the plural form. + */ + itemName: string[]; + } + + interface LegendTitleTemplates + { + /** Formatting of the smallest (leftmost) value of the legend. Default value: "less than {min} {name}" */ + lower?: string; + /** Formatting of all the value but the first and the last. Default value: "between {down} and {up} {name}" */ + inner?: string; + /** Formatting of the biggest (rightmost) value of the legend. Default value: "more than {max} {name}" */ + upper?: string; + } + + interface SubDomainFormatTemplates + { + /** Format of the title when there is no value associated to the date. Default value: "{date}" */ + empty?: string; + /** Format of the title when it's associated to a value. Default value: "{count} {name} {connector} {date}" */ + filled?: string; + } + + interface DataFormat + { + /** timestamp are in seconds, value can be any number (integer or float) */ + [timestamp: string]: number; + } + + interface LabelOffset + { + x: number; + y: number; + } + + /** Position and alignment of the domain label. */ + interface Label + { + /** + * Position of the label, relative to the domain. Default: "bottom" + * Valid values: {"top", "right", "bottom", "left"} + */ + position?: string; + + /** + * Horizontal align of the domain. Default: "center" + * Valid values: {"left", "center", "right"} + */ + align?: string; + /** + * Rotation for a vertical label. Default: null + * Valid values: {null, "left", "right"} + */ + rotate?: string; + /** + * Only used when label is rotated, defines the width of the label. Default: 100 + * Valid values: any intger + */ + width?: number; + /** + * More control about label positioning, if the default value does not fit your need, + * especially when label is rotated, or when using a big font-size. Default: {x:0, y:0} + */ + offset?: LabelOffset; + /** + * Height of the domain label in pixels. + * By leaving it to null, the label will be set to 2 times the height of the subDomain cell. + * If you want to remove the label, set domainLabelFormat to "" (empty string), instead + * of setting the label height to 0. Default: null + * Valid values: any integer + */ + height?: number; + } +} + +declare var CalHeatMap: CalHeatMap.CalHeatMapStatic; From d0e0aacb36bb7d0706fc06a75fe7c1f9bca178d9 Mon Sep 17 00:00:00 2001 From: Sergey Buturlakin Date: Fri, 20 Nov 2015 11:18:51 +0200 Subject: [PATCH 052/389] add deprecated but supported methods --- react-router/history.d.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/react-router/history.d.ts b/react-router/history.d.ts index 4fd7c5a0f..c527e83e8 100644 --- a/react-router/history.d.ts +++ b/react-router/history.d.ts @@ -10,7 +10,7 @@ declare namespace HistoryModule { type Action = string - type BeforeUnloadHook = () => string + type BeforeUnloadHook = () => string | boolean type CreateHistory = (options?: HistoryOptions) => T @@ -22,7 +22,6 @@ declare namespace HistoryModule { transitionTo(location: Location): void pushState(state: LocationState, path: Path): void replaceState(state: LocationState, path: Path): void - setState(state: LocationState): void // deprecated go(n: number): void goBack(): void goForward(): void @@ -30,6 +29,13 @@ declare namespace HistoryModule { createPath(path: Path): Path createHref(path: Path): Href createLocation(path?: Path, state?: LocationState, action?: Action, key?: LocationKey): Location + + /** @deprecated use location.key to save state instead */ + setState(state: LocationState): void + /** @deprecated use listenBefore instead */ + registerTransitionHook(hook: TransitionHook): void + /** @deprecated use the callback returned from listenBefore instead */ + unregisterTransitionHook(hook: TransitionHook): void } type HistoryOptions = Object @@ -63,7 +69,7 @@ declare namespace HistoryModule { interface HistoryBeforeUnload { - listenBeforeUnload(hook: () => string | boolean): Function + listenBeforeUnload(hook: BeforeUnloadHook): Function } interface HistoryQueries { From 51cd044cad5888e46d6a3fa6374a90b19a0feedf Mon Sep 17 00:00:00 2001 From: Sergey Buturlakin Date: Fri, 20 Nov 2015 11:20:02 +0200 Subject: [PATCH 053/389] update useRoutes history enhancer result interface --- react-router/react-router.d.ts | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/react-router/react-router.d.ts b/react-router/react-router.d.ts index c36376077..7063d2ab6 100644 --- a/react-router/react-router.d.ts +++ b/react-router/react-router.d.ts @@ -82,7 +82,7 @@ declare namespace ReactRouter { history?: H.History routes?: RouteConfig // alias for children createElement?: (component: RouteComponent, props: Object) => any - onError?: (err: any) => any + onError?: (error: any) => any onUpdate?: () => any parseQueryString?: ParseQueryString stringifyQuery?: StringifyQuery @@ -127,8 +127,8 @@ declare namespace ReactRouter { path?: RoutePattern component?: RouteComponent components?: RouteComponents - getComponent?: (location: H.Location, cb: (err: any, component?: RouteComponent) => void) => void - getComponents?: (location: H.Location, cb: (err: any, components?: RouteComponents) => void) => void + getComponent?: (location: H.Location, cb: (error: any, component?: RouteComponent) => void) => void + getComponents?: (location: H.Location, cb: (error: any, components?: RouteComponents) => void) => void onEnter?: EnterHook onLeave?: LeaveHook } @@ -141,14 +141,14 @@ declare namespace ReactRouter { path?: RoutePattern component?: RouteComponent components?: RouteComponents - getComponent?: (location: H.Location, cb: (err: any, component?: RouteComponent) => void) => void - getComponents?: (location: H.Location, cb: (err: any, components?: RouteComponents) => void) => void + getComponent?: (location: H.Location, cb: (error: any, component?: RouteComponent) => void) => void + getComponents?: (location: H.Location, cb: (error: any, components?: RouteComponents) => void) => void onEnter?: EnterHook onLeave?: LeaveHook indexRoute?: PlainRoute - getIndexRoute?: (location: H.Location, cb: (err: any, indexRoute: RouteConfig) => void) => void + getIndexRoute?: (location: H.Location, cb: (error: any, indexRoute: RouteConfig) => void) => void childRoutes?: PlainRoute[] - getChildRoutes?: (location: H.Location, cb: (err: any, childRoutes: RouteConfig) => void) => void + getChildRoutes?: (location: H.Location, cb: (error: any, childRoutes: RouteConfig) => void) => void } @@ -167,8 +167,8 @@ declare namespace ReactRouter { interface IndexRouteProps extends React.Props { component?: RouteComponent components?: RouteComponents - getComponent?: (location: H.Location, cb: (err: any, component?: RouteComponent) => void) => void - getComponents?: (location: H.Location, cb: (err: any, components?: RouteComponents) => void) => void + getComponent?: (location: H.Location, cb: (error: any, component?: RouteComponent) => void) => void + getComponents?: (location: H.Location, cb: (error: any, components?: RouteComponents) => void) => void onEnter?: EnterHook onLeave?: LeaveHook } @@ -207,11 +207,10 @@ declare namespace ReactRouter { /* utils */ interface HistoryRoutes { - isActive(pathname: H.Pathname, query: H.Query): boolean - registerRouteHook(route: PlainRoute, hook: RouteHook): void - unregisterRouteHook(route: PlainRoute, hook: RouteHook): void listen(listener: RouterListener): Function + listenBeforeLeavingRoute(route: PlainRoute, hook: RouteHook): void match(location: H.Location, callback: (error: any, nextState: RouterState, nextLocation: H.Location) => void): void + isActive(pathname: H.Pathname, query?: H.Query, indexOnly?: boolean): boolean } function useRoutes(createHistory: HistoryModule.CreateHistory): HistoryModule.CreateHistory From 99f6493ffb1ef5479c6154ec9f82a47178bbf8b6 Mon Sep 17 00:00:00 2001 From: Sergey Buturlakin Date: Fri, 20 Nov 2015 11:31:28 +0200 Subject: [PATCH 054/389] add push and replace methods --- react-router/history.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/react-router/history.d.ts b/react-router/history.d.ts index c527e83e8..1b5c6dfad 100644 --- a/react-router/history.d.ts +++ b/react-router/history.d.ts @@ -22,6 +22,8 @@ declare namespace HistoryModule { transitionTo(location: Location): void pushState(state: LocationState, path: Path): void replaceState(state: LocationState, path: Path): void + push(path: Path): void + replace(path: Path): void go(n: number): void goBack(): void goForward(): void From e5f2a84d7da4b371a9b65fd52242466bb24e2daa Mon Sep 17 00:00:00 2001 From: edvin Date: Fri, 20 Nov 2015 14:32:45 +0100 Subject: [PATCH 055/389] Add reason to cancel method. --- bluebird/bluebird-1.0.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bluebird/bluebird-1.0.d.ts b/bluebird/bluebird-1.0.d.ts index 69a4f9152..db9dd0dd2 100644 --- a/bluebird/bluebird-1.0.d.ts +++ b/bluebird/bluebird-1.0.d.ts @@ -131,7 +131,7 @@ declare class Promise implements Promise.Thenable { * Promises are by default not cancellable. Use `.cancellable()` to mark a promise as cancellable. */ // TODO what to do with this? - cancel(): Promise; + cancel(reason?: any): Promise; /** * Like `.then()`, but cancellation of the the returned promise or any of its descendant will not propagate cancellation to this promise or this promise's ancestors. From aba20a4f6008036b4ff28e12e11c0e5815326e0a Mon Sep 17 00:00:00 2001 From: edvin Date: Fri, 20 Nov 2015 14:52:50 +0100 Subject: [PATCH 056/389] Add reason to cancel method for bluebird 2.0.0. --- bluebird/bluebird.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bluebird/bluebird.d.ts b/bluebird/bluebird.d.ts index 9f36cf5bc..efbba7c01 100644 --- a/bluebird/bluebird.d.ts +++ b/bluebird/bluebird.d.ts @@ -134,7 +134,7 @@ declare class Promise implements Promise.Thenable, Promise.Inspection { * Promises are by default not cancellable. Use `.cancellable()` to mark a promise as cancellable. */ // TODO what to do with this? - cancel(): Promise; + cancel(reason?: any): Promise; /** * Like `.then()`, but cancellation of the the returned promise or any of its descendant will not propagate cancellation to this promise or this promise's ancestors. From 1d23a699bae66c613b7e8f68826eeef586b41f5e Mon Sep 17 00:00:00 2001 From: dencap Date: Fri, 20 Nov 2015 15:01:35 +0100 Subject: [PATCH 057/389] Fixed the signature of concat, that takes as input an array --- bytebuffer/bytebuffer.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bytebuffer/bytebuffer.d.ts b/bytebuffer/bytebuffer.d.ts index 0bfaed7c1..8f1a800ea 100644 --- a/bytebuffer/bytebuffer.d.ts +++ b/bytebuffer/bytebuffer.d.ts @@ -131,7 +131,7 @@ declare class ByteBuffer /** * Concatenates multiple ByteBuffers into one. */ - static concat( buffers: Array | ArrayBuffer | Uint8Array | string, encoding?: string | boolean, litteEndian?: boolean, noAssert?: boolean ): ByteBuffer; + static concat( buffers: Array, encoding?: string | boolean, litteEndian?: boolean, noAssert?: boolean ): ByteBuffer; /** * Decodes a base64 encoded string to a ByteBuffer. From 02f61451f80e56ce82cf4a2a19d03ffd4d015fbc Mon Sep 17 00:00:00 2001 From: hamza zia Date: Fri, 20 Nov 2015 22:19:33 +0800 Subject: [PATCH 058/389] Update chrome.d.ts fixed uninstall function name --- chrome/chrome.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/chrome.d.ts b/chrome/chrome.d.ts index 8829ab044..b27891704 100755 --- a/chrome/chrome.d.ts +++ b/chrome/chrome.d.ts @@ -5689,7 +5689,7 @@ declare module chrome.runtime { * URL to be opened after the extension is uninstalled. This URL must have an http: or https: scheme. Set an empty string to not open a new tab upon uninstallation. * @param callback Called when the uninstall URL is set. If the given URL is invalid, runtime.lastError will be set. */ - export function setUninstallUrl(url: string, callback?: () => void): void; + export function setUninstallURL(url: string, callback?: () => void): void; /** * Open your Extension's options page, if possible. * The precise behavior may depend on your manifest's options_ui or options_page key, or what Chrome happens to support at the time. For example, the page may be opened in a new tab, within chrome://extensions, within an App, or it may just focus an open options page. It will never cause the caller page to reload. From 8fed873d03f487aa9eed5b31904a833382f37520 Mon Sep 17 00:00:00 2001 From: rhysd Date: Fri, 20 Nov 2015 23:28:31 +0900 Subject: [PATCH 059/389] material-ui: Added type of component --- material-ui/material-ui-tests.tsx | 14 +++++++++++++- material-ui/material-ui.d.ts | 16 ++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/material-ui/material-ui-tests.tsx b/material-ui/material-ui-tests.tsx index 641ce5fcf..0165dee1f 100644 --- a/material-ui/material-ui-tests.tsx +++ b/material-ui/material-ui-tests.tsx @@ -7,6 +7,7 @@ import * as LinkedStateMixin from "react-addons-linked-state-mixin"; import Checkbox = require("material-ui/lib/checkbox"); import Colors = require("material-ui/lib/styles/colors"); import AppBar = require("material-ui/lib/app-bar"); +import Badge = require("material-ui/lib/badge"); import IconButton = require("material-ui/lib/icon-button"); import FlatButton = require("material-ui/lib/flat-button"); import Avatar = require("material-ui/lib/avatar"); @@ -132,6 +133,17 @@ class MaterialUiTests extends React.Component<{}, {}> implements React.LinkedSta backgroundColor={Colors.purple500}> + // "http://material-ui.com/#/components/badge" + element = Hello}> + + ; + element = Hello} + badgeStyle={{height: '24px', width: '24px'}} + > + This text has a badge! + ; // "http://material-ui.com/#/components/buttons" element = @@ -491,4 +503,4 @@ class MaterialUiTests extends React.Component<{}, {}> implements React.LinkedSta return element; } -} \ No newline at end of file +} diff --git a/material-ui/material-ui.d.ts b/material-ui/material-ui.d.ts index 4fb4861a2..33ec4ba86 100644 --- a/material-ui/material-ui.d.ts +++ b/material-ui/material-ui.d.ts @@ -9,6 +9,7 @@ declare module "material-ui" { export import AppBar = __MaterialUI.AppBar; // require('material-ui/lib/app-bar'); export import AppCanvas = __MaterialUI.AppCanvas; // require('material-ui/lib/app-canvas'); export import Avatar = __MaterialUI.Avatar; // require('material-ui/lib/avatar'); + export import Badge = __MaterialUI.Badge; // require('material-ui/lib/badge'); export import BeforeAfterWrapper = __MaterialUI.BeforeAfterWrapper; // require('material-ui/lib/before-after-wrapper'); export import Card = __MaterialUI.Card.Card; // require('material-ui/lib/card/card'); export import CardActions = __MaterialUI.Card.CardActions; // require('material-ui/lib/card/card-actions'); @@ -137,6 +138,16 @@ declare namespace __MaterialUI { export class Avatar extends React.Component { } + interface BadgeProps extends React.Props { + badgeContent: React.ReactElement | string | number; + primary?: boolean; + secondary?: boolean; + style?: React.CSSProperties; + badgeStyle?: React.CSSProperties; + } + export class Badge extends React.Component { + } + interface BeforeAfterWrapperProps extends React.Props { beforeStyle?: React.CSSProperties; afterStyle?: React.CSSProperties; @@ -1526,6 +1537,11 @@ declare module 'material-ui/lib/avatar' { export = Avatar; } +declare module "material-ui/lib/badge" { + import Badge = __MaterialUI.Badge; + export = Badge; +} + declare module 'material-ui/lib/before-after-wrapper' { import BeforeAfterWrapper = __MaterialUI.BeforeAfterWrapper; export = BeforeAfterWrapper; From 004c4f0f45f8256bcda386a7c379d9e517dddc14 Mon Sep 17 00:00:00 2001 From: Milan Burda Date: Fri, 20 Nov 2015 15:24:03 +0100 Subject: [PATCH 060/389] Add keytar.d.ts --- keytar/keytar-tests.ts | 9 +++++++ keytar/keytar.d.ts | 60 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 keytar/keytar-tests.ts create mode 100644 keytar/keytar.d.ts diff --git a/keytar/keytar-tests.ts b/keytar/keytar-tests.ts new file mode 100644 index 000000000..1ad9006c6 --- /dev/null +++ b/keytar/keytar-tests.ts @@ -0,0 +1,9 @@ +/// + +import keytar = require('keytar'); + +keytar.addPassword('keytar-tests', 'username', 'password'); +keytar.deletePassword('keytar-tests', 'username'); +keytar.findPassword('keytar-tests'); +keytar.getPassword('keytar-tests', 'username'); +keytar.replacePassword('keytar-tests', 'username', 'password'); diff --git a/keytar/keytar.d.ts b/keytar/keytar.d.ts new file mode 100644 index 000000000..cee7e71bd --- /dev/null +++ b/keytar/keytar.d.ts @@ -0,0 +1,60 @@ +// Type definitions for keytar 3.0.0 +// Project: http://atom.github.io/node-keytar/ +// Definitions by: Milan Burda +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module 'keytar' { + /** + * Get the stored password for the service and account. + * + * @param service The string service name. + * @param account The string account name. + * + * @returns the string password or null on failures. + */ + export function getPassword(service: string, account: string): string; + + /** + * Add the password for the service and account to the keychain. + * + * @param service The string service name. + * @param account The string account name. + * @param password The string password. + * + * @returns true on success, false on failure. + */ + export function addPassword(service: string, account: string, password: string): boolean; + + /** + * Delete the stored password for the service and account. + * + * @param service The string service name. + * @param account The string account name. + * + * @returns the string password or null on failures. + */ + export function deletePassword(service: string, account: string): string; + + /** + * Replace the password for the service and account in the keychain. + * + * This is a simple convenience function that internally calls deletePassword(service, account) + * followed by addPassword(service, account, password). + * + * @param service The string service name. + * @param account The string account name. + * @param password The string password. + * + * @returns true on success, false on failure. + */ + export function replacePassword(service: string, account: string, password: string): boolean; + + /** + * Find a password for the service in the keychain. + * + * @param service The string service name. + * + * @returns the string password or null on failures. + */ + export function findPassword(service: string): string; +} From 034d45f33efec492dbcd9e807569cce4f3085f96 Mon Sep 17 00:00:00 2001 From: Droritos Date: Fri, 20 Nov 2015 17:00:03 +0200 Subject: [PATCH 061/389] Update angular-notify.d.ts Bump version 2.0.2 --> 2.5.0 --- angular-notify/angular-notify.d.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/angular-notify/angular-notify.d.ts b/angular-notify/angular-notify.d.ts index 7e55dc654..f97c94e7a 100644 --- a/angular-notify/angular-notify.d.ts +++ b/angular-notify/angular-notify.d.ts @@ -1,4 +1,4 @@ -// Type definitions for angular-notify 2.0.2 +// Type definitions for angular-notify 2.5.0 // Project: https://github.com/cgross/angular-notify // Definitions by: Suwato // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -51,6 +51,11 @@ declare module angular.cgNotify { * Optional. Currently center and right are the only acceptable values. */ position? : string; + + /** + * Optional. The duration (in milliseconds) of the message. A duration of 0 will prevent the message from closing automatically. + */ + duration? : number; /** * Optional. Element that contains each notification. Defaults to document.body. @@ -94,6 +99,11 @@ declare module angular.cgNotify { * The default element that contains each notification. Defaults to document.body. */ container? : any; + + /** + * The maximum number of total notifications that can be visible at one time. Older notifications will be closed when the maximum is reached. + */ + maximumOpen? : number; }):void; /** From 5a1c6dc6acbec690d682a7e6f2144fb11befcbe5 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Fri, 20 Nov 2015 18:52:33 +0100 Subject: [PATCH 062/389] supertest-as-promised See https://github.com/WhoopInc/supertest-as-promised --- .../supertest-as-promised-tests.ts | 64 +++++++++++++++++++ .../supertest-as-promised.d.ts | 45 +++++++++++++ 2 files changed, 109 insertions(+) create mode 100644 supertest-as-promised/supertest-as-promised-tests.ts create mode 100644 supertest-as-promised/supertest-as-promised.d.ts diff --git a/supertest-as-promised/supertest-as-promised-tests.ts b/supertest-as-promised/supertest-as-promised-tests.ts new file mode 100644 index 000000000..2b79abd07 --- /dev/null +++ b/supertest-as-promised/supertest-as-promised-tests.ts @@ -0,0 +1,64 @@ +/// +/// +/// + +import * as request from 'supertest-as-promised'; +import * as express from 'express'; + +var app = express(); + +// chain your requests like you were promised: +request(app) + .get("/user") + .expect(200) + .then(function (res) { + return request(app) + .post("/kittens") + .send({ userId: res}) + .expect(201); + }) + .then(function (res) { + // ... + }); + + +// Usage +request(app) + .get("/kittens") + .expect(200) + .then(function (res) { + // ... + }); + +describe("GET /kittens", function () { + it("should work", function () { + return request(app).get("/kittens").expect(200); + }); +}); + + +// Agents +var agent = request.agent(app); +agent + .get("/ugly-kitteh") + .expect(404) + .then(function () { + // ... + }) + + +// Promisey goodness +request(app) + .get("/kittens") + .expect(201) + .then(function (res) { /* ... */ }) + // I'm a real promise now! + .catch(function (err) { /* ... */ }) + +request(app) + .get("/kittens") + .expect(201) + .toPromise() + // I'm a real promise now! + .delay(10) + .then(function (res) { /* ... */ }) diff --git a/supertest-as-promised/supertest-as-promised.d.ts b/supertest-as-promised/supertest-as-promised.d.ts new file mode 100644 index 000000000..2c035848f --- /dev/null +++ b/supertest-as-promised/supertest-as-promised.d.ts @@ -0,0 +1,45 @@ +// Type definitions for SuperTest as Promised v2.0.2 +// Project: https://github.com/WhoopInc/supertest-as-promised +// Definitions by: Tanguy Krotoff +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare module "supertest-as-promised" { + // Mostly copy-pasted from supertest.d.ts + + import * as superagent from 'superagent'; + import * as PromiseBluebird from 'bluebird'; + + function supertest(app: any): supertest.SuperTest; + + module supertest { + function agent(app?: any): supertest.SuperTest; + + interface SuperTest extends superagent.SuperAgent { + } + + interface Promise extends PromiseBluebird { + toPromise(): PromiseBluebird; + } + + interface Test extends superagent.Request { + url: string; + serverAddress(app: any, path: string): string; + expect(status: number): Promise; + expect(status: number, body: string): Promise; + expect(body: string): Promise; + expect(body: RegExp): Promise; + expect(body: Object): Promise; + expect(field: string, val: string): Promise; + expect(field: string, val: RegExp): Promise; + expect(checker: (res: Response) => any): Promise; + } + + interface Response extends superagent.Response { + } + } + + export = supertest; +} From 2f7fb157a8482a8efa1a50e724b27bf8736eb379 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Rieussec?= Date: Fri, 20 Nov 2015 10:40:21 -0800 Subject: [PATCH 063/389] Marked all functions with no return type as returning `void` Marked all params with no types as `any` --- ace/ace.d.ts | 588 +++++++++++++++++++++++++-------------------------- 1 file changed, 294 insertions(+), 294 deletions(-) diff --git a/ace/ace.d.ts b/ace/ace.d.ts index bedcfee54..8fed295f2 100644 --- a/ace/ace.d.ts +++ b/ace/ace.d.ts @@ -25,17 +25,17 @@ declare module AceAjax { export interface CommandManager { - byName; + byName: any; - commands; + commands: any; platform: string; - addCommands(commands:EditorCommand[]); + addCommands(commands:EditorCommand[]): void; - addCommand(command:EditorCommand); + addCommand(command:EditorCommand): void; - exec(name: string, editor: Editor, args: any); + exec(name: string, editor: Editor, args: any): void; } export interface Annotation { @@ -63,19 +63,19 @@ declare module AceAjax { export interface KeyBinding { - setDefaultHandler(kb); + setDefaultHandler(kb: any): void; - setKeyboardHandler(kb); + setKeyboardHandler(kb: any): void; - addKeyboardHandler(kb, pos); + addKeyboardHandler(kb: any, pos: any): void; - removeKeyboardHandler(kb): boolean; + removeKeyboardHandler(kb: any): boolean; getKeyboardHandler(): any; - onCommandKey(e, hashId, keyCode); + onCommandKey(e: any, hashId: any, keyCode: any): void; - onTextInput(text); + onTextInput(text: any): void; } var KeyBinding: { new(editor: Editor): KeyBinding; @@ -85,19 +85,19 @@ declare module AceAjax { getTokenizer(): any; - toggleCommentLines(state, doc, startRow, endRow); + toggleCommentLines(state: any, doc: any, startRow: any, endRow: any): void; - getNextLineIndent (state, line, tab): string; + getNextLineIndent (state: any, line: any, tab: any): string; - checkOutdent(state, line, input): boolean; + checkOutdent(state: any, line: any, input: any): boolean; - autoOutdent(state, doc, row); + autoOutdent(state: any, doc: any, row: any): void; - createWorker(session): any; + createWorker(session: any): any; - createModeDelegates (mapping); + createModeDelegates (mapping: any): void; - transformAction(state, action, editor, session, param): any; + transformAction(state: any, action: any, editor: any, session: any, param: any): any; } //////////////// @@ -151,7 +151,7 @@ declare module AceAjax { **/ export interface Anchor { - on(event: string, fn: (e) => any); + on(event: string, fn: (e: any) => any): void; /** * Returns an object identifying the `row` and `column` position of the current anchor. @@ -171,7 +171,7 @@ declare module AceAjax { * - `old`: An object describing the old Anchor position * - `value`: An object describing the new Anchor position **/ - onChange(e: any); + onChange(e: any): void; /** * Sets the anchor position to the specified row and column. If `noClip` is `true`, the position is not clipped. @@ -179,12 +179,12 @@ declare module AceAjax { * @param column The column index to move the anchor to * @param noClip Identifies if you want the position to be clipped **/ - setPosition(row: number, column: number, noClip: boolean); + setPosition(row: number, column: number, noClip: boolean): void; /** * When called, the `'change'` event listener is removed. **/ - detach(); + detach(): void; } var Anchor: { /** @@ -212,31 +212,31 @@ declare module AceAjax { * Sets a new tokenizer for this object. * @param tokenizer The new tokenizer to use **/ - setTokenizer(tokenizer: Tokenizer); + setTokenizer(tokenizer: Tokenizer): void; /** * Sets a new document to associate with this object. * @param doc The new document to associate with **/ - setDocument(doc: Document); + setDocument(doc: Document): void; /** * Emits the `'update'` event. `firstRow` and `lastRow` are used to define the boundaries of the region to be updated. * @param firstRow The starting row region * @param lastRow The final row region **/ - fireUpdateEvent(firstRow: number, lastRow: number); + fireUpdateEvent(firstRow: number, lastRow: number): void; /** * Starts tokenizing at the row indicated. * @param startRow The row to start at **/ - start(startRow: number); + start(startRow: number): void; /** * Stops tokenizing. **/ - stop(); + stop(): void; /** * Gives list of tokens of the row. (tokens are cached) @@ -269,13 +269,13 @@ declare module AceAjax { **/ export interface Document { - on(event: string, fn: (e) => any); + on(event: string, fn: (e: any) => any): void; /** * Replaces all the lines in the current `Document` with the value of `text`. * @param text The text to use **/ - setValue(text: string); + setValue(text: string): void; /** * Returns all the lines in the document as a single string, split by the new line character. @@ -287,7 +287,7 @@ declare module AceAjax { * @param row The row number to use * @param column The column number to use **/ - createAnchor(row: number, column: number); + createAnchor(row: number, column: number): void; /** * Returns the newline character that's being used, depending on the value of `newLineMode`. @@ -298,7 +298,7 @@ declare module AceAjax { * [Sets the new line mode.]{: #Document.setNewLineMode.desc} * @param newLineMode [The newline mode to use; can be either `windows`, `unix`, or `auto`]{: #Document.setNewLineMode.param} **/ - setNewLineMode(newLineMode: string); + setNewLineMode(newLineMode: string): void; /** * [Returns the type of newlines being used; either `windows`, `unix`, or `auto`]{: #Document.getNewLineMode} @@ -392,7 +392,7 @@ declare module AceAjax { * Removes the new line between `row` and the row immediately following it. This method also triggers the `'change'` event. * @param row The row to check **/ - removeNewLine(row: number); + removeNewLine(row: number): void; /** * Replaces a range in the document with the new `text`. @@ -404,12 +404,12 @@ declare module AceAjax { /** * Applies all the changes previously accumulated. These can be either `'includeText'`, `'insertLines'`, `'removeText'`, and `'removeLines'`. **/ - applyDeltas(deltas: Delta[]); + applyDeltas(deltas: Delta[]): void; /** * Reverts any changes previously applied. These can be either `'includeText'`, `'insertLines'`, `'removeText'`, and `'removeLines'`. **/ - revertDeltas(deltas: Delta[]); + revertDeltas(deltas: Delta[]): void; /** * Converts an index position in a document to a `{row, column}` object. @@ -466,33 +466,33 @@ declare module AceAjax { doc: Document; - on(event: string, fn: (e) => any); + on(event: string, fn: (e: any) => any): void; - findMatchingBracket(position: Position); + findMatchingBracket(position: Position): void; - addFold(text: string, range: Range); + addFold(text: string, range: Range): void; getFoldAt(row: number, column: number): any; - removeFold(arg: any); + removeFold(arg: any): void; - expandFold(arg: any); + expandFold(arg: any): void; - unfold(arg1: any, arg2: boolean); + unfold(arg1: any, arg2: boolean): void; - screenToDocumentColumn(row: number, column: number); + screenToDocumentColumn(row: number, column: number): void; getFoldDisplayLine(foldLine: any, docRow: number, docColumn: number): any; getFoldsInRange(range: Range): any; - highlight(text: string); + highlight(text: string): void; /** * Sets the `EditSession` to point to a new `Document`. If a `BackgroundTokenizer` exists, it also points to `doc`. * @param doc The new `Document` to use **/ - setDocument(doc: Document); + setDocument(doc: Document): void; /** * Returns the `Document` associated with this session. @@ -503,15 +503,15 @@ declare module AceAjax { * undefined * @param row The row to work with **/ - $resetRowCache(row: number); + $resetRowCache(row: number): void; /** * Sets the session text. * @param text The new text to place **/ - setValue(text: string); + setValue(text: string): void; - setMode(mode: string); + setMode(mode: string): void; /** * Returns the current [[Document `Document`]] as a string. @@ -546,7 +546,7 @@ declare module AceAjax { * Sets the undo manager. * @param undoManager The new undo manager **/ - setUndoManager(undoManager: UndoManager); + setUndoManager(undoManager: UndoManager): void; /** * Returns the current undo manager. @@ -554,7 +554,7 @@ declare module AceAjax { getUndoManager(): UndoManager; /** - * Returns the current value for tabs. If the user is using soft tabs, this will be a series of spaces (defined by [[EditSession.getTabSize `getTabSize()`]]); otherwise it's simply `'\t'`. + * Returns the current value for tabs. If the user is using soft tabs, this will be a series of spaces (defined by [[EditSession.getTabSize `getTabSize()`]]): void; otherwise it's simply `'\t'`. **/ getTabString(): string; @@ -562,7 +562,7 @@ declare module AceAjax { * Pass `true` to enable the use of soft tabs. Soft tabs means you're using spaces instead of the tab character (`'\t'`). * @param useSoftTabs Value indicating whether or not to use soft tabs **/ - setUseSoftTabs(useSoftTabs: boolean); + setUseSoftTabs(useSoftTabs: boolean): void; /** * Returns `true` if soft tabs are being used, `false` otherwise. @@ -573,7 +573,7 @@ declare module AceAjax { * Set the number of spaces that define a soft tab; for example, passing in `4` transforms the soft tabs to be equivalent to four spaces. This function also emits the `changeTabSize` event. * @param tabSize The new tab size **/ - setTabSize(tabSize: number); + setTabSize(tabSize: number): void; /** * Returns the current tab size. @@ -591,7 +591,7 @@ declare module AceAjax { * If overwrites is enabled, any text you enter will type over any text after it. If the value of `overwrite` changes, this function also emites the `changeOverwrite` event. * @param overwrite Defines wheter or not to set overwrites **/ - setOverwrite(overwrite: boolean); + setOverwrite(overwrite: boolean): void; /** * Returns `true` if overwrites are enabled; `false` otherwise. @@ -601,21 +601,21 @@ declare module AceAjax { /** * Sets the value of overwrite to the opposite of whatever it currently is. **/ - toggleOverwrite(); + toggleOverwrite(): void; /** * Adds `className` to the `row`, to be used for CSS stylings and whatnot. * @param row The row number * @param className The class to add **/ - addGutterDecoration(row: number, className: string); + addGutterDecoration(row: number, className: string): void; /** * Removes `className` from the `row`. * @param row The row number * @param className The class to add **/ - removeGutterDecoration(row: number, className: string); + removeGutterDecoration(row: number, className: string): void; /** * Returns an array of numbers, indicating which rows have breakpoints. @@ -626,25 +626,25 @@ declare module AceAjax { * Sets a breakpoint on every row number given by `rows`. This function also emites the `'changeBreakpoint'` event. * @param rows An array of row indices **/ - setBreakpoints(rows: any[]); + setBreakpoints(rows: any[]): void; /** * Removes all breakpoints on the rows. This function also emites the `'changeBreakpoint'` event. **/ - clearBreakpoints(); + clearBreakpoints(): void; /** * Sets a breakpoint on the row number given by `rows`. This function also emites the `'changeBreakpoint'` event. * @param row A row index * @param className Class of the breakpoint **/ - setBreakpoint(row: number, className: string); + setBreakpoint(row: number, className: string): void; /** * Removes a breakpoint on the row number given by `rows`. This function also emites the `'changeBreakpoint'` event. * @param row A row index **/ - clearBreakpoint(row: number); + clearBreakpoint(row: number): void; /** * Adds a new marker to the given `Range`. If `inFront` is `true`, a front marker is defined, and the `'changeFrontMarker'` event fires; otherwise, the `'changeBackMarker'` event fires. @@ -653,7 +653,7 @@ declare module AceAjax { * @param type Identify the type of the marker * @param inFront Set to `true` to establish a front marker **/ - addMarker(range: Range, clazz: string, type: Function, inFront: boolean); + addMarker(range: Range, clazz: string, type: Function, inFront: boolean): void; /** * Adds a new marker to the given `Range`. If `inFront` is `true`, a front marker is defined, and the `'changeFrontMarker'` event fires; otherwise, the `'changeBackMarker'` event fires. @@ -662,20 +662,20 @@ declare module AceAjax { * @param type Identify the type of the marker * @param inFront Set to `true` to establish a front marker **/ - addMarker(range: Range, clazz: string, type: string, inFront: boolean); + addMarker(range: Range, clazz: string, type: string, inFront: boolean): void; /** * Adds a dynamic marker to the session. * @param marker object with update method * @param inFront Set to `true` to establish a front marker **/ - addDynamicMarker(marker: any, inFront: boolean); + addDynamicMarker(marker: any, inFront: boolean): void; /** * Removes the marker with the specified ID. If this marker was in front, the `'changeFrontMarker'` event is emitted. If the marker was in the back, the `'changeBackMarker'` event is emitted. * @param markerId A number representing a marker **/ - removeMarker(markerId: number); + removeMarker(markerId: number): void; /** * Returns an array containing the IDs of all the markers, either front or back. @@ -687,7 +687,7 @@ declare module AceAjax { * Sets annotations for the `EditSession`. This functions emits the `'changeAnnotation'` event. * @param annotations A list of annotations **/ - setAnnotations(annotations: Annotation[]); + setAnnotations(annotations: Annotation[]): void; /** * Returns the annotations for the `EditSession`. @@ -697,13 +697,13 @@ declare module AceAjax { /** * Clears all the annotations for this session. This function also triggers the `'changeAnnotation'` event. **/ - clearAnnotations(); + clearAnnotations(): void; /** * If `text` contains either the newline (`\n`) or carriage-return ('\r') characters, `$autoNewLine` stores that value. * @param text A block of text **/ - $detectNewLine(text: string); + $detectNewLine(text: string): void; /** * Given a starting row and column, this method returns the `Range` of the first word boundary it finds. @@ -723,7 +723,7 @@ declare module AceAjax { * {:Document.setNewLineMode.desc} * @param newLineMode {:Document.setNewLineMode.param} **/ - setNewLineMode(newLineMode: string); + setNewLineMode(newLineMode: string): void; /** * Returns the current new line mode. @@ -734,7 +734,7 @@ declare module AceAjax { * Identifies if you want to use a worker for the `EditSession`. * @param useWorker Set to `true` to use a worker **/ - setUseWorker(useWorker: boolean); + setUseWorker(useWorker: boolean): void; /** * Returns `true` if workers are being used. @@ -744,13 +744,13 @@ declare module AceAjax { /** * Reloads all the tokens on the current session. This function calls [[BackgroundTokenizer.start `BackgroundTokenizer.start ()`]] to all the rows; it also emits the `'tokenizerUpdate'` event. **/ - onReloadTokenizer(); + onReloadTokenizer(): void; /** * Sets a new text mode for the `EditSession`. This method also emits the `'changeMode'` event. If a [[BackgroundTokenizer `BackgroundTokenizer`]] is set, the `'tokenizerUpdate'` event is also emitted. * @param mode Set a new text mode **/ - $mode(mode: TextMode); + $mode(mode: TextMode): void; /** * Returns the current text mode. @@ -761,7 +761,7 @@ declare module AceAjax { * This function sets the scroll top value. It also emits the `'changeScrollTop'` event. * @param scrollTop The new scroll top value **/ - setScrollTop(scrollTop: number); + setScrollTop(scrollTop: number): void; /** * [Returns the value of the distance between the top of the editor and the topmost part of the visible content.]{: #EditSession.getScrollTop} @@ -771,7 +771,7 @@ declare module AceAjax { /** * [Sets the value of the distance between the left of the editor and the leftmost part of the visible content.]{: #EditSession.setScrollLeft} **/ - setScrollLeft(); + setScrollLeft(): void; /** * [Returns the value of the distance between the left of the editor and the leftmost part of the visible content.]{: #EditSession.getScrollLeft} @@ -838,7 +838,7 @@ declare module AceAjax { * Enables or disables highlighting of the range where an undo occured. * @param enable If `true`, selects the range of the reinserted change **/ - setUndoSelect(enable: boolean); + setUndoSelect(enable: boolean): void; /** * Replaces a range in the document with the new `text`. @@ -864,13 +864,13 @@ declare module AceAjax { * @param endRow Ending row * @param indentString The indent token **/ - indentRows(startRow: number, endRow: number, indentString: string); + indentRows(startRow: number, endRow: number, indentString: string): void; /** * Outdents all the rows defined by the `start` and `end` properties of `range`. * @param range A range of rows **/ - outdentRows(range: Range); + outdentRows(range: Range): void; /** * Shifts all the lines in the document up one, starting from `firstRow` and ending at `lastRow`. @@ -897,7 +897,7 @@ declare module AceAjax { * Sets whether or not line wrapping is enabled. If `useWrapMode` is different than the current value, the `'changeWrapMode'` event is emitted. * @param useWrapMode Enable (or disable) wrap mode **/ - setUseWrapMode(useWrapMode: boolean); + setUseWrapMode(useWrapMode: boolean): void; /** * Returns `true` if wrap mode is being used; `false` otherwise. @@ -909,7 +909,7 @@ declare module AceAjax { * @param min The minimum wrap value (the left side wrap) * @param max The maximum wrap value (the right side wrap) **/ - setWrapLimitRange(min: number, max: number); + setWrapLimitRange(min: number, max: number): void; /** * This should generally only be called by the renderer when a resize is detected. @@ -933,7 +933,7 @@ declare module AceAjax { * @param str The string to check * @param offset The value to start at **/ - $getDisplayTokens(str: string, offset: number); + $getDisplayTokens(str: string, offset: number): void; /** * Calculates the width of the string `str` on the screen while assuming that the string starts at the first column on the screen. @@ -1006,7 +1006,7 @@ declare module AceAjax { * @param docRow * @param docColumn **/ - documentToScreenRow(docRow: number, docColumn: number); + documentToScreenRow(docRow: number, docColumn: number): void; /** * Returns the length of the screen. @@ -1036,17 +1036,17 @@ declare module AceAjax { * Event sessions dealing with the mouse and keyboard are bubbled up from `Document` to the `Editor`, which decides what to do with them. **/ export interface Editor { - - addEventListener(ev: 'change', callback: (ev: EditorChangeEvent) => any); - addEventListener(ev: string, callback: Function); + + addEventListener(ev: 'change', callback: (ev: EditorChangeEvent) => any): void; + addEventListener(ev: string, callback: Function): void; inMultiSelectMode: boolean; - selectMoreLines(n: number); + selectMoreLines(n: number): void; - onTextInput(text: string); + onTextInput(text: string): void; - onCommandKey(e, hashId, keyCode); + onCommandKey(e: any, hashId: any, keyCode: any): void; commands: CommandManager; @@ -1060,32 +1060,32 @@ declare module AceAjax { container: HTMLElement; - onSelectionChange(e); + onSelectionChange(e: any): void; - onChangeMode(e?); + onChangeMode(e?: any): void; + + execCommand(command:string, args?: any): void; - execCommand(command:string, args?: any); - /** * Sets a Configuration Option **/ - setOption(optionName: any, optionValue: any); - + setOption(optionName: any, optionValue: any): void; + /** * Sets Configuration Options **/ - setOptions(keyValueTuples: any); - + setOptions(keyValueTuples: any): void; + /** * Get a Configuration Option **/ getOption(name: any):any; - + /** * Get Configuration Options **/ getOptions():any; - + /** * Get rid of console warning by setting this to Infinity **/ @@ -1095,7 +1095,7 @@ declare module AceAjax { * Sets a new key handler, such as "vim" or "windows". * @param keyboardHandler The new key handler **/ - setKeyboardHandler(keyboardHandler: string); + setKeyboardHandler(keyboardHandler: string): void; /** * Returns the keyboard handler, such as "vim" or "windows". @@ -1106,7 +1106,7 @@ declare module AceAjax { * Sets a new editsession to use. This method also emits the `'changeSession'` event. * @param session The new session to use **/ - setSession(session: IEditSession); + setSession(session: IEditSession): void; /** * Returns the current session being used. @@ -1134,13 +1134,13 @@ declare module AceAjax { * {:VirtualRenderer.onResize} * @param force If `true`, recomputes the size, even if the height and width haven't changed **/ - resize(force?: boolean); + resize(force?: boolean): void; /** * {:VirtualRenderer.setTheme} * @param theme The path to a theme **/ - setTheme(theme: string); + setTheme(theme: string): void; /** * {:VirtualRenderer.getTheme} @@ -1151,54 +1151,54 @@ declare module AceAjax { * {:VirtualRenderer.setStyle} * @param style A class name **/ - setStyle(style: string); + setStyle(style: string): void; /** * {:VirtualRenderer.unsetStyle} **/ - unsetStyle(); + unsetStyle(): void; /** * Set a new font size (in pixels) for the editor text. * @param size A font size ( _e.g._ "12px") **/ - setFontSize(size: string); + setFontSize(size: string): void; /** * Brings the current `textInput` into focus. **/ - focus(); + focus(): void; /** * Returns `true` if the current `textInput` is in focus. **/ - isFocused(); + isFocused(): void; /** * Blurs the current `textInput`. **/ - blur(); + blur(): void; /** * Emitted once the editor comes into focus. **/ - onFocus(); + onFocus(): void; /** * Emitted once the editor has been blurred. **/ - onBlur(); + onBlur(): void; /** * Emitted whenever the document is changed. * @param e Contains a single property, `data`, which has the delta of changes **/ - onDocumentChange(e: any); + onDocumentChange(e: any): void; /** * Emitted when the selection changes. **/ - onCursorChange(); + onCursorChange(): void; /** * Returns the string of text currently highlighted. @@ -1208,30 +1208,30 @@ declare module AceAjax { /** * Called whenever a text "copy" happens. **/ - onCopy(); + onCopy(): void; /** * Called whenever a text "cut" happens. **/ - onCut(); + onCut(): void; /** * Called whenever a text "paste" happens. * @param text The pasted text **/ - onPaste(text: string); + onPaste(text: string): void; /** * Inserts `text` into wherever the cursor is pointing. * @param text The new text to add **/ - insert(text: string); + insert(text: string): void; /** * Pass in `true` to enable overwrites in your session, or `false` to disable. If overwrites is enabled, any text you enter will type over any text after it. If the value of `overwrite` changes, this function also emites the `changeOverwrite` event. * @param overwrite Defines wheter or not to set overwrites **/ - setOverwrite(overwrite: boolean); + setOverwrite(overwrite: boolean): void; /** * Returns `true` if overwrites are enabled; `false` otherwise. @@ -1241,13 +1241,13 @@ declare module AceAjax { /** * Sets the value of overwrite to the opposite of whatever it currently is. **/ - toggleOverwrite(); + toggleOverwrite(): void; /** * Sets how fast the mouse scrolling should do. * @param speed A value indicating the new speed (in milliseconds) **/ - setScrollSpeed(speed: number); + setScrollSpeed(speed: number): void; /** * Returns the value indicating how fast the mouse scroll speed is (in milliseconds). @@ -1258,7 +1258,7 @@ declare module AceAjax { * Sets the delay (in milliseconds) of the mouse drag. * @param dragDelay A value indicating the new delay **/ - setDragDelay(dragDelay: number); + setDragDelay(dragDelay: number): void; /** * Returns the current mouse drag delay. @@ -1272,7 +1272,7 @@ declare module AceAjax { * This function also emits the `'changeSelectionStyle'` event. * @param style The new selection style **/ - setSelectionStyle(style: string); + setSelectionStyle(style: string): void; /** * Returns the current selection style. @@ -1283,18 +1283,18 @@ declare module AceAjax { * Determines whether or not the current line should be highlighted. * @param shouldHighlight Set to `true` to highlight the current line **/ - setHighlightActiveLine(shouldHighlight: boolean); + setHighlightActiveLine(shouldHighlight: boolean): void; /** * Returns `true` if current lines are always highlighted. **/ - getHighlightActiveLine(); + getHighlightActiveLine(): void; /** * Determines if the currently selected word should be highlighted. * @param shouldHighlight Set to `true` to highlight the currently selected word **/ - setHighlightSelectedWord(shouldHighlight: boolean); + setHighlightSelectedWord(shouldHighlight: boolean): void; /** * Returns `true` if currently highlighted words are to be highlighted. @@ -1305,7 +1305,7 @@ declare module AceAjax { * If `showInvisibiles` is set to `true`, invisible characters—like spaces or new lines—are show in the editor. * @param showInvisibles Specifies whether or not to show invisible characters **/ - setShowInvisibles(showInvisibles: boolean); + setShowInvisibles(showInvisibles: boolean): void; /** * Returns `true` if invisible characters are being shown. @@ -1316,7 +1316,7 @@ declare module AceAjax { * If `showPrintMargin` is set to `true`, the print margin is shown in the editor. * @param showPrintMargin Specifies whether or not to show the print margin **/ - setShowPrintMargin(showPrintMargin: boolean); + setShowPrintMargin(showPrintMargin: boolean): void; /** * Returns `true` if the print margin is being shown. @@ -1327,7 +1327,7 @@ declare module AceAjax { * Sets the column defining where the print margin should be. * @param showPrintMargin Specifies the new print margin **/ - setPrintMarginColumn(showPrintMargin: number); + setPrintMarginColumn(showPrintMargin: number): void; /** * Returns the column number of where the print margin is. @@ -1338,7 +1338,7 @@ declare module AceAjax { * If `readOnly` is true, then the editor is set to read-only mode, and none of the content can change. * @param readOnly Specifies whether the editor can be modified or not **/ - setReadOnly(readOnly: boolean); + setReadOnly(readOnly: boolean): void; /** * Returns `true` if the editor is set to read-only mode. @@ -1349,7 +1349,7 @@ declare module AceAjax { * Specifies whether to use behaviors or not. ["Behaviors" in this case is the auto-pairing of special characters, like quotation marks, parenthesis, or brackets.]{: #BehaviorsDef} * @param enabled Enables or disables behaviors **/ - setBehavioursEnabled(enabled: boolean); + setBehavioursEnabled(enabled: boolean): void; /** * Returns `true` if the behaviors are currently enabled. {:BehaviorsDef} @@ -1361,89 +1361,89 @@ declare module AceAjax { * when such a character is typed in. * @param enabled Enables or disables wrapping behaviors **/ - setWrapBehavioursEnabled(enabled: boolean); + setWrapBehavioursEnabled(enabled: boolean): void; /** * Returns `true` if the wrapping behaviors are currently enabled. **/ - getWrapBehavioursEnabled(); + getWrapBehavioursEnabled(): void; /** * Indicates whether the fold widgets are shown or not. * @param show Specifies whether the fold widgets are shown **/ - setShowFoldWidgets(show: boolean); + setShowFoldWidgets(show: boolean): void; /** * Returns `true` if the fold widgets are shown. **/ - getShowFoldWidgets(); + getShowFoldWidgets(): void; /** * Removes words of text from the editor. A "word" is defined as a string of characters bookended by whitespace. * @param dir The direction of the deletion to occur, either "left" or "right" **/ - remove(dir: string); + remove(dir: string): void; /** * Removes the word directly to the right of the current selection. **/ - removeWordRight(); + removeWordRight(): void; /** * Removes the word directly to the left of the current selection. **/ - removeWordLeft(); + removeWordLeft(): void; /** * Removes all the words to the left of the current selection, until the start of the line. **/ - removeToLineStart(); + removeToLineStart(): void; /** * Removes all the words to the right of the current selection, until the end of the line. **/ - removeToLineEnd(); + removeToLineEnd(): void; /** * Splits the line at the current selection (by inserting an `'\n'`). **/ - splitLine(); + splitLine(): void; /** * Transposes current line. **/ - transposeLetters(); + transposeLetters(): void; /** * Converts the current selection entirely into lowercase. **/ - toLowerCase(); + toLowerCase(): void; /** * Converts the current selection entirely into uppercase. **/ - toUpperCase(); + toUpperCase(): void; /** * Inserts an indentation into the current cursor position or indents the selected lines. **/ - indent(); + indent(): void; /** * Indents the current line. **/ - blockIndent(); + blockIndent(): void; /** * Outdents the current line. **/ - blockOutdent(arg?: string); + blockOutdent(arg?: string): void; /** * Given the currently selected range, this function either comments all the lines, or uncomments all of them. **/ - toggleCommentLines(); + toggleCommentLines(): void; /** * Works like [[EditSession.getTokenAt]], except it returns a number. @@ -1454,12 +1454,12 @@ declare module AceAjax { * If the character before the cursor is a number, this functions changes its value by `amount`. * @param amount The value to change the numeral by (can be negative to decrease value) **/ - modifyNumber(amount: number); + modifyNumber(amount: number): void; /** * Removes all the lines in the current selection **/ - removeLines(); + removeLines(): void; /** * Shifts all the selected lines down one row. @@ -1516,37 +1516,37 @@ declare module AceAjax { /** * Selects the text from the current position of the document until where a "page down" finishes. **/ - selectPageDown(); + selectPageDown(): void; /** * Selects the text from the current position of the document until where a "page up" finishes. **/ - selectPageUp(); + selectPageUp(): void; /** * Shifts the document to wherever "page down" is, as well as moving the cursor position. **/ - gotoPageDown(); + gotoPageDown(): void; /** * Shifts the document to wherever "page up" is, as well as moving the cursor position. **/ - gotoPageUp(); + gotoPageUp(): void; /** * Scrolls the document to wherever "page down" is, without changing the cursor position. **/ - scrollPageDown(); + scrollPageDown(): void; /** * Scrolls the document to wherever "page up" is, without changing the cursor position. **/ - scrollPageUp(); + scrollPageUp(): void; /** * Moves the editor to the specified row. **/ - scrollToRow(); + scrollToRow(): void; /** * Scrolls to a line. If `center` is `true`, it puts the line in middle of screen (or attempts to). @@ -1555,12 +1555,12 @@ declare module AceAjax { * @param animate If `true` animates scrolling * @param callback Function to be called when the animation has finished **/ - scrollToLine(line: number, center: boolean, animate: boolean, callback: Function); + scrollToLine(line: number, center: boolean, animate: boolean, callback: Function): void; /** * Attempts to center the current selection on the screen. **/ - centerSelection(); + centerSelection(): void; /** * Gets the current position of the cursor. @@ -1580,30 +1580,30 @@ declare module AceAjax { /** * Selects all the text in editor. **/ - selectAll(); + selectAll(): void; /** * {:Selection.clearSelection} **/ - clearSelection(); + clearSelection(): void; /** * Moves the cursor to the specified row and column. Note that this does not de-select the current selection. * @param row The new row number * @param column The new column number **/ - moveCursorTo(row: number, column?: number, animate?:boolean); + moveCursorTo(row: number, column?: number, animate?:boolean): void; /** * Moves the cursor to the position indicated by `pos.row` and `pos.column`. * @param position An object with two properties, row and column **/ - moveCursorToPosition(position: Position); + moveCursorToPosition(position: Position): void; /** * Moves the cursor's row and column to the next matching bracket. **/ - jumpToMatching(); + jumpToMatching(): void; /** * Moves the cursor to the specified line number, and also into the indiciated column. @@ -1611,82 +1611,82 @@ declare module AceAjax { * @param column A column number to go to * @param animate If `true` animates scolling **/ - gotoLine(lineNumber: number, column?: number, animate?: boolean); + gotoLine(lineNumber: number, column?: number, animate?: boolean): void; /** * Moves the cursor to the specified row and column. Note that this does de-select the current selection. * @param row The new row number * @param column The new column number **/ - navigateTo(row: number, column: number); + navigateTo(row: number, column: number): void; /** * Moves the cursor up in the document the specified number of times. Note that this does de-select the current selection. * @param times The number of times to change navigation **/ - navigateUp(times?: number); + navigateUp(times?: number): void; /** * Moves the cursor down in the document the specified number of times. Note that this does de-select the current selection. * @param times The number of times to change navigation **/ - navigateDown(times?: number); + navigateDown(times?: number): void; /** * Moves the cursor left in the document the specified number of times. Note that this does de-select the current selection. * @param times The number of times to change navigation **/ - navigateLeft(times?: number); + navigateLeft(times?: number): void; /** * Moves the cursor right in the document the specified number of times. Note that this does de-select the current selection. * @param times The number of times to change navigation **/ - navigateRight(times: number); + navigateRight(times: number): void; /** * Moves the cursor to the start of the current line. Note that this does de-select the current selection. **/ - navigateLineStart(); + navigateLineStart(): void; /** * Moves the cursor to the end of the current line. Note that this does de-select the current selection. **/ - navigateLineEnd(); + navigateLineEnd(): void; /** * Moves the cursor to the end of the current file. Note that this does de-select the current selection. **/ - navigateFileEnd(); + navigateFileEnd(): void; /** * Moves the cursor to the start of the current file. Note that this does de-select the current selection. **/ - navigateFileStart(); + navigateFileStart(): void; /** * Moves the cursor to the word immediately to the right of the current position. Note that this does de-select the current selection. **/ - navigateWordRight(); + navigateWordRight(): void; /** * Moves the cursor to the word immediately to the left of the current position. Note that this does de-select the current selection. **/ - navigateWordLeft(); + navigateWordLeft(): void; /** * Replaces the first occurance of `options.needle` with the value in `replacement`. * @param replacement The text to replace with * @param options The [[Search `Search`]] options to use **/ - replace(replacement: string, options?: any); + replace(replacement: string, options?: any): void; /** * Replaces all occurances of `options.needle` with the value in `replacement`. * @param replacement The text to replace with * @param options The [[Search `Search`]] options to use **/ - replaceAll(replacement: string, options?: any); + replaceAll(replacement: string, options?: any): void; /** * {:Search.getOptions} For more information on `options`, see [[Search `Search`]]. @@ -1699,36 +1699,36 @@ declare module AceAjax { * @param options An object defining various search properties * @param animate If `true` animate scrolling **/ - find(needle: string, options?: any, animate?: boolean); + find(needle: string, options?: any, animate?: boolean): void; /** * Performs another search for `needle` in the document. For more information on `options`, see [[Search `Search`]]. * @param options search options * @param animate If `true` animate scrolling **/ - findNext(options?: any, animate?: boolean); + findNext(options?: any, animate?: boolean): void; /** * Performs a search for `needle` backwards. For more information on `options`, see [[Search `Search`]]. * @param options search options * @param animate If `true` animate scrolling **/ - findPrevious(options?: any, animate?: boolean); + findPrevious(options?: any, animate?: boolean): void; /** * {:UndoManager.undo} **/ - undo(); + undo(): void; /** * {:UndoManager.redo} **/ - redo(); + redo(): void; /** * Cleans up the entire editor. **/ - destroy(); + destroy(): void; } @@ -1740,7 +1740,7 @@ declare module AceAjax { **/ new(renderer: VirtualRenderer, session?: IEditSession): Editor; } - + interface EditorChangeEvent { start: Position; end: Position; @@ -1754,49 +1754,49 @@ declare module AceAjax { export interface PlaceHolder { - on(event: string, fn: (e) => any); + on(event: string, fn: (e: any) => any): void; /** * PlaceHolder.setup() * TODO **/ - setup(); + setup(): void; /** * PlaceHolder.showOtherMarkers() * TODO **/ - showOtherMarkers(); + showOtherMarkers(): void; /** * PlaceHolder.hideOtherMarkers() * Hides all over markers in the [[EditSession `EditSession`]] that are not the currently selected one. **/ - hideOtherMarkers(); + hideOtherMarkers(): void; /** * PlaceHolder@onUpdate(e) * Emitted when the place holder updates. **/ - onUpdate(); + onUpdate(): void; /** * PlaceHolder@onCursorChange(e) * Emitted when the cursor changes. **/ - onCursorChange(); + onCursorChange(): void; /** * PlaceHolder.detach() * TODO **/ - detach(); + detach(): void; /** * PlaceHolder.cancel() * TODO **/ - cancel(); + cancel(): void; } var PlaceHolder: { /** @@ -1819,15 +1819,15 @@ declare module AceAjax { export interface IRangeList { ranges: Range[]; - pointIndex(pos: Position, startIndex?: number); + pointIndex(pos: Position, startIndex?: number): void; - addList(ranges: Range[]); + addList(ranges: Range[]): void; - add(ranges: Range); + add(ranges: Range): void; merge(): Range[]; - substractPoint(pos: Position); + substractPoint(pos: Position): void; } export var RangeList: { new (): IRangeList; @@ -1860,7 +1860,7 @@ declare module AceAjax { * Returns `true` if and only if the starting row and column, and ending row and column, are equivalent to those given by `range`. * @param range A range to check against **/ - isEqual(range: Range); + isEqual(range: Range): void; /** * Returns a string containing the range's row and column information, given like this: @@ -1868,7 +1868,7 @@ declare module AceAjax { * [start.row/start.column] -> [end.row/end.column] * ``` **/ - toString(); + toString(): void; /** * Returns `true` if the `row` and `column` provided are within the given range. This can better be expressed as returning `true` if: @@ -1924,14 +1924,14 @@ declare module AceAjax { * @param row A row point to set * @param column A column point to set **/ - setStart(row: number, column: number); + setStart(row: number, column: number): void; /** * Sets the starting row and column for the range. * @param row A row point to set * @param column A column point to set **/ - setEnd(row: number, column: number); + setEnd(row: number, column: number): void; /** * Returns `true` if the `row` and `column` are within the given range. @@ -2059,7 +2059,7 @@ declare module AceAjax { * Emitted when the scroll bar, well, scrolls. * @param e Contains one property, `"data"`, which indicates the current scroll top position **/ - onScroll(e: any); + onScroll(e: any): void; /** * Returns the width of the scroll bar. @@ -2070,19 +2070,19 @@ declare module AceAjax { * Sets the height of the scroll bar, in pixels. * @param height The new height **/ - setHeight(height: number); + setHeight(height: number): void; /** * Sets the inner height of the scroll bar, in pixels. * @param height The new inner height **/ - setInnerHeight(height: number); + setInnerHeight(height: number): void; /** * Sets the scroll top of the scroll bar. * @param scrollTop The new scroll top **/ - setScrollTop(scrollTop: number); + setScrollTop(scrollTop: number): void; } var ScrollBar: { /** @@ -2116,7 +2116,7 @@ declare module AceAjax { * Sets the search options via the `options` parameter. * @param An object containing all the search propertie **/ - setOptions(An: any); + setOptions(An: any): void; /** * Searches for `options.needle`. If found, this method returns the [[Range `Range`]] where the text first occurs. If `options.backwards` is `true`, the search goes backwards in the session. @@ -2165,21 +2165,21 @@ declare module AceAjax { **/ export interface Selection { - addEventListener(ev: string, callback: Function); + addEventListener(ev: string, callback: Function): void; - moveCursorWordLeft(); + moveCursorWordLeft(): void; - moveCursorWordRight(); + moveCursorWordRight(): void; - fromOrientedRange(range: Range); + fromOrientedRange(range: Range): void; - setSelectionRange(match); + setSelectionRange(match: any): void; getAllRanges(): Range[]; - on(event: string, fn: (e) => any); + on(event: string, fn: (e: any) => any): void; - addRange(range: Range); + addRange(range: Range): void; /** * Returns `true` if the selection is empty. @@ -2201,7 +2201,7 @@ declare module AceAjax { * @param row The new row * @param column The new column **/ - setSelectionAnchor(row: number, column: number); + setSelectionAnchor(row: number, column: number): void; /** * Returns an object containing the `row` and `column` of the calling selection anchor. @@ -2217,7 +2217,7 @@ declare module AceAjax { * Shifts the selection up (or down, if [[Selection.isBackwards `isBackwards()`]] is true) the given number of columns. * @param columns The number of columns to shift by **/ - shiftSelection(columns: number); + shiftSelection(columns: number): void; /** * Returns `true` if the selection is going backwards in the document. @@ -2232,165 +2232,165 @@ declare module AceAjax { /** * [Empties the selection (by de-selecting it). This function also emits the `'changeSelection'` event.]{: #Selection.clearSelection} **/ - clearSelection(); + clearSelection(): void; /** * Selects all the text in the document. **/ - selectAll(); + selectAll(): void; /** * Sets the selection to the provided range. * @param range The range of text to select * @param reverse Indicates if the range should go backwards (`true`) or not **/ - setRange(range: Range, reverse: boolean); + setRange(range: Range, reverse: boolean): void; /** * Moves the selection cursor to the indicated row and column. * @param row The row to select to * @param column The column to select to **/ - selectTo(row: number, column: number); + selectTo(row: number, column: number): void; /** * Moves the selection cursor to the row and column indicated by `pos`. * @param pos An object containing the row and column **/ - selectToPosition(pos: any); + selectToPosition(pos: any): void; /** * Moves the selection up one row. **/ - selectUp(); + selectUp(): void; /** * Moves the selection down one row. **/ - selectDown(); + selectDown(): void; /** * Moves the selection right one column. **/ - selectRight(); + selectRight(): void; /** * Moves the selection left one column. **/ - selectLeft(); + selectLeft(): void; /** * Moves the selection to the beginning of the current line. **/ - selectLineStart(); + selectLineStart(): void; /** * Moves the selection to the end of the current line. **/ - selectLineEnd(); + selectLineEnd(): void; /** * Moves the selection to the end of the file. **/ - selectFileEnd(); + selectFileEnd(): void; /** * Moves the selection to the start of the file. **/ - selectFileStart(); + selectFileStart(): void; /** * Moves the selection to the first word on the right. **/ - selectWordRight(); + selectWordRight(): void; /** * Moves the selection to the first word on the left. **/ - selectWordLeft(); + selectWordLeft(): void; /** * Moves the selection to highlight the entire word. **/ - getWordRange(); + getWordRange(): void; /** * Selects an entire word boundary. **/ - selectWord(); + selectWord(): void; /** * Selects a word, including its right whitespace. **/ - selectAWord(); + selectAWord(): void; /** * Selects the entire line. **/ - selectLine(); + selectLine(): void; /** * Moves the cursor up one row. **/ - moveCursorUp(); + moveCursorUp(): void; /** * Moves the cursor down one row. **/ - moveCursorDown(); + moveCursorDown(): void; /** * Moves the cursor left one column. **/ - moveCursorLeft(); + moveCursorLeft(): void; /** * Moves the cursor right one column. **/ - moveCursorRight(); + moveCursorRight(): void; /** * Moves the cursor to the start of the line. **/ - moveCursorLineStart(); + moveCursorLineStart(): void; /** * Moves the cursor to the end of the line. **/ - moveCursorLineEnd(); + moveCursorLineEnd(): void; /** * Moves the cursor to the end of the file. **/ - moveCursorFileEnd(); + moveCursorFileEnd(): void; /** * Moves the cursor to the start of the file. **/ - moveCursorFileStart(); + moveCursorFileStart(): void; /** * Moves the cursor to the word on the right. **/ - moveCursorLongWordRight(); + moveCursorLongWordRight(): void; /** * Moves the cursor to the word on the left. **/ - moveCursorLongWordLeft(); + moveCursorLongWordLeft(): void; /** * Moves the cursor to position indicated by the parameters. Negative numbers move the cursor backwards in the document. * @param rows The number of rows to move by * @param chars The number of characters to move by **/ - moveCursorBy(rows: number, chars: number); + moveCursorBy(rows: number, chars: number): void; /** * Moves the selection to the position indicated by its `row` and `column`. * @param position The position to move to **/ - moveCursorToPosition(position: any); + moveCursorToPosition(position: any): void; /** * Moves the cursor to the row and column provided. [If `preventUpdateDesiredColumn` is `true`, then the cursor stays in the same column position as its original point.]{: #preventUpdateBoolDesc} @@ -2398,7 +2398,7 @@ declare module AceAjax { * @param column The column to move to * @param keepDesiredColumn [If `true`, the cursor move does not respect the previous column]{: #preventUpdateBool} **/ - moveCursorTo(row: number, column: number, keepDesiredColumn?: boolean); + moveCursorTo(row: number, column: number, keepDesiredColumn?: boolean): void; /** * Moves the cursor to the screen position indicated by row and column. {:preventUpdateBoolDesc} @@ -2406,7 +2406,7 @@ declare module AceAjax { * @param column The column to move to * @param keepDesiredColumn {:preventUpdateBool} **/ - moveCursorToScreen(row: number, column: number, keepDesiredColumn: boolean); + moveCursorToScreen(row: number, column: number, keepDesiredColumn: boolean): void; } var Selection: { /** @@ -2431,7 +2431,7 @@ declare module AceAjax { * Returns the editor identified by the index `idx`. * @param idx The index of the editor you want **/ - getEditor(idx: number); + getEditor(idx: number): void; /** * Returns the current editor. @@ -2441,44 +2441,44 @@ declare module AceAjax { /** * Focuses the current editor. **/ - focus(); + focus(): void; /** * Blurs the current editor. **/ - blur(); + blur(): void; /** * Sets a theme for each of the available editors. * @param theme The name of the theme to set **/ - setTheme(theme: string); + setTheme(theme: string): void; /** * Sets the keyboard handler for the editor. * @param keybinding **/ - setKeyboardHandler(keybinding: string); + setKeyboardHandler(keybinding: string): void; /** * Executes `callback` on all of the available editors. * @param callback A callback function to execute * @param scope The default scope for the callback **/ - forEach(callback: Function, scope: string); + forEach(callback: Function, scope: string): void; /** * Sets the font size, in pixels, for all the available editors. * @param size The new font size **/ - setFontSize(size: number); + setFontSize(size: number): void; /** * Sets a new [[EditSession `EditSession`]] for the indicated editor. * @param session The new edit session * @param idx The editor's index you're interested in **/ - setSession(session: IEditSession, idx: number); + setSession(session: IEditSession, idx: number): void; /** * Returns the orientation. @@ -2489,12 +2489,12 @@ declare module AceAjax { * Sets the orientation. * @param orientation The new orientation value **/ - setOrientation(orientation: number); + setOrientation(orientation: number): void; /** * Resizes the editor. **/ - resize(); + resize(): void; } var Split: { new(): Split; @@ -2583,7 +2583,7 @@ declare module AceAjax { * - `args[1]` is the document to associate with * @param options Contains additional properties **/ - execute(options: any); + execute(options: any): void; /** * [Perform an undo operation on the document, reverting the last change.]{: #UndoManager.undo} @@ -2595,12 +2595,12 @@ declare module AceAjax { * [Perform a redo operation on the document, reimplementing the last change.]{: #UndoManager.redo} * @param dontSelect {:dontSelect} **/ - redo(dontSelect: boolean); + redo(dontSelect: boolean): void; /** * Destroys the stack of undo and redo redo operations. **/ - reset(); + reset(): void; /** * Returns `true` if there are undo operations left to perform. @@ -2611,12 +2611,12 @@ declare module AceAjax { * Returns `true` if there are redo operations left to perform. **/ hasRedo(): boolean; - + /** * Returns `true` if the dirty counter is 0 **/ isClean(): boolean; - + /** * Sets dirty counter to 0 **/ @@ -2645,35 +2645,35 @@ declare module AceAjax { lineHeight: number; - screenToTextCoordinates(left: number, top: number); + screenToTextCoordinates(left: number, top: number): void; /** * Associates the renderer with an [[EditSession `EditSession`]]. **/ - setSession(session: IEditSession); + setSession(session: IEditSession): void; /** * Triggers a partial update of the text, from the range given by the two parameters. * @param firstRow The first row to update * @param lastRow The last row to update **/ - updateLines(firstRow: number, lastRow: number); + updateLines(firstRow: number, lastRow: number): void; /** * Triggers a full update of the text, for all the rows. **/ - updateText(); + updateText(): void; /** * Triggers a full update of all the layers, for all the rows. * @param force If `true`, forces the changes through **/ - updateFull(force: boolean); + updateFull(force: boolean): void; /** * Updates the font size. **/ - updateFontSize(); + updateFontSize(): void; /** * [Triggers a resize of the editor.]{: #VirtualRenderer.onResize} @@ -2682,18 +2682,18 @@ declare module AceAjax { * @param width The width of the editor in pixels * @param height The hiehgt of the editor, in pixels **/ - onResize(force: boolean, gutterWidth: number, width: number, height: number); + onResize(force: boolean, gutterWidth: number, width: number, height: number): void; /** * Adjusts the wrap limit, which is the number of characters that can fit within the width of the edit area on screen. **/ - adjustWrapLimit(); + adjustWrapLimit(): void; /** * Identifies whether you want to have an animated scroll or not. * @param shouldAnimate Set to `true` to show animated scrolls **/ - setAnimatedScroll(shouldAnimate: boolean); + setAnimatedScroll(shouldAnimate: boolean): void; /** * Returns whether an animated scroll happens or not. @@ -2704,7 +2704,7 @@ declare module AceAjax { * Identifies whether you want to show invisible characters or not. * @param showInvisibles Set to `true` to show invisibles **/ - setShowInvisibles(showInvisibles: boolean); + setShowInvisibles(showInvisibles: boolean): void; /** * Returns whether invisible characters are being shown or not. @@ -2715,7 +2715,7 @@ declare module AceAjax { * Identifies whether you want to show the print margin or not. * @param showPrintMargin Set to `true` to show the print margin **/ - setShowPrintMargin(showPrintMargin: boolean); + setShowPrintMargin(showPrintMargin: boolean): void; /** * Returns whether the print margin is being shown or not. @@ -2726,7 +2726,7 @@ declare module AceAjax { * Identifies whether you want to show the print margin column or not. * @param showPrintMargin Set to `true` to show the print margin column **/ - setPrintMarginColumn(showPrintMargin: boolean); + setPrintMarginColumn(showPrintMargin: boolean): void; /** * Returns whether the print margin column is being shown or not. @@ -2742,7 +2742,7 @@ declare module AceAjax { * Identifies whether you want to show the gutter or not. * @param show Set to `true` to show the gutter **/ - setShowGutter(show: boolean); + setShowGutter(show: boolean): void; /** * Returns the root element containing this renderer. @@ -2783,7 +2783,7 @@ declare module AceAjax { * Sets the padding for all the layers. * @param padding A new padding value (in pixels) **/ - setPadding(padding: number); + setPadding(padding: number): void; /** * Returns whether the horizontal scrollbar is set to be always visible. @@ -2794,58 +2794,58 @@ declare module AceAjax { * Identifies whether you want to show the horizontal scrollbar or not. * @param alwaysVisible Set to `true` to make the horizontal scroll bar visible **/ - setHScrollBarAlwaysVisible(alwaysVisible: boolean); + setHScrollBarAlwaysVisible(alwaysVisible: boolean): void; /** * Schedules an update to all the front markers in the document. **/ - updateFrontMarkers(); + updateFrontMarkers(): void; /** * Schedules an update to all the back markers in the document. **/ - updateBackMarkers(); + updateBackMarkers(): void; /** * Deprecated; (moved to [[EditSession]]) **/ - addGutterDecoration(); + addGutterDecoration(): void; /** * Deprecated; (moved to [[EditSession]]) **/ - removeGutterDecoration(); + removeGutterDecoration(): void; /** * Redraw breakpoints. **/ - updateBreakpoints(); + updateBreakpoints(): void; /** * Sets annotations for the gutter. * @param annotations An array containing annotations **/ - setAnnotations(annotations: any[]); + setAnnotations(annotations: any[]): void; /** * Updates the cursor icon. **/ - updateCursor(); + updateCursor(): void; /** * Hides the cursor icon. **/ - hideCursor(); + hideCursor(): void; /** * Shows the cursor icon. **/ - showCursor(); + showCursor(): void; /** * Scrolls the cursor into the first visibile area of the editor **/ - scrollCursorIntoView(); + scrollCursorIntoView(): void; /** * {:EditSession.getScrollTop} @@ -2871,7 +2871,7 @@ declare module AceAjax { * Gracefully scrolls from the top of the editor to the row indicated. * @param row A row id **/ - scrollToRow(row: number); + scrollToRow(row: number): void; /** * Gracefully scrolls the editor to the row indicated. @@ -2880,7 +2880,7 @@ declare module AceAjax { * @param animate If `true` animates scrolling * @param callback Function to be called after the animation has finished **/ - scrollToLine(line: number, center: boolean, animate: boolean, callback: Function); + scrollToLine(line: number, center: boolean, animate: boolean, callback: Function): void; /** * Scrolls the editor to the y pixel indicated. @@ -2899,7 +2899,7 @@ declare module AceAjax { * @param deltaX The x value to scroll by * @param deltaY The y value to scroll by **/ - scrollBy(deltaX: number, deltaY: number); + scrollBy(deltaX: number, deltaY: number): void; /** * Returns `true` if you can still scroll by either parameter; in other words, you haven't reached the end of the file or line. @@ -2918,35 +2918,35 @@ declare module AceAjax { /** * Focuses the current container. **/ - visualizeFocus(); + visualizeFocus(): void; /** * Blurs the current container. **/ - visualizeBlur(); + visualizeBlur(): void; /** * undefined * @param position **/ - showComposition(position: number); + showComposition(position: number): void; /** * Sets the inner text of the current composition to `text`. * @param text A string of text to use **/ - setCompositionText(text: string); + setCompositionText(text: string): void; /** * Hides the current composition. **/ - hideComposition(); + hideComposition(): void; /** * [Sets a new theme for the editor. `theme` should exist, and be a directory path, like `ace/theme/textmate`.]{: #VirtualRenderer.setTheme} * @param theme The path to a theme **/ - setTheme(theme: string); + setTheme(theme: string): void; /** * [Returns the path of the current theme.]{: #VirtualRenderer.getTheme} @@ -2957,18 +2957,18 @@ declare module AceAjax { * [Adds a new class, `style`, to the editor.]{: #VirtualRenderer.setStyle} * @param style A class name **/ - setStyle(style: string); + setStyle(style: string): void; /** * [Removes the class `style` from the editor.]{: #VirtualRenderer.unsetStyle} * @param style A class name **/ - unsetStyle(style: string); + unsetStyle(style: string): void; /** * Destroys the text and cursor layers for this renderer. **/ - destroy(); + destroy(): void; } var VirtualRenderer: { From f9a085d839f8e058a628a2e7847f0f2a9c2b8be8 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Fri, 20 Nov 2015 21:01:55 +0100 Subject: [PATCH 064/389] gulp-typescript "params" are not compulsory See https://github.com/ivogabe/gulp-typescript/blob/v2.9.2/lib/main.ts#L261 --- gulp-typescript/gulp-typescript-tests.ts | 6 ++++++ gulp-typescript/gulp-typescript.d.ts | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/gulp-typescript/gulp-typescript-tests.ts b/gulp-typescript/gulp-typescript-tests.ts index 3dd743188..5abd5a152 100644 --- a/gulp-typescript/gulp-typescript-tests.ts +++ b/gulp-typescript/gulp-typescript-tests.ts @@ -54,3 +54,9 @@ gulp.task('scripts', function () { return gulp.src('lib/*.ts') .pipe(typescript(tsProject, undefined, typescript.reporter.fullReporter())); }); + +gulp.task('default', function () { + return gulp.src('src/**/*.ts') + .pipe(typescript()) + .pipe(gulp.dest('built/local')); +}); diff --git a/gulp-typescript/gulp-typescript.d.ts b/gulp-typescript/gulp-typescript.d.ts index 7b16d0a5a..84d4b5d9c 100644 --- a/gulp-typescript/gulp-typescript.d.ts +++ b/gulp-typescript/gulp-typescript.d.ts @@ -6,11 +6,11 @@ /// declare module "gulp-typescript" { - function GulpTypescript(params: GulpTypescript.Params, filters?: GulpTypescript.FilterSettings, reporter?: GulpTypescript.Reporter): GulpTypescript.CompilationStream; + function GulpTypescript(params?: GulpTypescript.Params, filters?: GulpTypescript.FilterSettings, reporter?: GulpTypescript.Reporter): GulpTypescript.CompilationStream; module GulpTypescript { - export function createProject(params: Params): Project; - export function createProject(file: string, params: Params): Project; + export function createProject(params?: Params): Project; + export function createProject(file: string, params?: Params): Project; export function filter(filters: FilterSettings): CompilationStream; interface Params { declarationFiles?: boolean; From 877a6206a148c3212dead5b74923a5e43ed039b3 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Fri, 20 Nov 2015 21:13:09 +0100 Subject: [PATCH 065/389] Update gulp-useref to version 3.0.0 --- gulp-useref/gulp-useref-tests.ts | 75 +++++++++++++++++++++++++++++--- gulp-useref/gulp-useref.d.ts | 19 ++++---- 2 files changed, 77 insertions(+), 17 deletions(-) diff --git a/gulp-useref/gulp-useref-tests.ts b/gulp-useref/gulp-useref-tests.ts index 95c35662d..6af7aaab8 100644 --- a/gulp-useref/gulp-useref-tests.ts +++ b/gulp-useref/gulp-useref-tests.ts @@ -1,15 +1,76 @@ /// /// +/// +/// +/// +/// +/// +/// +/// -import gulp = require('gulp'); -import useref = require('gulp-useref'); - -gulp.task('default', () => { - var assets = useref.assets(); +import * as gulp from 'gulp'; +import * as useref from 'gulp-useref'; +// Usage +gulp.task('default', function () { return gulp.src('app/*.html') - .pipe(assets) - .pipe(assets.restore()) .pipe(useref()) .pipe(gulp.dest('dist')); }); + +gulp.task('default', function () { + return gulp.src('app/*.html') + .pipe(useref({ searchPath: '.tmp' })) + .pipe(gulp.dest('dist')); +}); + +import * as gulpif from 'gulp-if'; +import uglify = require('gulp-uglify'); +import minifyCss = require('gulp-minify-css'); + +gulp.task('html', function () { + return gulp.src('app/*.html') + .pipe(useref()) + .pipe(gulpif('*.js', uglify())) + .pipe(gulpif('*.css', minifyCss())) + .pipe(gulp.dest('dist')); +}); + + +// Transform Streams +import * as sourcemaps from 'gulp-sourcemaps'; +import lazypipe = require('lazypipe'); + +gulp.task('default', function () { + return gulp.src('index.html') + .pipe(useref({}, lazypipe().pipe(sourcemaps.init, { loadMaps: true })())) + .pipe(sourcemaps.write('maps')) + .pipe(gulp.dest('dist')); +}); + + +// options.additionalStreams +import * as ts from 'gulp-typescript'; + +// create stream of virtual files +var tsStream = gulp.src('src/**/*.ts') + .pipe(ts()); + +gulp.task('default', function () { + // use gulp-useref normally + return gulp.src('src/index.html') + .pipe(useref({ additionalStreams: [tsStream] })) + .pipe(gulp.dest('dist')); +}); + + +// options.transformPath +gulp.task('default', function () { + return gulp.src('app/*.html') + .pipe(useref({ + transformPath: function(filePath) { + return filePath.replace('/rootpath','') + } + })) + .pipe(gulp.dest('dist')); +}); diff --git a/gulp-useref/gulp-useref.d.ts b/gulp-useref/gulp-useref.d.ts index b1628aa5f..86011015c 100644 --- a/gulp-useref/gulp-useref.d.ts +++ b/gulp-useref/gulp-useref.d.ts @@ -1,4 +1,4 @@ -// Type definitions for gulp-useref v1.2.0 +// Type definitions for gulp-useref v3.0.0 // Project: https://github.com/jonkemp/gulp-useref // Definitions by: Tanguy Krotoff // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -6,20 +6,19 @@ /// declare module 'gulp-useref' { - interface IAssetsOptions { + interface Options { searchPath?: string | string[]; + base?: string; + noAssets?: boolean; noconcat?: boolean; + additionalStreams?: Array; + transformPath?: (filePath: string) => void; } - interface IAssetsStream extends NodeJS.ReadWriteStream { - restore(): NodeJS.ReadWriteStream; + interface Useref { + (options?: Options, ...transformStreams: NodeJS.ReadWriteStream[]): NodeJS.ReadWriteStream; } - interface IUseref { - (options?: any): NodeJS.ReadWriteStream; - assets(options?: IAssetsOptions): IAssetsStream; - } - - var useref: IUseref; + var useref: Useref; export = useref; } From a2e956e0f1bf38a0713c90f1164e1d6462ad6e45 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Fri, 20 Nov 2015 21:15:48 +0100 Subject: [PATCH 066/389] Fix gulp-rev-replace-tests.ts --- gulp-rev-replace/gulp-rev-replace-tests.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/gulp-rev-replace/gulp-rev-replace-tests.ts b/gulp-rev-replace/gulp-rev-replace-tests.ts index 57515c9ac..e7c5d9c18 100644 --- a/gulp-rev-replace/gulp-rev-replace-tests.ts +++ b/gulp-rev-replace/gulp-rev-replace-tests.ts @@ -9,13 +9,9 @@ import rev = require('gulp-rev'); import useref = require('gulp-useref'); gulp.task("index", () => { - var userefAssets = useref.assets(); - return gulp.src("src/index.html") - .pipe(userefAssets) // Concatenate with gulp-useref + .pipe(useref()) // Concatenate with gulp-useref .pipe(rev()) // Rename the concatenated files - .pipe(userefAssets.restore()) - .pipe(useref()) .pipe(revReplace()) // Substitute in new filenames .pipe(gulp.dest('public')); }); From a64af03846ab33df431b149665cf6e4b45dbafd0 Mon Sep 17 00:00:00 2001 From: Glen Date: Fri, 20 Nov 2015 22:35:30 +0200 Subject: [PATCH 067/389] Opts is optional See: http://www.browsersync.io/docs/api/#api-stream --- browser-sync/browser-sync.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/browser-sync/browser-sync.d.ts b/browser-sync/browser-sync.d.ts index 00c242942..2276f36e5 100644 --- a/browser-sync/browser-sync.d.ts +++ b/browser-sync/browser-sync.d.ts @@ -371,7 +371,7 @@ declare module "browser-sync" { * The stream method returns a transform stream and can act once or on many files. * @param opts Configuration for the stream method */ - stream(opts: { once: boolean }): NodeJS.ReadWriteStream; + stream(opts?: { once: boolean }): NodeJS.ReadWriteStream; /** * Helper method for browser notifications * @param message Can be a simple message such as 'Connected' or HTML From 31bef5ed0228a1b1fc111d9a396d38b95067a1c9 Mon Sep 17 00:00:00 2001 From: rhysd Date: Sat, 21 Nov 2015 07:15:38 +0900 Subject: [PATCH 068/389] DevTools-related methods are moved from BrowserWindow to WebContents DevTools-related methods are no longer defined in `BrowserWindow`. https://github.com/atom/electron/blob/master/docs/api/browser-window.md Instead, they are defined in `WebContents`. https://github.com/atom/electron/blob/master/docs/api/web-contents.md --- github-electron/github-electron-main-tests.ts | 10 +++-- github-electron/github-electron.d.ts | 42 +++++++++---------- 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/github-electron/github-electron-main-tests.ts b/github-electron/github-electron-main-tests.ts index 3bce8390e..8a4dcced8 100644 --- a/github-electron/github-electron-main-tests.ts +++ b/github-electron/github-electron-main-tests.ts @@ -61,9 +61,11 @@ app.on('ready', () => { mainWindow.loadUrl('file://foo/bar', {userAgent: 'cool-agent', httpReferrer: 'greateRefferer'}); mainWindow.webContents.loadUrl('file://foo/bar', {userAgent: 'cool-agent', httpReferrer: 'greateRefferer'}); - mainWindow.openDevTools() - var opened: boolean = mainWindow.isDevToolsOpened() - mainWindow.toggleDevTools() + mainWindow.webContents.openDevTools(); + mainWindow.webContents.toggleDevTools(); + mainWindow.webContents.openDevTools({detach: true}); + mainWindow.webContents.closeDevTools(); + var opened: boolean = mainWindow.webContents.isDevToolsOpened() // Emitted when the window is closed. mainWindow.on('closed', () => { // Dereference the window object, usually you would store windows @@ -344,7 +346,7 @@ var template = [ { label: 'Toggle DevTools', accelerator: 'Alt+Command+I', - click: () => { BrowserWindow.getFocusedWindow().toggleDevTools(); } + click: () => { BrowserWindow.getFocusedWindow().webContents.toggleDevTools(); } } ] }, diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts index fee13c29f..cc9099489 100644 --- a/github-electron/github-electron.d.ts +++ b/github-electron/github-electron.d.ts @@ -343,27 +343,6 @@ declare module GitHubElectron { * @returns Whether the window's document has been edited. */ isDocumentEdited(): boolean; - /** - * Opens the developer tools. - */ - openDevTools(options?: { - /** - * Opens devtools in a new window. - */ - detach?: boolean; - }): void; - /** - * Closes the developer tools. - */ - closeDevTools(): void; - /** - * Returns whether the developer tools are opened. - */ - isDevToolsOpened(): boolean; - /** - * Toggle the developer tools. - */ - toggleDevTools(): void; reloadIgnoringCache(): void; /** * Starts inspecting element at position (x, y). @@ -731,6 +710,27 @@ declare module GitHubElectron { * data Buffer - PDF file content */ callback: (error: Error, data: Buffer) => void): void; + /** + * Opens the developer tools. + */ + openDevTools(options?: { + /** + * Opens devtools in a new window. + */ + detach?: boolean; + }): void; + /** + * Closes the developer tools. + */ + closeDevTools(): void; + /** + * Returns whether the developer tools are opened. + */ + isDevToolsOpened(): boolean; + /** + * Toggle the developer tools. + */ + toggleDevTools(): void; /** * Send args.. to the web page via channel in asynchronous message, the web page * can handle it by listening to the channel event of ipc module. From addd482a5bc764e67b3d5c6f4b42b1f45de28fa7 Mon Sep 17 00:00:00 2001 From: rhysd Date: Sat, 21 Nov 2015 07:20:04 +0900 Subject: [PATCH 069/389] github-electron: Add addWorkSpace() and removeWorkSpace to WebContents --- github-electron/github-electron-main-tests.ts | 2 ++ github-electron/github-electron.d.ts | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/github-electron/github-electron-main-tests.ts b/github-electron/github-electron-main-tests.ts index 8a4dcced8..411c85f56 100644 --- a/github-electron/github-electron-main-tests.ts +++ b/github-electron/github-electron-main-tests.ts @@ -65,6 +65,8 @@ app.on('ready', () => { mainWindow.webContents.toggleDevTools(); mainWindow.webContents.openDevTools({detach: true}); mainWindow.webContents.closeDevTools(); + mainWindow.webContents.addWorkSpace('/path/to/workspace'); + mainWindow.webContents.removeWorkSpace('/path/to/workspace'); var opened: boolean = mainWindow.webContents.isDevToolsOpened() // Emitted when the window is closed. mainWindow.on('closed', () => { diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts index cc9099489..2d7844813 100644 --- a/github-electron/github-electron.d.ts +++ b/github-electron/github-electron.d.ts @@ -710,6 +710,14 @@ declare module GitHubElectron { * data Buffer - PDF file content */ callback: (error: Error, data: Buffer) => void): void; + /** + * Adds the specified path to DevTools workspace. + */ + addWorkSpace(path: string): void; + /** + * Removes the specified path from DevTools workspace. + */ + removeWorkSpace(path: string): void; /** * Opens the developer tools. */ From 6ba30af848e7f945876bf05e7a61e13078d54815 Mon Sep 17 00:00:00 2001 From: Justin Unterreiner Date: Fri, 20 Nov 2015 20:18:03 -0800 Subject: [PATCH 070/389] Added type definitions for cordova-plugin-spinner --- .../cordova-plugin-spinner-tests.ts | 10 ++++++ .../cordova-plugin-spinner.d.ts | 31 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 cordova-plugin-spinner/cordova-plugin-spinner-tests.ts create mode 100644 cordova-plugin-spinner/cordova-plugin-spinner.d.ts diff --git a/cordova-plugin-spinner/cordova-plugin-spinner-tests.ts b/cordova-plugin-spinner/cordova-plugin-spinner-tests.ts new file mode 100644 index 000000000..25e6b60ad --- /dev/null +++ b/cordova-plugin-spinner/cordova-plugin-spinner-tests.ts @@ -0,0 +1,10 @@ +/// + +SpinnerPlugin.activityStart(); +SpinnerPlugin.activityStart("a"); +SpinnerPlugin.activityStart("a", () => {}); +SpinnerPlugin.activityStart("a", () => {}, () => {}); + +SpinnerPlugin.activityStop(); +SpinnerPlugin.activityStop(() => {}); +SpinnerPlugin.activityStop(() => {}, () => {}); \ No newline at end of file diff --git a/cordova-plugin-spinner/cordova-plugin-spinner.d.ts b/cordova-plugin-spinner/cordova-plugin-spinner.d.ts new file mode 100644 index 000000000..44ccdde45 --- /dev/null +++ b/cordova-plugin-spinner/cordova-plugin-spinner.d.ts @@ -0,0 +1,31 @@ +// Type definitions for cordova-plugin-spinner 1.0.0 +// Project: https://github.com/Justin-Credible/cordova-plugin-spinner +// Definitions by: Justin Unterreiner +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module SpinnerPlugin { + + interface SpinnerPluginStatic { + + /** + * Blocks user input using an indeterminate spinner. + * + * An optional label can be shown below the spinner. + * + * @param labelText The optional value to show in a label. + * @param successCallback The success callback for this asynchronous function. + * @param failureCallback The failure callback for this asynchronous function; receives an error string. + */ + activityStart(labelText?: string, successCallback?: () => void, failureCallback?: (error: string) => void): void; + + /** + * Allows user input by hiding the indeterminate spinner. + * + * @param successCallback The success callback for this asynchronous function. + * @param failureCallback The failure callback for this asynchronous function; receives an error string. + */ + activityStop(successCallback?: () => void, failureCallback?: (error: string) => void): void; + } +} + +declare var SpinnerPlugin: SpinnerPlugin.SpinnerPluginStatic; From c9296d222f793894deda6d5cded13072db31899a Mon Sep 17 00:00:00 2001 From: progre Date: Sat, 21 Nov 2015 16:35:44 +0900 Subject: [PATCH 071/389] Url to URL --- github-electron/github-electron-main-tests.ts | 16 +++++++-------- .../github-electron-renderer-tests.ts | 4 ++-- github-electron/github-electron-renderer.d.ts | 2 +- github-electron/github-electron.d.ts | 20 +++++++++---------- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/github-electron/github-electron-main-tests.ts b/github-electron/github-electron-main-tests.ts index 3bce8390e..fcc3a1371 100644 --- a/github-electron/github-electron-main-tests.ts +++ b/github-electron/github-electron-main-tests.ts @@ -57,9 +57,9 @@ app.on('ready', () => { mainWindow = new BrowserWindow({ width: 800, height: 600 }); // and load the index.html of the app. - mainWindow.loadUrl(`file://${__dirname}/index.html`); - mainWindow.loadUrl('file://foo/bar', {userAgent: 'cool-agent', httpReferrer: 'greateRefferer'}); - mainWindow.webContents.loadUrl('file://foo/bar', {userAgent: 'cool-agent', httpReferrer: 'greateRefferer'}); + mainWindow.loadURL(`file://${__dirname}/index.html`); + mainWindow.loadURL('file://foo/bar', {userAgent: 'cool-agent', httpReferrer: 'greateRefferer'}); + mainWindow.webContents.loadURL('file://foo/bar', {userAgent: 'cool-agent', httpReferrer: 'greateRefferer'}); mainWindow.openDevTools() var opened: boolean = mainWindow.isDevToolsOpened() @@ -149,7 +149,7 @@ var onlineStatusWindow: GitHubElectron.BrowserWindow; app.on('ready', () => { onlineStatusWindow = new BrowserWindow({ width: 0, height: 0, show: false }); - onlineStatusWindow.loadUrl(`file://${__dirname}/online-status.html`); + onlineStatusWindow.loadURL(`file://${__dirname}/online-status.html`); }); ipc.on('online-status-changed', (event: any, status: any) => { @@ -165,7 +165,7 @@ app.on('ready', () => { height: 600, 'title-bar-style': 'hidden-inset', }); - window.loadUrl('https://github.com'); + window.loadURL('https://github.com'); }); // Supported Chrome command line switches @@ -179,7 +179,7 @@ app.commandLine.appendSwitch('vmodule', 'console=0'); // auto-updater // https://github.com/atom/electron/blob/master/docs/api/auto-updater.md -AutoUpdater.setFeedUrl('http://mycompany.com/myapp/latest?version=' + app.getVersion()); +AutoUpdater.setFeedURL('http://mycompany.com/myapp/latest?version=' + app.getVersion()); // browser-window // https://github.com/atom/electron/blob/master/docs/api/browser-window.md @@ -189,7 +189,7 @@ win.on('closed', () => { win = null; }); -win.loadUrl('https://github.com'); +win.loadURL('https://github.com'); win.show(); // content-tracing @@ -446,7 +446,7 @@ console.log(Clipboard.readText('selection')); CrashReporter.start({ productName: 'YourName', companyName: 'YourCompany', - submitUrl: 'https://your-domain.com/url-to-submit', + submitURL: 'https://your-domain.com/url-to-submit', autoSubmit: true }); diff --git a/github-electron/github-electron-renderer-tests.ts b/github-electron/github-electron-renderer-tests.ts index 4c940b651..86680600f 100644 --- a/github-electron/github-electron-renderer-tests.ts +++ b/github-electron/github-electron-renderer-tests.ts @@ -24,7 +24,7 @@ ipc.send('asynchronous-message', 'ping'); var BrowserWindow: typeof GitHubElectron.BrowserWindow = remote.require('browser-window'); var win = new BrowserWindow({ width: 800, height: 600 }); -win.loadUrl('https://github.com'); +win.loadURL('https://github.com'); remote.getCurrentWindow().on('close', () => { // blabla... @@ -66,7 +66,7 @@ console.log(Clipboard.readText('selection')); CrashReporter.start({ productName: 'YourName', companyName: 'YourCompany', - submitUrl: 'https://your-domain.com/url-to-submit', + submitURL: 'https://your-domain.com/url-to-submit', autoSubmit: true }); diff --git a/github-electron/github-electron-renderer.d.ts b/github-electron/github-electron-renderer.d.ts index 2fff2bb34..62b29d9cd 100644 --- a/github-electron/github-electron-renderer.d.ts +++ b/github-electron/github-electron-renderer.d.ts @@ -90,7 +90,7 @@ declare module GitHubElectron { * warnings. For example, https and data are secure schemes because they cannot be * corrupted by active network attackers. */ - registerUrlSchemeAsSecure(scheme: string): void; + registerURLSchemeAsSecure(scheme: string): void; } } diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts index fee13c29f..384c7c0d4 100644 --- a/github-electron/github-electron.d.ts +++ b/github-electron/github-electron.d.ts @@ -24,9 +24,9 @@ declare module GitHubElectron { */ static createFromBuffer(buffer: Buffer, scaleFactor?: number): NativeImage; /** - * Creates a new NativeImage instance from dataUrl + * Creates a new NativeImage instance from dataURL */ - static createFromDataUrl(dataUrl: string): NativeImage; + static createFromDataURL(dataURL: string): NativeImage; /** * @returns Buffer Contains the image's PNG encoded data. */ @@ -38,7 +38,7 @@ declare module GitHubElectron { /** * @returns string The data URL of the image. */ - toDataUrl(): string; + toDataURL(): string; /** * @returns boolean Whether the image is empty. */ @@ -398,9 +398,9 @@ declare module GitHubElectron { landscape?: boolean; }, callback: (error: Error, data: Buffer) => void): void; /** - * Same with webContents.loadUrl(url). + * Same with webContents.loadURL(url). */ - loadUrl(url: string, options?: { + loadURL(url: string, options?: { httpReferrer?: string; userAgent?: string; }): void; @@ -541,14 +541,14 @@ declare module GitHubElectron { * Loads the url in the window. * @param url Must contain the protocol prefix (e.g., the http:// or file://). */ - loadUrl(url: string, options?: { + loadURL(url: string, options?: { httpReferrer?: string; userAgent?: string; }): void; /** * @returns The URL of current web page. */ - getUrl(): string; + getURL(): string; /** * @returns The title of web page. */ @@ -1108,9 +1108,9 @@ declare module GitHubElectron { * Set the url and initialize the auto updater. * The url cannot be changed once it is set. */ - setFeedUrl(url: string): void; + setFeedURL(url: string): void; /** - * Ask the server whether there is an update, you have to call setFeedUrl + * Ask the server whether there is an update, you have to call setFeedURL * before using this API */ checkForUpdates(): any; @@ -1305,7 +1305,7 @@ declare module GitHubElectron { * URL that crash reports would be sent to as POST. * Default: http://54.249.141.255:1127/post */ - submitUrl?: string; + submitURL?: string; /** * Send the crash report without user interaction. * Default: true. From cd6041366589cbb833001f1174eafacfa1017d84 Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Sat, 21 Nov 2015 19:46:53 +0900 Subject: [PATCH 072/389] Add lwip.d.ts --- lwip/lwip-tests.ts | 285 +++++++++++++ lwip/lwip.d.ts | 1003 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1288 insertions(+) create mode 100644 lwip/lwip-tests.ts create mode 100644 lwip/lwip.d.ts diff --git a/lwip/lwip-tests.ts b/lwip/lwip-tests.ts new file mode 100644 index 000000000..4fca56381 --- /dev/null +++ b/lwip/lwip-tests.ts @@ -0,0 +1,285 @@ +/// + +import * as lwip from 'lwip'; + +lwip.open('lena.jpg', function(err, image) { + if (err) return console.log(err); + image.batch() + .blur(10) + .writeFile('lena_blur.jpg', function(err) { + if (err) return console.log(err); + console.log('done'); + }); +}); + +lwip.open('lena.jpg', function(err, image) { + if (err) return console.log(err); + image.batch() + .border(10, 'green') + .writeFile('lena_border.jpg', function(err) { + if (err) return console.log(err); + console.log('done'); + }); +}); + +lwip.open('lena.jpg', function(err, image) { + if (err) return console.log(err); + + image.batch() + .scale(0.75) + .border(5, [50, 100, 75, 75]) + .exec(function(err, image) { + if (err) return console.log(err); + + image.clone(function(err, clone1) { + if (err) return console.log("clone1:", err); + clone1.batch() + .mirror('y') + .hue(100) + .writeFile('lena_clone1.png', function(err) { + if (err) return console.log(err); + console.log('clone1: done'); + }); + }); + + image.clone(function(err, clone2) { + if (err) return console.log("clone2:", err); + clone2.batch() + .fade(0.5) + .mirror('x') + .writeFile('lena_clone2.png', function(err) { + if (err) return console.log(err); + console.log('clone2: done'); + }); + }); + + }); + +}); + +lwip.open('lena.jpg', function(err, image) { + if (err) return console.log(err); + image.contain(400,700,'green',function(err, image){ + image.writeFile('lena_contain.jpg', function(err){ + if (err) return console.log(err); + console.log('done'); + }); + }); +}); + +lwip.open('lena.gif', function(err, image) { + if (err) return console.log(err); + image.writeFile('lena_from_gif.png', function(err) { + if (err) return console.log(err); + console.log('done') + }); +}); + +lwip.open('lena.jpg', function(err, image) { + if (err) return console.log(err); + image.cover(400,800,function(err, image){ + image.writeFile('lena_cover.jpg', function(err){ + if (err) return console.log(err); + console.log('done'); + }); + }); +}); + +lwip.open('lena.jpg', function(err, image) { + if (err) return console.log(err); + image.batch() + .crop(400, 400) + .writeFile('lena_crop.jpg', function(err) { + if (err) return console.log(err); + console.log('done'); + }); +}); + +lwip.open('lena.jpg', function(err, image) { + if (err) return console.log(err); + + image.extract(230, 230, 370, 300, function(err, eyes) { + eyes.writeFile('lena_eyes.jpg', function(err) { + if (err) return console.log("eyes:", err); + console.log('eyes: done'); + }); + + eyes.extract(0, 0, 70, 71, function(err, left_eye) { + left_eye.writeFile('lena_eyes_left.jpg', function(err) { + if (err) return console.log("eyes left:", err); + console.log('eyes left: done'); + }); + }); + + eyes.extract(71, 0, 141, 71, function(err, right_eye) { + right_eye.writeFile('lena_eyes_right.jpg', function(err) { + if (err) return console.log("eyes right:", err); + console.log('eyes right: done'); + }); + }); + }); + + image.extract(240, 320, 350, 380, function(err, eyes) { + eyes.writeFile('lena_mouth.jpg', function(err) { + if (err) return console.log("mouth:", err); + console.log('mouth: done'); + }); + }); + +}); + +lwip.open('lena.jpg', function(err, image) { + if (err) return console.log(err); + image.batch() + .fade(0.5) + .writeFile('lena_fade.png', function(err) { + if (err) return console.log(err); + console.log('done'); + }); +}); + +lwip.open('lena.jpg', function(err, image) { + if (err) return console.log(err); + image.writeFile('lena_interlaced.gif', { + colors: 222, + interlaced: true + }, function(err) { + if (err) return console.log(err); + console.log('done'); + }); +}); + +lwip.open('lena.jpg', function(err, image) { + if (err) return console.log(err); + image.batch() + .hue(50) + .writeFile('lena_hue.jpg', function(err) { + if (err) return console.log(err); + console.log('done'); + }); +}); + +lwip.open('lena.jpg', function(err, image) { + if (err) return console.log(err); + image.batch() + .lighten(0.5) + .writeFile('lena_lighten.jpg', function(err) { + if (err) return console.log(err); + console.log('done'); + }); +}); + +lwip.open('lena.jpg', function(err, image) { + if (err) return console.log(err); + image.batch() + .mirror('x') + .writeFile('lena_mirror.jpg', function(err) { + if (err) return console.log(err); + console.log('done'); + }); +}); + +lwip.open(new Buffer(1000), { width: 10, height: 10 }, function(err, image) { + if (err) return console.log("err open", err); + image.batch() + .blur(9) + .writeFile('image_from_pixelbuffer.png', function(err){ + if (err) return console.log("err write", err); + console.log('done'); + }); +}); + +lwip.open('lena.jpg', function(err, image) { + if (err) return console.log(err); + image.batch() + .pad(10, 5, 10, 5, 'blue') + .writeFile('lena_pad.jpg', function(err) { + if (err) return console.log(err); + console.log('done'); + }); +}); + +lwip.open('lena.jpg', function(err, image) { + if (err) return console.log(err); + image.writeFile('lena_interlaced.png', { + compression: 'high', + interlaced: true + }, function(err) { + if (err) return console.log(err); + console.log('done'); + }); +}); + +lwip.open('lena.jpg', function(err, image) { + if (err) return console.log(err); + image.writeFile('lena_low_quality.jpg', { + quality: 10 + }, function(err) { + if (err) return console.log(err); + console.log('done'); + }); +}); + +lwip.open('lena.jpg', function(err, image) { + if (err) return console.log(err); + image.batch() + .rotate(45, { + r: 90, + g: 55, + b: 40 + }) + .writeFile('lena_rotate.gif', function(err) { + if (err) return console.log(err); + console.log('done') + }); +}); + +lwip.open('lena.png', function(err, image) { + if (err) return console.log(err); + image.batch() + .rotate(-33, 'white') + .scale(1.5) + .blur(5) + .writeFile('lena_rotate_scale_blur.jpg', function(err) { + if (err) return console.log(err); + console.log('done'); + }); +}); + +lwip.open('lena.jpg', function(err, image) { + if (err) return console.log(err); + image.batch() + .saturate(0.5) + .writeFile('lena_saturate.jpg', function(err) { + if (err) return console.log(err); + console.log('done'); + }); +}); + +lwip.create(3, 3, function(err, image){ + if (err) return console.log(err); + + var batch = image.batch(); + + // set the same color for each columns in the image + for (let x = 0; x < 3 ; x++){ + let c = {r: 100, g: 100, b: 100}; + for (let y = 0; y < 3; y++){ + batch.setPixel(x, y, c); + } + } + + batch.writeFile('rainbow.png', function(err){ + if (err) console.log(err); + }); +}); + +lwip.open('lena.jpg', function(err, image) { + if (err) return console.log(err); + image.batch() + .sharpen(200) + .writeFile('lena_sharpen.jpg', function(err) { + if (err) return console.log(err); + console.log('done'); + }); +}); diff --git a/lwip/lwip.d.ts b/lwip/lwip.d.ts new file mode 100644 index 000000000..63d2c701b --- /dev/null +++ b/lwip/lwip.d.ts @@ -0,0 +1,1003 @@ +// Type definitions for Light-weight image processor 0.0.8 +// Project: https://github.com/EyalAr/lwip +// Definitions by: Aya Morisawa +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "lwip" { + type ColorObject = {r: number, g: number, b: number, a?: number}; + type Color = string | [number, number, number, number] | ColorObject; + + interface ImageCallback { + (err: any, image: Image): void; + } + + /** + * Open an image + * @param source The path to the image on disk. + */ + function open(source: string, callback: ImageCallback): void; + + /** + * Open an image + * @param source The path to the image on disk. + * @param type Optional type of the image. If omitted, the type will be inferred from the file extension. Type must be a string of the image type (i.e. "jpg"). + */ + function open(source: string, type: string, callback: ImageCallback): void; + + /** + * Open an image + * @param source The path to the image on disk or an image buffer. + * @param type Type of the image. If source is an encoded image buffer, type must be a string of the image type (i.e. "jpg"). If source is a raw pixels buffer type must be an object with type.width and type.height properties. + */ + function open(source: Buffer, type: string | {width: number, height: number}, callback: ImageCallback): any; + + /** + * Create a new image + * @param width The width of the new image. + * @param height The height of the new image. + */ + function create(width: number, height: number, callback: ImageCallback): void; + + /** + * Create a new image + * @param width The width of the new image. + * @param height The height of the new image. + * @param color Optional Color of the canvas. + */ + function create(width: number, height: number, color: Color, callback: ImageCallback): void; + + type JpegBufferParams = { + quality?: number; + }; + + type PngBufferParams = { + compression?: string; + interlaced?: boolean; + transparency?: boolean | string; + }; + + type GifBufferParams = { + colors?: number; + interlaced?: boolean; + transparency?: boolean | string; + threshold: number; + } + + interface Image { + // Image operations + + /** + * Resize + * @param Width in pixels. + */ + resize(width: number, callback: ImageCallback): void; + + /** + * Resize + * @param Width in pixels. + * @param Interpolation method. + */ + resize(width: number, inter: string, callback: ImageCallback): void; + + /** + * Resize + * @param Width in pixels. + * @param Height in pixels. + */ + resize(width: number, height: number, callback: ImageCallback): void; + + /** + * Resize + * @param Width in pixels. + * @param Height in pixels. + * @param Interpolation method. + */ + resize(width: number, height: number, inter: string, callback: ImageCallback): void; + + /** + * Scale + * @param wRatio Width scale ratio. + */ + scale(wRatio: number, callback: ImageCallback): void; + + /** + * Scale + * @param wRatio Width scale ratio. + * @param inter Interpolation method. + */ + scale(wRatio: number, inter: string, callback: ImageCallback): void; + + /** + * Scale + * @param wRatio Width scale ratio. + * @param hRatio Height scale ratio. + */ + scale(wRatio: number, hRatio: number, callback: ImageCallback): void; + + /** + * Scale + * @param wRatio Width scale ratio. + * @param hRatio Height scale ratio. + * @param inter Interpolation method. + */ + scale(wRatio: number, hRatio: number, inter: string, callback: ImageCallback): void; + + /** + * Contain the image in a colored canvas. The image will be resized to the largest possible size such that it's fully contained inside the canvas. + * @param width Canvas' width in pixels. + * @param height Canvas' height in pixels. + */ + contain(width: number, height: number, callback: ImageCallback): void; + + /** + * Contain the image in a colored canvas. The image will be resized to the largest possible size such that it's fully contained inside the canvas. + * @param width Canvas' width in pixels. + * @param height Canvas' height in pixels. + * @param color Color of the canvas. + */ + contain(width: number, height: number, color: Color, callback: ImageCallback): void; + + /** + * Contain the image in a colored canvas. The image will be resized to the largest possible size such that it's fully contained inside the canvas. + * @param width Canvas' width in pixels. + * @param height Canvas' height in pixels. + * @param inter Interpolation method. + */ + contain(width: number, height: number, inter: string, callback: ImageCallback): void; + + /** + * Contain the image in a colored canvas. The image will be resized to the largest possible size such that it's fully contained inside the canvas. + * @param width Canvas' width in pixels. + * @param height Canvas' height in pixels. + * @param color Color of the canvas. + * @param inter Interpolation method. + */ + contain(width: number, height: number, color: Color, inter: string, callback: ImageCallback): void; + + /** + * Cover a canvas with the image. The image will be resized to the smallest possible size such that both its dimensions are bigger than the canvas's dimensions. Margins of the image exceeding the canvas will be discarded. + * @param width Canvas' width in pixels. + * @param height Canvas' height in pixels. + */ + cover(width: number, height: number, callback: ImageCallback): void; + + /** + * Cover a canvas with the image. The image will be resized to the smallest possible size such that both its dimensions are bigger than the canvas's dimensions. Margins of the image exceeding the canvas will be discarded. + * @param width Canvas' width in pixels. + * @param height Canvas' height in pixels. + * @param inter Interpolation method. + */ + cover(width: number, height: number, inter: string, callback: ImageCallback): void; + + /** + * Rotate + * @param degs Clockwise rotation degrees. + */ + rotate(degs: number, callback: ImageCallback): void; + + /** + * Rotate + * @param degs Clockwise rotation degrees. + * @param color Color of the canvas. + */ + rotate(degs: number, color: Color, callback: ImageCallback): void; + + /** + * Crop with rectangle coordinates + */ + crop(left: number, top: number, right: number, bottom: number, callback: ImageCallback): void; + + /** + * Crop a rectangle from center + * @param width Width of the rectangle to crop from the center of the image. + * @param height Height of the rectangle to crop from the center of the image. + */ + crop(width: number, height: number, callback: ImageCallback): void; + + /** + * Gaussian blur. + * @param sigma Standard deviation of the Gaussian filter. + */ + blur(sigma: number, callback: ImageCallback): void; + + /** + * Inverse diffusion shapren. + * @param amplitude Sharpening amplitude. + */ + sharpen(amplitude: number, callback: ImageCallback): void; + + /** + * Mirror an image along the 'x' axis, 'y' axis or both. + * @param axes 'x', 'y' or 'xy' (case sensitive). + */ + mirror(axes: string, callback: ImageCallback): void; + + /** + * Alias of mirror. Mirror an image along the 'x' axis, 'y' axis or both. + * @param axes 'x', 'y' or 'xy' (case sensitive). + */ + flip(axes: string, callback: ImageCallback): void; + + /** + * Add a colored border to the image. + * @param width Border width in pixels. + */ + border(width: number, callback: ImageCallback): void; + + /** + * Add a colored border to the image. + * @param width Border width in pixels. + * @param color Color of the border. + */ + border(width: number, color: Color, callback: ImageCallback): void; + + /** + * Pad image edges with colored pixels. + * @param left Number of pixels to add to left edge. + * @param top Number of pixels to add to top edge. + * @param right Number of pixels to add to right edge. + * @param bottom Number of pixels to add to bottom edge. + */ + pad(left: number, top: number, right: number, bottom: number, callback: ImageCallback): void; + + /** + * Pad image edges with colored pixels. + * @param left Number of pixels to add to left edge. + * @param top Number of pixels to add to top edge. + * @param right Number of pixels to add to right edge. + * @param bottom Number of pixels to add to bottom edge. + * @param color Color of the padding. + */ + pad(left: number, top: number, right: number, bottom: number, color: Color, callback: ImageCallback): void; + + /** + * Adjust image saturation. + * + * Examples: + * 1. image.saturate(0, ...) will have no effect on the image. + * 2. image.saturate(0.5, ...) will increase the saturation by 50%. + * 3. image.saturate(-1, ...) will decrease the saturation by 100%, effectively desaturating the image. + * + * @param delta By how much to increase / decrease the saturation. + */ + saturate(delta: number, callback: ImageCallback): void; + + /** + * Adjust image lightness. + * + * Examples: + * 1. image.lighten(0, ...) will have no effect on the image. + * 2. image.lighten(0.5, ...) will increase the lightness by 50%. + * 3. image.lighten(-1, ...) will decrease the lightness by 100%, effectively making the image black. + * + * @param delta By how much to increase / decrease the lightness. + */ + lighten(delta: number, callback: ImageCallback): void; + + /** + * Adjust image lightness. Equivalent to image.lighten(-delta, callback). + * @param delta By how much to increase / decrease the lightness. + */ + darken(delta: number, callback: ImageCallback): void; + + /** + * Adjust image hue. + * + * Examples: + * 1. image.hue(0, ...) will have no effect on the image. + * 2. image.hue(100, ...) will shift pixels' hue by 100 degrees. + * + * Note: The hue is shifted in a circular manner in the range [0,360] for each pixel individually. + * + * @param shift By how many degrees to shift each pixel's hue. + */ + hue(shift: number, callback: ImageCallback): void; + + /** + * Adjust image transperancy. + * + * Examples: + * 1. image.fade(0, ...) will have no effect on the image. + * 2. image.fade(0.5, ...) will increase the transparency by 50%. + * 3. image.fade(1, ...) will make the image completely transparent. + * + * Note: The transparency is adjusted independently for each pixel. + * + * @param delta By how much to increase / decrease the transperancy. + */ + fade(delta: number, callback: ImageCallback): void; + + /** + * Make image completely opaque. + */ + opacity(callback: ImageCallback): void; + + /** + * Paste an image on top of this image. + * + * Notes: + * 1. If the pasted image exceeds the bounds of the base image, an exception is thrown. + * 2. img is pasted in the state it was at the time image.paste( ... ) was called, eventhough callback is called asynchronously. + * 3. For transparent images, alpha blending is done according to the equations described here. + * 4. Extra caution is required when using this method in batch mode, as the images may change by the time this operation is called. + * + * @param left Coordinates of the left corner of the pasted image. + * @param top Coordinates of the top corner of the pasted image. + * @param img The image to paste. + */ + paste(left: number, top: number, img: Image, callback: ImageCallback): void; + + /** + * Set the color of a pixel. + * + * Notes: + * 1. If the coordinates exceed the bounds of the image, an exception is thrown. + * 2. Extra caution is required when using this method in batch mode, as the dimensions of the image may change by the time this operation is called. + * + * @param left Coordinates of the pixel from the left corner of the image. + * @param top Coordinates of the pixel from the top corner of the image. + * @param color Color of the pixel to set. + */ + setPixel(left: number, top: number, color: Color, callback: ImageCallback): void; + + /** + * Set the metadata in an image. This is currently only supported for PNG files. Sets a tEXt chunk with the key lwip_data and comment as the given string. If called with a null parameter, removes existing metadata from the image, if present. + * @param metadata A string of arbitrary length, or null. + */ + setMetaData(metadata: string): void; + + // Getters + + /** + * Return the image's width in pixels. + */ + width(): number; + + /** + * Return the image's height in pixels. + */ + height(): number; + + /** + * Return the color of the pixel at the (left, top) coordinate. + */ + getPixel(left: number, top: number): ColorObject; + + /** + * Clone the image into a new image object. + * + * Note: The image is cloned to the state it was at the time image.clone( ... ) was called, eventhough callback is called asynchronously. + */ + clone(callback: ImageCallback): void; + + /** + * Copy an area of the image into a new image object. + * + * Note: The sub-image is extracted from the original image in the state it was at the time image.extract( ... ) was called, eventhough callback is called asynchronously. + */ + extract(left: number, top: number, right: number, bottom: number, callback: ImageCallback): void; + + /** + * Get encoded binary image data as a NodeJS Buffer. + * + * When opening an image, it is decoded and stored in memory as an uncompressed image. All manipulations are done on the uncompressed data in memory. This method allows to encode the image to one of the specified formats and get the encoded data as a NodeJS Buffer object. + * + * @param format Encoding format. + */ + toBuffer(format: "jpg", callback: ImageCallback): void; + + /** + * Get encoded binary image data as a NodeJS Buffer. + * + * When opening an image, it is decoded and stored in memory as an uncompressed image. All manipulations are done on the uncompressed data in memory. This method allows to encode the image to one of the specified formats and get the encoded data as a NodeJS Buffer object. + * + * @param format Encoding format. + * @param params Format-specific parameters. + */ + toBuffer(format: "jpg", params: JpegBufferParams, callback: ImageCallback): void; + + /** + * Get encoded binary image data as a NodeJS Buffer. + * + * When opening an image, it is decoded and stored in memory as an uncompressed image. All manipulations are done on the uncompressed data in memory. This method allows to encode the image to one of the specified formats and get the encoded data as a NodeJS Buffer object. + * + * @param format Encoding format. + */ + toBuffer(format: "png", callback: ImageCallback): void; + + /** + * Get encoded binary image data as a NodeJS Buffer. + * + * When opening an image, it is decoded and stored in memory as an uncompressed image. All manipulations are done on the uncompressed data in memory. This method allows to encode the image to one of the specified formats and get the encoded data as a NodeJS Buffer object. + * + * @param format Encoding format. + * @param params Format-specific parameters. + */ + toBuffer(format: "png", params: PngBufferParams, callback: ImageCallback): void; + + /** + * Get encoded binary image data as a NodeJS Buffer. + * + * When opening an image, it is decoded and stored in memory as an uncompressed image. All manipulations are done on the uncompressed data in memory. This method allows to encode the image to one of the specified formats and get the encoded data as a NodeJS Buffer object. + * + * @param format Encoding format. + */ + toBuffer(format: "gif", callback: ImageCallback): void; + + /** + * Get encoded binary image data as a NodeJS Buffer. + * + * When opening an image, it is decoded and stored in memory as an uncompressed image. All manipulations are done on the uncompressed data in memory. This method allows to encode the image to one of the specified formats and get the encoded data as a NodeJS Buffer object. + * + * @param format Encoding format. + * @param params Format-specific parameters. + */ + toBuffer(format: "gif", params: GifBufferParams, callback: ImageCallback): void; + + /** + * Get encoded binary image data as a NodeJS Buffer. + * + * When opening an image, it is decoded and stored in memory as an uncompressed image. All manipulations are done on the uncompressed data in memory. This method allows to encode the image to one of the specified formats and get the encoded data as a NodeJS Buffer object. + * + * @param format Encoding format. + */ + toBuffer(format: string, callback: ImageCallback): void; + + /** + * Get encoded binary image data as a NodeJS Buffer. + * + * When opening an image, it is decoded and stored in memory as an uncompressed image. All manipulations are done on the uncompressed data in memory. This method allows to encode the image to one of the specified formats and get the encoded data as a NodeJS Buffer object. + * + * @param format Encoding format. + * @param params Format-specific parameters. + */ + toBuffer(format: string, params: JpegBufferParams | PngBufferParams | GifBufferParams, callback: ImageCallback): void; + + /** + * Write encoded binary image data directly to a file. + * + * @param path Path of file to write. + */ + writeFile(path: string, callback: ImageCallback): void; + + /** + * Write encoded binary image data directly to a file. + * + * @param path Path of file to write. + * @param params Format-specific parameters. + */ + writeFile(path: string, params: JpegBufferParams | PngBufferParams | GifBufferParams, callback: ImageCallback): void; + + /** + * Write encoded binary image data directly to a file. + * + * @param path Path of file to write. + * @param format Encoding format. + */ + writeFile(path: string, format: "jpg", callback: ImageCallback): void; + + /** + * Write encoded binary image data directly to a file. + * + * @param path Path of file to write. + * @param format Encoding format. + * @param params Format-specific parameters. + */ + writeFile(path: string, format: "jpg", params: JpegBufferParams, callback: ImageCallback): void; + + /** + * Write encoded binary image data directly to a file. + * + * @param path Path of file to write. + * @param format Encoding format. + */ + writeFile(path: string, format: "png", callback: ImageCallback): void; + + /** + * Write encoded binary image data directly to a file. + * + * @param path Path of file to write. + * @param format Encoding format. + * @param params Format-specific parameters. + */ + writeFile(path: string, format: "png", params: PngBufferParams, callback: ImageCallback): void; + + /** + * Write encoded binary image data directly to a file. + * + * @param path Path of file to write. + * @param format Encoding format. + */ + writeFile(path: string, format: "gif", callback: ImageCallback): void; + + /** + * Write encoded binary image data directly to a file. + * + * @param path Path of file to write. + * @param format Encoding format. + * @param params Format-specific parameters. + */ + writeFile(path: string, format: "gif", params: GifBufferParams, callback: ImageCallback): void; + + /** + * Write encoded binary image data directly to a file. + * + * @param path Path of file to write. + * @param format Encoding format. + */ + writeFile(path: string, format: string, callback: ImageCallback): void; + + /** + * Write encoded binary image data directly to a file. + * + * @param path Path of file to write. + * @param format Encoding format. + * @param params Format-specific parameters. + */ + writeFile(path: string, format: string, params: JpegBufferParams | PngBufferParams | GifBufferParams, callback: ImageCallback): void; + + /** + * Get the textual metadata from an image. This is currently only supported for tEXt chunks in PNG images, and will get the first tEXt chunk found with the key lwip_data. If none is found, returns null. + */ + getMetaData(): T; + + // Obtaining a batch object + + /** + * Obtain a batch object from the image + */ + batch(): Batch; + } + + interface Batch { + // Using a batch object + + /** + * Resize + * @param Width in pixels. + */ + resize(width: number): Batch; + + /** + * Resize + * @param Width in pixels. + * @param Interpolation method. + */ + resize(width: number, inter: string): Batch; + + /** + * Resize + * @param Width in pixels. + * @param Height in pixels. + */ + resize(width: number, height: number): Batch; + + /** + * Resize + * @param Width in pixels. + * @param Height in pixels. + * @param Interpolation method. + */ + resize(width: number, height: number, inter: string): Batch; + + /** + * Scale + * @param wRatio Width scale ratio. + */ + scale(wRatio: number): Batch; + + /** + * Scale + * @param wRatio Width scale ratio. + * @param inter Interpolation method. + */ + scale(wRatio: number, inter: string): Batch; + + /** + * Scale + * @param wRatio Width scale ratio. + * @param hRatio Height scale ratio. + */ + scale(wRatio: number, hRatio: number): Batch; + + /** + * Scale + * @param wRatio Width scale ratio. + * @param hRatio Height scale ratio. + * @param inter Interpolation method. + */ + scale(wRatio: number, hRatio: number, inter: string): Batch; + + /** + * Contain the image in a colored canvas. The image will be resized to the largest possible size such that it's fully contained inside the canvas. + * @param width Canvas' width in pixels. + * @param height Canvas' height in pixels. + */ + contain(width: number, height: number): Batch; + + /** + * Contain the image in a colored canvas. The image will be resized to the largest possible size such that it's fully contained inside the canvas. + * @param width Canvas' width in pixels. + * @param height Canvas' height in pixels. + * @param color Color of the canvas. + */ + contain(width: number, height: number, color: Color): Batch; + + /** + * Contain the image in a colored canvas. The image will be resized to the largest possible size such that it's fully contained inside the canvas. + * @param width Canvas' width in pixels. + * @param height Canvas' height in pixels. + * @param inter Interpolation method. + */ + contain(width: number, height: number, inter: string): Batch; + + /** + * Contain the image in a colored canvas. The image will be resized to the largest possible size such that it's fully contained inside the canvas. + * @param width Canvas' width in pixels. + * @param height Canvas' height in pixels. + * @param color Color of the canvas. + * @param inter Interpolation method. + */ + contain(width: number, height: number, color: Color, inter: string): Batch; + + /** + * Cover a canvas with the image. The image will be resized to the smallest possible size such that both its dimensions are bigger than the canvas's dimensions. Margins of the image exceeding the canvas will be discarded. + * @param width Canvas' width in pixels. + * @param height Canvas' height in pixels. + */ + cover(width: number, height: number): Batch; + + /** + * Cover a canvas with the image. The image will be resized to the smallest possible size such that both its dimensions are bigger than the canvas's dimensions. Margins of the image exceeding the canvas will be discarded. + * @param width Canvas' width in pixels. + * @param height Canvas' height in pixels. + * @param inter Interpolation method. + */ + cover(width: number, height: number, inter: string): Batch; + + /** + * Rotate + * @param degs Clockwise rotation degrees. + */ + rotate(degs: number): Batch; + + /** + * Rotate + * @param degs Clockwise rotation degrees. + * @param color Color of the canvas. + */ + rotate(degs: number, color: Color): Batch; + + /** + * Crop with rectangle coordinates + */ + crop(left: number, top: number, right: number, bottom: number): Batch; + + /** + * Crop a rectangle from center + * @param width Width of the rectangle to crop from the center of the image. + * @param height Height of the rectangle to crop from the center of the image. + */ + crop(width: number, height: number): Batch; + + /** + * Gaussian blur. + * @param sigma Standard deviation of the Gaussian filter. + */ + blur(sigma: number): Batch; + + /** + * Inverse diffusion shapren. + * @param amplitude Sharpening amplitude. + */ + sharpen(amplitude: number): Batch; + + /** + * Mirror an image along the 'x' axis, 'y' axis or both. + * @param axes 'x', 'y' or 'xy' (case sensitive). + */ + mirror(axes: string): Batch; + + /** + * Alias of mirror. Mirror an image along the 'x' axis, 'y' axis or both. + * @param axes 'x', 'y' or 'xy' (case sensitive). + */ + flip(axes: string): Batch; + + /** + * Add a colored border to the image. + * @param width Border width in pixels. + */ + border(width: number): Batch; + + /** + * Add a colored border to the image. + * @param width Border width in pixels. + * @param color Color of the border. + */ + border(width: number, color: Color): Batch; + + /** + * Pad image edges with colored pixels. + * @param left Number of pixels to add to left edge. + * @param top Number of pixels to add to top edge. + * @param right Number of pixels to add to right edge. + * @param bottom Number of pixels to add to bottom edge. + */ + pad(left: number, top: number, right: number, bottom: number): Batch; + + /** + * Pad image edges with colored pixels. + * @param left Number of pixels to add to left edge. + * @param top Number of pixels to add to top edge. + * @param right Number of pixels to add to right edge. + * @param bottom Number of pixels to add to bottom edge. + * @param color Color of the padding. + */ + pad(left: number, top: number, right: number, bottom: number, color: Color): Batch; + + /** + * Adjust image saturation. + * + * Examples: + * 1. image.saturate(0, ...) will have no effect on the image. + * 2. image.saturate(0.5, ...) will increase the saturation by 50%. + * 3. image.saturate(-1, ...) will decrease the saturation by 100%, effectively desaturating the image. + * + * @param delta By how much to increase / decrease the saturation. + */ + saturate(delta: number): Batch; + + /** + * Adjust image lightness. + * + * Examples: + * 1. image.lighten(0, ...) will have no effect on the image. + * 2. image.lighten(0.5, ...) will increase the lightness by 50%. + * 3. image.lighten(-1, ...) will decrease the lightness by 100%, effectively making the image black. + * + * @param delta By how much to increase / decrease the lightness. + */ + lighten(delta: number): Batch; + + /** + * Adjust image lightness. Equivalent to image.lighten(-delta, callback). + * @param delta By how much to increase / decrease the lightness. + */ + darken(delta: number): Batch; + + /** + * Adjust image hue. + * + * Examples: + * 1. image.hue(0, ...) will have no effect on the image. + * 2. image.hue(100, ...) will shift pixels' hue by 100 degrees. + * + * Note: The hue is shifted in a circular manner in the range [0,360] for each pixel individually. + * + * @param shift By how many degrees to shift each pixel's hue. + */ + hue(shift: number): Batch; + + /** + * Adjust image transperancy. + * + * Examples: + * 1. image.fade(0, ...) will have no effect on the image. + * 2. image.fade(0.5, ...) will increase the transparency by 50%. + * 3. image.fade(1, ...) will make the image completely transparent. + * + * Note: The transparency is adjusted independently for each pixel. + * + * @param delta By how much to increase / decrease the transperancy. + */ + fade(delta: number): Batch; + + /** + * Make image completely opaque. + */ + opacity(callback: ImageCallback): void; + + /** + * Paste an image on top of this image. + * + * Notes: + * 1. If the pasted image exceeds the bounds of the base image, an exception is thrown. + * 2. img is pasted in the state it was at the time image.paste( ... ) was called, eventhough callback is called asynchronously. + * 3. For transparent images, alpha blending is done according to the equations described here. + * 4. Extra caution is required when using this method in batch mode, as the images may change by the time this operation is called. + * + * @param left Coordinates of the left corner of the pasted image. + * @param top Coordinates of the top corner of the pasted image. + * @param img The image to paste. + */ + paste(left: number, top: number, img: Image): Batch; + + /** + * Set the color of a pixel. + * + * Notes: + * 1. If the coordinates exceed the bounds of the image, an exception is thrown. + * 2. Extra caution is required when using this method in batch mode, as the dimensions of the image may change by the time this operation is called. + * + * @param left Coordinates of the pixel from the left corner of the image. + * @param top Coordinates of the pixel from the top corner of the image. + * @param color Color of the pixel to set. + */ + setPixel(left: number, top: number, color: Color): Batch; + + /** + * Set the metadata in an image. This is currently only supported for PNG files. Sets a tEXt chunk with the key lwip_data and comment as the given string. If called with a null parameter, removes existing metadata from the image, if present. + * @param metadata A string of arbitrary length, or null. + */ + setMetaData(metadata: string): void; + + // Executing a batch + + /** + * Execute batch and obtain the manipulated image object + */ + exec(callback: ImageCallback): void; + + /** + * Execute batch and obtain a Buffer object + * + * When opening an image, it is decoded and stored in memory as an uncompressed image. All manipulations are done on the uncompressed data in memory. This method allows to encode the image to one of the specified formats and get the encoded data as a NodeJS Buffer object. + * + * @param format Encoding format. + */ + toBuffer(format: "jpg", callback: ImageCallback): void; + + /** + * Execute batch and obtain a Buffer object + * + * When opening an image, it is decoded and stored in memory as an uncompressed image. All manipulations are done on the uncompressed data in memory. This method allows to encode the image to one of the specified formats and get the encoded data as a NodeJS Buffer object. + * + * @param format Encoding format. + * @param params Format-specific parameters. + */ + toBuffer(format: "jpg", params: JpegBufferParams, callback: ImageCallback): void; + + /** + * Execute batch and obtain a Buffer object + * + * When opening an image, it is decoded and stored in memory as an uncompressed image. All manipulations are done on the uncompressed data in memory. This method allows to encode the image to one of the specified formats and get the encoded data as a NodeJS Buffer object. + * + * @param format Encoding format. + */ + toBuffer(format: "png", callback: ImageCallback): void; + + /** + * Execute batch and obtain a Buffer object + * + * When opening an image, it is decoded and stored in memory as an uncompressed image. All manipulations are done on the uncompressed data in memory. This method allows to encode the image to one of the specified formats and get the encoded data as a NodeJS Buffer object. + * + * @param format Encoding format. + * @param params Format-specific parameters. + */ + toBuffer(format: "png", params: PngBufferParams, callback: ImageCallback): void; + + /** + * Execute batch and obtain a Buffer object + * + * When opening an image, it is decoded and stored in memory as an uncompressed image. All manipulations are done on the uncompressed data in memory. This method allows to encode the image to one of the specified formats and get the encoded data as a NodeJS Buffer object. + * + * @param format Encoding format. + */ + toBuffer(format: "gif", callback: ImageCallback): void; + + /** + * Execute batch and obtain a Buffer object + * + * When opening an image, it is decoded and stored in memory as an uncompressed image. All manipulations are done on the uncompressed data in memory. This method allows to encode the image to one of the specified formats and get the encoded data as a NodeJS Buffer object. + * + * @param format Encoding format. + * @param params Format-specific parameters. + */ + toBuffer(format: "gif", params: GifBufferParams, callback: ImageCallback): void; + + /** + * Execute batch and obtain a Buffer object + * + * When opening an image, it is decoded and stored in memory as an uncompressed image. All manipulations are done on the uncompressed data in memory. This method allows to encode the image to one of the specified formats and get the encoded data as a NodeJS Buffer object. + * + * @param format Encoding format. + */ + toBuffer(format: string, callback: ImageCallback): void; + + /** + * Execute batch and obtain a Buffer object + * + * When opening an image, it is decoded and stored in memory as an uncompressed image. All manipulations are done on the uncompressed data in memory. This method allows to encode the image to one of the specified formats and get the encoded data as a NodeJS Buffer object. + * + * @param format Encoding format. + * @param params Format-specific parameters. + */ + toBuffer(format: string, params: JpegBufferParams | PngBufferParams | GifBufferParams, callback: ImageCallback): void; + + /** + * Execute batch and write to file + * + * @param path Path of file to write. + */ + writeFile(path: string, callback: ImageCallback): void; + + /** + * Execute batch and write to file + * + * @param path Path of file to write. + * @param params Format-specific parameters. + */ + writeFile(path: string, params: JpegBufferParams | PngBufferParams | GifBufferParams, callback: ImageCallback): void; + + /** + * Execute batch and write to file + * + * @param path Path of file to write. + * @param format Encoding format. + */ + writeFile(path: string, format: "jpg", callback: ImageCallback): void; + + /** + * Execute batch and write to file + * + * @param path Path of file to write. + * @param format Encoding format. + * @param params Format-specific parameters. + */ + writeFile(path: string, format: "jpg", params: JpegBufferParams, callback: ImageCallback): void; + + /** + * Execute batch and write to file + * + * @param path Path of file to write. + * @param format Encoding format. + */ + writeFile(path: string, format: "png", callback: ImageCallback): void; + + /** + * Execute batch and write to file + * + * @param path Path of file to write. + * @param format Encoding format. + * @param params Format-specific parameters. + */ + writeFile(path: string, format: "png", params: PngBufferParams, callback: ImageCallback): void; + + /** + * Execute batch and write to file + * + * @param path Path of file to write. + * @param format Encoding format. + */ + writeFile(path: string, format: "gif", callback: ImageCallback): void; + + /** + * Execute batch and write to file + * + * @param path Path of file to write. + * @param format Encoding format. + * @param params Format-specific parameters. + */ + writeFile(path: string, format: "gif", params: GifBufferParams, callback: ImageCallback): void; + + /** + * Execute batch and write to file + * + * @param path Path of file to write. + * @param format Encoding format. + */ + writeFile(path: string, format: string, callback: ImageCallback): void; + + /** + * Execute batch and write to file + * + * @param path Path of file to write. + * @param format Encoding format. + * @param params Format-specific parameters. + */ + writeFile(path: string, format: string, params: JpegBufferParams | PngBufferParams | GifBufferParams, callback: ImageCallback): void; + } +} From d8bbe9f70d511365dc0df7afda11ed1e1dcbe4ad Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Sat, 21 Nov 2015 20:13:05 +0900 Subject: [PATCH 073/389] Add abs.d.ts --- abs/abs-tests.ts | 5 +++++ abs/abs.d.ts | 14 ++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 abs/abs-tests.ts create mode 100644 abs/abs.d.ts diff --git a/abs/abs-tests.ts b/abs/abs-tests.ts new file mode 100644 index 000000000..80f52f8ff --- /dev/null +++ b/abs/abs-tests.ts @@ -0,0 +1,5 @@ +/// + +import Abs from 'abs'; + +const x: string = Abs('/foo'); diff --git a/abs/abs.d.ts b/abs/abs.d.ts new file mode 100644 index 000000000..58a533528 --- /dev/null +++ b/abs/abs.d.ts @@ -0,0 +1,14 @@ +// Type definitions for abs 1.1.0 +// Project: https://github.com/IonicaBizau/node-abs +// Definitions by: Aya Morisawa +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module "abs" { + /** + * Compute the absolute path of an input. + * @param input The input path. + */ + function Abs(input: string): string; + + export default Abs; +} From 510afdf330a4340cdf279a03d363ecaf0c4e708d Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Sat, 21 Nov 2015 20:26:06 +0900 Subject: [PATCH 074/389] Add absolute.d.ts --- absolute/absolute-tests.ts | 5 +++++ absolute/absolute.d.ts | 13 +++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 absolute/absolute-tests.ts create mode 100644 absolute/absolute.d.ts diff --git a/absolute/absolute-tests.ts b/absolute/absolute-tests.ts new file mode 100644 index 000000000..5c2514450 --- /dev/null +++ b/absolute/absolute-tests.ts @@ -0,0 +1,5 @@ +/// + +import absolute from 'absolute'; + +const x: boolean = absolute('/home/foo'); diff --git a/absolute/absolute.d.ts b/absolute/absolute.d.ts new file mode 100644 index 000000000..c0e8e9bd6 --- /dev/null +++ b/absolute/absolute.d.ts @@ -0,0 +1,13 @@ +// Type definitions for absolute 0.0.1 +// Project: https://github.com/bahamas10/node-absolute +// Definitions by: Aya Morisawa +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module "absolute" { + /** + * Test if a path is absolute + */ + function absolute(path: string): boolean; + + export default absolute; +} From aba0a7b4491a9ef43cf81c6f73fa53999fdda086 Mon Sep 17 00:00:00 2001 From: heycalmdown Date: Sat, 21 Nov 2015 23:03:37 +0900 Subject: [PATCH 075/389] blurbird) resolve should be able to omit the result when using new Promise() --- bluebird/bluebird.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bluebird/bluebird.d.ts b/bluebird/bluebird.d.ts index 9f36cf5bc..249f51726 100644 --- a/bluebird/bluebird.d.ts +++ b/bluebird/bluebird.d.ts @@ -20,14 +20,14 @@ declare class Promise implements Promise.Thenable, Promise.Inspection { /** * Create a new promise. The passed in function will receive functions `resolve` and `reject` as its arguments which can be called to seal the fate of the created promise. */ - constructor(callback: (resolve: (thenableOrResult: R | Promise.Thenable) => void, reject: (error: any) => void) => void); + constructor(callback: (resolve: (thenableOrResult?: R | Promise.Thenable) => void, reject: (error: any) => void) => void); /** * Promises/A+ `.then()` with progress handler. Returns a new promise chained from this promise. The new promise will be rejected or resolved dedefer on the passed `fulfilledHandler`, `rejectedHandler` and the state of this promise. */ then(onFulfill: (value: R) => U|Promise.Thenable, onReject?: (error: any) => U|Promise.Thenable, onProgress?: (note: any) => any): Promise; then(onFulfill: (value: R) => U|Promise.Thenable, onReject?: (error: any) => void|Promise.Thenable, onProgress?: (note: any) => any): Promise; - + /** * This is a catch-all exception handler, shortcut for calling `.then(null, handler)` on this promise. Any exception happening in a `.then`-chain will propagate to nearest `.catch` handler. * From f2841e566023a683b7e3e8bb2d7f58e39416c2c7 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Sat, 21 Nov 2015 20:30:33 +0500 Subject: [PATCH 076/389] lodash: signatures of _.keysIn have been changed --- lodash/lodash-tests.ts | 24 ++++++++++++++++++++++-- lodash/lodash.d.ts | 18 +++++++++++++++--- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 6d047d3d0..97d12d446 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6302,8 +6302,28 @@ module TestKeys { } } -result = _.keysIn({ 'one': 1, 'two': 2, 'three': 3 }); -result = _({ 'one': 1, 'two': 2, 'three': 3 }).keysIn().value(); +// _.keysIn +module TestKeysIn { + let object: _.Dictionary; + + { + let result: string[]; + + result = _.keysIn(object); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(object).keysIn(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(object).chain().keysIn(); + } +} // _.mapKeys module TestMapKeys { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index e4e027fba..7b72401f5 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -10745,6 +10745,8 @@ declare module _ { /** * Creates an array of the own enumerable property names of object. * + * Note: Non-object values are coerced to objects. See the ES spec for more details. + * * @param object The object to query. * @return Returns the array of property names. */ @@ -10769,17 +10771,27 @@ declare module _ { interface LoDashStatic { /** * Creates an array of the own and inherited enumerable property names of object. + * + * Note: Non-object values are coerced to objects. + * * @param object The object to query. * @return An array of property names. - **/ + */ keysIn(object?: any): string[]; } interface LoDashImplicitObjectWrapper { /** * @see _.keysIn - **/ - keysIn(): LoDashImplicitArrayWrapper + */ + keysIn(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.keysIn + */ + keysIn(): LoDashExplicitArrayWrapper; } //_.mapKeys From 02dafd4d5cebf23d350edf22bb9bde6b5a1547e5 Mon Sep 17 00:00:00 2001 From: Tom Grooffer Date: Sun, 22 Nov 2015 02:57:03 +0100 Subject: [PATCH 077/389] Update express-handlebars.d.ts https://github.com/ericf/express-handlebars see "partialsDir" option can be an array with string or objects, so this should be any. --- express-handlebars/express-handlebars.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/express-handlebars/express-handlebars.d.ts b/express-handlebars/express-handlebars.d.ts index 6ed538c21..04eb07162 100644 --- a/express-handlebars/express-handlebars.d.ts +++ b/express-handlebars/express-handlebars.d.ts @@ -21,7 +21,7 @@ interface ExphbsOptions { handlebars?: any; extname?: string; layoutsDir?: string; - partialsDir?: string; + partialsDir?: any; defaultLayout?: string; helpers?: any; compilerOptions?: any; From dd8d66353d662048c60cea33aff8c5506dc635ae Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Sun, 22 Nov 2015 13:45:55 +0900 Subject: [PATCH 078/389] Add mongoose-auto-increment.d.ts --- .../mongoose-auto-increment-tests.ts | 20 +++++++++++++++++++ .../mongoose-auto-increment.d.ts | 20 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 mongoose-auto-increment/mongoose-auto-increment-tests.ts create mode 100644 mongoose-auto-increment/mongoose-auto-increment.d.ts diff --git a/mongoose-auto-increment/mongoose-auto-increment-tests.ts b/mongoose-auto-increment/mongoose-auto-increment-tests.ts new file mode 100644 index 000000000..fbd2ef68a --- /dev/null +++ b/mongoose-auto-increment/mongoose-auto-increment-tests.ts @@ -0,0 +1,20 @@ +/// +/// + +import * as autoIncrement from 'mongoose-auto-increment'; +import * as mongoose from 'mongoose'; +import { Schema } from 'mongoose'; + +var connection = mongoose.createConnection("mongodb://localhost/myDatabase"); + +autoIncrement.initialize(connection); + +var bookSchema = new Schema({ + author: { type: Schema.Types.ObjectId, ref: 'Author' }, + title: String, + genre: String, + publishDate: Date +}); + +bookSchema.plugin(autoIncrement.plugin, 'Book'); +var Book = connection.model('Book', bookSchema); diff --git a/mongoose-auto-increment/mongoose-auto-increment.d.ts b/mongoose-auto-increment/mongoose-auto-increment.d.ts new file mode 100644 index 000000000..34e7b5ddd --- /dev/null +++ b/mongoose-auto-increment/mongoose-auto-increment.d.ts @@ -0,0 +1,20 @@ +// Type definitions for mongoose-auto-increment 5.0.1 +// Project: https://github.com/codetunnel/mongoose-auto-increment +// Definitions by: Aya Morisawa +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module 'mongoose-auto-increment' { + import { Connection, Schema, Mongoose } from 'mongoose'; + + /** + * Initialize plugin by creating counter collection in database. + */ + function initialize(connection: Connection): void; + + /** + * The function to use when invoking the plugin on a custom schema. + */ + function plugin(schema: Schema, options: Object): void; +} From a8a7d043c811b3ab48ff0ec0734f2759924d2dad Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Sun, 22 Nov 2015 14:19:12 +0900 Subject: [PATCH 079/389] Add mongoose-deep-populate.d.ts --- .../mongoose-deep-populate-tests.ts | 19 +++++++++++++++++++ .../mongoose-deep-populate.d.ts | 12 ++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 mongoose-deep-populate/mongoose-deep-populate-tests.ts create mode 100644 mongoose-deep-populate/mongoose-deep-populate.d.ts diff --git a/mongoose-deep-populate/mongoose-deep-populate-tests.ts b/mongoose-deep-populate/mongoose-deep-populate-tests.ts new file mode 100644 index 000000000..d85a854a9 --- /dev/null +++ b/mongoose-deep-populate/mongoose-deep-populate-tests.ts @@ -0,0 +1,19 @@ +/// +/// + +import mongooseDeepPopulate from 'mongoose-deep-populate'; +import * as mongoose from 'mongoose'; +import { Schema } from 'mongoose'; + +var connection = mongoose.connect("mongodb://localhost/myDatabase"); + +var deepPopulate = mongooseDeepPopulate(connection); + +var bookSchema = new Schema({ + author: { type: Schema.Types.ObjectId, ref: 'Author' }, + title: String, + genre: String, + publishDate: Date +}); + +bookSchema.plugin(deepPopulate, {}); diff --git a/mongoose-deep-populate/mongoose-deep-populate.d.ts b/mongoose-deep-populate/mongoose-deep-populate.d.ts new file mode 100644 index 000000000..247ba6b48 --- /dev/null +++ b/mongoose-deep-populate/mongoose-deep-populate.d.ts @@ -0,0 +1,12 @@ +// Type definitions for mongoose-deep-populate 2.0.3 +// Project: https://github.com/buunguyen/mongoose-deep-populate +// Definitions by: Aya Morisawa +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "mongoose-deep-populate" { + import { Mongoose, Schema } from 'mongoose'; + + export default function(mognoose: Mongoose): (schema: Schema, options: Object) => void; +} From 5d3d40c9b628e014cc41d36cc40f5d8a0b02e754 Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Sun, 22 Nov 2015 16:18:11 +0900 Subject: [PATCH 080/389] Add complex.d.ts --- complex/complex-tests.ts | 44 ++++++++ complex/complex.d.ts | 238 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 282 insertions(+) create mode 100644 complex/complex-tests.ts create mode 100644 complex/complex.d.ts diff --git a/complex/complex-tests.ts b/complex/complex-tests.ts new file mode 100644 index 000000000..46a5f5c69 --- /dev/null +++ b/complex/complex-tests.ts @@ -0,0 +1,44 @@ +/// + +import Complex from 'complex'; + +var z: Complex = new Complex(2, 3); +var z: Complex = Complex.from(2, 3); +var z: Complex = Complex.from(2, 4); +var z: Complex = Complex.from(5); +var z: Complex = Complex.from('2+5i'); +var z: Complex = Complex.fromPolar(3, Math.PI); +var z: Complex = Complex.i; +var z: Complex = Complex.one; +var z: Complex = z.fromRect(2, 3); +var z: Complex = z.fromPolar(3, Math.PI); +var z: Complex = z.toPrecision(3); +var z: Complex = z.toFixed(3); +var z: Complex = z.finalize(); +var x: number = z.magnitude(); +var x: number = z.abs(); +var x: number = z.angle(); +var x: number = z.arg(); +var x: number = z.phase(); +var z: Complex = z.conjugate(); +var z: Complex = z.negate(); +var z: Complex = z.multiply(z); +var z: Complex = z.mult(3); +var z: Complex = z.divide(z); +var z: Complex = z.div(3); +var z: Complex = z.add(z); +var z: Complex = z.subtract(z); +var z: Complex = z.sub(3); +var z: Complex = z.pow(z); +var z: Complex = z.sqrt(); +var z: Complex = z.log(2); +var z: Complex = z.exp(); +var z: Complex = z.sin(); +var z: Complex = z.cos(); +var z: Complex = z.tan(); +var z: Complex = z.sinh(); +var z: Complex = z.cosh(); +var z: Complex = z.tanh(); +var z: Complex = z.clone(); +var s: string = z.toString(); +var b: boolean = z.equals(z); diff --git a/complex/complex.d.ts b/complex/complex.d.ts new file mode 100644 index 000000000..b1ca7c4ac --- /dev/null +++ b/complex/complex.d.ts @@ -0,0 +1,238 @@ +// Type definitions for Complex 3.0.1 +// Project: https://github.com/arian/Complex +// Definitions by: Aya Morisawa +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module 'complex' { + export default class Complex { + /** + * @param real The real part of the number + * @param im The imaginary part of the number + */ + constructor(real: number, im: number); + + /** + * A in line function like Number.from. + * + * Examples: + * var z = Complex.from(2, 4); + * var z = Complex.from(5); + * var z = Complex.from('2+5i'); + * + * @param real A string representation of the number, for example 1+4i + */ + static from(real: string): Complex; + + /** + * A in line function like Number.from. + * @param real The real part of the number + * @param im The imaginary part of the number + */ + static from(real: number, im?: number): Complex; + + /** + * Creates a complex instance from a polar representation + * @param r The radius/magnitude of the number + * @param phi The angle/phase of the number + */ + static fromPolar(r: number, phi: number): Complex; + + /** + * A instance of the imaginary unit + */ + static i: Complex; + + /** + * A instance for the real number + */ + static one: Complex; + + /** + * Set the real and imaginary properties a and b from a + bi. + * @param real The real part of the number + * @param im The imaginary part of the number + */ + fromRect(real: number, im: number): Complex; + + /** + * Set the a and b in a + bi from a polar representation. + * @param r The radius/magnitude of the number + * @param phi The angle/phase of the number + */ + fromPolar(r: number, phi: number): Complex; + + /** + * Set the precision of the numbers. Similar to Number.prototype.toPrecision. Useful before printing the number with the toString method. + * @param k An integer specifying the number of significant digits + */ + toPrecision(k: number): Complex; + + /** + * Format a number using fixed-point notation. Similar to Number.prototype.toFixed. Useful before printing the number with the toString method. + * @param k The number of digits to appear after the decimal point; this may be a value between 0 and 20, inclusive, and implementations may optionally support a larger range of values. If this argument is omitted, it is treated as 0. + */ + toFixed(k: number): Complex; + + /** + * Finalize the instance. The number will not change and any other method call will return a new instance. Very useful when a complex instance should stay constant. For example the Complex.i variable is a finalized instance. + */ + finalize(): Complex; + + /** + * Calculate the magnitude of the complex number + */ + magnitude(): number; + + /** + * Alias for magnitude(). Calculate the magnitude of the complex number. + */ + abs(): number; + + /** + * Calculate the angle with respect to the real axis, in radians. + */ + angle(): number; + + /** + * Alias for angle(). Calculate the angle with respect to the real axis, in radians. + */ + arg(): number; + + /** + * Alias for angle(). Calculate the angle with respect to the real axis, in radians. + */ + phase(): number; + + /** + * Calculate the conjugate of the complex number (multiplies the imaginary part with -1) + */ + conjugate(): Complex; + + /** + * Negate the number (multiplies both the real and imaginary part with -1) + */ + negate(): Complex; + + /** + * Multiply the number with a real or complex number + * @param z The number to multiply with + */ + multiply(z: number | Complex): Complex; + + /** + * Alias for multiply(). Multiply the number with a real or complex number + * @param z The number to multiply with + */ + mult(z: number | Complex): Complex; + + /** + * Divide the number by a real or complex number + * @param z The number to divide by + */ + divide(z: number | Complex): Complex; + + /** + * Alias for divide(). Divide the number by a real or complex number + * @param z The number to divide by + */ + div(z: number | Complex): Complex; + + /** + * Add a real or complex number + * @param z The number to add + */ + add(z: number | Complex): Complex; + + /** + * Subtract a real or complex number + * @param z The number to subtract + */ + subtract(z: number | Complex): Complex; + + /** + * Alias for subtract(). Subtract a real or complex number + * @param z The number to subtract + */ + sub(z: number | Complex): Complex; + + /** + * Return the base to the exponent + * @param z The exponent + */ + pow(z: number | Complex): Complex; + + /** + * Return the square root + */ + sqrt(): Complex; + + /** + * Return the natural logarithm (base E) + * @param k The actual answer has a multiplicity (ln(z) = ln|z| + arg(z)) where arg(z) can return the same for different angles (every 2*pi), with this argument you can define which answer is required + */ + log(k?: number): Complex; + + /** + * Calculate the e^z where the base is E and the exponential the complex number. + */ + exp(): Complex; + + /** + * Calculate the sine of the complex number + */ + sin(): Complex; + + /** + * Calculate the cosine of the complex number + */ + cos(): Complex; + + /** + * Calculate the tangent of the complex number + */ + tan(): Complex; + + /** + * Calculate the hyperbolic sine of the complex number + */ + sinh(): Complex + + /** + * Calculate the hyperbolic cosine of the complex number + */ + cosh(): Complex + + /** + * Calculate the hyperbolic tangent of the complex number + */ + tanh(): Complex + + /** + * Return a new Complex instance with the same real and imaginary properties + */ + clone(): Complex; + + /** + * Return a string representation of the complex number + * + * Examples: + * new Complex(1, 2).toString(); // 1+2i + * new Complex(0, 1).toString(); // i + * new Complex(4, 0).toString(); // 4 + * new Complex(1, 1).toString(); // 1+i + * 'my Complex Number is: ' + (new Complex(3, 5)); // 'my Complex Number is: 3+5i + */ + toString(): string; + + /** + * Check if the real and imaginary components are equal to the passed in compelex components. + * + * Examples: + * new Complex(1, 4).equals(new Complex(1, 4)); // true + * new Complex(1, 4).equals(new Complex(1, 3)); // false + * + * @param z The complex number to compare with + */ + equals(z: number | Complex): boolean; + } +} From 12c6eec04b615c5edfa8e4cf3ddbed7b60046e94 Mon Sep 17 00:00:00 2001 From: bgrieder Date: Sun, 22 Nov 2015 09:58:22 +0100 Subject: [PATCH 081/389] Improvements to Events System + PanResponder + PushNotificationIOS + StatusBarIOS + VibrationIOS --- react-native/react-native-tests.tsx | 8 +- react-native/react-native.d.ts | 375 ++++++++++++++++++++-------- 2 files changed, 265 insertions(+), 118 deletions(-) diff --git a/react-native/react-native-tests.tsx b/react-native/react-native-tests.tsx index 2783ebeb0..f2e4cc22f 100644 --- a/react-native/react-native-tests.tsx +++ b/react-native/react-native-tests.tsx @@ -3,10 +3,8 @@ Note: This must be compiled with the target set to ES6 - The content of index.io.js could be something like - 'use strict'; import { AppRegistry } from 'react-native' @@ -15,11 +13,7 @@ The content of index.io.js could be something like AppRegistry.registerComponent('MopNative', () => Welcome); - - -NOTE: I (Bruno Grieder) complete these definitions as I port the UI Explorer to Typescript -If you are in a hurry for the latest definitions, or are looking for typescript examples, -check https://github.com/bgrieder/RNTSExplorer +For a list of complete Typescript examples: check https://github.com/bgrieder/RNTSExplorer */ diff --git a/react-native/react-native.d.ts b/react-native/react-native.d.ts index 60f8afd1a..dacfbc7f0 100644 --- a/react-native/react-native.d.ts +++ b/react-native/react-native.d.ts @@ -7,15 +7,12 @@ // // These definitions are meant to be used with the TSC compiler target set to ES6 // +// These definitions have been mostly completed by porting to Typescript +// the UI Explorer which comes with the react-native distribution +// Check: https://github.com/bgrieder/RNTSExplorer +// // This work is based on an original work made by Bernd Paradies: https://github.com/bparadie // -// WARNING: this work is very much beta: -// -it is still missing react-native definitions (see below) -// -it re-exports the whole of react 0.14 which may not be what react-native actually does -// -// I (Bruno Grieder) complete these definitions as I port the UI Explorer to Typescript -// If you are in a hurry for the latest definitions, check those in https://github.com/bgrieder/RNTSExplorer -// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// @@ -47,7 +44,7 @@ declare namespace ReactNative { // not in lib.es6.d.ts but called by react-native - done(callback?: (value: T) => void): void; + done( callback?: ( value: T ) => void ): void; } export interface PromiseConstructor { @@ -135,6 +132,73 @@ declare namespace ReactNative { export type Runnable = ( appParameters: any ) => void; + // Similar to React.SyntheticEvent except for nativeEvent + interface NativeSyntheticEvent { + bubbles: boolean + cancelable: boolean + currentTarget: EventTarget + defaultPrevented: boolean + eventPhase: number + isTrusted: boolean + nativeEvent: T + preventDefault(): void + stopPropagation(): void + target: EventTarget + timeStamp: Date + type: string + } + + export interface NativeTouchEvent { + /** + * Array of all touch events that have changed since the last event + */ + changedTouches: NativeTouchEvent[] + + /** + * The ID of the touch + */ + identifier: string + + /** + * The X position of the touch, relative to the element + */ + locationX: number + + /** + * The Y position of the touch, relative to the element + */ + locationY: number + + /** + * The X position of the touch, relative to the screen + */ + pageX: number + + /** + * The Y position of the touch, relative to the screen + */ + pageY: number + + /** + * The node id of the element receiving the touch event + */ + target: string + + /** + * A time identifier for the touch, useful for velocity calculation + */ + timestamp: number + + /** + * Array of all current touches on the screen + */ + touches : NativeTouchEvent[] + } + + export interface GestureResponderEvent extends NativeSyntheticEvent { + } + + export interface PointProperties { x: number y: number @@ -147,8 +211,23 @@ declare namespace ReactNative { right?: number } + /** + * //FIXME: need to find documentation on which compoenent is a native (i.e. non composite component) + */ export interface NativeComponent { - setNativeProps: (props: Object) => void + setNativeProps: ( props: Object ) => void + } + + /** + * //FIXME: need to find documentation on which component is a TTouchable and can implement that interface + * @see React.DOMAtributes + */ + export interface Touchable { + onTouchStart?: ( event: GestureResponderEvent ) => void + onTouchMove?: ( event: GestureResponderEvent ) => void + onTouchEnd?: ( event: GestureResponderEvent ) => void + onTouchCancel?: ( event: GestureResponderEvent ) => void + onTouchEndCapture?: ( event: GestureResponderEvent ) => void } export type AppConfig = { @@ -583,55 +662,6 @@ declare namespace ReactNative { } - export interface GestureResponderEvent { - nativeEvent : { - /** - * Array of all touch events that have changed since the last event - */ - changedTouches: any[] - - /** - * The ID of the touch - */ - identifier: string - - /** - * The X position of the touch, relative to the element - */ - locationX: number - - /** - * The Y position of the touch, relative to the element - */ - locationY: number - - /** - * The X position of the touch, relative to the screen - */ - pageX: number - - /** - * The Y position of the touch, relative to the screen - */ - pageY: number - - /** - * The node id of the element receiving the touch event - */ - target: string - - /** - * A time identifier for the touch, useful for velocity calculation - */ - timestamp: number - - /** - * Array of all current touches on the screen - */ - touches : any[] - } - } - /** * Gesture recognition on mobile devices is much more complicated than web. * A touch can go through several phases as the app determines what the user's intention is. @@ -667,12 +697,12 @@ declare namespace ReactNative { /** * Does this view want to become responder on the start of a touch? */ - onStartShouldSetResponder?: (event: GestureResponderEvent) => boolean + onStartShouldSetResponder?: ( event: GestureResponderEvent ) => boolean /** * Called for every touch move on the View when it is not the responder: does this view want to "claim" touch responsiveness? */ - onMoveShouldSetResponder?: (event: GestureResponderEvent) => boolean + onMoveShouldSetResponder?: ( event: GestureResponderEvent ) => boolean /** * If the View returns true and attempts to become the responder, one of the following will happen: @@ -682,12 +712,12 @@ declare namespace ReactNative { * The View is now responding for touch events. * This is the time to highlight and show the user what is happening */ - onResponderGrant?: (event: GestureResponderEvent) => void + onResponderGrant?: ( event: GestureResponderEvent ) => void /** * Something else is the responder right now and will not release it */ - onResponderReject?: (event: GestureResponderEvent) => void + onResponderReject?: ( event: GestureResponderEvent ) => void /** * If the view is responding, the following handlers can be called: @@ -696,25 +726,25 @@ declare namespace ReactNative { /** * The user is moving their finger */ - onResponderMove?: (event: GestureResponderEvent) => void + onResponderMove?: ( event: GestureResponderEvent ) => void /** * Fired at the end of the touch, ie "touchUp" */ - onResponderRelease?: (event: GestureResponderEvent) => void + onResponderRelease?: ( event: GestureResponderEvent ) => void /** * Something else wants to become responder. * Should this view release the responder? Returning true allows release */ - onResponderTerminationRequest?: (event: GestureResponderEvent) => boolean + onResponderTerminationRequest?: ( event: GestureResponderEvent ) => boolean /** * The responder has been taken from the View. * Might be taken by other views after a call to onResponderTerminationRequest, * or might be taken by the OS without asking (happens with control center/ notification center on iOS) */ - onResponderTerminate?: (event: GestureResponderEvent) => void + onResponderTerminate?: ( event: GestureResponderEvent ) => void /** * onStartShouldSetResponder and onMoveShouldSetResponder are called with a bubbling pattern, @@ -729,7 +759,7 @@ declare namespace ReactNative { * So if a parent View wants to prevent the child from becoming responder on a touch start, * it should have a onStartShouldSetResponderCapture handler which returns true. */ - onStartShouldSetResponderCapture?: (event: GestureResponderEvent) => boolean + onStartShouldSetResponderCapture?: ( event: GestureResponderEvent ) => boolean /** * onStartShouldSetResponder and onMoveShouldSetResponder are called with a bubbling pattern, @@ -864,7 +894,7 @@ declare namespace ReactNative { /** * @see https://facebook.github.io/react-native/docs/view.html#props */ - export interface ViewProperties extends ViewPropertiesAndroid, ViewPropertiesIOS, GestureResponderHandlers, React.Props { + export interface ViewProperties extends ViewPropertiesAndroid, ViewPropertiesIOS, GestureResponderHandlers, Touchable, React.Props { /** * Overrides the text that's read by the screen reader when the user interacts with the element. By default, the label is constructed by traversing all the children and accumulating all the Text nodes separated by space. @@ -1680,7 +1710,7 @@ declare namespace ReactNative { showsPointsOfInterest?: boolean } - export interface MapViewProperties extends MapViewPropertiesIOS, React.Props { + export interface MapViewProperties extends MapViewPropertiesIOS, Touchable, React.Props { /** * Map annotations with title/subtitle. @@ -2423,7 +2453,6 @@ declare namespace ReactNative { } - export interface PixelRatioStatic { get(): number; } @@ -2632,7 +2661,7 @@ declare namespace ReactNative { zoomScale?: number } - export interface ScrollViewProperties extends ScrollViewIOSProperties { + export interface ScrollViewProperties extends ScrollViewIOSProperties, Touchable { /** * These styles will be applied to the scroll view content container which @@ -2962,13 +2991,13 @@ declare namespace ReactNative { * eventName is expected to be `change` * //FIXME: No doc - inferred from NetInfo.js */ - addEventListener: (eventName: string, listener: (result: T) => void) => void + addEventListener: ( eventName: string, listener: ( result: T ) => void ) => void /** * eventName is expected to be `change` * //FIXME: No doc - inferred from NetInfo.js */ - removeEventListener: (eventName: string, listener: (result: T) => void) => void + removeEventListener: ( eventName: string, listener: ( result: T ) => void ) => void } /** @@ -2996,30 +3025,6 @@ declare namespace ReactNative { isConnectionMetered: any } - /** - * //FIXME: Documentation ? - */ - export interface PanResponderEvent { - - bubbles: boolean - cancelable: boolean - currentTarget: number - defaultPrevented: boolean - dispatchConfig: any - dispatchMarker: any - eventPhase: any - isDefaultPrevented: () => boolean - isPropagationStopped: () => boolean - isTrusted: boolean - nativeEvent: GestureResponderEvent - path: any - target: number - timeStamp: number - touchHistory: any[] - type: any - - } - export interface PanResponderGestureState { @@ -3083,19 +3088,19 @@ declare namespace ReactNative { * @see documentation of GestureResponderHandlers */ export interface PanResponderCallbacks { - onMoveShouldSetPanResponder?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => boolean - onStartShouldSetPanResponder?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => void - onPanResponderGrant?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => void - onPanResponderMove?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => void - onPanResponderRelease?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => void - onPanResponderTerminate?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => void + onMoveShouldSetPanResponder?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => boolean + onStartShouldSetPanResponder?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => void + onPanResponderGrant?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => void + onPanResponderMove?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => void + onPanResponderRelease?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => void + onPanResponderTerminate?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => void - onMoveShouldSetPanResponderCapture?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => boolean - onStartShouldSetPanResponderCapture?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => boolean - onPanResponderReject?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => void - onPanResponderStart?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => void - onPanResponderEnd?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => void - onPanResponderTerminationRequest?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => boolean + onMoveShouldSetPanResponderCapture?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => boolean + onStartShouldSetPanResponderCapture?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => boolean + onPanResponderReject?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => void + onPanResponderStart?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => void + onPanResponderEnd?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => void + onPanResponderTerminationRequest?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => boolean } export interface PanResponderInstance { @@ -3145,7 +3150,143 @@ declare namespace ReactNative { create( config: PanResponderCallbacks ): PanResponderInstance } + export interface PushNotificationPermissions { + alert?: boolean + badge?: boolean + sound?: boolean + } + export interface PushNotification { + + + /** + * An alias for `getAlert` to get the notification's main message string + */ + getMessage(): string | Object + + /** + * Gets the sound string from the `aps` object + */ + getSound(): string + + /** + * Gets the notification's main message from the `aps` object + */ + getAlert(): string | Object + + /** + * Gets the badge count number from the `aps` object + */ + getBadgeCount(): number + + /** + * Gets the data object on the notif + */ + getData(): Object + + } + + + /** + * Handle push notifications for your app, including permission handling and icon badge number. + * @see https://facebook.github.io/react-native/docs/pushnotificationios.html#content + * + * //FIXME: BGR: The documentation seems completely off compared to the actual js implementation. I could never get the example to run + */ + export interface PushNotificationIOSStatic { + + /** + * Sets the badge number for the app icon on the home screen + */ + setApplicationIconBadgeNumber( number: number ): void + + /** + * Gets the current badge number for the app icon on the home screen + */ + getApplicationIconBadgeNumber( callback: ( badge: number ) => void ): void + + /** + * Attaches a listener to remote notifications while the app is running in the + * foreground or the background. + * + * The handler will get be invoked with an instance of `PushNotificationIOS` + * + * The type MUST be 'notification' + */ + addEventListener( type: string, handler: ( notification: PushNotification ) => void ):void + + /** + * Requests all notification permissions from iOS, prompting the user's + * dialog box. + */ + requestPermissions(): void + + /** + * See what push permissions are currently enabled. `callback` will be + * invoked with a `permissions` object: + * + * - `alert` :boolean + * - `badge` :boolean + * - `sound` :boolean + */ + checkPermissions( callback: ( permissions: PushNotificationPermissions ) => void ): void + + /** + * Removes the event listener. Do this in `componentWillUnmount` to prevent + * memory leaks + */ + removeEventListener( type: string, handler: ( notification: PushNotification ) => void ): void + + /** + * An initial notification will be available if the app was cold-launched + * from a notification. + * + * The first caller of `popInitialNotification` will get the initial + * notification object, or `null`. Subsequent invocations will return null. + */ + popInitialNotification(): PushNotification + } + + + /** + * @enum('default', 'light-content') + */ + export type StatusBarStyle = string + + /** + * @enum('none','fade', 'slide') + */ + type StatusBarAnimation = string + + + /** + * //FIXME: No documentation is available (although this is self explanatory) + * + * @see https://facebook.github.io/react-native/docs/statusbarios.html#content + */ + export interface StatusBarIOSStatic { + + setStyle(style: StatusBarStyle, animated?: boolean): void + + setHidden(hidden: boolean, animation?: StatusBarAnimation): void + + setNetworkActivityIndicatorVisible(visible: boolean): void + } + + /** + * The Vibration API is exposed at VibrationIOS.vibrate(). + * On iOS, calling this function will trigger a one second vibration. + * The vibration is asynchronous so this method will return immediately. + * + * There will be no effect on devices that do not support Vibration, eg. the iOS simulator. + * + * Vibration patterns are currently unsupported. + * + * @see https://facebook.github.io/react-native/docs/vibrationios.html#content + */ + export interface VibrationIOSStatic { + vibrate(): void + } ////////////////////////////////////////////////////////////////////////// // @@ -3248,6 +3389,20 @@ declare namespace ReactNative { export var PanResponder: PanResponderStatic export type PanResponder = PanResponderStatic + export var PushNotificationIOS: PushNotificationIOSStatic + export type PushNotificationIOS = PushNotificationIOSStatic + + export var StatusBarIOS: StatusBarIOSStatic + export type StatusBarIOS = StatusBarIOSStatic + + export var VibrationIOS: VibrationIOSStatic + export type VibrationIOS = VibrationIOSStatic + + + // + // /TODO: BGR: These are leftovers of the initial port that must be revisited + // + export var SegmentedControlIOS: React.ComponentClass export var PixelRatio: PixelRatioStatic @@ -3257,8 +3412,6 @@ declare namespace ReactNative { export var InteractionManager: InteractionManagerStatic - - ////////////////////////////////////////////////////////////////////////// // // R E A C T - 0 . 1 4 From ba131000c0977b35d566788cdeaa7da323a0d30d Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Sun, 22 Nov 2015 20:47:52 +0900 Subject: [PATCH 082/389] Add gulp-babel.d.ts --- gulp-babel/gulp-babel-tests.ts | 7 +++++++ gulp-babel/gulp-babel.d.ts | 38 ++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 gulp-babel/gulp-babel-tests.ts create mode 100644 gulp-babel/gulp-babel.d.ts diff --git a/gulp-babel/gulp-babel-tests.ts b/gulp-babel/gulp-babel-tests.ts new file mode 100644 index 000000000..75175cf6f --- /dev/null +++ b/gulp-babel/gulp-babel-tests.ts @@ -0,0 +1,7 @@ +/// +/// + +import babel from 'gulp-babel'; + +var x: NodeJS.ReadWriteStream = babel(); +var x: NodeJS.ReadWriteStream = babel({}); diff --git a/gulp-babel/gulp-babel.d.ts b/gulp-babel/gulp-babel.d.ts new file mode 100644 index 000000000..36846cac4 --- /dev/null +++ b/gulp-babel/gulp-babel.d.ts @@ -0,0 +1,38 @@ +// Type definitions for gulp-babel 6.1.0 +// Project: https://github.com/babel/gulp-babel +// Definitions by: Aya Morisawa +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module 'gulp-babel' { + export default function(options?: { + filename?: string, + filenameRelative?: string, + presets?: string[], + plugins?: string[], + highlightCode?: boolean, + only?: string | string[], + ignore?: string | string[], + auxiliaryCommentBefore?: any, + auxiliaryCommentAfter?: any, + sourceMaps?: any, + inputSourceMap?: any, + sourceMapTarget?: any, + sourceFileName?: any, + sourceRoot?: any, + moduleRoot?: any, + moduleIds?: any, + moduleId?: any, + getModuleId?: any, + resolveModuleSource?: any, + keepModuleIdExtesions?: boolean, + code?: boolean, + ast?: boolean, + compact?: any, + comments?: boolean, + shouldPrintComment?: any, + env?: any, + retainLines?: boolean + }): NodeJS.ReadWriteStream; +} From 999fdb400c617d5a0cbef5693844c4e0c3178ba3 Mon Sep 17 00:00:00 2001 From: Jacques Kang Date: Sun, 22 Nov 2015 13:39:47 +0100 Subject: [PATCH 083/389] add ngCordova camera plugin --- ng-cordova/camera-tests.ts | 26 ++++++++++++++++++++++++++ ng-cordova/camera.d.ts | 14 ++++++++++++++ ng-cordova/tsd.d.ts | 1 + 3 files changed, 41 insertions(+) create mode 100644 ng-cordova/camera-tests.ts create mode 100644 ng-cordova/camera.d.ts diff --git a/ng-cordova/camera-tests.ts b/ng-cordova/camera-tests.ts new file mode 100644 index 000000000..207329b7a --- /dev/null +++ b/ng-cordova/camera-tests.ts @@ -0,0 +1,26 @@ +/// + +module ngCordova { + function cameraTest($cordovaCamera: ICameraService) { + var options = { + quality: 50, + destinationType: Camera.DestinationType.DATA_URL, + sourceType: Camera.PictureSourceType.CAMERA, + allowEdit: true, + encodingType: Camera.EncodingType.JPEG, + targetWidth: 100, + targetHeight: 100, + saveToPhotoAlbum: false, + correctOrientation: true + }; + + $cordovaCamera.getPicture(options).then((imageData) => { + console.log(imageData.trim()); + }).finally(() => { + $cordovaCamera.cleanup() + .then(() => { + console.log('cleaned up.'); + }); + }); + }; +} diff --git a/ng-cordova/camera.d.ts b/ng-cordova/camera.d.ts new file mode 100644 index 000000000..e9a6cd2c1 --- /dev/null +++ b/ng-cordova/camera.d.ts @@ -0,0 +1,14 @@ +// Type definitions for ngCordova.plugins.camera +// Project: https://github.com/driftyco/ng-cordova +// Definitions by: Jacques Kang +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// + +declare module ngCordova { + export interface ICameraService { + getPicture(options?: CameraOptions): ng.IPromise; + cleanup(): ng.IPromise; + } +} diff --git a/ng-cordova/tsd.d.ts b/ng-cordova/tsd.d.ts index d79755679..5f17dd706 100644 --- a/ng-cordova/tsd.d.ts +++ b/ng-cordova/tsd.d.ts @@ -14,3 +14,4 @@ /// /// /// +/// From ca7293c5ae1bfd5d3a756ad0d275d2b0fbc8ce7a Mon Sep 17 00:00:00 2001 From: Cyril Schumacher Date: Sun, 22 Nov 2015 14:59:47 +0100 Subject: [PATCH 084/389] Add definition for "email-templates". Update definition for "helmet". --- email-templates/email-templates-tests.ts | 26 ++++++ email-templates/email-templates.d.ts | 54 +++++++++++ helmet/helmet-tests.ts | 25 ++--- helmet/helmet.d.ts | 114 +++++++++++++---------- 4 files changed, 161 insertions(+), 58 deletions(-) create mode 100644 email-templates/email-templates-tests.ts create mode 100644 email-templates/email-templates.d.ts diff --git a/email-templates/email-templates-tests.ts b/email-templates/email-templates-tests.ts new file mode 100644 index 000000000..9b7072810 --- /dev/null +++ b/email-templates/email-templates-tests.ts @@ -0,0 +1,26 @@ +/// + +import EmailTemplates = require('email-templates'); + +var EmailTemplate = EmailTemplates.EmailTemplate; +var template = new EmailTemplate("./"); +var users = [ + { + email: 'pappa.pizza@spaghetti.com', + name: { + first: 'Pappa', + last: 'Pizza' + } + }, + { + email: 'mister.geppetto@spaghetti.com', + name: { + first: 'Mister', + last: 'Geppetto' + } + } +] + +var templates = users.map(function(user) { + return template.render(user); +}) diff --git a/email-templates/email-templates.d.ts b/email-templates/email-templates.d.ts new file mode 100644 index 000000000..e3e1095c3 --- /dev/null +++ b/email-templates/email-templates.d.ts @@ -0,0 +1,54 @@ +// Type definitions for node-email-templates +// Project: https://github.com/niftylettuce/node-email-templates +// Definitions by: Cyril Schumacher +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/** + * @summary Interface for result of email template. + * @interface + */ +interface EmailTemplateResults { + /** + * @summary HTML result. + * @type {string} + */ + html: string; + + /** + * @summary Text result. + * @type {string} + */ + text: string; +} + +/** + * @summary Interface for callback of email callback. + * @interface + */ +interface EmailTemplateCallback { + /** + * @summary Callback signature. + */ + (err: Object, results: EmailTemplateResults): void; +} + +declare module "email-templates" { + /** + * @summary Email template class. + * @class + */ + export class EmailTemplate { + /** + * @summary Constructor. + * @param {string} templateDir The template directory. + */ + constructor(templateDir: string); + + /** + * @summary Render a single template. + * @param {EmailTemplateCallback|Object} locals The variables or callback function. + * @param {EmailTemplateCallback} callback The callback function. + */ + render(locals: EmailTemplateCallback|Object, callback?: EmailTemplateCallback): void; + } +} diff --git a/helmet/helmet-tests.ts b/helmet/helmet-tests.ts index 04cfcaf36..d2509a022 100644 --- a/helmet/helmet-tests.ts +++ b/helmet/helmet-tests.ts @@ -1,59 +1,62 @@ /// +import express = require("express") import helmet = require("helmet"); +var app = express(); + /** * @summary Test for {@see helmet}. */ function helmetTest() { - helmet(); + app.use(helmet()); } /** * @summary Test for {@see helmet#xssFilter} function. */ function contentSecurityPolicyTest() { - helmet.xssFilter(); - helmet.xssFilter({ setOnOldIE: true }); + app.use(helmet.xssFilter()); + app.use(helmet.xssFilter({ setOnOldIE: true })); } /** * @summary Test for {@see helmet#frameguard} function. */ function frameguardTest() { - helmet.frameguard(); - helmet.frameguard("sameorigin"); + app.use(helmet.frameguard()); + app.use(helmet.frameguard("sameorigin")); } /** * @summary Test for {@see helmet#hsts} function. */ function hstsTest() { - helmet.hsts(); - helmet.hsts({ maxAge: 7776000000 }); + app.use(helmet.hsts()); + app.use(helmet.hsts({ maxAge: 7776000000 })); } /** * @summary Test for {@see helmet#ieNoOpen} function. */ function ieNoOpenTest() { - helmet.ieNoOpen(); + app.use(helmet.ieNoOpen()); } /** * @summary Test for {@see helmet#noSniff} function. */ function noSniffTest() { - helmet.noSniff(); + app.use(helmet.noSniff()); } /** * @summary Test for {@see helmet#publicKeyPins} function. */ function publicKeyPinsTest() { - helmet.publicKeyPins({ + app.use(helmet.publicKeyPins({ sha256s: ["AbCdEf123=", "ZyXwVu456="], includeSubdomains: true, reportUri: "http://example.com" - }); + })); } diff --git a/helmet/helmet.d.ts b/helmet/helmet.d.ts index fca15b926..35d9bf3ae 100644 --- a/helmet/helmet.d.ts +++ b/helmet/helmet.d.ts @@ -3,55 +3,75 @@ // Definitions by: Cyril Schumacher // Definitions: https://github.com/borisyankov/DefinitelyTyped -interface Helmet { - (): void; - - /** - * @summary Prevent clickjacking. - * @param {string} header The header. - */ - frameguard(header ?: string): void; - - /** - * @summary Hide "X-Powered-By" header. - * @param {Object} options The options. - */ - hidePoweredBy(options ?: Object): void; - - /** - * @summary Adds the "Strict-Transport-Security" header. - * @param {Object} options The options. - */ - hsts(options ?: Object): void; - - /** - * @summary Add the "X-Download-Options" header. - */ - ieNoOpen(): void; - - /** - * @summary Add the "Cache-Control" and "Pragma" headers to stop caching. - */ - nocache(options ?: Object): void; - - /** - * @summary Adds the "X-Content-Type-Options" header. - */ - noSniff(): void; - - /** - * @summary Adds the "Public-Key-Pins" header. - */ - publicKeyPins(options ?: Object): void; - - /** - * @summary Prevent Cross-site scripting attacks. - * @param {Object} options The options. - */ - xssFilter(options ?: Object): void; -} +/// declare module "helmet" { + import express = require("express"); + + /** + * @summary Interface for helmet class. + * @interface + */ + interface Helmet { + /** + * @summary Constructor. + * @return {RequestHandler} The Request handler. + */ + ():express.RequestHandler; + + /** + * @summary Prevent clickjacking. + * @param {string} header The header. + * @return {RequestHandler} The Request handler. + */ + frameguard(header ?: string):express.RequestHandler; + + /** + * @summary Hide "X-Powered-By" header. + * @param {Object} options The options. + * @return {RequestHandler} The Request handler. + */ + hidePoweredBy(options ?: Object):express.RequestHandler; + + /** + * @summary Adds the "Strict-Transport-Security" header. + * @param {Object} options The options. + * @return {RequestHandler} The Request handler. + */ + hsts(options ?: Object):express.RequestHandler; + + /** + * @summary Add the "X-Download-Options" header. + * @return {RequestHandler} The Request handler. + */ + ieNoOpen():express.RequestHandler; + + /** + * @summary Add the "Cache-Control" and "Pragma" headers to stop caching. + * @return {RequestHandler} The Request handler. + */ + noCache(options ?: Object):express.RequestHandler; + + /** + * @summary Adds the "X-Content-Type-Options" header. + * @return {RequestHandler} The Request handler. + */ + noSniff():express.RequestHandler; + + /** + * @summary Adds the "Public-Key-Pins" header. + * @return {RequestHandler} The Request handler. + */ + publicKeyPins(options ?: Object):express.RequestHandler; + + /** + * @summary Prevent Cross-site scripting attacks. + * @return {RequestHandler} The Request handler. + * @param {Object} options The options. + */ + xssFilter(options ?: Object):express.RequestHandler; + } + var helmet: Helmet; export = helmet; } From fe725b81fce6d8cff7fe365a1883f49452a2e073 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Sun, 22 Nov 2015 22:05:59 +0500 Subject: [PATCH 085/389] A definition of module "inherits" has been added --- inherits/inherits-tests.ts | 7 +++++++ inherits/inherits.d.ts | 11 +++++++++++ 2 files changed, 18 insertions(+) create mode 100644 inherits/inherits-tests.ts create mode 100644 inherits/inherits.d.ts diff --git a/inherits/inherits-tests.ts b/inherits/inherits-tests.ts new file mode 100644 index 000000000..7d05a7b0b --- /dev/null +++ b/inherits/inherits-tests.ts @@ -0,0 +1,7 @@ +/// + +import inherits = require('inherits'); + +let any: any; + +inherits(any, any); diff --git a/inherits/inherits.d.ts b/inherits/inherits.d.ts new file mode 100644 index 000000000..3028ddc00 --- /dev/null +++ b/inherits/inherits.d.ts @@ -0,0 +1,11 @@ +// Type definitions for inherits +// Project: https://github.com/isaacs/inherits +// Definitions by: Ilya Mochalov +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "inherits" { + import {inherits} from "util"; + export = inherits; +} From 790dca65ae53d6ee95cdfcefb2666f169a588e7c Mon Sep 17 00:00:00 2001 From: Sabeeh Ul Hussnain Date: Sun, 22 Nov 2015 22:18:02 +0500 Subject: [PATCH 086/389] added definations for lobibox --- lobibox/lobibox.d.ts | 197 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 197 insertions(+) create mode 100644 lobibox/lobibox.d.ts diff --git a/lobibox/lobibox.d.ts b/lobibox/lobibox.d.ts new file mode 100644 index 000000000..3ae7ebaef --- /dev/null +++ b/lobibox/lobibox.d.ts @@ -0,0 +1,197 @@ +// Type definitions for lobibox 1.0.1 +// Project: https://github.com/arboshiki/lobibox +// Definitions by: Sabeeh Ul Hussnain +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare var Lobibox: LobiboxModule.LobiboxStatic; +declare module "Lobibox" { + export = Lobibox; +} +declare module LobiboxModule { + interface MessageBoxesDefault { + title? : string; + horizontalOffset?: number; + width? : number; + height? : string; // Height is automatically given calculated by width + closeButton? : boolean; // Show close button or not + draggable? : boolean; // Make messagebox draggable + customBtnClass? : string; // Class for custom buttons + modal? : boolean; + debug? : boolean; + buttonsAlign? : string; // Position where buttons should be aligned + closeOnEsc? : boolean; // Close messagebox on Esc press + delayToRemove? : number; + baseClass? : string; + showClass? : string; + hideClass? : string; + msg? : string; + + // methods + hide? (): MessageBoxesDefault; + show? (): MessageBoxesDefault; + setWidth? (width?: number): MessageBoxesDefault; + setHeight? (height?: number): MessageBoxesDefault; + setSize? (width?: number, height?: number): MessageBoxesDefault; + setPosition? (left?: number|string, top?: number): MessageBoxesDefault; + setTitle? (title?: string): MessageBoxesDefault; + getTitle? (): string; + + // events + // when messagebox show is called but before it is actually shown + onShow? (lobibox:LobiboxStatic): void ; + // after messagebox is shown + shown? (lobibox:LobiboxStatic): void; + // when messagebox remove method is called but before it is actually hidden + beforeClose? (lobibox:LobiboxStatic): void; + // after messagebox is hidden + closed? (lobibox:LobiboxStatic): void; + } + + interface MessageBoxesOptions extends MessageBoxesDefault { + bodyClass? : string; + modalClasses? : { + 'error'? : string, + 'success'? : string, + 'info'? : string, + 'warning'? : string, + 'confirm'? : string, + 'progress'? : string, + 'prompt'? : string, + 'default'? : string, + 'window'? : string + }, + buttonsAlign?: any; + buttons?: { + ok?: { + 'class'?: string, + text?: string, + closeOnClick?: boolean + }, + cancel?: { + 'class'?: string, + text?: string, + closeOnClick?: boolean + }, + yes?: { + 'class'?: string, + text?: string, + closeOnClick?: boolean + }, + no?: { + 'class'?: string, + text?: string, + closeOnClick?: boolean + } + }; + callback? (lobibox:any, type:string); + } + interface ConfirmOptions extends MessageBoxesOptions { + title? : string; + width? : number; + iconClass? : string; + } + + interface PromptOptions extends MessageBoxesOptions, PromptMethods { + width?: number; + attrs?: any; // Object of any valid attribute of input field + value?: string; // Value which is given to textfield when messagebox is created + multiline?: boolean; // Set this true for multiline prompt + lines?: number; // This works only for multiline prompt. Number of lines + type?: string; // Prompt type. Available types (text|number|color) + label?: string; // Set some text which will be shown exactly on top of textfield + } + interface AlertOptions extends MessageBoxesOptions { + warning?: { + title?: string, + iconClass?: string // Change warning alert icon globally + }; + info?:{ + title?: string, + iconClass?: string // Change info alert icon globally + }; + success?: { + title?: string, + iconClass?: string // Change success alert icon globally + }; + error?: { + title?: string, + iconClass?: string // Change error alert icon globally + }; + } + interface ProgressOptions extends MessageBoxesOptions, ProgressMethods, ProgressEvents { + width? : number; + showProgressLabel? : boolean; // Show percentage of progress + label? : string; // Show progress label + progressTpl? : boolean; //Template of progress bar + + //Events + progressUpdated? : any; + progressCompleted? : any; + } + interface WindowOptions extends MessageBoxesOptions { + width? : number; + height? : any; + content? : string; // HTML Content of window + url? : string; // URL which will be used to load content + draggable? : boolean; // Override default option + autoload? : boolean; // Auto load from given url when window is created + loadMethod? : string; // Ajax method to load content + showAfterLoad? : boolean; // Show window after content is loaded or show and then load content + params? : {}; // Parameters which will be send by ajax for loading content + } + interface ProgressEvents { + progressUpdated? (lobibox:LobiboxStatic): void; + progressComplete? (lobibox:LobiboxStatic): void; + } + interface PromptMethods { + setValue? (val?:string): PromptMethods; + getValue? (): string; + } + interface ProgressMethods { + setProgress? (progress:number): ProgressMethods; + getProgress? (): number; + } + + interface NotifyDefault { + title?: boolean; // Title of notification. If you do not include the title in options it will automatically takes its value + //from Lobibox.notify.OPTIONS object depending of the type of the notifications or set custom string. Set this false to disable title + size?: string; // normal, mini, large + soundPath?: string; // The folder path where sounds are located + soundExt?: string; // Default extension for all sounds + showClass?: string; // Show animation class. + hideClass?: string; // Hide animation class. + icon?: boolean; // Icon of notification. Leave as is for default icon or set custom string + msg?: string; // Message of notification + img?: string; // Image source string + closable?: boolean; // Make notifications closable + delay?: number; // Hide notification after this time (in miliseconds) + delayIndicator?: boolean; // Show timer indicator + closeOnClick?: boolean; // Close notifications by clicking on them + width?: number; // Width of notification box + sound?: boolean; // Sound of notification. Set this false to disable sound. Leave as is for default sound or set custom soud path + position?: string; // Place to show notification. Available options: "top left", "top right", "bottom left", "bottom right" + } + interface NotifyOptions extends NotifyDefault, NotifyMethods { + 'class'?: string; //You can override options for large notifications from here + large?: {width?: number}; //You can override options for small notifications from here + mini?: {'class'?: string}; //Default options of different style notifications + success?: {'class'?: string, 'title'?: string,'icon'?: string,sound?: string}; + error?: {'class'?: string, 'title'?: string,'icon'?: string,sound?: string}; + warning?: {'class'?: string, 'title'?: string,'icon'?: string,sound?: string}; + info?: {'class'?: string, 'title'?: string,'icon'?: string,sound?: string}; + } + + interface NotifyMethods { + remove? (); + } + + interface LobiboxStatic { + base: {OPTIONS: MessageBoxesOptions, DEFAULTS: MessageBoxesDefault}; + alert: {(type: string, options?: AlertOptions), DEFAULTS: AlertOptions}; + prompt: {(type: string, options?: PromptOptions), DEFAULTS: PromptOptions}; + confirm: {(options?: ConfirmOptions), DEFAULTS: ConfirmOptions}; + progress: {(options: ProgressOptions), DEFAULTS: ProgressOptions}; + window: {(options: WindowOptions), DEFAULTS: WindowOptions}; + notify: {(type: string, options?: NotifyOptions), DEFAULTS?: NotifyDefault,OPTIONS?:NotifyOptions}; + } +} From f7c659b988a242220f3e82105957fa053c264b76 Mon Sep 17 00:00:00 2001 From: Sabeeh Ul Hussnain Date: Sun, 22 Nov 2015 22:52:27 +0500 Subject: [PATCH 087/389] lobibox test code --- lobibox/lobibox.js-test.ts | 134 +++++++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 lobibox/lobibox.js-test.ts diff --git a/lobibox/lobibox.js-test.ts b/lobibox/lobibox.js-test.ts new file mode 100644 index 000000000..4a14edf47 --- /dev/null +++ b/lobibox/lobibox.js-test.ts @@ -0,0 +1,134 @@ +/** + * Created by itboy on 11/22/2015. + */ + /// + /// + + //extending default parameters +Lobibox.notify.DEFAULTS = $.extend({}, Lobibox.notify.DEFAULTS, { + //override any options from default options + delay: false, + soundPath: '/libraries/lobibox/sounds/', + size: 'mini' +}); + +// notify +Lobibox.notify("error", {msg: "Hello world"}); +Lobibox.notify("success", {msg: "Hello world"}); +Lobibox.notify("warning", {msg: "Hello world"}); +Lobibox.notify("info", {msg: "Hello world"}); + +// alert +Lobibox.alert("error", {msg: "Hello world"}); +Lobibox.alert("success", {msg: "Hello world"}); +Lobibox.alert("warning", {msg: "Hello world"}); +Lobibox.alert("info", {msg: "Hello world"}); + +//alert with more options +Lobibox.alert('error', { + msg: 'This is an error message', + //buttons: ['ok', 'cancel', 'yes', 'no'], + //Or more powerfull way + buttons: { + ok: { + 'class': 'btn btn-info', + closeOnClick: false + }, + cancel: { + 'class': 'btn btn-danger', + closeOnClick: false + }, + yes: { + 'class': 'btn btn-success', + closeOnClick: false + }, + no: { + 'class': 'btn btn-warning', + closeOnClick: false + }, + custom: { + 'class': 'btn btn-default', + text: 'Custom' + } + }, + callback: function (lobibox, type) { + var btnType; + if (type === 'no') { + btnType = 'warning'; + } else if (type === 'yes') { + btnType = 'success'; + } else if (type === 'ok') { + btnType = 'info'; + } else if (type === 'cancel') { + btnType = 'error'; + } + Lobibox.notify(btnType, { + size: 'mini', + msg: 'This is ' + btnType + ' message' + }); + } +}); + +// confirm +Lobibox.confirm({ + msg: "Are you ok", +}); + +// prompt +Lobibox.prompt("text", { + title: 'Please enter username', + //Attributes of + attrs: { + placeholder: "Username" + } +}); + +// progress +Lobibox.progress({ + title: 'Please wait', + label: 'Uploading files...', + onShow: function ($this) { + var i = 0; + var inter = setInterval(function () { + window.console.log(i); + if (i > 100) { + clearInterval(inter); + } + i = i + 0.1; + $this.setProgress(i); + }, 10); + } +}); + +// window +Lobibox.window({ + title: 'Window title', + //Available types: string, jquery object, function + content: function () { + return $('.container'); + }, + url: 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.css', + autoload: false, + loadMethod: 'GET', + //Load parameters + params: { + param1: 'Lorem', + param2: 'Ipsum' + }, + buttons: { + load: { + text: 'Load from url' + }, + close: { + text: 'Close', + closeOnClick: true + } + }, + callback: function ($this, type, ev) { + if (type === 'load') { + $this.load(function () { + //Do something when content is loaded + }); + } + } +}); From 53fba494cd604075a86f161829963ca08871f213 Mon Sep 17 00:00:00 2001 From: Sabeeh Ul Hussnain Date: Sun, 22 Nov 2015 22:54:34 +0500 Subject: [PATCH 088/389] added definations for lobibox --- lobibox/lobibox.d.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lobibox/lobibox.d.ts b/lobibox/lobibox.d.ts index 3ae7ebaef..a68be8368 100644 --- a/lobibox/lobibox.d.ts +++ b/lobibox/lobibox.d.ts @@ -38,13 +38,13 @@ declare module LobiboxModule { // events // when messagebox show is called but before it is actually shown - onShow? (lobibox:LobiboxStatic): void ; + onShow? (lobibox:any): void ; // after messagebox is shown - shown? (lobibox:LobiboxStatic): void; + shown? (lobibox:any): void; // when messagebox remove method is called but before it is actually hidden - beforeClose? (lobibox:LobiboxStatic): void; + beforeClose? (lobibox:any): void; // after messagebox is hidden - closed? (lobibox:LobiboxStatic): void; + closed? (lobibox:any): void; } interface MessageBoxesOptions extends MessageBoxesDefault { @@ -81,7 +81,8 @@ declare module LobiboxModule { 'class'?: string, text?: string, closeOnClick?: boolean - } + }, + custom?: any, }; callback? (lobibox:any, type:string); } From 924aba24b25b21f9c38f2b8c65a201eaf5584927 Mon Sep 17 00:00:00 2001 From: Sabeeh Ul Hussnain Date: Sun, 22 Nov 2015 23:38:23 +0500 Subject: [PATCH 089/389] definitions for lobibox errors fixed --- lobibox/lobibox.d.ts | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/lobibox/lobibox.d.ts b/lobibox/lobibox.d.ts index a68be8368..2a951451f 100644 --- a/lobibox/lobibox.d.ts +++ b/lobibox/lobibox.d.ts @@ -82,9 +82,8 @@ declare module LobiboxModule { text?: string, closeOnClick?: boolean }, - custom?: any, - }; - callback? (lobibox:any, type:string); + }|any; + callback? (lobibox:any, type:string, ev: any): void; } interface ConfirmOptions extends MessageBoxesOptions { title? : string; @@ -132,7 +131,7 @@ declare module LobiboxModule { interface WindowOptions extends MessageBoxesOptions { width? : number; height? : any; - content? : string; // HTML Content of window + content? : any; // HTML Content of window url? : string; // URL which will be used to load content draggable? : boolean; // Override default option autoload? : boolean; // Auto load from given url when window is created @@ -183,16 +182,16 @@ declare module LobiboxModule { } interface NotifyMethods { - remove? (); + remove? (): any; } interface LobiboxStatic { base: {OPTIONS: MessageBoxesOptions, DEFAULTS: MessageBoxesDefault}; - alert: {(type: string, options?: AlertOptions), DEFAULTS: AlertOptions}; - prompt: {(type: string, options?: PromptOptions), DEFAULTS: PromptOptions}; - confirm: {(options?: ConfirmOptions), DEFAULTS: ConfirmOptions}; - progress: {(options: ProgressOptions), DEFAULTS: ProgressOptions}; - window: {(options: WindowOptions), DEFAULTS: WindowOptions}; - notify: {(type: string, options?: NotifyOptions), DEFAULTS?: NotifyDefault,OPTIONS?:NotifyOptions}; + alert: {(type: string, options?: T): LobiboxStatic, DEFAULTS: AlertOptions}; + prompt: {(type: string, options?: T): LobiboxStatic, DEFAULTS: PromptOptions}; + confirm: {(options?: ConfirmOptions): T, DEFAULTS: ConfirmOptions}; + progress: {(options: ProgressOptions): T, DEFAULTS: ProgressOptions}; + window: {(options: WindowOptions): T, DEFAULTS: WindowOptions}; + notify: {(type: string, options?: NotifyOptions): T, DEFAULTS?: NotifyDefault,OPTIONS?:NotifyOptions}; } } From 2440326118730fd8ec352217dc43cd6688955eb0 Mon Sep 17 00:00:00 2001 From: Sabeeh Ul Hussnain Date: Sun, 22 Nov 2015 23:39:01 +0500 Subject: [PATCH 090/389] lobibox test code updated --- lobibox/lobibox.js-test.ts | 224 +++++++++++++++++++------------------ 1 file changed, 114 insertions(+), 110 deletions(-) diff --git a/lobibox/lobibox.js-test.ts b/lobibox/lobibox.js-test.ts index 4a14edf47..6060ac175 100644 --- a/lobibox/lobibox.js-test.ts +++ b/lobibox/lobibox.js-test.ts @@ -5,130 +5,134 @@ /// //extending default parameters -Lobibox.notify.DEFAULTS = $.extend({}, Lobibox.notify.DEFAULTS, { - //override any options from default options - delay: false, - soundPath: '/libraries/lobibox/sounds/', - size: 'mini' -}); +class LobiboxTest { + static test() { + Lobibox.notify.DEFAULTS = $.extend({}, Lobibox.notify.DEFAULTS, { + //override any options from default options + delay: false, + soundPath: '/libraries/lobibox/sounds/', + size: 'mini' + }); // notify -Lobibox.notify("error", {msg: "Hello world"}); -Lobibox.notify("success", {msg: "Hello world"}); -Lobibox.notify("warning", {msg: "Hello world"}); -Lobibox.notify("info", {msg: "Hello world"}); + Lobibox.notify("error", {msg: "Hello world"}); + Lobibox.notify("success", {msg: "Hello world"}); + Lobibox.notify("warning", {msg: "Hello world"}); + Lobibox.notify("info", {msg: "Hello world"}); // alert -Lobibox.alert("error", {msg: "Hello world"}); -Lobibox.alert("success", {msg: "Hello world"}); -Lobibox.alert("warning", {msg: "Hello world"}); -Lobibox.alert("info", {msg: "Hello world"}); + Lobibox.alert("error", {msg: "Hello world"}); + Lobibox.alert("success", {msg: "Hello world"}); + Lobibox.alert("warning", {msg: "Hello world"}); + Lobibox.alert("info", {msg: "Hello world"}); //alert with more options -Lobibox.alert('error', { - msg: 'This is an error message', - //buttons: ['ok', 'cancel', 'yes', 'no'], - //Or more powerfull way - buttons: { - ok: { - 'class': 'btn btn-info', - closeOnClick: false - }, - cancel: { - 'class': 'btn btn-danger', - closeOnClick: false - }, - yes: { - 'class': 'btn btn-success', - closeOnClick: false - }, - no: { - 'class': 'btn btn-warning', - closeOnClick: false - }, - custom: { - 'class': 'btn btn-default', - text: 'Custom' - } - }, - callback: function (lobibox, type) { - var btnType; - if (type === 'no') { - btnType = 'warning'; - } else if (type === 'yes') { - btnType = 'success'; - } else if (type === 'ok') { - btnType = 'info'; - } else if (type === 'cancel') { - btnType = 'error'; - } - Lobibox.notify(btnType, { - size: 'mini', - msg: 'This is ' + btnType + ' message' + Lobibox.alert('error', { + msg: 'This is an error message', + //buttons: ['ok', 'cancel', 'yes', 'no'], + //Or more powerfull way + buttons: { + ok: { + 'class': 'btn btn-info', + closeOnClick: false + }, + cancel: { + 'class': 'btn btn-danger', + closeOnClick: false + }, + yes: { + 'class': 'btn btn-success', + closeOnClick: false + }, + no: { + 'class': 'btn btn-warning', + closeOnClick: false + }, + custom: { + 'class': 'btn btn-default', + text: 'Custom' + } + }, + callback: function (lobibox, type) { + var btnType; + if (type === 'no') { + btnType = 'warning'; + } else if (type === 'yes') { + btnType = 'success'; + } else if (type === 'ok') { + btnType = 'info'; + } else if (type === 'cancel') { + btnType = 'error'; + } + Lobibox.notify(btnType, { + size: 'mini', + msg: 'This is ' + btnType + ' message' + }); + } }); - } -}); // confirm -Lobibox.confirm({ - msg: "Are you ok", -}); + Lobibox.confirm({ + msg: "Are you ok", + }); // prompt -Lobibox.prompt("text", { - title: 'Please enter username', - //Attributes of - attrs: { - placeholder: "Username" - } -}); + Lobibox.prompt("text", { + title: 'Please enter username', + //Attributes of + attrs: { + placeholder: "Username" + } + }); // progress -Lobibox.progress({ - title: 'Please wait', - label: 'Uploading files...', - onShow: function ($this) { - var i = 0; - var inter = setInterval(function () { - window.console.log(i); - if (i > 100) { - clearInterval(inter); + Lobibox.progress({ + title: 'Please wait', + label: 'Uploading files...', + onShow: function ($this) { + var i = 0; + var inter = setInterval(function () { + window.console.log(i); + if (i > 100) { + clearInterval(inter); + } + i = i + 0.1; + $this.setProgress(i); + }, 10); } - i = i + 0.1; - $this.setProgress(i); - }, 10); - } -}); + }); // window -Lobibox.window({ - title: 'Window title', - //Available types: string, jquery object, function - content: function () { - return $('.container'); - }, - url: 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.css', - autoload: false, - loadMethod: 'GET', - //Load parameters - params: { - param1: 'Lorem', - param2: 'Ipsum' - }, - buttons: { - load: { - text: 'Load from url' - }, - close: { - text: 'Close', - closeOnClick: true - } - }, - callback: function ($this, type, ev) { - if (type === 'load') { - $this.load(function () { - //Do something when content is loaded - }); - } + Lobibox.window({ + title: 'Window title', + //Available types: string, jquery object, function + content: function () { + return $('.container'); + }, + url: 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.css', + autoload: false, + loadMethod: 'GET', + //Load parameters + params: { + param1: 'Lorem', + param2: 'Ipsum' + }, + buttons: { + load: { + text: 'Load from url' + }, + close: { + text: 'Close', + closeOnClick: true + } + }, + callback: function ($this, type, ev) { + if (type === 'load') { + $this.load(function () { + //Do something when content is loaded + }); + } + } + }); } -}); +} From 8b698cb8bb9f94b34168f613afe9cf171d69e65f Mon Sep 17 00:00:00 2001 From: Sabeeh Ul Hussnain Date: Sun, 22 Nov 2015 23:48:55 +0500 Subject: [PATCH 091/389] updated lobibox test code --- lobibox/lobibox.js-test.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lobibox/lobibox.js-test.ts b/lobibox/lobibox.js-test.ts index 6060ac175..b4fea7a14 100644 --- a/lobibox/lobibox.js-test.ts +++ b/lobibox/lobibox.js-test.ts @@ -1,12 +1,14 @@ /** * Created by itboy on 11/22/2015. */ - /// + /// /// - //extending default parameters + // run test by calling + // LobiboxTest.test(); class LobiboxTest { static test() { + //extending default parameters Lobibox.notify.DEFAULTS = $.extend({}, Lobibox.notify.DEFAULTS, { //override any options from default options delay: false, From 76bd92c8ac2aedb9f5e0a7c8c1c7e3799822f4b8 Mon Sep 17 00:00:00 2001 From: SirTobi Date: Sun, 22 Nov 2015 19:52:52 +0100 Subject: [PATCH 092/389] Renamed old jssha files of version 1.6.0 to contain their version --- jssha/{jssha-tests.ts => jssha-1.6.0-tests.ts} | 2 +- jssha/{jssha.d.ts => jssha-1.6.0.d.ts} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename jssha/{jssha-tests.ts => jssha-1.6.0-tests.ts} (93%) rename jssha/{jssha.d.ts => jssha-1.6.0.d.ts} (98%) diff --git a/jssha/jssha-tests.ts b/jssha/jssha-1.6.0-tests.ts similarity index 93% rename from jssha/jssha-tests.ts rename to jssha/jssha-1.6.0-tests.ts index 8d6eec5a6..67e1ec026 100755 --- a/jssha/jssha-tests.ts +++ b/jssha/jssha-1.6.0-tests.ts @@ -1,4 +1,4 @@ -/// +/// /// var imported = require("jssha"); diff --git a/jssha/jssha.d.ts b/jssha/jssha-1.6.0.d.ts similarity index 98% rename from jssha/jssha.d.ts rename to jssha/jssha-1.6.0.d.ts index 1c75c3862..7ff6e2a20 100755 --- a/jssha/jssha.d.ts +++ b/jssha/jssha-1.6.0.d.ts @@ -1,4 +1,4 @@ -// Type definitions for jsSHA +// Type definitions for jsSHA-1.6.0 // Project: https://github.com/Caligatio/jsSHA // Definitions by: David Li // Definitions: https://github.com/borisyankov/DefinitelyTyped From 52b9b36e5dd45a8d58b43b4e4b3d0be6b59d90ee Mon Sep 17 00:00:00 2001 From: Sabeeh Ul Hussnain Date: Sun, 22 Nov 2015 23:59:47 +0500 Subject: [PATCH 093/389] updated lobibox test code --- lobibox/lobibox.js-test.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lobibox/lobibox.js-test.ts b/lobibox/lobibox.js-test.ts index b4fea7a14..bd0ff33d2 100644 --- a/lobibox/lobibox.js-test.ts +++ b/lobibox/lobibox.js-test.ts @@ -4,11 +4,11 @@ /// /// - // run test by calling - // LobiboxTest.test(); + + //Run test : LobiboxTest.test() class LobiboxTest { static test() { - //extending default parameters + // extending default parameters Lobibox.notify.DEFAULTS = $.extend({}, Lobibox.notify.DEFAULTS, { //override any options from default options delay: false, @@ -55,8 +55,8 @@ class LobiboxTest { text: 'Custom' } }, - callback: function (lobibox, type) { - var btnType; + callback: function (lobibox:any, type:string):any { + let btnType:string = ""; if (type === 'no') { btnType = 'warning'; } else if (type === 'yes') { @@ -91,9 +91,9 @@ class LobiboxTest { Lobibox.progress({ title: 'Please wait', label: 'Uploading files...', - onShow: function ($this) { + onShow: function ($this:any):void { var i = 0; - var inter = setInterval(function () { + var inter = setInterval(function ():void { window.console.log(i); if (i > 100) { clearInterval(inter); @@ -108,7 +108,7 @@ class LobiboxTest { Lobibox.window({ title: 'Window title', //Available types: string, jquery object, function - content: function () { + content: function ():any { return $('.container'); }, url: 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.css', @@ -128,9 +128,9 @@ class LobiboxTest { closeOnClick: true } }, - callback: function ($this, type, ev) { + callback: function ($this:any, type:string, ev:any):void { if (type === 'load') { - $this.load(function () { + $this.load(function ():any { //Do something when content is loaded }); } From e020d6b8a1a7c30d1678e2b75cd3ed15e95ae37b Mon Sep 17 00:00:00 2001 From: Sabeeh Ul Hussnain Date: Mon, 23 Nov 2015 00:00:11 +0500 Subject: [PATCH 094/389] definitions for lobibox errors fixed --- lobibox/lobibox.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lobibox/lobibox.d.ts b/lobibox/lobibox.d.ts index 2a951451f..d8a7588d5 100644 --- a/lobibox/lobibox.d.ts +++ b/lobibox/lobibox.d.ts @@ -83,7 +83,7 @@ declare module LobiboxModule { closeOnClick?: boolean }, }|any; - callback? (lobibox:any, type:string, ev: any): void; + callback? (lobibox:any, type?:string, ev?: any): void; } interface ConfirmOptions extends MessageBoxesOptions { title? : string; From 6e12544cf91956cf3b4f9811eab1fd1a12e1604c Mon Sep 17 00:00:00 2001 From: SirTobi Date: Sun, 22 Nov 2015 20:34:52 +0100 Subject: [PATCH 095/389] made option map properties optional --- jssha/jssha-1.6.0.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jssha/jssha-1.6.0.d.ts b/jssha/jssha-1.6.0.d.ts index 7ff6e2a20..b6dcef80f 100755 --- a/jssha/jssha-1.6.0.d.ts +++ b/jssha/jssha-1.6.0.d.ts @@ -6,8 +6,8 @@ declare module jsSHA { export interface OutputFormatOptions { - outputUpper : boolean; - b64Pad : string; + outputUpper? : boolean; + b64Pad? : string; } export interface jsSHA { From 8bbf0548e54d6b7544d47940058c3bf42c5e71e8 Mon Sep 17 00:00:00 2001 From: SirTobi Date: Sun, 22 Nov 2015 20:38:19 +0100 Subject: [PATCH 096/389] add: added type definitions for new jssha version (2.0.2) because of the rework from 1.6 to 2.0 --- jssha/jssha-tests.ts | 50 +++++++++++++++++++++++++ jssha/jssha.d.ts | 87 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 137 insertions(+) create mode 100644 jssha/jssha-tests.ts create mode 100644 jssha/jssha.d.ts diff --git a/jssha/jssha-tests.ts b/jssha/jssha-tests.ts new file mode 100644 index 000000000..def07a2d2 --- /dev/null +++ b/jssha/jssha-tests.ts @@ -0,0 +1,50 @@ +/// +/// + +var imported = require("jssha"); + +// constructor +let shaObj1:jsSHA.jsSHA = imported("SHA-256", "HEX"); +let shaObj2:jsSHA.jsSHA = new jsSHA("SHA-512", "TEXT"); +let shaObj3:jsSHA.jsSHA = new jsSHA("SHA-512", "TEXT", { }); +let shaObj4:jsSHA.jsSHA = new jsSHA("SHA-512", "TEXT", { encoding: "UTF" }); +let shaObj5:jsSHA.jsSHA = new jsSHA("SHA-512", "TEXT", { numRounds: 1 }); +let shaObj6:jsSHA.jsSHA = new jsSHA("SHA-512", "TEXT", { encoding: "UTF", numRounds: 1 }); + +// setHMACKey +shaObj1.setHMACKey("key", "TEXT"); +shaObj1.setHMACKey("key", "TEXT", { }); +shaObj1.setHMACKey("key", "TEXT", { encoding: "UTF" }); + +// update +shaObj1.update("This is a test"); + +// getHash +let hash1:string = shaObj1.getHash("HEX"); +let hash2:string = shaObj1.getHash("HEX", {}); +let hash3:string = shaObj1.getHash("HEX", { b64Pad: "=" }); +let hash4:string = shaObj1.getHash("HEX", { outputUpper: true }); +let hash5:string = shaObj1.getHash("HEX", { outputUpper: true, b64Pad: '=' }); + +// getHMAC +let hmac1:string = shaObj1.getHMAC("HEX"); +let hmac2:string = shaObj1.getHMAC("HEX", {}); +let hmac3:string = shaObj1.getHMAC("HEX", { b64Pad: "=" }); +let hmac4:string = shaObj1.getHMAC("HEX", { outputUpper: true }); +let hmac5:string = shaObj1.getHMAC("HEX", { outputUpper: true, b64Pad: '=' }); + + +// examples from the readme.md (https://github.com/Caligatio/jsSHA/blob/v2.0.2/README.md) +{ + var shaObj = new jsSHA("SHA-512", "TEXT"); + shaObj.update("This is a test"); + var hash = shaObj.getHash("HEX"); +} + + +{ + let shaObj = new jsSHA("SHA-256", "TEXT"); + shaObj.setHMACKey("abc", "TEXT"); + shaObj.update("This is a test"); + let hmac = shaObj.getHMAC("HEX"); +} \ No newline at end of file diff --git a/jssha/jssha.d.ts b/jssha/jssha.d.ts new file mode 100644 index 000000000..8ce44f2c1 --- /dev/null +++ b/jssha/jssha.d.ts @@ -0,0 +1,87 @@ +// Type definitions for jsSHA +// Project: https://github.com/Caligatio/jsSHA +// Definitions by: Tobias Kahlert +// Definitions: https://github.com/SrTobi/DefinitelyTyped + + +declare module jsSHA { + + export interface EncodingOptions { + encoding? : string; + } + + export interface Options extends EncodingOptions { + numRounds? : number; + } + + export interface OutputFormatOptions { + outputUpper? : boolean; + b64Pad? : string; + } + + export interface jsSHA { + /** + * jsSHA is the workhorse of the library. Instantiate it with the string to + * be hashed as the parameter + * + * @constructor + * @this {jsSHA} + * @param {string} variant The desired SHA variant (SHA-1, SHA-224, SHA-256, + * SHA-384, or SHA-512) + * @param {string} inputFormat The format of srcString: HEX, TEXT, B64, or BYTES + * @param {{encoding: (string|undefined), numRounds: (string|undefined)}=} + * options Optional values + */ + new (variant:string, inputFormat:string, options?:Options):jsSHA; + + /** + * Sets the HMAC key for an eventual getHMAC call. Must be called + * immediately after jsSHA object instantiation + * + * @param {string} key The key used to calculate the HMAC + * @param {string} inputFormat The format of key, HEX, TEXT, B64, or BYTES + * @param {{encoding : (string|undefined)}=} options Associative array + * of input format options + */ + setHMACKey(key:string, inputFormat:string, encodingOpts?:EncodingOptions):void; + + /** + * Takes strString and hashes as many blocks as possible. Stores the + * rest for either a future update or getHash call. + * + * @param {string} srcString The string to be hashed + */ + update(srcString:string):void; + + + /** + * Returns the desired SHA hash of the string specified at instantiation + * using the specified parameters + * + * @param {string} format The desired output formatting (B64, HEX, or BYTES) + * @param {{outputUpper : (boolean|undefined), b64Pad : (string|undefined)}=} + * options Hash list of output formatting options + * @return {string} The string representation of the hash in the format + * specified + */ + getHash(format:string, outputFormatOpts?:OutputFormatOptions):string; + + /** + * Returns the the HMAC in the specified format using the key given by + * a previous setHMACKey call. + * + * @param {string} format The desired output formatting + * (B64, HEX, or BYTES) + * @param {{outputUpper : (boolean|undefined), b64Pad : (string|undefined)}=} + * options associative array of output formatting options + * @return {string} The string representation of the hash in the format + * specified + */ + getHMAC(format:string, outputFormatOpts?:OutputFormatOptions):string; + } +} + +declare var jsSHA: jsSHA.jsSHA; +declare module 'jssha' { + export = jsSHA; +} \ No newline at end of file From 4ae716eee75b85a04616f9c4305f99f4f648ea48 Mon Sep 17 00:00:00 2001 From: SrTobi Date: Mon, 23 Nov 2015 00:26:46 +0100 Subject: [PATCH 097/389] add: type definitions for wake_on_lan --- wake_on_lan/wake_on_lan-tests.ts | 39 +++++++++++++++++ wake_on_lan/wake_on_lan.d.ts | 74 ++++++++++++++++++++++++++++++++ 2 files changed, 113 insertions(+) create mode 100644 wake_on_lan/wake_on_lan-tests.ts create mode 100644 wake_on_lan/wake_on_lan.d.ts diff --git a/wake_on_lan/wake_on_lan-tests.ts b/wake_on_lan/wake_on_lan-tests.ts new file mode 100644 index 000000000..35c8754cd --- /dev/null +++ b/wake_on_lan/wake_on_lan-tests.ts @@ -0,0 +1,39 @@ +/// +/// + +import wol = require('wake_on_lan'); + +wol.wake("20:DE:20:DE:20:DE"); + +let errFunc:wol.ErrorCallback = function(error:any) { + if (error) { + // handle error + } else { + // done sending packets + } +}; + +var opts:wol.WakeOptions = { address: "192.168.1.1" }; +var opts1:wol.WakeOptions = { address: "192.168.1.1", num_packets: 3 }; +var opts2:wol.WakeOptions = { address: "192.168.1.1", num_packets: 3, interval: 4 }; +var opts3:wol.WakeOptions = { address: "192.168.1.1", num_packets: 3, interval: 4, port: 5 }; +var opts4:wol.WakeOptions = { address: "192.168.1.1" }; +var opts5:wol.WakeOptions = { address: "192.168.1.1", interval: 4 }; +var opts6:wol.WakeOptions = { address: "192.168.1.1", port: 5 }; +var opts7:wol.WakeOptions = { address: "192.168.1.1", interval: 4, port: 5 }; +var opts8:wol.WakeOptions = { num_packets: 3 }; +var opts9:wol.WakeOptions = { num_packets: 3, interval: 4 }; +var opts10:wol.WakeOptions = { num_packets: 3, port: 5 }; +var opts11:wol.WakeOptions = { num_packets: 3, interval: 4, port: 5 }; +var opts12:wol.WakeOptions = { interval: 4 }; +var opts13:wol.WakeOptions = { interval: 4, port: 5 }; +var opts14:wol.WakeOptions = { port: 5 }; +var opts15:wol.WakeOptions = { }; + +wol.wake('20:DE:20:DE:20:DE'); +wol.wake('20:DE:20:DE:20:DE', opts); +wol.wake('20:DE:20:DE:20:DE', errFunc); +wol.wake('20:DE:20:DE:20:DE', opts, errFunc); + + +var magic_packet:Buffer = wol.createMagicPacket('20:DE:20:DE:20:DE'); \ No newline at end of file diff --git a/wake_on_lan/wake_on_lan.d.ts b/wake_on_lan/wake_on_lan.d.ts new file mode 100644 index 000000000..46a03eeee --- /dev/null +++ b/wake_on_lan/wake_on_lan.d.ts @@ -0,0 +1,74 @@ +// Type definitions for wake_on_lan +// Project: https://github.com/agnat/node_wake_on_lan +// Definitions by: Tobias Kahlert +// Definitions: https://github.com/SrTobi/DefinitelyTyped + +/// +/// + +declare module wol { + + export interface WakeOptions { + + /** + * The ip address to which the packet is send (default: 255.255.255.255) + */ + address?:string; + + /** + * Number of packets to send (default: 3) + */ + num_packets?:number; + + /** + * The interval between packets (default: 100ms) + */ + interval?:number; + + /** + * The port to send to (default: 9) + */ + port?:number; + } + + type ErrorCallback = (Error:any) => void; + + export interface Wol { + /** + * Send a sequence of Wake-on-LAN magic packets to the given MAC address. + * + * @param {string} macAddress the mac address of the target device + */ + wake(macAddress:string):void; + + /** + * Send a sequence of Wake-on-LAN magic packets to the given MAC address. + * + * @param {string} macAddress the mac address of the target device + * @param {ErrorCallback} callback is called when all packets have been sent or an error occurs. + */ + wake(macAddress:string, callback:ErrorCallback):void; + + /** + * Send a sequence of Wake-on-LAN magic packets to the given MAC address. + * + * @param {string} macAddress the mac address of the target device + * @param {WakeOptions} opts additional options to send the packet + * @param {ErrorCallback} callback is called when all packets have been sent or an error occurs. + */ + wake(macAddress:string, opts:WakeOptions, callback?:Function):void; + + /** + * Creates a buffer with a magic packet for the given MAC address. + * + * @param {string} macAddress mac address of the target device + * @return {Buffer} the magic packet + */ + createMagicPacket(macAddress:string):Buffer; + } +} + +declare module 'wake_on_lan' { + var wol: wol.Wol; + export = wol; +} From 4986b607ede2a16aa81881155603c45f99f9c842 Mon Sep 17 00:00:00 2001 From: SrTobi Date: Mon, 23 Nov 2015 00:36:09 +0100 Subject: [PATCH 098/389] fixed parameter documentation --- jssha/jssha.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jssha/jssha.d.ts b/jssha/jssha.d.ts index 8ce44f2c1..2b5a2b7e0 100644 --- a/jssha/jssha.d.ts +++ b/jssha/jssha.d.ts @@ -40,7 +40,7 @@ declare module jsSHA { * * @param {string} key The key used to calculate the HMAC * @param {string} inputFormat The format of key, HEX, TEXT, B64, or BYTES - * @param {{encoding : (string|undefined)}=} options Associative array + * @param {{encoding : (string|undefined)}=} encodingOpts Associative array * of input format options */ setHMACKey(key:string, inputFormat:string, encodingOpts?:EncodingOptions):void; @@ -60,7 +60,7 @@ declare module jsSHA { * * @param {string} format The desired output formatting (B64, HEX, or BYTES) * @param {{outputUpper : (boolean|undefined), b64Pad : (string|undefined)}=} - * options Hash list of output formatting options + * outputFormatOpts Hash list of output formatting options * @return {string} The string representation of the hash in the format * specified */ @@ -73,7 +73,7 @@ declare module jsSHA { * @param {string} format The desired output formatting * (B64, HEX, or BYTES) * @param {{outputUpper : (boolean|undefined), b64Pad : (string|undefined)}=} - * options associative array of output formatting options + * outputFormatOpts associative array of output formatting options * @return {string} The string representation of the hash in the format * specified */ From 9dcb36b7e2cdad44b845f568e92fe0e602f75a28 Mon Sep 17 00:00:00 2001 From: SrTobi Date: Mon, 23 Nov 2015 00:36:53 +0100 Subject: [PATCH 099/389] improved constructor documentation --- jssha/jssha.d.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/jssha/jssha.d.ts b/jssha/jssha.d.ts index 2b5a2b7e0..0d880de45 100644 --- a/jssha/jssha.d.ts +++ b/jssha/jssha.d.ts @@ -24,8 +24,6 @@ declare module jsSHA { * jsSHA is the workhorse of the library. Instantiate it with the string to * be hashed as the parameter * - * @constructor - * @this {jsSHA} * @param {string} variant The desired SHA variant (SHA-1, SHA-224, SHA-256, * SHA-384, or SHA-512) * @param {string} inputFormat The format of srcString: HEX, TEXT, B64, or BYTES From 9bfee0e09d6b5678296e748dc075d2aca20daf24 Mon Sep 17 00:00:00 2001 From: SrTobi Date: Mon, 23 Nov 2015 00:46:38 +0100 Subject: [PATCH 100/389] improved test --- jssha/jssha-tests.ts | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/jssha/jssha-tests.ts b/jssha/jssha-tests.ts index def07a2d2..f6e0f96b4 100644 --- a/jssha/jssha-tests.ts +++ b/jssha/jssha-tests.ts @@ -1,30 +1,29 @@ /// /// -var imported = require("jssha"); +import imported = require("jssha"); // constructor -let shaObj1:jsSHA.jsSHA = imported("SHA-256", "HEX"); -let shaObj2:jsSHA.jsSHA = new jsSHA("SHA-512", "TEXT"); -let shaObj3:jsSHA.jsSHA = new jsSHA("SHA-512", "TEXT", { }); -let shaObj4:jsSHA.jsSHA = new jsSHA("SHA-512", "TEXT", { encoding: "UTF" }); -let shaObj5:jsSHA.jsSHA = new jsSHA("SHA-512", "TEXT", { numRounds: 1 }); -let shaObj6:jsSHA.jsSHA = new jsSHA("SHA-512", "TEXT", { encoding: "UTF", numRounds: 1 }); +let shaObj1:jsSHA.jsSHA = new imported("SHA-512", "TEXT"); +let shaObj2:jsSHA.jsSHA = new imported("SHA-512", "TEXT", { }); +let shaObj3:jsSHA.jsSHA = new imported("SHA-512", "TEXT", { encoding: "UTF8" }); +let shaObj4:jsSHA.jsSHA = new imported("SHA-512", "TEXT", { numRounds: 1 }); +let shaObj5:jsSHA.jsSHA = new imported("SHA-512", "TEXT", { encoding: "UTF8", numRounds: 1 }); // setHMACKey shaObj1.setHMACKey("key", "TEXT"); -shaObj1.setHMACKey("key", "TEXT", { }); -shaObj1.setHMACKey("key", "TEXT", { encoding: "UTF" }); +shaObj2.setHMACKey("key", "TEXT", { }); +shaObj3.setHMACKey("key", "TEXT", { encoding: "UTF8" }); // update shaObj1.update("This is a test"); // getHash -let hash1:string = shaObj1.getHash("HEX"); -let hash2:string = shaObj1.getHash("HEX", {}); -let hash3:string = shaObj1.getHash("HEX", { b64Pad: "=" }); -let hash4:string = shaObj1.getHash("HEX", { outputUpper: true }); -let hash5:string = shaObj1.getHash("HEX", { outputUpper: true, b64Pad: '=' }); +let hash1:string = shaObj4.getHash("HEX"); +let hash2:string = shaObj4.getHash("HEX", {}); +let hash3:string = shaObj4.getHash("HEX", { b64Pad: "=" }); +let hash4:string = shaObj4.getHash("HEX", { outputUpper: true }); +let hash5:string = shaObj4.getHash("HEX", { outputUpper: true, b64Pad: '=' }); // getHMAC let hmac1:string = shaObj1.getHMAC("HEX"); @@ -36,14 +35,14 @@ let hmac5:string = shaObj1.getHMAC("HEX", { outputUpper: true, b64Pad: '=' }); // examples from the readme.md (https://github.com/Caligatio/jsSHA/blob/v2.0.2/README.md) { - var shaObj = new jsSHA("SHA-512", "TEXT"); + var shaObj = new imported("SHA-512", "TEXT"); shaObj.update("This is a test"); var hash = shaObj.getHash("HEX"); } { - let shaObj = new jsSHA("SHA-256", "TEXT"); + let shaObj = new imported("SHA-256", "TEXT"); shaObj.setHMACKey("abc", "TEXT"); shaObj.update("This is a test"); let hmac = shaObj.getHMAC("HEX"); From 8ed81ba63237a628ec63f7cd34697c6acc1bdaed Mon Sep 17 00:00:00 2001 From: SrTobi Date: Mon, 23 Nov 2015 00:53:32 +0100 Subject: [PATCH 101/389] hide jsSHA instance --- jssha/jssha.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jssha/jssha.d.ts b/jssha/jssha.d.ts index 0d880de45..e8e8787c5 100644 --- a/jssha/jssha.d.ts +++ b/jssha/jssha.d.ts @@ -79,7 +79,7 @@ declare module jsSHA { } } -declare var jsSHA: jsSHA.jsSHA; declare module 'jssha' { + var jsSHA: jsSHA.jsSHA; export = jsSHA; } \ No newline at end of file From 6775aa83ad0d5b72332aeab1ec553a7af645ad62 Mon Sep 17 00:00:00 2001 From: SrTobi Date: Mon, 23 Nov 2015 01:00:38 +0100 Subject: [PATCH 102/389] fixed minor typos --- wake_on_lan/wake_on_lan.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/wake_on_lan/wake_on_lan.d.ts b/wake_on_lan/wake_on_lan.d.ts index 46a03eeee..97e4a7177 100644 --- a/wake_on_lan/wake_on_lan.d.ts +++ b/wake_on_lan/wake_on_lan.d.ts @@ -3,7 +3,6 @@ // Definitions by: Tobias Kahlert // Definitions: https://github.com/SrTobi/DefinitelyTyped -/// /// declare module wol { @@ -70,5 +69,5 @@ declare module wol { declare module 'wake_on_lan' { var wol: wol.Wol; - export = wol; + export = wol; } From 66efc690ae79f9c43f7f9fbbaa1910fd1f3a9310 Mon Sep 17 00:00:00 2001 From: zoetrope Date: Mon, 23 Nov 2015 15:38:59 +0900 Subject: [PATCH 103/389] ui-grid: fixed type for SELECT filter --- ui-grid/ui-grid.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui-grid/ui-grid.d.ts b/ui-grid/ui-grid.d.ts index 06d6314c0..e6dd7468d 100644 --- a/ui-grid/ui-grid.d.ts +++ b/ui-grid/ui-grid.d.ts @@ -3857,7 +3857,7 @@ declare module uiGrid { * defaults to uiGridConstants.filter.INPUT, which gives a text box. If set to uiGridConstants.filter.SELECT * then a select box will be shown with options selectOptions */ - type?: number; + type?: number | string; /** * options in the format [{ value: 1, label: 'male' }]. No i18n filter is provided, you need to perform the i18n * on the values before you provide them @@ -3870,7 +3870,7 @@ declare module uiGrid { disableCancelButton?: boolean; } export interface ISelectOption { - value: number; + value: number | string; label: string; } From bfe9aff4a027ce97032b1e656a5014a2e93d57c4 Mon Sep 17 00:00:00 2001 From: Dan Lewi Harkestad Date: Mon, 23 Nov 2015 10:39:49 +0100 Subject: [PATCH 104/389] Fixed a comma that should've been a semicolon. --- highcharts/highcharts.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/highcharts/highcharts.d.ts b/highcharts/highcharts.d.ts index 94277ca25..e86d4b86c 100644 --- a/highcharts/highcharts.d.ts +++ b/highcharts/highcharts.d.ts @@ -1304,7 +1304,7 @@ interface HighchartsChartOptions3dFrame { * @default 'transparent' * @since 4.0 */ - color?: string | HighchartsGradient, + color?: string | HighchartsGradient; /** * Thickness of the panel. * @default 1 From 5493d5794119f043952b60b1da3c6a26fc476b1a Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Mon, 23 Nov 2015 17:51:48 +0500 Subject: [PATCH 105/389] lodash: signatures of _.at have been changed --- lodash/lodash-tests.ts | 39 ++++++++++++++++++++++++++++----------- lodash/lodash.d.ts | 20 +++++++++++++++++--- 2 files changed, 45 insertions(+), 14 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 30c0b9934..5665fc56d 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -2557,17 +2557,34 @@ module TestAny { } // _.at -{ - let testAtArray: TResult[]; - let testAtList: _.List; - let testAtDictionary: _.Dictionary; - let result: TResult[]; - result = _.at(testAtArray, 0, '1', [2], ['3'], [4, '5']); - result = _.at(testAtList, 0, '1', [2], ['3'], [4, '5']); - result = _.at(testAtDictionary, 0, '1', [2], ['3'], [4, '5']); - result = _(testAtArray).at(0, '1', [2], ['3'], [4, '5']).value(); - result = _(testAtList).at(0, '1', [2], ['3'], [4, '5']).value(); - result = _(testAtDictionary).at(0, '1', [2], ['3'], [4, '5']).value(); +module TestAt { + let array: TResult[]; + let list: _.List; + let dictionary: _.Dictionary; + + { + let result: TResult[]; + + result = _.at(array, 0, '1', [2], ['3'], [4, '5']); + result = _.at(list, 0, '1', [2], ['3'], [4, '5']); + result = _.at(dictionary, 0, '1', [2], ['3'], [4, '5']); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).at(0, '1', [2], ['3'], [4, '5']); + result = _(list).at(0, '1', [2], ['3'], [4, '5']); + result = _(dictionary).at(0, '1', [2], ['3'], [4, '5']); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().at(0, '1', [2], ['3'], [4, '5']); + result = _(list).chain().at(0, '1', [2], ['3'], [4, '5']); + result = _(dictionary).chain().at(0, '1', [2], ['3'], [4, '5']); + } } // _.collect diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 73a783b64..ebce26c02 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -3793,7 +3793,7 @@ declare module _ { */ at( collection: List|Dictionary, - ...props: Array> + ...props: (number|string|(number|string)[])[] ): T[]; } @@ -3801,14 +3801,28 @@ declare module _ { /** * @see _.at */ - at(...props: Array>): LoDashImplicitArrayWrapper; + at(...props: (number|string|(number|string)[])[]): LoDashImplicitArrayWrapper; } interface LoDashImplicitObjectWrapper { /** * @see _.at */ - at(...props: Array>): LoDashImplicitArrayWrapper; + at(...props: (number|string|(number|string)[])[]): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.at + */ + at(...props: (number|string|(number|string)[])[]): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.at + */ + at(...props: (number|string|(number|string)[])[]): LoDashExplicitArrayWrapper; } //_.collect From 01e43b6ec754c0d741b19ae97f7b66cde0a6f92b Mon Sep 17 00:00:00 2001 From: ami Date: Mon, 23 Nov 2015 21:57:48 +0900 Subject: [PATCH 106/389] fix typo resolvedResponseType --- protobufjs/protobufjs-tests.ts | 2 +- protobufjs/protobufjs.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/protobufjs/protobufjs-tests.ts b/protobufjs/protobufjs-tests.ts index f20efec3c..94afba0a8 100644 --- a/protobufjs/protobufjs-tests.ts +++ b/protobufjs/protobufjs-tests.ts @@ -409,7 +409,7 @@ function assertIsRPCMethod(rpc: ProtoBuf.ReflectRPCMethod, name: string) { assertIsMethod(rpc, name); assertIsMessage(rpc.resolvedRequestType, name + ".resolvedRequestType"); - assertIsMessage(rpc.resolveResponseType, name + ".resolvedResponsetype"); + assertIsMessage(rpc.resolvedResponseType, name + ".resolvedResponsetype"); } testProtoBufJs(); diff --git a/protobufjs/protobufjs.d.ts b/protobufjs/protobufjs.d.ts index 7133df6f6..ec8131e7f 100644 --- a/protobufjs/protobufjs.d.ts +++ b/protobufjs/protobufjs.d.ts @@ -379,7 +379,7 @@ declare module ProtoBuf { requestName: string; responseName: string; resolvedRequestType: ReflectMessage; - resolveResponseType: ReflectMessage; + resolvedResponseType: ReflectMessage; } } From ba3d78e4b5965cedf44a52e9c36fb72932352c16 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Mon, 23 Nov 2015 15:36:53 +0100 Subject: [PATCH 107/389] Update gulp-tslint to version 3.6.0 --- gulp-tslint/gulp-tslint-tests.ts | 85 ++++++++++++++++++++++---------- gulp-tslint/gulp-tslint.d.ts | 31 +++++++----- 2 files changed, 78 insertions(+), 38 deletions(-) diff --git a/gulp-tslint/gulp-tslint-tests.ts b/gulp-tslint/gulp-tslint-tests.ts index fd4b1fe88..8658f103f 100644 --- a/gulp-tslint/gulp-tslint-tests.ts +++ b/gulp-tslint/gulp-tslint-tests.ts @@ -1,17 +1,36 @@ -/// +/// /// /// -import gulp = require("gulp"); -import tslint = require("gulp-tslint"); -import vinyl = require("vinyl"); + +import * as gulp from 'gulp'; +import * as tslint from 'gulp-tslint'; +import vinyl = require('vinyl'); + +// Taken from gulp-tslint README https://github.com/panuhorsmalahti/gulp-tslint/blob/master/README.md gulp.task('tslint', function(){ - gulp.src('source.ts') + return gulp.src('source.ts') .pipe(tslint()) .pipe(tslint.report('verbose')); }); -/* Output is in the following form: +gulp.task('invalid-noemit', function(){ + return gulp.src('input.ts') + .pipe(tslint()) + .pipe(tslint.report('prose', { + emitError: false + })); +}); + +gulp.task('invalid-noemit', function(){ + return gulp.src('input.ts') + .pipe(tslint()) + .pipe(tslint.report('prose', { + summarizeFailureOutput: true + })); +}); + +/* output is in the following form: * [{ * "name": "invalid.ts", * "failure": "missing whitespace", @@ -21,41 +40,55 @@ gulp.task('tslint', function(){ * "ruleName": "one-line" * }] */ -var testReporter = function (output: tslint.Output[], file: vinyl, options: tslint.Options) { +const testReporter: tslint.Reporter = function (output, file, options) { // file is a reference to the vinyl File object console.log("Found " + output.length + " errors in " + file.path); - // options is a reference to the reporter options, e.g. options.emitError + // options is a reference to the reporter options, e.g. including the emitError boolean }; gulp.task('invalid-custom', function(){ - gulp.src('invalid.ts') + return gulp.src('input.ts') .pipe(tslint()) .pipe(tslint.report(testReporter)); }); -gulp.task('invalid-custom', function () { - gulp.src('invalid.ts') - .pipe(tslint()) - .pipe(tslint.report(testReporter, { emitError: false })); -}); - gulp.task('tslint-json', function(){ - gulp.src('invalid.ts') + return gulp.src('input.ts') .pipe(tslint({ configuration: { - rules: { - "class-name": true - // ... - } + rules: { + "class-name": true, + // ... + } } })) .pipe(tslint.report('prose'));; }); -gulp.task("lint", () => { - return gulp.src(["gulpfile.ts", "{src,test}/**/*.ts"]) - .pipe(tslint()) - .pipe(tslint.report("verbose", { - emitError: true - })); +gulp.task('tslint', function(){ + return gulp.src(['input.ts',]) + .pipe(tslint()) + .pipe(tslint.report('prose', { + reportLimit: 2 + })); }); + + +gulp.task('tslint', function(){ + return gulp.src(['input.ts',]) + .pipe(tslint({ + tslint: require('tslint') + })); +}); + +const tslintOptions: tslint.Options = { + configuration: {}, + rulesDirectory: null, + tslint: null +}; + +const reportOptions: tslint.ReportOptions = { + emitError: true, + reportLimit: 0, + summarizeFailureOutput: false +}; diff --git a/gulp-tslint/gulp-tslint.d.ts b/gulp-tslint/gulp-tslint.d.ts index 99b990277..75c32718b 100644 --- a/gulp-tslint/gulp-tslint.d.ts +++ b/gulp-tslint/gulp-tslint.d.ts @@ -1,4 +1,4 @@ -// Type definitions for gulp-tslint +// Type definitions for gulp-tslint 3.6.0 // Project: https://github.com/panuhorsmalahti/gulp-tslint // Definitions by: Asana // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -9,13 +9,23 @@ declare module "gulp-tslint" { import vinyl = require("vinyl"); - function GulpTsLint(opts?: GulpTsLint.Options): NodeJS.ReadWriteStream; + namespace gulpTsLint { + interface GulpTsLint { + (options?: Options): NodeJS.ReadWriteStream; + report(reporter?: Reporter, options?: ReportOptions): NodeJS.ReadWriteStream; + report(options?: ReportOptions): NodeJS.ReadWriteStream; + } - module GulpTsLint { interface Options { - configuration?: {}; - rulesDirectory?: string; - emitError?: boolean; + configuration?: {}, + rulesDirectory?: string, + tslint?: GulpTsLint + } + + interface ReportOptions { + emitError?: boolean, + reportLimit?: number, + summarizeFailureOutput?: boolean } interface Position { @@ -32,12 +42,9 @@ declare module "gulp-tslint" { ruleName: string; } - type Reporter = string|((output: Output[], file: vinyl, options: Options) => any); - export function report(reporter?: Reporter, options?: Options): NodeJS.ReadWriteStream; - export function report(options?: Options): NodeJS.ReadWriteStream; - + type Reporter = string|((output: Output[], file: vinyl, options: ReportOptions) => any); } - export = GulpTsLint; + var gulpTsLint: gulpTsLint.GulpTsLint; + export = gulpTsLint; } - From d14f555305c0d946ddde7aae4328be00071c4883 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Ewerl=C3=B6f?= Date: Mon, 23 Nov 2015 18:58:09 +0100 Subject: [PATCH 108/389] removed the empty file --- jasmine-matchers/jasmine-matchers-tests.ts.tscparams | 1 - 1 file changed, 1 deletion(-) delete mode 100644 jasmine-matchers/jasmine-matchers-tests.ts.tscparams diff --git a/jasmine-matchers/jasmine-matchers-tests.ts.tscparams b/jasmine-matchers/jasmine-matchers-tests.ts.tscparams deleted file mode 100644 index d3f5a12fa..000000000 --- a/jasmine-matchers/jasmine-matchers-tests.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ - From b51e822a32abc08c8965d589389a48157d88d0a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Ewerl=C3=B6f?= Date: Mon, 23 Nov 2015 18:58:24 +0100 Subject: [PATCH 109/389] added the definitions for jamie mason's jasmine-matchers --- .../jamiemason-jasmine-matchers.d.ts | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 jasmine-matchers/jamiemason-jasmine-matchers.d.ts diff --git a/jasmine-matchers/jamiemason-jasmine-matchers.d.ts b/jasmine-matchers/jamiemason-jasmine-matchers.d.ts new file mode 100644 index 000000000..119cccb89 --- /dev/null +++ b/jasmine-matchers/jamiemason-jasmine-matchers.d.ts @@ -0,0 +1,108 @@ +// Type definitions for jasmine-matchers 2.0.0-beta2 +// Project: https://github.com/JamieMason/Jasmine-Matchers +// Definitions by: UserPixel +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/* +Typings 2015 UserPixel + +TypeScript tests auto-extracted from jasmine-matchers unit test. + +Original jasmine-matchers license applies: + +Copyright (C) 2013, uxebu Inc. + +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 jasmine { + interface Matchers { + // These functions are written in the order defined in the src directory of jasmine-matchers + // The type system is used smartly whenever it can provide value (by looking at the code of every matcher) + toBeAfter(otherDate: Date, actualDate: Date): boolean; // + toBeArray(actualArray: any[]): boolean; // + toBeArrayOfBooleans(actualArray: any[]): boolean; // + toBeArrayOfNumbers(actualArray: any[]): boolean; + toBeArrayOfObjects(actualArray: any[]): boolean; + toBeArrayOfSize(size: number, actualArray: any[]): boolean; + toBeArrayOfStrings(actualArray: any[]): boolean; + toBeBefore(otherDate: Date, actualDate: Date): boolean; // + toBeBoolean(actual: boolean): boolean; + toBeCalculable(actual: number): boolean; + toBeDate(actual: Date): boolean; + toBeEmptyArray(actualArray: any[]): boolean; + toBeEmptyObject(actual: {}): boolean; + toBeEmptyString(actual: string): boolean; + toBeEvenNumber(actual: number): boolean; + toBeFalse(actual: boolean): boolean; + toBeFunction(actual: any): boolean; + toBeHtmlString(actual: string): boolean; + toBeIso8601(actual: string): boolean; + toBeJsonString(actual: string): boolean; + toBeLongerThan(actual: string): boolean; + toBeNonEmptyArray(actualArray: any[]): boolean; + toBeNonEmptyObject(actual: {}): boolean; + toBeNonEmptyString(actual: string): boolean; + toBeNumber(actual: number): boolean; + toBeObject(actual: {}): boolean; + toBeOddNumber(actual: number): boolean; + toBeSameLengthAs(other: string, actual: string): boolean; + toBeShorterThan(other: string, actual: string): boolean; + toBeString(actual: string): boolean; + toBeTrue(actual: boolean): boolean; + toBeWhitespace(actual: string): boolean; + toBeWholeNumber(actual: number): boolean; + toBeWithinRange(floor: number, ceiling: number, actual: number): boolean; + + toEndWith(subString: string, actual: string): boolean; + + toHaveArray(key: string, actual: {}): boolean; + toHaveArrayOfBooleans(key: string, actual: {}): boolean; + toHaveArrayOfNumbers(key: string, actual: {}): boolean; + toHaveArrayOfObjects(key: string, actual: {}): boolean; + toHaveArrayOfSize(key: string, size: number, actual: {}): boolean; + toHaveArrayOfStrings(key: string, actual: {}): boolean; + toHaveBoolean(key: string, actual: {}): boolean; + toHaveCalculable(key: string, actual: {}): boolean; + toHaveDate(key: string, actual: {}): boolean; + toHaveDateAfter(key: string, actual: {}): boolean; + toHaveDateBefore(key: string, actual: {}): boolean; + toHaveEmptyArray(key: string, actual: {}): boolean; + toHaveEmptyObject(key: string, actual: {}): boolean; + toHaveEmptyString(key: string, actual: {}): boolean; + toHaveEvenNumber(key: string, actual: {}): boolean; + toHaveFalse(key: string, actual: {}): boolean; + toHaveHtmlString(key: string, actual: {}): boolean; + toHaveIso8601(key: string, actual: {}): boolean; + toHaveJsonString(key: string, actual: {}): boolean; + toHaveMember(key: string, actual: {}): boolean; + toHaveMethod(key: string, actual: {}): boolean; + toHaveNonEmptyArray(key: string, actual: {}): boolean; + toHaveNonEmptyObject(key: string, actual: {}): boolean; + toHaveNonEmptyString(key: string, actual: {}): boolean; + toHaveNumber(key: string, actual: {}): boolean; + toHaveNumberWithinRange(key: string, actual: {}): boolean; + toHaveObject(key: string, actual: {}): boolean; + toHaveOddNumber(key: string, actual: {}): boolean; + toHaveString(key: string, actual: {}): boolean; + toHaveStringLongerThan(key: string, actual: {}): boolean; + toHaveStringSameLengthAs(key: string, actual: {}): boolean; + toHaveStringShorterThan(key: string, actual: {}): boolean; + toHaveTrue(key: string, actual: {}): boolean; + toHaveWhitespaceString(key: string, actual: {}): boolean; + toHaveWholeNumber(key: string, actual: {}): boolean; + + toImplement(api: {}, actual: {}): boolean; + + toStartWith(subString: string, actual: string): boolean; + + toThrowAnyError(throwerFn: (...any) => any): boolean; + toThrowErrorOfType(type: string, throwerFn: (...any) => any): boolean; + } +} From fd48b8e7d1153c45c4e085d1cd0900d326923c3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Ewerl=C3=B6f?= Date: Mon, 23 Nov 2015 19:00:25 +0100 Subject: [PATCH 110/389] fixd priliminary compiler errors --- jasmine-matchers/jamiemason-jasmine-matchers.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jasmine-matchers/jamiemason-jasmine-matchers.d.ts b/jasmine-matchers/jamiemason-jasmine-matchers.d.ts index 119cccb89..6a2b8a49a 100644 --- a/jasmine-matchers/jamiemason-jasmine-matchers.d.ts +++ b/jasmine-matchers/jamiemason-jasmine-matchers.d.ts @@ -102,7 +102,7 @@ declare module jasmine { toStartWith(subString: string, actual: string): boolean; - toThrowAnyError(throwerFn: (...any) => any): boolean; - toThrowErrorOfType(type: string, throwerFn: (...any) => any): boolean; + toThrowAnyError(throwerFn: () => any): boolean; + toThrowErrorOfType(type: string, throwerFn: () => any): boolean; } } From 8cbcd054b62891994cec69a7ea3cf138d23dcbe2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Ewerl=C3=B6f?= Date: Mon, 23 Nov 2015 19:32:49 +0100 Subject: [PATCH 111/389] added all tests from the original repo and passed all the tests --- .../jamiemason-jasmine-matchers-tests.ts | 1994 +++++++++++++++++ .../jamiemason-jasmine-matchers.d.ts | 148 +- 2 files changed, 2068 insertions(+), 74 deletions(-) create mode 100644 jasmine-matchers/jamiemason-jasmine-matchers-tests.ts diff --git a/jasmine-matchers/jamiemason-jasmine-matchers-tests.ts b/jasmine-matchers/jamiemason-jasmine-matchers-tests.ts new file mode 100644 index 000000000..ade9e8cb5 --- /dev/null +++ b/jasmine-matchers/jamiemason-jasmine-matchers-tests.ts @@ -0,0 +1,1994 @@ +/// +/// + +// Taken directly from the test directory of the original repo + +declare var describeWhenNotArray: (arr: string) => void; +declare var describeToBeArrayOfX: (arr: string, descriptor: {}) => void; +declare var describeToHaveArrayX: (arr: string, descriptor: () => void) => void; +declare var describeToHaveX: (arr: string, descriptor: () => void) => void; +declare var describeToHaveBooleanX: (arr: string, descriptor: () => void) => void; +declare var badReference: {someValue: any}; +var _undefined; + +describe('toBeAfter', function() { + describe('when invoked', function() { + describe('when value is a Date', function() { + describe('when date occurs after another', function() { + it('should confirm', function() { + expect(new Date('2013-01-01T01:00:00.000Z')).toBeAfter(new Date('2013-01-01T00:00:00.000Z')); + }); + }); + describe('when date does NOT occur after another', function() { + it('should deny', function() { + expect(new Date('2013-01-01T00:00:00.000Z')).not.toBeAfter(new Date('2013-01-01T01:00:00.000Z')); + }); + }); + }); + }); +}); + + +describe('toBeArray', function() { + describe('when invoked', function() { + describe('when subject is a true Array', function() { + it('should confirm', function() { + expect([]).toBeArray(); + expect(new Array()).toBeArray(); + }); + }); + describeWhenNotArray('toBeArray'); + }); +}); + + +describe('toBeArrayOfBooleans', function() { + describeToBeArrayOfX('toBeArrayOfBooleans', { + type: 'Boolean', + whenValid: function() { + expect([true]).toBeArrayOfBooleans(); + expect([new Boolean(true)]).toBeArrayOfBooleans(); + expect([new Boolean(false)]).toBeArrayOfBooleans(); + expect([false, true]).toBeArrayOfBooleans(); + }, + whenInvalid: function() { + expect([null]).not.toBeArrayOfBooleans(); + }, + whenMixed: function() { + expect([null, false]).not.toBeArrayOfBooleans(); + expect([null, true]).not.toBeArrayOfBooleans(); + } + }); +}); + + +describe('toBeArrayOfNumbers', function() { + describeToBeArrayOfX('toBeArrayOfNumbers', { + type: 'Number', + whenValid: function() { + expect([1]).toBeArrayOfNumbers(); + expect([new Number(1)]).toBeArrayOfNumbers(); + expect([new Number(0)]).toBeArrayOfNumbers(); + expect([0, 1]).toBeArrayOfNumbers(); + }, + whenInvalid: function() { + expect([null]).not.toBeArrayOfNumbers(); + }, + whenMixed: function() { + expect([null, 0]).not.toBeArrayOfNumbers(); + } + }); +}); + +describe('toBeArrayOfObjects', function() { + describeToBeArrayOfX('toBeArrayOfObjects', { + type: 'Object', + whenValid: function() { + expect([{}, {}]).toBeArrayOfObjects(); + }, + whenInvalid: function() { + expect([null]).not.toBeArrayOfObjects(); + expect(['Object']).not.toBeArrayOfObjects(); + expect(['[object Object]']).not.toBeArrayOfObjects(); + }, + whenMixed: function() { + expect([null, {}]).not.toBeArrayOfObjects(); + } + }); +}); + +describe('toBeArrayOfSize', function() { + describe('when invoked', function() { + describe('when subject is a true Array', function() { + describe('when subject has the expected number of members', function() { + it('should confirm', function() { + expect([]).toBeArrayOfSize(0); + expect([null]).toBeArrayOfSize(1); + expect([false, false]).toBeArrayOfSize(2); + expect([_undefined, _undefined]).toBeArrayOfSize(2); + }); + }); + describe('when subject has an unexpected number of members', function() { + it('should deny', function() { + expect([]).not.toBeArrayOfSize(1); + expect([null]).not.toBeArrayOfSize(0); + expect([true, true]).not.toBeArrayOfSize(1); + }); + }); + }); + describeWhenNotArray('toBeArrayOfSize'); + }); +}); + + +describe('toBeArrayOfStrings', function() { + describeToBeArrayOfX('toBeArrayOfStrings', { + type: 'String', + whenValid: function() { + expect(['truthy']).toBeArrayOfStrings(); + expect([new String('truthy')]).toBeArrayOfStrings(); + expect([new String('')]).toBeArrayOfStrings(); + expect(['', 'truthy']).toBeArrayOfStrings(); + }, + whenInvalid: function() { + expect([null]).not.toBeArrayOfStrings(); + }, + whenMixed: function() { + expect([null, '']).not.toBeArrayOfStrings(); + } + }); +}); + +describe('toBeBefore', function() { + describe('when invoked', function() { + describe('when value is a Date', function() { + describe('when date occurs before another', function() { + it('should confirm', function() { + expect(new Date('2013-01-01T00:00:00.000Z')).toBeBefore(new Date('2013-01-01T01:00:00.000Z')); + }); + }); + describe('when date does NOT occur before another', function() { + it('should deny', function() { + expect(new Date('2013-01-01T01:00:00.000Z')).not.toBeBefore(new Date('2013-01-01T00:00:00.000Z')); + }); + }); + }); + }); +}); + + +describe('toBeBoolean', function() { + describe('when invoked', function() { + describe('when subject not only truthy or falsy, but a boolean', function() { + it('should confirm', function() { + expect(true).toBeBoolean(); + expect(false).toBeBoolean(); + expect(new Boolean(true)).toBeBoolean(); + expect(new Boolean(false)).toBeBoolean(); + }); + }); + describe('when subject is truthy or falsy', function() { + it('should deny', function() { + expect(1).not.toBeBoolean(); + expect(0).not.toBeBoolean(); + }); + }); + }); +}); + +describe('toBeCalculable', function() { + describe('when invoked', function() { + describe('when subject CAN be coerced to be used in mathematical operations', function() { + it('should confirm', function() { + expect('1').toBeCalculable(); + expect('').toBeCalculable(); + expect(null).toBeCalculable(); + }); + }); + describe('when subject can NOT be coerced by JavaScript to be used in mathematical operations', function() { + it('should deny', function() { + expect({}).not.toBeCalculable(); + expect(NaN).not.toBeCalculable(); + }); + }); + }); +}); + +describe('toBeDate', function() { + describe('when invoked', function() { + describe('when value is an instance of Date', function() { + it('should confirm', function() { + expect(new Date()).toBeDate(); + }); + }); + describe('when value is NOT an instance of Date', function() { + it('should deny', function() { + expect(null).not.toBeDate(); + }); + }); + }); +}); + +describe('toBeEmptyArray', function() { + describe('when invoked', function() { + describe('when subject is a true Array', function() { + describe('when subject has members', function() { + it('should confirm', function() { + expect([]).toBeEmptyArray(); + }); + }); + describe('when subject has no members', function() { + it('should deny', function() { + expect([null]).not.toBeEmptyArray(); + expect(['']).not.toBeEmptyArray(); + expect([1]).not.toBeEmptyArray(); + expect([true]).not.toBeEmptyArray(); + expect([false]).not.toBeEmptyArray(); + }); + }); + }); + describeWhenNotArray('toBeEmptyArray'); + }); +}); + +describe('toBeEmptyObject', function() { + beforeEach(function() { + this.Foo = function() {}; + }); + describe('when invoked', function() { + describe('when subject IS an Object with no instance members', function() { + beforeEach(function() { + this.Foo.prototype = { + b: 2 + }; + }); + it('should confirm', function() { + expect(new this.Foo()).toBeEmptyObject(); + expect({}).toBeEmptyObject(); + }); + }); + describe('when subject is NOT an Object with no instance members', function() { + it('should deny', function() { + expect({ + a: 1 + }).not.toBeEmptyObject(); + expect(null).not.toBeNonEmptyObject(); + }); + }); + }); +}); + +describe('toBeEmptyString', function() { + describe('when invoked', function() { + describe('when subject IS a string with no characters', function() { + it('should confirm', function() { + expect('').toBeEmptyString(); + }); + }); + describe('when subject is NOT a string with no characters', function() { + it('should deny', function() { + expect(' ').not.toBeEmptyString(); + }); + }); + }); +}); + +describe('toBeEvenNumber', function() { + describe('when invoked', function() { + describe('when subject IS an even number', function() { + it('should confirm', function() { + expect(2).toBeEvenNumber(); + }); + }); + describe('when subject is NOT an even number', function() { + it('should deny', function() { + expect(1).not.toBeEvenNumber(); + expect(NaN).not.toBeEvenNumber(); + }); + }); + }); +}); + + +describe('toBeFalse', function() { + describe('when invoked', function() { + describe('when subject is not only falsy, but a boolean false', function() { + it('should confirm', function() { + expect(false).toBeFalse(); + expect(new Boolean(false)).toBeFalse(); + }); + }); + describe('when subject is falsy', function() { + it('should deny', function() { + expect(1).not.toBeFalse(); + }); + }); + }); +}); + +describe('toBeFunction', function() { + describe('when invoked', function() { + describe('when subject IS a function', function() { + it('should confirm', function() { + expect(function() {}).toBeFunction(); + }); + }); + describe('when subject is NOT a function', function() { + it('should deny', function() { + expect(/regexp/).not.toBeFunction(); + }); + }); + }); +}); + +describe('toBeHtmlString', function() { + describe('when invoked', function() { + describe('when subject IS a string of HTML markup', function() { + beforeEach(function() { + this.ngMultiLine = ''; + this.ngMultiLine += ''; + this.ngMultiLine += '\n'; + this.ngMultiLine += ' Watch with Google TV'; + this.ngMultiLine += '\n'; + this.ngMultiLine += ''; + this.ngMultiLine += '\n'; + }); + it('should confirm', function() { + expect('text').toBeHtmlString(); + expect('baz').toBeHtmlString(); + expect('
').toBeHtmlString(); + expect('
  • ').toBeHtmlString(); + expect(this.ngMultiLine).toBeHtmlString(); + }); + }); + describe('when subject is NOT a string of HTML markup', function() { + it('should deny', function() { + expect('div').not.toBeHtmlString(); + expect(null).not.toBeHtmlString(); + }); + }); + }); +}); + +describe('toBeIso8601', function() { + describe('when invoked', function() { + describe('when value is a Date String conforming to the ISO 8601 standard', function() { + describe('when specified date is valid', function() { + it('should confirm', function() { + expect('2013-07-08T07:29:15.863Z').toBeIso8601(); + expect('2013-07-08T07:29:15.863').toBeIso8601(); + expect('2013-07-08T07:29:15').toBeIso8601(); + expect('2013-07-08T07:29').toBeIso8601(); + expect('2013-07-08').toBeIso8601(); + }); + }); + describe('when specified date is NOT valid', function() { + it('should deny', function() { + expect('2013-99-12T00:00:00.000Z').not.toBeIso8601(); + expect('2013-12-99T00:00:00.000Z').not.toBeIso8601(); + expect('2013-01-01T99:00:00.000Z').not.toBeIso8601(); + expect('2013-01-01T99:99:00.000Z').not.toBeIso8601(); + expect('2013-01-01T00:00:99.000Z').not.toBeIso8601(); + }); + }); + }); + describe('when value is a String NOT conforming to the ISO 8601 standard', function() { + it('should deny', function() { + expect('2013-07-08T07:29:15.').not.toBeIso8601(); + expect('2013-07-08T07:29:').not.toBeIso8601(); + expect('2013-07-08T07:2').not.toBeIso8601(); + expect('2013-07-08T07:').not.toBeIso8601(); + expect('2013-07-08T07').not.toBeIso8601(); + expect('2013-07-08T').not.toBeIso8601(); + expect('2013-07-0').not.toBeIso8601(); + expect('2013-07-').not.toBeIso8601(); + expect('2013-07').not.toBeIso8601(); + expect('2013-0').not.toBeIso8601(); + expect('2013-').not.toBeIso8601(); + expect('2013').not.toBeIso8601(); + expect('201').not.toBeIso8601(); + expect('20').not.toBeIso8601(); + expect('2').not.toBeIso8601(); + expect('').not.toBeIso8601(); + }); + }); + }); +}); +var _undefined; + +describe('toBeJsonString', function() { + describe('when invoked', function() { + describe('when subject IS a string of parseable JSON', function() { + it('should confirm', function() { + expect('{}').toBeJsonString(); + expect('[]').toBeJsonString(); + expect('[1]').toBeJsonString(); + }); + }); + describe('when subject is NOT a string of parseable JSON', function() { + it('should deny', function() { + expect('[1,]').not.toBeJsonString(); + expect('<>').not.toBeJsonString(); + expect(null).not.toBeJsonString(); + expect('').not.toBeJsonString(); + expect(_undefined).not.toBeJsonString(); + }); + }); + }); +}); + +describe('toBeLongerThan', function() { + describe('when invoked', function() { + describe('when the subject and comparison ARE both strings', function() { + describe('when the subject IS longer than the comparision string', function() { + it('should confirm', function() { + expect('abc').toBeLongerThan('ab'); + expect('a').toBeLongerThan(''); + }); + }); + describe('when the subject is NOT longer than the comparision string', function() { + it('should deny', function() { + expect('ab').not.toBeLongerThan('abc'); + expect('').not.toBeLongerThan('a'); + }); + }); + }); + describe('when the subject and comparison are NOT both strings', function() { + it('should deny (we are asserting the relative lengths of two strings)', function() { + expect('truthy').not.toBeLongerThan(_undefined); + expect(_undefined).not.toBeLongerThan('truthy'); + expect('').not.toBeLongerThan(_undefined); + expect(_undefined).not.toBeLongerThan(''); + }); + }); + }); +}); + +describe('toBeNonEmptyArray', function() { + describe('when invoked', function() { + describe('when subject is a true Array', function() { + describe('when subject has members', function() { + it('should confirm', function() { + expect([null]).toBeNonEmptyArray(); + expect([_undefined]).toBeNonEmptyArray(); + expect(['']).toBeNonEmptyArray(); + }); + }); + describe('when subject has no members', function() { + it('should deny', function() { + expect([]).not.toBeNonEmptyArray(); + }); + }); + }); + describeWhenNotArray('toBeNonEmptyArray'); + }); +}); + +describe('toBeNonEmptyObject', function() { + beforeEach(function() { + this.Foo = function() {}; + }); + describe('when invoked', function() { + describe('when subject IS an Object with at least one instance member', function() { + it('should confirm', function() { + expect({ + a: 1 + }).toBeNonEmptyObject(); + }); + }); + describe('when subject is NOT an Object with at least one instance member', function() { + beforeEach(function() { + this.Foo.prototype = { + b: 2 + }; + }); + it('should deny', function() { + expect(new this.Foo()).not.toBeNonEmptyObject(); + expect({}).not.toBeNonEmptyObject(); + expect(null).not.toBeNonEmptyObject(); + }); + }); + }); +}); + +describe('toBeNonEmptyString', function() { + describe('when invoked', function() { + describe('when subject IS a string with at least one character', function() { + it('should confirm', function() { + expect(' ').toBeNonEmptyString(); + }); + }); + describe('when subject is NOT a string with at least one character', function() { + it('should deny', function() { + expect('').not.toBeNonEmptyString(); + expect(null).not.toBeNonEmptyString(); + }); + }); + }); +}); + +describe('toBeNumber', function() { + describe('when invoked', function() { + describe('when subject IS a number', function() { + it('should confirm', function() { + expect(1).toBeNumber(); + expect(1.11).toBeNumber(); + expect(1e3).toBeNumber(); + expect(0.11).toBeNumber(); + expect(-11).toBeNumber(); + }); + }); + describe('when subject is NOT a number', function() { + it('should deny', function() { + expect('1').not.toBeNumber(); + expect(NaN).not.toBeNumber(); + }); + }); + }); +}); + + +describe('toBeObject', function() { + beforeEach(function() { + this.Foo = function() {}; + }); + describe('when invoked', function() { + describe('when subject IS an Object', function() { + it('should confirm', function() { + expect(new Object()).toBeObject(); + expect(new this.Foo()).toBeObject(); + expect({}).toBeObject(); + }); + }); + describe('when subject is NOT an Object', function() { + it('should deny', function() { + expect(null).not.toBeObject(); + expect(123).not.toBeObject(); + expect('[object Object]').not.toBeObject(); + }); + }); + }); +}); + +describe('toBeOddNumber', function() { + describe('when invoked', function() { + describe('when subject IS an odd number', function() { + it('should confirm', function() { + expect(1).toBeOddNumber(); + }); + }); + describe('when subject is NOT an odd number', function() { + it('should deny', function() { + expect(2).not.toBeOddNumber(); + expect(NaN).not.toBeOddNumber(); + }); + }); + }); +}); +var _undefined; + +describe('toBeSameLengthAs', function() { + describe('when invoked', function() { + describe('when the subject and comparison ARE both strings', function() { + describe('when the subject IS the same length as the comparision string', function() { + it('should confirm', function() { + expect('ab').toBeSameLengthAs('ab'); + }); + }); + describe('when the subject is NOT the same length as the comparision string', function() { + it('should deny', function() { + expect('abc').not.toBeSameLengthAs('ab'); + expect('a').not.toBeSameLengthAs(''); + expect('').not.toBeSameLengthAs('a'); + }); + }); + }); + describe('when the subject and comparison are NOT both strings', function() { + it('should deny (we are asserting the relative lengths of two strings)', function() { + expect('truthy').not.toBeSameLengthAs(_undefined); + expect(_undefined).not.toBeSameLengthAs('truthy'); + expect('').not.toBeSameLengthAs(_undefined); + expect(_undefined).not.toBeSameLengthAs(''); + }); + }); + }); +}); +var _undefined; + +describe('toBeShorterThan', function() { + describe('when invoked', function() { + describe('when the subject and comparison ARE both strings', function() { + describe('when the subject IS shorter than the comparision string', function() { + it('should confirm', function() { + expect('ab').toBeShorterThan('abc'); + expect('').toBeShorterThan('a'); + }); + }); + describe('when the subject is NOT shorter than the comparision string', function() { + it('should deny', function() { + expect('abc').not.toBeShorterThan('ab'); + expect('a').not.toBeShorterThan(''); + }); + }); + }); + describe('when the subject and comparison are NOT both strings', function() { + it('should deny (we are asserting the relative lengths of two strings)', function() { + expect('truthy').not.toBeShorterThan(_undefined); + expect(_undefined).not.toBeShorterThan('truthy'); + expect('').not.toBeShorterThan(_undefined); + expect(_undefined).not.toBeShorterThan(''); + }); + }); + }); +}); + +describe('toBeString', function() { + describe('when invoked', function() { + describe('when subject IS a string of any length', function() { + it('should confirm', function() { + expect('').toBeString(); + expect(' ').toBeString(); + }); + }); + describe('when subject is NOT a string of any length', function() { + it('should deny', function() { + expect(null).not.toBeString(); + }); + }); + }); +}); + + +describe('toBeTrue', function() { + describe('when invoked', function() { + describe('when subject is not only truthy, but a boolean true', function() { + it('should confirm', function() { + expect(true).toBeTrue(); + expect(new Boolean(true)).toBeTrue(); + }); + }); + describe('when subject is truthy', function() { + it('should deny', function() { + expect(1).not.toBeTrue(); + }); + }); + }); +}); + +describe('toBeWhitespace', function() { + describe('when invoked', function() { + describe('when subject IS a string containing only tabs, spaces, returns etc', function() { + it('should confirm', function() { + expect(' ').toBeWhitespace(); + expect('').toBeWhitespace(); + }); + }); + describe('when subject is NOT a string containing only tabs, spaces, returns etc', function() { + it('should deny', function() { + expect('has-no-whitespace').not.toBeWhitespace(); + expect('has whitespace').not.toBeWhitespace(); + expect(null).not.toBeWhitespace(); + }); + }); + }); +}); + +describe('toBeWholeNumber', function() { + describe('when invoked', function() { + describe('when subject IS a number with no positive decimal places', function() { + it('should confirm', function() { + expect(1).toBeWholeNumber(); + expect(0).toBeWholeNumber(); + expect(0.0).toBeWholeNumber(); + }); + }); + describe('when subject is NOT a number with no positive decimal places', function() { + it('should deny', function() { + expect(NaN).not.toBeWholeNumber(); + expect(1.1).not.toBeWholeNumber(); + expect(0.1).not.toBeWholeNumber(); + }); + }); + }); +}); + +describe('toBeWithinRange', function() { + describe('when invoked', function() { + describe('when subject IS a number >= floor and <= ceiling', function() { + it('should confirm', function() { + expect(0).toBeWithinRange(0, 2); + expect(1).toBeWithinRange(0, 2); + expect(2).toBeWithinRange(0, 2); + }); + }); + describe('when subject is NOT a number >= floor and <= ceiling', function() { + it('should deny', function() { + expect(-3).not.toBeWithinRange(0, 2); + expect(-2).not.toBeWithinRange(0, 2); + expect(-1).not.toBeWithinRange(0, 2); + expect(3).not.toBeWithinRange(0, 2); + expect(NaN).not.toBeWithinRange(0, 2); + }); + }); + }); +}); +var _undefined; + +describe('toEndWith', function() { + describe('when invoked', function() { + describe('when subject is NOT an undefined or empty string', function() { + describe('when subject is a string whose trailing characters match the expected string', function() { + it('should confirm', function() { + expect('jamie').toEndWith('mie'); + }); + }); + describe('when subject is a string whose trailing characters DO NOT match the expected string', function() { + it('should deny', function() { + expect('jamie ').not.toEndWith('mie'); + expect('jamiE').not.toEndWith('mie'); + }); + }); + }); + describe('when subject IS an undefined or empty string', function() { + it('should deny', function() { + expect('').not.toEndWith(''); + expect(_undefined).not.toEndWith(''); + expect(_undefined).not.toEndWith('undefined'); + expect('undefined').not.toEndWith(_undefined); + }); + }); + }); +}); + +describe('toHaveArray', function() { + describeToHaveArrayX('toHaveArray', function() { + it('should confirm', function() { + expect({ + memberName: [] + }).toHaveArray('memberName'); + expect({ + memberName: [1, 2, 3] + }).toHaveArray('memberName'); + }); + }); +}); + + +describe('toHaveArrayOfBooleans', function() { + describeToHaveArrayX('toHaveArrayOfBooleans', function() { + describe('when named Array is empty', function() { + it('should confirm', function() { + expect({ + memberName: [] + }).toHaveArrayOfBooleans('memberName'); + }); + }); + describe('when named Array has items', function() { + describe('when all items are booleans', function() { + it('should confirm', function() { + expect({ + memberName: [true] + }).toHaveArrayOfBooleans('memberName'); + expect({ + memberName: [new Boolean(true)] + }).toHaveArrayOfBooleans('memberName'); + expect({ + memberName: [new Boolean(false)] + }).toHaveArrayOfBooleans('memberName'); + expect({ + memberName: [false, true] + }).toHaveArrayOfBooleans('memberName'); + }); + }); + describe('when any item is not a boolean', function() { + it('should deny', function() { + expect({ + memberName: [null] + }).not.toHaveArrayOfBooleans('memberName'); + expect({ + memberName: [null, false] + }).not.toHaveArrayOfBooleans('memberName'); + }); + }); + }); + }); +}); + + +describe('toHaveArrayOfNumbers', function() { + describeToHaveArrayX('toHaveArrayOfNumbers', function() { + describe('when named Array is empty', function() { + it('should confirm', function() { + expect({ + memberName: [] + }).toHaveArrayOfNumbers('memberName'); + }); + }); + describe('when named Array has items', function() { + describe('when all items are numbers', function() { + it('should confirm', function() { + expect({ + memberName: [1] + }).toHaveArrayOfNumbers('memberName'); + expect({ + memberName: [new Number(1)] + }).toHaveArrayOfNumbers('memberName'); + expect({ + memberName: [new Number(0)] + }).toHaveArrayOfNumbers('memberName'); + expect({ + memberName: [0, 1] + }).toHaveArrayOfNumbers('memberName'); + }); + }); + describe('when any item is not a number', function() { + it('should deny', function() { + expect({ + memberName: [null] + }).not.toHaveArrayOfNumbers('memberName'); + expect({ + memberName: [null, 0] + }).not.toHaveArrayOfNumbers('memberName'); + }); + }); + }); + }); +}); + +describe('toHaveArrayOfObjects', function() { + describeToHaveArrayX('toHaveArrayOfObjects', function() { + describe('when named Array is empty', function() { + it('should confirm', function() { + expect({ + memberName: [] + }).toHaveArrayOfObjects('memberName'); + }); + }); + describe('when named Array has items', function() { + describe('when all items are objects', function() { + it('should confirm', function() { + expect({ + memberName: [{}] + }).toHaveArrayOfObjects('memberName'); + expect({ + memberName: [{}, {}] + }).toHaveArrayOfObjects('memberName'); + }); + }); + describe('when any item is not an object', function() { + it('should deny', function() { + expect({ + memberName: [null] + }).not.toHaveArrayOfObjects('memberName'); + expect({ + memberName: [null, {}] + }).not.toHaveArrayOfObjects('memberName'); + }); + }); + }); + }); +}); + +describe('toHaveArrayOfSize', function() { + describeToHaveArrayX('toHaveArrayOfSize', function() { + describe('when number of expected items does not match', function() { + it('should deny', function() { + expect({ + memberName: '' + }).not.toHaveArrayOfSize('memberName'); + expect({ + memberName: ['bar'] + }).not.toHaveArrayOfSize('memberName', 0); + }); + }); + describe('when number of expected items does match', function() { + it('should confirm', function() { + expect({ + memberName: [] + }).toHaveArrayOfSize('memberName', 0); + expect({ + memberName: ['bar'] + }).toHaveArrayOfSize('memberName', 1); + expect({ + memberName: ['bar', 'baz'] + }).toHaveArrayOfSize('memberName', 2); + }); + }); + }); +}); + + +describe('toHaveArrayOfStrings', function() { + describeToHaveArrayX('toHaveArrayOfStrings', function() { + describe('when named Array is empty', function() { + it('should confirm', function() { + expect({ + memberName: [] + }).toHaveArrayOfStrings('memberName'); + }); + }); + describe('when named Array has items', function() { + describe('when all items are strings', function() { + it('should confirm', function() { + expect({ + memberName: ['truthy'] + }).toHaveArrayOfStrings('memberName'); + expect({ + memberName: [new String('truthy')] + }).toHaveArrayOfStrings('memberName'); + expect({ + memberName: [new String('')] + }).toHaveArrayOfStrings('memberName'); + expect({ + memberName: ['', 'truthy'] + }).toHaveArrayOfStrings('memberName'); + }); + }); + describe('when any item is not a string', function() { + it('should deny', function() { + expect({ + memberName: [null] + }).not.toHaveArrayOfStrings('memberName'); + expect({ + memberName: [null, ''] + }).not.toHaveArrayOfStrings('memberName'); + }); + }); + }); + }); +}); + + +describe('toHaveBoolean', function() { + describeToHaveBooleanX('toHaveBoolean', function() { + describe('when primitive', function() { + it('should confirm', function() { + expect({ + memberName: true + }).toHaveBoolean('memberName'); + expect({ + memberName: false + }).toHaveBoolean('memberName'); + }); + }); + describe('when Boolean object', function() { + it('should confirm', function() { + expect({ + memberName: new Boolean(true) + }).toHaveBoolean('memberName'); + expect({ + memberName: new Boolean(false) + }).toHaveBoolean('memberName'); + }); + }); + }); +}); + +describe('toHaveCalculable', function() { + describeToHaveX('toHaveCalculable', function() { + describe('when subject CAN be coerced to be used in mathematical operations', function() { + it('should confirm', function() { + expect({ + memberName: '1' + }).toHaveCalculable('memberName'); + expect({ + memberName: '' + }).toHaveCalculable('memberName'); + expect({ + memberName: null + }).toHaveCalculable('memberName'); + }); + }); + describe('when subject can NOT be coerced by JavaScript to be used in mathematical operations', function() { + it('should deny', function() { + expect({ + memberName: {} + }).not.toHaveCalculable('memberName'); + expect({ + memberName: NaN + }).not.toHaveCalculable('memberName'); + }); + }); + }); +}); + +describe('toHaveDate', function() { + var mockDate; + beforeEach(function() { + mockDate = { + any: new Date(), + early: new Date('2013-01-01T00:00:00.000Z'), + late: new Date('2013-01-01T01:00:00.000Z') + }; + }); + describeToHaveX('toHaveDate', function() { + describe('when member is an instance of Date', function() { + it('should confirm', function() { + expect({ + memberName: mockDate.any + }).toHaveDate('memberName'); + }); + }); + describe('when member is NOT an instance of Date', function() { + it('should deny', function() { + expect({ + memberName: null + }).not.toHaveDate('memberName'); + }); + }); + }); +}); + +describe('toHaveDateAfter', function() { + var mockDate; + beforeEach(function() { + mockDate = { + any: new Date(), + early: new Date('2013-01-01T00:00:00.000Z'), + late: new Date('2013-01-01T01:00:00.000Z') + }; + }); + describeToHaveX('toHaveDateAfter', function() { + describe('when member is an instance of Date', function() { + describe('when date occurs before another', function() { + it('should confirm', function() { + expect({ + memberName: mockDate.late + }).toHaveDateAfter('memberName', mockDate.early); + }); + }); + describe('when date does NOT occur before another', function() { + it('should deny', function() { + expect({ + memberName: mockDate.early + }).not.toHaveDateAfter('memberName', mockDate.late); + }); + }); + }); + describe('when member is NOT an instance of Date', function() { + it('should deny', function() { + expect({ + memberName: null + }).not.toHaveDateAfter('memberName', mockDate.any); + }); + }); + }); +}); + +describeToHaveX('toHaveDateBefore', function() { + var mockDate; + beforeEach(function() { + mockDate = { + any: new Date(), + early: new Date('2013-01-01T00:00:00.000Z'), + late: new Date('2013-01-01T01:00:00.000Z') + }; + }); + describe('when member is an instance of Date', function() { + describe('when date occurs before another', function() { + it('should confirm', function() { + expect({ + memberName: mockDate.early + }).toHaveDateBefore('memberName', mockDate.late); + }); + }); + describe('when date does NOT occur before another', function() { + it('should deny', function() { + expect({ + memberName: mockDate.late + }).not.toHaveDateBefore('memberName', mockDate.early); + }); + }); + }); + describe('when member is NOT an instance of Date', function() { + it('should deny', function() { + expect({ + memberName: null + }).not.toHaveDateBefore('memberName', mockDate.any); + }); + }); +}); + +describe('toHaveEmptyArray', function() { + describeToHaveArrayX('toHaveEmptyArray', function() { + describe('when named array has members', function() { + it('should deny', function() { + expect({ + memberName: [1, 2, 3] + }).not.toHaveEmptyArray('memberName'); + expect({ + memberName: '' + }).not.toHaveEmptyArray('memberName'); + }); + }); + describe('when named array has no members', function() { + it('should confirm', function() { + expect({ + memberName: [] + }).toHaveEmptyArray('memberName'); + }); + }); + }); +}); + +describe('toHaveEmptyObject', function() { + beforeEach(function() { + this.Foo = function() {}; + }); + describeToHaveX('toHaveEmptyObject', function() { + describe('when subject IS an Object with no instance members', function() { + beforeEach(function() { + this.Foo.prototype = { + b: 2 + }; + }); + it('should confirm', function() { + expect({ + memberName: new this.Foo() + }).toHaveEmptyObject('memberName'); + expect({ + memberName: {} + }).toHaveEmptyObject('memberName'); + }); + }); + describe('when subject is NOT an Object with no instance members', function() { + it('should deny', function() { + expect({ + memberName: { + a: 1 + } + }).not.toHaveEmptyObject('memberName'); + expect({ + memberName: null + }).not.toHaveNonEmptyObject('memberName'); + }); + }); + }); +}); + +describe('toHaveEmptyString', function() { + describeToHaveX('toHaveEmptyString', function() { + describe('when subject IS a string with no characters', function() { + it('should confirm', function() { + expect({ + memberName: '' + }).toHaveEmptyString('memberName'); + }); + }); + describe('when subject is NOT a string with no characters', function() { + it('should deny', function() { + expect({ + memberName: ' ' + }).not.toHaveEmptyString('memberName'); + }); + }); + }); +}); + +describe('toHaveEvenNumber', function() { + describeToHaveX('toHaveEvenNumber', function() { + describe('when subject IS an even number', function() { + it('should confirm', function() { + expect({ + memberName: 2 + }).toHaveEvenNumber('memberName'); + }); + }); + describe('when subject is NOT an even number', function() { + it('should deny', function() { + expect({ + memberName: 1 + }).not.toHaveEvenNumber('memberName'); + expect({ + memberName: NaN + }).not.toHaveEvenNumber('memberName'); + }); + }); + }); +}); + +describe('toHaveFalse', function() { + describeToHaveBooleanX('toHaveFalse', function() { + describe('when primitive', function() { + describe('when true', function() { + it('should deny', function() { + expect({ + memberName: true + }).not.toHaveFalse('memberName'); + }); + }); + describe('when false', function() { + it('should confirm', function() { + expect({ + memberName: false + }).toHaveFalse('memberName'); + }); + }); + }); + describe('when Boolean object', function() { + describe('when true', function() { + it('should deny', function() { + expect({ + memberName: new Boolean(true) + }).not.toHaveFalse('memberName'); + }); + }); + describe('when false', function() { + it('should confirm', function() { + expect({ + memberName: new Boolean(false) + }).toHaveFalse('memberName'); + }); + }); + }); + }); +}); + +describe('toHaveHtmlString', function() { + describeToHaveX('toHaveHtmlString', function() { + describe('when subject IS a string of HTML markup', function() { + beforeEach(function() { + this.ngMultiLine = ''; + this.ngMultiLine += ''; + this.ngMultiLine += '\n'; + this.ngMultiLine += ' Watch with Google TV'; + this.ngMultiLine += '\n'; + this.ngMultiLine += ''; + this.ngMultiLine += '\n'; + }); + it('should confirm', function() { + expect({ + memberName: 'text' + }).toHaveHtmlString('memberName'); + expect({ + memberName: 'baz' + }).toHaveHtmlString('memberName'); + expect({ + memberName: '
    ' + }).toHaveHtmlString('memberName'); + expect({ + memberName: '
  • ' + }).toHaveHtmlString('memberName'); + expect({ + memberName: this.ngMultiLine + }).toHaveHtmlString('memberName'); + }); + }); + describe('when subject is NOT a string of HTML markup', function() { + it('should deny', function() { + expect({ + memberName: 'div' + }).not.toHaveHtmlString('memberName'); + expect({ + memberName: null + }).not.toHaveHtmlString('memberName'); + }); + }); + }); +}); + +describe('toHaveIso8601', function() { + describeToHaveX('toHaveIso8601', function() { + describe('when member is a Date String conforming to the ISO 8601 standard', + function() { + describe('when specified date is valid', function() { + it('should confirm', function() { + expect({ + memberName: '2013-07-08T07:29:15.863Z' + }).toHaveIso8601('memberName'); + expect({ + memberName: '2013-07-08T07:29:15.863' + }).toHaveIso8601('memberName'); + expect({ + memberName: '2013-07-08T07:29:15' + }).toHaveIso8601('memberName'); + expect({ + memberName: '2013-07-08T07:29' + }).toHaveIso8601('memberName'); + expect({ + memberName: '2013-07-08' + }).toHaveIso8601('memberName'); + }); + }); + describe('when specified date is NOT valid', function() { + it('should deny', function() { + expect({ + memberName: '2013-99-12T00:00:00.000Z' + }).not.toHaveIso8601('memberName'); + expect({ + memberName: '2013-12-99T00:00:00.000Z' + }).not.toHaveIso8601('memberName'); + expect({ + memberName: '2013-01-01T99:00:00.000Z' + }).not.toHaveIso8601('memberName'); + expect({ + memberName: '2013-01-01T99:99:00.000Z' + }).not.toHaveIso8601('memberName'); + expect({ + memberName: '2013-01-01T00:00:99.000Z' + }).not.toHaveIso8601('memberName'); + }); + }); + }); + describe('when member is a String NOT conforming to the ISO 8601 standard', + function() { + it('should deny', function() { + expect({ + memberName: '2013-07-08T07:29:15.' + }).not.toHaveIso8601('memberName'); + expect({ + memberName: '2013-07-08T07:29:' + }).not.toHaveIso8601('memberName'); + expect({ + memberName: '2013-07-08T07:2' + }).not.toHaveIso8601('memberName'); + expect({ + memberName: '2013-07-08T07:' + }).not.toHaveIso8601('memberName'); + expect({ + memberName: '2013-07-08T07' + }).not.toHaveIso8601('memberName'); + expect({ + memberName: '2013-07-08T' + }).not.toHaveIso8601('memberName'); + expect({ + memberName: '2013-07-0' + }).not.toHaveIso8601('memberName'); + expect({ + memberName: '2013-07-' + }).not.toHaveIso8601('memberName'); + expect({ + memberName: '2013-07' + }).not.toHaveIso8601('memberName'); + expect({ + memberName: '2013-0' + }).not.toHaveIso8601('memberName'); + expect({ + memberName: '2013-' + }).not.toHaveIso8601('memberName'); + expect({ + memberName: '2013' + }).not.toHaveIso8601('memberName'); + expect({ + memberName: '201' + }).not.toHaveIso8601('memberName'); + expect({ + memberName: '20' + }).not.toHaveIso8601('memberName'); + expect({ + memberName: '2' + }).not.toHaveIso8601('memberName'); + expect({ + memberName: '' + }).not.toHaveIso8601('memberName'); + }); + }); + }); +}); + +describe('toHaveJsonString', function() { + describeToHaveX('toHaveJsonString', function() { + describe('when subject IS a string of parseable JSON', function() { + it('should confirm', function() { + expect({ + memberName: '{}' + }).toHaveJsonString('memberName'); + expect({ + memberName: '[]' + }).toHaveJsonString('memberName'); + expect({ + memberName: '[1]' + }).toHaveJsonString('memberName'); + }); + }); + describe('when subject is NOT a string of parseable JSON', function() { + it('should deny', function() { + expect({ + memberName: '[1,]' + }).not.toHaveJsonString('memberName'); + expect({ + memberName: '<>' + }).not.toHaveJsonString('memberName'); + expect({ + memberName: null + }).not.toHaveJsonString('memberName'); + expect({ + memberName: '' + }).not.toHaveJsonString('memberName'); + expect({ + memberName: _undefined + }).not.toHaveJsonString('memberName'); + }); + }); + }); +}); + +describe('toHaveMember', function() { + describeToHaveX('toHaveMember', function() {}); +}); + +describe('toHaveMethod', function() { + describeToHaveX('toHaveMethod', function() { + describe('when subject IS a function', function() { + it('should confirm', function() { + expect({ + memberName: function() {} + }).toHaveMethod('memberName'); + }); + }); + describe('when subject is NOT a function', function() { + it('should deny', function() { + expect({ + memberName: /regexp/ + }).not.toHaveMethod('memberName'); + }); + }); + }); +}); + +describe('toHaveNonEmptyArray', function() { + describeToHaveArrayX('toHaveNonEmptyArray', function() { + describe('when named array has no members', function() { + it('should deny', function() { + expect({ + memberName: [] + }).not.toHaveNonEmptyArray('memberName'); + }); + }); + describe('when named array has members', function() { + it('should confirm', function() { + expect({ + memberName: [1, 2, 3] + }).toHaveNonEmptyArray('memberName'); + }); + }); + }); +}); + +describe('toHaveNonEmptyObject', function() { + describeToHaveX('toHaveNonEmptyObject', function() { + beforeEach(function() { + this.Foo = function() {}; + }); + describe('when subject IS an Object with at least one instance member', function() { + it('should confirm', function() { + expect({ + memberName: { + a: 1 + } + }).toHaveNonEmptyObject('memberName'); + }); + }); + describe('when subject is NOT an Object with at least one instance member', function() { + beforeEach(function() { + this.Foo.prototype = { + b: 2 + }; + }); + it('should deny', function() { + expect({ + memberName: new this.Foo() + }).not.toHaveNonEmptyObject('memberName'); + expect({ + memberName: {} + }).not.toHaveNonEmptyObject('memberName'); + expect({ + memberName: null + }).not.toHaveNonEmptyObject('memberName'); + }); + }); + }); +}); + +describe('toHaveNonEmptyString', function() { + describeToHaveX('toHaveNonEmptyString', function() { + describe('when subject IS a string with at least one character', function() { + it('should confirm', function() { + expect({ + memberName: ' ' + }).toHaveNonEmptyString('memberName'); + }); + }); + describe('when subject is NOT a string with at least one character', function() { + it('should deny', function() { + expect({ + memberName: '' + }).not.toHaveNonEmptyString('memberName'); + expect({ + memberName: null + }).not.toHaveNonEmptyString('memberName'); + }); + }); + }); +}); + +describe('toHaveNumber', function() { + describeToHaveX('toHaveNumber', function() { + describe('when subject IS a number', function() { + it('should confirm', function() { + expect({ + memberName: 1 + }).toHaveNumber('memberName'); + expect({ + memberName: 1.11 + }).toHaveNumber('memberName'); + expect({ + memberName: 1e3 + }).toHaveNumber('memberName'); + expect({ + memberName: 0.11 + }).toHaveNumber('memberName'); + expect({ + memberName: -11 + }).toHaveNumber('memberName'); + }); + }); + describe('when subject is NOT a number', function() { + it('should deny', function() { + expect({ + memberName: '1' + }).not.toHaveNumber('memberName'); + expect({ + memberName: NaN + }).not.toHaveNumber('memberName'); + }); + }); + }); +}); + +describe('toHaveNumberWithinRange', function() { + describeToHaveX('toHaveNumberWithinRange', function() { + describe('when subject IS a number >= floor and <= ceiling', function() { + it('should confirm', function() { + expect({ + memberName: 0 + }).toHaveNumberWithinRange('memberName', 0, 2); + expect({ + memberName: 1 + }).toHaveNumberWithinRange('memberName', 0, 2); + expect({ + memberName: 2 + }).toHaveNumberWithinRange('memberName', 0, 2); + }); + }); + describe('when subject is NOT a number >= floor and <= ceiling', function() { + it('should deny', function() { + expect({ + memberName: -3 + }).not.toHaveNumberWithinRange('memberName', 0, 2); + expect({ + memberName: -2 + }).not.toHaveNumberWithinRange('memberName', 0, 2); + expect({ + memberName: -1 + }).not.toHaveNumberWithinRange('memberName', 0, 2); + expect({ + memberName: 3 + }).not.toHaveNumberWithinRange('memberName', 0, 2); + expect({ + memberName: NaN + }).not.toHaveNumberWithinRange('memberName', 0, 2); + }); + }); + }); +}); + +describe('toHaveObject', function() { + describeToHaveX('toHaveObject', function() { + beforeEach(function() { + this.Foo = function() {}; + }); + describe('when subject IS an Object', function() { + it('should confirm', function() { + expect({ + memberName: new Object() + }).toHaveObject('memberName'); + expect({ + memberName: new this.Foo() + }).toHaveObject('memberName'); + expect({ + memberName: {} + }).toHaveObject('memberName'); + }); + }); + describe('when subject is NOT an Object', function() { + it('should deny', function() { + expect({ + memberName: null + }).not.toHaveObject('memberName'); + expect({ + memberName: 123 + }).not.toHaveObject('memberName'); + expect({ + memberName: '[object Object]' + }).not.toHaveObject('memberName'); + }); + }); + }); +}); + +describe('toHaveOddNumber', function() { + describeToHaveX('toHaveOddNumber', function() { + describe('when subject IS an odd number', function() { + it('should confirm', function() { + expect({ + memberName: 1 + }).toHaveOddNumber('memberName'); + }); + }); + describe('when subject is NOT an odd number', function() { + it('should deny', function() { + expect({ + memberName: 2 + }).not.toHaveOddNumber('memberName'); + expect({ + memberName: NaN + }).not.toHaveOddNumber('memberName'); + }); + }); + }); +}); + +describe('toHaveString', function() { + describeToHaveX('toHaveString', function() { + describe('when subject IS a string of any length', function() { + it('should confirm', function() { + expect({ + memberName: '' + }).toHaveString('memberName'); + expect({ + memberName: ' ' + }).toHaveString('memberName'); + }); + }); + describe('when subject is NOT a string of any length', function() { + it('should deny', function() { + expect({ + memberName: null + }).not.toHaveString('memberName'); + }); + }); + }); +}); + +describe('toHaveStringLongerThan', function() { + describeToHaveX('toHaveStringLongerThan', function() { + describe('when the subject and comparison ARE both strings', function() { + describe('when the subject IS longer than the comparision string', function() { + it('should confirm', function() { + expect({ + memberName: 'abc' + }).toHaveStringLongerThan('memberName', 'ab'); + expect({ + memberName: 'a' + }).toHaveStringLongerThan('memberName', ''); + }); + }); + describe('when the subject is NOT longer than the comparision string', function() { + it('should deny', function() { + expect({ + memberName: 'ab' + }).not.toHaveStringLongerThan('memberName', 'abc'); + expect({ + memberName: '' + }).not.toHaveStringLongerThan('memberName', 'a'); + }); + }); + }); + describe('when the subject and comparison are NOT both strings', function() { + it('should deny (we are asserting the relative lengths of two strings)', function() { + expect({ + memberName: 'truthy' + }).not.toHaveStringLongerThan('memberName', _undefined); + expect({ + memberName: _undefined + }).not.toHaveStringLongerThan('memberName', 'truthy'); + expect({ + memberName: '' + }).not.toHaveStringLongerThan('memberName', _undefined); + expect({ + memberName: _undefined + }).not.toHaveStringLongerThan('memberName', ''); + }); + }); + }); +}); + +describe('toHaveStringSameLengthAs', function() { + describeToHaveX('toHaveStringSameLengthAs', function() { + describe('when the subject and comparison ARE both strings', function() { + describe('when the subject IS the same length as the comparision string', function() { + it('should confirm', function() { + expect({ + memberName: 'ab' + }).toHaveStringSameLengthAs('memberName', 'ab'); + }); + }); + describe('when the subject is NOT the same length as the comparision string', function() { + it('should deny', function() { + expect({ + memberName: 'abc' + }).not.toHaveStringSameLengthAs('memberName', 'ab'); + expect({ + memberName: 'a' + }).not.toHaveStringSameLengthAs('memberName', ''); + expect({ + memberName: '' + }).not.toHaveStringSameLengthAs('memberName', 'a'); + }); + }); + }); + describe('when the subject and comparison are NOT both strings', function() { + it('should deny (we are asserting the relative lengths of two strings)', function() { + expect({ + memberName: 'truthy' + }).not.toHaveStringSameLengthAs('memberName', _undefined); + expect({ + memberName: _undefined + }).not.toHaveStringSameLengthAs('memberName', 'truthy'); + expect({ + memberName: '' + }).not.toHaveStringSameLengthAs('memberName', _undefined); + expect({ + memberName: _undefined + }).not.toHaveStringSameLengthAs('memberName', ''); + }); + }); + }); +}); + +describe('toHaveStringShorterThan', function() { + describeToHaveX('toHaveStringShorterThan', function() { + describe('when the subject and comparison ARE both strings', function() { + describe('when the subject IS shorter than the comparision string', function() { + it('should confirm', function() { + expect({ + memberName: 'ab' + }).toHaveStringShorterThan('memberName', 'abc'); + expect({ + memberName: '' + }).toHaveStringShorterThan('memberName', 'a'); + }); + }); + describe('when the subject is NOT shorter than the comparision string', function() { + it('should deny', function() { + expect({ + memberName: 'abc' + }).not.toHaveStringShorterThan('memberName', 'ab'); + expect({ + memberName: 'a' + }).not.toHaveStringShorterThan('memberName', ''); + }); + }); + }); + describe('when the subject and comparison are NOT both strings', function() { + it('should deny (we are asserting the relative lengths of two strings)', function() { + expect({ + memberName: 'truthy' + }).not.toHaveStringShorterThan('memberName', _undefined); + expect({ + memberName: _undefined + }).not.toHaveStringShorterThan('memberName', 'truthy'); + expect({ + memberName: '' + }).not.toHaveStringShorterThan('memberName', _undefined); + expect({ + memberName: _undefined + }).not.toHaveStringShorterThan('memberName', ''); + }); + }); + }); +}); + + +describe('toHaveTrue', function() { + describeToHaveBooleanX('toHaveTrue', function() { + describe('when primitive', function() { + describe('when true', function() { + it('should confirm', function() { + expect({ + memberName: true + }).toHaveTrue('memberName'); + }); + }); + describe('when false', function() { + it('should deny', function() { + expect({ + memberName: false + }).not.toHaveTrue('memberName'); + }); + }); + }); + describe('when Boolean object', function() { + describe('when true', function() { + it('should confirm', function() { + expect({ + memberName: new Boolean(true) + }).toHaveTrue('memberName'); + }); + }); + describe('when false', function() { + it('should deny', function() { + expect({ + memberName: new Boolean(false) + }).not.toHaveTrue('memberName'); + }); + }); + }); + }); +}); + +describe('toHaveWhitespaceString', function() { + describeToHaveX('toHaveWhitespaceString', function() { + describe('when subject IS a string containing only tabs, spaces, returns etc', function() { + it('should confirm', function() { + expect({ + memberName: ' ' + }).toHaveWhitespaceString('memberName'); + expect({ + memberName: '' + }).toHaveWhitespaceString('memberName'); + }); + }); + describe('when subject is NOT a string containing only tabs, spaces, returns etc', function() { + it('should deny', function() { + expect({ + memberName: 'has-no-whitespace' + }).not.toHaveWhitespaceString('memberName'); + expect({ + memberName: 'has whitespace' + }).not.toHaveWhitespaceString('memberName'); + expect({ + memberName: null + }).not.toHaveWhitespaceString('memberName'); + }); + }); + }); +}); + +describe('toHaveWholeNumber', function() { + describeToHaveX('toHaveWholeNumber', function() { + describe('when subject IS a number with no positive decimal places', function() { + it('should confirm', function() { + expect({ + memberName: 1 + }).toHaveWholeNumber('memberName'); + expect({ + memberName: 0 + }).toHaveWholeNumber('memberName'); + expect({ + memberName: 0.0 + }).toHaveWholeNumber('memberName'); + }); + }); + describe('when subject is NOT a number with no positive decimal places', function() { + it('should deny', function() { + expect({ + memberName: NaN + }).not.toHaveWholeNumber('memberName'); + expect({ + memberName: 1.1 + }).not.toHaveWholeNumber('memberName'); + expect({ + memberName: 0.1 + }).not.toHaveWholeNumber('memberName'); + }); + }); + }); +}); + +describe('toImplement', function() { + describe('when invoked', function() { + describe('when subject IS an Object containing all of the supplied members', function() { + it('should confirm', function() { + expect({ + a: 1, + b: 2 + }).toImplement({ + a: 1, + b: 2 + }); + expect({ + a: 1, + b: 2 + }).toImplement({ + a: 1 + }); + }); + }); + describe('when subject is NOT an Object containing all of the supplied members', function() { + it('should deny', function() { + expect({ + a: 1 + }).not.toImplement({ + c: 3 + }); + expect(null).not.toImplement({ + a: 1 + }); + }); + }); + }); +}); + +describe('toStartWith', function() { + describe('when invoked', function() { + describe('when subject is NOT an undefined or empty string', function() { + describe('when subject is a string whose leading characters match the expected string', function() { + it('should confirm', function() { + expect('jamie').toStartWith('jam'); + }); + }); + describe('when subject is a string whose leading characters DO NOT match the expected string', function() { + it('should deny', function() { + expect(' jamie').not.toStartWith('jam'); + expect('Jamie').not.toStartWith('jam'); + }); + }); + }); + describe('when subject IS an undefined or empty string', function() { + it('should deny', function() { + expect('').not.toStartWith(''); + expect(_undefined).not.toStartWith(''); + expect(_undefined).not.toStartWith('undefined'); + expect('undefined').not.toStartWith(_undefined); + }); + }); + }); +}); + + +describe('toThrowAnyError', function() { + describe('when supplied a function', function() { + describe('when function errors when invoked', function() { + beforeEach(function() { + this.throwError = function() { + throw new Error('wut?'); + }; + this.badReference = function() { + return badReference.someValue; + }; + }); + it('should confirm', function() { + expect(this.throwError).toThrowAnyError(); + expect(this.badReference).toThrowAnyError(); + }); + }); + describe('when function does NOT error when invoked', function() { + beforeEach(function() { + this.noErrors = function() {}; + }); + it('should deny', function() { + expect(this.noErrors).not.toThrowAnyError(); + }); + }); + }); +}); + + +describe('toThrowErrorOfType', function() { + describe('when supplied a function', function() { + describe('when function errors when invoked', function() { + beforeEach(function() { + this.throwError = function() { + throw new Error('wut?'); + }; + this.badReference = function() { + return badReference.someValue; + }; + }); + describe('when the error is of the expected type', function() { + it('should confirm', function() { + expect(this.throwError).toThrowErrorOfType('Error'); + expect(this.badReference).toThrowErrorOfType('ReferenceError'); + }); + }); + describe('when the error is NOT of the expected type', function() { + it('should confirm', function() { + expect(this.throwError).not.toThrowErrorOfType('ReferenceError'); + expect(this.badReference).not.toThrowErrorOfType('Error'); + }); + }); + }); + }); +}); diff --git a/jasmine-matchers/jamiemason-jasmine-matchers.d.ts b/jasmine-matchers/jamiemason-jasmine-matchers.d.ts index 6a2b8a49a..e293496c6 100644 --- a/jasmine-matchers/jamiemason-jasmine-matchers.d.ts +++ b/jasmine-matchers/jamiemason-jasmine-matchers.d.ts @@ -25,84 +25,84 @@ declare module jasmine { interface Matchers { // These functions are written in the order defined in the src directory of jasmine-matchers // The type system is used smartly whenever it can provide value (by looking at the code of every matcher) - toBeAfter(otherDate: Date, actualDate: Date): boolean; // - toBeArray(actualArray: any[]): boolean; // - toBeArrayOfBooleans(actualArray: any[]): boolean; // - toBeArrayOfNumbers(actualArray: any[]): boolean; - toBeArrayOfObjects(actualArray: any[]): boolean; - toBeArrayOfSize(size: number, actualArray: any[]): boolean; - toBeArrayOfStrings(actualArray: any[]): boolean; - toBeBefore(otherDate: Date, actualDate: Date): boolean; // - toBeBoolean(actual: boolean): boolean; - toBeCalculable(actual: number): boolean; - toBeDate(actual: Date): boolean; - toBeEmptyArray(actualArray: any[]): boolean; - toBeEmptyObject(actual: {}): boolean; - toBeEmptyString(actual: string): boolean; - toBeEvenNumber(actual: number): boolean; - toBeFalse(actual: boolean): boolean; - toBeFunction(actual: any): boolean; - toBeHtmlString(actual: string): boolean; - toBeIso8601(actual: string): boolean; - toBeJsonString(actual: string): boolean; - toBeLongerThan(actual: string): boolean; - toBeNonEmptyArray(actualArray: any[]): boolean; - toBeNonEmptyObject(actual: {}): boolean; - toBeNonEmptyString(actual: string): boolean; - toBeNumber(actual: number): boolean; - toBeObject(actual: {}): boolean; - toBeOddNumber(actual: number): boolean; - toBeSameLengthAs(other: string, actual: string): boolean; - toBeShorterThan(other: string, actual: string): boolean; - toBeString(actual: string): boolean; - toBeTrue(actual: boolean): boolean; - toBeWhitespace(actual: string): boolean; - toBeWholeNumber(actual: number): boolean; - toBeWithinRange(floor: number, ceiling: number, actual: number): boolean; + toBeAfter(otherDate: Date): boolean; // + toBeArray(): boolean; // + toBeArrayOfBooleans(): boolean; // + toBeArrayOfNumbers(): boolean; + toBeArrayOfObjects(): boolean; + toBeArrayOfSize(size: number): boolean; + toBeArrayOfStrings(): boolean; + toBeBefore(otherDate: Date): boolean; // + toBeBoolean(): boolean; + toBeCalculable(): boolean; + toBeDate(): boolean; + toBeEmptyArray(): boolean; + toBeEmptyObject(): boolean; + toBeEmptyString(): boolean; + toBeEvenNumber(): boolean; + toBeFalse(): boolean; + toBeFunction(): boolean; + toBeHtmlString(): boolean; + toBeIso8601(): boolean; + toBeJsonString(): boolean; + toBeLongerThan(other: string): boolean; + toBeNonEmptyArray(): boolean; + toBeNonEmptyObject(): boolean; + toBeNonEmptyString(): boolean; + toBeNumber(): boolean; + toBeObject(): boolean; + toBeOddNumber(): boolean; + toBeSameLengthAs(other: string): boolean; + toBeShorterThan(other: string): boolean; + toBeString(): boolean; + toBeTrue(): boolean; + toBeWhitespace(): boolean; + toBeWholeNumber(): boolean; + toBeWithinRange(floor: number, ceiling: number): boolean; - toEndWith(subString: string, actual: string): boolean; + toEndWith(subString: string): boolean; - toHaveArray(key: string, actual: {}): boolean; - toHaveArrayOfBooleans(key: string, actual: {}): boolean; - toHaveArrayOfNumbers(key: string, actual: {}): boolean; - toHaveArrayOfObjects(key: string, actual: {}): boolean; - toHaveArrayOfSize(key: string, size: number, actual: {}): boolean; - toHaveArrayOfStrings(key: string, actual: {}): boolean; - toHaveBoolean(key: string, actual: {}): boolean; - toHaveCalculable(key: string, actual: {}): boolean; - toHaveDate(key: string, actual: {}): boolean; - toHaveDateAfter(key: string, actual: {}): boolean; - toHaveDateBefore(key: string, actual: {}): boolean; - toHaveEmptyArray(key: string, actual: {}): boolean; - toHaveEmptyObject(key: string, actual: {}): boolean; - toHaveEmptyString(key: string, actual: {}): boolean; - toHaveEvenNumber(key: string, actual: {}): boolean; - toHaveFalse(key: string, actual: {}): boolean; - toHaveHtmlString(key: string, actual: {}): boolean; - toHaveIso8601(key: string, actual: {}): boolean; - toHaveJsonString(key: string, actual: {}): boolean; - toHaveMember(key: string, actual: {}): boolean; - toHaveMethod(key: string, actual: {}): boolean; - toHaveNonEmptyArray(key: string, actual: {}): boolean; - toHaveNonEmptyObject(key: string, actual: {}): boolean; - toHaveNonEmptyString(key: string, actual: {}): boolean; - toHaveNumber(key: string, actual: {}): boolean; - toHaveNumberWithinRange(key: string, actual: {}): boolean; - toHaveObject(key: string, actual: {}): boolean; - toHaveOddNumber(key: string, actual: {}): boolean; - toHaveString(key: string, actual: {}): boolean; - toHaveStringLongerThan(key: string, actual: {}): boolean; - toHaveStringSameLengthAs(key: string, actual: {}): boolean; - toHaveStringShorterThan(key: string, actual: {}): boolean; - toHaveTrue(key: string, actual: {}): boolean; - toHaveWhitespaceString(key: string, actual: {}): boolean; - toHaveWholeNumber(key: string, actual: {}): boolean; + toHaveArray(key: string): boolean; + toHaveArrayOfBooleans(key: string): boolean; + toHaveArrayOfNumbers(key: string): boolean; + toHaveArrayOfObjects(key: string): boolean; + toHaveArrayOfSize(key: string, size?: number): boolean; + toHaveArrayOfStrings(key: string): boolean; + toHaveBoolean(key: string): boolean; + toHaveCalculable(key: string): boolean; + toHaveDate(key: string): boolean; + toHaveDateAfter(key: string, otherDate: Date): boolean; + toHaveDateBefore(key: string, otherDate: Date): boolean; + toHaveEmptyArray(key: string): boolean; + toHaveEmptyObject(key: string): boolean; + toHaveEmptyString(key: string): boolean; + toHaveEvenNumber(key: string): boolean; + toHaveFalse(key: string): boolean; + toHaveHtmlString(key: string): boolean; + toHaveIso8601(key: string): boolean; + toHaveJsonString(key: string): boolean; + toHaveMember(key: string): boolean; + toHaveMethod(key: string): boolean; + toHaveNonEmptyArray(key: string): boolean; + toHaveNonEmptyObject(key: string): boolean; + toHaveNonEmptyString(key: string): boolean; + toHaveNumber(key: string): boolean; + toHaveNumberWithinRange(key: string, floor: number, ceiling: number): boolean; + toHaveObject(key: string): boolean; + toHaveOddNumber(key: string): boolean; + toHaveString(key: string): boolean; + toHaveStringLongerThan(key: string, other: string): boolean; + toHaveStringSameLengthAs(key: string, other: string): boolean; + toHaveStringShorterThan(key: string, other: string): boolean; + toHaveTrue(key: string): boolean; + toHaveWhitespaceString(key: string): boolean; + toHaveWholeNumber(key: string): boolean; - toImplement(api: {}, actual: {}): boolean; + toImplement(api: {}): boolean; - toStartWith(subString: string, actual: string): boolean; + toStartWith(subString: string): boolean; - toThrowAnyError(throwerFn: () => any): boolean; - toThrowErrorOfType(type: string, throwerFn: () => any): boolean; + toThrowAnyError(): boolean; + toThrowErrorOfType(type: string): boolean; } } From 24a38ab5f1742137c03f565198be52734c9a680e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Ewerl=C3=B6f?= Date: Mon, 23 Nov 2015 19:36:28 +0100 Subject: [PATCH 112/389] defined the type for mockDate and _undefined --- jasmine-matchers/jamiemason-jasmine-matchers-tests.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/jasmine-matchers/jamiemason-jasmine-matchers-tests.ts b/jasmine-matchers/jamiemason-jasmine-matchers-tests.ts index ade9e8cb5..20f2e9a7e 100644 --- a/jasmine-matchers/jamiemason-jasmine-matchers-tests.ts +++ b/jasmine-matchers/jamiemason-jasmine-matchers-tests.ts @@ -9,7 +9,7 @@ declare var describeToHaveArrayX: (arr: string, descriptor: () => void) => void; declare var describeToHaveX: (arr: string, descriptor: () => void) => void; declare var describeToHaveBooleanX: (arr: string, descriptor: () => void) => void; declare var badReference: {someValue: any}; -var _undefined; +var _undefined: any = undefined; describe('toBeAfter', function() { describe('when invoked', function() { @@ -993,7 +993,7 @@ describe('toHaveCalculable', function() { }); describe('toHaveDate', function() { - var mockDate; + var mockDate: any; beforeEach(function() { mockDate = { any: new Date(), @@ -1020,7 +1020,7 @@ describe('toHaveDate', function() { }); describe('toHaveDateAfter', function() { - var mockDate; + var mockDate: any; beforeEach(function() { mockDate = { any: new Date(), @@ -1056,7 +1056,7 @@ describe('toHaveDateAfter', function() { }); describeToHaveX('toHaveDateBefore', function() { - var mockDate; + var mockDate: any; beforeEach(function() { mockDate = { any: new Date(), From 28b50e6021a9bd3ea8a0240bc4a1ec23e5be0123 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Ewerl=C3=B6f?= Date: Mon, 23 Nov 2015 19:41:08 +0100 Subject: [PATCH 113/389] reformated the tests to tab=2 --- .../jamiemason-jasmine-matchers-tests.ts | 3270 ++++++++--------- 1 file changed, 1635 insertions(+), 1635 deletions(-) diff --git a/jasmine-matchers/jamiemason-jasmine-matchers-tests.ts b/jasmine-matchers/jamiemason-jasmine-matchers-tests.ts index 20f2e9a7e..cd4914339 100644 --- a/jasmine-matchers/jamiemason-jasmine-matchers-tests.ts +++ b/jasmine-matchers/jamiemason-jasmine-matchers-tests.ts @@ -8,1987 +8,1987 @@ declare var describeToBeArrayOfX: (arr: string, descriptor: {}) => void; declare var describeToHaveArrayX: (arr: string, descriptor: () => void) => void; declare var describeToHaveX: (arr: string, descriptor: () => void) => void; declare var describeToHaveBooleanX: (arr: string, descriptor: () => void) => void; -declare var badReference: {someValue: any}; +declare var badReference: { someValue: any }; var _undefined: any = undefined; describe('toBeAfter', function() { - describe('when invoked', function() { - describe('when value is a Date', function() { - describe('when date occurs after another', function() { - it('should confirm', function() { - expect(new Date('2013-01-01T01:00:00.000Z')).toBeAfter(new Date('2013-01-01T00:00:00.000Z')); - }); - }); - describe('when date does NOT occur after another', function() { - it('should deny', function() { - expect(new Date('2013-01-01T00:00:00.000Z')).not.toBeAfter(new Date('2013-01-01T01:00:00.000Z')); - }); - }); + describe('when invoked', function() { + describe('when value is a Date', function() { + describe('when date occurs after another', function() { + it('should confirm', function() { + expect(new Date('2013-01-01T01:00:00.000Z')).toBeAfter(new Date('2013-01-01T00:00:00.000Z')); }); + }); + describe('when date does NOT occur after another', function() { + it('should deny', function() { + expect(new Date('2013-01-01T00:00:00.000Z')).not.toBeAfter(new Date('2013-01-01T01:00:00.000Z')); + }); + }); }); + }); }); describe('toBeArray', function() { - describe('when invoked', function() { - describe('when subject is a true Array', function() { - it('should confirm', function() { - expect([]).toBeArray(); - expect(new Array()).toBeArray(); - }); - }); - describeWhenNotArray('toBeArray'); + describe('when invoked', function() { + describe('when subject is a true Array', function() { + it('should confirm', function() { + expect([]).toBeArray(); + expect(new Array()).toBeArray(); + }); }); + describeWhenNotArray('toBeArray'); + }); }); describe('toBeArrayOfBooleans', function() { - describeToBeArrayOfX('toBeArrayOfBooleans', { - type: 'Boolean', - whenValid: function() { - expect([true]).toBeArrayOfBooleans(); - expect([new Boolean(true)]).toBeArrayOfBooleans(); - expect([new Boolean(false)]).toBeArrayOfBooleans(); - expect([false, true]).toBeArrayOfBooleans(); - }, - whenInvalid: function() { - expect([null]).not.toBeArrayOfBooleans(); - }, - whenMixed: function() { - expect([null, false]).not.toBeArrayOfBooleans(); - expect([null, true]).not.toBeArrayOfBooleans(); - } - }); + describeToBeArrayOfX('toBeArrayOfBooleans', { + type: 'Boolean', + whenValid: function() { + expect([true]).toBeArrayOfBooleans(); + expect([new Boolean(true)]).toBeArrayOfBooleans(); + expect([new Boolean(false)]).toBeArrayOfBooleans(); + expect([false, true]).toBeArrayOfBooleans(); + }, + whenInvalid: function() { + expect([null]).not.toBeArrayOfBooleans(); + }, + whenMixed: function() { + expect([null, false]).not.toBeArrayOfBooleans(); + expect([null, true]).not.toBeArrayOfBooleans(); + } + }); }); describe('toBeArrayOfNumbers', function() { - describeToBeArrayOfX('toBeArrayOfNumbers', { - type: 'Number', - whenValid: function() { - expect([1]).toBeArrayOfNumbers(); - expect([new Number(1)]).toBeArrayOfNumbers(); - expect([new Number(0)]).toBeArrayOfNumbers(); - expect([0, 1]).toBeArrayOfNumbers(); - }, - whenInvalid: function() { - expect([null]).not.toBeArrayOfNumbers(); - }, - whenMixed: function() { - expect([null, 0]).not.toBeArrayOfNumbers(); - } - }); + describeToBeArrayOfX('toBeArrayOfNumbers', { + type: 'Number', + whenValid: function() { + expect([1]).toBeArrayOfNumbers(); + expect([new Number(1)]).toBeArrayOfNumbers(); + expect([new Number(0)]).toBeArrayOfNumbers(); + expect([0, 1]).toBeArrayOfNumbers(); + }, + whenInvalid: function() { + expect([null]).not.toBeArrayOfNumbers(); + }, + whenMixed: function() { + expect([null, 0]).not.toBeArrayOfNumbers(); + } + }); }); describe('toBeArrayOfObjects', function() { - describeToBeArrayOfX('toBeArrayOfObjects', { - type: 'Object', - whenValid: function() { - expect([{}, {}]).toBeArrayOfObjects(); - }, - whenInvalid: function() { - expect([null]).not.toBeArrayOfObjects(); - expect(['Object']).not.toBeArrayOfObjects(); - expect(['[object Object]']).not.toBeArrayOfObjects(); - }, - whenMixed: function() { - expect([null, {}]).not.toBeArrayOfObjects(); - } - }); + describeToBeArrayOfX('toBeArrayOfObjects', { + type: 'Object', + whenValid: function() { + expect([{}, {}]).toBeArrayOfObjects(); + }, + whenInvalid: function() { + expect([null]).not.toBeArrayOfObjects(); + expect(['Object']).not.toBeArrayOfObjects(); + expect(['[object Object]']).not.toBeArrayOfObjects(); + }, + whenMixed: function() { + expect([null, {}]).not.toBeArrayOfObjects(); + } + }); }); describe('toBeArrayOfSize', function() { - describe('when invoked', function() { - describe('when subject is a true Array', function() { - describe('when subject has the expected number of members', function() { - it('should confirm', function() { - expect([]).toBeArrayOfSize(0); - expect([null]).toBeArrayOfSize(1); - expect([false, false]).toBeArrayOfSize(2); - expect([_undefined, _undefined]).toBeArrayOfSize(2); - }); - }); - describe('when subject has an unexpected number of members', function() { - it('should deny', function() { - expect([]).not.toBeArrayOfSize(1); - expect([null]).not.toBeArrayOfSize(0); - expect([true, true]).not.toBeArrayOfSize(1); - }); - }); + describe('when invoked', function() { + describe('when subject is a true Array', function() { + describe('when subject has the expected number of members', function() { + it('should confirm', function() { + expect([]).toBeArrayOfSize(0); + expect([null]).toBeArrayOfSize(1); + expect([false, false]).toBeArrayOfSize(2); + expect([_undefined, _undefined]).toBeArrayOfSize(2); }); - describeWhenNotArray('toBeArrayOfSize'); + }); + describe('when subject has an unexpected number of members', function() { + it('should deny', function() { + expect([]).not.toBeArrayOfSize(1); + expect([null]).not.toBeArrayOfSize(0); + expect([true, true]).not.toBeArrayOfSize(1); + }); + }); }); + describeWhenNotArray('toBeArrayOfSize'); + }); }); describe('toBeArrayOfStrings', function() { - describeToBeArrayOfX('toBeArrayOfStrings', { - type: 'String', - whenValid: function() { - expect(['truthy']).toBeArrayOfStrings(); - expect([new String('truthy')]).toBeArrayOfStrings(); - expect([new String('')]).toBeArrayOfStrings(); - expect(['', 'truthy']).toBeArrayOfStrings(); - }, - whenInvalid: function() { - expect([null]).not.toBeArrayOfStrings(); - }, - whenMixed: function() { - expect([null, '']).not.toBeArrayOfStrings(); - } - }); + describeToBeArrayOfX('toBeArrayOfStrings', { + type: 'String', + whenValid: function() { + expect(['truthy']).toBeArrayOfStrings(); + expect([new String('truthy')]).toBeArrayOfStrings(); + expect([new String('')]).toBeArrayOfStrings(); + expect(['', 'truthy']).toBeArrayOfStrings(); + }, + whenInvalid: function() { + expect([null]).not.toBeArrayOfStrings(); + }, + whenMixed: function() { + expect([null, '']).not.toBeArrayOfStrings(); + } + }); }); describe('toBeBefore', function() { - describe('when invoked', function() { - describe('when value is a Date', function() { - describe('when date occurs before another', function() { - it('should confirm', function() { - expect(new Date('2013-01-01T00:00:00.000Z')).toBeBefore(new Date('2013-01-01T01:00:00.000Z')); - }); - }); - describe('when date does NOT occur before another', function() { - it('should deny', function() { - expect(new Date('2013-01-01T01:00:00.000Z')).not.toBeBefore(new Date('2013-01-01T00:00:00.000Z')); - }); - }); + describe('when invoked', function() { + describe('when value is a Date', function() { + describe('when date occurs before another', function() { + it('should confirm', function() { + expect(new Date('2013-01-01T00:00:00.000Z')).toBeBefore(new Date('2013-01-01T01:00:00.000Z')); }); + }); + describe('when date does NOT occur before another', function() { + it('should deny', function() { + expect(new Date('2013-01-01T01:00:00.000Z')).not.toBeBefore(new Date('2013-01-01T00:00:00.000Z')); + }); + }); }); + }); }); describe('toBeBoolean', function() { - describe('when invoked', function() { - describe('when subject not only truthy or falsy, but a boolean', function() { - it('should confirm', function() { - expect(true).toBeBoolean(); - expect(false).toBeBoolean(); - expect(new Boolean(true)).toBeBoolean(); - expect(new Boolean(false)).toBeBoolean(); - }); - }); - describe('when subject is truthy or falsy', function() { - it('should deny', function() { - expect(1).not.toBeBoolean(); - expect(0).not.toBeBoolean(); - }); - }); + describe('when invoked', function() { + describe('when subject not only truthy or falsy, but a boolean', function() { + it('should confirm', function() { + expect(true).toBeBoolean(); + expect(false).toBeBoolean(); + expect(new Boolean(true)).toBeBoolean(); + expect(new Boolean(false)).toBeBoolean(); + }); }); + describe('when subject is truthy or falsy', function() { + it('should deny', function() { + expect(1).not.toBeBoolean(); + expect(0).not.toBeBoolean(); + }); + }); + }); }); describe('toBeCalculable', function() { - describe('when invoked', function() { - describe('when subject CAN be coerced to be used in mathematical operations', function() { - it('should confirm', function() { - expect('1').toBeCalculable(); - expect('').toBeCalculable(); - expect(null).toBeCalculable(); - }); - }); - describe('when subject can NOT be coerced by JavaScript to be used in mathematical operations', function() { - it('should deny', function() { - expect({}).not.toBeCalculable(); - expect(NaN).not.toBeCalculable(); - }); - }); + describe('when invoked', function() { + describe('when subject CAN be coerced to be used in mathematical operations', function() { + it('should confirm', function() { + expect('1').toBeCalculable(); + expect('').toBeCalculable(); + expect(null).toBeCalculable(); + }); }); + describe('when subject can NOT be coerced by JavaScript to be used in mathematical operations', function() { + it('should deny', function() { + expect({}).not.toBeCalculable(); + expect(NaN).not.toBeCalculable(); + }); + }); + }); }); describe('toBeDate', function() { - describe('when invoked', function() { - describe('when value is an instance of Date', function() { - it('should confirm', function() { - expect(new Date()).toBeDate(); - }); - }); - describe('when value is NOT an instance of Date', function() { - it('should deny', function() { - expect(null).not.toBeDate(); - }); - }); + describe('when invoked', function() { + describe('when value is an instance of Date', function() { + it('should confirm', function() { + expect(new Date()).toBeDate(); + }); }); + describe('when value is NOT an instance of Date', function() { + it('should deny', function() { + expect(null).not.toBeDate(); + }); + }); + }); }); describe('toBeEmptyArray', function() { - describe('when invoked', function() { - describe('when subject is a true Array', function() { - describe('when subject has members', function() { - it('should confirm', function() { - expect([]).toBeEmptyArray(); - }); - }); - describe('when subject has no members', function() { - it('should deny', function() { - expect([null]).not.toBeEmptyArray(); - expect(['']).not.toBeEmptyArray(); - expect([1]).not.toBeEmptyArray(); - expect([true]).not.toBeEmptyArray(); - expect([false]).not.toBeEmptyArray(); - }); - }); + describe('when invoked', function() { + describe('when subject is a true Array', function() { + describe('when subject has members', function() { + it('should confirm', function() { + expect([]).toBeEmptyArray(); }); - describeWhenNotArray('toBeEmptyArray'); + }); + describe('when subject has no members', function() { + it('should deny', function() { + expect([null]).not.toBeEmptyArray(); + expect(['']).not.toBeEmptyArray(); + expect([1]).not.toBeEmptyArray(); + expect([true]).not.toBeEmptyArray(); + expect([false]).not.toBeEmptyArray(); + }); + }); }); + describeWhenNotArray('toBeEmptyArray'); + }); }); describe('toBeEmptyObject', function() { - beforeEach(function() { - this.Foo = function() {}; + beforeEach(function() { + this.Foo = function() { }; + }); + describe('when invoked', function() { + describe('when subject IS an Object with no instance members', function() { + beforeEach(function() { + this.Foo.prototype = { + b: 2 + }; + }); + it('should confirm', function() { + expect(new this.Foo()).toBeEmptyObject(); + expect({}).toBeEmptyObject(); + }); }); - describe('when invoked', function() { - describe('when subject IS an Object with no instance members', function() { - beforeEach(function() { - this.Foo.prototype = { - b: 2 - }; - }); - it('should confirm', function() { - expect(new this.Foo()).toBeEmptyObject(); - expect({}).toBeEmptyObject(); - }); - }); - describe('when subject is NOT an Object with no instance members', function() { - it('should deny', function() { - expect({ - a: 1 - }).not.toBeEmptyObject(); - expect(null).not.toBeNonEmptyObject(); - }); - }); + describe('when subject is NOT an Object with no instance members', function() { + it('should deny', function() { + expect({ + a: 1 + }).not.toBeEmptyObject(); + expect(null).not.toBeNonEmptyObject(); + }); }); + }); }); describe('toBeEmptyString', function() { - describe('when invoked', function() { - describe('when subject IS a string with no characters', function() { - it('should confirm', function() { - expect('').toBeEmptyString(); - }); - }); - describe('when subject is NOT a string with no characters', function() { - it('should deny', function() { - expect(' ').not.toBeEmptyString(); - }); - }); + describe('when invoked', function() { + describe('when subject IS a string with no characters', function() { + it('should confirm', function() { + expect('').toBeEmptyString(); + }); }); + describe('when subject is NOT a string with no characters', function() { + it('should deny', function() { + expect(' ').not.toBeEmptyString(); + }); + }); + }); }); describe('toBeEvenNumber', function() { - describe('when invoked', function() { - describe('when subject IS an even number', function() { - it('should confirm', function() { - expect(2).toBeEvenNumber(); - }); - }); - describe('when subject is NOT an even number', function() { - it('should deny', function() { - expect(1).not.toBeEvenNumber(); - expect(NaN).not.toBeEvenNumber(); - }); - }); + describe('when invoked', function() { + describe('when subject IS an even number', function() { + it('should confirm', function() { + expect(2).toBeEvenNumber(); + }); }); + describe('when subject is NOT an even number', function() { + it('should deny', function() { + expect(1).not.toBeEvenNumber(); + expect(NaN).not.toBeEvenNumber(); + }); + }); + }); }); describe('toBeFalse', function() { - describe('when invoked', function() { - describe('when subject is not only falsy, but a boolean false', function() { - it('should confirm', function() { - expect(false).toBeFalse(); - expect(new Boolean(false)).toBeFalse(); - }); - }); - describe('when subject is falsy', function() { - it('should deny', function() { - expect(1).not.toBeFalse(); - }); - }); + describe('when invoked', function() { + describe('when subject is not only falsy, but a boolean false', function() { + it('should confirm', function() { + expect(false).toBeFalse(); + expect(new Boolean(false)).toBeFalse(); + }); }); + describe('when subject is falsy', function() { + it('should deny', function() { + expect(1).not.toBeFalse(); + }); + }); + }); }); describe('toBeFunction', function() { - describe('when invoked', function() { - describe('when subject IS a function', function() { - it('should confirm', function() { - expect(function() {}).toBeFunction(); - }); - }); - describe('when subject is NOT a function', function() { - it('should deny', function() { - expect(/regexp/).not.toBeFunction(); - }); - }); + describe('when invoked', function() { + describe('when subject IS a function', function() { + it('should confirm', function() { + expect(function() { }).toBeFunction(); + }); }); + describe('when subject is NOT a function', function() { + it('should deny', function() { + expect(/regexp/).not.toBeFunction(); + }); + }); + }); }); describe('toBeHtmlString', function() { - describe('when invoked', function() { - describe('when subject IS a string of HTML markup', function() { - beforeEach(function() { - this.ngMultiLine = ''; - this.ngMultiLine += ''; - this.ngMultiLine += '\n'; - this.ngMultiLine += ' Watch with Google TV'; - this.ngMultiLine += '\n'; - this.ngMultiLine += ''; - this.ngMultiLine += '\n'; - }); - it('should confirm', function() { - expect('text').toBeHtmlString(); - expect('baz').toBeHtmlString(); - expect('
    ').toBeHtmlString(); - expect('
  • ').toBeHtmlString(); - expect(this.ngMultiLine).toBeHtmlString(); - }); - }); - describe('when subject is NOT a string of HTML markup', function() { - it('should deny', function() { - expect('div').not.toBeHtmlString(); - expect(null).not.toBeHtmlString(); - }); - }); + describe('when invoked', function() { + describe('when subject IS a string of HTML markup', function() { + beforeEach(function() { + this.ngMultiLine = ''; + this.ngMultiLine += ''; + this.ngMultiLine += '\n'; + this.ngMultiLine += ' Watch with Google TV'; + this.ngMultiLine += '\n'; + this.ngMultiLine += ''; + this.ngMultiLine += '\n'; + }); + it('should confirm', function() { + expect('text').toBeHtmlString(); + expect('baz').toBeHtmlString(); + expect('
    ').toBeHtmlString(); + expect('
  • ').toBeHtmlString(); + expect(this.ngMultiLine).toBeHtmlString(); + }); }); + describe('when subject is NOT a string of HTML markup', function() { + it('should deny', function() { + expect('div').not.toBeHtmlString(); + expect(null).not.toBeHtmlString(); + }); + }); + }); }); describe('toBeIso8601', function() { - describe('when invoked', function() { - describe('when value is a Date String conforming to the ISO 8601 standard', function() { - describe('when specified date is valid', function() { - it('should confirm', function() { - expect('2013-07-08T07:29:15.863Z').toBeIso8601(); - expect('2013-07-08T07:29:15.863').toBeIso8601(); - expect('2013-07-08T07:29:15').toBeIso8601(); - expect('2013-07-08T07:29').toBeIso8601(); - expect('2013-07-08').toBeIso8601(); - }); - }); - describe('when specified date is NOT valid', function() { - it('should deny', function() { - expect('2013-99-12T00:00:00.000Z').not.toBeIso8601(); - expect('2013-12-99T00:00:00.000Z').not.toBeIso8601(); - expect('2013-01-01T99:00:00.000Z').not.toBeIso8601(); - expect('2013-01-01T99:99:00.000Z').not.toBeIso8601(); - expect('2013-01-01T00:00:99.000Z').not.toBeIso8601(); - }); - }); + describe('when invoked', function() { + describe('when value is a Date String conforming to the ISO 8601 standard', function() { + describe('when specified date is valid', function() { + it('should confirm', function() { + expect('2013-07-08T07:29:15.863Z').toBeIso8601(); + expect('2013-07-08T07:29:15.863').toBeIso8601(); + expect('2013-07-08T07:29:15').toBeIso8601(); + expect('2013-07-08T07:29').toBeIso8601(); + expect('2013-07-08').toBeIso8601(); }); - describe('when value is a String NOT conforming to the ISO 8601 standard', function() { - it('should deny', function() { - expect('2013-07-08T07:29:15.').not.toBeIso8601(); - expect('2013-07-08T07:29:').not.toBeIso8601(); - expect('2013-07-08T07:2').not.toBeIso8601(); - expect('2013-07-08T07:').not.toBeIso8601(); - expect('2013-07-08T07').not.toBeIso8601(); - expect('2013-07-08T').not.toBeIso8601(); - expect('2013-07-0').not.toBeIso8601(); - expect('2013-07-').not.toBeIso8601(); - expect('2013-07').not.toBeIso8601(); - expect('2013-0').not.toBeIso8601(); - expect('2013-').not.toBeIso8601(); - expect('2013').not.toBeIso8601(); - expect('201').not.toBeIso8601(); - expect('20').not.toBeIso8601(); - expect('2').not.toBeIso8601(); - expect('').not.toBeIso8601(); - }); + }); + describe('when specified date is NOT valid', function() { + it('should deny', function() { + expect('2013-99-12T00:00:00.000Z').not.toBeIso8601(); + expect('2013-12-99T00:00:00.000Z').not.toBeIso8601(); + expect('2013-01-01T99:00:00.000Z').not.toBeIso8601(); + expect('2013-01-01T99:99:00.000Z').not.toBeIso8601(); + expect('2013-01-01T00:00:99.000Z').not.toBeIso8601(); }); + }); }); + describe('when value is a String NOT conforming to the ISO 8601 standard', function() { + it('should deny', function() { + expect('2013-07-08T07:29:15.').not.toBeIso8601(); + expect('2013-07-08T07:29:').not.toBeIso8601(); + expect('2013-07-08T07:2').not.toBeIso8601(); + expect('2013-07-08T07:').not.toBeIso8601(); + expect('2013-07-08T07').not.toBeIso8601(); + expect('2013-07-08T').not.toBeIso8601(); + expect('2013-07-0').not.toBeIso8601(); + expect('2013-07-').not.toBeIso8601(); + expect('2013-07').not.toBeIso8601(); + expect('2013-0').not.toBeIso8601(); + expect('2013-').not.toBeIso8601(); + expect('2013').not.toBeIso8601(); + expect('201').not.toBeIso8601(); + expect('20').not.toBeIso8601(); + expect('2').not.toBeIso8601(); + expect('').not.toBeIso8601(); + }); + }); + }); }); var _undefined; describe('toBeJsonString', function() { - describe('when invoked', function() { - describe('when subject IS a string of parseable JSON', function() { - it('should confirm', function() { - expect('{}').toBeJsonString(); - expect('[]').toBeJsonString(); - expect('[1]').toBeJsonString(); - }); - }); - describe('when subject is NOT a string of parseable JSON', function() { - it('should deny', function() { - expect('[1,]').not.toBeJsonString(); - expect('<>').not.toBeJsonString(); - expect(null).not.toBeJsonString(); - expect('').not.toBeJsonString(); - expect(_undefined).not.toBeJsonString(); - }); - }); + describe('when invoked', function() { + describe('when subject IS a string of parseable JSON', function() { + it('should confirm', function() { + expect('{}').toBeJsonString(); + expect('[]').toBeJsonString(); + expect('[1]').toBeJsonString(); + }); }); + describe('when subject is NOT a string of parseable JSON', function() { + it('should deny', function() { + expect('[1,]').not.toBeJsonString(); + expect('<>').not.toBeJsonString(); + expect(null).not.toBeJsonString(); + expect('').not.toBeJsonString(); + expect(_undefined).not.toBeJsonString(); + }); + }); + }); }); describe('toBeLongerThan', function() { - describe('when invoked', function() { - describe('when the subject and comparison ARE both strings', function() { - describe('when the subject IS longer than the comparision string', function() { - it('should confirm', function() { - expect('abc').toBeLongerThan('ab'); - expect('a').toBeLongerThan(''); - }); - }); - describe('when the subject is NOT longer than the comparision string', function() { - it('should deny', function() { - expect('ab').not.toBeLongerThan('abc'); - expect('').not.toBeLongerThan('a'); - }); - }); + describe('when invoked', function() { + describe('when the subject and comparison ARE both strings', function() { + describe('when the subject IS longer than the comparision string', function() { + it('should confirm', function() { + expect('abc').toBeLongerThan('ab'); + expect('a').toBeLongerThan(''); }); - describe('when the subject and comparison are NOT both strings', function() { - it('should deny (we are asserting the relative lengths of two strings)', function() { - expect('truthy').not.toBeLongerThan(_undefined); - expect(_undefined).not.toBeLongerThan('truthy'); - expect('').not.toBeLongerThan(_undefined); - expect(_undefined).not.toBeLongerThan(''); - }); + }); + describe('when the subject is NOT longer than the comparision string', function() { + it('should deny', function() { + expect('ab').not.toBeLongerThan('abc'); + expect('').not.toBeLongerThan('a'); }); + }); }); + describe('when the subject and comparison are NOT both strings', function() { + it('should deny (we are asserting the relative lengths of two strings)', function() { + expect('truthy').not.toBeLongerThan(_undefined); + expect(_undefined).not.toBeLongerThan('truthy'); + expect('').not.toBeLongerThan(_undefined); + expect(_undefined).not.toBeLongerThan(''); + }); + }); + }); }); describe('toBeNonEmptyArray', function() { - describe('when invoked', function() { - describe('when subject is a true Array', function() { - describe('when subject has members', function() { - it('should confirm', function() { - expect([null]).toBeNonEmptyArray(); - expect([_undefined]).toBeNonEmptyArray(); - expect(['']).toBeNonEmptyArray(); - }); - }); - describe('when subject has no members', function() { - it('should deny', function() { - expect([]).not.toBeNonEmptyArray(); - }); - }); + describe('when invoked', function() { + describe('when subject is a true Array', function() { + describe('when subject has members', function() { + it('should confirm', function() { + expect([null]).toBeNonEmptyArray(); + expect([_undefined]).toBeNonEmptyArray(); + expect(['']).toBeNonEmptyArray(); }); - describeWhenNotArray('toBeNonEmptyArray'); + }); + describe('when subject has no members', function() { + it('should deny', function() { + expect([]).not.toBeNonEmptyArray(); + }); + }); }); + describeWhenNotArray('toBeNonEmptyArray'); + }); }); describe('toBeNonEmptyObject', function() { - beforeEach(function() { - this.Foo = function() {}; + beforeEach(function() { + this.Foo = function() { }; + }); + describe('when invoked', function() { + describe('when subject IS an Object with at least one instance member', function() { + it('should confirm', function() { + expect({ + a: 1 + }).toBeNonEmptyObject(); + }); }); - describe('when invoked', function() { - describe('when subject IS an Object with at least one instance member', function() { - it('should confirm', function() { - expect({ - a: 1 - }).toBeNonEmptyObject(); - }); - }); - describe('when subject is NOT an Object with at least one instance member', function() { - beforeEach(function() { - this.Foo.prototype = { - b: 2 - }; - }); - it('should deny', function() { - expect(new this.Foo()).not.toBeNonEmptyObject(); - expect({}).not.toBeNonEmptyObject(); - expect(null).not.toBeNonEmptyObject(); - }); - }); + describe('when subject is NOT an Object with at least one instance member', function() { + beforeEach(function() { + this.Foo.prototype = { + b: 2 + }; + }); + it('should deny', function() { + expect(new this.Foo()).not.toBeNonEmptyObject(); + expect({}).not.toBeNonEmptyObject(); + expect(null).not.toBeNonEmptyObject(); + }); }); + }); }); describe('toBeNonEmptyString', function() { - describe('when invoked', function() { - describe('when subject IS a string with at least one character', function() { - it('should confirm', function() { - expect(' ').toBeNonEmptyString(); - }); - }); - describe('when subject is NOT a string with at least one character', function() { - it('should deny', function() { - expect('').not.toBeNonEmptyString(); - expect(null).not.toBeNonEmptyString(); - }); - }); + describe('when invoked', function() { + describe('when subject IS a string with at least one character', function() { + it('should confirm', function() { + expect(' ').toBeNonEmptyString(); + }); }); + describe('when subject is NOT a string with at least one character', function() { + it('should deny', function() { + expect('').not.toBeNonEmptyString(); + expect(null).not.toBeNonEmptyString(); + }); + }); + }); }); describe('toBeNumber', function() { - describe('when invoked', function() { - describe('when subject IS a number', function() { - it('should confirm', function() { - expect(1).toBeNumber(); - expect(1.11).toBeNumber(); - expect(1e3).toBeNumber(); - expect(0.11).toBeNumber(); - expect(-11).toBeNumber(); - }); - }); - describe('when subject is NOT a number', function() { - it('should deny', function() { - expect('1').not.toBeNumber(); - expect(NaN).not.toBeNumber(); - }); - }); + describe('when invoked', function() { + describe('when subject IS a number', function() { + it('should confirm', function() { + expect(1).toBeNumber(); + expect(1.11).toBeNumber(); + expect(1e3).toBeNumber(); + expect(0.11).toBeNumber(); + expect(-11).toBeNumber(); + }); }); + describe('when subject is NOT a number', function() { + it('should deny', function() { + expect('1').not.toBeNumber(); + expect(NaN).not.toBeNumber(); + }); + }); + }); }); describe('toBeObject', function() { - beforeEach(function() { - this.Foo = function() {}; + beforeEach(function() { + this.Foo = function() { }; + }); + describe('when invoked', function() { + describe('when subject IS an Object', function() { + it('should confirm', function() { + expect(new Object()).toBeObject(); + expect(new this.Foo()).toBeObject(); + expect({}).toBeObject(); + }); }); - describe('when invoked', function() { - describe('when subject IS an Object', function() { - it('should confirm', function() { - expect(new Object()).toBeObject(); - expect(new this.Foo()).toBeObject(); - expect({}).toBeObject(); - }); - }); - describe('when subject is NOT an Object', function() { - it('should deny', function() { - expect(null).not.toBeObject(); - expect(123).not.toBeObject(); - expect('[object Object]').not.toBeObject(); - }); - }); + describe('when subject is NOT an Object', function() { + it('should deny', function() { + expect(null).not.toBeObject(); + expect(123).not.toBeObject(); + expect('[object Object]').not.toBeObject(); + }); }); + }); }); describe('toBeOddNumber', function() { - describe('when invoked', function() { - describe('when subject IS an odd number', function() { - it('should confirm', function() { - expect(1).toBeOddNumber(); - }); - }); - describe('when subject is NOT an odd number', function() { - it('should deny', function() { - expect(2).not.toBeOddNumber(); - expect(NaN).not.toBeOddNumber(); - }); - }); + describe('when invoked', function() { + describe('when subject IS an odd number', function() { + it('should confirm', function() { + expect(1).toBeOddNumber(); + }); }); + describe('when subject is NOT an odd number', function() { + it('should deny', function() { + expect(2).not.toBeOddNumber(); + expect(NaN).not.toBeOddNumber(); + }); + }); + }); }); var _undefined; describe('toBeSameLengthAs', function() { - describe('when invoked', function() { - describe('when the subject and comparison ARE both strings', function() { - describe('when the subject IS the same length as the comparision string', function() { - it('should confirm', function() { - expect('ab').toBeSameLengthAs('ab'); - }); - }); - describe('when the subject is NOT the same length as the comparision string', function() { - it('should deny', function() { - expect('abc').not.toBeSameLengthAs('ab'); - expect('a').not.toBeSameLengthAs(''); - expect('').not.toBeSameLengthAs('a'); - }); - }); + describe('when invoked', function() { + describe('when the subject and comparison ARE both strings', function() { + describe('when the subject IS the same length as the comparision string', function() { + it('should confirm', function() { + expect('ab').toBeSameLengthAs('ab'); }); - describe('when the subject and comparison are NOT both strings', function() { - it('should deny (we are asserting the relative lengths of two strings)', function() { - expect('truthy').not.toBeSameLengthAs(_undefined); - expect(_undefined).not.toBeSameLengthAs('truthy'); - expect('').not.toBeSameLengthAs(_undefined); - expect(_undefined).not.toBeSameLengthAs(''); - }); + }); + describe('when the subject is NOT the same length as the comparision string', function() { + it('should deny', function() { + expect('abc').not.toBeSameLengthAs('ab'); + expect('a').not.toBeSameLengthAs(''); + expect('').not.toBeSameLengthAs('a'); }); + }); }); + describe('when the subject and comparison are NOT both strings', function() { + it('should deny (we are asserting the relative lengths of two strings)', function() { + expect('truthy').not.toBeSameLengthAs(_undefined); + expect(_undefined).not.toBeSameLengthAs('truthy'); + expect('').not.toBeSameLengthAs(_undefined); + expect(_undefined).not.toBeSameLengthAs(''); + }); + }); + }); }); var _undefined; describe('toBeShorterThan', function() { - describe('when invoked', function() { - describe('when the subject and comparison ARE both strings', function() { - describe('when the subject IS shorter than the comparision string', function() { - it('should confirm', function() { - expect('ab').toBeShorterThan('abc'); - expect('').toBeShorterThan('a'); - }); - }); - describe('when the subject is NOT shorter than the comparision string', function() { - it('should deny', function() { - expect('abc').not.toBeShorterThan('ab'); - expect('a').not.toBeShorterThan(''); - }); - }); + describe('when invoked', function() { + describe('when the subject and comparison ARE both strings', function() { + describe('when the subject IS shorter than the comparision string', function() { + it('should confirm', function() { + expect('ab').toBeShorterThan('abc'); + expect('').toBeShorterThan('a'); }); - describe('when the subject and comparison are NOT both strings', function() { - it('should deny (we are asserting the relative lengths of two strings)', function() { - expect('truthy').not.toBeShorterThan(_undefined); - expect(_undefined).not.toBeShorterThan('truthy'); - expect('').not.toBeShorterThan(_undefined); - expect(_undefined).not.toBeShorterThan(''); - }); + }); + describe('when the subject is NOT shorter than the comparision string', function() { + it('should deny', function() { + expect('abc').not.toBeShorterThan('ab'); + expect('a').not.toBeShorterThan(''); }); + }); }); + describe('when the subject and comparison are NOT both strings', function() { + it('should deny (we are asserting the relative lengths of two strings)', function() { + expect('truthy').not.toBeShorterThan(_undefined); + expect(_undefined).not.toBeShorterThan('truthy'); + expect('').not.toBeShorterThan(_undefined); + expect(_undefined).not.toBeShorterThan(''); + }); + }); + }); }); describe('toBeString', function() { - describe('when invoked', function() { - describe('when subject IS a string of any length', function() { - it('should confirm', function() { - expect('').toBeString(); - expect(' ').toBeString(); - }); - }); - describe('when subject is NOT a string of any length', function() { - it('should deny', function() { - expect(null).not.toBeString(); - }); - }); + describe('when invoked', function() { + describe('when subject IS a string of any length', function() { + it('should confirm', function() { + expect('').toBeString(); + expect(' ').toBeString(); + }); }); + describe('when subject is NOT a string of any length', function() { + it('should deny', function() { + expect(null).not.toBeString(); + }); + }); + }); }); describe('toBeTrue', function() { - describe('when invoked', function() { - describe('when subject is not only truthy, but a boolean true', function() { - it('should confirm', function() { - expect(true).toBeTrue(); - expect(new Boolean(true)).toBeTrue(); - }); - }); - describe('when subject is truthy', function() { - it('should deny', function() { - expect(1).not.toBeTrue(); - }); - }); + describe('when invoked', function() { + describe('when subject is not only truthy, but a boolean true', function() { + it('should confirm', function() { + expect(true).toBeTrue(); + expect(new Boolean(true)).toBeTrue(); + }); }); + describe('when subject is truthy', function() { + it('should deny', function() { + expect(1).not.toBeTrue(); + }); + }); + }); }); describe('toBeWhitespace', function() { - describe('when invoked', function() { - describe('when subject IS a string containing only tabs, spaces, returns etc', function() { - it('should confirm', function() { - expect(' ').toBeWhitespace(); - expect('').toBeWhitespace(); - }); - }); - describe('when subject is NOT a string containing only tabs, spaces, returns etc', function() { - it('should deny', function() { - expect('has-no-whitespace').not.toBeWhitespace(); - expect('has whitespace').not.toBeWhitespace(); - expect(null).not.toBeWhitespace(); - }); - }); + describe('when invoked', function() { + describe('when subject IS a string containing only tabs, spaces, returns etc', function() { + it('should confirm', function() { + expect(' ').toBeWhitespace(); + expect('').toBeWhitespace(); + }); }); + describe('when subject is NOT a string containing only tabs, spaces, returns etc', function() { + it('should deny', function() { + expect('has-no-whitespace').not.toBeWhitespace(); + expect('has whitespace').not.toBeWhitespace(); + expect(null).not.toBeWhitespace(); + }); + }); + }); }); describe('toBeWholeNumber', function() { - describe('when invoked', function() { - describe('when subject IS a number with no positive decimal places', function() { - it('should confirm', function() { - expect(1).toBeWholeNumber(); - expect(0).toBeWholeNumber(); - expect(0.0).toBeWholeNumber(); - }); - }); - describe('when subject is NOT a number with no positive decimal places', function() { - it('should deny', function() { - expect(NaN).not.toBeWholeNumber(); - expect(1.1).not.toBeWholeNumber(); - expect(0.1).not.toBeWholeNumber(); - }); - }); + describe('when invoked', function() { + describe('when subject IS a number with no positive decimal places', function() { + it('should confirm', function() { + expect(1).toBeWholeNumber(); + expect(0).toBeWholeNumber(); + expect(0.0).toBeWholeNumber(); + }); }); + describe('when subject is NOT a number with no positive decimal places', function() { + it('should deny', function() { + expect(NaN).not.toBeWholeNumber(); + expect(1.1).not.toBeWholeNumber(); + expect(0.1).not.toBeWholeNumber(); + }); + }); + }); }); describe('toBeWithinRange', function() { - describe('when invoked', function() { - describe('when subject IS a number >= floor and <= ceiling', function() { - it('should confirm', function() { - expect(0).toBeWithinRange(0, 2); - expect(1).toBeWithinRange(0, 2); - expect(2).toBeWithinRange(0, 2); - }); - }); - describe('when subject is NOT a number >= floor and <= ceiling', function() { - it('should deny', function() { - expect(-3).not.toBeWithinRange(0, 2); - expect(-2).not.toBeWithinRange(0, 2); - expect(-1).not.toBeWithinRange(0, 2); - expect(3).not.toBeWithinRange(0, 2); - expect(NaN).not.toBeWithinRange(0, 2); - }); - }); + describe('when invoked', function() { + describe('when subject IS a number >= floor and <= ceiling', function() { + it('should confirm', function() { + expect(0).toBeWithinRange(0, 2); + expect(1).toBeWithinRange(0, 2); + expect(2).toBeWithinRange(0, 2); + }); }); + describe('when subject is NOT a number >= floor and <= ceiling', function() { + it('should deny', function() { + expect(-3).not.toBeWithinRange(0, 2); + expect(-2).not.toBeWithinRange(0, 2); + expect(-1).not.toBeWithinRange(0, 2); + expect(3).not.toBeWithinRange(0, 2); + expect(NaN).not.toBeWithinRange(0, 2); + }); + }); + }); }); var _undefined; describe('toEndWith', function() { - describe('when invoked', function() { - describe('when subject is NOT an undefined or empty string', function() { - describe('when subject is a string whose trailing characters match the expected string', function() { - it('should confirm', function() { - expect('jamie').toEndWith('mie'); - }); - }); - describe('when subject is a string whose trailing characters DO NOT match the expected string', function() { - it('should deny', function() { - expect('jamie ').not.toEndWith('mie'); - expect('jamiE').not.toEndWith('mie'); - }); - }); + describe('when invoked', function() { + describe('when subject is NOT an undefined or empty string', function() { + describe('when subject is a string whose trailing characters match the expected string', function() { + it('should confirm', function() { + expect('jamie').toEndWith('mie'); }); - describe('when subject IS an undefined or empty string', function() { - it('should deny', function() { - expect('').not.toEndWith(''); - expect(_undefined).not.toEndWith(''); - expect(_undefined).not.toEndWith('undefined'); - expect('undefined').not.toEndWith(_undefined); - }); + }); + describe('when subject is a string whose trailing characters DO NOT match the expected string', function() { + it('should deny', function() { + expect('jamie ').not.toEndWith('mie'); + expect('jamiE').not.toEndWith('mie'); }); + }); }); + describe('when subject IS an undefined or empty string', function() { + it('should deny', function() { + expect('').not.toEndWith(''); + expect(_undefined).not.toEndWith(''); + expect(_undefined).not.toEndWith('undefined'); + expect('undefined').not.toEndWith(_undefined); + }); + }); + }); }); describe('toHaveArray', function() { - describeToHaveArrayX('toHaveArray', function() { - it('should confirm', function() { - expect({ - memberName: [] - }).toHaveArray('memberName'); - expect({ - memberName: [1, 2, 3] - }).toHaveArray('memberName'); - }); + describeToHaveArrayX('toHaveArray', function() { + it('should confirm', function() { + expect({ + memberName: [] + }).toHaveArray('memberName'); + expect({ + memberName: [1, 2, 3] + }).toHaveArray('memberName'); }); + }); }); describe('toHaveArrayOfBooleans', function() { - describeToHaveArrayX('toHaveArrayOfBooleans', function() { - describe('when named Array is empty', function() { - it('should confirm', function() { - expect({ - memberName: [] - }).toHaveArrayOfBooleans('memberName'); - }); - }); - describe('when named Array has items', function() { - describe('when all items are booleans', function() { - it('should confirm', function() { - expect({ - memberName: [true] - }).toHaveArrayOfBooleans('memberName'); - expect({ - memberName: [new Boolean(true)] - }).toHaveArrayOfBooleans('memberName'); - expect({ - memberName: [new Boolean(false)] - }).toHaveArrayOfBooleans('memberName'); - expect({ - memberName: [false, true] - }).toHaveArrayOfBooleans('memberName'); - }); - }); - describe('when any item is not a boolean', function() { - it('should deny', function() { - expect({ - memberName: [null] - }).not.toHaveArrayOfBooleans('memberName'); - expect({ - memberName: [null, false] - }).not.toHaveArrayOfBooleans('memberName'); - }); - }); - }); + describeToHaveArrayX('toHaveArrayOfBooleans', function() { + describe('when named Array is empty', function() { + it('should confirm', function() { + expect({ + memberName: [] + }).toHaveArrayOfBooleans('memberName'); + }); }); + describe('when named Array has items', function() { + describe('when all items are booleans', function() { + it('should confirm', function() { + expect({ + memberName: [true] + }).toHaveArrayOfBooleans('memberName'); + expect({ + memberName: [new Boolean(true)] + }).toHaveArrayOfBooleans('memberName'); + expect({ + memberName: [new Boolean(false)] + }).toHaveArrayOfBooleans('memberName'); + expect({ + memberName: [false, true] + }).toHaveArrayOfBooleans('memberName'); + }); + }); + describe('when any item is not a boolean', function() { + it('should deny', function() { + expect({ + memberName: [null] + }).not.toHaveArrayOfBooleans('memberName'); + expect({ + memberName: [null, false] + }).not.toHaveArrayOfBooleans('memberName'); + }); + }); + }); + }); }); describe('toHaveArrayOfNumbers', function() { - describeToHaveArrayX('toHaveArrayOfNumbers', function() { - describe('when named Array is empty', function() { - it('should confirm', function() { - expect({ - memberName: [] - }).toHaveArrayOfNumbers('memberName'); - }); - }); - describe('when named Array has items', function() { - describe('when all items are numbers', function() { - it('should confirm', function() { - expect({ - memberName: [1] - }).toHaveArrayOfNumbers('memberName'); - expect({ - memberName: [new Number(1)] - }).toHaveArrayOfNumbers('memberName'); - expect({ - memberName: [new Number(0)] - }).toHaveArrayOfNumbers('memberName'); - expect({ - memberName: [0, 1] - }).toHaveArrayOfNumbers('memberName'); - }); - }); - describe('when any item is not a number', function() { - it('should deny', function() { - expect({ - memberName: [null] - }).not.toHaveArrayOfNumbers('memberName'); - expect({ - memberName: [null, 0] - }).not.toHaveArrayOfNumbers('memberName'); - }); - }); - }); + describeToHaveArrayX('toHaveArrayOfNumbers', function() { + describe('when named Array is empty', function() { + it('should confirm', function() { + expect({ + memberName: [] + }).toHaveArrayOfNumbers('memberName'); + }); }); + describe('when named Array has items', function() { + describe('when all items are numbers', function() { + it('should confirm', function() { + expect({ + memberName: [1] + }).toHaveArrayOfNumbers('memberName'); + expect({ + memberName: [new Number(1)] + }).toHaveArrayOfNumbers('memberName'); + expect({ + memberName: [new Number(0)] + }).toHaveArrayOfNumbers('memberName'); + expect({ + memberName: [0, 1] + }).toHaveArrayOfNumbers('memberName'); + }); + }); + describe('when any item is not a number', function() { + it('should deny', function() { + expect({ + memberName: [null] + }).not.toHaveArrayOfNumbers('memberName'); + expect({ + memberName: [null, 0] + }).not.toHaveArrayOfNumbers('memberName'); + }); + }); + }); + }); }); describe('toHaveArrayOfObjects', function() { - describeToHaveArrayX('toHaveArrayOfObjects', function() { - describe('when named Array is empty', function() { - it('should confirm', function() { - expect({ - memberName: [] - }).toHaveArrayOfObjects('memberName'); - }); - }); - describe('when named Array has items', function() { - describe('when all items are objects', function() { - it('should confirm', function() { - expect({ - memberName: [{}] - }).toHaveArrayOfObjects('memberName'); - expect({ - memberName: [{}, {}] - }).toHaveArrayOfObjects('memberName'); - }); - }); - describe('when any item is not an object', function() { - it('should deny', function() { - expect({ - memberName: [null] - }).not.toHaveArrayOfObjects('memberName'); - expect({ - memberName: [null, {}] - }).not.toHaveArrayOfObjects('memberName'); - }); - }); - }); + describeToHaveArrayX('toHaveArrayOfObjects', function() { + describe('when named Array is empty', function() { + it('should confirm', function() { + expect({ + memberName: [] + }).toHaveArrayOfObjects('memberName'); + }); }); + describe('when named Array has items', function() { + describe('when all items are objects', function() { + it('should confirm', function() { + expect({ + memberName: [{}] + }).toHaveArrayOfObjects('memberName'); + expect({ + memberName: [{}, {}] + }).toHaveArrayOfObjects('memberName'); + }); + }); + describe('when any item is not an object', function() { + it('should deny', function() { + expect({ + memberName: [null] + }).not.toHaveArrayOfObjects('memberName'); + expect({ + memberName: [null, {}] + }).not.toHaveArrayOfObjects('memberName'); + }); + }); + }); + }); }); describe('toHaveArrayOfSize', function() { - describeToHaveArrayX('toHaveArrayOfSize', function() { - describe('when number of expected items does not match', function() { - it('should deny', function() { - expect({ - memberName: '' - }).not.toHaveArrayOfSize('memberName'); - expect({ - memberName: ['bar'] - }).not.toHaveArrayOfSize('memberName', 0); - }); - }); - describe('when number of expected items does match', function() { - it('should confirm', function() { - expect({ - memberName: [] - }).toHaveArrayOfSize('memberName', 0); - expect({ - memberName: ['bar'] - }).toHaveArrayOfSize('memberName', 1); - expect({ - memberName: ['bar', 'baz'] - }).toHaveArrayOfSize('memberName', 2); - }); - }); + describeToHaveArrayX('toHaveArrayOfSize', function() { + describe('when number of expected items does not match', function() { + it('should deny', function() { + expect({ + memberName: '' + }).not.toHaveArrayOfSize('memberName'); + expect({ + memberName: ['bar'] + }).not.toHaveArrayOfSize('memberName', 0); + }); }); + describe('when number of expected items does match', function() { + it('should confirm', function() { + expect({ + memberName: [] + }).toHaveArrayOfSize('memberName', 0); + expect({ + memberName: ['bar'] + }).toHaveArrayOfSize('memberName', 1); + expect({ + memberName: ['bar', 'baz'] + }).toHaveArrayOfSize('memberName', 2); + }); + }); + }); }); describe('toHaveArrayOfStrings', function() { - describeToHaveArrayX('toHaveArrayOfStrings', function() { - describe('when named Array is empty', function() { - it('should confirm', function() { - expect({ - memberName: [] - }).toHaveArrayOfStrings('memberName'); - }); - }); - describe('when named Array has items', function() { - describe('when all items are strings', function() { - it('should confirm', function() { - expect({ - memberName: ['truthy'] - }).toHaveArrayOfStrings('memberName'); - expect({ - memberName: [new String('truthy')] - }).toHaveArrayOfStrings('memberName'); - expect({ - memberName: [new String('')] - }).toHaveArrayOfStrings('memberName'); - expect({ - memberName: ['', 'truthy'] - }).toHaveArrayOfStrings('memberName'); - }); - }); - describe('when any item is not a string', function() { - it('should deny', function() { - expect({ - memberName: [null] - }).not.toHaveArrayOfStrings('memberName'); - expect({ - memberName: [null, ''] - }).not.toHaveArrayOfStrings('memberName'); - }); - }); - }); + describeToHaveArrayX('toHaveArrayOfStrings', function() { + describe('when named Array is empty', function() { + it('should confirm', function() { + expect({ + memberName: [] + }).toHaveArrayOfStrings('memberName'); + }); }); + describe('when named Array has items', function() { + describe('when all items are strings', function() { + it('should confirm', function() { + expect({ + memberName: ['truthy'] + }).toHaveArrayOfStrings('memberName'); + expect({ + memberName: [new String('truthy')] + }).toHaveArrayOfStrings('memberName'); + expect({ + memberName: [new String('')] + }).toHaveArrayOfStrings('memberName'); + expect({ + memberName: ['', 'truthy'] + }).toHaveArrayOfStrings('memberName'); + }); + }); + describe('when any item is not a string', function() { + it('should deny', function() { + expect({ + memberName: [null] + }).not.toHaveArrayOfStrings('memberName'); + expect({ + memberName: [null, ''] + }).not.toHaveArrayOfStrings('memberName'); + }); + }); + }); + }); }); describe('toHaveBoolean', function() { - describeToHaveBooleanX('toHaveBoolean', function() { - describe('when primitive', function() { - it('should confirm', function() { - expect({ - memberName: true - }).toHaveBoolean('memberName'); - expect({ - memberName: false - }).toHaveBoolean('memberName'); - }); - }); - describe('when Boolean object', function() { - it('should confirm', function() { - expect({ - memberName: new Boolean(true) - }).toHaveBoolean('memberName'); - expect({ - memberName: new Boolean(false) - }).toHaveBoolean('memberName'); - }); - }); + describeToHaveBooleanX('toHaveBoolean', function() { + describe('when primitive', function() { + it('should confirm', function() { + expect({ + memberName: true + }).toHaveBoolean('memberName'); + expect({ + memberName: false + }).toHaveBoolean('memberName'); + }); }); + describe('when Boolean object', function() { + it('should confirm', function() { + expect({ + memberName: new Boolean(true) + }).toHaveBoolean('memberName'); + expect({ + memberName: new Boolean(false) + }).toHaveBoolean('memberName'); + }); + }); + }); }); describe('toHaveCalculable', function() { - describeToHaveX('toHaveCalculable', function() { - describe('when subject CAN be coerced to be used in mathematical operations', function() { - it('should confirm', function() { - expect({ - memberName: '1' - }).toHaveCalculable('memberName'); - expect({ - memberName: '' - }).toHaveCalculable('memberName'); - expect({ - memberName: null - }).toHaveCalculable('memberName'); - }); - }); - describe('when subject can NOT be coerced by JavaScript to be used in mathematical operations', function() { - it('should deny', function() { - expect({ - memberName: {} - }).not.toHaveCalculable('memberName'); - expect({ - memberName: NaN - }).not.toHaveCalculable('memberName'); - }); - }); + describeToHaveX('toHaveCalculable', function() { + describe('when subject CAN be coerced to be used in mathematical operations', function() { + it('should confirm', function() { + expect({ + memberName: '1' + }).toHaveCalculable('memberName'); + expect({ + memberName: '' + }).toHaveCalculable('memberName'); + expect({ + memberName: null + }).toHaveCalculable('memberName'); + }); }); + describe('when subject can NOT be coerced by JavaScript to be used in mathematical operations', function() { + it('should deny', function() { + expect({ + memberName: {} + }).not.toHaveCalculable('memberName'); + expect({ + memberName: NaN + }).not.toHaveCalculable('memberName'); + }); + }); + }); }); describe('toHaveDate', function() { - var mockDate: any; - beforeEach(function() { - mockDate = { - any: new Date(), - early: new Date('2013-01-01T00:00:00.000Z'), - late: new Date('2013-01-01T01:00:00.000Z') - }; + var mockDate: any; + beforeEach(function() { + mockDate = { + any: new Date(), + early: new Date('2013-01-01T00:00:00.000Z'), + late: new Date('2013-01-01T01:00:00.000Z') + }; + }); + describeToHaveX('toHaveDate', function() { + describe('when member is an instance of Date', function() { + it('should confirm', function() { + expect({ + memberName: mockDate.any + }).toHaveDate('memberName'); + }); }); - describeToHaveX('toHaveDate', function() { - describe('when member is an instance of Date', function() { - it('should confirm', function() { - expect({ - memberName: mockDate.any - }).toHaveDate('memberName'); - }); - }); - describe('when member is NOT an instance of Date', function() { - it('should deny', function() { - expect({ - memberName: null - }).not.toHaveDate('memberName'); - }); - }); + describe('when member is NOT an instance of Date', function() { + it('should deny', function() { + expect({ + memberName: null + }).not.toHaveDate('memberName'); + }); }); + }); }); describe('toHaveDateAfter', function() { - var mockDate: any; - beforeEach(function() { - mockDate = { - any: new Date(), - early: new Date('2013-01-01T00:00:00.000Z'), - late: new Date('2013-01-01T01:00:00.000Z') - }; - }); - describeToHaveX('toHaveDateAfter', function() { - describe('when member is an instance of Date', function() { - describe('when date occurs before another', function() { - it('should confirm', function() { - expect({ - memberName: mockDate.late - }).toHaveDateAfter('memberName', mockDate.early); - }); - }); - describe('when date does NOT occur before another', function() { - it('should deny', function() { - expect({ - memberName: mockDate.early - }).not.toHaveDateAfter('memberName', mockDate.late); - }); - }); + var mockDate: any; + beforeEach(function() { + mockDate = { + any: new Date(), + early: new Date('2013-01-01T00:00:00.000Z'), + late: new Date('2013-01-01T01:00:00.000Z') + }; + }); + describeToHaveX('toHaveDateAfter', function() { + describe('when member is an instance of Date', function() { + describe('when date occurs before another', function() { + it('should confirm', function() { + expect({ + memberName: mockDate.late + }).toHaveDateAfter('memberName', mockDate.early); }); - describe('when member is NOT an instance of Date', function() { - it('should deny', function() { - expect({ - memberName: null - }).not.toHaveDateAfter('memberName', mockDate.any); - }); + }); + describe('when date does NOT occur before another', function() { + it('should deny', function() { + expect({ + memberName: mockDate.early + }).not.toHaveDateAfter('memberName', mockDate.late); }); + }); }); + describe('when member is NOT an instance of Date', function() { + it('should deny', function() { + expect({ + memberName: null + }).not.toHaveDateAfter('memberName', mockDate.any); + }); + }); + }); }); describeToHaveX('toHaveDateBefore', function() { - var mockDate: any; - beforeEach(function() { - mockDate = { - any: new Date(), - early: new Date('2013-01-01T00:00:00.000Z'), - late: new Date('2013-01-01T01:00:00.000Z') - }; + var mockDate: any; + beforeEach(function() { + mockDate = { + any: new Date(), + early: new Date('2013-01-01T00:00:00.000Z'), + late: new Date('2013-01-01T01:00:00.000Z') + }; + }); + describe('when member is an instance of Date', function() { + describe('when date occurs before another', function() { + it('should confirm', function() { + expect({ + memberName: mockDate.early + }).toHaveDateBefore('memberName', mockDate.late); + }); }); - describe('when member is an instance of Date', function() { - describe('when date occurs before another', function() { - it('should confirm', function() { - expect({ - memberName: mockDate.early - }).toHaveDateBefore('memberName', mockDate.late); - }); - }); - describe('when date does NOT occur before another', function() { - it('should deny', function() { - expect({ - memberName: mockDate.late - }).not.toHaveDateBefore('memberName', mockDate.early); - }); - }); + describe('when date does NOT occur before another', function() { + it('should deny', function() { + expect({ + memberName: mockDate.late + }).not.toHaveDateBefore('memberName', mockDate.early); + }); }); - describe('when member is NOT an instance of Date', function() { - it('should deny', function() { - expect({ - memberName: null - }).not.toHaveDateBefore('memberName', mockDate.any); - }); + }); + describe('when member is NOT an instance of Date', function() { + it('should deny', function() { + expect({ + memberName: null + }).not.toHaveDateBefore('memberName', mockDate.any); }); + }); }); describe('toHaveEmptyArray', function() { - describeToHaveArrayX('toHaveEmptyArray', function() { - describe('when named array has members', function() { - it('should deny', function() { - expect({ - memberName: [1, 2, 3] - }).not.toHaveEmptyArray('memberName'); - expect({ - memberName: '' - }).not.toHaveEmptyArray('memberName'); - }); - }); - describe('when named array has no members', function() { - it('should confirm', function() { - expect({ - memberName: [] - }).toHaveEmptyArray('memberName'); - }); - }); + describeToHaveArrayX('toHaveEmptyArray', function() { + describe('when named array has members', function() { + it('should deny', function() { + expect({ + memberName: [1, 2, 3] + }).not.toHaveEmptyArray('memberName'); + expect({ + memberName: '' + }).not.toHaveEmptyArray('memberName'); + }); }); + describe('when named array has no members', function() { + it('should confirm', function() { + expect({ + memberName: [] + }).toHaveEmptyArray('memberName'); + }); + }); + }); }); describe('toHaveEmptyObject', function() { - beforeEach(function() { - this.Foo = function() {}; + beforeEach(function() { + this.Foo = function() { }; + }); + describeToHaveX('toHaveEmptyObject', function() { + describe('when subject IS an Object with no instance members', function() { + beforeEach(function() { + this.Foo.prototype = { + b: 2 + }; + }); + it('should confirm', function() { + expect({ + memberName: new this.Foo() + }).toHaveEmptyObject('memberName'); + expect({ + memberName: {} + }).toHaveEmptyObject('memberName'); + }); }); - describeToHaveX('toHaveEmptyObject', function() { - describe('when subject IS an Object with no instance members', function() { - beforeEach(function() { - this.Foo.prototype = { - b: 2 - }; - }); - it('should confirm', function() { - expect({ - memberName: new this.Foo() - }).toHaveEmptyObject('memberName'); - expect({ - memberName: {} - }).toHaveEmptyObject('memberName'); - }); - }); - describe('when subject is NOT an Object with no instance members', function() { - it('should deny', function() { - expect({ - memberName: { - a: 1 - } - }).not.toHaveEmptyObject('memberName'); - expect({ - memberName: null - }).not.toHaveNonEmptyObject('memberName'); - }); - }); + describe('when subject is NOT an Object with no instance members', function() { + it('should deny', function() { + expect({ + memberName: { + a: 1 + } + }).not.toHaveEmptyObject('memberName'); + expect({ + memberName: null + }).not.toHaveNonEmptyObject('memberName'); + }); }); + }); }); describe('toHaveEmptyString', function() { - describeToHaveX('toHaveEmptyString', function() { - describe('when subject IS a string with no characters', function() { - it('should confirm', function() { - expect({ - memberName: '' - }).toHaveEmptyString('memberName'); - }); - }); - describe('when subject is NOT a string with no characters', function() { - it('should deny', function() { - expect({ - memberName: ' ' - }).not.toHaveEmptyString('memberName'); - }); - }); + describeToHaveX('toHaveEmptyString', function() { + describe('when subject IS a string with no characters', function() { + it('should confirm', function() { + expect({ + memberName: '' + }).toHaveEmptyString('memberName'); + }); }); + describe('when subject is NOT a string with no characters', function() { + it('should deny', function() { + expect({ + memberName: ' ' + }).not.toHaveEmptyString('memberName'); + }); + }); + }); }); describe('toHaveEvenNumber', function() { - describeToHaveX('toHaveEvenNumber', function() { - describe('when subject IS an even number', function() { - it('should confirm', function() { - expect({ - memberName: 2 - }).toHaveEvenNumber('memberName'); - }); - }); - describe('when subject is NOT an even number', function() { - it('should deny', function() { - expect({ - memberName: 1 - }).not.toHaveEvenNumber('memberName'); - expect({ - memberName: NaN - }).not.toHaveEvenNumber('memberName'); - }); - }); + describeToHaveX('toHaveEvenNumber', function() { + describe('when subject IS an even number', function() { + it('should confirm', function() { + expect({ + memberName: 2 + }).toHaveEvenNumber('memberName'); + }); }); + describe('when subject is NOT an even number', function() { + it('should deny', function() { + expect({ + memberName: 1 + }).not.toHaveEvenNumber('memberName'); + expect({ + memberName: NaN + }).not.toHaveEvenNumber('memberName'); + }); + }); + }); }); describe('toHaveFalse', function() { - describeToHaveBooleanX('toHaveFalse', function() { - describe('when primitive', function() { - describe('when true', function() { - it('should deny', function() { - expect({ - memberName: true - }).not.toHaveFalse('memberName'); - }); - }); - describe('when false', function() { - it('should confirm', function() { - expect({ - memberName: false - }).toHaveFalse('memberName'); - }); - }); + describeToHaveBooleanX('toHaveFalse', function() { + describe('when primitive', function() { + describe('when true', function() { + it('should deny', function() { + expect({ + memberName: true + }).not.toHaveFalse('memberName'); }); - describe('when Boolean object', function() { - describe('when true', function() { - it('should deny', function() { - expect({ - memberName: new Boolean(true) - }).not.toHaveFalse('memberName'); - }); - }); - describe('when false', function() { - it('should confirm', function() { - expect({ - memberName: new Boolean(false) - }).toHaveFalse('memberName'); - }); - }); + }); + describe('when false', function() { + it('should confirm', function() { + expect({ + memberName: false + }).toHaveFalse('memberName'); }); + }); }); + describe('when Boolean object', function() { + describe('when true', function() { + it('should deny', function() { + expect({ + memberName: new Boolean(true) + }).not.toHaveFalse('memberName'); + }); + }); + describe('when false', function() { + it('should confirm', function() { + expect({ + memberName: new Boolean(false) + }).toHaveFalse('memberName'); + }); + }); + }); + }); }); describe('toHaveHtmlString', function() { - describeToHaveX('toHaveHtmlString', function() { - describe('when subject IS a string of HTML markup', function() { - beforeEach(function() { - this.ngMultiLine = ''; - this.ngMultiLine += ''; - this.ngMultiLine += '\n'; - this.ngMultiLine += ' Watch with Google TV'; - this.ngMultiLine += '\n'; - this.ngMultiLine += ''; - this.ngMultiLine += '\n'; - }); - it('should confirm', function() { - expect({ - memberName: 'text' - }).toHaveHtmlString('memberName'); - expect({ - memberName: 'baz' - }).toHaveHtmlString('memberName'); - expect({ - memberName: '
    ' - }).toHaveHtmlString('memberName'); - expect({ - memberName: '
  • ' - }).toHaveHtmlString('memberName'); - expect({ - memberName: this.ngMultiLine - }).toHaveHtmlString('memberName'); - }); - }); - describe('when subject is NOT a string of HTML markup', function() { - it('should deny', function() { - expect({ - memberName: 'div' - }).not.toHaveHtmlString('memberName'); - expect({ - memberName: null - }).not.toHaveHtmlString('memberName'); - }); - }); + describeToHaveX('toHaveHtmlString', function() { + describe('when subject IS a string of HTML markup', function() { + beforeEach(function() { + this.ngMultiLine = ''; + this.ngMultiLine += ''; + this.ngMultiLine += '\n'; + this.ngMultiLine += ' Watch with Google TV'; + this.ngMultiLine += '\n'; + this.ngMultiLine += ''; + this.ngMultiLine += '\n'; + }); + it('should confirm', function() { + expect({ + memberName: 'text' + }).toHaveHtmlString('memberName'); + expect({ + memberName: 'baz' + }).toHaveHtmlString('memberName'); + expect({ + memberName: '
    ' + }).toHaveHtmlString('memberName'); + expect({ + memberName: '
  • ' + }).toHaveHtmlString('memberName'); + expect({ + memberName: this.ngMultiLine + }).toHaveHtmlString('memberName'); + }); }); + describe('when subject is NOT a string of HTML markup', function() { + it('should deny', function() { + expect({ + memberName: 'div' + }).not.toHaveHtmlString('memberName'); + expect({ + memberName: null + }).not.toHaveHtmlString('memberName'); + }); + }); + }); }); describe('toHaveIso8601', function() { - describeToHaveX('toHaveIso8601', function() { - describe('when member is a Date String conforming to the ISO 8601 standard', - function() { - describe('when specified date is valid', function() { - it('should confirm', function() { - expect({ - memberName: '2013-07-08T07:29:15.863Z' - }).toHaveIso8601('memberName'); - expect({ - memberName: '2013-07-08T07:29:15.863' - }).toHaveIso8601('memberName'); - expect({ - memberName: '2013-07-08T07:29:15' - }).toHaveIso8601('memberName'); - expect({ - memberName: '2013-07-08T07:29' - }).toHaveIso8601('memberName'); - expect({ - memberName: '2013-07-08' - }).toHaveIso8601('memberName'); - }); - }); - describe('when specified date is NOT valid', function() { - it('should deny', function() { - expect({ - memberName: '2013-99-12T00:00:00.000Z' - }).not.toHaveIso8601('memberName'); - expect({ - memberName: '2013-12-99T00:00:00.000Z' - }).not.toHaveIso8601('memberName'); - expect({ - memberName: '2013-01-01T99:00:00.000Z' - }).not.toHaveIso8601('memberName'); - expect({ - memberName: '2013-01-01T99:99:00.000Z' - }).not.toHaveIso8601('memberName'); - expect({ - memberName: '2013-01-01T00:00:99.000Z' - }).not.toHaveIso8601('memberName'); - }); - }); - }); - describe('when member is a String NOT conforming to the ISO 8601 standard', - function() { - it('should deny', function() { - expect({ - memberName: '2013-07-08T07:29:15.' - }).not.toHaveIso8601('memberName'); - expect({ - memberName: '2013-07-08T07:29:' - }).not.toHaveIso8601('memberName'); - expect({ - memberName: '2013-07-08T07:2' - }).not.toHaveIso8601('memberName'); - expect({ - memberName: '2013-07-08T07:' - }).not.toHaveIso8601('memberName'); - expect({ - memberName: '2013-07-08T07' - }).not.toHaveIso8601('memberName'); - expect({ - memberName: '2013-07-08T' - }).not.toHaveIso8601('memberName'); - expect({ - memberName: '2013-07-0' - }).not.toHaveIso8601('memberName'); - expect({ - memberName: '2013-07-' - }).not.toHaveIso8601('memberName'); - expect({ - memberName: '2013-07' - }).not.toHaveIso8601('memberName'); - expect({ - memberName: '2013-0' - }).not.toHaveIso8601('memberName'); - expect({ - memberName: '2013-' - }).not.toHaveIso8601('memberName'); - expect({ - memberName: '2013' - }).not.toHaveIso8601('memberName'); - expect({ - memberName: '201' - }).not.toHaveIso8601('memberName'); - expect({ - memberName: '20' - }).not.toHaveIso8601('memberName'); - expect({ - memberName: '2' - }).not.toHaveIso8601('memberName'); - expect({ - memberName: '' - }).not.toHaveIso8601('memberName'); - }); - }); - }); + describeToHaveX('toHaveIso8601', function() { + describe('when member is a Date String conforming to the ISO 8601 standard', + function() { + describe('when specified date is valid', function() { + it('should confirm', function() { + expect({ + memberName: '2013-07-08T07:29:15.863Z' + }).toHaveIso8601('memberName'); + expect({ + memberName: '2013-07-08T07:29:15.863' + }).toHaveIso8601('memberName'); + expect({ + memberName: '2013-07-08T07:29:15' + }).toHaveIso8601('memberName'); + expect({ + memberName: '2013-07-08T07:29' + }).toHaveIso8601('memberName'); + expect({ + memberName: '2013-07-08' + }).toHaveIso8601('memberName'); + }); + }); + describe('when specified date is NOT valid', function() { + it('should deny', function() { + expect({ + memberName: '2013-99-12T00:00:00.000Z' + }).not.toHaveIso8601('memberName'); + expect({ + memberName: '2013-12-99T00:00:00.000Z' + }).not.toHaveIso8601('memberName'); + expect({ + memberName: '2013-01-01T99:00:00.000Z' + }).not.toHaveIso8601('memberName'); + expect({ + memberName: '2013-01-01T99:99:00.000Z' + }).not.toHaveIso8601('memberName'); + expect({ + memberName: '2013-01-01T00:00:99.000Z' + }).not.toHaveIso8601('memberName'); + }); + }); + }); + describe('when member is a String NOT conforming to the ISO 8601 standard', + function() { + it('should deny', function() { + expect({ + memberName: '2013-07-08T07:29:15.' + }).not.toHaveIso8601('memberName'); + expect({ + memberName: '2013-07-08T07:29:' + }).not.toHaveIso8601('memberName'); + expect({ + memberName: '2013-07-08T07:2' + }).not.toHaveIso8601('memberName'); + expect({ + memberName: '2013-07-08T07:' + }).not.toHaveIso8601('memberName'); + expect({ + memberName: '2013-07-08T07' + }).not.toHaveIso8601('memberName'); + expect({ + memberName: '2013-07-08T' + }).not.toHaveIso8601('memberName'); + expect({ + memberName: '2013-07-0' + }).not.toHaveIso8601('memberName'); + expect({ + memberName: '2013-07-' + }).not.toHaveIso8601('memberName'); + expect({ + memberName: '2013-07' + }).not.toHaveIso8601('memberName'); + expect({ + memberName: '2013-0' + }).not.toHaveIso8601('memberName'); + expect({ + memberName: '2013-' + }).not.toHaveIso8601('memberName'); + expect({ + memberName: '2013' + }).not.toHaveIso8601('memberName'); + expect({ + memberName: '201' + }).not.toHaveIso8601('memberName'); + expect({ + memberName: '20' + }).not.toHaveIso8601('memberName'); + expect({ + memberName: '2' + }).not.toHaveIso8601('memberName'); + expect({ + memberName: '' + }).not.toHaveIso8601('memberName'); + }); + }); + }); }); describe('toHaveJsonString', function() { - describeToHaveX('toHaveJsonString', function() { - describe('when subject IS a string of parseable JSON', function() { - it('should confirm', function() { - expect({ - memberName: '{}' - }).toHaveJsonString('memberName'); - expect({ - memberName: '[]' - }).toHaveJsonString('memberName'); - expect({ - memberName: '[1]' - }).toHaveJsonString('memberName'); - }); - }); - describe('when subject is NOT a string of parseable JSON', function() { - it('should deny', function() { - expect({ - memberName: '[1,]' - }).not.toHaveJsonString('memberName'); - expect({ - memberName: '<>' - }).not.toHaveJsonString('memberName'); - expect({ - memberName: null - }).not.toHaveJsonString('memberName'); - expect({ - memberName: '' - }).not.toHaveJsonString('memberName'); - expect({ - memberName: _undefined - }).not.toHaveJsonString('memberName'); - }); - }); + describeToHaveX('toHaveJsonString', function() { + describe('when subject IS a string of parseable JSON', function() { + it('should confirm', function() { + expect({ + memberName: '{}' + }).toHaveJsonString('memberName'); + expect({ + memberName: '[]' + }).toHaveJsonString('memberName'); + expect({ + memberName: '[1]' + }).toHaveJsonString('memberName'); + }); }); + describe('when subject is NOT a string of parseable JSON', function() { + it('should deny', function() { + expect({ + memberName: '[1,]' + }).not.toHaveJsonString('memberName'); + expect({ + memberName: '<>' + }).not.toHaveJsonString('memberName'); + expect({ + memberName: null + }).not.toHaveJsonString('memberName'); + expect({ + memberName: '' + }).not.toHaveJsonString('memberName'); + expect({ + memberName: _undefined + }).not.toHaveJsonString('memberName'); + }); + }); + }); }); describe('toHaveMember', function() { - describeToHaveX('toHaveMember', function() {}); + describeToHaveX('toHaveMember', function() { }); }); describe('toHaveMethod', function() { - describeToHaveX('toHaveMethod', function() { - describe('when subject IS a function', function() { - it('should confirm', function() { - expect({ - memberName: function() {} - }).toHaveMethod('memberName'); - }); - }); - describe('when subject is NOT a function', function() { - it('should deny', function() { - expect({ - memberName: /regexp/ - }).not.toHaveMethod('memberName'); - }); - }); + describeToHaveX('toHaveMethod', function() { + describe('when subject IS a function', function() { + it('should confirm', function() { + expect({ + memberName: function() { } + }).toHaveMethod('memberName'); + }); }); + describe('when subject is NOT a function', function() { + it('should deny', function() { + expect({ + memberName: /regexp/ + }).not.toHaveMethod('memberName'); + }); + }); + }); }); describe('toHaveNonEmptyArray', function() { - describeToHaveArrayX('toHaveNonEmptyArray', function() { - describe('when named array has no members', function() { - it('should deny', function() { - expect({ - memberName: [] - }).not.toHaveNonEmptyArray('memberName'); - }); - }); - describe('when named array has members', function() { - it('should confirm', function() { - expect({ - memberName: [1, 2, 3] - }).toHaveNonEmptyArray('memberName'); - }); - }); + describeToHaveArrayX('toHaveNonEmptyArray', function() { + describe('when named array has no members', function() { + it('should deny', function() { + expect({ + memberName: [] + }).not.toHaveNonEmptyArray('memberName'); + }); }); + describe('when named array has members', function() { + it('should confirm', function() { + expect({ + memberName: [1, 2, 3] + }).toHaveNonEmptyArray('memberName'); + }); + }); + }); }); describe('toHaveNonEmptyObject', function() { - describeToHaveX('toHaveNonEmptyObject', function() { - beforeEach(function() { - this.Foo = function() {}; - }); - describe('when subject IS an Object with at least one instance member', function() { - it('should confirm', function() { - expect({ - memberName: { - a: 1 - } - }).toHaveNonEmptyObject('memberName'); - }); - }); - describe('when subject is NOT an Object with at least one instance member', function() { - beforeEach(function() { - this.Foo.prototype = { - b: 2 - }; - }); - it('should deny', function() { - expect({ - memberName: new this.Foo() - }).not.toHaveNonEmptyObject('memberName'); - expect({ - memberName: {} - }).not.toHaveNonEmptyObject('memberName'); - expect({ - memberName: null - }).not.toHaveNonEmptyObject('memberName'); - }); - }); + describeToHaveX('toHaveNonEmptyObject', function() { + beforeEach(function() { + this.Foo = function() { }; }); + describe('when subject IS an Object with at least one instance member', function() { + it('should confirm', function() { + expect({ + memberName: { + a: 1 + } + }).toHaveNonEmptyObject('memberName'); + }); + }); + describe('when subject is NOT an Object with at least one instance member', function() { + beforeEach(function() { + this.Foo.prototype = { + b: 2 + }; + }); + it('should deny', function() { + expect({ + memberName: new this.Foo() + }).not.toHaveNonEmptyObject('memberName'); + expect({ + memberName: {} + }).not.toHaveNonEmptyObject('memberName'); + expect({ + memberName: null + }).not.toHaveNonEmptyObject('memberName'); + }); + }); + }); }); describe('toHaveNonEmptyString', function() { - describeToHaveX('toHaveNonEmptyString', function() { - describe('when subject IS a string with at least one character', function() { - it('should confirm', function() { - expect({ - memberName: ' ' - }).toHaveNonEmptyString('memberName'); - }); - }); - describe('when subject is NOT a string with at least one character', function() { - it('should deny', function() { - expect({ - memberName: '' - }).not.toHaveNonEmptyString('memberName'); - expect({ - memberName: null - }).not.toHaveNonEmptyString('memberName'); - }); - }); + describeToHaveX('toHaveNonEmptyString', function() { + describe('when subject IS a string with at least one character', function() { + it('should confirm', function() { + expect({ + memberName: ' ' + }).toHaveNonEmptyString('memberName'); + }); }); + describe('when subject is NOT a string with at least one character', function() { + it('should deny', function() { + expect({ + memberName: '' + }).not.toHaveNonEmptyString('memberName'); + expect({ + memberName: null + }).not.toHaveNonEmptyString('memberName'); + }); + }); + }); }); describe('toHaveNumber', function() { - describeToHaveX('toHaveNumber', function() { - describe('when subject IS a number', function() { - it('should confirm', function() { - expect({ - memberName: 1 - }).toHaveNumber('memberName'); - expect({ - memberName: 1.11 - }).toHaveNumber('memberName'); - expect({ - memberName: 1e3 - }).toHaveNumber('memberName'); - expect({ - memberName: 0.11 - }).toHaveNumber('memberName'); - expect({ - memberName: -11 - }).toHaveNumber('memberName'); - }); - }); - describe('when subject is NOT a number', function() { - it('should deny', function() { - expect({ - memberName: '1' - }).not.toHaveNumber('memberName'); - expect({ - memberName: NaN - }).not.toHaveNumber('memberName'); - }); - }); + describeToHaveX('toHaveNumber', function() { + describe('when subject IS a number', function() { + it('should confirm', function() { + expect({ + memberName: 1 + }).toHaveNumber('memberName'); + expect({ + memberName: 1.11 + }).toHaveNumber('memberName'); + expect({ + memberName: 1e3 + }).toHaveNumber('memberName'); + expect({ + memberName: 0.11 + }).toHaveNumber('memberName'); + expect({ + memberName: -11 + }).toHaveNumber('memberName'); + }); }); + describe('when subject is NOT a number', function() { + it('should deny', function() { + expect({ + memberName: '1' + }).not.toHaveNumber('memberName'); + expect({ + memberName: NaN + }).not.toHaveNumber('memberName'); + }); + }); + }); }); describe('toHaveNumberWithinRange', function() { - describeToHaveX('toHaveNumberWithinRange', function() { - describe('when subject IS a number >= floor and <= ceiling', function() { - it('should confirm', function() { - expect({ - memberName: 0 - }).toHaveNumberWithinRange('memberName', 0, 2); - expect({ - memberName: 1 - }).toHaveNumberWithinRange('memberName', 0, 2); - expect({ - memberName: 2 - }).toHaveNumberWithinRange('memberName', 0, 2); - }); - }); - describe('when subject is NOT a number >= floor and <= ceiling', function() { - it('should deny', function() { - expect({ - memberName: -3 - }).not.toHaveNumberWithinRange('memberName', 0, 2); - expect({ - memberName: -2 - }).not.toHaveNumberWithinRange('memberName', 0, 2); - expect({ - memberName: -1 - }).not.toHaveNumberWithinRange('memberName', 0, 2); - expect({ - memberName: 3 - }).not.toHaveNumberWithinRange('memberName', 0, 2); - expect({ - memberName: NaN - }).not.toHaveNumberWithinRange('memberName', 0, 2); - }); - }); + describeToHaveX('toHaveNumberWithinRange', function() { + describe('when subject IS a number >= floor and <= ceiling', function() { + it('should confirm', function() { + expect({ + memberName: 0 + }).toHaveNumberWithinRange('memberName', 0, 2); + expect({ + memberName: 1 + }).toHaveNumberWithinRange('memberName', 0, 2); + expect({ + memberName: 2 + }).toHaveNumberWithinRange('memberName', 0, 2); + }); }); + describe('when subject is NOT a number >= floor and <= ceiling', function() { + it('should deny', function() { + expect({ + memberName: -3 + }).not.toHaveNumberWithinRange('memberName', 0, 2); + expect({ + memberName: -2 + }).not.toHaveNumberWithinRange('memberName', 0, 2); + expect({ + memberName: -1 + }).not.toHaveNumberWithinRange('memberName', 0, 2); + expect({ + memberName: 3 + }).not.toHaveNumberWithinRange('memberName', 0, 2); + expect({ + memberName: NaN + }).not.toHaveNumberWithinRange('memberName', 0, 2); + }); + }); + }); }); describe('toHaveObject', function() { - describeToHaveX('toHaveObject', function() { - beforeEach(function() { - this.Foo = function() {}; - }); - describe('when subject IS an Object', function() { - it('should confirm', function() { - expect({ - memberName: new Object() - }).toHaveObject('memberName'); - expect({ - memberName: new this.Foo() - }).toHaveObject('memberName'); - expect({ - memberName: {} - }).toHaveObject('memberName'); - }); - }); - describe('when subject is NOT an Object', function() { - it('should deny', function() { - expect({ - memberName: null - }).not.toHaveObject('memberName'); - expect({ - memberName: 123 - }).not.toHaveObject('memberName'); - expect({ - memberName: '[object Object]' - }).not.toHaveObject('memberName'); - }); - }); + describeToHaveX('toHaveObject', function() { + beforeEach(function() { + this.Foo = function() { }; }); + describe('when subject IS an Object', function() { + it('should confirm', function() { + expect({ + memberName: new Object() + }).toHaveObject('memberName'); + expect({ + memberName: new this.Foo() + }).toHaveObject('memberName'); + expect({ + memberName: {} + }).toHaveObject('memberName'); + }); + }); + describe('when subject is NOT an Object', function() { + it('should deny', function() { + expect({ + memberName: null + }).not.toHaveObject('memberName'); + expect({ + memberName: 123 + }).not.toHaveObject('memberName'); + expect({ + memberName: '[object Object]' + }).not.toHaveObject('memberName'); + }); + }); + }); }); describe('toHaveOddNumber', function() { - describeToHaveX('toHaveOddNumber', function() { - describe('when subject IS an odd number', function() { - it('should confirm', function() { - expect({ - memberName: 1 - }).toHaveOddNumber('memberName'); - }); - }); - describe('when subject is NOT an odd number', function() { - it('should deny', function() { - expect({ - memberName: 2 - }).not.toHaveOddNumber('memberName'); - expect({ - memberName: NaN - }).not.toHaveOddNumber('memberName'); - }); - }); + describeToHaveX('toHaveOddNumber', function() { + describe('when subject IS an odd number', function() { + it('should confirm', function() { + expect({ + memberName: 1 + }).toHaveOddNumber('memberName'); + }); }); + describe('when subject is NOT an odd number', function() { + it('should deny', function() { + expect({ + memberName: 2 + }).not.toHaveOddNumber('memberName'); + expect({ + memberName: NaN + }).not.toHaveOddNumber('memberName'); + }); + }); + }); }); describe('toHaveString', function() { - describeToHaveX('toHaveString', function() { - describe('when subject IS a string of any length', function() { - it('should confirm', function() { - expect({ - memberName: '' - }).toHaveString('memberName'); - expect({ - memberName: ' ' - }).toHaveString('memberName'); - }); - }); - describe('when subject is NOT a string of any length', function() { - it('should deny', function() { - expect({ - memberName: null - }).not.toHaveString('memberName'); - }); - }); + describeToHaveX('toHaveString', function() { + describe('when subject IS a string of any length', function() { + it('should confirm', function() { + expect({ + memberName: '' + }).toHaveString('memberName'); + expect({ + memberName: ' ' + }).toHaveString('memberName'); + }); }); + describe('when subject is NOT a string of any length', function() { + it('should deny', function() { + expect({ + memberName: null + }).not.toHaveString('memberName'); + }); + }); + }); }); describe('toHaveStringLongerThan', function() { - describeToHaveX('toHaveStringLongerThan', function() { - describe('when the subject and comparison ARE both strings', function() { - describe('when the subject IS longer than the comparision string', function() { - it('should confirm', function() { - expect({ - memberName: 'abc' - }).toHaveStringLongerThan('memberName', 'ab'); - expect({ - memberName: 'a' - }).toHaveStringLongerThan('memberName', ''); - }); - }); - describe('when the subject is NOT longer than the comparision string', function() { - it('should deny', function() { - expect({ - memberName: 'ab' - }).not.toHaveStringLongerThan('memberName', 'abc'); - expect({ - memberName: '' - }).not.toHaveStringLongerThan('memberName', 'a'); - }); - }); + describeToHaveX('toHaveStringLongerThan', function() { + describe('when the subject and comparison ARE both strings', function() { + describe('when the subject IS longer than the comparision string', function() { + it('should confirm', function() { + expect({ + memberName: 'abc' + }).toHaveStringLongerThan('memberName', 'ab'); + expect({ + memberName: 'a' + }).toHaveStringLongerThan('memberName', ''); }); - describe('when the subject and comparison are NOT both strings', function() { - it('should deny (we are asserting the relative lengths of two strings)', function() { - expect({ - memberName: 'truthy' - }).not.toHaveStringLongerThan('memberName', _undefined); - expect({ - memberName: _undefined - }).not.toHaveStringLongerThan('memberName', 'truthy'); - expect({ - memberName: '' - }).not.toHaveStringLongerThan('memberName', _undefined); - expect({ - memberName: _undefined - }).not.toHaveStringLongerThan('memberName', ''); - }); + }); + describe('when the subject is NOT longer than the comparision string', function() { + it('should deny', function() { + expect({ + memberName: 'ab' + }).not.toHaveStringLongerThan('memberName', 'abc'); + expect({ + memberName: '' + }).not.toHaveStringLongerThan('memberName', 'a'); }); + }); }); + describe('when the subject and comparison are NOT both strings', function() { + it('should deny (we are asserting the relative lengths of two strings)', function() { + expect({ + memberName: 'truthy' + }).not.toHaveStringLongerThan('memberName', _undefined); + expect({ + memberName: _undefined + }).not.toHaveStringLongerThan('memberName', 'truthy'); + expect({ + memberName: '' + }).not.toHaveStringLongerThan('memberName', _undefined); + expect({ + memberName: _undefined + }).not.toHaveStringLongerThan('memberName', ''); + }); + }); + }); }); describe('toHaveStringSameLengthAs', function() { - describeToHaveX('toHaveStringSameLengthAs', function() { - describe('when the subject and comparison ARE both strings', function() { - describe('when the subject IS the same length as the comparision string', function() { - it('should confirm', function() { - expect({ - memberName: 'ab' - }).toHaveStringSameLengthAs('memberName', 'ab'); - }); - }); - describe('when the subject is NOT the same length as the comparision string', function() { - it('should deny', function() { - expect({ - memberName: 'abc' - }).not.toHaveStringSameLengthAs('memberName', 'ab'); - expect({ - memberName: 'a' - }).not.toHaveStringSameLengthAs('memberName', ''); - expect({ - memberName: '' - }).not.toHaveStringSameLengthAs('memberName', 'a'); - }); - }); + describeToHaveX('toHaveStringSameLengthAs', function() { + describe('when the subject and comparison ARE both strings', function() { + describe('when the subject IS the same length as the comparision string', function() { + it('should confirm', function() { + expect({ + memberName: 'ab' + }).toHaveStringSameLengthAs('memberName', 'ab'); }); - describe('when the subject and comparison are NOT both strings', function() { - it('should deny (we are asserting the relative lengths of two strings)', function() { - expect({ - memberName: 'truthy' - }).not.toHaveStringSameLengthAs('memberName', _undefined); - expect({ - memberName: _undefined - }).not.toHaveStringSameLengthAs('memberName', 'truthy'); - expect({ - memberName: '' - }).not.toHaveStringSameLengthAs('memberName', _undefined); - expect({ - memberName: _undefined - }).not.toHaveStringSameLengthAs('memberName', ''); - }); + }); + describe('when the subject is NOT the same length as the comparision string', function() { + it('should deny', function() { + expect({ + memberName: 'abc' + }).not.toHaveStringSameLengthAs('memberName', 'ab'); + expect({ + memberName: 'a' + }).not.toHaveStringSameLengthAs('memberName', ''); + expect({ + memberName: '' + }).not.toHaveStringSameLengthAs('memberName', 'a'); }); + }); }); + describe('when the subject and comparison are NOT both strings', function() { + it('should deny (we are asserting the relative lengths of two strings)', function() { + expect({ + memberName: 'truthy' + }).not.toHaveStringSameLengthAs('memberName', _undefined); + expect({ + memberName: _undefined + }).not.toHaveStringSameLengthAs('memberName', 'truthy'); + expect({ + memberName: '' + }).not.toHaveStringSameLengthAs('memberName', _undefined); + expect({ + memberName: _undefined + }).not.toHaveStringSameLengthAs('memberName', ''); + }); + }); + }); }); describe('toHaveStringShorterThan', function() { - describeToHaveX('toHaveStringShorterThan', function() { - describe('when the subject and comparison ARE both strings', function() { - describe('when the subject IS shorter than the comparision string', function() { - it('should confirm', function() { - expect({ - memberName: 'ab' - }).toHaveStringShorterThan('memberName', 'abc'); - expect({ - memberName: '' - }).toHaveStringShorterThan('memberName', 'a'); - }); - }); - describe('when the subject is NOT shorter than the comparision string', function() { - it('should deny', function() { - expect({ - memberName: 'abc' - }).not.toHaveStringShorterThan('memberName', 'ab'); - expect({ - memberName: 'a' - }).not.toHaveStringShorterThan('memberName', ''); - }); - }); + describeToHaveX('toHaveStringShorterThan', function() { + describe('when the subject and comparison ARE both strings', function() { + describe('when the subject IS shorter than the comparision string', function() { + it('should confirm', function() { + expect({ + memberName: 'ab' + }).toHaveStringShorterThan('memberName', 'abc'); + expect({ + memberName: '' + }).toHaveStringShorterThan('memberName', 'a'); }); - describe('when the subject and comparison are NOT both strings', function() { - it('should deny (we are asserting the relative lengths of two strings)', function() { - expect({ - memberName: 'truthy' - }).not.toHaveStringShorterThan('memberName', _undefined); - expect({ - memberName: _undefined - }).not.toHaveStringShorterThan('memberName', 'truthy'); - expect({ - memberName: '' - }).not.toHaveStringShorterThan('memberName', _undefined); - expect({ - memberName: _undefined - }).not.toHaveStringShorterThan('memberName', ''); - }); + }); + describe('when the subject is NOT shorter than the comparision string', function() { + it('should deny', function() { + expect({ + memberName: 'abc' + }).not.toHaveStringShorterThan('memberName', 'ab'); + expect({ + memberName: 'a' + }).not.toHaveStringShorterThan('memberName', ''); }); + }); }); + describe('when the subject and comparison are NOT both strings', function() { + it('should deny (we are asserting the relative lengths of two strings)', function() { + expect({ + memberName: 'truthy' + }).not.toHaveStringShorterThan('memberName', _undefined); + expect({ + memberName: _undefined + }).not.toHaveStringShorterThan('memberName', 'truthy'); + expect({ + memberName: '' + }).not.toHaveStringShorterThan('memberName', _undefined); + expect({ + memberName: _undefined + }).not.toHaveStringShorterThan('memberName', ''); + }); + }); + }); }); describe('toHaveTrue', function() { - describeToHaveBooleanX('toHaveTrue', function() { - describe('when primitive', function() { - describe('when true', function() { - it('should confirm', function() { - expect({ - memberName: true - }).toHaveTrue('memberName'); - }); - }); - describe('when false', function() { - it('should deny', function() { - expect({ - memberName: false - }).not.toHaveTrue('memberName'); - }); - }); + describeToHaveBooleanX('toHaveTrue', function() { + describe('when primitive', function() { + describe('when true', function() { + it('should confirm', function() { + expect({ + memberName: true + }).toHaveTrue('memberName'); }); - describe('when Boolean object', function() { - describe('when true', function() { - it('should confirm', function() { - expect({ - memberName: new Boolean(true) - }).toHaveTrue('memberName'); - }); - }); - describe('when false', function() { - it('should deny', function() { - expect({ - memberName: new Boolean(false) - }).not.toHaveTrue('memberName'); - }); - }); + }); + describe('when false', function() { + it('should deny', function() { + expect({ + memberName: false + }).not.toHaveTrue('memberName'); }); + }); }); + describe('when Boolean object', function() { + describe('when true', function() { + it('should confirm', function() { + expect({ + memberName: new Boolean(true) + }).toHaveTrue('memberName'); + }); + }); + describe('when false', function() { + it('should deny', function() { + expect({ + memberName: new Boolean(false) + }).not.toHaveTrue('memberName'); + }); + }); + }); + }); }); describe('toHaveWhitespaceString', function() { - describeToHaveX('toHaveWhitespaceString', function() { - describe('when subject IS a string containing only tabs, spaces, returns etc', function() { - it('should confirm', function() { - expect({ - memberName: ' ' - }).toHaveWhitespaceString('memberName'); - expect({ - memberName: '' - }).toHaveWhitespaceString('memberName'); - }); - }); - describe('when subject is NOT a string containing only tabs, spaces, returns etc', function() { - it('should deny', function() { - expect({ - memberName: 'has-no-whitespace' - }).not.toHaveWhitespaceString('memberName'); - expect({ - memberName: 'has whitespace' - }).not.toHaveWhitespaceString('memberName'); - expect({ - memberName: null - }).not.toHaveWhitespaceString('memberName'); - }); - }); + describeToHaveX('toHaveWhitespaceString', function() { + describe('when subject IS a string containing only tabs, spaces, returns etc', function() { + it('should confirm', function() { + expect({ + memberName: ' ' + }).toHaveWhitespaceString('memberName'); + expect({ + memberName: '' + }).toHaveWhitespaceString('memberName'); + }); }); + describe('when subject is NOT a string containing only tabs, spaces, returns etc', function() { + it('should deny', function() { + expect({ + memberName: 'has-no-whitespace' + }).not.toHaveWhitespaceString('memberName'); + expect({ + memberName: 'has whitespace' + }).not.toHaveWhitespaceString('memberName'); + expect({ + memberName: null + }).not.toHaveWhitespaceString('memberName'); + }); + }); + }); }); describe('toHaveWholeNumber', function() { - describeToHaveX('toHaveWholeNumber', function() { - describe('when subject IS a number with no positive decimal places', function() { - it('should confirm', function() { - expect({ - memberName: 1 - }).toHaveWholeNumber('memberName'); - expect({ - memberName: 0 - }).toHaveWholeNumber('memberName'); - expect({ - memberName: 0.0 - }).toHaveWholeNumber('memberName'); - }); - }); - describe('when subject is NOT a number with no positive decimal places', function() { - it('should deny', function() { - expect({ - memberName: NaN - }).not.toHaveWholeNumber('memberName'); - expect({ - memberName: 1.1 - }).not.toHaveWholeNumber('memberName'); - expect({ - memberName: 0.1 - }).not.toHaveWholeNumber('memberName'); - }); - }); + describeToHaveX('toHaveWholeNumber', function() { + describe('when subject IS a number with no positive decimal places', function() { + it('should confirm', function() { + expect({ + memberName: 1 + }).toHaveWholeNumber('memberName'); + expect({ + memberName: 0 + }).toHaveWholeNumber('memberName'); + expect({ + memberName: 0.0 + }).toHaveWholeNumber('memberName'); + }); }); + describe('when subject is NOT a number with no positive decimal places', function() { + it('should deny', function() { + expect({ + memberName: NaN + }).not.toHaveWholeNumber('memberName'); + expect({ + memberName: 1.1 + }).not.toHaveWholeNumber('memberName'); + expect({ + memberName: 0.1 + }).not.toHaveWholeNumber('memberName'); + }); + }); + }); }); describe('toImplement', function() { - describe('when invoked', function() { - describe('when subject IS an Object containing all of the supplied members', function() { - it('should confirm', function() { - expect({ - a: 1, - b: 2 - }).toImplement({ - a: 1, - b: 2 - }); - expect({ - a: 1, - b: 2 - }).toImplement({ - a: 1 - }); - }); + describe('when invoked', function() { + describe('when subject IS an Object containing all of the supplied members', function() { + it('should confirm', function() { + expect({ + a: 1, + b: 2 + }).toImplement({ + a: 1, + b: 2 }); - describe('when subject is NOT an Object containing all of the supplied members', function() { - it('should deny', function() { - expect({ - a: 1 - }).not.toImplement({ - c: 3 - }); - expect(null).not.toImplement({ - a: 1 - }); - }); + expect({ + a: 1, + b: 2 + }).toImplement({ + a: 1 }); + }); }); + describe('when subject is NOT an Object containing all of the supplied members', function() { + it('should deny', function() { + expect({ + a: 1 + }).not.toImplement({ + c: 3 + }); + expect(null).not.toImplement({ + a: 1 + }); + }); + }); + }); }); describe('toStartWith', function() { - describe('when invoked', function() { - describe('when subject is NOT an undefined or empty string', function() { - describe('when subject is a string whose leading characters match the expected string', function() { - it('should confirm', function() { - expect('jamie').toStartWith('jam'); - }); - }); - describe('when subject is a string whose leading characters DO NOT match the expected string', function() { - it('should deny', function() { - expect(' jamie').not.toStartWith('jam'); - expect('Jamie').not.toStartWith('jam'); - }); - }); + describe('when invoked', function() { + describe('when subject is NOT an undefined or empty string', function() { + describe('when subject is a string whose leading characters match the expected string', function() { + it('should confirm', function() { + expect('jamie').toStartWith('jam'); }); - describe('when subject IS an undefined or empty string', function() { - it('should deny', function() { - expect('').not.toStartWith(''); - expect(_undefined).not.toStartWith(''); - expect(_undefined).not.toStartWith('undefined'); - expect('undefined').not.toStartWith(_undefined); - }); + }); + describe('when subject is a string whose leading characters DO NOT match the expected string', function() { + it('should deny', function() { + expect(' jamie').not.toStartWith('jam'); + expect('Jamie').not.toStartWith('jam'); }); + }); }); + describe('when subject IS an undefined or empty string', function() { + it('should deny', function() { + expect('').not.toStartWith(''); + expect(_undefined).not.toStartWith(''); + expect(_undefined).not.toStartWith('undefined'); + expect('undefined').not.toStartWith(_undefined); + }); + }); + }); }); describe('toThrowAnyError', function() { - describe('when supplied a function', function() { - describe('when function errors when invoked', function() { - beforeEach(function() { - this.throwError = function() { - throw new Error('wut?'); - }; - this.badReference = function() { - return badReference.someValue; - }; - }); - it('should confirm', function() { - expect(this.throwError).toThrowAnyError(); - expect(this.badReference).toThrowAnyError(); - }); - }); - describe('when function does NOT error when invoked', function() { - beforeEach(function() { - this.noErrors = function() {}; - }); - it('should deny', function() { - expect(this.noErrors).not.toThrowAnyError(); - }); - }); + describe('when supplied a function', function() { + describe('when function errors when invoked', function() { + beforeEach(function() { + this.throwError = function() { + throw new Error('wut?'); + }; + this.badReference = function() { + return badReference.someValue; + }; + }); + it('should confirm', function() { + expect(this.throwError).toThrowAnyError(); + expect(this.badReference).toThrowAnyError(); + }); }); + describe('when function does NOT error when invoked', function() { + beforeEach(function() { + this.noErrors = function() { }; + }); + it('should deny', function() { + expect(this.noErrors).not.toThrowAnyError(); + }); + }); + }); }); describe('toThrowErrorOfType', function() { - describe('when supplied a function', function() { - describe('when function errors when invoked', function() { - beforeEach(function() { - this.throwError = function() { - throw new Error('wut?'); - }; - this.badReference = function() { - return badReference.someValue; - }; - }); - describe('when the error is of the expected type', function() { - it('should confirm', function() { - expect(this.throwError).toThrowErrorOfType('Error'); - expect(this.badReference).toThrowErrorOfType('ReferenceError'); - }); - }); - describe('when the error is NOT of the expected type', function() { - it('should confirm', function() { - expect(this.throwError).not.toThrowErrorOfType('ReferenceError'); - expect(this.badReference).not.toThrowErrorOfType('Error'); - }); - }); + describe('when supplied a function', function() { + describe('when function errors when invoked', function() { + beforeEach(function() { + this.throwError = function() { + throw new Error('wut?'); + }; + this.badReference = function() { + return badReference.someValue; + }; + }); + describe('when the error is of the expected type', function() { + it('should confirm', function() { + expect(this.throwError).toThrowErrorOfType('Error'); + expect(this.badReference).toThrowErrorOfType('ReferenceError'); }); + }); + describe('when the error is NOT of the expected type', function() { + it('should confirm', function() { + expect(this.throwError).not.toThrowErrorOfType('ReferenceError'); + expect(this.badReference).not.toThrowErrorOfType('Error'); + }); + }); }); + }); }); From c4f6180ca5edb993ce567b90df47e95faf2f860f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Ewerl=C3=B6f?= Date: Mon, 23 Nov 2015 19:41:46 +0100 Subject: [PATCH 114/389] reformated the definition file to tab=2 --- .../jamiemason-jasmine-matchers.d.ts | 156 +++++++++--------- 1 file changed, 78 insertions(+), 78 deletions(-) diff --git a/jasmine-matchers/jamiemason-jasmine-matchers.d.ts b/jasmine-matchers/jamiemason-jasmine-matchers.d.ts index e293496c6..91b473a58 100644 --- a/jasmine-matchers/jamiemason-jasmine-matchers.d.ts +++ b/jasmine-matchers/jamiemason-jasmine-matchers.d.ts @@ -22,87 +22,87 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI /// declare module jasmine { - interface Matchers { - // These functions are written in the order defined in the src directory of jasmine-matchers - // The type system is used smartly whenever it can provide value (by looking at the code of every matcher) - toBeAfter(otherDate: Date): boolean; // - toBeArray(): boolean; // - toBeArrayOfBooleans(): boolean; // - toBeArrayOfNumbers(): boolean; - toBeArrayOfObjects(): boolean; - toBeArrayOfSize(size: number): boolean; - toBeArrayOfStrings(): boolean; - toBeBefore(otherDate: Date): boolean; // - toBeBoolean(): boolean; - toBeCalculable(): boolean; - toBeDate(): boolean; - toBeEmptyArray(): boolean; - toBeEmptyObject(): boolean; - toBeEmptyString(): boolean; - toBeEvenNumber(): boolean; - toBeFalse(): boolean; - toBeFunction(): boolean; - toBeHtmlString(): boolean; - toBeIso8601(): boolean; - toBeJsonString(): boolean; - toBeLongerThan(other: string): boolean; - toBeNonEmptyArray(): boolean; - toBeNonEmptyObject(): boolean; - toBeNonEmptyString(): boolean; - toBeNumber(): boolean; - toBeObject(): boolean; - toBeOddNumber(): boolean; - toBeSameLengthAs(other: string): boolean; - toBeShorterThan(other: string): boolean; - toBeString(): boolean; - toBeTrue(): boolean; - toBeWhitespace(): boolean; - toBeWholeNumber(): boolean; - toBeWithinRange(floor: number, ceiling: number): boolean; + interface Matchers { + // These functions are written in the order defined in the src directory of jasmine-matchers + // The type system is used smartly whenever it can provide value (by looking at the code of every matcher) + toBeAfter(otherDate: Date): boolean; // + toBeArray(): boolean; // + toBeArrayOfBooleans(): boolean; // + toBeArrayOfNumbers(): boolean; + toBeArrayOfObjects(): boolean; + toBeArrayOfSize(size: number): boolean; + toBeArrayOfStrings(): boolean; + toBeBefore(otherDate: Date): boolean; // + toBeBoolean(): boolean; + toBeCalculable(): boolean; + toBeDate(): boolean; + toBeEmptyArray(): boolean; + toBeEmptyObject(): boolean; + toBeEmptyString(): boolean; + toBeEvenNumber(): boolean; + toBeFalse(): boolean; + toBeFunction(): boolean; + toBeHtmlString(): boolean; + toBeIso8601(): boolean; + toBeJsonString(): boolean; + toBeLongerThan(other: string): boolean; + toBeNonEmptyArray(): boolean; + toBeNonEmptyObject(): boolean; + toBeNonEmptyString(): boolean; + toBeNumber(): boolean; + toBeObject(): boolean; + toBeOddNumber(): boolean; + toBeSameLengthAs(other: string): boolean; + toBeShorterThan(other: string): boolean; + toBeString(): boolean; + toBeTrue(): boolean; + toBeWhitespace(): boolean; + toBeWholeNumber(): boolean; + toBeWithinRange(floor: number, ceiling: number): boolean; - toEndWith(subString: string): boolean; + toEndWith(subString: string): boolean; - toHaveArray(key: string): boolean; - toHaveArrayOfBooleans(key: string): boolean; - toHaveArrayOfNumbers(key: string): boolean; - toHaveArrayOfObjects(key: string): boolean; - toHaveArrayOfSize(key: string, size?: number): boolean; - toHaveArrayOfStrings(key: string): boolean; - toHaveBoolean(key: string): boolean; - toHaveCalculable(key: string): boolean; - toHaveDate(key: string): boolean; - toHaveDateAfter(key: string, otherDate: Date): boolean; - toHaveDateBefore(key: string, otherDate: Date): boolean; - toHaveEmptyArray(key: string): boolean; - toHaveEmptyObject(key: string): boolean; - toHaveEmptyString(key: string): boolean; - toHaveEvenNumber(key: string): boolean; - toHaveFalse(key: string): boolean; - toHaveHtmlString(key: string): boolean; - toHaveIso8601(key: string): boolean; - toHaveJsonString(key: string): boolean; - toHaveMember(key: string): boolean; - toHaveMethod(key: string): boolean; - toHaveNonEmptyArray(key: string): boolean; - toHaveNonEmptyObject(key: string): boolean; - toHaveNonEmptyString(key: string): boolean; - toHaveNumber(key: string): boolean; - toHaveNumberWithinRange(key: string, floor: number, ceiling: number): boolean; - toHaveObject(key: string): boolean; - toHaveOddNumber(key: string): boolean; - toHaveString(key: string): boolean; - toHaveStringLongerThan(key: string, other: string): boolean; - toHaveStringSameLengthAs(key: string, other: string): boolean; - toHaveStringShorterThan(key: string, other: string): boolean; - toHaveTrue(key: string): boolean; - toHaveWhitespaceString(key: string): boolean; - toHaveWholeNumber(key: string): boolean; + toHaveArray(key: string): boolean; + toHaveArrayOfBooleans(key: string): boolean; + toHaveArrayOfNumbers(key: string): boolean; + toHaveArrayOfObjects(key: string): boolean; + toHaveArrayOfSize(key: string, size?: number): boolean; + toHaveArrayOfStrings(key: string): boolean; + toHaveBoolean(key: string): boolean; + toHaveCalculable(key: string): boolean; + toHaveDate(key: string): boolean; + toHaveDateAfter(key: string, otherDate: Date): boolean; + toHaveDateBefore(key: string, otherDate: Date): boolean; + toHaveEmptyArray(key: string): boolean; + toHaveEmptyObject(key: string): boolean; + toHaveEmptyString(key: string): boolean; + toHaveEvenNumber(key: string): boolean; + toHaveFalse(key: string): boolean; + toHaveHtmlString(key: string): boolean; + toHaveIso8601(key: string): boolean; + toHaveJsonString(key: string): boolean; + toHaveMember(key: string): boolean; + toHaveMethod(key: string): boolean; + toHaveNonEmptyArray(key: string): boolean; + toHaveNonEmptyObject(key: string): boolean; + toHaveNonEmptyString(key: string): boolean; + toHaveNumber(key: string): boolean; + toHaveNumberWithinRange(key: string, floor: number, ceiling: number): boolean; + toHaveObject(key: string): boolean; + toHaveOddNumber(key: string): boolean; + toHaveString(key: string): boolean; + toHaveStringLongerThan(key: string, other: string): boolean; + toHaveStringSameLengthAs(key: string, other: string): boolean; + toHaveStringShorterThan(key: string, other: string): boolean; + toHaveTrue(key: string): boolean; + toHaveWhitespaceString(key: string): boolean; + toHaveWholeNumber(key: string): boolean; - toImplement(api: {}): boolean; + toImplement(api: {}): boolean; - toStartWith(subString: string): boolean; + toStartWith(subString: string): boolean; - toThrowAnyError(): boolean; - toThrowErrorOfType(type: string): boolean; - } + toThrowAnyError(): boolean; + toThrowErrorOfType(type: string): boolean; + } } From b0131162f16e4aaad5f8ebdee592059f73cdb736 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Ewerl=C3=B6f?= Date: Mon, 23 Nov 2015 19:44:01 +0100 Subject: [PATCH 115/389] fixed copyright formattings --- .../jamiemason-jasmine-matchers.d.ts | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/jasmine-matchers/jamiemason-jasmine-matchers.d.ts b/jasmine-matchers/jamiemason-jasmine-matchers.d.ts index 91b473a58..318a30917 100644 --- a/jasmine-matchers/jamiemason-jasmine-matchers.d.ts +++ b/jasmine-matchers/jamiemason-jasmine-matchers.d.ts @@ -3,22 +3,6 @@ // Definitions by: UserPixel // Definitions: https://github.com/borisyankov/DefinitelyTyped -/* -Typings 2015 UserPixel - -TypeScript tests auto-extracted from jasmine-matchers unit test. - -Original jasmine-matchers license applies: - -Copyright (C) 2013, uxebu Inc. - -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 jasmine { From c9203f8fdf5362b0ec24c6402060259ffda873f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Ewerl=C3=B6f?= Date: Mon, 23 Nov 2015 19:49:29 +0100 Subject: [PATCH 116/389] moved the files to jasmine-expect directory --- .../jasmine-expect-tests.ts | 0 .../jasmine-expect.d.ts | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename jasmine-matchers/jamiemason-jasmine-matchers-tests.ts => jasmine-expect/jasmine-expect-tests.ts (100%) rename jasmine-matchers/jamiemason-jasmine-matchers.d.ts => jasmine-expect/jasmine-expect.d.ts (100%) diff --git a/jasmine-matchers/jamiemason-jasmine-matchers-tests.ts b/jasmine-expect/jasmine-expect-tests.ts similarity index 100% rename from jasmine-matchers/jamiemason-jasmine-matchers-tests.ts rename to jasmine-expect/jasmine-expect-tests.ts diff --git a/jasmine-matchers/jamiemason-jasmine-matchers.d.ts b/jasmine-expect/jasmine-expect.d.ts similarity index 100% rename from jasmine-matchers/jamiemason-jasmine-matchers.d.ts rename to jasmine-expect/jasmine-expect.d.ts From 9d5078123140734d09aab2d9dbd672bdc579ae17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Ewerl=C3=B6f?= Date: Mon, 23 Nov 2015 19:50:50 +0100 Subject: [PATCH 117/389] updated the headers and file references --- jasmine-expect/jasmine-expect-tests.ts | 2 +- jasmine-expect/jasmine-expect.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/jasmine-expect/jasmine-expect-tests.ts b/jasmine-expect/jasmine-expect-tests.ts index cd4914339..ec54269f4 100644 --- a/jasmine-expect/jasmine-expect-tests.ts +++ b/jasmine-expect/jasmine-expect-tests.ts @@ -1,5 +1,5 @@ /// -/// +/// // Taken directly from the test directory of the original repo diff --git a/jasmine-expect/jasmine-expect.d.ts b/jasmine-expect/jasmine-expect.d.ts index 318a30917..fe6238078 100644 --- a/jasmine-expect/jasmine-expect.d.ts +++ b/jasmine-expect/jasmine-expect.d.ts @@ -1,4 +1,4 @@ -// Type definitions for jasmine-matchers 2.0.0-beta2 +// Type definitions for jasmine-expect 2.0.0-beta2 // Project: https://github.com/JamieMason/Jasmine-Matchers // Definitions by: UserPixel // Definitions: https://github.com/borisyankov/DefinitelyTyped From d2c5200bbff6d06cd2d062aa4215b2f3f82c6d85 Mon Sep 17 00:00:00 2001 From: Thom Bradford Date: Mon, 23 Nov 2015 20:47:34 +0100 Subject: [PATCH 118/389] Updating for the most recent version of PEG.js the most recent version(s) of PEG.js expose location information in peg$SyntaxError that declare a start/end range --- pegjs/pegjs.d.ts | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/pegjs/pegjs.d.ts b/pegjs/pegjs.d.ts index c42b9aae5..1e8bfc6ad 100644 --- a/pegjs/pegjs.d.ts +++ b/pegjs/pegjs.d.ts @@ -6,11 +6,22 @@ declare module PEG { function parse(input:string):any; - class SyntaxError { - line:number; - column:number; - offset:number; + interface Location { + line: number; + column: number; + offset: number; + } + interface LocationRange { + start: Location, + end: Location + } + + class SyntaxError { + line: number; + column: number; + offset: number; + location: LocationRange; expected:any[]; found:any; name:string; From f62de72ab38e95f3e8cca24421a20685ef58d6e6 Mon Sep 17 00:00:00 2001 From: Attila Gazso Date: Mon, 23 Nov 2015 22:13:06 +0100 Subject: [PATCH 119/389] Added missing onError EventHandler --- youtube/youtube.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/youtube/youtube.d.ts b/youtube/youtube.d.ts index f3f5c3b52..6e5066cf9 100644 --- a/youtube/youtube.d.ts +++ b/youtube/youtube.d.ts @@ -17,6 +17,7 @@ declare module YT { onReady?: EventHandler; onPlayback?: EventHandler; onStateChange?: EventHandler; + onError?: EventHandler; } export enum ListType { From 2fdf51dda42e04f940db8631c4f3b008b237b756 Mon Sep 17 00:00:00 2001 From: Yuce Tekol Date: Mon, 23 Nov 2015 23:46:28 +0200 Subject: [PATCH 120/389] Added definitions for async-writer --- async-writer/async-writer-tests.ts | 66 +++++++++++++++++++++++++ async-writer/async-writer.d.ts | 78 ++++++++++++++++++++++++++++++ 2 files changed, 144 insertions(+) create mode 100644 async-writer/async-writer-tests.ts create mode 100644 async-writer/async-writer.d.ts diff --git a/async-writer/async-writer-tests.ts b/async-writer/async-writer-tests.ts new file mode 100644 index 000000000..c26e31495 --- /dev/null +++ b/async-writer/async-writer-tests.ts @@ -0,0 +1,66 @@ +/// + +import asyncWriter = require('async-writer'); +import stream = require('stream'); + +class TestStream extends stream.Writable { + constructor(public output: string) { + super(); + } + _write(data: string, encoding: string, callback: Function) { + this.output += data; + callback(); + } +} + +// Simple usage +function simpleUsage(callback: () => void) { + var output = ''; + let testStream = new TestStream(output); + let out = asyncWriter.create(testStream) + .on('error', (err: Error) => { + console.error(err); + }) + .on('finish', () => { + console.log(testStream.output); + callback(); + }) + + out.write('A'); + out.write('B'); + out.write('C'); + out.end(); +} + + +// Asynchronous, out-of-order writing +function asyncUsage(callback: () => void) { + var output = ''; + let testStream = new TestStream(output); + let out = asyncWriter.create(testStream) + .on('error', (err: Error) => { + console.error(err); + }) + .on('finish', () => { + console.log(testStream.output); + callback(); + }) + + out.write('A'); + + let asyncOut = out.beginAsync(); + setTimeout(() => { + asyncOut.write('B'); + asyncOut.end(); + }, 1000); + + out.write('C'); + out.end(); +} + +// run test +simpleUsage(() => { + asyncUsage(() => { + console.log('DONE'); + }); +}); diff --git a/async-writer/async-writer.d.ts b/async-writer/async-writer.d.ts new file mode 100644 index 000000000..42f82d35c --- /dev/null +++ b/async-writer/async-writer.d.ts @@ -0,0 +1,78 @@ +// Type definitions for async-writer 1.4.1 +// Project: https://github.com/marko-js/async-writer +// Definitions by: Yuce Tekol +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module 'async-writer' { + import stream = require('stream'); + import events = require('events'); + + module async_writer { + interface EventFunction { + (event: string, callback: Function): void; + } + + class StringWriter { + constructor(events: events.EventEmitter); + end(): void; + write(what: string): StringWriter; + toString(): string; + } + + class BufferedWriter { + constructor(wrappedStream: stream.Stream); + flush(): void; + on(event: string, callback: Function): BufferedWriter; + once(event: string, callback: Function): BufferedWriter; + clear(): void; + end(): void; + write(what: string): BufferedWriter; + } + + interface BeginAsyncOptions { + last?: boolean; + timeout?: number; + name?: string; + } + + class AsyncWriter { + static enableAsyncStackTrace():void; + + constructor(writer?: any, global?: {[s: string]: any}, async?: boolean, buffer?: boolean); + isAsyncWriter: AsyncWriter; + sync(): void; + getAttributes(): {[s: string]: any}; + getAttribute(): any; + write(str: string): AsyncWriter; + getOutput(): string; + captureString(func: Function, thisObj: Object): string; + swapWriter(newWriter: StringWriter | BufferedWriter, func: Function, thisObj: Object): void; + createNestedWriter(writer: StringWriter | BufferedWriter): AsyncWriter; + beginAsync(options?: number | BeginAsyncOptions): AsyncWriter; + handleBeginAsync(options: number | BeginAsyncOptions, parent: AsyncWriter): void; + on(event: string, callback: Function): AsyncWriter; + once(event: string, callback: Function): AsyncWriter; + onLast(callback: Function): AsyncWriter; + emit(arg: any): AsyncWriter; + removeListener(): AsyncWriter; + pipe(stream: stream.Stream): AsyncWriter; + error(e: Error): void; + end(data?: any): AsyncWriter; + handleEnd(isAsync: boolean): void; + _finish(): void; + flush(): void; + } + + interface AsyncWriterOptions { + global?: {[s: string]: any}; + buffer?: boolean; + } + + function create(writer?: any, options?: AsyncWriterOptions): AsyncWriter; + function enableAsyncStackTrace(): void; + } + + export = async_writer; +} From 58641fd48cf8e677eb3ab0456d992e4b7562507b Mon Sep 17 00:00:00 2001 From: Stefan Geneshky Date: Mon, 23 Nov 2015 14:39:56 -0800 Subject: [PATCH 121/389] Update rivets and its test --- rivets/rivets-tests.ts | 34 +++++++++------- rivets/rivets.d.ts | 88 ++++++++++++++++++++++++++++-------------- 2 files changed, 79 insertions(+), 43 deletions(-) diff --git a/rivets/rivets-tests.ts b/rivets/rivets-tests.ts index fec282046..f23772094 100644 --- a/rivets/rivets-tests.ts +++ b/rivets/rivets-tests.ts @@ -1,18 +1,22 @@ /// -Rivets.configure({ - // Attribute prefix in templates - prefix: 'rv', - // Preload templates with initial data on bind - preloadData: true, - // Root sightglass interface for keypaths - rootInterface: '.', - // Template delimiters for text bindings - templateDelimiters: ['[[', ']]'], - // Augment the event handler of the on-* binder - handler: function(target:any, event:any, binding:any) { - this.call(target, event, binding.view.models) - } - }) +rivets.configure({ + // Attribute prefix in templates + prefix: 'rv', + // Preload templates with initial data on bind + preloadData: true, + // Root sightglass interface for keypaths + rootInterface: '.', + // Template delimiters for text bindings + templateDelimiters: ['[[', ']]'], + // Augment the event handler of the on-* binder + handler: function(target:any, event:any, binding:any) { + this.call(target, event, binding.view.models) + } +}); + var t = {test: ["hello", "one", "two"]} -Rivets.bind(document.getElementById("para1"), t) \ No newline at end of file +var opts = {bar: "foo"}; +rivets.bind(document.getElementById("para1"), t); +rivets.bind(document.getElementById("para1"), t, opts); +rivets.bind([document.getElementById("para1"), document.getElementById("para2")], t); diff --git a/rivets/rivets.d.ts b/rivets/rivets.d.ts index 2b04653ec..de3ebf47b 100644 --- a/rivets/rivets.d.ts +++ b/rivets/rivets.d.ts @@ -3,33 +3,65 @@ // Definitions by: Trevor Baron // Definitions: https://github.com/borisyankov/DefinitelyTyped -interface FinchStatic { - configure(options?: { - /** - * Attribute prefix in templates - */ - prefix?: string; - /** - * Preload templates with initial data on bind - */ - preloadData?: boolean; - /** - * Root sightglass interface for keypaths - */ - rootInterface?: string; - /** - * Template delimiters for text bindings - */ - templateDelimiters?: Array - /** - * Augment the event handler of the on-* binder - */ - handler?: Function; - }):void; - bind(element:any, template:any):void; +/// + +declare module Rivets { + + interface View { + build(): void; + bind(): void; + unbind(): void; + } + + interface Rivets { + // Global binders. + binders: Object; + + // Global components. + components: Object; + + // Global formatters. + formatters: Object; + + // Global sightglass adapters. + adapters: Object; + + // Default attribute prefix. + prefix: string; + + // Default template delimiters. + templateDelimiters: Array; + + // Default sightglass root interface. + rootInterface: string; + + // Preload data by default. + preloadData: boolean; + + handler(context: any, ev: Event, biding: any): void; + + configure(options?: { + + // Attribute prefix in templates + prefix?: string; + + //Preload templates with initial data on bind + preloadData?: boolean; + + //Root sightglass interface for keypaths + rootInterface?: string; + + // Template delimiters for text bindings + templateDelimiters?: Array + + // Augment the event handler of the on-* binder + handler?: Function; + }): void; + + bind(element: HTMLElement, models: Object, options?: Object): View; + bind(element: JQuery, models: Object, options?: Object): View; + bind(element: Array, models: Object, options?: Object): View; + } } -declare var Rivets: FinchStatic; -declare module "rivets" { - export = Rivets; -} +declare var rivets: Rivets.Rivets; From 5c0d1a6d74d553e5e4519d4f3ccd61af1240493e Mon Sep 17 00:00:00 2001 From: Jason Saelhof Date: Mon, 23 Nov 2015 16:40:50 -0700 Subject: [PATCH 122/389] Updated the type of the "next" parameter in SpriteSheetBuilder's addAnimation method. From the easeljs docs: "Specifies the name of the animation to continue to after this animation ends. You can also pass false to have the animation stop when it ends. By default it will loop to the start of the same animation." --- easeljs/easeljs.d.ts | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/easeljs/easeljs.d.ts b/easeljs/easeljs.d.ts index a46f2484e..b8a9733d6 100644 --- a/easeljs/easeljs.d.ts +++ b/easeljs/easeljs.d.ts @@ -52,7 +52,7 @@ declare module createjs { // methods clone(): Bitmap; } - + export class BitmapText extends DisplayObject { constructor(text?:string, spriteSheet?:SpriteSheet); @@ -66,7 +66,7 @@ declare module createjs { spriteSheet: SpriteSheet; text: string; } - + export class BlurFilter extends Filter { constructor(blurX?: number, blurY?: number, quality?: number); @@ -115,7 +115,7 @@ declare module createjs { greenOffset: number; redMultiplier: number; redOffset: number; - + // methods clone(): ColorFilter; } @@ -139,7 +139,7 @@ declare module createjs { toArray(): number[]; toString(): string; } - + export class ColorMatrixFilter extends Filter { constructor(matrix: number[] | ColorMatrix); @@ -149,7 +149,7 @@ declare module createjs { // methods clone(): ColorMatrixFilter; } - + export class Container extends DisplayObject { constructor(); @@ -183,7 +183,7 @@ declare module createjs { swapChildren(child1: DisplayObject, child2: DisplayObject): void; swapChildrenAt(index1: number, index2: number): void; } - + export class DisplayObject extends EventDispatcher { constructor(); @@ -268,7 +268,7 @@ declare module createjs { // properties htmlElement: HTMLElement; - + // methods clone(): DisplayObject; // throw error set(props: Object): DOMElement; @@ -589,7 +589,7 @@ declare module createjs { export class MouseEvent extends Event { constructor(type: string, bubbles: boolean, cancelable: boolean, stageX: number, stageY: number, nativeEvent: NativeMouseEvent, pointerID: number, primary: boolean, rawX: number, rawY: number); - + // properties isTouch: boolean; localX: number; @@ -601,10 +601,10 @@ declare module createjs { rawY: number; stageX: number; stageY: number; - + // methods clone(): MouseEvent; - + // EventDispatcher mixins addEventListener(type: string, listener: (eventObj: Object) => boolean, useCapture?: boolean): Function; addEventListener(type: string, listener: (eventObj: Object) => void, useCapture?: boolean): Function; @@ -670,12 +670,12 @@ declare module createjs { play(): void; stop(): void; } - + export class MovieClipPlugin { // methods tween(tween: Tween, prop: string, value: string | number | boolean, startValues: any[], endValues: any[], ratio: number, wait: Object, end: Object): void; } - + export class Point { constructor(x?: number, y?: number); @@ -756,7 +756,7 @@ declare module createjs { offset: number; paused: boolean; spriteSheet: SpriteSheet; - + // methods advance(time?: number): void; clone(): Sprite; @@ -767,7 +767,7 @@ declare module createjs { set(props: Object): Sprite; setTransform(x?: number, y?: number, scaleX?: number, scaleY?: number, rotation?: number, skewX?: number, skewY?: number, regX?: number, regY?: number): Sprite; stop(): void; - + } export class SpriteContainer extends Container @@ -798,7 +798,7 @@ declare module createjs { animations: string[]; complete: boolean; framerate: number; - + // methods clone(): SpriteSheet; getAnimation(name: string): SpriteSheetAnimation; @@ -825,7 +825,7 @@ declare module createjs { timeSlice: number; // methods - addAnimation(name: string, frames: number[], next?: string, frequency?: number): void; + addAnimation(name: string, frames: number[], next?: string|boolean, frequency?: number): void; addFrame(source: DisplayObject, sourceRect?: Rectangle, scale?: number, setupFunction?: () => any, setupData?: Object): number; addMovieClip(source: MovieClip, sourceRect?: Rectangle, scale?: number, setupFunction?: () => any, setupData?: Object, labelFunction?: () => any): void; build(): SpriteSheet; @@ -883,7 +883,7 @@ declare module createjs { preventSelection: boolean; snapToPixelEnabled: boolean; // deprecated tickOnUpdate: boolean; - + // methods clear(): void; clone(): Stage; @@ -892,7 +892,7 @@ declare module createjs { tick(props?: Object): void; toDataURL(backgroundColor: string, mimeType: string): string; update(...arg: any[]): void; - + } From abc4706bc98f56eacdf7e1213f6b854f27bec29f Mon Sep 17 00:00:00 2001 From: Jason Saelhof Date: Mon, 23 Nov 2015 16:45:09 -0700 Subject: [PATCH 123/389] removed whitespace changes --- easeljs/easeljs.d.ts | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/easeljs/easeljs.d.ts b/easeljs/easeljs.d.ts index b8a9733d6..73b45b810 100644 --- a/easeljs/easeljs.d.ts +++ b/easeljs/easeljs.d.ts @@ -52,7 +52,7 @@ declare module createjs { // methods clone(): Bitmap; } - + export class BitmapText extends DisplayObject { constructor(text?:string, spriteSheet?:SpriteSheet); @@ -66,7 +66,7 @@ declare module createjs { spriteSheet: SpriteSheet; text: string; } - + export class BlurFilter extends Filter { constructor(blurX?: number, blurY?: number, quality?: number); @@ -115,7 +115,7 @@ declare module createjs { greenOffset: number; redMultiplier: number; redOffset: number; - + // methods clone(): ColorFilter; } @@ -139,7 +139,7 @@ declare module createjs { toArray(): number[]; toString(): string; } - + export class ColorMatrixFilter extends Filter { constructor(matrix: number[] | ColorMatrix); @@ -149,7 +149,7 @@ declare module createjs { // methods clone(): ColorMatrixFilter; } - + export class Container extends DisplayObject { constructor(); @@ -183,7 +183,7 @@ declare module createjs { swapChildren(child1: DisplayObject, child2: DisplayObject): void; swapChildrenAt(index1: number, index2: number): void; } - + export class DisplayObject extends EventDispatcher { constructor(); @@ -268,7 +268,7 @@ declare module createjs { // properties htmlElement: HTMLElement; - + // methods clone(): DisplayObject; // throw error set(props: Object): DOMElement; @@ -589,7 +589,7 @@ declare module createjs { export class MouseEvent extends Event { constructor(type: string, bubbles: boolean, cancelable: boolean, stageX: number, stageY: number, nativeEvent: NativeMouseEvent, pointerID: number, primary: boolean, rawX: number, rawY: number); - + // properties isTouch: boolean; localX: number; @@ -601,10 +601,10 @@ declare module createjs { rawY: number; stageX: number; stageY: number; - + // methods clone(): MouseEvent; - + // EventDispatcher mixins addEventListener(type: string, listener: (eventObj: Object) => boolean, useCapture?: boolean): Function; addEventListener(type: string, listener: (eventObj: Object) => void, useCapture?: boolean): Function; @@ -670,12 +670,12 @@ declare module createjs { play(): void; stop(): void; } - + export class MovieClipPlugin { // methods tween(tween: Tween, prop: string, value: string | number | boolean, startValues: any[], endValues: any[], ratio: number, wait: Object, end: Object): void; } - + export class Point { constructor(x?: number, y?: number); @@ -756,7 +756,7 @@ declare module createjs { offset: number; paused: boolean; spriteSheet: SpriteSheet; - + // methods advance(time?: number): void; clone(): Sprite; @@ -767,7 +767,7 @@ declare module createjs { set(props: Object): Sprite; setTransform(x?: number, y?: number, scaleX?: number, scaleY?: number, rotation?: number, skewX?: number, skewY?: number, regX?: number, regY?: number): Sprite; stop(): void; - + } export class SpriteContainer extends Container @@ -798,7 +798,7 @@ declare module createjs { animations: string[]; complete: boolean; framerate: number; - + // methods clone(): SpriteSheet; getAnimation(name: string): SpriteSheetAnimation; @@ -883,7 +883,7 @@ declare module createjs { preventSelection: boolean; snapToPixelEnabled: boolean; // deprecated tickOnUpdate: boolean; - + // methods clear(): void; clone(): Stage; @@ -892,7 +892,7 @@ declare module createjs { tick(props?: Object): void; toDataURL(backgroundColor: string, mimeType: string): string; update(...arg: any[]): void; - + } From 31fb378dafd65515e1546507a515be6e1cf44067 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Tue, 24 Nov 2015 04:49:49 +0500 Subject: [PATCH 124/389] lodash: signatures of _.isTypedArray have been changed --- lodash/lodash-tests.ts | 16 ++++++++++++++-- lodash/lodash.d.ts | 8 ++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 30c0b9934..d712c9b09 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -5121,8 +5121,20 @@ result = _({}).isString(); } // _.isTypedArray -result = _.isTypedArray([]); -result = _([]).isTypedArray(); +module TestIsTypedArray { + { + let result: boolean; + + result = _.isTypedArray([]); + result = _([]).isTypedArray(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _([]).chain().isTypedArray(); + } +} // _.isUndefined result = _.isUndefined(any); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 73a783b64..a893b0441 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -9005,6 +9005,7 @@ declare module _ { interface LoDashStatic { /** * Checks if value is classified as a typed array. + * * @param value The value to check. * @return Returns true if value is correctly classified, else false. */ @@ -9018,6 +9019,13 @@ declare module _ { isTypedArray(): boolean; } + interface LoDashExplicitWrapperBase { + /** + * see _.isTypedArray + */ + isTypedArray(): LoDashExplicitWrapper; + } + //_.isUndefined interface LoDashStatic { /** From a301b36205d1db51a9bfc74c32a885df77f44fbd Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Tue, 24 Nov 2015 04:59:13 +0500 Subject: [PATCH 125/389] lodash: signatures of _.findKey have been changed --- lodash/lodash-tests.ts | 28 ++++++++++++++++++++++++++-- lodash/lodash.d.ts | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 2 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 30c0b9934..4f9b1f493 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6008,10 +6008,9 @@ module TestExtend { // _.findKey module TestFindKey { - let result: string; - { let predicateFn: (value: any, key?: string, object?: {}) => boolean; + let result: string; result = _.findKey<{a: string;}>({a: ''}); @@ -6038,6 +6037,7 @@ module TestFindKey { { let predicateFn: (value: string, key?: string, collection?: _.Dictionary) => boolean; + let result: string; result = _.findKey({a: ''}, predicateFn); result = _.findKey({a: ''}, predicateFn, any); @@ -6045,6 +6045,30 @@ module TestFindKey { result = _<{a: string;}>({a: ''}).findKey(predicateFn); result = _<{a: string;}>({a: ''}).findKey(predicateFn, any); } + + { + let predicateFn: (value: any, key?: string, object?: {}) => boolean; + let result: _.LoDashExplicitWrapper; + + result = _<{a: string;}>({a: ''}).chain().findKey(); + + result = _<{a: string;}>({a: ''}).chain().findKey(predicateFn); + result = _<{a: string;}>({a: ''}).chain().findKey(predicateFn, any); + + + result = _<{a: string;}>({a: ''}).chain().findKey(''); + result = _<{a: string;}>({a: ''}).chain().findKey('', any); + + result = _<{a: string;}>({a: ''}).chain().findKey<{a: number;}>({a: 42}); + } + + { + let predicateFn: (value: string, key?: string, collection?: _.Dictionary) => boolean; + let result: _.LoDashExplicitWrapper; + + result = _<{a: string;}>({a: ''}).chain().findKey(predicateFn); + result = _<{a: string;}>({a: ''}).chain().findKey(predicateFn, any); + } } // _.findLastKey diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 73a783b64..aa53e4fcc 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -10396,6 +10396,39 @@ declare module _ { ): string; } + interface LoDashExplicitObjectWrapper { + /** + * @see _.findKey + */ + findKey( + predicate?: DictionaryIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findKey + */ + findKey( + predicate?: ObjectIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findKey + */ + findKey( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findKey + */ + findKey>( + predicate?: TWhere + ): LoDashExplicitWrapper; + } + //_.findLastKey interface LoDashStatic { /** From 989cc747fdf75d98628bd8bc9d1f45806ebe8ca9 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Tue, 24 Nov 2015 05:07:52 +0500 Subject: [PATCH 126/389] lodash: signatures of _.valuesIn have been changed --- lodash/lodash-tests.ts | 31 +++++++++++++++++++++---------- lodash/lodash.d.ts | 22 +++++++++++++++------- 2 files changed, 36 insertions(+), 17 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 30c0b9934..fa6f9bec2 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6729,17 +6729,28 @@ module TestValues { } } -// _.valueIn -class TestValueIn { - public a = 1; - public b = 2; - public c: number; +// _.valuesIn +module TestValuesIn { + let object: _.Dictionary; + + { + let result: TResult[]; + + result = _.valuesIn(object); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(object).valuesIn(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(object).chain().valuesIn(); + } } -TestValueIn.prototype.c = 3; -result = _.valuesIn(new TestValueIn()); -// → [1, 2, 3] -result = _(new TestValueIn()).valuesIn().value(); -// → [1, 2, 3] /********** * String * diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 73a783b64..eb9070db1 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -11477,18 +11477,26 @@ declare module _ { //_.valuesIn interface LoDashStatic { /** - * Creates an array of the own and inherited enumerable property values of object. - * @param object The object to query. - * @return Returns the array of property values. - **/ + * Creates an array of the own and inherited enumerable property values of object. + * + * @param object The object to query. + * @return Returns the array of property values. + */ valuesIn(object?: any): T[]; } interface LoDashImplicitObjectWrapper { /** - * @see _.valuesIn - **/ - valuesIn(): LoDashImplicitArrayWrapper; + * @see _.valuesIn + */ + valuesIn(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.valuesIn + */ + valuesIn(): LoDashExplicitArrayWrapper; } /********** From 8432f317395297cda689ec3468f656f0354bbc98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Par=C3=A9?= Date: Mon, 23 Nov 2015 19:07:55 -0500 Subject: [PATCH 127/389] Add p2.js Type definitions I did it for him https://github.com/clark-stevenson/p2.d.ts/issues/1 --- p2/p2-tests.d.ts | 45 +++ p2/p2.d.ts | 1005 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1050 insertions(+) create mode 100644 p2/p2-tests.d.ts create mode 100644 p2/p2.d.ts diff --git a/p2/p2-tests.d.ts b/p2/p2-tests.d.ts new file mode 100644 index 000000000..63c213321 --- /dev/null +++ b/p2/p2-tests.d.ts @@ -0,0 +1,45 @@ +/// + +// Create a physics world, where bodies and constraints live +var world = new p2.World({ + gravity:[0, -9.82] +}); + +// Create an empty dynamic body +var circleBody = new p2.Body({ + mass: 5, + position: [0, 10] +}); + +// Add a circle shape to the body. +var circleShape = new p2.Circle({ radius: 1 }); +circleBody.addShape(circleShape); + +// ...and add the body to the world. +// If we don't add it to the world, it won't be simulated. +world.addBody(circleBody); + +// Create an infinite ground plane. +var groundBody = new p2.Body({ + mass: 0 // Setting mass to 0 makes the body static +}); +var groundShape = new p2.Plane(); +groundBody.addShape(groundShape); +world.addBody(groundBody); + +// To get the trajectories of the bodies, +// we must step the world forward in time. +// This is done using a fixed time step size. +var timeStep = 1 / 60; // seconds + +// The "Game loop". Could be replaced by, for example, requestAnimationFrame. +setInterval(function(){ + + // The step method moves the bodies forward in time. + world.step(timeStep); + + // Print the circle position to console. + // Could be replaced by a render call. + console.log("Circle y position: " + circleBody.position[1]); + +}, 1000 * timeStep); diff --git a/p2/p2.d.ts b/p2/p2.d.ts new file mode 100644 index 000000000..a0e3f8b6a --- /dev/null +++ b/p2/p2.d.ts @@ -0,0 +1,1005 @@ +// Type definitions for p2.js v0.7.1 +// Project: https://github.com/schteppe/p2.js/ +// Definitions by: Clark Stevenson +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module p2 { + + export class AABB { + + constructor(options?: { + upperBound?: number[]; + lowerBound?: number[]; + }); + + setFromPoints(points: number[][], position: number[], angle: number, skinSize: number): void; + copy(aabb: AABB): void; + extend(aabb: AABB): void; + overlaps(aabb: AABB): boolean; + + } + + export class Broadphase { + + static AABB: number; + static BOUNDING_CIRCLE: number; + + static NAIVE: number; + static SAP: number; + + static boundingRadiusCheck(bodyA: Body, bodyB: Body): boolean; + static aabbCheck(bodyA: Body, bodyB: Body): boolean; + static canCollide(bodyA: Body, bodyB: Body): boolean; + + constructor(type: number); + + type: number; + result: Body[]; + world: World; + boundingVolumeType: number; + + setWorld(world: World): void; + getCollisionPairs(world: World): Body[]; + boundingVolumeCheck(bodyA: Body, bodyB: Body): boolean; + + } + + export class GridBroadphase extends Broadphase { + + constructor(options?: { + xmin?: number; + xmax?: number; + ymin?: number; + ymax?: number; + nx?: number; + ny?: number; + }); + + xmin: number; + xmax: number; + ymin: number; + ymax: number; + nx: number; + ny: number; + binsizeX: number; + binsizeY: number; + + } + + export class NativeBroadphase extends Broadphase { + + } + + export class Narrowphase { + + contactEquations: ContactEquation[]; + frictionEquations: FrictionEquation[]; + enableFriction: boolean; + enableEquations: boolean; + slipForce: number; + frictionCoefficient: number; + surfaceVelocity: number; + reuseObjects: boolean; + resuableContactEquations: any[]; + reusableFrictionEquations: any[]; + restitution: number; + stiffness: number; + relaxation: number; + frictionStiffness: number; + frictionRelaxation: number; + enableFrictionReduction: boolean; + contactSkinSize: number; + + collidedLastStep(bodyA: Body, bodyB: Body): boolean; + reset(): void; + createContactEquation(bodyA: Body, bodyB: Body, shapeA: Shape, shapeB: Shape): ContactEquation; + createFrictionFromContact(c: ContactEquation): FrictionEquation; + + } + + export class SAPBroadphase extends Broadphase { + + axisList: Body[]; + axisIndex: number; + + } + + export class Constraint { + + static DISTANCE: number; + static GEAR: number; + static LOCK: number; + static PRISMATIC: number; + static REVOLUTE: number; + + constructor(bodyA: Body, bodyB: Body, type: number, options?: { + collideConnected?: boolean; + wakeUpBodies?: boolean; + }); + + type: number; + equeations: Equation[]; + bodyA: Body; + bodyB: Body; + collideConnected: boolean; + + update(): void; + setStiffness(stiffness: number): void; + setRelaxation(relaxation: number): void; + + } + + export class DistanceConstraint extends Constraint { + + constructor(bodyA: Body, bodyB: Body, type: number, options?: { + collideConnected?: boolean; + wakeUpBodies?: boolean; + distance?: number; + localAnchorA?: number[]; + localAnchorB?: number[]; + maxForce?: number; + }); + + localAnchorA: number[]; + localAnchorB: number[]; + distance: number; + maxForce: number; + upperLimitEnabled: boolean; + upperLimit: number; + lowerLimitEnabled: boolean; + lowerLimit: number; + position: number; + + setMaxForce(f: number): void; + getMaxForce(): number; + + } + + export class GearConstraint extends Constraint { + + constructor(bodyA: Body, bodyB: Body, type: number, options?: { + collideConnected?: boolean; + wakeUpBodies?: boolean; + angle?: number; + ratio?: number; + maxTorque?: number; + }); + + ratio: number; + angle: number; + + setMaxTorque(torque: number): void; + getMaxTorque(): number; + + } + + export class LockConstraint extends Constraint { + + constructor(bodyA: Body, bodyB: Body, type: number, options?: { + collideConnected?: boolean; + wakeUpBodies?: boolean; + localOffsetB?: number[]; + localAngleB?: number; + maxForce?: number; + }); + + setMaxForce(force: number): void; + getMaxForce(): number; + + } + + export class PrismaticConstraint extends Constraint { + + constructor(bodyA: Body, bodyB: Body, type: number, options?: { + collideConnected?: boolean; + wakeUpBodies?: boolean; + maxForce?: number; + localAnchorA?: number[]; + localAnchorB?: number[]; + localAxisA?: number[]; + disableRotationalLock?: boolean; + upperLimit?: number; + lowerLimit?: number; + }); + + localAnchorA: number[]; + localAnchorB: number[]; + localAxisA: number[]; + position: number; + velocity: number; + lowerLimitEnabled: boolean; + upperLimitEnabled: boolean; + lowerLimit: number; + upperLimit: number; + upperLimitEquation: ContactEquation; + lowerLimitEquation: ContactEquation; + motorEquation: Equation; + motorEnabled: boolean; + motorSpeed: number; + + enableMotor(): void; + disableMotor(): void; + setLimits(lower: number, upper: number): void; + + } + + export class RevoluteConstraint extends Constraint { + + constructor(bodyA: Body, bodyB: Body, type: number, options?: { + collideConnected?: boolean; + wakeUpBodies?: boolean; + worldPivot?: number[]; + localPivotA?: number[]; + localPivotB?: number[]; + maxForce?: number; + }); + + pivotA: number[]; + pivotB: number[]; + motorEquation: RotationalVelocityEquation; + motorEnabled: boolean; + angle: number; + lowerLimitEnabled: boolean; + upperLimitEnabled: boolean; + lowerLimit: number; + upperLimit: number; + upperLimitEquation: ContactEquation; + lowerLimitEquation: ContactEquation; + + enableMotor(): void; + disableMotor(): void; + motorIsEnabled(): boolean; + setLimits(lower: number, upper: number): void; + setMotorSpeed(speed: number): void; + getMotorSpeed(): number; + + } + + export class AngleLockEquation extends Equation { + + constructor(bodyA: Body, bodyB: Body, options?: { + angle?: number; + ratio?: number; + }); + + computeGq(): number; + setRatio(ratio: number): number; + setMaxTorque(torque: number): number; + + } + + export class ContactEquation extends Equation { + + constructor(bodyA: Body, bodyB: Body); + + contactPointA: number[]; + penetrationVec: number[]; + contactPointB: number[]; + normalA: number[]; + restitution: number; + firstImpact: boolean; + shapeA: Shape; + shapeB: Shape; + + computeB(a: number, b: number, h: number): number; + + } + + export class Equation { + + static DEFAULT_STIFFNESS: number; + static DEFAULT_RELAXATION: number; + + constructor(bodyA: Body, bodyB: Body, minForce?: number, maxForce?: number); + + minForce: number; + maxForce: number; + bodyA: Body; + bodyB: Body; + stiffness: number; + relaxation: number; + G: number[]; + offset: number; + a: number; + b: number; + epsilon: number; + timeStep: number; + needsUpdate: boolean; + multiplier: number; + relativeVelocity: number; + enabled: boolean; + + gmult(G: number[], vi: number[], wi: number[], vj: number[], wj: number[]): number; + computeB(a: number, b: number, h: number): number; + computeGq(): number; + computeGW(): number; + computeGWlambda(): number; + computeGiMf(): number; + computeGiMGt(): number; + addToWlambda(deltalambda: number): number; + computeInvC(eps: number): number; + + } + + export class FrictionEquation extends Equation { + + constructor(bodyA: Body, bodyB: Body, slipForce: number); + + contactPointA: number[]; + contactPointB: number[]; + t: number[]; + shapeA: Shape; + shapeB: Shape; + frictionCoefficient: number; + + setSlipForce(slipForce: number): number; + getSlipForce(): number; + computeB(a: number, b: number, h: number): number; + + } + + export class RotationalLockEquation extends Equation { + + constructor(bodyA: Body, bodyB: Body, options?: { + angle?: number; + }); + + angle: number; + + computeGq(): number; + + } + + export class RotationalVelocityEquation extends Equation { + + constructor(bodyA: Body, bodyB: Body); + + computeB(a: number, b: number, h: number): number; + + } + + export class EventEmitter { + + on(type: string, listener: Function, context: any): EventEmitter; + has(type: string, listener: Function): boolean; + off(type: string, listener: Function): EventEmitter; + emit(event: any): EventEmitter; + + } + + export class ContactMaterialOptions { + + friction: number; + restitution: number; + stiffness: number; + relaxation: number; + frictionStiffness: number; + frictionRelaxation: number; + surfaceVelocity: number; + + } + + export class ContactMaterial { + + static idCounter: number; + + constructor(materialA: Material, materialB: Material, options?: ContactMaterialOptions); + + id: number; + materialA: Material; + materialB: Material; + friction: number; + restitution: number; + stiffness: number; + relaxation: number; + frictionStuffness: number; + frictionRelaxation: number; + surfaceVelocity: number; + contactSkinSize: number; + + } + + export class Material { + + static idCounter: number; + + constructor(id: number); + + id: number; + + } + + export class vec2 { + + static crossLength(a: number[], b: number[]): number; + static crossVZ(out: number[], vec: number[], zcomp: number): number; + static crossZV(out: number[], zcomp: number, vec: number[]): number; + static rotate(out: number[], a: number[], angle: number): void; + static rotate90cw(out: number[], a: number[]): number; + static centroid(out: number[], a: number[], b: number[], c: number[]): number[]; + static create(): number[]; + static clone(a: number[]): number[]; + static fromValues(x: number, y: number): number[]; + static copy(out: number[], a: number[]): number[]; + static set(out: number[], x: number, y: number): number[]; + static toLocalFrame(out: number[], worldPoint: number[], framePosition: number[], frameAngle: number): void; + static toGlobalFrame(out: number[], localPoint: number[], framePosition: number[], frameAngle: number): void; + static add(out: number[], a: number[], b: number[]): number[]; + static subtract(out: number[], a: number[], b: number[]): number[]; + static sub(out: number[], a: number[], b: number[]): number[]; + static multiply(out: number[], a: number[], b: number[]): number[]; + static mul(out: number[], a: number[], b: number[]): number[]; + static divide(out: number[], a: number[], b: number[]): number[]; + static div(out: number[], a: number[], b: number[]): number[]; + static scale(out: number[], a: number[], b: number): number[]; + static distance(a: number[], b: number[]): number; + static dist(a: number[], b: number[]): number; + static squaredDistance(a: number[], b: number[]): number; + static sqrDist(a: number[], b: number[]): number; + static length(a: number[]): number; + static len(a: number[]): number; + static squaredLength(a: number[]): number; + static sqrLen(a: number[]): number; + static negate(out: number[], a: number[]): number[]; + static normalize(out: number[], a: number[]): number[]; + static dot(a: number[], b: number[]): number; + static str(a: number[]): string; + + } + + export interface BodyOptions { + + mass?: number; + position?: number[]; + velocity?: number[]; + angle?: number; + angularVelocity?: number; + force?: number[]; + angularForce?: number; + fixedRotation?: boolean; + + } + + export class Body extends EventEmitter { + + sleepyEvent: { + type: string; + }; + + sleepEvent: { + type: string; + }; + + wakeUpEvent: { + type: string; + }; + + static DYNAMIC: number; + static STATIC: number; + static KINEMATIC: number; + static AWAKE: number; + static SLEEPY: number; + static SLEEPING: number; + + constructor(options?: BodyOptions); + + id: number; + world: World; + shapes: Shape[]; + mass: number; + invMass: number; + inertia: number; + invInertia: number; + invMassSolve: number; + invInertiaSolve: number; + fixedRotation: number; + position: number[]; + interpolatedPosition: number[]; + interpolatedAngle: number; + previousPosition: number[]; + previousAngle: number; + velocity: number[]; + vlambda: number[]; + wlambda: number[]; + angle: number; + angularVelocity: number; + force: number[]; + angularForce: number; + damping: number; + angularDamping: number; + type: number; + boundingRadius: number; + aabb: AABB; + aabbNeedsUpdate: boolean; + allowSleep: boolean; + wantsToSleep: boolean; + sleepState: number; + sleepSpeedLimit: number; + sleepTimeLimit: number; + gravityScale: number; + collisionResponse: boolean; + + updateSolveMassProperties(): void; + setDensity(density: number): void; + getArea(): number; + getAABB(): AABB; + updateAABB(): void; + updateBoundingRadius(): void; + addShape(shape: Shape, offset?: number[], angle?: number): void; + removeShape(shape: Shape): boolean; + updateMassProperties(): void; + applyForce(force: number[], worldPoint: number[]): void; + toLocalFrame(out: number[], worldPoint: number[]): void; + toWorldFrame(out: number[], localPoint: number[]): void; + fromPolygon(path: number[][], options?: { + optimalDecomp?: boolean; + skipSimpleCheck?: boolean; + removeCollinearPoints?: any; //boolean | number + }): boolean; + adjustCenterOfMass(): void; + setZeroForce(): void; + resetConstraintVelocity(): void; + applyDamping(dy: number): void; + wakeUp(): void; + sleep(): void; + sleepTick(time: number, dontSleep: boolean, dt: number): void; + getVelocityFromPosition(story: number[], dt: number): number[]; + getAngularVelocityFromPosition(timeStep: number): number; + overlaps(body: Body): boolean; + + } + + export class Spring { + + constructor(bodyA: Body, bodyB: Body, options?: { + + stiffness?: number; + damping?: number; + localAnchorA?: number[]; + localAnchorB?: number[]; + worldAnchorA?: number[]; + worldAnchorB?: number[]; + + }); + + stiffness: number; + damping: number; + bodyA: Body; + bodyB: Body; + + applyForce(): void; + + } + + export class LinearSpring extends Spring { + + localAnchorA: number[]; + localAnchorB: number[]; + restLength: number; + + setWorldAnchorA(worldAnchorA: number[]): void; + setWorldAnchorB(worldAnchorB: number[]): void; + getWorldAnchorA(result: number[]): number[]; + getWorldAnchorB(result: number[]): number[]; + applyForce(): void; + + } + + export class RotationalSpring extends Spring { + + constructor(bodyA: Body, bodyB: Body, options?: { + restAngle?: number; + stiffness?: number; + damping?: number; + }); + + restAngle: number; + + } + + export interface CapsuleOptions extends SharedShapeOptions { + + length?: number; + radius?: number; + + } + + export class Capsule extends Shape { + + constructor(options?: CapsuleOptions); + + length: number; + radius: number; + + } + + export interface CircleOptions extends SharedShapeOptions { + + radius?: number; + + } + + export class Circle extends Shape { + + constructor(options?: CircleOptions); + + radius: number; + + } + + export interface ConvexOptions extends SharedShapeOptions { + + length?: number; + radius?: number; + + } + + export class Convex extends Shape { + + static triangleArea(a: number[], b: number[], c: number[]): number; + + constructor(options?: ConvexOptions); + + vertices: number[][]; + axes: number[]; + centerOfMass: number[]; + triangles: number[]; + boundingRadius: number; + + projectOntoLocalAxis(localAxis: number[], result: number[]): void; + projectOntoWorldAxis(localAxis: number[], shapeOffset: number[], shapeAngle: number, result: number[]): void; + + updateCenterOfMass(): void; + + } + + export interface HeightfieldOptions extends SharedShapeOptions { + + heights?: number[]; + minValue?: number; + maxValue?: number; + elementWidth?: number; + + } + + export class Heightfield extends Shape { + + constructor(options?: HeightfieldOptions); + + data: number[]; + maxValue: number; + minValue: number; + elementWidth: number; + + } + + export interface SharedShapeOptions { + + position?: number[]; + angle?: number; + collisionGroup?: number; + collisionResponse?: boolean; + collisionMask?: number; + sensor?: boolean; + + } + + export interface ShapeOptions extends SharedShapeOptions { + + type?: number; + + } + + export class Shape { + + static idCounter: number; + static CIRCLE: number; + static PARTICLE: number; + static PLANE: number; + static CONVEX: number; + static LINE: number; + static BOX: number; + static CAPSULE: number; + static HEIGHTFIELD: number; + + constructor(options?: ShapeOptions); + + type: number; + id: number; + position: number[]; + angle: number; + boundingRadius: number; + collisionGroup: number; + collisionResponse: boolean; + collisionMask: number; + material: Material; + area: number; + sensor: boolean; + + computeMomentOfInertia(mass: number): number; + updateBoundingRadius(): number; + updateArea(): void; + computeAABB(out: AABB, position: number[], angle: number): void; + + } + + export interface LineOptions extends SharedShapeOptions { + + length?: number; + + } + + export class Line extends Shape { + + constructor(options?: LineOptions); + + length: number; + + } + + export class Particle extends Shape { + + constructor(options?: SharedShapeOptions); + + } + + export class Plane extends Shape { + + constructor(options?: SharedShapeOptions); + + } + + export interface BoxOptions { + + width?: number; + height?: number; + + } + + export class Box extends Shape { + + constructor(options?: BoxOptions); + + width: number; + height: number; + + } + + export class Solver extends EventEmitter { + + static GS: number; + static ISLAND: number; + + constructor(options?: {}, type?: number); + + type: number; + equations: Equation[]; + equationSortFunction: Equation; //Equation | boolean + + solve(dy: number, world: World): void; + solveIsland(dy: number, island: Island): void; + sortEquations(): void; + addEquation(eq: Equation): void; + addEquations(eqs: Equation[]): void; + removeEquation(eq: Equation): void; + removeAllEquations(): void; + + } + + export class GSSolver extends Solver { + + constructor(options?: { + iterations?: number; + tolerance?: number; + }); + + iterations: number; + tolerance: number; + useZeroRHS: boolean; + frictionIterations: number; + usedIterations: number; + + solve(h: number, world: World): void; + + } + + export class OverlapKeeper { + + constructor(bodyA: Body, shapeA: Shape, bodyB: Body, shapeB: Shape); + + shapeA: Shape; + shapeB: Shape; + bodyA: Body; + bodyB: Body; + + tick(): void; + setOverlapping(bodyA: Body, shapeA: Shape, bodyB: Body, shapeB: Body): void; + bodiesAreOverlapping(bodyA: Body, bodyB: Body): boolean; + set(bodyA: Body, shapeA: Shape, bodyB: Body, shapeB: Shape): void; + + } + + export class TupleDictionary { + + data: number[]; + keys: number[]; + + getKey(id1: number, id2: number): string; + getByKey(key: number): number; + get(i: number, j: number): number; + set(i: number, j: number, value: number): number; + reset(): void; + copy(dict: TupleDictionary): void; + + } + + export class Utils { + + static appendArray(a: Array, b: Array): Array; + static splice(array: Array, index: number, howMany: number): void; + static extend(a: any, b: any): void; + static defaults(options: any, defaults: any): any; + + } + + export class Island { + + equations: Equation[]; + bodies: Body[]; + + reset(): void; + getBodies(result: any): Body[]; + wantsToSleep(): boolean; + sleep(): boolean; + + } + + export class IslandManager extends Solver { + + static getUnvisitedNode(nodes: IslandNode[]): IslandNode; // IslandNode | boolean + + equations: Equation[]; + islands: Island[]; + nodes: IslandNode[]; + + visit(node: IslandNode, bds: Body[], eqs: Equation[]): void; + bfs(root: IslandNode, bds: Body[], eqs: Equation[]): void; + split(world: World): Island[]; + + } + + export class IslandNode { + + constructor(body: Body); + + body: Body; + neighbors: IslandNode[]; + equations: Equation[]; + visited: boolean; + + reset(): void; + + } + + export class World extends EventEmitter { + + postStepEvent: { + type: string; + }; + + addBodyEvent: { + type: string; + }; + + removeBodyEvent: { + type: string; + }; + + addSpringEvent: { + type: string; + }; + + impactEvent: { + type: string; + bodyA: Body; + bodyB: Body; + shapeA: Shape; + shapeB: Shape; + contactEquation: ContactEquation; + }; + + postBroadphaseEvent: { + type: string; + pairs: Body[]; + }; + + beginContactEvent: { + type: string; + shapeA: Shape; + shapeB: Shape; + bodyA: Body; + bodyB: Body; + contactEquations: ContactEquation[]; + }; + + endContactEvent: { + type: string; + shapeA: Shape; + shapeB: Shape; + bodyA: Body; + bodyB: Body; + }; + + preSolveEvent: { + type: string; + contactEquations: ContactEquation[]; + frictionEquations: FrictionEquation[]; + }; + + static NO_SLEEPING: number; + static BODY_SLEEPING: number; + static ISLAND_SLEEPING: number; + + static integrateBody(body: Body, dy: number): void; + + constructor(options?: { + solver?: Solver; + gravity?: number[]; + broadphase?: Broadphase; + islandSplit?: boolean; + doProfiling?: boolean; + }); + + springs: Spring[]; + bodies: Body[]; + solver: Solver; + narrowphase: Narrowphase; + islandManager: IslandManager; + gravity: number[]; + frictionGravity: number; + useWorldGravityAsFrictionGravity: boolean; + useFrictionGravityOnZeroGravity: boolean; + doProfiling: boolean; + lastStepTime: number; + broadphase: Broadphase; + constraints: Constraint[]; + defaultMaterial: Material; + defaultContactMaterial: ContactMaterial; + lastTimeStep: number; + applySpringForces: boolean; + applyDamping: boolean; + applyGravity: boolean; + solveConstraints: boolean; + contactMaterials: ContactMaterial[]; + time: number; + stepping: boolean; + islandSplit: boolean; + emitImpactEvent: boolean; + sleepMode: number; + + addConstraint(c: Constraint): void; + addContactMaterial(contactMaterial: ContactMaterial): void; + removeContactMaterial(cm: ContactMaterial): void; + getContactMaterial(materialA: Material, materialB: Material): ContactMaterial; // ContactMaterial | boolean + removeConstraint(c: Constraint): void; + step(dy: number, timeSinceLastCalled?: number, maxSubSteps?: number): void; + runNarrowphase(np: Narrowphase, bi: Body, si: Shape, xi: any[], ai: number, bj: Body, sj: Shape, xj: any[], aj: number, cm: number, glen: number): void; + addSpring(s: Spring): void; + removeSpring(s: Spring): void; + addBody(body: Body): void; + removeBody(body: Body): void; + getBodyByID(id: number): Body; //Body | boolean + disableBodyCollision(bodyA: Body, bodyB: Body): void; + enableBodyCollision(bodyA: Body, bodyB: Body): void; + clear(): void; + clone(): World; + hitTest(worldPoint: number[], bodies: Body[], precision: number): Body[]; + setGlobalEquationParameters(parameters: { + relaxation?: number; + stiffness?: number; + }): void; + setGlobalStiffness(stiffness: number): void; + setGlobalRelaxation(relaxation: number): void; + } + +} From f1e51ed6ee399c74842fa71453a227f9b74d6fda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Par=C3=A9?= Date: Mon, 23 Nov 2015 19:24:58 -0500 Subject: [PATCH 128/389] rename test file --- p2/{p2-tests.d.ts => p2-tests.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename p2/{p2-tests.d.ts => p2-tests.ts} (100%) diff --git a/p2/p2-tests.d.ts b/p2/p2-tests.ts similarity index 100% rename from p2/p2-tests.d.ts rename to p2/p2-tests.ts From 7043fc9115cb01d4e0f66eb440dfc85a36176d2d Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Sat, 21 Nov 2015 20:17:59 +0500 Subject: [PATCH 129/389] lodash: signatures of _.isElement have been changed --- lodash/lodash-tests.ts | 23 +++++++++++++++++++---- lodash/lodash.d.ts | 8 ++++++++ 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 6d047d3d0..294c838d4 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -4898,10 +4898,25 @@ result = _({}).isDate(); } // _.isElement -result = _.isElement(any); -result = _(42).isElement(); -result = _([]).isElement(); -result = _({}).isElement(); +module TestIsElement { + { + let result: boolean; + + result = _.isElement(any); + + result = _(42).isElement(); + result = _([]).isElement(); + result = _({}).isElement(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(42).chain().isElement(); + result = _([]).chain().isElement(); + result = _({}).chain().isElement(); + } +} // _.isEmpty result = _.isEmpty([1, 2, 3]); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index e4e027fba..0f4603b33 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -8663,6 +8663,7 @@ declare module _ { interface LoDashStatic { /** * Checks if value is a DOM element. + * * @param value The value to check. * @return Returns true if value is a DOM element, else false. */ @@ -8676,6 +8677,13 @@ declare module _ { isElement(): boolean; } + interface LoDashExplicitWrapperBase { + /** + * @see _.isElement + */ + isElement(): LoDashExplicitWrapper; + } + //_.isEmpty interface LoDashStatic { /** From c1f48f095841d2e3225d8120f4b7b07fccbf0a2d Mon Sep 17 00:00:00 2001 From: Frode Egeland Date: Tue, 24 Nov 2015 11:07:51 +0900 Subject: [PATCH 130/389] Fix: IIntervalService missing optional function arguments IIntervalService can take arguments to be passed to the function (`[Pass]`): > $interval(fn, delay, [count], [invokeApply], [Pass]); This adds this to the definition. --- angularjs/angular.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index 1b54bac2a..048b9cd4a 100644 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -615,7 +615,7 @@ declare module angular { // see http://docs.angularjs.org/api/ng.$interval /////////////////////////////////////////////////////////////////////////// interface IIntervalService { - (func: Function, delay: number, count?: number, invokeApply?: boolean): IPromise; + (func: Function, delay: number, count?: number, invokeApply?: boolean, ...args: any[]): IPromise; cancel(promise: IPromise): boolean; } From c0efbdf8f4d93a23192d932f63c16659f9acfc37 Mon Sep 17 00:00:00 2001 From: fredericogalvao Date: Tue, 24 Nov 2015 00:38:17 -0200 Subject: [PATCH 131/389] Updating phonegap-plugin-push definition to 1.4.4 --- .../phonegap-plugin-push-tests.ts | 54 +++++-- .../phonegap-plugin-push.d.ts | 143 ++++++++++++------ 2 files changed, 143 insertions(+), 54 deletions(-) diff --git a/phonegap-plugin-push/phonegap-plugin-push-tests.ts b/phonegap-plugin-push/phonegap-plugin-push-tests.ts index 916a6cf82..f4bc07c0c 100644 --- a/phonegap-plugin-push/phonegap-plugin-push-tests.ts +++ b/phonegap-plugin-push/phonegap-plugin-push-tests.ts @@ -1,26 +1,39 @@ /// function test() { - var options:PhonegapPluginPush.InitOptions = { + let options: PhonegapPluginPush.InitOptions = { android: { senderID: '123456789', icon: 'phonegap', iconColor: 'blue', sound: true, vibrate: true, - clearNotifications: false + clearNotifications: false, + forceShow: true }, ios: { badge: true, sound: true, - alert: true + alert: true, + clearBadge: true }, windows: {} }; - var push:PhonegapPluginPush.PushNotification; + + let iosStringOptions = { + badge: 'true', + sound: 'true', + alert: 'true', + clearBadge: 'true' + }; + + options.ios = iosStringOptions; + + let push: PhonegapPluginPush.PushNotification; /*from constructor*/ push = new PushNotification(options); + push = new window.PushNotification(options); push.unregister(() => { console.log('did unregister'); @@ -30,12 +43,13 @@ function test() { /*from init*/ push = PushNotification.init(options); + push = window.PushNotification.init(options); - push.on('registration', (data:PhonegapPluginPush.RegistrationEventResponse) => { + let registrationHandler = (data: PhonegapPluginPush.RegistrationEventResponse) => { console.log(data.registrationId); - }); + }; - push.on('notification', (data:PhonegapPluginPush.NotificationEventResponse) => { + let notificationHandler = (data: PhonegapPluginPush.NotificationEventResponse) => { console.log(data.message); console.log(data.title); console.log(data.count); @@ -45,15 +59,35 @@ function test() { /*the rest of the additional fields are not 'canon'*/ console.log(data.additionalData); console.log(data.additionalData.foreground); - }); - push.on('error', (e:Error) => { + push.finish(() => { + console.log('did finish'); + }, () => { + console.log('did not finish'); + }) + }; + + let errorHandler = (e: Error) => { console.log(e.message); - }); + }; + + push.on('registration', registrationHandler); + push.on('notification', notificationHandler); + push.on('error', errorHandler); + + push.off('registration', registrationHandler); + push.off('notification', notificationHandler); + push.off('error', errorHandler); push.setApplicationIconBadgeNumber(() => { console.log('did setApplicationIconBadgeNumber'); }, () => { console.log('did not setApplicationIconBadgeNumber'); }, 1); + + push.getApplicationIconBadgeNumber((count: number) => { + console.log('did getApplicationIconBadgeNumber', count); + }, () => { + console.log('did not getApplicationIconBadgeNumber'); + }); } diff --git a/phonegap-plugin-push/phonegap-plugin-push.d.ts b/phonegap-plugin-push/phonegap-plugin-push.d.ts index e9168a642..017a9c5b7 100644 --- a/phonegap-plugin-push/phonegap-plugin-push.d.ts +++ b/phonegap-plugin-push/phonegap-plugin-push.d.ts @@ -12,43 +12,77 @@ declare module PhonegapPluginPush { * @param event * @param callback */ - on(event:"registration", callback:(response:RegistrationEventResponse)=>any):void + on(event: "registration", callback: (response: RegistrationEventResponse) => any): void /** * The event notification will be triggered each time a push notification is received by a 3rd party push service on the device. * @param event * @param callback */ - on(event:"notification", callback:(response:NotificationEventResponse)=>any):void + on(event: "notification", callback: (response: NotificationEventResponse) => any): void /** * The event error will trigger when an internal error occurs and the cache is aborted. * @param event * @param callback */ - on(event:"error", callback:(response:Error)=>any):void - /*Generic one, needed for the overloads*/ + on(event: "error", callback: (response: Error) => any): void /** * * @param event Name of the event to listen to. See below(above) for all the event names. * @param callback is called when the event is triggered. + * @param event + * @param callback */ - on(event:string, callback:(response:EventResponse)=>any):void + on(event: string, callback: (response: EventResponse) => any): void + + off(event: "registration", callback: (response: RegistrationEventResponse) => any): void + off(event: "notification", callback: (response: NotificationEventResponse) => any): void + off(event: "error", callback: (response: Error) => any): void + /** + * As stated in the example, you will have to store your event handler if you are planning to remove it. + * @param event Name of the event type. The possible event names are the same as for the push.on function. + * @param callback handle to the function to get removed. + * @param event + * @param callback + */ + off(event: string, callback: (response: EventResponse) => any): void /** * The unregister method is used when the application no longer wants to receive push notifications. + * Beware that this cleans up all event handlers previously registered, + * so you will need to re-register them if you want them to function again without an application reload. * @param successHandler * @param errorHandler */ - unregister(successHandler:()=>any, errorHandler?:()=>any):void + unregister(successHandler: () => any, errorHandler?: () => any): void + /*TODO according to js source code, "errorHandler" is optional, but is "count" also optional? I can't read objetive-C code (can anyone at all? I wonder...)*/ /** * Set the badge count visible when the app is not running * - * The count is an integer indicating what number should show up in the badge. Passing 0 will clear the badge. Each notification event contains a data.count value which can be used to set the badge to correct number. + * The count is an integer indicating what number should show up in the badge. + * Passing 0 will clear the badge. + * Each notification event contains a data.count value which can be used to set the badge to correct number. * @param successHandler * @param errorHandler * @param count */ - setApplicationIconBadgeNumber(successHandler:()=>any, errorHandler:()=>any, count:number):void + setApplicationIconBadgeNumber(successHandler: () => any, errorHandler: () => any, count: number): void + /** + * Get the current badge count visible when the app is not running + * successHandler gets called with an integer which is the current badge count + * @param successHandler + * @param errorHandler + */ + getApplicationIconBadgeNumber(successHandler: (count: number) => any, errorHandler: () => any): void + + /** + * iOS only + * Tells the OS that you are done processing a background push notification. + * successHandler gets called when background push processing is successfully completed. + * @param successHandler + * @param errorHandler + */ + finish(successHandler: () => any, errorHandler: () => any): void } /** @@ -62,28 +96,32 @@ declare module PhonegapPluginPush { /** * Maps to the project number in the Google Developer Console. */ - senderID:string + senderID: string /** - * The name of a drawable resource to use as the small-icon. + * The name of a drawable resource to use as the small-icon. The name should not include the extension. */ - icon?:string + icon?: string /** - * Sets the background color of the small icon. + * Sets the background color of the small icon on Android 5.0 and greater. * Supported Formats - http://developer.android.com/reference/android/graphics/Color.html#parseColor(java.lang.String) */ - iconColor?:string + iconColor?: string /** * If true it plays the sound specified in the push data or the default system sound. Default is true. */ - sound?:boolean + sound?: boolean /** * If true the device vibrates on receipt of notification. Default is true. */ - vibrate?:boolean + vibrate?: boolean /** * If true the app clears all pending notifications when it is closed. Default is true. */ - clearNotifications?:boolean + clearNotifications?: boolean + /** + * If true will always show a notification, even when the app is on the foreground. Default is false. + */ + forceShow?: boolean } /** @@ -91,17 +129,33 @@ declare module PhonegapPluginPush { */ ios?: { /** - * If true the device shows an alert on receipt of notification. Default is false. + * If true|"true" the device sets the badge number on receipt of notification. + * Default is false|"false". + * Note: the value you set this option to the first time you call the init method will be how the application always acts. + * Once this is set programmatically in the init method it can only be changed manually by the user in Settings>Notifications>App Name. + * This is normal iOS behaviour. */ - badge?: boolean + badge?: boolean | string /** - * If true the device sets the badge number on receipt of notification. Default is false. + * If true|"true" the device plays a sound on receipt of notification. + * Default is false|"false". + * Note: the value you set this option to the first time you call the init method will be how the application always acts. + * Once this is set programmatically in the init method it can only be changed manually by the user in Settings>Notifications>App Name. + * This is normal iOS behaviour. */ - sound?: boolean + sound?: boolean | string /** - * If true the device plays a sound on receipt of notification. Default is false. + * If true|"true" the device shows an alert on receipt of notification. + * Default is false|"false". + * Note: the value you set this option to the first time you call the init method will be how the application always acts. + * Once this is set programmatically in the init method it can only be changed manually by the user in Settings>Notifications>App Name. + * This is normal iOS behaviour. */ - alert?: boolean + alert?: boolean | string + /** + * Boolean|String Optional. If true|"true" the badge will be cleared on app startup. Default is false|"false". + */ + clearBadge?: boolean | string } /** @@ -116,63 +170,64 @@ declare module PhonegapPluginPush { /** * The registration ID provided by the 3rd party remote push service. */ - registrationId:string + registrationId: string } interface NotificationEventResponse { /** * The text of the push message sent from the 3rd party service. */ - message:string + message: string /** * The optional title of the push message sent from the 3rd party service. */ - title?:string + title?: string /** * The number of messages to be displayed in the badge iOS or message count in the notification shade in Android. * For windows, it represents the value in the badge notification which could be a number or a status glyph. */ - count:string + count: string /** * The name of the sound file to be played upon receipt of the notification. */ - sound:string + sound: string /** * The path of the image file to be displayed in the notification. */ - image:string + image: string /** * An optional collection of data sent by the 3rd party push service that does not fit in the above properties. */ additionalData: NotificationEventAdditionalData } + /** + * TODO: document all possible properties (I only got the android ones) + * + * Loosened up with a dictionary notation, but all non-defined properties need to use (map['prop']) notation + * + * Ideally the developer would overload (merged declaration) this or create a new interface that would extend this one + * so that he could specify any custom code without having to use array notation (map['prop']) for all of them. + */ interface NotificationEventAdditionalData { - /** - * TODO: document all possible properties (I only got the android ones) - * - * Loosened up with a dictionary notation, but all non-defined properties need to use (map['prop']) notation - * - * Ideally the developer would overload (merged declaration) this or create a new interface that would extend this one - * so that he could specify any custom code without having to use array notation (map['prop']) for all of them. - */ [name: string]: any + /** * Whether the notification was received while the app was in the foreground */ - foreground?:boolean - collapse_key?:string - from?:string - notId?:string + foreground?: boolean + collapse_key?: string + from?: string + notId?: string } interface PushNotificationStatic { - init(options:InitOptions):PushNotification - new(options:InitOptions):PushNotification + init(options: InitOptions): PushNotification + new (options: InitOptions): PushNotification } } interface Window { - PushNotification:PhonegapPluginPush.PushNotificationStatic + PushNotification: PhonegapPluginPush.PushNotificationStatic } -declare var PushNotification:PhonegapPluginPush.PushNotificationStatic; +declare var PushNotification: PhonegapPluginPush.PushNotificationStatic; From 17758248863977dbf88e938d6cc428b55e1df205 Mon Sep 17 00:00:00 2001 From: fredericogalvao Date: Tue, 24 Nov 2015 00:50:20 -0200 Subject: [PATCH 132/389] [chores] --- phonegap-plugin-push/phonegap-plugin-push-tests.ts | 2 +- phonegap-plugin-push/phonegap-plugin-push.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phonegap-plugin-push/phonegap-plugin-push-tests.ts b/phonegap-plugin-push/phonegap-plugin-push-tests.ts index f4bc07c0c..339c7e8e1 100644 --- a/phonegap-plugin-push/phonegap-plugin-push-tests.ts +++ b/phonegap-plugin-push/phonegap-plugin-push-tests.ts @@ -64,7 +64,7 @@ function test() { console.log('did finish'); }, () => { console.log('did not finish'); - }) + }); }; let errorHandler = (e: Error) => { diff --git a/phonegap-plugin-push/phonegap-plugin-push.d.ts b/phonegap-plugin-push/phonegap-plugin-push.d.ts index 017a9c5b7..a8807cc34 100644 --- a/phonegap-plugin-push/phonegap-plugin-push.d.ts +++ b/phonegap-plugin-push/phonegap-plugin-push.d.ts @@ -153,7 +153,7 @@ declare module PhonegapPluginPush { */ alert?: boolean | string /** - * Boolean|String Optional. If true|"true" the badge will be cleared on app startup. Default is false|"false". + * If true|"true" the badge will be cleared on app startup. Default is false|"false". */ clearBadge?: boolean | string } From 97d7377cf8f38d1c4e8e424f4a55de99428fe281 Mon Sep 17 00:00:00 2001 From: gcroteau Date: Mon, 23 Nov 2015 22:57:19 -0500 Subject: [PATCH 133/389] Initial commit. Created turf.d.ts and turf-test.ts files. --- turf/turf-test.ts | 0 turf/turf.d.ts | 0 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 turf/turf-test.ts create mode 100644 turf/turf.d.ts diff --git a/turf/turf-test.ts b/turf/turf-test.ts new file mode 100644 index 000000000..e69de29bb diff --git a/turf/turf.d.ts b/turf/turf.d.ts new file mode 100644 index 000000000..e69de29bb From b30dbc4dd32b3237cd78e9139c3fc270caaacacb Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Tue, 24 Nov 2015 11:25:05 +0100 Subject: [PATCH 134/389] Update SuperAgent to version 1.4.0 - Callback now always takes 2 arguments, see https://github.com/visionmedia/superagent/commit/e440274 - Add Request.use() - Improve tests --- superagent/superagent-tests.ts | 39 +++++++++++++++++++++++++++------- superagent/superagent.d.ts | 5 +++-- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/superagent/superagent-tests.ts b/superagent/superagent-tests.ts index 466fc33a1..58b684044 100644 --- a/superagent/superagent-tests.ts +++ b/superagent/superagent-tests.ts @@ -1,17 +1,20 @@ -/// +/// /// // via: http://visionmedia.github.io/superagent/ -import request = require('superagent') -import fs = require('fs'); +import * as request from 'superagent'; +import * as fs from 'fs'; + +// Examples taken from https://github.com/visionmedia/superagent/blob/gh-pages/docs/index.md +// and https://github.com/visionmedia/superagent/blob/master/Readme.md request .post('/api/pet') .send({ name: 'Manny', species: 'cat' }) .set('X-API-Key', 'foobar') .set('Accept', 'application/json') - .end((res: request.Response) => { + .end((err, res) => { if (res.ok) { console.log('yay got ' + JSON.stringify(res.body)); } else { @@ -25,7 +28,7 @@ agent .send({ name: 'Manny', species: 'cat' }) .set('X-API-Key', 'foobar') .set('Accept', 'application/json') - .end((res: request.Response) => { + .end((err, res) => { if (res.error) { console.log('oh no ' + res.error.message); } else { @@ -33,8 +36,19 @@ agent } }); +// Plugins +var nocache = require('superagent-no-cache'); +var prefix = require('superagent-prefix')('/static'); -var callback = (res: request.Response) => {}; +request + .get('/some-url') + .use(prefix) // Prefixes *only* this request + .use(nocache) // Prevents caching of *only* this request + .end(function(err, res){ + // Do something + }); + +var callback = (err: any, res: request.Response) => {}; // Request basics request @@ -44,6 +58,10 @@ request request('GET', '/search') .end(callback); +request + .get('http://example.com/search') + .end(callback); + request .head('/favicon.ico') .end(callback); @@ -100,6 +118,12 @@ request .query('range=1..5') .end(callback); +// HEAD requests +request + .head('/users') + .query({ email: 'joe@smith.com' }) + .end(callback); + // POST / PUT requests request.post('/user') .set('Content-Type', 'application/json') @@ -139,6 +163,7 @@ request.post('/user') request.post('/user') .type('png'); +// Setting Accept request.get('/user') .accept('application/json'); @@ -254,5 +279,3 @@ request .attach('image', 'path/to/tobi.png') .on('error', (err: any) => {}) .end(callback); - - diff --git a/superagent/superagent.d.ts b/superagent/superagent.d.ts index a5118a764..493d287ef 100644 --- a/superagent/superagent.d.ts +++ b/superagent/superagent.d.ts @@ -1,4 +1,4 @@ -// Type definitions for SuperAgent 0.15.4 +// Type definitions for SuperAgent v1.4.0 // Project: https://github.com/visionmedia/superagent // Definitions by: Alex Varju // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -8,7 +8,7 @@ declare module "superagent" { import stream = require('stream'); - type CallbackHandler = { (err: any, res: request.Response): void; }|{ (res: request.Response): void; }; + type CallbackHandler = (err: any, res: request.Response) => void; var request: request.SuperAgentStatic; @@ -102,6 +102,7 @@ declare module "superagent" { set(field: Object): Req; timeout(ms: number): Req; type(val: string): Req; + use(fn: Function): Req; withCredentials(): Req; write(data: string, encoding?: string): Req; write(data: Buffer, encoding?: string): Req; From 15852a714521bb27a8b4e129c7f48e7e1046cfdb Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Tue, 24 Nov 2015 11:27:45 +0100 Subject: [PATCH 135/389] Update SuperTest to version 1.1.0 - Callback now always takes 2 arguments, see https://github.com/visionmedia/superagent/commit/e440274 - Override superagent.Request.end() so it takes the proper callback signature --- supertest/supertest-tests.ts | 7 +++---- supertest/supertest.d.ts | 5 +++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/supertest/supertest-tests.ts b/supertest/supertest-tests.ts index d76c97ea4..5e0de8ad8 100644 --- a/supertest/supertest-tests.ts +++ b/supertest/supertest-tests.ts @@ -1,8 +1,8 @@ /// /// -import supertest = require('supertest') -import express = require('express'); +import * as supertest from 'supertest'; +import * as express from 'express'; var app = express(); @@ -11,7 +11,7 @@ supertest(app) .expect('Content-Type', /json/) .expect('Content-Length', '20') .expect(201) - .end((err: any, res: supertest.Response) => { + .end((err, res) => { if (err) throw err; }); @@ -56,4 +56,3 @@ function hasPreviousAndNextKeys(res: supertest.Response) { if (!('next' in res.body)) return "missing next key"; if (!('prev' in res.body)) throw new Error("missing prev key"); } - diff --git a/supertest/supertest.d.ts b/supertest/supertest.d.ts index dccbd47c8..9ca154e2f 100644 --- a/supertest/supertest.d.ts +++ b/supertest/supertest.d.ts @@ -1,4 +1,4 @@ -// Type definitions for SuperTest 0.14.0 +// Type definitions for SuperTest v1.1.0 // Project: https://github.com/visionmedia/supertest // Definitions by: Alex Varju // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -8,7 +8,7 @@ declare module "supertest" { import superagent = require('superagent'); - type CallbackHandler = { (err: any, res: supertest.Response): void; }|{ (res: supertest.Response): void; }; + type CallbackHandler = (err: any, res: supertest.Response) => void; function supertest(app: any): supertest.SuperTest; @@ -29,6 +29,7 @@ declare module "supertest" { expect(field: string, val: string, callback?: CallbackHandler): Test; expect(field: string, val: RegExp, callback?: CallbackHandler): Test; expect(checker: (res: Response) => any): Test; + end(callback?: CallbackHandler): Test; } interface Response extends superagent.Response { From 612f58ac6aa92de613ed5bbb8ed7bf1c460dcec2 Mon Sep 17 00:00:00 2001 From: Lukasz Potapczuk Date: Tue, 24 Nov 2015 12:11:19 +0100 Subject: [PATCH 136/389] Added definitions for ng-stomp library --- ng-stomp/ng-stomp-test.ts | 48 +++++++++++++++++++++++++++++++++++++++ ng-stomp/ng-stomp.d.ts | 34 +++++++++++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 ng-stomp/ng-stomp-test.ts create mode 100644 ng-stomp/ng-stomp.d.ts diff --git a/ng-stomp/ng-stomp-test.ts b/ng-stomp/ng-stomp-test.ts new file mode 100644 index 000000000..e27b1bd23 --- /dev/null +++ b/ng-stomp/ng-stomp-test.ts @@ -0,0 +1,48 @@ +/// +/// + +module ngStompTesting { + + "use strict"; + var ngStompTest = "ngStompTest"; + + class test { + constructor(private ngstomp:ngStomp) { + var connectHeaders ={ + "Lol": "user", + "Accept": "lol" + }; + + ngstomp.connect('/endpoint', connectHeaders) + + // frame = CONNECTED headers + .then(function (frame) { + + this.subscription = ngstomp.subscribe('/dest', function (payload, headers, res) { + this.payload = payload; + }, { + "headers": "are awesome" + }); + + // Unsubscribe + this.subscription.unsubscribe(); + + // Send message + ngstomp.send('/dest', { + message: 'body' + }, { + priority: 9, + custom: 42 //Custom Headers + }); + + // Disconnect + ngstomp.disconnect(function () { + + }); + }); + } + + } + + angular.module("app").controller(ngStompTest, test); +} \ No newline at end of file diff --git a/ng-stomp/ng-stomp.d.ts b/ng-stomp/ng-stomp.d.ts new file mode 100644 index 000000000..df6397421 --- /dev/null +++ b/ng-stomp/ng-stomp.d.ts @@ -0,0 +1,34 @@ +// Type definitions for ngStomp +// Project: https://github.com/beevelop/ng-stomp +// Definitions by: Lukasz Potapczuk +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/// + + +interface ngStomp { + sock:any; + stomp:any; + debug:any; + off: any; + + setDebug:(callback:Function)=> void; + + connect: (endpoint:string, headers?:Headers)=> angular.IHttpPromise; + + disconnect: (callback:()=>void) => angular.IHttpPromise; + + subscribe: (destination:string, callback:Function, headers?:Headers, scope?:any) => any; + + unsubscribe: () => any; + + send: (destination:string, body:any, headers:Headers)=> any; + + } + + interface Headers { + [key: string]: any; + } + + + + From 4bc8a55f65b66a6855e009299287046a16ddd25b Mon Sep 17 00:00:00 2001 From: Lukasz Potapczuk Date: Tue, 24 Nov 2015 12:22:48 +0100 Subject: [PATCH 137/389] Fixed ng-stomp definitions --- ng-stomp/ng-stomp-test.ts | 3 ++- ng-stomp/ng-stomp.d.ts | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ng-stomp/ng-stomp-test.ts b/ng-stomp/ng-stomp-test.ts index e27b1bd23..4f9092c20 100644 --- a/ng-stomp/ng-stomp-test.ts +++ b/ng-stomp/ng-stomp-test.ts @@ -9,12 +9,13 @@ module ngStompTesting { class test { constructor(private ngstomp:ngStomp) { var connectHeaders ={ - "Lol": "user", + "Auth": "user", "Accept": "lol" }; ngstomp.connect('/endpoint', connectHeaders) + // frame = CONNECTED headers .then(function (frame) { diff --git a/ng-stomp/ng-stomp.d.ts b/ng-stomp/ng-stomp.d.ts index df6397421..314f36028 100644 --- a/ng-stomp/ng-stomp.d.ts +++ b/ng-stomp/ng-stomp.d.ts @@ -17,7 +17,7 @@ interface ngStomp { disconnect: (callback:()=>void) => angular.IHttpPromise; - subscribe: (destination:string, callback:Function, headers?:Headers, scope?:any) => any; + subscribe: (destination:string, callback:(payload:string, headers:Headers, res:Function)=>void, headers?:Headers, scope?:any) => any; unsubscribe: () => any; @@ -32,3 +32,5 @@ interface ngStomp { + + From 0d29dd1f2e1ec36df21568d5f9da1263f3d099d7 Mon Sep 17 00:00:00 2001 From: Lukasz Potapczuk Date: Tue, 24 Nov 2015 12:25:28 +0100 Subject: [PATCH 138/389] Fixed ng-stomp definitions --- ng-stomp/ng-stomp.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ng-stomp/ng-stomp.d.ts b/ng-stomp/ng-stomp.d.ts index 314f36028..7cf263eeb 100644 --- a/ng-stomp/ng-stomp.d.ts +++ b/ng-stomp/ng-stomp.d.ts @@ -1,6 +1,6 @@ // Type definitions for ngStomp // Project: https://github.com/beevelop/ng-stomp -// Definitions by: Lukasz Potapczuk +// Definitions by: Lukasz Potapczuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// From 148d636a9a1bae3d260d3c42dea23415208f092e Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Tue, 24 Nov 2015 13:54:48 +0200 Subject: [PATCH 139/389] Update signalr.d.ts Fixed error function handler params. --- signalr/signalr.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/signalr/signalr.d.ts b/signalr/signalr.d.ts index e890c8f42..515b1864f 100644 --- a/signalr/signalr.d.ts +++ b/signalr/signalr.d.ts @@ -60,7 +60,7 @@ interface SignalR { starting(handler: () => void ): SignalR; received(handler: (data: any) => void ): SignalR; - error(handler: (error: string) => void ): SignalR; + error(handler: (error: Error) => void ): SignalR; stateChanged(handler: (change: SignalRStateChange) => void ): SignalR; disconnected(handler: () => void ): SignalR; connectionSlow(handler: () => void ): SignalR; From ed11abd71a0d06fd37a65ee9d0908e5106b06347 Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Tue, 24 Nov 2015 14:19:08 +0200 Subject: [PATCH 140/389] Removed immutable Immutable changed to any and added TODO. --- flux/flux.d.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/flux/flux.d.ts b/flux/flux.d.ts index 5b6079d50..dc476f3bc 100644 --- a/flux/flux.d.ts +++ b/flux/flux.d.ts @@ -3,7 +3,6 @@ // Definitions by: Steve Baker , Giedrius Grabauskas // Definitions: https://github.com/borisyankov/DefinitelyTyped -/// /// declare module Flux { @@ -84,8 +83,8 @@ declare module FluxUtils { /** * This class extends ReduceStore and defines the state as an immutable map. */ - export class MapStore extends ReduceStore> { - + // TODO: Change to > + export class MapStore extends ReduceStore { /** * Access the value at the given key. * Throws an error if the key does not exist in the cache. @@ -108,7 +107,9 @@ declare module FluxUtils { * it allows providing a previous result to update instead of generating a new map. * Providing a previous result allows the possibility of keeping the same reference if the keys did not change. */ - getAll(keys: Immutable.IndexedIterable, prev?: Immutable.Map): Immutable.Map; + // TODO: Update with Immutable interface. + // getAll(keys: Immutable.IndexedIterable, prev?: Immutable.Map): Immutable.Map; + getAll(keys: any, prev?: any): any; } export class ReduceStore extends Store { From f9cd3e383d7462c7dfcd2eca8ff088534d270e08 Mon Sep 17 00:00:00 2001 From: mirogrenda Date: Tue, 24 Nov 2015 15:40:54 +0100 Subject: [PATCH 141/389] ckeditor: added CKEDITOR.lang type definition Added the missing CKEDITOR.lang type definition (stores language-related functions - see https://github.com/ckeditor/ckeditor-dev/blob/master/core/lang.js) --- ckeditor/ckeditor.d.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ckeditor/ckeditor.d.ts b/ckeditor/ckeditor.d.ts index 0164bb09b..b3c2f4524 100644 --- a/ckeditor/ckeditor.d.ts +++ b/ckeditor/ckeditor.d.ts @@ -1139,4 +1139,12 @@ declare module CKEDITOR { function isTabEnabled(editor: editor, dialogName: string, tabName: string): boolean; function okButton(): void; } -} + + module lang { + var languages: any; + var rtl: any; + + function load(languageCode: string, defaultLanguage: string, callback: Function): void; + function detect(defaultLanguage: string, probeLanguage: string): string; + } +} \ No newline at end of file From 0cf0251b353eed2dc733804e51d094334138dd1a Mon Sep 17 00:00:00 2001 From: Ivan Drinchev Date: Tue, 24 Nov 2015 17:22:57 +0200 Subject: [PATCH 142/389] Added umzug v1.7.0 definitions --- umzug/umzug-tests.ts | 134 ++++++++++++++++++++++++++++++ umzug/umzug.d.ts | 188 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 322 insertions(+) create mode 100644 umzug/umzug-tests.ts create mode 100644 umzug/umzug.d.ts diff --git a/umzug/umzug-tests.ts b/umzug/umzug-tests.ts new file mode 100644 index 000000000..95d7521fd --- /dev/null +++ b/umzug/umzug-tests.ts @@ -0,0 +1,134 @@ +/// +/// +/// + +import Umzug = require("umzug"); +import Sequelize = require("sequelize"); + + +var umzug = new Umzug({}); + +umzug.up().then(function (result) { + // do something with the result +}); + +umzug.execute({ + migrations: ['some-id', 'some-other-id'], + method: 'up' +}).then(function (migrations) { + // "migrations" will be an Array of all executed/reverted migrations. +}); + +umzug.pending().then(function (migrations) { + // "migrations" will be an Array with the names of + // pending migrations. +}); + +umzug.executed().then(function (migrations) { + // "migrations" will be an Array of already executed migrations. +}); + +umzug.up().then(function (migrations) { + // "migrations" will be an Array with the names of the + // executed migrations. +}); + +umzug.up({ to: '20141101203500-task' }).then(function (migrations) {}); + +umzug.up({ migrations: ['20141101203500-task', '20141101203501-task-2'] }); + +umzug.up('20141101203500-task'); // Runs just the passed migration +umzug.up(['20141101203500-task', '20141101203501-task-2']); + +umzug.down().then(function (migration) { + // "migration" will the name of the reverted migration. +}); + +umzug.down({ to: '20141031080000-task' }).then(function (migrations) { + // "migrations" will be an Array with the names of all reverted migrations. +}); + +umzug.down({ migrations: ['20141101203500-task', '20141101203501-task-2'] }); + +umzug.down('20141101203500-task'); // Runs just the passed migration +umzug.down(['20141101203500-task', '20141101203501-task-2']); + +var AnotherUmzug = new Umzug({ + // The storage. + // Possible values: 'json', 'sequelize', an object + storage: 'json', + + // The options for the storage. + // Check the available storages for further details. + storageOptions: {}, + + // The logging function. + // A function that gets executed everytime migrations start and have ended. + logging: false, + + // The name of the positive method in migrations. + upName: 'up', + + // The name of the negative method in migrations. + downName: 'down', + + migrations: { + // The params that gets passed to the migrations. + // Might be an array or a synchronous function which returns an array. + params: [], + + // The path to the migrations directory. + path: 'migrations', + + // The pattern that determines whether or not a file is a migration. + pattern: /^\d+[\w-]+\.js$/, + + // A function that receives and returns the to be executed function. + // This can be used to modify the function. + wrap: function (fun : Function) { return fun; } + } +}); + +var AnotherUmzug = new Umzug({ + // The storage. + // Possible values: 'json', 'sequelize', an object + storage: 'json', + storageOptions: { + path: process.cwd() + '/db/sequelize-meta.json' + } +}); + +var sequelize = new Sequelize(''); + +var AnotherUmzug = new Umzug({ + // The storage. + // Possible values: 'json', 'sequelize', an object + storage: 'sequelize', + storageOptions: { + // The configured instance of Sequelize. + // Optional if `model` is passed. + sequelize: sequelize, + + // The to be used Sequelize model. + // Must have column name matching `columnName` option + // Optional of `sequelize` is passed. + model: sequelize.define( 'model', {} ), + + // The name of the to be used model. + // Defaults to 'SequelizeMeta' + modelName: 'Schema', + + // The name of table to create if `model` option is not supplied + // Defaults to `modelName` + tableName: 'Schema', + + // The name of table column holding migration name. + // Defaults to 'name'. + columnName: 'migration', + + // The type of the column holding migration name. + // Defaults to `Sequelize.STRING` + columnType: Sequelize.STRING(100) + } + +}); diff --git a/umzug/umzug.d.ts b/umzug/umzug.d.ts new file mode 100644 index 000000000..2e2b20a7c --- /dev/null +++ b/umzug/umzug.d.ts @@ -0,0 +1,188 @@ +// Type definitions for Umzug v1.7.0 +// Project: https://github.com/sequelize/umzug +// Definitions by: Ivan Drinchev +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// + +declare module "umzug" { + + import Sequelize = require("sequelize"); + + interface MigrationOptions { + + /* + * The params that gets passed to the migrations. + * Might be an array or a synchronous function which returns an array. + */ + params?: Array; + + /** The path to the migrations directory. */ + path?: string; + + /** The pattern that determines whether or not a file is a migration. */ + pattern?: RegExp; + + /** + * A function that receives and returns the to be executed function. + * This can be used to modify the function. + */ + wrap?: ( fn : T ) => T; + + } + + interface JSONStorageOptions { + + /** + * The path to the json storage. + * Defaults to process.cwd() + '/umzug.json'; + */ + path?: string; + + } + + interface SequelizeStorageOptions { + + /** + * The configured instance of Sequelize. + * Optional if `model` is passed. + */ + sequelize?: Sequelize.Sequelize; + + /** + * The to be used Sequelize model. + * Must have column name matching `columnName` option + * Optional of `sequelize` is passed. + */ + model?: Sequelize.Model; + + /** + * The name of the to be used model. + * Defaults to 'SequelizeMeta' + */ + modelName?: string; + + /** + * The name of table to create if `model` option is not supplied + * Defaults to `modelName` + */ + tableName?: string; + + /** + * The name of table column holding migration name. + * Defaults to 'name'. + */ + columnName: string; + + /** + * The type of the column holding migration name. + * Defaults to `Sequelize.STRING` + */ + columnType: Sequelize.DataTypeAbstract; + + } + + interface ExecuteOptions { + migrations?: Array; + method?: string; + } + + interface UmzugOptions { + + /** + * The storage. + * Possible values: 'json', 'sequelize', an object + */ + storage?: string; + + /** + * The options for the storage. + */ + storageOptions?: JSONStorageOptions | SequelizeStorageOptions | Object; + + /** + * The logging function. + * A function that gets executed everytime migrations start and have ended. + */ + logging? : boolean | Function; + + /** + * The name of the positive method in migrations. + */ + upName? : string; + + /** + * The name of the negative method in migrations. + */ + downName? : string; + + /** + * Options for defined migration + */ + migrations? : MigrationOptions; + + } + + interface UpDownToOptions { + + /** + * It is also possible to pass the name of a migration in order to + * just run the migrations from the current state to the passed + * migration name. + */ + to: string; + + } + + interface UpDownMigrationsOptions { + + /** + * Running specific migrations while ignoring the right order, can be + * done like this: + */ + migrations: Array; + + } + + class Umzug { + + constructor(options?: UmzugOptions); + + /** + * The execute method is a general purpose function that runs for + * every specified migrations the respective function. + */ + execute(options? : ExecuteOptions) : Promise>; + + /** + * You can get a list of pending/not yet executed migrations like this: + */ + pending() : Promise>; + + /** + * You can get a list of already executed migrations like this: + */ + executed() : Promise>; + + /** + * The up method can be used to execute all pending migrations. + */ + up(migration?: string) : Promise; + up(migrations?: Array) : Promise>; + up(options?: UpDownToOptions | UpDownMigrationsOptions ) : Promise>; + + /** + * The down method can be used to revert the last executed migration. + */ + down(migration?: string) : Promise; + down(migrations?: Array) : Promise>; + down(options?: UpDownToOptions | UpDownMigrationsOptions ) : Promise>; + + } + + var umzug : typeof Umzug; + + export = umzug; + +} From 8ccfe0dd015abcdae1625bfc795ca7ae6615fd78 Mon Sep 17 00:00:00 2001 From: gcroteau Date: Tue, 24 Nov 2015 14:54:21 -0500 Subject: [PATCH 143/389] Added definition for distance and pointOnLine. Added related tests. --- turf/turf-test.ts | 94 +++++++++++++++++++++++++++++++++++++++++++++++ turf/turf.d.ts | 65 ++++++++++++++++++++++++++++++++ 2 files changed, 159 insertions(+) diff --git a/turf/turf-test.ts b/turf/turf-test.ts index e69de29bb..1cf6be9b0 100644 --- a/turf/turf-test.ts +++ b/turf/turf-test.ts @@ -0,0 +1,94 @@ +/// + +////////////////////////////////////////////////////////////////////////// +// Tests Aggregation +////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////// +// Tests Measurement +////////////////////////////////////////////////////////////////////////// + +var point1 = { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [-75.343, 39.984] + } +}; +var point2 = { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [-75.534, 39.123] + } +}; +var units = "miles"; + +var points = { + "type": "FeatureCollection", + "features": [point1, point2] +}; + +var distance = turf.distance(point1, point2, units); + +////////////////////////////////////////////////////////////////////////// +// Tests Transformation +////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////// +// Tests Misc +////////////////////////////////////////////////////////////////////////// + +var line = { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "LineString", + "coordinates": [ + [-77.031669, 38.878605], + [-77.029609, 38.881946], + [-77.020339, 38.884084], + [-77.025661, 38.885821], + [-77.021884, 38.889563], + [-77.019824, 38.892368] + ] + } +}; +var pt = { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [-77.037076, 38.884017] + } +}; + +var snapped = turf.pointOnLine(line, pt); +snapped.properties['marker-color'] = '#00f' + +var result = { + "type": "FeatureCollection", + "features": [line, pt, snapped] +}; + +////////////////////////////////////////////////////////////////////////// +// Tests Helper +////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////// +// Tests Data +////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////// +// Tests Interpolation +//////////////////////////////////////////////////////////////////////////; + +////////////////////////////////////////////////////////////////////////// +// Tests Joins +////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////// +// Tests Classification +////////////////////////////////////////////////////////////////////////// diff --git a/turf/turf.d.ts b/turf/turf.d.ts index e69de29bb..cde4b59d3 100644 --- a/turf/turf.d.ts +++ b/turf/turf.d.ts @@ -0,0 +1,65 @@ +// Type definitions for Turf 2.0 +// Project: http://turfjs.org/ +// Definitions by: Guillaume Croteau +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module turf { + ////////////////////////////////////////////////////////////////////////// + // Aggregation + ////////////////////////////////////////////////////////////////////////// + + ////////////////////////////////////////////////////////////////////////// + // Measurement + ////////////////////////////////////////////////////////////////////////// + + /** + * Calculates the distance between two points in degress, radians, miles, or kilometers. This uses the Haversine formula to account for global curvature. + * @param from Origin point + * @param to Destination point + * @param units Can be degrees, radians, miles, or kilometers. Default is kilometers. + * @returns Distance between the two points + */ + function distance(from: GeoJSON.Feature, to: GeoJSON.Feature, units?: string): number; + + ////////////////////////////////////////////////////////////////////////// + // Transformation + ////////////////////////////////////////////////////////////////////////// + + ////////////////////////////////////////////////////////////////////////// + // Misc + ////////////////////////////////////////////////////////////////////////// + + /** + * Takes a Point and a LineString and calculates the closest Point on the LineString. + * @param line Line to snap to + * @param point Point to snap from + * @returns Closest point on the line to point + */ + function pointOnLine(line: GeoJSON.Feature, point: GeoJSON.Feature): GeoJSON.Feature; + + ////////////////////////////////////////////////////////////////////////// + // Helper + ////////////////////////////////////////////////////////////////////////// + + ////////////////////////////////////////////////////////////////////////// + // Data + ////////////////////////////////////////////////////////////////////////// + + ////////////////////////////////////////////////////////////////////////// + // Interpolation + //////////////////////////////////////////////////////////////////////////; + + ////////////////////////////////////////////////////////////////////////// + // Joins + ////////////////////////////////////////////////////////////////////////// + + ////////////////////////////////////////////////////////////////////////// + // Classification + ////////////////////////////////////////////////////////////////////////// + + ////////////////////////////////////////////////////////////////////////// + // Types + ////////////////////////////////////////////////////////////////////////// +} From 9488d2229fd7f91287777bcd3d61f658b3a1c020 Mon Sep 17 00:00:00 2001 From: gcroteau Date: Tue, 24 Nov 2015 16:53:35 -0500 Subject: [PATCH 144/389] Added along and area definition. Added related tests. --- turf/turf-test.ts | 100 ++++++++++++++++++++++++++++++++-------------- turf/turf.d.ts | 18 ++++++++- 2 files changed, 86 insertions(+), 32 deletions(-) diff --git a/turf/turf-test.ts b/turf/turf-test.ts index 1cf6be9b0..5d1a73a93 100644 --- a/turf/turf-test.ts +++ b/turf/turf-test.ts @@ -1,11 +1,7 @@ /// ////////////////////////////////////////////////////////////////////////// -// Tests Aggregation -////////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////////// -// Tests Measurement +// Tests data initialisation ////////////////////////////////////////////////////////////////////////// var point1 = { @@ -16,6 +12,7 @@ var point1 = { "coordinates": [-75.343, 39.984] } }; + var point2 = { "type": "Feature", "properties": {}, @@ -24,22 +21,6 @@ var point2 = { "coordinates": [-75.534, 39.123] } }; -var units = "miles"; - -var points = { - "type": "FeatureCollection", - "features": [point1, point2] -}; - -var distance = turf.distance(point1, point2, units); - -////////////////////////////////////////////////////////////////////////// -// Tests Transformation -////////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////////// -// Tests Misc -////////////////////////////////////////////////////////////////////////// var line = { "type": "Feature", @@ -56,21 +37,78 @@ var line = { ] } }; -var pt = { - "type": "Feature", - "properties": {}, - "geometry": { - "type": "Point", - "coordinates": [-77.037076, 38.884017] - } + +var polygons = { + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Polygon", + "coordinates": [[ + [-67.031021, 10.458102], + [-67.031021, 10.53372], + [-66.929397, 10.53372], + [-66.929397, 10.458102], + [-67.031021, 10.458102] + ]] + } + }, { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Polygon", + "coordinates": [[ + [-66.919784, 10.397325], + [-66.919784, 10.513467], + [-66.805114, 10.513467], + [-66.805114, 10.397325], + [-66.919784, 10.397325] + ]] + } + } + ] }; -var snapped = turf.pointOnLine(line, pt); -snapped.properties['marker-color'] = '#00f' +////////////////////////////////////////////////////////////////////////// +// Tests Aggregation +////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////// +// Tests Measurement +////////////////////////////////////////////////////////////////////////// + +// -- Test along -- +var along = turf.along(line, 1, 'miles'); var result = { "type": "FeatureCollection", - "features": [line, pt, snapped] + "features": [line, along] +}; + +// -- Test area -- +var area = turf.area(polygons); + +// -- Test distance -- +var units = "miles"; +var distance = turf.distance(point1, point2, units); + +////////////////////////////////////////////////////////////////////////// +// Tests Transformation +////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////// +// Tests Misc +////////////////////////////////////////////////////////////////////////// + +// -- Test pointOnLine -- +var snapped = turf.pointOnLine(line, point1); +snapped.properties['marker-color'] = '#00f' + +result = { + "type": "FeatureCollection", + "features": [line, point1, snapped] }; ////////////////////////////////////////////////////////////////////////// diff --git a/turf/turf.d.ts b/turf/turf.d.ts index cde4b59d3..15e9478db 100644 --- a/turf/turf.d.ts +++ b/turf/turf.d.ts @@ -14,11 +14,27 @@ declare module turf { // Measurement ////////////////////////////////////////////////////////////////////////// + /** + * Takes a line and returns a point at a specified distance along the line. + * @param line Input line + * @param distance Distance along the line + * @param [units=miles] Can be degrees, radians, miles, or kilometers. Default is miles + * @returns Point along the line + */ + function along(line: GeoJSON.Feature, distance: number, units?: string): GeoJSON.Feature; + + /** + * Takes one or more features and returns their area in square meters. + * @param input Input features + * @returns Area in square meters + */ + function area(input: GeoJSON.Feature | GeoJSON.FeatureCollection): number; + /** * Calculates the distance between two points in degress, radians, miles, or kilometers. This uses the Haversine formula to account for global curvature. * @param from Origin point * @param to Destination point - * @param units Can be degrees, radians, miles, or kilometers. Default is kilometers. + * @param [units=kilometers] Can be degrees, radians, miles, or kilometers. Default is kilometers. * @returns Distance between the two points */ function distance(from: GeoJSON.Feature, to: GeoJSON.Feature, units?: string): number; From eb5d102c53dd046694b34a64e9fc1ffaa8a3797c Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Wed, 25 Nov 2015 04:47:56 +0500 Subject: [PATCH 145/389] lodash: signatures of _.flattenDeep have been changed --- lodash/lodash-tests.ts | 34 ++++++++++++++++++++++++++++------ lodash/lodash.d.ts | 18 ++++++++++++++++-- 2 files changed, 44 insertions(+), 8 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 30c0b9934..731d12c6d 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -615,18 +615,40 @@ module TestFlattenDeep { result = _.flattenDeep(recursiveArray); result = _.flattenDeep(listOfMaybeRecursiveArraysOrValues); - - result = _(recursiveArray).flattenDeep().value(); - - result = _(listOfMaybeRecursiveArraysOrValues).flattenDeep().value(); } { - let result: any; + let result: any[]; result = _.flattenDeep(recursiveList); + } - result = _(recursiveList).flattenDeep().value(); + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(recursiveArray).flattenDeep(); + + result = _(listOfMaybeRecursiveArraysOrValues).flattenDeep(); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(recursiveList).flattenDeep(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(recursiveArray).chain().flattenDeep(); + + result = _(listOfMaybeRecursiveArraysOrValues).chain().flattenDeep(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(recursiveList).chain().flattenDeep(); } } diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 73a783b64..dd347d9d1 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -1131,14 +1131,28 @@ declare module _ { /** * @see _.flattenDeep */ - flattenDeep(): LoDashImplicitArrayWrapper; + flattenDeep(): LoDashImplicitArrayWrapper; } interface LoDashImplicitObjectWrapper { /** * @see _.flattenDeep */ - flattenDeep(): LoDashImplicitArrayWrapper; + flattenDeep(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.flattenDeep + */ + flattenDeep(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.flattenDeep + */ + flattenDeep(): LoDashExplicitArrayWrapper; } //_.head From 56fa333e5a07268f39caa2ea9717742c1af67d8e Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Wed, 25 Nov 2015 02:25:09 +0200 Subject: [PATCH 146/389] Imported FluxUtils and React Imported FluxUtils and React modules and added react typescript definitions reference. --- flux/flux-tests.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/flux/flux-tests.ts b/flux/flux-tests.ts index f41d15aff..52507a224 100644 --- a/flux/flux-tests.ts +++ b/flux/flux-tests.ts @@ -1,6 +1,12 @@ /// +/// import flux = require('flux') +import FluxUtils = require('flux/utils') +import React = require('react') + +var Component = React.Component +var Container = FluxUtils.Container // // Basic dispatcher usage @@ -78,4 +84,6 @@ class CustomDispatcher extends flux.Dispatcher { var customDispatcher = new CustomDispatcher() -export = customDispatcher \ No newline at end of file +export = customDispatcher + + From 66f52639ef5e850bc71356852b2b5ebc8db1215d Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Wed, 25 Nov 2015 02:26:37 +0200 Subject: [PATCH 147/389] Added test code --- flux/flux-tests.ts | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/flux/flux-tests.ts b/flux/flux-tests.ts index 52507a224..c804babd8 100644 --- a/flux/flux-tests.ts +++ b/flux/flux-tests.ts @@ -86,4 +86,41 @@ var customDispatcher = new CustomDispatcher() export = customDispatcher +// Sample Reduce Store +class CounterStore extends ReduceStore { + getInitialState(): number { + return 0; + } + reduce(state: number, action: Object): number { + switch (action.type) { + case 'increment': + return state + 1; + + case 'square': + return state * state; + + default: + return state; + } + } +} + +// Sample Flux container with CounterStore +class CounterContainer extends Component { + static getStores() { + return [CounterStore]; + } + + static calculateState(prevState) { + return { + counter: CounterStore.getState(), + }; + } + + render() { + return {this.state.counter}; + } +} + +const container = Container.create(CounterContainer); From f67ea5412d895e5e56db4e2c3e909363b50c6ef4 Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Wed, 25 Nov 2015 02:33:58 +0200 Subject: [PATCH 148/389] Removed JSX elements. --- flux/flux-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flux/flux-tests.ts b/flux/flux-tests.ts index c804babd8..33225178a 100644 --- a/flux/flux-tests.ts +++ b/flux/flux-tests.ts @@ -119,7 +119,7 @@ class CounterContainer extends Component { } render() { - return {this.state.counter}; + return this.state.counter; } } From 5eb0edcee2c0015fc546a0ba79204abc898fddc5 Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Wed, 25 Nov 2015 02:40:50 +0200 Subject: [PATCH 149/389] Fixed test errors --- flux/flux-tests.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/flux/flux-tests.ts b/flux/flux-tests.ts index 33225178a..9f583475e 100644 --- a/flux/flux-tests.ts +++ b/flux/flux-tests.ts @@ -7,6 +7,7 @@ import React = require('react') var Component = React.Component var Container = FluxUtils.Container +var ReduceStore = FluxUtils.ReduceStore // // Basic dispatcher usage @@ -92,7 +93,7 @@ class CounterStore extends ReduceStore { return 0; } - reduce(state: number, action: Object): number { + reduce(state: number, action: any): number { switch (action.type) { case 'increment': return state + 1; @@ -107,12 +108,12 @@ class CounterStore extends ReduceStore { } // Sample Flux container with CounterStore -class CounterContainer extends Component { +class CounterContainer extends Component { static getStores() { return [CounterStore]; } - static calculateState(prevState) { + static calculateState(prevState: any) { return { counter: CounterStore.getState(), }; From b8ce2921dce286372842e2c5efe731513e5bc452 Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Wed, 25 Nov 2015 02:45:53 +0200 Subject: [PATCH 150/389] ReduceStore import updated and changed extends. --- flux/flux-tests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flux/flux-tests.ts b/flux/flux-tests.ts index 9f583475e..0fe6e13d1 100644 --- a/flux/flux-tests.ts +++ b/flux/flux-tests.ts @@ -7,7 +7,6 @@ import React = require('react') var Component = React.Component var Container = FluxUtils.Container -var ReduceStore = FluxUtils.ReduceStore // // Basic dispatcher usage @@ -87,8 +86,9 @@ var customDispatcher = new CustomDispatcher() export = customDispatcher + // Sample Reduce Store -class CounterStore extends ReduceStore { +class CounterStore extends FluxUtils.ReduceStore { getInitialState(): number { return 0; } From 3f99edd466ce2039ccdf9088e6b0d578c920df62 Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Wed, 25 Nov 2015 02:49:06 +0200 Subject: [PATCH 151/389] Object changed to any. --- flux/flux.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/flux/flux.d.ts b/flux/flux.d.ts index dc476f3bc..c65892321 100644 --- a/flux/flux.d.ts +++ b/flux/flux.d.ts @@ -77,7 +77,7 @@ declare module FluxUtils { * that updates its state when relevant stores change. * The provided base class must have static methods getStores() and calculateState(). */ - static create(base: React.ComponentClass, options?: Object): React.ComponentClass; + static create(base: React.ComponentClass, options?: any): React.ComponentClass; } /** @@ -130,7 +130,7 @@ declare module FluxUtils { * All subclasses must implement this method. * This method should be pure and have no side-effects. */ - reduce(state: T, action: Object): T; + reduce(state: T, action: any): T; /** * Checks if two versions of state are the same. @@ -145,7 +145,7 @@ declare module FluxUtils { /** * Constructs and registers an instance of this store with the given dispatcher. */ - constructor(dispatcher: Flux.Dispatcher); + constructor(dispatcher: Flux.Dispatcher); /** * Adds a listener to the store, when the store changes the given callback will be called. @@ -157,7 +157,7 @@ declare module FluxUtils { /** * Returns the dispatcher this store is registered with. */ - getDispatcher(): Flux.Dispatcher; + getDispatcher(): Flux.Dispatcher; /** * Returns the dispatch token that the dispatcher recognizes this store by. @@ -184,7 +184,7 @@ declare module FluxUtils { * This is how the store receives actions from the dispatcher. * All state mutation logic must be done during this method. */ - __onDispatch(payload: Object): void; + __onDispatch(payload: any): void; } } From 848b9d84676b802a37e6d0d9dca226780c9f311c Mon Sep 17 00:00:00 2001 From: gcroteau Date: Tue, 24 Nov 2015 19:52:59 -0500 Subject: [PATCH 152/389] Completed the Measurement definitions. --- turf/turf-test.ts | 157 ++++++++++++++++++++++++++++++++++++++++++---- turf/turf.d.ts | 135 ++++++++++++++++++++++++++++++++------- 2 files changed, 259 insertions(+), 33 deletions(-) diff --git a/turf/turf-test.ts b/turf/turf-test.ts index 5d1a73a93..c248ebda1 100644 --- a/turf/turf-test.ts +++ b/turf/turf-test.ts @@ -71,6 +71,112 @@ var polygons = { ] }; +var polygon = { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Polygon", + "coordinates": [[ + [105.818939,21.004714], + [105.818939,21.061754], + [105.890007,21.061754], + [105.890007,21.004714], + [105.818939,21.004714] + ]] + } +}; + +var features = { + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [-97.522259, 35.4691] + } + }, { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [-97.502754, 35.463455] + } + }, { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [-97.508269, 35.463245] + } + }, { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [-97.516809, 35.465779] + } + }, { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [-97.515372, 35.467072] + } + }, { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [-97.509363, 35.463053] + } + }, { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [-97.511123, 35.466601] + } + }, { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [-97.518547, 35.469327] + } + }, { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [-97.519706, 35.469659] + } + }, { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [-97.517839, 35.466998] + } + }, { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [-97.508678, 35.464942] + } + }, { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [-97.514914, 35.463453] + } + } + ] +}; + ////////////////////////////////////////////////////////////////////////// // Tests Aggregation ////////////////////////////////////////////////////////////////////////// @@ -82,18 +188,53 @@ var polygons = { // -- Test along -- var along = turf.along(line, 1, 'miles'); -var result = { - "type": "FeatureCollection", - "features": [line, along] -}; - // -- Test area -- var area = turf.area(polygons); +// -- Test bboxPolygon -- +var bbox = [0, 0, 10, 10]; +var poly = turf.bboxPolygon(bbox); + +// -- Test bearing -- +var bearing = turf.bearing(point1, point2); + +// -- Test center +var centerPt = turf.center(features); + +// -- Test centroid -- +var centroidPt = turf.centroid(poly); + +// -- Test destination -- +var distance = 50; +var bearing = 90; +var units = 'miles'; +var destination = turf.destination(point1, distance, bearing, units); + // -- Test distance -- var units = "miles"; var distance = turf.distance(point1, point2, units); +// -- Test envelope -- +var enveloped = turf.envelope(polygons); + +// -- Test extent -- +var bbox = turf.extent(polygons); + +// -- Test lineDistance +var length = turf.lineDistance(line, 'miles'); + +// -- Test midpoint -- +var midpointed = turf.midpoint(point1, point2); + +// -- Test pointOnSurface -- +var pointOnPolygon = turf.pointOnSurface(polygon); + +// -- Test size -- +var resized = turf.size(bbox, 2); + +// -- Test square -- +var squared = turf.square(bbox); + ////////////////////////////////////////////////////////////////////////// // Tests Transformation ////////////////////////////////////////////////////////////////////////// @@ -104,12 +245,6 @@ var distance = turf.distance(point1, point2, units); // -- Test pointOnLine -- var snapped = turf.pointOnLine(line, point1); -snapped.properties['marker-color'] = '#00f' - -result = { - "type": "FeatureCollection", - "features": [line, point1, snapped] -}; ////////////////////////////////////////////////////////////////////////// // Tests Helper diff --git a/turf/turf.d.ts b/turf/turf.d.ts index 15e9478db..2b0c69c13 100644 --- a/turf/turf.d.ts +++ b/turf/turf.d.ts @@ -6,13 +6,13 @@ /// declare module turf { - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////// // Aggregation - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////// // Measurement - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////// /** * Takes a line and returns a point at a specified distance along the line. @@ -29,7 +29,46 @@ declare module turf { * @returns Area in square meters */ function area(input: GeoJSON.Feature | GeoJSON.FeatureCollection): number; - + + /** + * Takes a bbox and returns an equivalent polygon. + * @param bbox An Array of bounding box coordinates in the form: [xLow, yLow, xHigh, yHigh] + * @returns A Polygon representation of the bounding box + */ + function bboxPolygon(bbox: Array): GeoJSON.Feature; + + /** + * Takes two points and finds the geographic bearing between them. + * @param start Starting Point + * @param end Ending point + * @returns Bearing in decimal degrees + */ + function bearing(start: GeoJSON.Feature, end: GeoJSON.Feature): number; + + /** + * Takes a FeatureCollection and returns the absolute center point of all features. + * @param features Input features + * @returns A Point feature at the absolute center point of all input features + */ + function center(features: GeoJSON.FeatureCollection): GeoJSON.Feature; + + /** + * Takes one or more features and calculates the centroid using the arithmetic mean of all vertices. This lessens the effect of small islands and artifacts when calculating the centroid of a set of polygons. + * @param features Input features + * @returns The centroid of the input features + */ + function centroid(features: GeoJSON.Feature | GeoJSON.FeatureCollection): GeoJSON.Feature; + + /** + * Takes a Point and calculates the location of a destination point given a distance in degrees, radians, miles, or kilometers; and bearing in degrees. This uses the Haversine formula to account for global curvature. + * @param start Starting point + * @param distance Distance from the starting point + * @param bearing Ranging from -180 and 180 + * @param units Miles, kilometers, degrees or radians + * @returns Destination point + */ + function destination(start: GeoJSON.Feature, distance: number, bearing: number, units: string): GeoJSON.Feature; + /** * Calculates the distance between two points in degress, radians, miles, or kilometers. This uses the Haversine formula to account for global curvature. * @param from Origin point @@ -39,13 +78,65 @@ declare module turf { */ function distance(from: GeoJSON.Feature, to: GeoJSON.Feature, units?: string): number; - ////////////////////////////////////////////////////////////////////////// - // Transformation - ////////////////////////////////////////////////////////////////////////// + /** + * Takes any number of features and returns a rectangular Polygon that encompasses all vertices. + * @param fc Input features + * @returns A rectangular Polygon feature that encompasses all vertices + */ + function envelope(fc: GeoJSON.FeatureCollection): GeoJSON.Feature; - ////////////////////////////////////////////////////////////////////////// + /** + * Takes a set of features, calculates the extent of all input features, and returns a bounding box. + * @param input Input features + * @returns The bounding box of input given as an array in WSEN order (west, south, east, north) + */ + function extent(input: GeoJSON.Feature | GeoJSON.FeatureCollection): Array; + + /** + * Takes a line and measures its length in the specified units. + * @param line Line to measure + * @param units Can be degrees, radians, miles, or kilometers + * @returns Length of the input line + */ + function lineDistance(line: GeoJSON.Feature, units: string): number; + + /** + * Takes two points and returns a point midway between them. + * @param pt1 First point + * @param pt2 Second point + * @returns A point midway between pt1 and pt2 + */ + function midpoint(pt1: GeoJSON.Feature, pt2: GeoJSON.Feature): GeoJSON.Feature; + + /** + * Takes a feature and returns a Point guaranteed to be on the surface of the feature. Given a Polygon, the point will be in the area of the polygon. Given a LineString, the point will be along the string. Given a Point, the point will the same as the input. + * @param input Any feature or set of features + * @returns A point on the surface of input + */ + function pointOnSurface(input: GeoJSON.Feature | GeoJSON.FeatureCollection): GeoJSON.Feature; + + /** + * Takes a bounding box and returns a new bounding box with a size expanded or contracted by a factor of X. + * @param bbox A bounding box + * @param factor The ratio of the new bbox to the input bbox + * @returns The resized bbox + */ + function size(bbox: Array, factor: number): Array; + + /** + * Takes a bounding box and calculates the minimum square bounding box that would contain the input. + * @param bbox A bounding box + * @returns A square surrounding bbox + */ + function square(bbox: Array): Array; + + ////////////////////////////////////////////////////// + // Transformation + ////////////////////////////////////////////////////// + + ////////////////////////////////////////////////////// // Misc - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////// /** * Takes a Point and a LineString and calculates the closest Point on the LineString. @@ -55,27 +146,27 @@ declare module turf { */ function pointOnLine(line: GeoJSON.Feature, point: GeoJSON.Feature): GeoJSON.Feature; - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////// // Helper - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////// // Data - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////// // Interpolation - //////////////////////////////////////////////////////////////////////////; + ////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////// // Joins - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////// // Classification - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////// // Types - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////// } From 01f5b8f246217b8fdf44131b74eb78284f84b35c Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Wed, 25 Nov 2015 03:00:46 +0200 Subject: [PATCH 153/389] Store called and moved to cosnt. --- flux/flux-tests.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/flux/flux-tests.ts b/flux/flux-tests.ts index 0fe6e13d1..4c83c8e1c 100644 --- a/flux/flux-tests.ts +++ b/flux/flux-tests.ts @@ -107,15 +107,18 @@ class CounterStore extends FluxUtils.ReduceStore { } } +var Disaptcher: any; +const Store = new CounterStore(Dispatcher); + // Sample Flux container with CounterStore class CounterContainer extends Component { static getStores() { - return [CounterStore]; + return [Store]; } static calculateState(prevState: any) { return { - counter: CounterStore.getState(), + counter: Store.getState(), }; } From 3201084d33a46cdc09aadee5ea2085f8010fae70 Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Wed, 25 Nov 2015 03:02:37 +0200 Subject: [PATCH 154/389] Fixed mistype --- flux/flux-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flux/flux-tests.ts b/flux/flux-tests.ts index 4c83c8e1c..d4f4f5510 100644 --- a/flux/flux-tests.ts +++ b/flux/flux-tests.ts @@ -108,7 +108,7 @@ class CounterStore extends FluxUtils.ReduceStore { } var Disaptcher: any; -const Store = new CounterStore(Dispatcher); +const Store = new CounterStore(Disaptcher); // Sample Flux container with CounterStore class CounterContainer extends Component { From 06911fd64b6f30fff878c1f2f240c4e304644a7e Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Wed, 25 Nov 2015 03:08:28 +0200 Subject: [PATCH 155/389] Changed to use basicDispatcher in Store. --- flux/flux-tests.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/flux/flux-tests.ts b/flux/flux-tests.ts index d4f4f5510..24369ef2d 100644 --- a/flux/flux-tests.ts +++ b/flux/flux-tests.ts @@ -107,8 +107,7 @@ class CounterStore extends FluxUtils.ReduceStore { } } -var Disaptcher: any; -const Store = new CounterStore(Disaptcher); +const Store = new CounterStore(basicDispatcher); // Sample Flux container with CounterStore class CounterContainer extends Component { From bbc2af3a3fc34fb1c64d0596cb8c5f2be7f493b7 Mon Sep 17 00:00:00 2001 From: gcroteau Date: Tue, 24 Nov 2015 20:22:20 -0500 Subject: [PATCH 156/389] Completed the Transformation definitions. --- turf/turf-test.ts | 52 ++++++++++++++++++++++++++++-- turf/turf.d.ts | 82 ++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 128 insertions(+), 6 deletions(-) diff --git a/turf/turf-test.ts b/turf/turf-test.ts index c248ebda1..85b2c7b9a 100644 --- a/turf/turf-test.ts +++ b/turf/turf-test.ts @@ -71,7 +71,7 @@ var polygons = { ] }; -var polygon = { +var polygon1 = { "type": "Feature", "properties": {}, "geometry": { @@ -86,6 +86,26 @@ var polygon = { } }; +var polygon2 = { + "type": "Feature", + "properties": { + "fill": "#00f" + }, + "geometry": { + "type": "Polygon", + "coordinates": [[ + [-122.520217, 45.535693], + [-122.64038, 45.553967], + [-122.720031, 45.526554], + [-122.669906, 45.507309], + [-122.723464, 45.446643], + [-122.532577, 45.408574], + [-122.487258, 45.477466], + [-122.520217, 45.535693] + ]] + } +} + var features = { "type": "FeatureCollection", "features": [ @@ -227,7 +247,7 @@ var length = turf.lineDistance(line, 'miles'); var midpointed = turf.midpoint(point1, point2); // -- Test pointOnSurface -- -var pointOnPolygon = turf.pointOnSurface(polygon); +var pointOnPolygon = turf.pointOnSurface(polygon1); // -- Test size -- var resized = turf.size(bbox, 2); @@ -239,6 +259,34 @@ var squared = turf.square(bbox); // Tests Transformation ////////////////////////////////////////////////////////////////////////// +// -- Test bezier -- +var curved = turf.bezier(line); + +// -- Test buffer -- +var buffered = turf.buffer(point1, 500, units); + +// -- Test concave -- +var hull = turf.concave(features, 1, 'miles'); + +// -- Test convex -- +var hull = turf.convex(features); + +// -- Test difference -- +var differenced = turf.difference(polygon1, polygon2); + +// -- Test intersect -- +var intersection = turf.intersect(polygon1, polygon2); + +// -- Test merge -- +var merged = turf.merge(polygons); + +// -- Test simplify -- +var tolerance = 0.01; +var simplified = turf.simplify(polygon1, tolerance, false); + +// -- Test union -- +var union = turf.union(polygon1, polygon2); + ////////////////////////////////////////////////////////////////////////// // Tests Misc ////////////////////////////////////////////////////////////////////////// diff --git a/turf/turf.d.ts b/turf/turf.d.ts index 2b0c69c13..77bba0c74 100644 --- a/turf/turf.d.ts +++ b/turf/turf.d.ts @@ -18,7 +18,7 @@ declare module turf { * Takes a line and returns a point at a specified distance along the line. * @param line Input line * @param distance Distance along the line - * @param [units=miles] Can be degrees, radians, miles, or kilometers. Default is miles + * @param [units=miles] 'miles', 'feet', 'kilometers', 'meters', or 'degrees' * @returns Point along the line */ function along(line: GeoJSON.Feature, distance: number, units?: string): GeoJSON.Feature; @@ -64,7 +64,7 @@ declare module turf { * @param start Starting point * @param distance Distance from the starting point * @param bearing Ranging from -180 and 180 - * @param units Miles, kilometers, degrees or radians + * @param units 'miles', 'feet', 'kilometers', 'meters', or 'degrees' * @returns Destination point */ function destination(start: GeoJSON.Feature, distance: number, bearing: number, units: string): GeoJSON.Feature; @@ -73,7 +73,7 @@ declare module turf { * Calculates the distance between two points in degress, radians, miles, or kilometers. This uses the Haversine formula to account for global curvature. * @param from Origin point * @param to Destination point - * @param [units=kilometers] Can be degrees, radians, miles, or kilometers. Default is kilometers. + * @param [units=kilometers] 'miles', 'feet', 'kilometers', 'meters', or 'degrees' * @returns Distance between the two points */ function distance(from: GeoJSON.Feature, to: GeoJSON.Feature, units?: string): number; @@ -95,7 +95,7 @@ declare module turf { /** * Takes a line and measures its length in the specified units. * @param line Line to measure - * @param units Can be degrees, radians, miles, or kilometers + * @param units 'miles', 'feet', 'kilometers', 'meters', or 'degrees' * @returns Length of the input line */ function lineDistance(line: GeoJSON.Feature, units: string): number; @@ -134,6 +134,80 @@ declare module turf { // Transformation ////////////////////////////////////////////////////// + /** + * Takes a line and returns a curved version by applying a Bezier spline algorithm. The bezier spline implementation is by Leszek Rybicki. + * @param line Input LineString + * @param [resolution=10000] Time in milliseconds between points + * @param [sharpness=0.85] A measure of how curvy the path should be between splines + * @returns Curved line + */ + function bezier(line: GeoJSON.Feature, resolution?: number, sharpness?: number): GeoJSON.Feature; + + /** + * Calculates a buffer for input features for a given radius. Units supported are miles, kilometers, and degrees. + * @param feature Input to be buffered + * @param distance Distance to draw the buffer + * @param units 'miles', 'feet', 'kilometers', 'meters', or 'degrees' + * @returns Buffered features + */ + function buffer(feature: GeoJSON.Feature | GeoJSON.FeatureCollection, distance: number, units: string): GeoJSON.Feature | GeoJSON.FeatureCollection; + + /** + * Takes a set of points and returns a concave hull polygon. Internally, this implements a Monotone chain algorithm. + * @param points Input points + * @param maxEdge The size of an edge necessary for part of the hull to become concave (in miles) + * @param units Used for maxEdge distance (miles or kilometers) + * @returns A concave hull + */ + function concave(points: GeoJSON.FeatureCollection, maxEdge: number, units: string): GeoJSON.Feature; + + /** + * Takes a set of points and returns a convex hull polygon. Internally this uses the convex-hull module that implements a monotone chain hull. + * @param input Input points + * @returns A convex hull + */ + function convex(points: GeoJSON.FeatureCollection): GeoJSON.Feature; + + /** + * Finds the difference between two polygons by clipping the second polygon from the first. + * @param poly1 Input Polygon feaure + * @param poly2 Polygon feature to difference from poly1 + * @returns A Polygon feature showing the area of poly1 excluding the area of poly2 + */ + function difference(poly1: GeoJSON.Feature, poly2: GeoJSON.Feature): GeoJSON.Feature; + + /** + * Takes two polygons and finds their intersection. If they share a border, returns the border; if they don't intersect, returns undefined. + * @param poly1 The first polygon + * @param poly2 The second polygon + * @returns If poly1 and poly2 overlap, returns a Polygon feature representing the area they overlap; if poly1 and poly2 do not overlap, returns undefined; if poly1 and poly2 share a border, a MultiLineString of the locations where their borders are shared + */ + function intersect(poly1: GeoJSON.Feature, poly2: GeoJSON.Feature): GeoJSON.Feature; + + /** + * Takes a set of polygons and returns a single merged polygon feature. If the input polygon features are not contiguous, this function returns a MultiPolygon feature. + * @param fc Input polygons + * @returns Merged polygon or multipolygon + */ + function merge(fc: GeoJSON.FeatureCollection): GeoJSON.Feature; + + /** + * Takes a LineString or Polygon and returns a simplified version. Internally uses simplify-js to perform simplification. + * @param feature Feature to be simplified + * @param tolerance Simplification tolerance + * @param highQuality Whether or not to spend more time to create a higher-quality simplification with a different algorithm + * @returns A simplified feature + */ + function simplify(feature: GeoJSON.Feature | GeoJSON.FeatureCollection | GeoJSON.GeometryCollection, tolerance: number, highQuality: boolean): GeoJSON.Feature | GeoJSON.FeatureCollection | GeoJSON.GeometryCollection; + + /** + * Takes two polygons and returns a combined polygon. If the input polygons are not contiguous, this function returns a MultiPolygon feature. + * @param poly1 Input polygon + * @param poly2 Another input polygon + * @returns A combined Polygon or MultiPolygon feature + */ + function union(poly1: GeoJSON.Feature, poly2: GeoJSON.Feature): GeoJSON.Feature; + ////////////////////////////////////////////////////// // Misc ////////////////////////////////////////////////////// From ba1ba6fdeb2d2c17b153589f9374fedba54cfa3e Mon Sep 17 00:00:00 2001 From: Andrew Fong Date: Wed, 25 Nov 2015 02:05:27 +0000 Subject: [PATCH 157/389] Individual chart options may also override global options --- chartjs/chart-tests.ts | 31 ++++++++++++++- chartjs/chart.d.ts | 88 +++++++++++++++++++++--------------------- 2 files changed, 74 insertions(+), 45 deletions(-) diff --git a/chartjs/chart-tests.ts b/chartjs/chart-tests.ts index 4bd8820c6..452ddbf62 100644 --- a/chartjs/chart-tests.ts +++ b/chartjs/chart-tests.ts @@ -325,7 +325,7 @@ var myDoughnutChart = new Chart(ctx).Doughnut(pieData, { animateRotate: true, animateScale: false, legendTemplate: "
      -legend\"><% for (var i=0; i
    • \"><%if(segments[i].label){%><%=segments[i].label%><%}%>
    • <%}%>
    " -}); +}); var myDoughnutChartLegend: string = myDoughnutChart.generateLegend(); var myDoughnutChartImage: string = myDoughnutChart.toBase64Image(); @@ -341,3 +341,32 @@ myDoughnutChart.resize(); myDoughnutChart.update(); myDoughnutChart.stop(); myDoughnutChart.destroy(); + +// Test using charts with overrides of a subset of global options +var partialOpts: ChartSettings = { + showTooltips: true, + tooltipEvents: ["mousemove", "touchstart", "touchmove"], + tooltipFillColor: "rgba(0,0,0,0.8)", + tooltipFontFamily: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif", + tooltipFontSize: 14, + tooltipFontStyle: "normal", + tooltipFontColor: "#fff", + tooltipTitleFontFamily: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif", + tooltipTitleFontSize: 14, + tooltipTitleFontStyle: "bold", + tooltipTitleFontColor: "#fff", + tooltipYPadding: 6, + tooltipXPadding: 6, + tooltipCaretSize: 8, + tooltipCornerRadius: 6, + tooltipXOffset: 10, + tooltipTemplate: "<%if (label){%><%=label%>: <%}%><%= value %>" +}; + +var my2ndLineChart = new Chart(ctx).Line(lineData, partialOpts); +var my2ndBarChart = new Chart(ctx).Bar(barData, partialOpts); +var my2ndRadarChart = new Chart(ctx).Radar(radarData, partialOpts); +var my2ndPolarAreaChart = new Chart(ctx).PolarArea(polarAreaData, partialOpts); +var my2ndPieChart = new Chart(ctx).Pie(pieData, partialOpts); +var my2ndDoughnutChart = new Chart(ctx).Doughnut(pieData, partialOpts); + diff --git a/chartjs/chart.d.ts b/chartjs/chart.d.ts index d337d144a..62f393b8a 100644 --- a/chartjs/chart.d.ts +++ b/chartjs/chart.d.ts @@ -33,49 +33,49 @@ interface CircularChartData { } interface ChartSettings { - animation: boolean; - animationSteps: number; - animationEasing: string; - showScale: boolean; - scaleOverride: boolean; - scaleSteps: number; - scaleStepWidth: number; - scaleStartValue: number; - scaleLineColor: string; - scaleLineWidth: number; - scaleShowLabels: boolean; - scaleLabel: string; - scaleIntegersOnly: boolean; - scaleBeginAtZero: boolean; - scaleFontFamily: string; - scaleFontSize: number; - scaleFontStyle: string; - scaleFontColor: string; - responsive: boolean; - maintainAspectRatio: boolean; - showTooltips: boolean; - tooltipEvents: string[]; - tooltipFillColor: string; - tooltipFontFamily: string; - tooltipFontSize: number; - tooltipFontStyle: string; - tooltipFontColor: string; - tooltipTitleFontFamily: string; - tooltipTitleFontSize: number; - tooltipTitleFontStyle: string; - tooltipTitleFontColor: string; - tooltipYPadding: number; - tooltipXPadding: number; - tooltipCaretSize: number; - tooltipCornerRadius: number; - tooltipXOffset: number; - tooltipTemplate: string; - multiTooltipTemplate: string; - onAnimationProgress: () => any; - onAnimationComplete: () => any; + animation?: boolean; + animationSteps?: number; + animationEasing?: string; + showScale?: boolean; + scaleOverride?: boolean; + scaleSteps?: number; + scaleStepWidth?: number; + scaleStartValue?: number; + scaleLineColor?: string; + scaleLineWidth?: number; + scaleShowLabels?: boolean; + scaleLabel?: string; + scaleIntegersOnly?: boolean; + scaleBeginAtZero?: boolean; + scaleFontFamily?: string; + scaleFontSize?: number; + scaleFontStyle?: string; + scaleFontColor?: string; + responsive?: boolean; + maintainAspectRatio?: boolean; + showTooltips?: boolean; + tooltipEvents?: string[]; + tooltipFillColor?: string; + tooltipFontFamily?: string; + tooltipFontSize?: number; + tooltipFontStyle?: string; + tooltipFontColor?: string; + tooltipTitleFontFamily?: string; + tooltipTitleFontSize?: number; + tooltipTitleFontStyle?: string; + tooltipTitleFontColor?: string; + tooltipYPadding?: number; + tooltipXPadding?: number; + tooltipCaretSize?: number; + tooltipCornerRadius?: number; + tooltipXOffset?: number; + tooltipTemplate?: string; + multiTooltipTemplate?: string; + onAnimationProgress?: () => any; + onAnimationComplete?: () => any; } -interface ChartOptions { +interface ChartOptions extends ChartSettings { scaleShowGridLines?: boolean; scaleGridLineColor?: string; scaleGridLineWidth?: number; @@ -138,7 +138,7 @@ interface BarChartOptions extends ChartOptions { barDatasetSpacing?: number; } -interface RadarChartOptions { +interface RadarChartOptions extends ChartSettings { scaleShowLine?: boolean; angleShowLineOut?: boolean; scaleShowLabels?: boolean; @@ -159,7 +159,7 @@ interface RadarChartOptions { legendTemplate?: string; } -interface PolarAreaChartOptions { +interface PolarAreaChartOptions extends ChartSettings { scaleShowLabelBackdrop?: boolean; scaleBackdropColor?: string; scaleBeginAtZero?: boolean; @@ -176,7 +176,7 @@ interface PolarAreaChartOptions { legendTemplate?: string; } -interface PieChartOptions { +interface PieChartOptions extends ChartSettings { segmentShowStroke?: boolean; segmentStrokeColor?: string; segmentStrokeWidth?: number; From bd95f700d11867f1f18f1faaf6675906f5fa6c27 Mon Sep 17 00:00:00 2001 From: gcroteau Date: Tue, 24 Nov 2015 21:57:25 -0500 Subject: [PATCH 158/389] Completed the Misc definitions. --- turf/turf-test.ts | 17 ++++++++++++++++- turf/turf.d.ts | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/turf/turf-test.ts b/turf/turf-test.ts index 85b2c7b9a..b053e761e 100644 --- a/turf/turf-test.ts +++ b/turf/turf-test.ts @@ -222,7 +222,7 @@ var bearing = turf.bearing(point1, point2); var centerPt = turf.center(features); // -- Test centroid -- -var centroidPt = turf.centroid(poly); +var centroidPt = turf.centroid(polygon1); // -- Test destination -- var distance = 50; @@ -291,6 +291,21 @@ var union = turf.union(polygon1, polygon2); // Tests Misc ////////////////////////////////////////////////////////////////////////// +// -- Test combine -- +var combined = turf.combine(features); + +// -- Test explode -- +var points = turf.explode(polygon1); + +// -- Test flip -- +var flipedPoint = turf.flip(point1); + +// -- Test kinks -- +var kinks = turf.kinks(polygon1); + +// -- Test lineSlice -- +var sliced = turf.lineSlice(point1, point2, line); + // -- Test pointOnLine -- var snapped = turf.pointOnLine(line, point1); diff --git a/turf/turf.d.ts b/turf/turf.d.ts index 77bba0c74..fb479ae34 100644 --- a/turf/turf.d.ts +++ b/turf/turf.d.ts @@ -212,6 +212,43 @@ declare module turf { // Misc ////////////////////////////////////////////////////// + /** + * Combines a FeatureCollection of Point, LineString, or Polygon features into MultiPoint, MultiLineString, or MultiPolygon features. + * @param fc A FeatureCollection of any type + * @returns A FeatureCollection of corresponding type to input + */ + function combine(fc: GeoJSON.FeatureCollection): GeoJSON.FeatureCollection; + + /** + * Takes a feature or set of features and returns all positions as points. + * @param input Input features + * @returns Points representing the exploded input features + */ + function explode(input: GeoJSON.Feature | GeoJSON.FeatureCollection): GeoJSON.FeatureCollection; + + /** + * Takes input features and flips all of their coordinates from [x, y] to [y, x]. + * @param input Input features + * @returns A feature or set of features of the same type as input with flipped coordinates + */ + function flip(input: GeoJSON.Feature | GeoJSON.FeatureCollection): GeoJSON.Feature | GeoJSON.FeatureCollection; + + /** + * Takes a polygon and returns points at all self-intersections. + * @param polygon Input polygon + * @returns Self-intersections + */ + function kinks(polygon: GeoJSON.Feature): GeoJSON.FeatureCollection; + + /** + * Takes a line, a start Point, and a stop point and returns the line in between those points. + * @param point1 Starting point + * @param point2 Stopping point + * @param line Line to slice + * @returns Sliced line + */ + function lineSlice(point1: GeoJSON.Feature, point2: GeoJSON.Feature, line: GeoJSON.Feature): GeoJSON.Feature; + /** * Takes a Point and a LineString and calculates the closest Point on the LineString. * @param line Line to snap to From 4d5969f17cd9411d5bf5d87eba035ecd012a48d2 Mon Sep 17 00:00:00 2001 From: gcroteau Date: Tue, 24 Nov 2015 22:47:30 -0500 Subject: [PATCH 159/389] Completed the Helper definitions. --- turf/turf-test.ts | 30 ++++++++++++++++++++++++++++++ turf/turf.d.ts | 31 +++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/turf/turf-test.ts b/turf/turf-test.ts index b053e761e..296542868 100644 --- a/turf/turf-test.ts +++ b/turf/turf-test.ts @@ -313,6 +313,36 @@ var snapped = turf.pointOnLine(line, point1); // Tests Helper ////////////////////////////////////////////////////////////////////////// +// -- Test featurecollection -- +var fc = turf.featurecollection([point1, point2]); + +// -- Test linestring -- +var linestring1 = turf.linestring([ + [-21.964416, 64.148203], + [-21.956176, 64.141316], + [-21.93901, 64.135924], + [-21.927337, 64.136673] +]); +var linestring2 = turf.linestring([ + [-21.929054, 64.127985], + [-21.912918, 64.134726], + [-21.916007, 64.141016], + [-21.930084, 64.14446] +], {name: 'line 1', distance: 145}); + +// -- Test point -- +var pt1 = turf.point([-75.343, 39.984]); +var pt2 = turf.point([-75.343, 39.984], {name: 'point 1', distance: 145}); + +// -- Test polygon -- +var polygon = turf.polygon([[ + [-2.275543, 53.464547], + [-2.275543, 53.489271], + [-2.215118, 53.489271], + [-2.215118, 53.464547], + [-2.275543, 53.464547] +]], { name: 'poly1', population: 400}); + ////////////////////////////////////////////////////////////////////////// // Tests Data ////////////////////////////////////////////////////////////////////////// diff --git a/turf/turf.d.ts b/turf/turf.d.ts index fb479ae34..0f6868630 100644 --- a/turf/turf.d.ts +++ b/turf/turf.d.ts @@ -261,6 +261,37 @@ declare module turf { // Helper ////////////////////////////////////////////////////// + /** + * Takes one or more Features and creates a FeatureCollection. + * @param features Input features + * @returns A FeatureCollection of input features + */ + function featurecollection(features: Array): GeoJSON.FeatureCollection; + + /** + * Creates a LineString based on a coordinate array. Properties can be added optionally. + * @param coordinates An array of Positions + * @param [properties] An Object of key-value pairs to add as properties + * @returns A LineString feature + */ + function linestring(coordinates: Array>, properties?: any): GeoJSON.Feature; + + /** + * Takes coordinates and properties (optional) and returns a new Point feature. + * @param coordinates Longitude, latitude position (each in decimal degrees) + * @param [properties] An Object of key-value pairs to add as properties + * @returns A Point feature + */ + function point(coordinates: Array, properties?: any): GeoJSON.Feature; + + /** + * Takes an array of LinearRings and optionally an Object with properties and returns a Polygon feature. + * @param rings An array of LinearRings + * @param [properties] An Object of key-value pairs to add as properties + * @returns A Polygon feature + */ + function polygon(rings: Array>>, properties?: any): GeoJSON.Feature; + ////////////////////////////////////////////////////// // Data ////////////////////////////////////////////////////// From b5b7ec2ce07a810c2d19a111196e2753197e733e Mon Sep 17 00:00:00 2001 From: gcroteau Date: Tue, 24 Nov 2015 23:44:45 -0500 Subject: [PATCH 160/389] Added filter definition. --- turf/turf-test.ts | 5 +++++ turf/turf.d.ts | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/turf/turf-test.ts b/turf/turf-test.ts index 296542868..4d89f140e 100644 --- a/turf/turf-test.ts +++ b/turf/turf-test.ts @@ -347,6 +347,11 @@ var polygon = turf.polygon([[ // Tests Data ////////////////////////////////////////////////////////////////////////// +// -- Test filter -- +var key = "species"; +var value = "oak"; +var filtered = turf.filter(features, key, value); + ////////////////////////////////////////////////////////////////////////// // Tests Interpolation //////////////////////////////////////////////////////////////////////////; diff --git a/turf/turf.d.ts b/turf/turf.d.ts index 0f6868630..85d7b25f9 100644 --- a/turf/turf.d.ts +++ b/turf/turf.d.ts @@ -296,6 +296,15 @@ declare module turf { // Data ////////////////////////////////////////////////////// + /** + * Takes a FeatureCollection and filters it by a given property and value. + * @param features Input features + * @param key The property on which to filter + * @param value The value of that property on which to filter + * @returns A filtered collection with only features that match input key and value + */ + function filter(features: GeoJSON.FeatureCollection, key: string, value: string): GeoJSON.FeatureCollection; + ////////////////////////////////////////////////////// // Interpolation ////////////////////////////////////////////////////// From dcefa9ec84b7fb0ae4776310cf21e7d019b5a9de Mon Sep 17 00:00:00 2001 From: Mehrdad Reshadi Date: Tue, 24 Nov 2015 21:21:11 -0800 Subject: [PATCH 161/389] added missing types for jakejs --- jake/jake.d.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/jake/jake.d.ts b/jake/jake.d.ts index 1812b818b..95614374c 100644 --- a/jake/jake.d.ts +++ b/jake/jake.d.ts @@ -40,6 +40,16 @@ declare function fail(...err:any[]): void; */ declare function file(name:string, prereqs?:string[], action?:()=>void, opts?:jake.FileTaskOptions): jake.FileTask; +/** + * Creates Jake FileTask from regex patterns + * @name name/pattern of the Task + * @param source calculated from the name pattern + * @param prereqs Prerequisites to be run before this task + * @param action The action to perform for this task + * @param opts Perform this task asynchronously. If you flag a task with this option, you must call the global `complete` method inside the task's action, for execution to proceed to the next task. + */ +declare function rule(pattern: RegExp, source: string | { (name: string): string; }, prereqs?: string[], action?: () => void, opts?: jake.TaskOptions): void; + /** * Creates a namespace which allows logical grouping of tasks, and prevents name-collisions with task-names. Namespaces can be nested inside of other namespaces. * @param name The name of the namespace @@ -185,6 +195,11 @@ declare module jake{ * @default false */ async?: boolean; + + /** + * number of parllel async tasks + */ + parallelLimit?: number; } /** From 4b6d9d687d59b7099efa50b8b128b91581981b8e Mon Sep 17 00:00:00 2001 From: Denis Sokolov Date: Wed, 25 Nov 2015 11:07:18 +0200 Subject: [PATCH 162/389] Simplify scripts in package.json npm already puts the directory in question in PATH --- package.json | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 2b9d019f8..f20ff96cf 100644 --- a/package.json +++ b/package.json @@ -20,17 +20,17 @@ "node": ">= 0.12.0" }, "scripts": { - "test": "./node_modules/.bin/dt --changes", - "changes": "./node_modules/.bin/dt --changes", - "lint": "./node_modules/.bin/dt --lint", - "tscparams": "./node_modules/.bin/dt --tscparams --no-tests --no-headers", - "all": "./node_modules/.bin/dt", - "dry": "./node_modules/.bin/dt --dry --changes", - "list": "./node_modules/.bin/dt --dry --print-files --print-refmap", - "last": "./node_modules/.bin/dt --dry --print-files --print-refmap --changes", - "files": "./node_modules/.bin/dt --dry --print-files", - "refmap": "./node_modules/.bin/dt --dry --print-refmap", - "help": "./node_modules/.bin/dt -h" + "test": "dt --changes", + "changes": "dt --changes", + "lint": "dt --lint", + "tscparams": "dt --tscparams --no-tests --no-headers", + "all": "dt", + "dry": "dt --dry --changes", + "list": "dt --dry --print-files --print-refmap", + "last": "dt --dry --print-files --print-refmap --changes", + "files": "dt --dry --print-files", + "refmap": "dt --dry --print-refmap", + "help": "dt -h" }, "dependencies": { }, From 53e93bf70a34ea14ca718a82bc68dec7386e081a Mon Sep 17 00:00:00 2001 From: "Remo H. Jansen" Date: Wed, 25 Nov 2015 09:40:03 +0000 Subject: [PATCH 163/389] Added Q.race method. This method was missing from the type definitions file. --- q/Q.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/q/Q.d.ts b/q/Q.d.ts index 50ee49c52..ba30b2745 100644 --- a/q/Q.d.ts +++ b/q/Q.d.ts @@ -206,6 +206,11 @@ declare module Q { * Returns a promise that is fulfilled with an array containing the fulfillment value of each promise, or is rejected with the same rejection reason as the first promise to be rejected. */ export function all(promises: IPromise[]): Promise; + + /** + * Returns a promise for the first of an array of promises to become settled. + */ + export function race(promises: IPromise[]): Promise; /** * Returns a promise that is fulfilled with an array of promise state snapshots, but only after all the original promises have settled, i.e. become either fulfilled or rejected. From 84a38034f75c85cd3951e94c0165b360ad8680ae Mon Sep 17 00:00:00 2001 From: Jan Vorwerk Date: Wed, 25 Nov 2015 11:46:30 +0100 Subject: [PATCH 164/389] add empty namespace declaration for gulp-uglify to allow es6 imports (see /Microsoft/TypeScript/issues/5073) --- gulp-uglify/gulp-uglify.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gulp-uglify/gulp-uglify.d.ts b/gulp-uglify/gulp-uglify.d.ts index 840b5110b..05eb937ed 100644 --- a/gulp-uglify/gulp-uglify.d.ts +++ b/gulp-uglify/gulp-uglify.d.ts @@ -170,6 +170,6 @@ declare module "gulp-uglify" { */ comments_before: string[]; } - + namespace GulpUglify {} export = GulpUglify; -} \ No newline at end of file +} From c6820e3980f977031e2ed05456ab3f0eb0bffbe9 Mon Sep 17 00:00:00 2001 From: Paldom Date: Wed, 25 Nov 2015 13:35:58 +0100 Subject: [PATCH 165/389] expiresInMinutes is deprecated, use expiresIn instead --- jsonwebtoken/jsonwebtoken.d.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/jsonwebtoken/jsonwebtoken.d.ts b/jsonwebtoken/jsonwebtoken.d.ts index 205970f6a..bb74aa853 100644 --- a/jsonwebtoken/jsonwebtoken.d.ts +++ b/jsonwebtoken/jsonwebtoken.d.ts @@ -22,8 +22,13 @@ declare module "jsonwebtoken" { * - none: No digital signature or MAC value included */ algorithm?: string; - /** @member {number} - Lifetime for the token in minutes */ + /** + *@deprecated - see expiresIn + *@member {number} - Lifetime for the token in minutes + */ expiresInMinutes?: number; + /** @member {string} - Lifetime for the token expressed in a string describing a time span [rauchg/ms](https://github.com/rauchg/ms.js). Eg: `60`, `"2 days"`, `"10h"`, `"7d"` */ + expiresIn?: string; audience?: string; subject?: string; issuer?: string; @@ -33,6 +38,7 @@ declare module "jsonwebtoken" { export interface VerifyOptions { audience?: string; issuer?: string; + maxAge?: string; } export interface VerifyCallbak { From 1000b2c823ef215653d60d0a2f66dd9b4c38f183 Mon Sep 17 00:00:00 2001 From: dencap Date: Wed, 25 Nov 2015 17:18:44 +0100 Subject: [PATCH 166/389] First draft of definition for pako --- pako/pako-tests.ts | 26 ++++++++++++++++++++ pako/pako.d.ts | 60 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 pako/pako-tests.ts create mode 100644 pako/pako.d.ts diff --git a/pako/pako-tests.ts b/pako/pako-tests.ts new file mode 100644 index 000000000..b7bb504ca --- /dev/null +++ b/pako/pako-tests.ts @@ -0,0 +1,26 @@ +/// + +import pako = require("pako"); + +var test = { my: 'super', puper: [456, 567], awesome: 'pako' }; + +var binaryString = pako.deflate(JSON.stringify(test), { to: 'string' }); + +// +// Here you can do base64 encode, make xhr requests and so on. +// + +var restored = JSON.parse(pako.inflate(binaryString, { to: 'string' })); + +var pako = require('pako') + , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9]) + , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]); + +var deflate = new pako.Deflate({ level: 3}); + +deflate.push(chunk1, false); +deflate.push(chunk2, true); // true -> last chunk + +if (deflate.err) { throw new Error(deflate.err); } + +console.log(deflate.result); \ No newline at end of file diff --git a/pako/pako.d.ts b/pako/pako.d.ts new file mode 100644 index 000000000..42465cee1 --- /dev/null +++ b/pako/pako.d.ts @@ -0,0 +1,60 @@ +// Type definitions for pako 0.2.8 +// Project: https://github.com/nodeca/pako +// Definitions by: Denis Cappellin +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module Pako { + + /** + * Compress data with deflate algorithm and options. + */ + export function deflate( data: Uint8Array | Array | string, options?: any ): string; + /** + * The same as deflate, but creates raw data, without wrapper (header and adler32 crc). + */ + export function deflateRaw( data: Uint8Array | Array | string, options?: any ): string; + /** + * The same as deflate, but create gzip wrapper instead of deflate one. + */ + export function gzip( data: Uint8Array | Array | string, options?: any ): string; + /** + * Decompress data with inflate/ungzip and options. Autodetect format via wrapper header + * by default. That's why we don't provide separate ungzip method. + */ + export function inflate( data: Uint8Array | Array | string, options?: any ): Uint8Array | Array | string; + /** + * The same as inflate, but creates raw data, without wrapper (header and adler32 crc). + */ + export function inflateRaw( data: Uint8Array | Array | string, options?: any ): Uint8Array | Array | string; + /** + * Just shortcut to inflate, because it autodetects format by header.content. Done for convenience. + */ + export function ungzip( data: Uint8Array | Array | string, options?: any ): Uint8Array | Array | string; + + export interface Deflate { + /** + * + */ + constructor( options?: any ); + err: number; + msg: string; + result: Uint8Array | Array; + onData( chunk: Uint8Array | Array | string ): void; + onEnd( status: number ): void; + push( data: Uint8Array | Array | ArrayBuffer | string, mode?: number | boolean ): boolean; + } + + export interface Inflate { + constructor( options?: any ); + err: number; + msg: string; + result: Uint8Array | Array | string; + onData( chunk: Uint8Array | Array | string ): void; + onEnd( status: number ): void; + push( data: Uint8Array | Array | ArrayBuffer | string, mode?: number | boolean ): boolean; + } +} + +declare module 'pako' { + export = Pako; +} From 82a3b88cdcf3d7832537020c33a30a1d90462e54 Mon Sep 17 00:00:00 2001 From: dencap Date: Wed, 25 Nov 2015 17:23:03 +0100 Subject: [PATCH 167/389] First draft of definition for pako --- pako/pako-tests.ts | 19 +++++-------------- pako/pako.d.ts | 19 +++++++++++-------- 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/pako/pako-tests.ts b/pako/pako-tests.ts index b7bb504ca..b364d971f 100644 --- a/pako/pako-tests.ts +++ b/pako/pako-tests.ts @@ -2,25 +2,16 @@ import pako = require("pako"); -var test = { my: 'super', puper: [456, 567], awesome: 'pako' }; - -var binaryString = pako.deflate(JSON.stringify(test), { to: 'string' }); - -// -// Here you can do base64 encode, make xhr requests and so on. -// - -var restored = JSON.parse(pako.inflate(binaryString, { to: 'string' })); - -var pako = require('pako') - , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9]) - , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]); +var chunk1 = new Uint8Array([1,2,3,4,5,6,7,8,9]) +var chunk2 = new Uint8Array([10,11,12,13,14,15,16,17,18,19]); var deflate = new pako.Deflate({ level: 3}); deflate.push(chunk1, false); deflate.push(chunk2, true); // true -> last chunk -if (deflate.err) { throw new Error(deflate.err); } +if (deflate.err) { + throw new Error( deflate.err.toString() ); +} console.log(deflate.result); \ No newline at end of file diff --git a/pako/pako.d.ts b/pako/pako.d.ts index 42465cee1..1b86f81fa 100644 --- a/pako/pako.d.ts +++ b/pako/pako.d.ts @@ -21,20 +21,23 @@ declare module Pako { * Decompress data with inflate/ungzip and options. Autodetect format via wrapper header * by default. That's why we don't provide separate ungzip method. */ - export function inflate( data: Uint8Array | Array | string, options?: any ): Uint8Array | Array | string; + export function inflate( data: Uint8Array | Array | string, options?: any ): Uint8Array; + export function inflate( data: Uint8Array | Array | string, options?: any ): Array; + export function inflate( data: Uint8Array | Array | string, options?: any ): String; /** * The same as inflate, but creates raw data, without wrapper (header and adler32 crc). */ - export function inflateRaw( data: Uint8Array | Array | string, options?: any ): Uint8Array | Array | string; + export function inflateRaw( data: Uint8Array | Array | string, options?: any ): Uint8Array; + export function inflateRaw( data: Uint8Array | Array | string, options?: any ): Array; + export function inflateRaw( data: Uint8Array | Array | string, options?: any ): string; /** * Just shortcut to inflate, because it autodetects format by header.content. Done for convenience. */ - export function ungzip( data: Uint8Array | Array | string, options?: any ): Uint8Array | Array | string; + export function ungzip( data: Uint8Array | Array | string, options?: any ): Uint8Array; + export function ungzip( data: Uint8Array | Array | string, options?: any ): Array; + export function ungzip( data: Uint8Array | Array | string, options?: any ): string; - export interface Deflate { - /** - * - */ + export class Deflate { constructor( options?: any ); err: number; msg: string; @@ -44,7 +47,7 @@ declare module Pako { push( data: Uint8Array | Array | ArrayBuffer | string, mode?: number | boolean ): boolean; } - export interface Inflate { + export class Inflate { constructor( options?: any ); err: number; msg: string; From b65f3c4365af162392297de198ed5b8708413c17 Mon Sep 17 00:00:00 2001 From: Vladimir Date: Wed, 25 Nov 2015 17:52:21 +0100 Subject: [PATCH 168/389] handleUpgrades option support in ServerOptions interface http://restify.com/#creating-a-server In restify docs createServer method supports handleUpgrades parameter in ServerOptions object, but it's not present in the type's interface. --- restify/restify.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/restify/restify.d.ts b/restify/restify.d.ts index 596637f23..d3e5e35f8 100644 --- a/restify/restify.d.ts +++ b/restify/restify.d.ts @@ -110,6 +110,7 @@ declare module "restify" { version ?: string; responseTimeHeader ?: string; responseTimeFormatter ?: (durationInMilliseconds: number) => any; + handleUpgrades ?: boolean; } interface ClientOptions { From 6f002a7c320350182886b2b88845d5aa6875cf30 Mon Sep 17 00:00:00 2001 From: Jacques Kang Date: Wed, 25 Nov 2015 21:20:58 +0100 Subject: [PATCH 169/389] Add IonicPopupConfirmPromise confirm(options) Show a simple confirm popup with a Cancel and OK button. Resolves the promise with true if the user presses the OK button, and false if the user presses the Cancel button. (Ref: http://ionicframework.com/docs/api/service/$ionicPopup/) --- ionic/ionic.d.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ionic/ionic.d.ts b/ionic/ionic.d.ts index 688a253ed..3014d25a8 100644 --- a/ionic/ionic.d.ts +++ b/ionic/ionic.d.ts @@ -246,10 +246,13 @@ declare module ionic { interface IonicPopupService { show(options: IonicPopupFullOptions): IonicPopupPromise; alert(options: IonicPopupAlertOptions): IonicPopupPromise; - confirm(options: IonicPopupConfirmOptions): IonicPopupPromise; + confirm(options: IonicPopupConfirmOptions): IonicPopupConfirmPromise; prompt(options: IonicPopupPromptOptions): IonicPopupPromise; } + interface IonicPopupConfirmPromise extends ng.IPromise { + close(value?: boolean): void; + } interface IonicPopupPromise extends ng.IPromise { close(value?: any): any; } From c000d73be493f203342c3a6d699fc5702a248272 Mon Sep 17 00:00:00 2001 From: Jacques Kang Date: Wed, 25 Nov 2015 21:24:39 +0100 Subject: [PATCH 170/389] Update test for $ionicPopup.confirm() --- ionic/ionic-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ionic/ionic-tests.ts b/ionic/ionic-tests.ts index ee8647b08..cfb882530 100644 --- a/ionic/ionic-tests.ts +++ b/ionic/ionic-tests.ts @@ -249,7 +249,7 @@ class IonicTestController { okType: "okType", cancelText: "Cancel", cancelType: "cancelType" - }).then(() => console.log("popover shown")) + }).then((result) => console.log(result === true ? "confirmed": "cancelled")) this.$ionicPopup.confirm({ title: "title", subTitle: "subTitle", From afe705f34bcd5367135bd2506999a1b22165b3a8 Mon Sep 17 00:00:00 2001 From: Joe Skeen Date: Wed, 25 Nov 2015 13:38:11 -0700 Subject: [PATCH 171/389] adm-zip: Move AdmZip class out of global scope; add tests --- adm-zip/adm-zip-tests.ts | 28 ++++++- adm-zip/adm-zip.d.ts | 163 +++++++++++++++++++-------------------- 2 files changed, 107 insertions(+), 84 deletions(-) diff --git a/adm-zip/adm-zip-tests.ts b/adm-zip/adm-zip-tests.ts index f8583ae61..c1e62e7f2 100644 --- a/adm-zip/adm-zip-tests.ts +++ b/adm-zip/adm-zip-tests.ts @@ -1,10 +1,9 @@ /// import AdmZip = require("adm-zip"); - // reading archives var zip = new AdmZip("./my_file.zip"); -var zipEntries = zip.getEntries(); // an array of ZipEntry records +var zipEntries: AdmZip.IZipEntry[] = zip.getEntries(); // an array of ZipEntry records zipEntries.forEach(function (zipEntry) { console.log(zipEntry.toString()); // outputs zip entries information @@ -31,3 +30,28 @@ zip.addLocalFile("/home/me/some_picture.png"); var willSendthis = zip.toBuffer(); // or write everything to disk zip.writeZip(/*target file name*/"/home/me/files.zip"); + +function processZipEntry(zipEntry: AdmZip.IZipEntry) { + console.log('comment', zipEntry.comment); +} + +//tests taken from examples at https://github.com/cthackers/adm-zip/wiki/ADM-ZIP +import Zip = require("adm-zip"); +// loads and parses existing zip file local_file.zip +var zip = new Zip("local_file.zip"); +// creates new in memory zip +zip = new Zip(); +// loads and parses existing zip file local_file.zip +zip = new Zip("local_file.zip"); +// get all entries and iterate them +zip.getEntries().forEach((entry) => { + var entryName = entry.entryName; + var decompressedData = zip.readFile(entry); // decompressed buffer of the entry + console.log(zip.readAsText(entry)); // outputs the decompressed content of the entry +}); + +// will extract the file myfile.txt from the archive to /home/user/folder/subfolder/myfile.txt +zip.extractEntryTo("folder/subfolder/myfile.txt", "/home/user/", true, true); + +// will extract the file myfile.txt from the archive to /home/user/myfile.txt +zip.extractEntryTo("folder/subfolder/myfile.txt", "/home/user/", false, true); diff --git a/adm-zip/adm-zip.d.ts b/adm-zip/adm-zip.d.ts index 9f2eb7dfd..ee57569da 100644 --- a/adm-zip/adm-zip.d.ts +++ b/adm-zip/adm-zip.d.ts @@ -5,8 +5,8 @@ /// -declare module AdmZip { - class ZipFile { +declare module "adm-zip" { + class AdmZip { /** * Create a new, empty archive. */ @@ -28,7 +28,7 @@ declare module AdmZip { * @param entry ZipEntry object * @return Buffer or Null in case of error */ - readFile(entry: IZipEntry): Buffer; + readFile(entry: AdmZip.IZipEntry): Buffer; /** * Asynchronous readFile * @param entry String with the full path of the entry @@ -41,7 +41,7 @@ declare module AdmZip { * @param callback Called with a Buffer or Null in case of error * @return Buffer or Null in case of error */ - readFileAsync(entry: IZipEntry, callback: (data: Buffer, err: string) => any): void; + readFileAsync(entry: AdmZip.IZipEntry, callback: (data: Buffer, err: string) => any): void; /** * Extracts the given entry from the archive and returns the content as * plain text in the given encoding @@ -57,7 +57,7 @@ declare module AdmZip { * @param encoding Optional. If no encoding is specified utf8 is used * @return String */ - readAsText(fileName: IZipEntry, encoding?: string): string; + readAsText(fileName: AdmZip.IZipEntry, encoding?: string): string; /** * Asynchronous readAsText * @param entry String with the full path of the entry @@ -71,7 +71,7 @@ declare module AdmZip { * @param callback Called with the resulting string. * @param encoding Optional. If no encoding is specified utf8 is used */ - readAsTextAsync(fileName: IZipEntry, callback: (data: string) => any, encoding?: string): void; + readAsTextAsync(fileName: AdmZip.IZipEntry, callback: (data: string) => any, encoding?: string): void; /** * Remove the entry from the file or the entry and all its nested directories * and files if the given entry is a directory @@ -83,7 +83,7 @@ declare module AdmZip { * and files if the given entry is a directory * @param entry A ZipEntry object. */ - deleteFile(entry: IZipEntry): void; + deleteFile(entry: AdmZip.IZipEntry): void; /** * Adds a comment to the zip. The zip must be rewritten after * adding the comment. @@ -110,7 +110,7 @@ declare module AdmZip { * @param entry ZipEntry object. * @param comment The comment to add to the entry. */ - addZipEntryComment(entry: IZipEntry, comment: string): void; + addZipEntryComment(entry: AdmZip.IZipEntry, comment: string): void; /** * Returns the comment of the specified entry. * @param entry String with the full path of the entry. @@ -122,7 +122,7 @@ declare module AdmZip { * @param entry ZipEntry object. * @return String The comment of the specified entry. */ - getZipEntryComment(entry: IZipEntry): string; + getZipEntryComment(entry: AdmZip.IZipEntry): string; /** * Updates the content of an existing entry inside the archive. The zip * must be rewritten after updating the content @@ -136,7 +136,7 @@ declare module AdmZip { * @param entry ZipEntry object. * @param content The entry's new contents. */ - updateFile(entry: IZipEntry, content: Buffer): void; + updateFile(entry: AdmZip.IZipEntry, content: Buffer): void; /** * Adds a file from the disk to the archive. * @param localPath Path to a file on disk. @@ -167,14 +167,14 @@ declare module AdmZip { * Returns an array of ZipEntry objects representing the files and folders * inside the archive */ - getEntries(): IZipEntry[]; + getEntries(): AdmZip.IZipEntry[]; /** * Returns a ZipEntry object representing the file or folder specified by * ``name``. * @param name Name of the file or folder to retrieve. * @return ZipEntry The entry corresponding to the name. */ - getEntry(name: string): IZipEntry; + getEntry(name: string): AdmZip.IZipEntry; /** * Extracts the given entry to the given targetPath. * If the entry is a directory inside the archive, the entire directory and @@ -203,7 +203,7 @@ declare module AdmZip { * will be overwriten if this is true. Default is FALSE * @return Boolean */ - extractEntryTo(entryPath: IZipEntry, targetPath: string, maintainEntryPath?: boolean, overwrite?: boolean): boolean; + extractEntryTo(entryPath: AdmZip.IZipEntry, targetPath: string, maintainEntryPath?: boolean, overwrite?: boolean): boolean; /** * Extracts the entire archive to the given location * @param targetPath Target location @@ -225,76 +225,75 @@ declare module AdmZip { toBuffer(): Buffer; } - /** - * The ZipEntry is more than a structure representing the entry inside the - * zip file. Beside the normal attributes and headers a entry can have, the - * class contains a reference to the part of the file where the compressed - * data resides and decompresses it when requested. It also compresses the - * data and creates the headers required to write in the zip file. - */ - interface IZipEntry { + module AdmZip { /** - * Represents the full name and path of the file - */ - entryName: string; - rawEntryName: Buffer; - /** - * Extra data associated with this entry. - */ - extra: Buffer; - /** - * Entry comment. - */ - comment: string; - name: string; - /** - * Read-Only property that indicates the type of the entry. - */ - isDirectory: boolean; - /** - * Get the header associated with this ZipEntry. - */ - header: Buffer; - /** - * Retrieve the compressed data for this entry. Note that this may trigger - * compression if any properties were modified. - */ - getCompressedData(): Buffer; - /** - * Asynchronously retrieve the compressed data for this entry. Note that - * this may trigger compression if any properties were modified. - */ - getCompressedDataAsync(callback: (data: Buffer) => void): void; - /** - * Set the (uncompressed) data to be associated with this entry. - */ - setData(value: string): void; - /** - * Set the (uncompressed) data to be associated with this entry. - */ - setData(value: Buffer): void; - /** - * Get the decompressed data associated with this entry. - */ - getData(): Buffer; - /** - * Asynchronously get the decompressed data associated with this entry. - */ - getDataAsync(callback: (data: Buffer) => void): void; - /** - * Returns the CEN Entry Header to be written to the output zip file, plus - * the extra data and the entry comment. - */ - packHeader(): Buffer; - /** - * Returns a nicely formatted string with the most important properties of - * the ZipEntry. - */ - toString(): string; + * The ZipEntry is more than a structure representing the entry inside the + * zip file. Beside the normal attributes and headers a entry can have, the + * class contains a reference to the part of the file where the compressed + * data resides and decompresses it when requested. It also compresses the + * data and creates the headers required to write in the zip file. + */ + interface IZipEntry { + /** + * Represents the full name and path of the file + */ + entryName: string; + rawEntryName: Buffer; + /** + * Extra data associated with this entry. + */ + extra: Buffer; + /** + * Entry comment. + */ + comment: string; + name: string; + /** + * Read-Only property that indicates the type of the entry. + */ + isDirectory: boolean; + /** + * Get the header associated with this ZipEntry. + */ + header: Buffer; + /** + * Retrieve the compressed data for this entry. Note that this may trigger + * compression if any properties were modified. + */ + getCompressedData(): Buffer; + /** + * Asynchronously retrieve the compressed data for this entry. Note that + * this may trigger compression if any properties were modified. + */ + getCompressedDataAsync(callback: (data: Buffer) => void): void; + /** + * Set the (uncompressed) data to be associated with this entry. + */ + setData(value: string): void; + /** + * Set the (uncompressed) data to be associated with this entry. + */ + setData(value: Buffer): void; + /** + * Get the decompressed data associated with this entry. + */ + getData(): Buffer; + /** + * Asynchronously get the decompressed data associated with this entry. + */ + getDataAsync(callback: (data: Buffer) => void): void; + /** + * Returns the CEN Entry Header to be written to the output zip file, plus + * the extra data and the entry comment. + */ + packHeader(): Buffer; + /** + * Returns a nicely formatted string with the most important properties of + * the ZipEntry. + */ + toString(): string; + } } -} -declare module "adm-zip" { - import zipFile = AdmZip.ZipFile; - export = zipFile; + export = AdmZip; } From 770a3bb179aab719b753a62001d8cb96c95cb98b Mon Sep 17 00:00:00 2001 From: Jacques Kang Date: Wed, 25 Nov 2015 21:55:00 +0100 Subject: [PATCH 172/389] Improve IonicActionSheetOptions Ref: http://ionicframework.com/docs/api/service/$ionicActionSheet/ --- ionic/ionic-tests.ts | 12 +++++++++--- ionic/ionic.d.ts | 9 ++++++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/ionic/ionic-tests.ts b/ionic/ionic-tests.ts index cfb882530..c68846715 100644 --- a/ionic/ionic-tests.ts +++ b/ionic/ionic-tests.ts @@ -84,13 +84,19 @@ class IonicTestController { private testActionSheet(): void { var closeActionSheetFn: ()=>void = this.$ionicActionSheet.show({ - buttons: [], + buttons: [{ text: 'A button' }], titleText: "titleText", cancelText: "cancelText", destructiveText: "destructiveText", cancel: ()=>{ console.log("cancel"); }, - buttonClicked: ()=>{ console.log("buttonClicked"); }, - destructiveButtonClicked: ()=>{ console.log("destructiveButtonClicked"); }, + buttonClicked: (index)=>{ + console.log("buttonClicked"); + return index === 0; + }, + destructiveButtonClicked: ()=>{ + console.log("destructiveButtonClicked"); + return false; + }, cancelOnStateChange: true, cssClass: "cssClass" }); diff --git a/ionic/ionic.d.ts b/ionic/ionic.d.ts index 3014d25a8..bb009df51 100644 --- a/ionic/ionic.d.ts +++ b/ionic/ionic.d.ts @@ -102,14 +102,17 @@ declare module ionic { interface IonicActionSheetService { show(options: IonicActionSheetOptions): ()=>void; } + interface IonicActionSheetButton { + text: string; + } interface IonicActionSheetOptions { - buttons?: Array; + buttons?: Array; titleText?: string; cancelText?: string; destructiveText?: string; cancel?: ()=>any; - buttonClicked?: (index: any)=>any; - destructiveButtonClicked?: ()=>any; + buttonClicked?: (index: number)=>boolean; + destructiveButtonClicked?: ()=>boolean; cancelOnStateChange?: boolean; cssClass?: string; } From c0326f4d621e44118a60e629adce70b80f629519 Mon Sep 17 00:00:00 2001 From: Joe Skeen Date: Wed, 25 Nov 2015 14:29:34 -0700 Subject: [PATCH 173/389] Added additional test --- adm-zip/adm-zip-tests.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/adm-zip/adm-zip-tests.ts b/adm-zip/adm-zip-tests.ts index c1e62e7f2..93f8f2f2d 100644 --- a/adm-zip/adm-zip-tests.ts +++ b/adm-zip/adm-zip-tests.ts @@ -55,3 +55,7 @@ zip.extractEntryTo("folder/subfolder/myfile.txt", "/home/user/", true, true); // will extract the file myfile.txt from the archive to /home/user/myfile.txt zip.extractEntryTo("folder/subfolder/myfile.txt", "/home/user/", false, true); + +function isAdmZipEntry(obj: any): obj is AdmZip.IZipEntry { + return obj !== null && typeof obj === "object" && typeof obj['entryName'] === 'string'; +} \ No newline at end of file From 2830f7f722ef6e0a05115f143f9621517c35acf5 Mon Sep 17 00:00:00 2001 From: Maximilian Friedmann Date: Wed, 25 Nov 2015 22:54:59 +0100 Subject: [PATCH 174/389] Update meteor.d.ts collection.remove returns the number of removed items, just like update/upsert etc., see http://docs.meteor.com/#/full/remove --- meteor/meteor.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meteor/meteor.d.ts b/meteor/meteor.d.ts index ee6c1db41..222de7ae7 100644 --- a/meteor/meteor.d.ts +++ b/meteor/meteor.d.ts @@ -616,7 +616,7 @@ declare module Mongo { insert(doc: T, callback?: Function): string; rawCollection(): any; rawDatabase(): any; - remove(selector: Mongo.Selector | Mongo.ObjectID | string, callback?: Function): void; + remove(selector: Mongo.Selector | Mongo.ObjectID | string, callback?: Function): number; update(selector: Mongo.Selector | Mongo.ObjectID | string, modifier: Mongo.Modifier, options?: { multi?: boolean; upsert?: boolean; From 9ce1cff36fceab03314c25d0513f23b7d8453cb7 Mon Sep 17 00:00:00 2001 From: gcroteau Date: Wed, 25 Nov 2015 17:08:37 -0500 Subject: [PATCH 175/389] Completed Data definitions. --- turf/turf-test.ts | 18 ++++++++++++++++++ turf/turf.d.ts | 29 +++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/turf/turf-test.ts b/turf/turf-test.ts index 4d89f140e..a69d36d47 100644 --- a/turf/turf-test.ts +++ b/turf/turf-test.ts @@ -352,6 +352,24 @@ var key = "species"; var value = "oak"; var filtered = turf.filter(features, key, value); +// -- Test random -- +var points = turf.random('points', 100, { + bbox: [-70, 40, -60, 60] +}); + +var points = turf.random('points', 100, { + bbox: [-70, 40, -60, 60], + num_vertices: 2, + max_radial_length: 10 +}); + +// -- Test remove -- +var filtered = turf.remove(points, 'marker-color', '#00f'); + +// -- Test sample -- +var points = turf.random('points', 1000); +var sample = turf.sample(points, 10); + ////////////////////////////////////////////////////////////////////////// // Tests Interpolation //////////////////////////////////////////////////////////////////////////; diff --git a/turf/turf.d.ts b/turf/turf.d.ts index 85d7b25f9..c10fe2ac9 100644 --- a/turf/turf.d.ts +++ b/turf/turf.d.ts @@ -305,6 +305,35 @@ declare module turf { */ function filter(features: GeoJSON.FeatureCollection, key: string, value: string): GeoJSON.FeatureCollection; + /** + * Generates random GeoJSON data, including Points and Polygons, for testing and experimentation. + * @param [type='point'] Type of features desired: 'points' or 'polygons' + * @param [count=1] How many geometries should be generated. + * @param [options] Options relevant to the feature desired. Can include: + * - A bounding box inside of which geometries are placed. In the case of Point features, they are guaranteed to be within this bounds, while Polygon features have their centroid within the bounds. + * - The number of vertices added to polygon features. Default is 10; + * - The total number of decimal degrees longitude or latitude that a polygon can extent outwards to from its center. Default is 10. + * @returns Generated random features + */ + function random(type?: string, count?: number, options?: {bbox?: Array; num_vertices?: number; max_radial_length?: number;}): GeoJSON.FeatureCollection; + + /** + * Takes a FeatureCollection of any type, a property, and a value and returns a FeatureCollection with features matching that property-value pair removed. + * @param features Set of input features + * @param property The property to remove + * @param value The value to remove + * @returns The resulting FeatureCollection without features that match the property-value pair + */ + function remove(features: GeoJSON.FeatureCollection, property: string, value: string): GeoJSON.FeatureCollection; + + /** + * Takes a FeatureCollection and returns a FeatureCollection with given number of features at random. + * @param features Set of input features + * @param n Number of features to select + * @returns A FeatureCollection with n features + */ + function sample(features: GeoJSON.FeatureCollection, n: number): GeoJSON.FeatureCollection; + ////////////////////////////////////////////////////// // Interpolation ////////////////////////////////////////////////////// From ab3aa41ff74a961268a1ebe7aee2218e099bb4d9 Mon Sep 17 00:00:00 2001 From: gcroteau Date: Wed, 25 Nov 2015 19:47:29 -0500 Subject: [PATCH 176/389] Added Interpolation definitions to turf.d.ts. --- turf/turf-test.ts | 43 +++++++++++++++++++++++++++++++ turf/turf.d.ts | 64 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+) diff --git a/turf/turf-test.ts b/turf/turf-test.ts index a69d36d47..e8aaec708 100644 --- a/turf/turf-test.ts +++ b/turf/turf-test.ts @@ -197,6 +197,24 @@ var features = { ] }; +var triangle = { + "type": "Feature", + "properties": { + "a": 11, + "b": 122, + "c": 44 + }, + "geometry": { + "type": "Polygon", + "coordinates": [[ + [-75.1221, 39.57], + [-75.58, 39.18], + [-75.97, 39.86], + [-75.1221, 39.57] + ]] + } +}; + ////////////////////////////////////////////////////////////////////////// // Tests Aggregation ////////////////////////////////////////////////////////////////////////// @@ -374,6 +392,31 @@ var sample = turf.sample(points, 10); // Tests Interpolation //////////////////////////////////////////////////////////////////////////; +// -- Test hexGrid -- +var cellWidth = 50; +var hexgrid = turf.hexGrid(bbox, cellWidth, units); + +// -- Test isolines -- +var breaks = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; +var isolined = turf.isolines(points, 'z', 15, breaks); + +// -- Test planepoint -- +var zValue = turf.planepoint(point1, triangle); + +// -- Test pointGrid -- +var extent = [-70.823364, -33.553984, -70.473175, -33.302986]; +var cellWidth = 3; +var grid = turf.pointGrid(extent, cellWidth, units); + +// -- Test squareGrid -- +var squareGrid = turf.squareGrid(extent, cellWidth, units); + +// -- Test tin -- +var tin = turf.tin(points, 'z'); + +// -- Test triangleGrid -- +var triangleGrid = turf.triangleGrid(extent, cellWidth, units); + ////////////////////////////////////////////////////////////////////////// // Tests Joins ////////////////////////////////////////////////////////////////////////// diff --git a/turf/turf.d.ts b/turf/turf.d.ts index c10fe2ac9..b74681a89 100644 --- a/turf/turf.d.ts +++ b/turf/turf.d.ts @@ -338,6 +338,70 @@ declare module turf { // Interpolation ////////////////////////////////////////////////////// + /** + * Takes a bounding box and a cell size in degrees and returns a FeatureCollection of flat-topped hexagons (Polygon features) aligned in an "odd-q" vertical grid as described in Hexagonal Grids. + * @param bbox Bounding box in [minX, minY, maxX, maxY] order + * @param cellWidth Width of cell in specified units + * @param units Used in calculating cellWidth ('miles' or 'kilometers') + * @returns A hexagonal grid + */ + function hexGrid(bbox: Array, cellWidth: number, units: string): GeoJSON.FeatureCollection; + + /** + * Takes points with z-values and an array of value breaks and generates isolines. + * @param points Input points + * @param z The property name in points from which z-values will be pulled + * @param resolution Resolution of the underlying grid + * @param breaks Where to draw contours + * @returns Isolines + */ + function isolines(points: GeoJSON.FeatureCollection, z: string, resolution: number, breaks: Array): GeoJSON.FeatureCollection; + + /** + * Takes a triangular plane as a Polygon and a Point within that triangle and returns the z-value at that point. The Polygon needs to have properties a, b, and c that define the values at its three corners. + * @param interpolatedPoint The Point for which a z-value will be calculated + * @param triangle A Polygon feature with three vertices + * @returns The z-value for interpolatedPoint + */ + function planepoint(interpolatedPoint: GeoJSON.Feature, triangle: GeoJSON.Feature): number; + + /** + * Takes a bounding box and a cell depth and returns a set of points in a grid. + * @param extent Extent in [minX, minY, maxX, maxY] order + * @param cellWidth The distance across each cell + * @param units Used in calculating cellWidth ('miles' or 'kilometers') + * @returns Grid of points + */ + function pointGrid(extent: Array, cellWidth: number, units: string): GeoJSON.FeatureCollection; + + /** + * Takes a bounding box and a cell depth and returns a set of square polygons in a grid. + * @param extent Extent in [minX, minY, maxX, maxY] order + * @param cellWidth Width of each cell + * @param units Used in calculating cellWidth ('miles' or 'kilometers') + * @returns Grid of polygons + */ + function squareGrid(extent: Array, cellWidth: number, units: string): GeoJSON.FeatureCollection; + + /** + * Takes a set of points and the name of a z-value property and creates a Triangulated Irregular Network, or a TIN for short, returned as a collection of Polygons. + * These are often used for developing elevation contour maps or stepped heat visualizations. + * This triangulates the points, as well as adds properties called a, b, and c representing the value of the given propertyName at each of the points that represent the corners of the triangle. + * @param points Input points + * @param [propertyName] Name of the property from which to pull z values This is optional: if not given, then there will be no extra data added to the derived triangles. + * @returns TIN output + */ + function tin(points: GeoJSON.FeatureCollection, propertyName?: string): GeoJSON.FeatureCollection; + + /** + * Takes a bounding box and a cell depth and returns a set of triangular polygons in a grid. + * @param extent Extent in [minX, minY, maxX, maxY] order + * @param cellWidth Width of each cell + * @param units Used in calculating cellWidth ('miles' or 'kilometers') + * @returns Grid of triangles + */ + function triangleGrid(extent: Array, cellWidth: number, units: string): GeoJSON.FeatureCollection; + ////////////////////////////////////////////////////// // Joins ////////////////////////////////////////////////////// From 1c55a6117750de906e301ff3a39204844f3a1069 Mon Sep 17 00:00:00 2001 From: gcroteau Date: Wed, 25 Nov 2015 19:56:27 -0500 Subject: [PATCH 177/389] Added Joins definitions to turf.d.ts. --- turf/turf-test.ts | 9 +++++++++ turf/turf.d.ts | 26 ++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/turf/turf-test.ts b/turf/turf-test.ts index e8aaec708..d46bf2e81 100644 --- a/turf/turf-test.ts +++ b/turf/turf-test.ts @@ -421,6 +421,15 @@ var triangleGrid = turf.triangleGrid(extent, cellWidth, units); // Tests Joins ////////////////////////////////////////////////////////////////////////// +// -- Test inside -- +var isInside1 = turf.inside(point1, polygon); + +// -- Test tag -- +var tagged = turf.tag(points, triangleGrid, 'fill', 'marker-color'); + +// -- Test within -- +var ptsWithin = turf.within(points, polygons); + ////////////////////////////////////////////////////////////////////////// // Tests Classification ////////////////////////////////////////////////////////////////////////// diff --git a/turf/turf.d.ts b/turf/turf.d.ts index b74681a89..f90668b4f 100644 --- a/turf/turf.d.ts +++ b/turf/turf.d.ts @@ -406,6 +406,32 @@ declare module turf { // Joins ////////////////////////////////////////////////////// + /** + * Takes a Point and a Polygon or MultiPolygon and determines if the point resides inside the polygon. The polygon can be convex or concave. The function accounts for holes. + * @param point Input point + * @param polygon Input polygon or multipolygon + * @returns true if the Point is inside the Polygon; false if the Point is not inside the Polygon + */ + function inside(point: GeoJSON.Feature, polygon: GeoJSON.Feature): boolean; + + /** + * Takes a set of points and a set of polygons and performs a spatial join. + * @param points Input points + * @param polygons Input polygons + * @param polyId Property in polygons to add to joined Point features + * @param containingPolyId Property in points in which to store joined property from polygons + * @returns Points with containingPolyId property containing values from polyId + */ + function tag(points: GeoJSON.FeatureCollection, polygons: GeoJSON.FeatureCollection, polyId: string, containingPolyId: string): GeoJSON.FeatureCollection; + + /** + * Takes a set of points and a set of polygons and returns the points that fall within the polygons. + * @param points Input points + * @param polygons Input polygons + * @returns Points that land within at least one polygon + */ + function within(points: GeoJSON.FeatureCollection, polygons: GeoJSON.FeatureCollection): GeoJSON.FeatureCollection; + ////////////////////////////////////////////////////// // Classification ////////////////////////////////////////////////////// From 77365e3b156e2230e735a1aeec914bcfe9281dd4 Mon Sep 17 00:00:00 2001 From: gcroteau Date: Wed, 25 Nov 2015 20:11:13 -0500 Subject: [PATCH 178/389] Added Classification definitions to turf.d.ts. --- turf/turf-test.ts | 17 +++++++++++++++++ turf/turf.d.ts | 38 +++++++++++++++++++++++++++++++++++--- 2 files changed, 52 insertions(+), 3 deletions(-) diff --git a/turf/turf-test.ts b/turf/turf-test.ts index d46bf2e81..5a8501c74 100644 --- a/turf/turf-test.ts +++ b/turf/turf-test.ts @@ -433,3 +433,20 @@ var ptsWithin = turf.within(points, polygons); ////////////////////////////////////////////////////////////////////////// // Tests Classification ////////////////////////////////////////////////////////////////////////// + +// -- Test jenks -- +var breaks = turf.jenks(points, 'population', 3); + +// -- Test nearest -- +var nearest = turf.nearest(point1, points); + +// -- Test quantile -- +var breaks = turf.quantile(points, 'population', [25, 50, 75, 99]); + +// -- Test reclass -- +var translations = [ + [0, 200, "small"], + [200, 400, "medium"], + [400, 600, "large"] +]; +var reclassed = turf.reclass(points, 'population', 'size', translations); diff --git a/turf/turf.d.ts b/turf/turf.d.ts index f90668b4f..0da75e33b 100644 --- a/turf/turf.d.ts +++ b/turf/turf.d.ts @@ -436,7 +436,39 @@ declare module turf { // Classification ////////////////////////////////////////////////////// - ////////////////////////////////////////////////////// - // Types - ////////////////////////////////////////////////////// + /** + * Takes a set of features and returns an array of the Jenks Natural breaks for a given property. + * @param input Input features + * @param field The property in input on which to calculate Jenks natural breaks + * @param numberOfBreaks Number of classes in which to group the data + * @returns The break number for each class plus the minimum and maximum values + */ + function jenks(input: GeoJSON.FeatureCollection, field: string, numberOfBreaks: number): Array; + + /** + * Takes a reference point and a set of points and returns the point from the set closest to the reference. + * @param point The reference point + * @param against Input point set + * @returns The closest point in the set to the reference point + */ + function nearest(point: GeoJSON.Feature, against: GeoJSON.FeatureCollection): GeoJSON.Feature; + + /** + * Takes a FeatureCollection, a property name, and a set of percentiles and returns a quantile array. + * @param input Set of features + * @param field The property in input from which to retrieve quantile values + * @param percentiles An Array of percentiles on which to calculate quantile values + * @returns An array of the break values + */ + function quantile(input: GeoJSON.FeatureCollection, field: string, percentiles: Array): Array; + + /** + * Takes a FeatureCollection, an input field, an output field, and an array of translations and outputs an identical FeatureCollection with the output field property populated. + * @param input Set of input features + * @param inField The field to translate + * @param outField The field in which to store translated results + * @param translations An array of translations + * @returns A FeatureCollection with identical geometries to input but with outField populated. + */ + function reclass(input: GeoJSON.FeatureCollection, inField: string, outField: string, translations: Array): GeoJSON.FeatureCollection; } From 99167e24770d36b6bc4e14c75bc28d7f3409f437 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Thu, 26 Nov 2015 06:30:50 +0500 Subject: [PATCH 179/389] lodash: signatures of _.fill have been changed --- lodash/lodash-tests.ts | 57 +++++++++++++++++-- lodash/lodash.d.ts | 124 +++++++++++++++++++++++++---------------- 2 files changed, 126 insertions(+), 55 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 30c0b9934..a34d45f62 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -453,13 +453,58 @@ module TestDropWhile { } // _.fill -var testFillArray = [1, 2, 3]; -var testFillList: _.List = {0: 1, 1: 2, 2: 3, length: 3}; +module TestFill { + let array: number[]; + let list: _.List; -result = _.fill(testFillArray, 'a', 0, 3); -result = <_.List>_.fill(testFillList, 'a', 0, 3); -result = _(testFillArray).fill(0, 0, 3).value(); -result = <_.List>_(testFillList).fill(0, 0, 3).value(); + { + let result: number[]; + + result = _.fill(array, 42); + result = _.fill(array, 42, 0); + result = _.fill(array, 42, 0, 10); + } + + { + let result: _.List; + + result = _.fill(list, 42); + result = _.fill(list, 42, 0); + result = _.fill(list, 42, 0, 10); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).fill(42); + result = _(array).fill(42, 0); + result = _(array).fill(42, 0, 10); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.List>; + + result = _(list).fill(42); + result = _(list).fill(42, 0); + result = _(list).fill(42, 0, 10); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().fill(42); + result = _(array).chain().fill(42, 0); + result = _(array).chain().fill(42, 0, 10); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.List>; + + result = _(list).chain().fill(42); + result = _(list).chain().fill(42, 0); + result = _(list).chain().fill(42, 0, 10); + } +} // _.findIndex module TestFindIndex { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 73a783b64..dbc21db5f 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -749,6 +749,81 @@ declare module _ { ): LoDashExplicitArrayWrapper; } + //_.fill + interface LoDashStatic { + /** + * Fills elements of array with value from start up to, but not including, end. + * + * Note: This method mutates array. + * + * @param array The array to fill. + * @param value The value to fill array with. + * @param start The start position. + * @param end The end position. + * @return Returns array. + */ + fill( + array: any[], + value: T, + start?: number, + end?: number + ): T[]; + + /** + * @see _.fill + */ + fill( + array: List, + value: T, + start?: number, + end?: number + ): List; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.fill + */ + fill( + value: T, + start?: number, + end?: number + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.fill + */ + fill( + value: T, + start?: number, + end?: number + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.fill + */ + fill( + value: T, + start?: number, + end?: number + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.fill + */ + fill( + value: T, + start?: number, + end?: number + ): LoDashExplicitObjectWrapper>; + } + //_.findIndex interface LoDashStatic { /** @@ -4552,55 +4627,6 @@ declare module _ { ): LoDashExplicitWrapper; } - //_.fill - interface LoDashStatic { - /** - * Fills elements of array with value from start up to, but not including, end. - * - * Note: This method mutates array. - * - * @param array (Array): The array to fill. - * @param value (*): The value to fill array with. - * @param [start=0] (number): The start position. - * @param [end=array.length] (number): The end position. - * @return (Array): Returns array. - */ - fill( - array: any[], - value: any, - start?: number, - end?: number): TResult[]; - - /** - * @see _.fill - */ - fill( - array: List, - value: any, - start?: number, - end?: number): List; - } - - interface LoDashImplicitArrayWrapper { - /** - * @see _.fill - */ - fill( - value: TResult, - start?: number, - end?: number): LoDashImplicitArrayWrapper; - } - - interface LoDashImplicitObjectWrapper { - /** - * @see _.fill - */ - fill( - value: TResult, - start?: number, - end?: number): LoDashImplicitObjectWrapper>; - } - //_.filter interface LoDashStatic { /** From 879969aa283663106903181dd3d760d6f743f23d Mon Sep 17 00:00:00 2001 From: book010 Date: Thu, 26 Nov 2015 12:20:30 +0800 Subject: [PATCH 180/389] update text to textContent for 1.0.0-rc5 --- angular-material/angular-material.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angular-material/angular-material.d.ts b/angular-material/angular-material.d.ts index 54ef2507b..e87f33710 100644 --- a/angular-material/angular-material.d.ts +++ b/angular-material/angular-material.d.ts @@ -116,7 +116,7 @@ declare module angular.material { } interface IToastPreset { - content(content: string): T; + textContent(content: string): T; action(action: string): T; highlightAction(highlightAction: boolean): T; capsule(capsule: boolean): T; From abacf3f78af1ec0fd906bca738e6a8d940a50779 Mon Sep 17 00:00:00 2001 From: book010 Date: Thu, 26 Nov 2015 12:22:02 +0800 Subject: [PATCH 181/389] update content to textContent for 1.0.0-rc5 md-toast now uses textContent instead of content - content is deprecated --- angular-material/angular-material-tests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/angular-material/angular-material-tests.ts b/angular-material/angular-material-tests.ts index a9cd52437..3c70dd27e 100644 --- a/angular-material/angular-material-tests.ts +++ b/angular-material/angular-material-tests.ts @@ -96,5 +96,5 @@ myApp.controller('SidenavController', ($scope: ng.IScope, $mdSidenav: ng.materia }); myApp.controller('ToastController', ($scope: ng.IScope, $mdToast: ng.material.IToastService) => { - $scope['openToast'] = () => $mdToast.show($mdToast.simple().content('Hello!')); -}); \ No newline at end of file + $scope['openToast'] = () => $mdToast.show($mdToast.simple().textContent('Hello!')); +}); From 732f2f4bc1fed1f44cb68eab68b66fb14f895ee4 Mon Sep 17 00:00:00 2001 From: bgrieder Date: Thu, 26 Nov 2015 05:46:09 +0100 Subject: [PATCH 182/389] improved definitions so that react-native 'extends' react rather thane 're-exports' react --- react-native/react-native.d.ts | 231 +++------------------------------ 1 file changed, 17 insertions(+), 214 deletions(-) diff --git a/react-native/react-native.d.ts b/react-native/react-native.d.ts index dacfbc7f0..dc6cc5e3c 100644 --- a/react-native/react-native.d.ts +++ b/react-native/react-native.d.ts @@ -5,21 +5,24 @@ /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // -// These definitions are meant to be used with the TSC compiler target set to ES6 +// USING: these definitions are meant to be used with the TSC compiler target set to ES6 // -// These definitions have been mostly completed by porting to Typescript -// the UI Explorer which comes with the react-native distribution -// Check: https://github.com/bgrieder/RNTSExplorer +// USAGE EXAMPLES: check the RNTSExplorer project at https://github.com/bgrieder/RNTSExplorer // -// This work is based on an original work made by Bernd Paradies: https://github.com/bparadie +// CONTRIBUTING: please open pull requests and make sure that the changes do not break RNTSExplorer (they should not) +// Do not hesitate to open a pull request against RNTSExplorer to provide an example for a case not covered by the current App +// +// CREDITS: This work is based on an original work made by Bernd Paradies: https://github.com/bparadie // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// +//so we know what is "original" React import React = __React; -declare namespace ReactNative { +//react-native "extends" react +declare namespace __React { /** @@ -118,6 +121,7 @@ declare namespace ReactNative { // @see lib.es6.d.ts export var Promise: PromiseConstructor; + //TODO: BGR: Replace with ComponentClass ? // node_modules/react-tools/src/classic/class/ReactClass.js export interface ReactClass { // TODO: @@ -3411,214 +3415,11 @@ declare namespace ReactNative { export type DeviceEventSubscription = DeviceEventSubscriptionStatic export var InteractionManager: InteractionManagerStatic - ////////////////////////////////////////////////////////////////////////// - // - // R E A C T - 0 . 1 4 - // - ////////////////////////////////////////////////////////////////////////// - - - export type ReactType = React.ReactType; - - export interface ReactElement

    extends React.ReactElement

    {} - - export interface ClassicElement

    extends React.ClassicElement

    {} - - export interface DOMElement

    extends React.DOMElement

    {} - - export type HTMLElement =React.ReactHTMLElement; - export type SVGElement = React.ReactSVGElement; - - // - // Factories - // ---------------------------------------------------------------------- - - export interface Factory

    extends React.Factory

    {} - - export interface ClassicFactory

    extends React.ClassicFactory

    {} - - export interface DOMFactory

    extends React.DOMFactory

    {} - - export type HTMLFactory = React.HTMLFactory; - export type SVGFactory = React.SVGFactory; - - // - // React Nodes - // http://facebook.github.io/react/docs/glossary.html - // ---------------------------------------------------------------------- - - export type ReactText = React.ReactText; - export type ReactChild = React.ReactChild; - - // Should be Array but type aliases cannot be recursive - export type ReactFragment = React.ReactFragment; - export type ReactNode = React.ReactNode; - - // - // Top Level API - // ---------------------------------------------------------------------- - - export function createClass( spec: React.ComponentSpec ): React.ClassicComponentClass

    ; - - export function createFactory

    ( type: string ): React.DOMFactory

    ; - export function createFactory

    ( type: React.ClassicComponentClass

    | string ): React.ClassicFactory

    ; - export function createFactory

    ( type: React.ComponentClass

    ): React.Factory

    ; - - export function createElement

    ( type: string, - props?: P, - ...children: React.ReactNode[] ): React.DOMElement

    ; - export function createElement

    ( type: React.ClassicComponentClass

    | string, - props?: P, - ...children: React.ReactNode[] ): React.ClassicElement

    ; - export function createElement

    ( type: React.ComponentClass

    , - props?: P, - ...children: React.ReactNode[] ): React.ReactElement

    ; - - export function cloneElement

    ( element: React.DOMElement

    , - props?: P, - ...children: React.ReactNode[] ): React.DOMElement

    ; - export function cloneElement

    ( element: React.ClassicElement

    , - props?: P, - ...children: React.ReactNode[] ): React.ClassicElement

    ; - export function cloneElement

    ( element: React.ReactElement

    , - props?: P, - ...children: React.ReactNode[] ): React.ReactElement

    ; - - export function isValidElement( object: {} ): boolean; - - export var DOM: React.ReactDOM; - export var PropTypes: React.ReactPropTypes; - export var Children: React.ReactChildren; - - // - // Component API - // ---------------------------------------------------------------------- - - // Base component for plain JS classes - export class Component extends React.Component {} - - export interface ClassicComponent extends React.ClassicComponent {} - - export interface DOMComponent

    extends ClassicComponent { - tagName: string; - } - - export interface ChildContextProvider extends React.ChildContextProvider {} - - // - // Class Interfaces - // ---------------------------------------------------------------------- - - export interface ComponentClass

    extends React.ComponentClass

    {} - - export interface ClassicComponentClass

    extends React.ClassicComponentClass

    {} - - // - // Component Specs and Lifecycle - // ---------------------------------------------------------------------- - - export interface ComponentLifecycle extends React.ComponentLifecycle {} - - export interface Mixin extends React.Mixin {} - - export interface ComponentSpec extends React.ComponentSpec {} - - // - // Event System - // ---------------------------------------------------------------------- - - export interface SyntheticEvent extends React.SyntheticEvent {} - - export interface DragEvent extends React.DragEvent {} - - export interface ClipboardEvent extends React.ClipboardEvent {} - - export interface KeyboardEvent extends React.KeyboardEvent {} - - - export interface FocusEvent extends React.FocusEvent {} - - export interface FormEvent extends React.FormEvent {} - - export interface MouseEvent extends React.MouseEvent {} - - export interface TouchEvent extends React.TouchEvent {} - - export interface UIEvent extends React.UIEvent {} - - export interface WheelEvent extends React.WheelEvent {} - - // - // Event Handler Types - // ---------------------------------------------------------------------- - - export interface EventHandler extends React.EventHandler {} - - export interface DragEventHandler extends React.DragEventHandler {} - export interface ClipboardEventHandler extends React.ClipboardEventHandler {} - export interface KeyboardEventHandler extends React.KeyboardEventHandler {} - export interface FocusEventHandler extends React.FocusEventHandler {} - export interface FormEventHandler extends React.FormEventHandler {} - export interface MouseEventHandler extends React.MouseEventHandler {} - export interface TouchEventHandler extends React.TouchEventHandler {} - export interface UIEventHandler extends React.UIEventHandler {} - export interface WheelEventHandler extends React.WheelEventHandler {} - - // - // Props / DOM Attributes - // ---------------------------------------------------------------------- - - export interface Props extends React.Props {} - - export interface DOMAttributes extends React.DOMAttributes {} - - // This interface is not complete. Only properties accepting - // unitless numbers are listed here (see CSSProperty.js in React) - export interface CSSProperties extends React.CSSProperties {} - - export interface HTMLAttributes extends React.HTMLAttributes {} - - export interface SVGAttributes extends React.SVGAttributes {} - - // - // React.DOM - // ---------------------------------------------------------------------- - - export interface ReactDOM extends React.ReactDOM {} - - // - // React.PropTypes - // ---------------------------------------------------------------------- - - export interface Validator extends React.Validator {} - - export interface Requireable extends React.Requireable {} - - export interface ValidationMap extends React.ValidationMap {} - - export interface ReactPropTypes extends React.ReactPropTypes {} - - // - // React.Children - // ---------------------------------------------------------------------- - - export interface ReactChildren extends React.ReactChildren {} - - // - // Browser Interfaces - // https://github.com/nikeee/2048-typescript/blob/master/2048/js/touch.d.ts - // ---------------------------------------------------------------------- - - export interface AbstractView extends React.AbstractView {} - - export interface Touch extends React.Touch {} - - export interface TouchList extends React.TouchList {} - // // Additional ( and controversial) // + ////////////////////////////////////////////////////////////////////////// export function __spread( target: any, ...sources: any[] ): any; @@ -3657,10 +3458,16 @@ declare namespace ReactNative { declare module "react-native" { + import ReactNative = __React export default ReactNative } +declare var global: __React.GlobalStatic +declare function require( name: string ): any + + +//TODO: BGR: this is a left-over from the initial port. Not sure it makes any sense declare module "Dimensions" { import React from 'react-native'; @@ -3671,7 +3478,3 @@ declare module "Dimensions" { var ExportDimensions: Dimensions; export = ExportDimensions; } - -declare var global: ReactNative.GlobalStatic - -declare function require( name: string ): any From afb6532a96b7a00810b56dc8f90f6934a62b99d1 Mon Sep 17 00:00:00 2001 From: JJJ Date: Thu, 26 Nov 2015 15:00:20 +0800 Subject: [PATCH 183/389] update version to 1.0.0-rc5 --- angular-material/angular-material.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angular-material/angular-material.d.ts b/angular-material/angular-material.d.ts index e87f33710..43e0b9f53 100644 --- a/angular-material/angular-material.d.ts +++ b/angular-material/angular-material.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Angular Material 0.10.1-rc1+ (angular.material module) +// Type definitions for Angular Material 1.0.0-rc5+ (angular.material module) // Project: https://github.com/angular/material // Definitions by: Matt Traynham // Definitions: https://github.com/borisyankov/DefinitelyTyped From 148598770764cc57e0b5fa6c2488c0ba87865985 Mon Sep 17 00:00:00 2001 From: Denis Sokolov Date: Thu, 26 Nov 2015 09:10:18 +0200 Subject: [PATCH 184/389] Add compose-function typings --- compose-function/compose-function-tests.ts | 21 +++++++++++++++ compose-function/compose-function.d.ts | 31 ++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 compose-function/compose-function-tests.ts create mode 100644 compose-function/compose-function.d.ts diff --git a/compose-function/compose-function-tests.ts b/compose-function/compose-function-tests.ts new file mode 100644 index 000000000..dd0a80fef --- /dev/null +++ b/compose-function/compose-function-tests.ts @@ -0,0 +1,21 @@ +/// + +const numberToNumber = (a: number): number => a + 2; +const numberToString = (a: number): string => "foo"; +const stringToNumber = (a: string): number => 5; + +import composeFunction = require("compose-function"); +const t1: number = composeFunction(numberToNumber, numberToNumber)(5); +const t2: string = composeFunction(numberToString, numberToNumber)(5); +const t3: string = composeFunction(numberToString, stringToNumber)("f"); +const t4: (a: string) => number = composeFunction( + (f: (a: string) => number) => ((p: string) => 5), + (f: (a: number) => string) => ((p: string) => 4) + )(numberToString); + + +const t5: number = composeFunction(stringToNumber, numberToString, numberToNumber)(5); +const t6: string = composeFunction(numberToString, stringToNumber, numberToString, numberToNumber)(5); + +const t7: string = composeFunction( + numberToString, numberToNumber, stringToNumber, numberToString, stringToNumber)("fo"); diff --git a/compose-function/compose-function.d.ts b/compose-function/compose-function.d.ts new file mode 100644 index 000000000..d4f205fd3 --- /dev/null +++ b/compose-function/compose-function.d.ts @@ -0,0 +1,31 @@ +// Type definitions for compose-function +// Project: https://github.com/stoeffel/compose-function +// Definitions by: Denis Sokolov +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module "compose-function" { + // Hardcoded signatures for 2-4 parameters + function f( + f1: (b: B) => C, + f2: (a: A) => B + ): (a: A) => C + function f( + f1: (b: C) => D, + f2: (a: B) => C, + f3: (a: A) => B + ): (a: A) => D + function f( + f1: (b: D) => E, + f2: (a: C) => D, + f3: (a: B) => C, + f4: (a: A) => B + ): (a: A) => E + + // Minimal typing for more than 4 parameters + function f( + f1: (a: any) => Result, + ...functions: Function[] + ): (a: any) => Result + + export = f; +} From 3efcdc303430181781369d962374a217d5584a33 Mon Sep 17 00:00:00 2001 From: Shlomi Assaf Date: Thu, 26 Nov 2015 12:37:27 +0200 Subject: [PATCH 185/389] Add resumeBootstrap to IAngularStatic --- angularjs/angular.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index 1b54bac2a..ee8a94db6 100644 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -165,6 +165,12 @@ declare module angular { dot: number; codeName: string; }; + + /** + * If window.name contains prefix NG_DEFER_BOOTSTRAP! when angular.bootstrap is called, the bootstrap process will be paused until angular.resumeBootstrap() is called. + * @param extraModules An optional array of modules that should be added to the original list of modules that the app was about to be bootstrapped with. + */ + resumeBootstrap?(extraModules?: string[]): ng.auto.IInjectorService; } /////////////////////////////////////////////////////////////////////////// From eff4af0407b08a4b2653cfa2a351447007e32d0a Mon Sep 17 00:00:00 2001 From: Sam Verschueren Date: Thu, 26 Nov 2015 14:06:32 +0100 Subject: [PATCH 186/389] Add query-string --- query-string/query-string-tests.ts | 13 +++++++++++++ query-string/query-string.d.ts | 27 +++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 query-string/query-string-tests.ts create mode 100644 query-string/query-string.d.ts diff --git a/query-string/query-string-tests.ts b/query-string/query-string-tests.ts new file mode 100644 index 000000000..597d270f2 --- /dev/null +++ b/query-string/query-string-tests.ts @@ -0,0 +1,13 @@ +/// + +import qs = require('query-string'); + +qs.stringify({ foo: 'bar' }); +qs.stringify({ foo: 'bar', bar: 'baz' }); + +qs.parse('?foo=bar'); +qs.parse('#foo=bar'); +qs.parse('&foo=bar&foo=baz'); + +qs.extract('http://foo.bar/?abc=def&hij=klm'); +qs.extract('http://foo.bar/?foo=bar'); diff --git a/query-string/query-string.d.ts b/query-string/query-string.d.ts new file mode 100644 index 000000000..e4d76d003 --- /dev/null +++ b/query-string/query-string.d.ts @@ -0,0 +1,27 @@ +// Type definitions for query-string v3.0.0 +// Project: https://github.com/sindresorhus/query-string +// Definitions by: Sam Verschueren +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "query-string" { + /** + * Parse a query string into an object. + * Leading ? or # are ignored, so you can pass location.search or location.hash directly. + * @param str + */ + export function parse(str: string): any; + + /** + * Stringify an object into a query string, sorting the keys. + * + * @param obj + */ + export function stringify(obj: any): string; + + /** + * Extract a query string from a URL that can be passed into .parse(). + * + * @param str + */ + export function extract(str: string): string; +} From a5ff255a5d98135895f2469da4f9caef13dd2e1a Mon Sep 17 00:00:00 2001 From: Rainer ziller Date: Thu, 26 Nov 2015 15:56:52 +0100 Subject: [PATCH 187/389] Add QunitAssert parameter to setup functions Add QunitAssert parameter to the setup, teardown, beforeEach and afterEach functions. This facilitates the usage of for example async code in the setup. --- qunit/qunit-tests.ts | 24 ++++++++++++++++++++++++ qunit/qunit.d.ts | 12 ++++++++---- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/qunit/qunit-tests.ts b/qunit/qunit-tests.ts index dd0335aed..9a3486118 100644 --- a/qunit/qunit-tests.ts +++ b/qunit/qunit-tests.ts @@ -170,6 +170,30 @@ QUnit.module("module A", { } }); +QUnit.module("module with async setup and teardown", { + setup: function (assert) { + var done = assert.async(); + setTimeout(function () { + // prepare something for all following tests + }); + }, + teardown: function (assert) { + // clean up after each test + } +}); + +QUnit.module("module with async setup and teardown", { + beforeEach: function (assert: QUnitAssert) { + var done = assert.async(); + setTimeout(function () { + // prepare something for all following tests + }); + }, + afterEach: function () { + // clean up after each test + } +}); + QUnit.test("a test", function (assert) { function square(x) { diff --git a/qunit/qunit.d.ts b/qunit/qunit.d.ts index fde535a68..98b513b9a 100644 --- a/qunit/qunit.d.ts +++ b/qunit/qunit.d.ts @@ -148,23 +148,27 @@ interface URLConfigItem { interface LifecycleObject { /** * Runs before each test + * @param assert * @deprecated */ - setup?: () => void; + setup?: (assert: QUnitAssert) => void; /** * Runs after each test + * @param assert * @deprecated */ - teardown?: () => void; + teardown?: (assert: QUnitAssert) => void; /** * Runs before each test + * @param assert */ - beforeEach?: () => void; + beforeEach?: (assert: QUnitAssert) => void; /** * Runs after each test + * @param assert */ - afterEach?: () => void; + afterEach?: (assert: QUnitAssert) => void; /** * Any additional properties on the hooks object will be added to that context. From 1e9df33f6baf97425a92090ca233d835dd8a756f Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Fri, 27 Nov 2015 01:10:41 +0900 Subject: [PATCH 188/389] Fix gulp-babel.d.ts --- gulp-babel/gulp-babel-tests.ts | 2 +- gulp-babel/gulp-babel.d.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gulp-babel/gulp-babel-tests.ts b/gulp-babel/gulp-babel-tests.ts index 75175cf6f..e5daf3617 100644 --- a/gulp-babel/gulp-babel-tests.ts +++ b/gulp-babel/gulp-babel-tests.ts @@ -1,7 +1,7 @@ /// /// -import babel from 'gulp-babel'; +import babel = require('gulp-babel'); var x: NodeJS.ReadWriteStream = babel(); var x: NodeJS.ReadWriteStream = babel({}); diff --git a/gulp-babel/gulp-babel.d.ts b/gulp-babel/gulp-babel.d.ts index 36846cac4..98d33881c 100644 --- a/gulp-babel/gulp-babel.d.ts +++ b/gulp-babel/gulp-babel.d.ts @@ -6,7 +6,7 @@ /// declare module 'gulp-babel' { - export default function(options?: { + function babel(options?: { filename?: string, filenameRelative?: string, presets?: string[], @@ -35,4 +35,6 @@ declare module 'gulp-babel' { env?: any, retainLines?: boolean }): NodeJS.ReadWriteStream; + + export = babel; } From 81516e3ef9fbd4aa349388173b31ac18815b2843 Mon Sep 17 00:00:00 2001 From: Attila Gazso Date: Thu, 26 Nov 2015 21:19:23 +0100 Subject: [PATCH 189/389] Added missing playsinline to PlayerVars As seen at https://developers.google.com/youtube/player_parameters --- youtube/youtube.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/youtube/youtube.d.ts b/youtube/youtube.d.ts index 6e5066cf9..a90ab4c88 100644 --- a/youtube/youtube.d.ts +++ b/youtube/youtube.d.ts @@ -44,6 +44,7 @@ declare module YT { origin?: string; playerpiid?: string; playlist?: string[]; + playsinline?: number; rel?: number; showinfo?: number; start?: number; From f172a40ea2dbae7accea16e6c5f058ca384dd739 Mon Sep 17 00:00:00 2001 From: Lukasz Potapczuk Date: Thu, 26 Nov 2015 21:25:22 +0100 Subject: [PATCH 190/389] Renamed ng-stomp test file --- ng-stomp/{ng-stomp-test.ts => ng-stomp-tests.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename ng-stomp/{ng-stomp-test.ts => ng-stomp-tests.ts} (100%) diff --git a/ng-stomp/ng-stomp-test.ts b/ng-stomp/ng-stomp-tests.ts similarity index 100% rename from ng-stomp/ng-stomp-test.ts rename to ng-stomp/ng-stomp-tests.ts From a8e7febb506b0c04222087368c0e155e80bbfb20 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Fri, 27 Nov 2015 04:51:57 +0500 Subject: [PATCH 191/389] lodash: signatures of _.forEach and _.forEachRight have been changed --- lodash/lodash.d.ts | 124 +++++++++++++++++++++++++++++---------------- 1 file changed, 80 insertions(+), 44 deletions(-) diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index ad465c5c3..53c98e9d7 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -4215,15 +4215,6 @@ declare module _ { //_.each interface LoDashStatic { - /** - * @see _.forEach - */ - each( - collection: string, - iteratee?: StringIterator, - thisArg?: any - ): string; - /** * @see _.forEach */ @@ -4250,6 +4241,24 @@ declare module _ { iteratee?: DictionaryIterator, thisArg?: any ): Dictionary; + + /** + * @see _.forEach + */ + each( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; + + /** + * @see _.forEach + */ + each( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; } interface LoDashImplicitWrapper { @@ -4257,7 +4266,7 @@ declare module _ { * @see _.forEach */ each( - iteratee: StringIterator, + iteratee: ListIterator, thisArg?: any ): LoDashImplicitWrapper; } @@ -4287,7 +4296,7 @@ declare module _ { * @see _.forEach */ each( - iteratee: StringIterator, + iteratee: ListIterator, thisArg?: any ): LoDashExplicitWrapper; } @@ -4314,15 +4323,6 @@ declare module _ { //_.eachRight interface LoDashStatic { - /** - * @see _.forEachRight - */ - eachRight( - collection: string, - iteratee?: StringIterator, - thisArg?: any - ): string; - /** * @see _.forEachRight */ @@ -4349,6 +4349,24 @@ declare module _ { iteratee?: DictionaryIterator, thisArg?: any ): Dictionary; + + /** + * @see _.forEachRight + */ + eachRight( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; + + /** + * @see _.forEachRight + */ + eachRight( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; } interface LoDashImplicitWrapper { @@ -4356,7 +4374,7 @@ declare module _ { * @see _.forEachRight */ eachRight( - iteratee: StringIterator, + iteratee: ListIterator, thisArg?: any ): LoDashImplicitWrapper; } @@ -4386,7 +4404,7 @@ declare module _ { * @see _.forEachRight */ eachRight( - iteratee: StringIterator, + iteratee: ListIterator, thisArg?: any ): LoDashExplicitWrapper; } @@ -5089,15 +5107,6 @@ declare module _ { * @param iteratee The function invoked per iteration. * @param thisArg The this binding of iteratee. */ - forEach( - collection: string, - iteratee?: StringIterator, - thisArg?: any - ): string; - - /** - * @see _.forEach - */ forEach( collection: T[], iteratee?: ListIterator, @@ -5121,6 +5130,24 @@ declare module _ { iteratee?: DictionaryIterator, thisArg?: any ): Dictionary; + + /** + * @see _.forEach + */ + forEach( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; + + /** + * @see _.forEach + */ + forEach( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; } interface LoDashImplicitWrapper { @@ -5128,7 +5155,7 @@ declare module _ { * @see _.forEach */ forEach( - iteratee: StringIterator, + iteratee: ListIterator, thisArg?: any ): LoDashImplicitWrapper; } @@ -5158,7 +5185,7 @@ declare module _ { * @see _.forEach */ forEach( - iteratee: StringIterator, + iteratee: ListIterator, thisArg?: any ): LoDashExplicitWrapper; } @@ -5194,15 +5221,6 @@ declare module _ { * @param iteratee The function called per iteration. * @param thisArg The this binding of callback. */ - forEachRight( - collection: string, - iteratee?: StringIterator, - thisArg?: any - ): string; - - /** - * @see _.forEachRight - */ forEachRight( collection: T[], iteratee?: ListIterator, @@ -5226,6 +5244,24 @@ declare module _ { iteratee?: DictionaryIterator, thisArg?: any ): Dictionary; + + /** + * @see _.forEachRight + */ + forEachRight( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; + + /** + * @see _.forEachRight + */ + forEachRight( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; } interface LoDashImplicitWrapper { @@ -5233,7 +5269,7 @@ declare module _ { * @see _.forEachRight */ forEachRight( - iteratee: StringIterator, + iteratee: ListIterator, thisArg?: any ): LoDashImplicitWrapper; } @@ -5263,7 +5299,7 @@ declare module _ { * @see _.forEachRight */ forEachRight( - iteratee: StringIterator, + iteratee: ListIterator, thisArg?: any ): LoDashExplicitWrapper; } From 06869f8867912caea060ef46014d9712f18d70c4 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Fri, 27 Nov 2015 05:47:07 +0500 Subject: [PATCH 192/389] lodash: signatures of _.findLastKey have been changed --- lodash/lodash-tests.ts | 28 ++++++++++++++++++++++++++-- lodash/lodash.d.ts | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 2 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index bdc08ccdc..a70ea2178 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6117,10 +6117,9 @@ module TestFindKey { // _.findLastKey module TestFindLastKey { - let result: string; - { let predicateFn: (value: any, key?: string, object?: {}) => boolean; + let result: string; result = _.findLastKey<{a: string;}>({a: ''}); @@ -6147,6 +6146,7 @@ module TestFindLastKey { { let predicateFn: (value: string, key?: string, collection?: _.Dictionary) => boolean; + let result: string; result = _.findLastKey({a: ''}, predicateFn); result = _.findLastKey({a: ''}, predicateFn, any); @@ -6154,6 +6154,30 @@ module TestFindLastKey { result = _<{a: string;}>({a: ''}).findLastKey(predicateFn); result = _<{a: string;}>({a: ''}).findLastKey(predicateFn, any); } + + { + let predicateFn: (value: any, key?: string, object?: {}) => boolean; + let result: _.LoDashExplicitWrapper; + + result = _<{a: string;}>({a: ''}).chain().findLastKey(); + + result = _<{a: string;}>({a: ''}).chain().findLastKey(predicateFn); + result = _<{a: string;}>({a: ''}).chain().findLastKey(predicateFn, any); + + + result = _<{a: string;}>({a: ''}).chain().findLastKey(''); + result = _<{a: string;}>({a: ''}).chain().findLastKey('', any); + + result = _<{a: string;}>({a: ''}).chain().findLastKey<{a: number;}>({a: 42}); + } + + { + let predicateFn: (value: string, key?: string, collection?: _.Dictionary) => boolean; + let result: _.LoDashExplicitWrapper; + + result = _<{a: string;}>({a: ''}).chain().findLastKey(predicateFn); + result = _<{a: string;}>({a: ''}).chain().findLastKey(predicateFn, any); + } } // _.forIn diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index ad465c5c3..0ccab9131 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -10544,6 +10544,39 @@ declare module _ { ): string; } + interface LoDashExplicitObjectWrapper { + /** + * @see _.findLastKey + */ + findLastKey( + predicate?: DictionaryIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findLastKey + */ + findLastKey( + predicate?: ObjectIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findLastKey + */ + findLastKey( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findLastKey + */ + findLastKey>( + predicate?: TWhere + ): LoDashExplicitWrapper; + } + //_.forIn interface LoDashStatic { /** From 3ea58099e4095399e4c1c79177876637dd3bbf99 Mon Sep 17 00:00:00 2001 From: Sabeeh Ul Hussnain Date: Fri, 27 Nov 2015 08:38:28 +0500 Subject: [PATCH 193/389] test updated and file renamed --- lobibox/{lobibox.js-test.ts => lobibox.js-tests.ts} | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) rename lobibox/{lobibox.js-test.ts => lobibox.js-tests.ts} (97%) diff --git a/lobibox/lobibox.js-test.ts b/lobibox/lobibox.js-tests.ts similarity index 97% rename from lobibox/lobibox.js-test.ts rename to lobibox/lobibox.js-tests.ts index bd0ff33d2..c5fe295a8 100644 --- a/lobibox/lobibox.js-test.ts +++ b/lobibox/lobibox.js-tests.ts @@ -5,7 +5,7 @@ /// - //Run test : LobiboxTest.test() + //Run test : LobiboxTest.test() after window load event class LobiboxTest { static test() { // extending default parameters @@ -138,3 +138,7 @@ class LobiboxTest { }); } } + +window.onload = (): void => { + Notify.error("test"); +}; From 33663d7a9ff040cbe309c8607c0e540adeaaca71 Mon Sep 17 00:00:00 2001 From: Sabeeh Ul Hussnain Date: Fri, 27 Nov 2015 08:41:41 +0500 Subject: [PATCH 194/389] test updated and file renamed --- lobibox/lobibox.js-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lobibox/lobibox.js-tests.ts b/lobibox/lobibox.js-tests.ts index c5fe295a8..78637114a 100644 --- a/lobibox/lobibox.js-tests.ts +++ b/lobibox/lobibox.js-tests.ts @@ -140,5 +140,5 @@ class LobiboxTest { } window.onload = (): void => { - Notify.error("test"); + LobiboxTest.test(); }; From 36b68a0023358c4c39ff49a9b330639e5c662a0f Mon Sep 17 00:00:00 2001 From: gcroteau Date: Thu, 26 Nov 2015 23:28:51 -0500 Subject: [PATCH 195/389] Added Aggregation definitions to turf.d.ts. --- turf/turf-test.ts | 70 +++++++++++++++++++++++++++++++++++++ turf/turf.d.ts | 88 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 158 insertions(+) diff --git a/turf/turf-test.ts b/turf/turf-test.ts index 5a8501c74..a6bb7e2ac 100644 --- a/turf/turf-test.ts +++ b/turf/turf-test.ts @@ -215,10 +215,80 @@ var triangle = { } }; +var aggregations = [ + { + aggregation: 'sum', + inField: 'population', + outField: 'pop_sum' + }, + { + aggregation: 'average', + inField: 'population', + outField: 'pop_avg' + }, + { + aggregation: 'median', + inField: 'population', + outField: 'pop_median' + }, + { + aggregation: 'min', + inField: 'population', + outField: 'pop_min' + }, + { + aggregation: 'max', + inField: 'population', + outField: 'pop_max' + }, + { + aggregation: 'deviation', + inField: 'population', + outField: 'pop_deviation' + }, + { + aggregation: 'variance', + inField: 'population', + outField: 'pop_variance' + }, + { + aggregation: 'count', + inField: '', + outField: 'point_count' + } +]; + ////////////////////////////////////////////////////////////////////////// // Tests Aggregation ////////////////////////////////////////////////////////////////////////// +// -- Test aggregate -- +var aggregated = turf.aggregate(polygons, points, aggregations); + +// -- Test average -- +var averaged = turf.average(polygons, points, 'population', 'pop_avg'); + +// -- Test count -- +var counted = turf.count(polygons, points, 'pt_count'); + +// -- Test deviation -- +var deviated = turf.deviation(polygons, points, 'population', 'pop_deviation'); + +// -- Test max -- +var aggregated = turf.max(polygons, points, 'population', 'max'); + +// -- Test median -- +var medians = turf.median(polygons, points, 'population', 'median'); + +// -- Test min -- +var minimums = turf.min(polygons, points, 'population', 'min'); + +// -- Test sum -- +var summed = turf.sum(polygons, points, 'population', 'sum'); + +// -- Test variance -- +var varianced = turf.variance(polygons, points, 'population', 'variance'); + ////////////////////////////////////////////////////////////////////////// // Tests Measurement ////////////////////////////////////////////////////////////////////////// diff --git a/turf/turf.d.ts b/turf/turf.d.ts index 0da75e33b..bbc84eac3 100644 --- a/turf/turf.d.ts +++ b/turf/turf.d.ts @@ -10,6 +10,94 @@ declare module turf { // Aggregation ////////////////////////////////////////////////////// + /** + * Calculates a series of aggregations for a set of points within a set of polygons. Sum, average, count, min, max, and deviation are supported. + * @param polygons Polygons with values on which to aggregate + * @param points Points to be aggregated + * @param aggregations An array of aggregation objects + * @returns Polygons with properties listed based on outField values in aggregations + */ + function aggregate(polygons: GeoJSON.FeatureCollection, points: GeoJSON.FeatureCollection, aggregations: Array<{aggregation: string, inField: string, outField: string}>): GeoJSON.FeatureCollection; + + /** + * Calculates the average value of a field for a set of points within a set of polygons. + * @param polygons Polygons with values on which to average + * @param points Points from which to calculate the average + * @param field The field in the points features from which to pull values to average + * @param outField The field in polygons to put results of the averages + * @returns Polygons with the value of outField set to the calculated averages + */ + function average(polygons: GeoJSON.FeatureCollection, points: GeoJSON.FeatureCollection, field: string, outField: string): GeoJSON.FeatureCollection; + + /** + * Takes a set of points and a set of polygons and calculates the number of points that fall within the set of polygons. + * @param polygons Input polygons + * @param points Input points + * @param countField A field to append to the attributes of the Polygon features representing Point counts + * @returns Polygons with countField appended + */ + function count(polygons: GeoJSON.FeatureCollection, points: GeoJSON.FeatureCollection, countField: string): GeoJSON.FeatureCollection; + + /** + * Calculates the standard deviation value of a field for a set of points within a set of polygons. + * @param polygons Input polygons + * @param points Input points + * @param inField The field in points from which to aggregate + * @param outField The field to append to polygons representing deviation + * @returns Polygons with appended field representing deviation + */ + function deviation(polygons: GeoJSON.FeatureCollection, points: GeoJSON.FeatureCollection, inField: string, outField: string): GeoJSON.FeatureCollection; + + /** + * Calculates the maximum value of a field for a set of points within a set of polygons. + * @param polygons Input polygons + * @param points Input points + * @param inField The field in input data to analyze + * @param outField The field in which to store results + * @returns Polygons with properties listed as outField values + */ + function max(polygons: GeoJSON.FeatureCollection, points: GeoJSON.FeatureCollection, inField: string, outField: string): GeoJSON.FeatureCollection; + + /** + * Calculates the median value of a field for a set of points within a set of polygons. + * @param polygons Input polygons + * @param points Input points + * @param inField The field in input data to analyze + * @param outField The field in which to store results + * @returns Polygons with properties listed as outField values + */ + function median(polygons: GeoJSON.FeatureCollection, points: GeoJSON.FeatureCollection, inField: string, outField: string): GeoJSON.FeatureCollection; + + /** + * Calculates the minimum value of a field for a set of points within a set of polygons. + * @param polygons Input polygons + * @param points Input points + * @param inField The field in input data to analyze + * @param outField The field in which to store results + * @returns Polygons with properties listed as outField values + */ + function min(polygons: GeoJSON.FeatureCollection, points: GeoJSON.FeatureCollection, inField: string, outField: string): GeoJSON.FeatureCollection; + + /** + * Calculates the sum of a field for a set of points within a set of polygons. + * @param polygons Input polygons + * @param points Input points + * @param inField The field in input data to analyze + * @param outField The field in which to store results + * @returns Polygons with properties listed as outField + */ + function sum(polygons: GeoJSON.FeatureCollection, points: GeoJSON.FeatureCollection, inField: string, outField: string): GeoJSON.FeatureCollection; + + /** + * Calculates the variance value of a field for a set of points within a set of polygons. + * @param polygons Input polygons + * @param points Input points + * @param inField The field in input data to analyze + * @param outField The field in which to store results + * @returns Polygons with properties listed as outField + */ + function variance(polygons: GeoJSON.FeatureCollection, points: GeoJSON.FeatureCollection, inField: string, outField: string): GeoJSON.FeatureCollection; + ////////////////////////////////////////////////////// // Measurement ////////////////////////////////////////////////////// From d7e89a66fd7ffc56bee5e8a226fc7145a17f7b86 Mon Sep 17 00:00:00 2001 From: Vasya Aksyonov Date: Fri, 27 Nov 2015 15:18:18 +0500 Subject: [PATCH 196/389] js-combinatorics typings and tests --- .../js-combinatorics-global-tests.ts | 93 ++++++++++++ js-combinatorics/js-combinatorics-global.d.ts | 8 ++ js-combinatorics/js-combinatorics-tests.ts | 95 ++++++++++++ js-combinatorics/js-combinatorics.d.ts | 135 ++++++++++++++++++ 4 files changed, 331 insertions(+) create mode 100644 js-combinatorics/js-combinatorics-global-tests.ts create mode 100644 js-combinatorics/js-combinatorics-global.d.ts create mode 100644 js-combinatorics/js-combinatorics-tests.ts create mode 100644 js-combinatorics/js-combinatorics.d.ts diff --git a/js-combinatorics/js-combinatorics-global-tests.ts b/js-combinatorics/js-combinatorics-global-tests.ts new file mode 100644 index 000000000..b8cbd3525 --- /dev/null +++ b/js-combinatorics/js-combinatorics-global-tests.ts @@ -0,0 +1,93 @@ +/// + +const p:number = Combinatorics.P(1, 2); +const c:number = Combinatorics.C(1, 2); +const factorial:number = Combinatorics.factorial(5); +const factoradic:number[] = Combinatorics.factoradic(5); + +const power = Combinatorics.power(["a", "b", "c"]); +const nextPower:string[] = power.next(); +power.forEach((i:string[]) => console.log(i)); +const powersLengths:number[] = power.map((i:string[]) => i.length); +const filteredPowers:string[][] = power.filter((i:string[]) => i.length > 0); +const allPowers:string[][] = power.toArray(); +const powersCount = power.length; +const nthPower:string[] = power.nth(3); + +const limitedCombination = Combinatorics.combination(["a", "b", "c"], 2); +const combination = Combinatorics.combination(["a", "b", "c"]); +const nextCombination:string[] = combination.next(); +combination.forEach((i:string[]) => console.log(i)); +const combinationsLengths:number[] = combination.map((i:string[]) => i.length); +const filteredCombinations:string[][] = combination.filter((i:string[]) => i.length > 0); +const allCombinations:string[][] = combination.toArray(); +const combinationsCount = combination.length; + +const limitedPermutation = Combinatorics.permutation(["a", "b", "c"], 2); +const permutation = Combinatorics.permutation(["a", "b", "c"]); +const nextPermutation:string[] = permutation.next(); +permutation.forEach((i:string[]) => console.log(i)); +const permutationsLengths:number[] = permutation.map((i:string[]) => i.length); +const filteredPermutations:string[][] = permutation.filter((i:string[]) => i.length > 0); +const allPermutations:string[][] = permutation.toArray(); +const permutationsCount = permutation.length; + +const permutationCombination = Combinatorics.permutationCombination(["a", "b", "c"]); +const nextPermutationCombinations:string[] = permutationCombination.next(); +permutationCombination.forEach((i:string[]) => console.log(i)); +const permutationCombinationsLengths:number[] = permutationCombination.map((i:string[]) => i.length); +const filteredPermutationCombinationss:string[][] = permutationCombination.filter((i:string[]) => i.length > 0); +const allPermutationCombinationss:string[][] = permutationCombination.toArray(); +const permutationCombinationsCount = permutationCombination.length; + +const limitedBaseN = Combinatorics.baseN(["a", "b", "c"], 2); +const baseN = Combinatorics.baseN(["a", "b", "c"]); +const nextbaseN:string[] = baseN.next(); +baseN.forEach((i:string[]) => console.log(i)); +const baseNsLengths:number[] = baseN.map((i:string[]) => i.length); +const filteredbaseNs:string[][] = baseN.filter((i:string[]) => i.length > 0); +const allbaseNs:string[][] = baseN.toArray(); +const baseNsCount = baseN.length; +const nthbaseN:string[] = baseN.nth(3); + +const cartesianProduct1 = Combinatorics.cartesianProduct(["a", "b", "c"]); +const nextCartesianProduct1:[string] = cartesianProduct1.next(); +cartesianProduct1.forEach((i:[string]) => console.log(i)); +const cartesianProduct1sLengths:number[] = cartesianProduct1.map((i:[string]) => i.length); +const filteredCartesianProduct1s:[string][] = cartesianProduct1.filter((i:[string]) => i.length > 0); +const allCartesianProduct1s:[string][] = cartesianProduct1.toArray(); +const cartesianProduct1sCount = cartesianProduct1.length; +const nthCartesianProduct1:[string] = cartesianProduct1.nth(3); +const cartesianProduct1ByCoords:[string] = cartesianProduct1.get(1); + +const cartesianProduct2 = Combinatorics.cartesianProduct(["a", "b", "c"], [1, 2, 3]); +const nextCartesianProduct2:[string, number] = cartesianProduct2.next(); +cartesianProduct2.forEach((i:[string, number]) => console.log(i)); +const cartesianProduct2sLengths:number[] = cartesianProduct2.map((i:[string, number]) => i.length); +const filteredCartesianProduct2s:[string, number][] = cartesianProduct2.filter((i:[string, number]) => i.length > 0); +const allCartesianProduct2s:[string, number][] = cartesianProduct2.toArray(); +const cartesianProduct2sCount = cartesianProduct2.length; +const nthCartesianProduct2:[string, number] = cartesianProduct2.nth(3); +const cartesianProduct2ByCoords:[string, number] = cartesianProduct2.get(1, 1); + +const cartesianProduct3 = Combinatorics.cartesianProduct(["a", "b", "c"], [1, 2, 3], [true, false]); +const nextCartesianProduct3:[string, number, boolean] = cartesianProduct3.next(); +cartesianProduct3.forEach((i:[string, number, boolean]) => console.log(i)); +const cartesianProduct3sLengths:number[] = cartesianProduct3.map((i:[string, number, boolean]) => i.length); +const filteredCartesianProduct3s:[string, number, boolean][] = cartesianProduct3.filter((i:[string, number, boolean]) => i.length > 0); +const allCartesianProduct3s:[string, number, boolean][] = cartesianProduct3.toArray(); +const cartesianProduct3sCount = cartesianProduct3.length; +const nthCartesianProduct3:[string, number, boolean] = cartesianProduct3.nth(3); +const cartesianProduct3ByCoords:[string, number, boolean] = cartesianProduct3.get(1, 1); + +const cartesianProductAny = Combinatorics.cartesianProduct(["a", 1, true], [false, 2, "b"]); +const nextCartesianProductAny:any[] = cartesianProductAny.next(); +cartesianProductAny.forEach((i:any[]) => console.log(i)); +const cartesianProductAnysLengths:number[] = cartesianProductAny.map((i:any[]) => i.length); +const filteredCartesianProductAnys:any[][] = cartesianProductAny.filter((i:any[]) => i.length > 0); +const allCartesianProductAnys:any[][] = cartesianProductAny.toArray(); +const cartesianProductAnysCount = cartesianProductAny.length; +const nthCartesianProductAny:any[] = cartesianProductAny.nth(3); +const cartesianProductAnyByCoords:any[] = cartesianProductAny.get(1, 1); + +const version:string = Combinatorics.VERSION; \ No newline at end of file diff --git a/js-combinatorics/js-combinatorics-global.d.ts b/js-combinatorics/js-combinatorics-global.d.ts new file mode 100644 index 000000000..20c302981 --- /dev/null +++ b/js-combinatorics/js-combinatorics-global.d.ts @@ -0,0 +1,8 @@ +// Type definitions for js-combinatorics v0.5.0 (global) +// Project: https://github.com/dankogai/js-combinatorics +// Definitions by: Vasya Aksyonov +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +import Combinatorics = __Combinatorics; diff --git a/js-combinatorics/js-combinatorics-tests.ts b/js-combinatorics/js-combinatorics-tests.ts new file mode 100644 index 000000000..08e04c374 --- /dev/null +++ b/js-combinatorics/js-combinatorics-tests.ts @@ -0,0 +1,95 @@ +/// + +import * as Combinatorics from "js-combinatorics"; + +const p:number = Combinatorics.P(1, 2); +const c:number = Combinatorics.C(1, 2); +const factorial:number = Combinatorics.factorial(5); +const factoradic:number[] = Combinatorics.factoradic(5); + +const power = Combinatorics.power(["a", "b", "c"]); +const nextPower:string[] = power.next(); +power.forEach((i:string[]) => console.log(i)); +const powersLengths:number[] = power.map((i:string[]) => i.length); +const filteredPowers:string[][] = power.filter((i:string[]) => i.length > 0); +const allPowers:string[][] = power.toArray(); +const powersCount = power.length; +const nthPower:string[] = power.nth(3); + +const limitedCombination = Combinatorics.combination(["a", "b", "c"], 2); +const combination = Combinatorics.combination(["a", "b", "c"]); +const nextCombination:string[] = combination.next(); +combination.forEach((i:string[]) => console.log(i)); +const combinationsLengths:number[] = combination.map((i:string[]) => i.length); +const filteredCombinations:string[][] = combination.filter((i:string[]) => i.length > 0); +const allCombinations:string[][] = combination.toArray(); +const combinationsCount = combination.length; + +const limitedPermutation = Combinatorics.permutation(["a", "b", "c"], 2); +const permutation = Combinatorics.permutation(["a", "b", "c"]); +const nextPermutation:string[] = permutation.next(); +permutation.forEach((i:string[]) => console.log(i)); +const permutationsLengths:number[] = permutation.map((i:string[]) => i.length); +const filteredPermutations:string[][] = permutation.filter((i:string[]) => i.length > 0); +const allPermutations:string[][] = permutation.toArray(); +const permutationsCount = permutation.length; + +const permutationCombination = Combinatorics.permutationCombination(["a", "b", "c"]); +const nextPermutationCombinations:string[] = permutationCombination.next(); +permutationCombination.forEach((i:string[]) => console.log(i)); +const permutationCombinationsLengths:number[] = permutationCombination.map((i:string[]) => i.length); +const filteredPermutationCombinationss:string[][] = permutationCombination.filter((i:string[]) => i.length > 0); +const allPermutationCombinationss:string[][] = permutationCombination.toArray(); +const permutationCombinationsCount = permutationCombination.length; + +const limitedBaseN = Combinatorics.baseN(["a", "b", "c"], 2); +const baseN = Combinatorics.baseN(["a", "b", "c"]); +const nextbaseN:string[] = baseN.next(); +baseN.forEach((i:string[]) => console.log(i)); +const baseNsLengths:number[] = baseN.map((i:string[]) => i.length); +const filteredbaseNs:string[][] = baseN.filter((i:string[]) => i.length > 0); +const allbaseNs:string[][] = baseN.toArray(); +const baseNsCount = baseN.length; +const nthbaseN:string[] = baseN.nth(3); + +const cartesianProduct1 = Combinatorics.cartesianProduct(["a", "b", "c"]); +const nextCartesianProduct1:[string] = cartesianProduct1.next(); +cartesianProduct1.forEach((i:[string]) => console.log(i)); +const cartesianProduct1sLengths:number[] = cartesianProduct1.map((i:[string]) => i.length); +const filteredCartesianProduct1s:[string][] = cartesianProduct1.filter((i:[string]) => i.length > 0); +const allCartesianProduct1s:[string][] = cartesianProduct1.toArray(); +const cartesianProduct1sCount = cartesianProduct1.length; +const nthCartesianProduct1:[string] = cartesianProduct1.nth(3); +const cartesianProduct1ByCoords:[string] = cartesianProduct1.get(1); + +const cartesianProduct2 = Combinatorics.cartesianProduct(["a", "b", "c"], [1, 2, 3]); +const nextCartesianProduct2:[string, number] = cartesianProduct2.next(); +cartesianProduct2.forEach((i:[string, number]) => console.log(i)); +const cartesianProduct2sLengths:number[] = cartesianProduct2.map((i:[string, number]) => i.length); +const filteredCartesianProduct2s:[string, number][] = cartesianProduct2.filter((i:[string, number]) => i.length > 0); +const allCartesianProduct2s:[string, number][] = cartesianProduct2.toArray(); +const cartesianProduct2sCount = cartesianProduct2.length; +const nthCartesianProduct2:[string, number] = cartesianProduct2.nth(3); +const cartesianProduct2ByCoords:[string, number] = cartesianProduct2.get(1, 1); + +const cartesianProduct3 = Combinatorics.cartesianProduct(["a", "b", "c"], [1, 2, 3], [true, false]); +const nextCartesianProduct3:[string, number, boolean] = cartesianProduct3.next(); +cartesianProduct3.forEach((i:[string, number, boolean]) => console.log(i)); +const cartesianProduct3sLengths:number[] = cartesianProduct3.map((i:[string, number, boolean]) => i.length); +const filteredCartesianProduct3s:[string, number, boolean][] = cartesianProduct3.filter((i:[string, number, boolean]) => i.length > 0); +const allCartesianProduct3s:[string, number, boolean][] = cartesianProduct3.toArray(); +const cartesianProduct3sCount = cartesianProduct3.length; +const nthCartesianProduct3:[string, number, boolean] = cartesianProduct3.nth(3); +const cartesianProduct3ByCoords:[string, number, boolean] = cartesianProduct3.get(1, 1); + +const cartesianProductAny = Combinatorics.cartesianProduct(["a", 1, true], [false, 2, "b"]); +const nextCartesianProductAny:any[] = cartesianProductAny.next(); +cartesianProductAny.forEach((i:any[]) => console.log(i)); +const cartesianProductAnysLengths:number[] = cartesianProductAny.map((i:any[]) => i.length); +const filteredCartesianProductAnys:any[][] = cartesianProductAny.filter((i:any[]) => i.length > 0); +const allCartesianProductAnys:any[][] = cartesianProductAny.toArray(); +const cartesianProductAnysCount = cartesianProductAny.length; +const nthCartesianProductAny:any[] = cartesianProductAny.nth(3); +const cartesianProductAnyByCoords:any[] = cartesianProductAny.get(1, 1); + +const version:string = Combinatorics.VERSION; diff --git a/js-combinatorics/js-combinatorics.d.ts b/js-combinatorics/js-combinatorics.d.ts new file mode 100644 index 000000000..270e98b64 --- /dev/null +++ b/js-combinatorics/js-combinatorics.d.ts @@ -0,0 +1,135 @@ +// Type definitions for js-combinatorics v0.5.0 +// Project: https://github.com/dankogai/js-combinatorics +// Definitions by: Vasya Aksyonov +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare namespace __Combinatorics { + + interface IGenerator { + + /** + * Returns the element or undefined if no more element is available. + */ + next():T; + + /** + * Applies the callback function for each element. + */ + forEach(f:(item:T) => void):void; + + /** + * All elements at once with function applied to each element. + */ + map(f:(item:T) => TResult):TResult[]; + + /** + * Returns an array with elements that passes the filter function. + */ + filter(predicate:(item:T) => boolean):T[]; + + /** + * All elements at once. + */ + toArray():T[]; + + /** + * Returns the number of elements to be generated which equals to generator.toArray().length + * but it is precalculated without actually generating elements. + * Handy when you prepare for large iteration. + */ + length:number; + + } + + interface IPredictableGenerator extends IGenerator { + + /** + * Returns the nth element (starting 0). + */ + nth(n:number):T; + + } + + interface ICartesianProductGenerator extends IPredictableGenerator { + + /** + * Arguments are coordinates in integer. + * Arguments can be out of bounds but it returns undefined in such cases. + */ + get(...coordinates:number[]):T; + + } + + /** + * Calculates m P n + */ + function P(m:number, n:number):number; + + /** + * Calculates m C n + */ + function C(m:number, n:number):number; + + /** + * Calculates n! + */ + function factorial(n:number):number; + + /** + * Returns the factoradic representation of n in array, in least significant order. + * See http://en.wikipedia.org/wiki/Factorial_number_system + */ + function factoradic(n:number):number[]; + + /** + * Generates the power set of array. + */ + function power(a:T[]):IPredictableGenerator; + + /** + * Generates the combination of array with n elements. + * When n is ommited, the length of the array is used. + */ + function combination(a:T[], n?:number):IGenerator; + + /** + * Generates the permutation of array with n elements. + * When n is ommited, the length of the array is used. + */ + function permutation(a:T[], n?:number):IGenerator; + + /** + * Generates the permutation of the combination of n. + * Equivalent to permutation(combination(a)), but more efficient. + */ + function permutationCombination(a:T[]):IGenerator; + + /** + * Generates n-digit "numbers" where each digit is an element in array. + * Note this "number" is in the least significant order. + * When n is ommited, the length of the array is used. + */ + function baseN(a:T[], n?:number):IPredictableGenerator; + + /** + * Generates the cartesian product of the arrays. All arguments must be arrays with more than one element. + */ + function cartesianProduct(a1:T1[]):ICartesianProductGenerator<[T1]>; + function cartesianProduct(a1:T1[], a2:T2[]):ICartesianProductGenerator<[T1, T2]>; + function cartesianProduct(a1:T1[], a2:T2[], a3:T3[]):ICartesianProductGenerator<[T1, T2, T3]>; + function cartesianProduct(a1:T1[], a2:T2[], a3:T3[], a4:T4[]):ICartesianProductGenerator<[T1, T2, T3, T4]>; + function cartesianProduct(a1:T1[], a2:T2[], a3:T3[], a4:T4[], a5:T5[]):ICartesianProductGenerator<[T1, T2, T3, T4, T5]>; + function cartesianProduct(a1:T1[], a2:T2[], a3:T3[], a4:T4[], a5:T5[], a6:T6[]):ICartesianProductGenerator<[T1, T2, T3, T4, T5, T6]>; + function cartesianProduct(a1:T1[], a2:T2[], a3:T3[], a4:T4[], a5:T5[], a6:T6[], a7:T7[]):ICartesianProductGenerator<[T1, T2, T3, T4, T5, T6, T7]>; + function cartesianProduct(a1:T1[], a2:T2[], a3:T3[], a4:T4[], a5:T5[], a6:T6[], a7:T7[], a8:T8[]):ICartesianProductGenerator<[T1, T2, T3, T4, T5, T6, T7, T8]>; + function cartesianProduct(a1:T1[], a2:T2[], a3:T3[], a4:T4[], a5:T5[], a6:T6[], a7:T7[], a8:T8[], a9:T9[]):ICartesianProductGenerator<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; + function cartesianProduct(a1:T1[], a2:T2[], a3:T3[], a4:T4[], a5:T5[], a6:T6[], a7:T7[], a8:T8[], a9:T9[], a10:T10[]):ICartesianProductGenerator<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; + function cartesianProduct(...a:any[][]):ICartesianProductGenerator; + + const VERSION:string; + +} + +declare module "js-combinatorics" { + export = __Combinatorics; +} From 211643619c5a47c2fc338a8d6ff71771a2ac1370 Mon Sep 17 00:00:00 2001 From: Vasya Aksyonov Date: Fri, 27 Nov 2015 15:25:35 +0500 Subject: [PATCH 197/389] More cartesian product typings --- js-combinatorics/js-combinatorics-global-tests.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/js-combinatorics/js-combinatorics-global-tests.ts b/js-combinatorics/js-combinatorics-global-tests.ts index b8cbd3525..e8591fbc2 100644 --- a/js-combinatorics/js-combinatorics-global-tests.ts +++ b/js-combinatorics/js-combinatorics-global-tests.ts @@ -52,6 +52,7 @@ const nthbaseN:string[] = baseN.nth(3); const cartesianProduct1 = Combinatorics.cartesianProduct(["a", "b", "c"]); const nextCartesianProduct1:[string] = cartesianProduct1.next(); +const nextCartesianProduct1Char = nextCartesianProduct1[0].substr(0, 1); cartesianProduct1.forEach((i:[string]) => console.log(i)); const cartesianProduct1sLengths:number[] = cartesianProduct1.map((i:[string]) => i.length); const filteredCartesianProduct1s:[string][] = cartesianProduct1.filter((i:[string]) => i.length > 0); @@ -62,6 +63,8 @@ const cartesianProduct1ByCoords:[string] = cartesianProduct1.get(1); const cartesianProduct2 = Combinatorics.cartesianProduct(["a", "b", "c"], [1, 2, 3]); const nextCartesianProduct2:[string, number] = cartesianProduct2.next(); +const nextCartesianProduct2Char = nextCartesianProduct2[0].substr(0, 1); +const nextCartesianProduct2Num = nextCartesianProduct2[1].toFixed(2); cartesianProduct2.forEach((i:[string, number]) => console.log(i)); const cartesianProduct2sLengths:number[] = cartesianProduct2.map((i:[string, number]) => i.length); const filteredCartesianProduct2s:[string, number][] = cartesianProduct2.filter((i:[string, number]) => i.length > 0); @@ -72,6 +75,9 @@ const cartesianProduct2ByCoords:[string, number] = cartesianProduct2.get(1, 1); const cartesianProduct3 = Combinatorics.cartesianProduct(["a", "b", "c"], [1, 2, 3], [true, false]); const nextCartesianProduct3:[string, number, boolean] = cartesianProduct3.next(); +const nextCartesianProduct3Char = nextCartesianProduct3[0].substr(0, 1); +const nextCartesianProduct3Num = nextCartesianProduct3[1].toFixed(2); +const nextCartesianProduct4Cond = nextCartesianProduct3[2] === true; cartesianProduct3.forEach((i:[string, number, boolean]) => console.log(i)); const cartesianProduct3sLengths:number[] = cartesianProduct3.map((i:[string, number, boolean]) => i.length); const filteredCartesianProduct3s:[string, number, boolean][] = cartesianProduct3.filter((i:[string, number, boolean]) => i.length > 0); @@ -90,4 +96,4 @@ const cartesianProductAnysCount = cartesianProductAny.length; const nthCartesianProductAny:any[] = cartesianProductAny.nth(3); const cartesianProductAnyByCoords:any[] = cartesianProductAny.get(1, 1); -const version:string = Combinatorics.VERSION; \ No newline at end of file +const version:string = Combinatorics.VERSION; From 0dd5ad7c0f031515546c90aa1faf06054c46ce83 Mon Sep 17 00:00:00 2001 From: Marcin Porebski Date: Fri, 27 Nov 2015 13:44:42 +0100 Subject: [PATCH 198/389] Wreck 7.0.0 typings --- wreck/wreck-tests.ts | 41 ++++++++++++++++++++++++++++++++++++++++ wreck/wreck.d.ts | 45 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 wreck/wreck-tests.ts create mode 100644 wreck/wreck.d.ts diff --git a/wreck/wreck-tests.ts b/wreck/wreck-tests.ts new file mode 100644 index 000000000..b1e8b0d0b --- /dev/null +++ b/wreck/wreck-tests.ts @@ -0,0 +1,41 @@ +/// + +import Wreck = require('wreck'); + +Wreck.get('https://google.com/', function (err, res, payload) { + /* do stuff */ +}); + + +var method = 'GET'; // GET, POST, PUT, DELETE +var uri = 'https://google.com/'; +var readableStream = Wreck.toReadableStream('foo=bar'); + +var wreck = Wreck.defaults({ + headers: { 'x-foo-bar': 123 } +}); + +// cascading example -- does not alter `wreck` +var wreckWithTimeout = wreck.defaults({ + timeout: 5 +}); + +// all attributes are optional +var options = { + maxBytes: 1048576, // 1 MB, default: unlimited + rejectUnauthorized: true, + downstreamRes: null, + agent: null, // Node Core http.Agent +}; + +var optionalCallback = function (err, res) { + + /* handle err if it exists, in which case res will be undefined */ + + // buffer the response stream + Wreck.read(res, null, function (err, body) { + /* do stuff */ + }); +}; + +var req = wreck.request(method, uri, options, optionalCallback); diff --git a/wreck/wreck.d.ts b/wreck/wreck.d.ts new file mode 100644 index 000000000..7198de2bb --- /dev/null +++ b/wreck/wreck.d.ts @@ -0,0 +1,45 @@ +// Type definitions for wreck 7.0.0 +// Project: https://github.com/hapijs/wreck +// Definitions by: Marcin Porębski +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module Wreck +{ + import http = require('http'); + import stream = require('stream'); + + + interface IWreckObject + { + defaults: (options: any) => IWreckObject; + + request: (method: string, uri: string, options: any = null, callback: (err: any, response: http.IncomingMessage) => void = null) => http.ClientRequest; + + read: (response: http.IncomingMessage, options: any, callback: (err: any, payload: any) => void) => void; + + get: (uri: string, options: any = null, callback: (err: any, response: http.IncomingMessage, payload: any) => void = null) => http.ClientRequest; + post: (uri: string, options: any = null, callback: (err: any, response: http.IncomingMessage, payload: any) => void = null) => http.ClientRequest; + patch: (uri: string, options: any = null, callback: (err: any, response: http.IncomingMessage, payload: any) => void = null) => http.ClientRequest; + put: (uri: string, options: any = null, callback: (err: any, response: http.IncomingMessage, payload: any) => void = null) => http.ClientRequest; + delete: (uri: string, options: any = null, callback: (err: any, response: http.IncomingMessage, payload: any) => void = null) => http.ClientRequest; + + toReadableStream: (payload: any, encoding: string = null) => stream.Readable; + + parseCacheControl: (field: string) => any; + + agents: { + http: http.Agent, + https: http.Agent + }; + } + +} + +declare module "wreck" +{ + var wreck: Wreck.IWreckObject; + + export = wreck; +} From 117d429754f3f0a52ae903c3203e0a703022f488 Mon Sep 17 00:00:00 2001 From: Marcin Porebski Date: Fri, 27 Nov 2015 13:53:54 +0100 Subject: [PATCH 199/389] Wreck 7.0.0 typings - fixes --- wreck/wreck-tests.ts | 10 ++++------ wreck/wreck.d.ts | 22 +++++++++------------- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/wreck/wreck-tests.ts b/wreck/wreck-tests.ts index b1e8b0d0b..6e7abab0e 100644 --- a/wreck/wreck-tests.ts +++ b/wreck/wreck-tests.ts @@ -2,7 +2,7 @@ import Wreck = require('wreck'); -Wreck.get('https://google.com/', function (err, res, payload) { +Wreck.get('https://google.com/', {}, function (err: any, res: any, payload: any) { /* do stuff */ }); @@ -23,17 +23,15 @@ var wreckWithTimeout = wreck.defaults({ // all attributes are optional var options = { maxBytes: 1048576, // 1 MB, default: unlimited - rejectUnauthorized: true, - downstreamRes: null, - agent: null, // Node Core http.Agent + rejectUnauthorized: true }; -var optionalCallback = function (err, res) { +var optionalCallback = function (err: any, res: any) { /* handle err if it exists, in which case res will be undefined */ // buffer the response stream - Wreck.read(res, null, function (err, body) { + Wreck.read(res, null, function (err: any, body: any) { /* do stuff */ }); }; diff --git a/wreck/wreck.d.ts b/wreck/wreck.d.ts index 7198de2bb..135b2f4f2 100644 --- a/wreck/wreck.d.ts +++ b/wreck/wreck.d.ts @@ -5,7 +5,7 @@ /// -declare module Wreck +declare module "wreck" { import http = require('http'); import stream = require('stream'); @@ -15,17 +15,17 @@ declare module Wreck { defaults: (options: any) => IWreckObject; - request: (method: string, uri: string, options: any = null, callback: (err: any, response: http.IncomingMessage) => void = null) => http.ClientRequest; + request: (method: string, uri: string, options: any, callback?: (err: any, response: http.IncomingMessage) => void) => http.ClientRequest; read: (response: http.IncomingMessage, options: any, callback: (err: any, payload: any) => void) => void; - get: (uri: string, options: any = null, callback: (err: any, response: http.IncomingMessage, payload: any) => void = null) => http.ClientRequest; - post: (uri: string, options: any = null, callback: (err: any, response: http.IncomingMessage, payload: any) => void = null) => http.ClientRequest; - patch: (uri: string, options: any = null, callback: (err: any, response: http.IncomingMessage, payload: any) => void = null) => http.ClientRequest; - put: (uri: string, options: any = null, callback: (err: any, response: http.IncomingMessage, payload: any) => void = null) => http.ClientRequest; - delete: (uri: string, options: any = null, callback: (err: any, response: http.IncomingMessage, payload: any) => void = null) => http.ClientRequest; + get: (uri: string, options: any, callback: (err: any, response: http.IncomingMessage, payload: any) => void) => http.ClientRequest; + post: (uri: string, options: any, callback: (err: any, response: http.IncomingMessage, payload: any) => void) => http.ClientRequest; + patch: (uri: string, options: any, callback: (err: any, response: http.IncomingMessage, payload: any) => void) => http.ClientRequest; + put: (uri: string, options: any, callback: (err: any, response: http.IncomingMessage, payload: any) => void) => http.ClientRequest; + delete: (uri: string, options: any, callback: (err: any, response: http.IncomingMessage, payload: any) => void) => http.ClientRequest; - toReadableStream: (payload: any, encoding: string = null) => stream.Readable; + toReadableStream: (payload: any, encoding?: string) => stream.Readable; parseCacheControl: (field: string) => any; @@ -35,11 +35,7 @@ declare module Wreck }; } -} - -declare module "wreck" -{ - var wreck: Wreck.IWreckObject; + var wreck: IWreckObject; export = wreck; } From 5b7b0dcf88d01d13148e16da14c28faf864cf48c Mon Sep 17 00:00:00 2001 From: Roman Krivtsov Date: Fri, 27 Nov 2015 17:22:16 +0100 Subject: [PATCH 200/389] New typings for fs-extra --- fs-extra/fs-extra.d.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/fs-extra/fs-extra.d.ts b/fs-extra/fs-extra.d.ts index 852956a71..d997d12a8 100644 --- a/fs-extra/fs-extra.d.ts +++ b/fs-extra/fs-extra.d.ts @@ -167,6 +167,15 @@ declare module "fs-extra" { export function exists(path: string, callback?: (exists: boolean) => void ): void; export function existsSync(path: string): boolean; export function ensureDir(path: string, cb: (err: Error) => void): void; + export function ensureDirSync(path: string): void; + export function ensureFile(path: string, cb: (err: Error) => void): void; + export function ensureFileSync(path: string): void; + export function ensureLink(path: string, cb: (err: Error) => void): void; + export function ensureLinkSync(path: string): void; + export function ensureSymlink(path: string, cb: (err: Error) => void): void; + export function ensureSymlinkSync(path: string): void; + export function emptyDir(path: string, callback?: (err: Error) => void): void; + export function emptyDirSync(path: string): boolean; export interface OpenOptions { encoding?: string; @@ -192,4 +201,5 @@ declare module "fs-extra" { } export function createReadStream(path: string, options?: ReadStreamOptions): ReadStream; export function createWriteStream(path: string, options?: WriteStreamOptions): WriteStream; + export function createOutputStream(path: string, options?: WriteStreamOptions): WriteStream; } From 6d5f4d98b5a55b77f1ec0bcfad860007eaa3ee26 Mon Sep 17 00:00:00 2001 From: Roman Krivtsov Date: Fri, 27 Nov 2015 17:35:42 +0100 Subject: [PATCH 201/389] Fs-extra new typings tests --- fs-extra/fs-extra-tests.ts | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/fs-extra/fs-extra-tests.ts b/fs-extra/fs-extra-tests.ts index 0919ef1b0..80655ab5b 100644 --- a/fs-extra/fs-extra-tests.ts +++ b/fs-extra/fs-extra-tests.ts @@ -45,6 +45,7 @@ var openOpts: fs.OpenOptions; var watcher: fs.FSWatcher; var readStreeam: stream.Readable; var writeStream: stream.Writable; +var outputStream: stream.Writable; fs.copy(src, dest, errorCallback); fs.copy(src, dest, (src: string) => { @@ -150,7 +151,7 @@ strArr = fs.readdirSync(path); fs.close(fd, errorCallback); fs.closeSync(fd); fs.open(path, flags, modeStr, (err: Error, fd: number) => { - + }); num = fs.openSync(path, flags, modeStr); fs.utimes(path, atime, mtime, errorCallback); @@ -217,6 +218,17 @@ fs.exists(path, (exists: boolean) => { }); bool = fs.existsSync(path); +fs.ensureDir(path, errorCallback); +fs.ensureDirSync(path); +fs.ensureFile(path, errorCallback); +fs.ensureFileSync(path); +fs.ensureLink(path, errorCallback); +fs.ensureLinkSync(path); +fs.ensureSymlink(path, errorCallback); +fs.ensureSymlinkSync(path); +fs.emptyDir(path, errorCallback); +fs.emptyDirSync(path); + readStreeam = fs.createReadStream(path); readStreeam = fs.createReadStream(path, { flags: str, @@ -231,3 +243,9 @@ writeStream = fs.createWriteStream(path, { encoding: str, string: str }); +outputStream = fs.createOutputStream(path); +outputStream = fs.createOutputStream(path, { + flags: str, + encoding: str, + string: str +}); From 814e5ba4b19295c427df103ce4bf20857853f82d Mon Sep 17 00:00:00 2001 From: Michael Tiller Date: Fri, 27 Nov 2015 11:27:26 -0500 Subject: [PATCH 202/389] Exposing additional types and interfaces --- react-router/react-router.d.ts | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/react-router/react-router.d.ts b/react-router/react-router.d.ts index 7063d2ab6..2010a1f49 100644 --- a/react-router/react-router.d.ts +++ b/react-router/react-router.d.ts @@ -310,6 +310,11 @@ declare module "react-router/lib/useRoutes" { } +declare module "react-router/lib/PatternUtils" { + + export function formatPattern(pattern: string, params: {}): string; + +} declare module "react-router/lib/RouteUtils" { @@ -396,12 +401,33 @@ declare module "react-router" { import { createRoutes } from "react-router/lib/RouteUtils" + import { formatPattern } from "react-router/lib/PatternUtils" + import RoutingContext from "react-router/lib/RoutingContext" import PropTypes from "react-router/lib/PropTypes" import match from "react-router/lib/match" + // PlainRoute is defined in the API documented at: + // https://github.com/rackt/react-router/blob/master/docs/API.md + // but not included in any of the .../lib modules above. + export type PlainRoute = ReactRouter.PlainRoute + + // The following definitions are also very useful to export + // because by using these types lots of potential type errors + // can be exposed: + export type EnterHook = ReactRouter.EnterHook + export type LeaveHook = ReactRouter.LeaveHook + export type ParseQueryString = ReactRouter.ParseQueryString + export type RedirectFunction = ReactRouter.RedirectFunction + export type RouteComponentProps = ReactRouter.RouteComponentProps; + export type RouteHook = ReactRouter.RouteHook + export type StringifyQuery = ReactRouter.StringifyQuery + export type RouterListener = ReactRouter.RouterListener + export type RouterState = ReactRouter.RouterState + export type HistoryBase = ReactRouter.HistoryBase + export { Router, Link, @@ -415,6 +441,7 @@ declare module "react-router" { RouteContext, useRoutes, createRoutes, + formatPattern, RoutingContext, PropTypes, match From ad6c1fad6c37533530e7f2d3852ae606f3cea767 Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Sat, 28 Nov 2015 02:42:35 +0900 Subject: [PATCH 203/389] Add ratelimtier.d.ts --- ratelimiter/ratelimiter-tests.ts | 17 +++++++++ ratelimiter/ratelimiter.d.ts | 59 ++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 ratelimiter/ratelimiter-tests.ts create mode 100644 ratelimiter/ratelimiter.d.ts diff --git a/ratelimiter/ratelimiter-tests.ts b/ratelimiter/ratelimiter-tests.ts new file mode 100644 index 000000000..14d42422e --- /dev/null +++ b/ratelimiter/ratelimiter-tests.ts @@ -0,0 +1,17 @@ +/// +/// + +import redis = require('redis'); +import Limiter = require('ratelimiter'); + +let id: string; +let db: redis.RedisClient; +let limit = new Limiter({ id: id, db: db }); + +const str: string = limit.inspect(); + +limit.get((err, limit): void => { + const total: number = limit.total; + const remaining: number = limit.remaining; + const reset: number = limit.reset; +}); diff --git a/ratelimiter/ratelimiter.d.ts b/ratelimiter/ratelimiter.d.ts new file mode 100644 index 000000000..6e9883dd5 --- /dev/null +++ b/ratelimiter/ratelimiter.d.ts @@ -0,0 +1,59 @@ +// Type definitions for ratelimiter 2.1.1 +// Project: https://github.com/tj/node-ratelimiter +// Definitions by: Aya Morisawa +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "ratelimiter" { + import { RedisClient } from 'redis'; + + interface LimiterOption { + /** + * The identifier to limit against (typically a user id) + */ + id: string; + + /** + * Redis connection instance + */ + db: RedisClient; + + /** + * Max requests within duration + */ + max?: number; + + /** + * Duration of limit in milliseconds + */ + duration?: number; + } + + interface LimiterInfo { + /** + * max value + */ + total: number; + + /** + * Number of calls left in current duration without decreasing current get + */ + remaining: number; + + /** + * Time in milliseconds until the end of current duration + */ + reset: number; + } + + class Limiter { + constructor(opts: LimiterOption); + + inspect(): string; + + get(fn: (err: any, info: LimiterInfo) => void): void; + } + + export = Limiter; +} From 44c617ff731e8fc62ae2fc689126b12aa7c13a32 Mon Sep 17 00:00:00 2001 From: cherrydev Date: Fri, 27 Nov 2015 16:33:58 -0800 Subject: [PATCH 204/389] Update dexie.d.ts ; Add semicolons to quell errors Some TS editors are complaining about a few missing semicolons. --- dexie/dexie.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dexie/dexie.d.ts b/dexie/dexie.d.ts index d6c26283c..13b9b31e0 100644 --- a/dexie/dexie.d.ts +++ b/dexie/dexie.d.ts @@ -38,7 +38,7 @@ declare class Dexie { static deepClone(obj: Object): Object; - version(versionNumber: number): Dexie.Version + version(versionNumber: number): Dexie.Version; on: { (eventName: string, subscriber: () => any): void; @@ -48,7 +48,7 @@ declare class Dexie { populate: Dexie.DexieEvent; blocked: Dexie.DexieEvent; versionchange: Dexie.DexieVersionChangeEvent; - } + }; open(): Dexie.Promise; From 2acc0fe641631c727d91fa20ff73f52ed54ee2b0 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Sat, 28 Nov 2015 09:36:59 +0500 Subject: [PATCH 205/389] lodash: signatures of _.isNull have been changed --- lodash/lodash-tests.ts | 23 +++++++++++++++++++---- lodash/lodash.d.ts | 10 +++++++++- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index bdc08ccdc..af4f246c5 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -5092,10 +5092,25 @@ result = _(Array.prototype.push).isNative(); } // _.isNull -result = _.isNull(any); -result = _(1).isNull(); -result = _([]).isNull(); -result = _({}).isNull(); +module TestIsNull { + { + let result: boolean; + + result = _.isNull(any); + + result = _(1).isNull(); + result = _([]).isNull(); + result = _({}).isNull(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isNull(); + result = _([]).chain().isNull(); + result = _({}).chain().isNull(); + } +} // _.isNumber result = _.isNumber(any); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index ad465c5c3..e6da5f334 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -8919,9 +8919,10 @@ declare module _ { interface LoDashStatic { /** * Checks if value is null. + * * @param value The value to check. * @return Returns true if value is null, else false. - **/ + */ isNull(value?: any): boolean; } @@ -8932,6 +8933,13 @@ declare module _ { isNull(): boolean; } + interface LoDashExplicitWrapperBase { + /** + * see _.isNull + */ + isNull(): LoDashExplicitWrapper; + } + //_.isNumber interface LoDashStatic { /** From bc664db5212182aa61ee6fb1b3935bc1ffbd29dc Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Sat, 28 Nov 2015 10:00:09 +0500 Subject: [PATCH 206/389] lodash: signatures of _.defer have been changed --- lodash/lodash-tests.ts | 35 +++++++++++++++++++++++++++++++++-- lodash/lodash.d.ts | 31 ++++++++++++++++++++----------- 2 files changed, 53 insertions(+), 13 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index bdc08ccdc..7a477f585 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -4490,8 +4490,39 @@ source.addEventListener('message', <_.LoDashImplicitObjectWrapper>_(fu var returnedDebounce = _.throttle(function (a: any) { return a * 5; }, 5); returnedThrottled(4); -result = _.defer(function () { console.log('deferred'); }); -result = <_.LoDashImplicitWrapper>_(function () { console.log('deferred'); }).defer(); +// _.defer +module TestDefer { + type SampleFunc = (a: number, b: string) => boolean; + + let func: SampleFunc; + + { + let result: number; + + result = _.defer(func); + result = _.defer(func, any); + result = _.defer(func, any, any); + result = _.defer(func, any, any, any); + } + + { + let result: _.LoDashImplicitWrapper; + + result = _(func).defer(); + result = _(func).defer(any); + result = _(func).defer(any, any); + result = _(func).defer(any, any, any); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(func).chain().defer(); + result = _(func).chain().defer(any); + result = _(func).chain().defer(any, any); + result = _(func).chain().defer(any, any, any); + } +} // _.delay module TestDelay { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index ad465c5c3..23c1ae4f2 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -7913,24 +7913,33 @@ declare module _ { //_.defer interface LoDashStatic { /** - * Defers executing the func function until the current call stack has cleared. Additional - * arguments will be provided to func when it is invoked. - * @param func The function to defer. - * @param args Arguments to invoke the function with. - * @return The timer id. - **/ - defer( - func: Function, - ...args: any[]): number; + * Defers invoking the func until the current call stack has cleared. Any additional arguments are provided to + * func when it’s invoked. + * + * @param func The function to defer. + * @param args The arguments to invoke the function with. + * @return Returns the timer id. + */ + defer( + func: T, + ...args: any[] + ): number; } interface LoDashImplicitObjectWrapper { /** - * @see _.defer - **/ + * @see _.defer + */ defer(...args: any[]): LoDashImplicitWrapper; } + interface LoDashExplicitObjectWrapper { + /** + * @see _.defer + */ + defer(...args: any[]): LoDashExplicitWrapper; + } + //_.delay interface LoDashStatic { /** From 05e7d8d0cdb21c89944f7d7157ac59cb2a2f36e7 Mon Sep 17 00:00:00 2001 From: sodatea Date: Sun, 29 Nov 2015 00:56:20 +0800 Subject: [PATCH 207/389] Update tape-tests to match tape v4.2.2 documentation --- tape/tape-tests.ts | 165 ++++++++++++++++++++++++++++++--------------- 1 file changed, 111 insertions(+), 54 deletions(-) diff --git a/tape/tape-tests.ts b/tape/tape-tests.ts index 2c4e4ec1b..85bb19a6e 100644 --- a/tape/tape-tests.ts +++ b/tape/tape-tests.ts @@ -4,21 +4,16 @@ import tape = require('tape'); -var x: any; -var value: any; -var err: any; -var a: any; -var b: any; -var err: any; -var num: number; var name: string; -var msg: string; -var rs: NodeJS.ReadableStream; - var cb: tape.TestCase; +var opts: tape.TestOptions; var t: tape.Test; +tape(cb); tape(name, cb); +tape(opts, cb); +tape(name, opts, cb); + tape(name, (test: tape.Test) => { t = test; }); @@ -26,29 +21,51 @@ tape(name, (test: tape.Test) => { tape.skip(name, cb); tape.only(name, cb); -rs = tape.createStream(); -rs = tape.createStream(x); -var tx = tape.createHarness(); -tx(name, cb); -tape.skip(name, cb); -tape.only(name, cb); +var sopts: tape.StreamOptions; +var rs: NodeJS.ReadableStream; +rs = tape.createStream(); +rs = tape.createStream(sopts); + + +var htest: typeof tape; +htest = tape.createHarness(); + tape(name, (test: tape.Test) => { + var num: number; + var ms: number; + var value: any; + var actual: any; + var expected: any; + var err: any; + var fn = function() {}; + var msg: string; + + var exceptionExpected: RegExp | (() => void); + test.plan(num); test.end(); + test.end(err); test.fail(msg); test.pass(msg); + test.timeoutAfter(ms); test.skip(msg); + test.ok(value); test.ok(value, msg); + test.true(value); test.true(value, msg); + test.assert(value); test.assert(value, msg); + test.notOk(value); test.notOk(value, msg); + test.false(value); test.false(value, msg); + test.notok(value); test.notok(value, msg); test.error(err, msg); @@ -56,51 +73,91 @@ tape(name, (test: tape.Test) => { test.ifErr(err, msg); test.iferror(err, msg); - test.equal(a, b, msg); - test.equals(a, b, msg); - test.isEqual(a, b, msg); - test.is(a, b, msg); - test.strictEqual(a, b, msg); - test.strictEquals(a, b, msg); + test.equal(actual, expected); + test.equal(actual, expected, msg); + test.equals(actual, expected); + test.equals(actual, expected, msg); + test.isEqual(actual, expected); + test.isEqual(actual, expected, msg); + test.is(actual, expected); + test.is(actual, expected, msg); + test.strictEqual(actual, expected); + test.strictEqual(actual, expected, msg); + test.strictEquals(actual, expected); + test.strictEquals(actual, expected, msg); - test.notEqual(a, b, msg); - test.notEquals(a, b, msg); - test.notStrictEqual(a, b, msg); - test.notStrictEquals(a, b, msg); - test.isNotEqual(a, b, msg); - test.isNot(a, b, msg); - test.not(a, b, msg); - test.doesNotEqual(a, b, msg); - test.notEqual(a, b, msg); - test.isInequal(a, b, msg); + test.notEqual(actual, expected); + test.notEqual(actual, expected, msg); + test.notEquals(actual, expected); + test.notEquals(actual, expected, msg); + test.notStrictEqual(actual, expected); + test.notStrictEqual(actual, expected, msg); + test.notStrictEquals(actual, expected); + test.notStrictEquals(actual, expected, msg); + test.isNotEqual(actual, expected); + test.isNotEqual(actual, expected, msg); + test.isNot(actual, expected); + test.isNot(actual, expected, msg); + test.not(actual, expected); + test.not(actual, expected, msg); + test.doesNotEqual(actual, expected); + test.doesNotEqual(actual, expected, msg); + test.isInequal(actual, expected); + test.isInequal(actual, expected, msg); - test.deepEqual(a, b, msg); - test.deepEquals(a, b, msg); - test.isEquivalent(a, b, msg); - test.same(a, b, msg); + test.deepEqual(actual, expected); + test.deepEqual(actual, expected, msg); + test.deepEquals(actual, expected); + test.deepEquals(actual, expected, msg); + test.isEquivalent(actual, expected); + test.isEquivalent(actual, expected, msg); + test.same(actual, expected); + test.same(actual, expected, msg); - test.notDeepEqual(a, b, msg); - test.notEquivalent(a, b, msg); - test.notDeeply(a, b, msg); - test.notSame(a, b, msg); - test.isNotDeepEqual(a, b, msg); - test.isNotDeeply(a, b, msg); - test.isNotEquivalent(a, b, msg); - test.isInequivalent(a, b, msg); + test.notDeepEqual(actual, expected); + test.notDeepEqual(actual, expected, msg); + test.notEquivalent(actual, expected); + test.notEquivalent(actual, expected, msg); + test.notDeeply(actual, expected); + test.notDeeply(actual, expected, msg); + test.notSame(actual, expected); + test.notSame(actual, expected, msg); + test.isNotDeepEqual(actual, expected); + test.isNotDeepEqual(actual, expected, msg); + test.isNotDeeply(actual, expected); + test.isNotDeeply(actual, expected, msg); + test.isNotEquivalent(actual, expected); + test.isNotEquivalent(actual, expected, msg); + test.isInequivalent(actual, expected); + test.isInequivalent(actual, expected, msg); - test.deepLooseEqual(a, b, msg); - test.looseEqual(a, b, msg); - test.looseEquals(a, b, msg); + test.deepLooseEqual(actual, expected); + test.deepLooseEqual(actual, expected, msg); + test.looseEqual(actual, expected); + test.looseEqual(actual, expected, msg); + test.looseEquals(actual, expected); + test.looseEquals(actual, expected, msg); - test.notDeepLooseEqual(a, b, msg); - test.notLooseEqual(a, b, msg); - test.notLooseEquals(a, b, msg); + test.notDeepLooseEqual(actual, expected); + test.notDeepLooseEqual(actual, expected, msg); + test.notLooseEqual(actual, expected); + test.notLooseEqual(actual, expected, msg); + test.notLooseEquals(actual, expected); + test.notLooseEquals(actual, expected, msg); - test.throws(() => { + test.throws(fn); + test.throws(fn, msg); + test.throws(fn, exceptionExpected); + test.throws(fn, exceptionExpected, msg); - }, value, msg); + test.doesNotThrow(fn); + test.doesNotThrow(fn, msg); + test.doesNotThrow(fn, exceptionExpected); + test.doesNotThrow(fn, exceptionExpected, msg); - test.doesNotThrow(() => { + test.test(name, (st) => { + t = st; + }); - }, value, msg); + test.comment(msg); }); From 496bca81b7c6cdf81b8245a3cb029b58295d5d5c Mon Sep 17 00:00:00 2001 From: Joe Skeen Date: Sat, 28 Nov 2015 10:59:30 -0700 Subject: [PATCH 208/389] comment formatting --- adm-zip/adm-zip.d.ts | 72 ++++++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/adm-zip/adm-zip.d.ts b/adm-zip/adm-zip.d.ts index ee57569da..208c13b27 100644 --- a/adm-zip/adm-zip.d.ts +++ b/adm-zip/adm-zip.d.ts @@ -227,70 +227,70 @@ declare module "adm-zip" { module AdmZip { /** - * The ZipEntry is more than a structure representing the entry inside the - * zip file. Beside the normal attributes and headers a entry can have, the - * class contains a reference to the part of the file where the compressed - * data resides and decompresses it when requested. It also compresses the - * data and creates the headers required to write in the zip file. - */ + * The ZipEntry is more than a structure representing the entry inside the + * zip file. Beside the normal attributes and headers a entry can have, the + * class contains a reference to the part of the file where the compressed + * data resides and decompresses it when requested. It also compresses the + * data and creates the headers required to write in the zip file. + */ interface IZipEntry { /** - * Represents the full name and path of the file - */ + * Represents the full name and path of the file + */ entryName: string; rawEntryName: Buffer; /** - * Extra data associated with this entry. - */ + * Extra data associated with this entry. + */ extra: Buffer; /** - * Entry comment. - */ + * Entry comment. + */ comment: string; name: string; /** - * Read-Only property that indicates the type of the entry. - */ + * Read-Only property that indicates the type of the entry. + */ isDirectory: boolean; /** - * Get the header associated with this ZipEntry. - */ + * Get the header associated with this ZipEntry. + */ header: Buffer; /** - * Retrieve the compressed data for this entry. Note that this may trigger - * compression if any properties were modified. - */ + * Retrieve the compressed data for this entry. Note that this may trigger + * compression if any properties were modified. + */ getCompressedData(): Buffer; /** - * Asynchronously retrieve the compressed data for this entry. Note that - * this may trigger compression if any properties were modified. - */ + * Asynchronously retrieve the compressed data for this entry. Note that + * this may trigger compression if any properties were modified. + */ getCompressedDataAsync(callback: (data: Buffer) => void): void; /** - * Set the (uncompressed) data to be associated with this entry. - */ + * Set the (uncompressed) data to be associated with this entry. + */ setData(value: string): void; /** - * Set the (uncompressed) data to be associated with this entry. - */ + * Set the (uncompressed) data to be associated with this entry. + */ setData(value: Buffer): void; /** - * Get the decompressed data associated with this entry. - */ + * Get the decompressed data associated with this entry. + */ getData(): Buffer; /** - * Asynchronously get the decompressed data associated with this entry. - */ + * Asynchronously get the decompressed data associated with this entry. + */ getDataAsync(callback: (data: Buffer) => void): void; /** - * Returns the CEN Entry Header to be written to the output zip file, plus - * the extra data and the entry comment. - */ + * Returns the CEN Entry Header to be written to the output zip file, plus + * the extra data and the entry comment. + */ packHeader(): Buffer; /** - * Returns a nicely formatted string with the most important properties of - * the ZipEntry. - */ + * Returns a nicely formatted string with the most important properties of + * the ZipEntry. + */ toString(): string; } } From e2e1e881bb57431fbbe9289ac4da1fea928dc84c Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Sun, 29 Nov 2015 00:28:28 +0200 Subject: [PATCH 209/389] jwt-decode definition file added --- jwt-decode/jwt-decode.d.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 jwt-decode/jwt-decode.d.ts diff --git a/jwt-decode/jwt-decode.d.ts b/jwt-decode/jwt-decode.d.ts new file mode 100644 index 000000000..67d7aac16 --- /dev/null +++ b/jwt-decode/jwt-decode.d.ts @@ -0,0 +1,16 @@ +// Type definitions for jwt-decode v1.4.0 +// Project: https://github.com/auth0/jwt-decode +// Definitions by: Giedrius Grabauskas +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +declare module JwtDecode { + interface JwtDecodeStatic { + (token: string): any; + } +} + +declare module 'jwt-decode' { + var jwtDecode: JwtDecode.JwtDecodeStatic; + export = jwtDecode; +} From 0edde72be8d59eaff8775a8ba992a43dbf2dccc0 Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Sun, 29 Nov 2015 00:31:26 +0200 Subject: [PATCH 210/389] jwt-decode test added --- jwt-decode/jwt-decode-test.ts | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 jwt-decode/jwt-decode-test.ts diff --git a/jwt-decode/jwt-decode-test.ts b/jwt-decode/jwt-decode-test.ts new file mode 100644 index 000000000..231c3d300 --- /dev/null +++ b/jwt-decode/jwt-decode-test.ts @@ -0,0 +1,5 @@ +import * as jwtDecode from 'jwt-decode'; + +let token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJmb28iOiJiYXIiLCJleHAiOjEzOTMyODY4OTMsImlhdCI6MTM5MzI2ODg5M30.4-iaDojEVl0pJQMjrbM1EzUIfAZgsbK_kgnVyVxFSVo"; + +let decodedToken = jwtDecode(responseIdToken); From bf04904b971185574aed5ad599505a6cacd49816 Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Sun, 29 Nov 2015 00:37:54 +0200 Subject: [PATCH 211/389] jwt-decode tests added --- jwt-decode/{jwt-decode-test.ts => jwt-decode-tests.ts} | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) rename jwt-decode/{jwt-decode-test.ts => jwt-decode-tests.ts} (63%) diff --git a/jwt-decode/jwt-decode-test.ts b/jwt-decode/jwt-decode-tests.ts similarity index 63% rename from jwt-decode/jwt-decode-test.ts rename to jwt-decode/jwt-decode-tests.ts index 231c3d300..fcecd326a 100644 --- a/jwt-decode/jwt-decode-test.ts +++ b/jwt-decode/jwt-decode-tests.ts @@ -2,4 +2,10 @@ import * as jwtDecode from 'jwt-decode'; let token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJmb28iOiJiYXIiLCJleHAiOjEzOTMyODY4OTMsImlhdCI6MTM5MzI2ODg5M30.4-iaDojEVl0pJQMjrbM1EzUIfAZgsbK_kgnVyVxFSVo"; -let decodedToken = jwtDecode(responseIdToken); +interface TokenDto { + foo: string; + exp: number; + iat: number; +} + +let decodedToken = jwtDecode(token) as TokenDto; From 95f6be561df5a420c69b408f50c10ea53ea76cc6 Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Sun, 29 Nov 2015 00:50:23 +0200 Subject: [PATCH 212/389] Fixed jwtDecode import. --- jwt-decode/jwt-decode-tests.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/jwt-decode/jwt-decode-tests.ts b/jwt-decode/jwt-decode-tests.ts index fcecd326a..66d639b40 100644 --- a/jwt-decode/jwt-decode-tests.ts +++ b/jwt-decode/jwt-decode-tests.ts @@ -1,5 +1,6 @@ -import * as jwtDecode from 'jwt-decode'; - + /// +import jwtDecode = require('jwt-decode'); + let token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJmb28iOiJiYXIiLCJleHAiOjEzOTMyODY4OTMsImlhdCI6MTM5MzI2ODg5M30.4-iaDojEVl0pJQMjrbM1EzUIfAZgsbK_kgnVyVxFSVo"; interface TokenDto { From b9d1b538d5b115b4eba2e4cbe019568b23c6cf2c Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Sun, 29 Nov 2015 04:51:06 +0500 Subject: [PATCH 213/389] A definition of module "buffer-compare" has been added --- buffer-compare/buffer-compare-tests.ts | 27 ++++++++++++++++++++++++++ buffer-compare/buffer-compare.d.ts | 17 ++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 buffer-compare/buffer-compare-tests.ts create mode 100644 buffer-compare/buffer-compare.d.ts diff --git a/buffer-compare/buffer-compare-tests.ts b/buffer-compare/buffer-compare-tests.ts new file mode 100644 index 000000000..88e6dddb9 --- /dev/null +++ b/buffer-compare/buffer-compare-tests.ts @@ -0,0 +1,27 @@ +/// +/// + +import compare = require('buffer-compare'); + +let result: number; + +result = compare(new Buffer(''), new Buffer('')); +result = compare([], []); +result = compare('', ''); +result = compare(new Buffer(''), []); +result = compare([], ''); +result = compare('', new Buffer('')); + +result = compare(new Buffer(''), new Buffer('')); +result = compare([], []); +result = compare('', ''); +result = compare(new Buffer(''), []); +result = compare([], ''); +result = compare('', new Buffer('')); + +result = compare(new Buffer(''), new Buffer('')); +result = compare([], []); +result = compare('', ''); +result = compare(new Buffer(''), []); +result = compare([], ''); +result = compare('', new Buffer('')); diff --git a/buffer-compare/buffer-compare.d.ts b/buffer-compare/buffer-compare.d.ts new file mode 100644 index 000000000..58e4004dc --- /dev/null +++ b/buffer-compare/buffer-compare.d.ts @@ -0,0 +1,17 @@ +// Type definitions for buffer-compare +// Project: https://github.com/soldair/node-buffer-compare +// Definitions by: Ilya Mochalov +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "buffer-compare" { + interface List { + [index: number]: any; + length: number + } + + function compare(cmp: List, to: List): number; + function compare(cmp: T, to: T): number; + function compare(cmp: C, to: T): number; + + export = compare; +} From 6153dcb3010d9661fe2e038d91ae440859b5364c Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Sun, 29 Nov 2015 07:38:27 +0500 Subject: [PATCH 214/389] lodash: signatures of _.invert have been changed --- lodash/lodash-tests.ts | 30 ++++++++++++++++++++++++------ lodash/lodash.d.ts | 20 +++++++++++++++++++- 2 files changed, 43 insertions(+), 7 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index bdc08ccdc..3563bc990 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6399,12 +6399,30 @@ module TestHas { } // _.invert -{ - let result: TResult; - result = _.invert({}); - result = _.invert({}, true); - result = _({}).invert().value(); - result = _({}).invert(true).value(); +module TestInvert { + { + let result: TResult; + + result = _.invert({}); + result = _.invert({}, true); + + result = _.invert({}); + result = _.invert({}, true); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _({}).invert(); + result = _({}).invert(true); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _({}).chain().invert(); + result = _({}).chain().invert(true); + } } // _.keys diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index ad465c5c3..dd266bba7 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -10823,7 +10823,18 @@ declare module _ { * @param multiValue Allow multiple values per key. * @return Returns the new inverted object. */ - invert(object: T, multiValue?: boolean): TResult; + invert( + object: T, + multiValue?: boolean + ): TResult; + + /** + * @see _.invert + */ + invert( + object: Object, + multiValue?: boolean + ): TResult; } interface LoDashImplicitObjectWrapper { @@ -10833,6 +10844,13 @@ declare module _ { invert(multiValue?: boolean): LoDashImplicitObjectWrapper; } + interface LoDashExplicitObjectWrapper { + /** + * @see _.invert + */ + invert(multiValue?: boolean): LoDashExplicitObjectWrapper; + } + //_.keys interface LoDashStatic { /** From c59dcb8d6f88e858ceb6dd72dd1a0325dc580d47 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Mon, 30 Nov 2015 09:48:26 +0500 Subject: [PATCH 215/389] lodash: signatures of _.sortedIndex have been changed --- lodash/lodash-tests.ts | 91 +++++++++++++-- lodash/lodash.d.ts | 253 +++++++++++++++++++++++++++++++++-------- 2 files changed, 284 insertions(+), 60 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index bdc08ccdc..d48362b62 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -1164,17 +1164,86 @@ module TestSlice { // _.sortedIndex module TestSortedIndex { - result = _.sortedIndex([20, 30, 50], 40); - result = _.sortedIndex([{ 'x': 20 }, { 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x'); - var sortedIndexDict: { wordToNumber: { [idx: string]: number } } = { - 'wordToNumber': { 'twenty': 20, 'thirty': 30, 'fourty': 40, 'fifty': 50 } - }; - result = _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function (word: string) { - return sortedIndexDict.wordToNumber[word]; - }); - result = _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function (word: string) { - return this.wordToNumber[word]; - }, sortedIndexDict); + type SampleType = {a: number; b: string; c: boolean;}; + + let array: SampleType[]; + let list: _.List; + + let value: SampleType; + + let stringIterator: (x: string) => number; + let arrayIterator: (x: SampleType) => number; + let listIterator: (x: SampleType) => number; + + { + let result: number; + + result = _.sortedIndex('', ''); + result = _.sortedIndex('', '', stringIterator); + result = _.sortedIndex('', '', stringIterator, any); + result = _.sortedIndex('', '', stringIterator); + result = _.sortedIndex('', '', stringIterator, any); + + result = _.sortedIndex(array, value); + result = _.sortedIndex(array, value, arrayIterator); + result = _.sortedIndex(array, value, arrayIterator, any); + result = _.sortedIndex(array, value, ''); + result = _.sortedIndex(array, value, {a: 42}); + result = _.sortedIndex(array, value, arrayIterator); + result = _.sortedIndex(array, value, arrayIterator, any); + result = _.sortedIndex<{a: number}, SampleType>(array, value, {a: 42}); + + result = _.sortedIndex(list, value); + result = _.sortedIndex(list, value, listIterator); + result = _.sortedIndex(list, value, listIterator, any); + result = _.sortedIndex(list, value, ''); + result = _.sortedIndex(list, value, {a: 42}); + result = _.sortedIndex(list, value, listIterator); + result = _.sortedIndex(list, value, listIterator, any); + result = _.sortedIndex<{a: number}, SampleType>(list, value, {a: 42}); + + result = _('').sortedIndex(''); + result = _('').sortedIndex('', stringIterator); + result = _('').sortedIndex('', stringIterator, any); + + result = _(array).sortedIndex(value); + result = _(array).sortedIndex(value, arrayIterator); + result = _(array).sortedIndex(value, arrayIterator, any); + result = _(array).sortedIndex(value, ''); + result = _(array).sortedIndex<{a: number}>(value, {a: 42}); + + result = _(list).sortedIndex(value); + result = _(list).sortedIndex(value, listIterator); + result = _(list).sortedIndex(value, listIterator, any); + result = _(list).sortedIndex(value, ''); + result = _(list).sortedIndex(value, {a: 42}); + result = _(list).sortedIndex(value, listIterator); + result = _(list).sortedIndex(value, listIterator, any); + result = _(list).sortedIndex<{a: number}, SampleType>(value, {a: 42}); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('').chain().sortedIndex(''); + result = _('').chain().sortedIndex('', stringIterator); + result = _('').chain().sortedIndex('', stringIterator, any); + + result = _(array).chain().sortedIndex(value); + result = _(array).chain().sortedIndex(value, arrayIterator); + result = _(array).chain().sortedIndex(value, arrayIterator, any); + result = _(array).chain().sortedIndex(value, ''); + result = _(array).chain().sortedIndex<{a: number}>(value, {a: 42}); + + result = _(list).chain().sortedIndex(value); + result = _(list).chain().sortedIndex(value, listIterator); + result = _(list).chain().sortedIndex(value, listIterator, any); + result = _(list).chain().sortedIndex(value, ''); + result = _(list).chain().sortedIndex(value, {a: 42}); + result = _(list).chain().sortedIndex(value, listIterator); + result = _(list).chain().sortedIndex(value, listIterator, any); + result = _(list).chain().sortedIndex<{a: number}, SampleType>(value, {a: 42}); + } } // _.sortedLastIndex diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index ad465c5c3..5af03703a 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -1842,71 +1842,226 @@ declare module _ { //_.sortedIndex interface LoDashStatic { /** - * Uses a binary search to determine the smallest index at which a value should be inserted - * into a given sorted array in order to maintain the sort order of the array. If a callback - * is provided it will be executed for value and each element of array to compute their sort - * ranking. The callback is bound to thisArg and invoked with one argument; (value). - * - * If a property name is provided for callback the created "_.pluck" style callback will - * return the property value of the given element. - * - * If an object is provided for callback the created "_.where" style callback will return - * true for elements that have the properties of the given object, else false. - * @param array The sorted list. - * @param value The value to determine its index within `list`. - * @param callback Iterator to compute the sort ranking of each value, optional. - * @return The index at which value should be inserted into array. - **/ - sortedIndex( - array: Array, - value: T, - callback?: (x: T) => TSort, - thisArg?: any): number; - - /** - * @see _.sortedIndex - **/ + * Uses a binary search to determine the lowest index at which value should be inserted into array in order to maintain its sort order. If an iteratee function is provided it’s invoked for value and each element of array to compute their sort ranking. The iteratee is bound to thisArg and invoked with one argument; (value). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that have the properties of the given object, else false. + * + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param iteratee The function invoked per iteration. + * @return The this binding of iteratee. + */ sortedIndex( array: List, value: T, - callback?: (x: T) => TSort, - thisArg?: any): number; + iteratee?: (x: T) => TSort, + thisArg?: any + ): number; /** - * @see _.sortedIndex - * @param pluckValue the _.pluck style callback - **/ - sortedIndex( - array: Array, - value: T, - pluckValue: string): number; - - /** - * @see _.sortedIndex - * @param pluckValue the _.pluck style callback - **/ + * @see _.sortedIndex + */ sortedIndex( array: List, value: T, - pluckValue: string): number; + iteratee?: (x: T) => any, + thisArg?: any + ): number; /** - * @see _.sortedIndex - * @param pluckValue the _.where style callback - **/ - sortedIndex( - array: Array, + * @see _.sortedIndex + */ + sortedIndex( + array: List, value: T, - whereValue: W): number; + iteratee: string + ): number; /** - * @see _.sortedIndex - * @param pluckValue the _.where style callback - **/ + * @see _.sortedIndex + */ sortedIndex( array: List, value: T, - whereValue: W): number; + iteratee: W + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + array: List, + value: T, + iteratee: Object + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.sortedIndex + */ + sortedIndex( + value: string, + iteratee?: (x: string) => TSort, + thisArg?: any + ): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: W + ): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee?: (x: T) => any, + thisArg?: any + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: W + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: Object + ): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.sortedIndex + */ + sortedIndex( + value: string, + iteratee?: (x: string) => TSort, + thisArg?: any + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: string + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: W + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee?: (x: T) => any, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: string + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: W + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: Object + ): LoDashExplicitWrapper; } //_.sortedLastIndex From beea5fcbc17c0b112b64b7759fb58779189fd687 Mon Sep 17 00:00:00 2001 From: chrmcg Date: Mon, 30 Nov 2015 02:43:33 -0500 Subject: [PATCH 216/389] Add two missing semicolons --- googlemaps/google.maps.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/googlemaps/google.maps.d.ts b/googlemaps/google.maps.d.ts index 298f2f6ea..3ac35b048 100644 --- a/googlemaps/google.maps.d.ts +++ b/googlemaps/google.maps.d.ts @@ -849,7 +849,7 @@ declare module google.maps { formatted_address: string; geometry: GeocoderGeometry; partial_match: boolean; - postcode_localities: string[] + postcode_localities: string[]; types: string[]; } @@ -1822,7 +1822,7 @@ declare module google.maps { matched_substrings: PredictionSubstring[]; place_id: string; terms: PredictionTerm[]; - types: string[] + types: string[]; } export interface PredictionTerm { From e986301426bf3bed3aad75ec943b4a717f52ab73 Mon Sep 17 00:00:00 2001 From: Dominic Collart Date: Mon, 30 Nov 2015 11:13:09 +0100 Subject: [PATCH 217/389] Allow "tokenGetter" function to use many parameters (useful to load service/provider/factory) --- angular-jwt/angular-jwt.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angular-jwt/angular-jwt.d.ts b/angular-jwt/angular-jwt.d.ts index 55bb3e4f6..620fcc8e4 100644 --- a/angular-jwt/angular-jwt.d.ts +++ b/angular-jwt/angular-jwt.d.ts @@ -25,6 +25,6 @@ declare module angular.jwt { } interface IJwtInterceptor { - tokenGetter(): string; + tokenGetter(...params : any[]): string; } } From b8622c4b93b0202f19bf48043ac1c1e5890dd0fd Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Fri, 20 Nov 2015 11:12:53 -0500 Subject: [PATCH 218/389] Updating Hapi's IServerInject --- hapi/hapi.d.ts | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/hapi/hapi.d.ts b/hapi/hapi.d.ts index 7f2fab90e..23db49446 100644 --- a/hapi/hapi.d.ts +++ b/hapi/hapi.d.ts @@ -904,15 +904,25 @@ declare module "hapi" { url: string; /** an object with optional request headers where each key is the header name and the value is the header content. Defaults to no additions to the default Shot headers.*/ headers: IDictionary; - /**- an optional string or buffer containing the request payload (object must be manually converted to a string first). Defaults to no payload. Note that payload processing defaults to 'application/json' if no 'Content-Type' header provided.*/ - payload: string|Buffer; - /**an optional credentials object containing authentication information. The credentials are used to bypass the default authentication strategies, and are validated directly as if they were received via an authentication scheme. Defaults to no credentials.*/ - credentials: any; + /** n optional string, buffer or object containing the request payload. In case of an object it will be converted to a string for you. Defaults to no payload. Note that payload processing defaults to 'application/json' if no 'Content-Type' header provided.*/ + payload?: string|{}|Buffer; + /** an optional credentials object containing authentication information. The credentials are used to bypass the default authentication strategies, and are validated directly as if they were received via an authentication scheme. Defaults to no credentials.*/ + credentials?: any; + /** an optional artifacts object containing authentication artifact information. The artifacts are used to bypass the default authentication strategies, and are validated directly as if they were received via an authentication scheme. Ignored if set without credentials. Defaults to no artifacts.*/ + artifacts?: any; + /** sets the initial value of request.app*/ + app?: any; + /** sets the initial value of request.plugins*/ + plugins?: any; + /** allows access to routes with config.isInternal set to true. Defaults to false.*/ + allowInternals?: boolean; + /** sets the remote address for the incoming connection.*/ + remoteAddress?: boolean; /**object with options used to simulate client request stream conditions for testing: error - if true, emits an 'error' event after payload transmission (if any). Defaults to false. close - if true, emits a 'close' event after payload transmission (if any). Defaults to false. end - if false, does not end the stream. Defaults to true.*/ - simulate: { + simulate?: { error: boolean; close: boolean; end: boolean; From 1c5ba17bf0d7e95d9164582509c69e4eff491251 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Fri, 20 Nov 2015 11:20:49 -0500 Subject: [PATCH 219/389] Headers is also optional --- hapi/hapi.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hapi/hapi.d.ts b/hapi/hapi.d.ts index 23db49446..8fd84de08 100644 --- a/hapi/hapi.d.ts +++ b/hapi/hapi.d.ts @@ -903,7 +903,7 @@ declare module "hapi" { /** the request URL. If the URI includes an authority (e.g. 'example.com:8080'), it is used to automatically set an HTTP 'Host' header, unless one was specified in headers.*/ url: string; /** an object with optional request headers where each key is the header name and the value is the header content. Defaults to no additions to the default Shot headers.*/ - headers: IDictionary; + headers?: IDictionary; /** n optional string, buffer or object containing the request payload. In case of an object it will be converted to a string for you. Defaults to no payload. Note that payload processing defaults to 'application/json' if no 'Content-Type' header provided.*/ payload?: string|{}|Buffer; /** an optional credentials object containing authentication information. The credentials are used to bypass the default authentication strategies, and are validated directly as if they were received via an authentication scheme. Defaults to no credentials.*/ From 59e1cd247aa0509666f3bbdbff318ca20e27de5f Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Fri, 20 Nov 2015 11:48:28 -0500 Subject: [PATCH 220/389] Options could be a string --- hapi/hapi.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hapi/hapi.d.ts b/hapi/hapi.d.ts index 8fd84de08..727bada75 100644 --- a/hapi/hapi.d.ts +++ b/hapi/hapi.d.ts @@ -897,7 +897,7 @@ declare module "hapi" { export interface IServerInject { - (options: { + (options: string | { /** the request HTTP method (e.g. 'POST'). Defaults to 'GET'.*/ method: string; /** the request URL. If the URI includes an authority (e.g. 'example.com:8080'), it is used to automatically set an HTTP 'Host' header, unless one was specified in headers.*/ From 088b384ad6d5897529d43934ded1d8c43a7a6b94 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Mon, 23 Nov 2015 09:17:32 -0500 Subject: [PATCH 221/389] Hapi does not use bluebird --- hapi/hapi.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hapi/hapi.d.ts b/hapi/hapi.d.ts index 727bada75..644f07e09 100644 --- a/hapi/hapi.d.ts +++ b/hapi/hapi.d.ts @@ -7,7 +7,7 @@ /// -/// +/// From 88d8553e62a0b552ac70aaf8cd1f844463b9eb52 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Mon, 30 Nov 2015 09:38:59 -0500 Subject: [PATCH 222/389] Adding duck typed Promise Interface --- hapi/hapi.d.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hapi/hapi.d.ts b/hapi/hapi.d.ts index 644f07e09..fe9e17b5b 100644 --- a/hapi/hapi.d.ts +++ b/hapi/hapi.d.ts @@ -7,10 +7,6 @@ /// -/// - - - declare module "hapi" { import http = require("http"); @@ -21,6 +17,10 @@ declare module "hapi" { [key: string]: T; } + interface IPromise { + + } + /** Boom Module for errors. https://github.com/hapijs/boom * boom provides a set of utilities for returning HTTP errors. Each utility returns a Boom error response object (instance of Error) which includes the following properties: */ export interface IBoom extends Error { @@ -234,12 +234,12 @@ declare module "hapi" { When calling reply(), the framework waits until process.nextTick() to continue processing the request and transmit the response. This enables making changes to the returned response object before the response is sent. This means the framework will resume as soon as the handler method exits. To suspend this behavior, the returned response object supports the following methods: hold(), send() */ export interface IReply { (err: Error, - result?: string|number|boolean|Buffer|stream.Stream | Promise | T, + result?: string|number|boolean|Buffer|stream.Stream | IPromise | T, /** Note that when used to return both an error and credentials in the authentication methods, reply() must be called with three arguments function(err, null, data) where data is the additional authentication information. */ credentialData?: any ): IBoom; /** Note that if result is a Stream with a statusCode property, that status code will be used as the default response code. */ - (result: string|number|boolean|Buffer|stream.Stream | Promise | T): Response; + (result: string|number|boolean|Buffer|stream.Stream | IPromise | T): Response; /** Returns control back to the framework without setting a response. If called in the handler, the response defaults to an empty payload with status code 200. * The data argument is only used for passing back authentication data and is ignored elsewhere. */ From a767b1466cbe07b3065bfa9c0bf1cbe2b05578ab Mon Sep 17 00:00:00 2001 From: Daniel Gruber Date: Mon, 30 Nov 2015 16:01:59 +0100 Subject: [PATCH 223/389] added option pane --- leaflet-label/leaflet-label.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/leaflet-label/leaflet-label.d.ts b/leaflet-label/leaflet-label.d.ts index a77def73c..02d94a321 100644 --- a/leaflet-label/leaflet-label.d.ts +++ b/leaflet-label/leaflet-label.d.ts @@ -56,6 +56,7 @@ declare module L { className?: string; clickable?: boolean; direction?: string; // 'left' | 'right' | 'auto'; + pane?: string; noHide?: boolean; offset?: Point; opacity?: number; From 25f513d3bf40cc952819d0d6839f4b10bccffef9 Mon Sep 17 00:00:00 2001 From: gcroteau Date: Mon, 30 Nov 2015 10:17:44 -0500 Subject: [PATCH 224/389] Cleaned up the definition file. --- turf/turf-test.ts | 40 ++++++++++++++++++------------------ turf/turf.d.ts | 52 ++++++++++++++++++++++++++++++----------------- 2 files changed, 53 insertions(+), 39 deletions(-) diff --git a/turf/turf-test.ts b/turf/turf-test.ts index a6bb7e2ac..a262b359e 100644 --- a/turf/turf-test.ts +++ b/turf/turf-test.ts @@ -1,8 +1,8 @@ /// -////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////// // Tests data initialisation -////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////// var point1 = { "type": "Feature", @@ -258,9 +258,9 @@ var aggregations = [ } ]; -////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////// // Tests Aggregation -////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////// // -- Test aggregate -- var aggregated = turf.aggregate(polygons, points, aggregations); @@ -289,9 +289,9 @@ var summed = turf.sum(polygons, points, 'population', 'sum'); // -- Test variance -- var varianced = turf.variance(polygons, points, 'population', 'variance'); -////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////// // Tests Measurement -////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////// // -- Test along -- var along = turf.along(line, 1, 'miles'); @@ -343,9 +343,9 @@ var resized = turf.size(bbox, 2); // -- Test square -- var squared = turf.square(bbox); -////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////// // Tests Transformation -////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////// // -- Test bezier -- var curved = turf.bezier(line); @@ -375,9 +375,9 @@ var simplified = turf.simplify(polygon1, tolerance, false); // -- Test union -- var union = turf.union(polygon1, polygon2); -////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////// // Tests Misc -////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////// // -- Test combine -- var combined = turf.combine(features); @@ -397,9 +397,9 @@ var sliced = turf.lineSlice(point1, point2, line); // -- Test pointOnLine -- var snapped = turf.pointOnLine(line, point1); -////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////// // Tests Helper -////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////// // -- Test featurecollection -- var fc = turf.featurecollection([point1, point2]); @@ -431,9 +431,9 @@ var polygon = turf.polygon([[ [-2.275543, 53.464547] ]], { name: 'poly1', population: 400}); -////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////// // Tests Data -////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////// // -- Test filter -- var key = "species"; @@ -458,9 +458,9 @@ var filtered = turf.remove(points, 'marker-color', '#00f'); var points = turf.random('points', 1000); var sample = turf.sample(points, 10); -////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////// // Tests Interpolation -//////////////////////////////////////////////////////////////////////////; +/////////////////////////////////////////// // -- Test hexGrid -- var cellWidth = 50; @@ -487,9 +487,9 @@ var tin = turf.tin(points, 'z'); // -- Test triangleGrid -- var triangleGrid = turf.triangleGrid(extent, cellWidth, units); -////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////// // Tests Joins -////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////// // -- Test inside -- var isInside1 = turf.inside(point1, polygon); @@ -500,9 +500,9 @@ var tagged = turf.tag(points, triangleGrid, 'fill', 'marker-color'); // -- Test within -- var ptsWithin = turf.within(points, polygons); -////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////// // Tests Classification -////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////// // -- Test jenks -- var breaks = turf.jenks(points, 'population', 3); diff --git a/turf/turf.d.ts b/turf/turf.d.ts index bbc84eac3..07299e766 100644 --- a/turf/turf.d.ts +++ b/turf/turf.d.ts @@ -11,7 +11,8 @@ declare module turf { ////////////////////////////////////////////////////// /** - * Calculates a series of aggregations for a set of points within a set of polygons. Sum, average, count, min, max, and deviation are supported. + * Calculates a series of aggregations for a set of points within a set of polygons. + * Sum, average, count, min, max, and deviation are supported. * @param polygons Polygons with values on which to aggregate * @param points Points to be aggregated * @param aggregations An array of aggregation objects @@ -106,7 +107,7 @@ declare module turf { * Takes a line and returns a point at a specified distance along the line. * @param line Input line * @param distance Distance along the line - * @param [units=miles] 'miles', 'feet', 'kilometers', 'meters', or 'degrees' + * @param [units=miles] 'miles', 'kilometers', 'radians' or 'degrees' * @returns Point along the line */ function along(line: GeoJSON.Feature, distance: number, units?: string): GeoJSON.Feature; @@ -141,27 +142,30 @@ declare module turf { function center(features: GeoJSON.FeatureCollection): GeoJSON.Feature; /** - * Takes one or more features and calculates the centroid using the arithmetic mean of all vertices. This lessens the effect of small islands and artifacts when calculating the centroid of a set of polygons. + * Takes one or more features and calculates the centroid using the arithmetic mean of all vertices. + * This lessens the effect of small islands and artifacts when calculating the centroid of a set of polygons. * @param features Input features * @returns The centroid of the input features */ function centroid(features: GeoJSON.Feature | GeoJSON.FeatureCollection): GeoJSON.Feature; /** - * Takes a Point and calculates the location of a destination point given a distance in degrees, radians, miles, or kilometers; and bearing in degrees. This uses the Haversine formula to account for global curvature. + * Takes a Point and calculates the location of a destination point given a distance in degrees, radians, miles, or kilometers; and bearing in degrees. + * This uses the Haversine formula to account for global curvature. * @param start Starting point * @param distance Distance from the starting point * @param bearing Ranging from -180 and 180 - * @param units 'miles', 'feet', 'kilometers', 'meters', or 'degrees' + * @param units 'miles', 'kilometers', 'radians', or 'degrees' * @returns Destination point */ function destination(start: GeoJSON.Feature, distance: number, bearing: number, units: string): GeoJSON.Feature; /** - * Calculates the distance between two points in degress, radians, miles, or kilometers. This uses the Haversine formula to account for global curvature. + * Calculates the distance between two points in degress, radians, miles, or kilometers. + * This uses the Haversine formula to account for global curvature. * @param from Origin point * @param to Destination point - * @param [units=kilometers] 'miles', 'feet', 'kilometers', 'meters', or 'degrees' + * @param [units=kilometers] 'miles', 'kilometers', 'radians', or 'degrees' * @returns Distance between the two points */ function distance(from: GeoJSON.Feature, to: GeoJSON.Feature, units?: string): number; @@ -183,7 +187,7 @@ declare module turf { /** * Takes a line and measures its length in the specified units. * @param line Line to measure - * @param units 'miles', 'feet', 'kilometers', 'meters', or 'degrees' + * @param units 'miles', 'kilometers', 'radians', or 'degrees' * @returns Length of the input line */ function lineDistance(line: GeoJSON.Feature, units: string): number; @@ -197,7 +201,8 @@ declare module turf { function midpoint(pt1: GeoJSON.Feature, pt2: GeoJSON.Feature): GeoJSON.Feature; /** - * Takes a feature and returns a Point guaranteed to be on the surface of the feature. Given a Polygon, the point will be in the area of the polygon. Given a LineString, the point will be along the string. Given a Point, the point will the same as the input. + * Takes a feature and returns a Point guaranteed to be on the surface of the feature. Given a Polygon, the point will be in the area of the polygon. + * Given a LineString, the point will be along the string. Given a Point, the point will the same as the input. * @param input Any feature or set of features * @returns A point on the surface of input */ @@ -223,7 +228,8 @@ declare module turf { ////////////////////////////////////////////////////// /** - * Takes a line and returns a curved version by applying a Bezier spline algorithm. The bezier spline implementation is by Leszek Rybicki. + * Takes a line and returns a curved version by applying a Bezier spline algorithm. + * The bezier spline implementation is by Leszek Rybicki. * @param line Input LineString * @param [resolution=10000] Time in milliseconds between points * @param [sharpness=0.85] A measure of how curvy the path should be between splines @@ -235,7 +241,7 @@ declare module turf { * Calculates a buffer for input features for a given radius. Units supported are miles, kilometers, and degrees. * @param feature Input to be buffered * @param distance Distance to draw the buffer - * @param units 'miles', 'feet', 'kilometers', 'meters', or 'degrees' + * @param units 'miles', 'kilometers', 'radians', or 'degrees' * @returns Buffered features */ function buffer(feature: GeoJSON.Feature | GeoJSON.FeatureCollection, distance: number, units: string): GeoJSON.Feature | GeoJSON.FeatureCollection; @@ -254,7 +260,7 @@ declare module turf { * @param input Input points * @returns A convex hull */ - function convex(points: GeoJSON.FeatureCollection): GeoJSON.Feature; + function convex(input: GeoJSON.FeatureCollection): GeoJSON.Feature; /** * Finds the difference between two polygons by clipping the second polygon from the first. @@ -265,22 +271,27 @@ declare module turf { function difference(poly1: GeoJSON.Feature, poly2: GeoJSON.Feature): GeoJSON.Feature; /** - * Takes two polygons and finds their intersection. If they share a border, returns the border; if they don't intersect, returns undefined. + * Takes two polygons and finds their intersection. + * If they share a border, returns the border; if they don't intersect, returns undefined. * @param poly1 The first polygon * @param poly2 The second polygon - * @returns If poly1 and poly2 overlap, returns a Polygon feature representing the area they overlap; if poly1 and poly2 do not overlap, returns undefined; if poly1 and poly2 share a border, a MultiLineString of the locations where their borders are shared + * @returns If poly1 and poly2 overlap, returns a Polygon feature representing the area they overlap; + * if poly1 and poly2 do not overlap, returns undefined; + * if poly1 and poly2 share a border, a MultiLineString of the locations where their borders are shared */ function intersect(poly1: GeoJSON.Feature, poly2: GeoJSON.Feature): GeoJSON.Feature; /** - * Takes a set of polygons and returns a single merged polygon feature. If the input polygon features are not contiguous, this function returns a MultiPolygon feature. + * Takes a set of polygons and returns a single merged polygon feature. + * If the input polygon features are not contiguous, this function returns a MultiPolygon feature. * @param fc Input polygons * @returns Merged polygon or multipolygon */ function merge(fc: GeoJSON.FeatureCollection): GeoJSON.Feature; /** - * Takes a LineString or Polygon and returns a simplified version. Internally uses simplify-js to perform simplification. + * Takes a LineString or Polygon and returns a simplified version. + * Internally uses simplify-js to perform simplification. * @param feature Feature to be simplified * @param tolerance Simplification tolerance * @param highQuality Whether or not to spend more time to create a higher-quality simplification with a different algorithm @@ -289,7 +300,8 @@ declare module turf { function simplify(feature: GeoJSON.Feature | GeoJSON.FeatureCollection | GeoJSON.GeometryCollection, tolerance: number, highQuality: boolean): GeoJSON.Feature | GeoJSON.FeatureCollection | GeoJSON.GeometryCollection; /** - * Takes two polygons and returns a combined polygon. If the input polygons are not contiguous, this function returns a MultiPolygon feature. + * Takes two polygons and returns a combined polygon. + * If the input polygons are not contiguous, this function returns a MultiPolygon feature. * @param poly1 Input polygon * @param poly2 Another input polygon * @returns A combined Polygon or MultiPolygon feature @@ -446,7 +458,8 @@ declare module turf { function isolines(points: GeoJSON.FeatureCollection, z: string, resolution: number, breaks: Array): GeoJSON.FeatureCollection; /** - * Takes a triangular plane as a Polygon and a Point within that triangle and returns the z-value at that point. The Polygon needs to have properties a, b, and c that define the values at its three corners. + * Takes a triangular plane as a Polygon and a Point within that triangle and returns the z-value at that point. + * The Polygon needs to have properties a, b, and c that define the values at its three corners. * @param interpolatedPoint The Point for which a z-value will be calculated * @param triangle A Polygon feature with three vertices * @returns The z-value for interpolatedPoint @@ -495,7 +508,8 @@ declare module turf { ////////////////////////////////////////////////////// /** - * Takes a Point and a Polygon or MultiPolygon and determines if the point resides inside the polygon. The polygon can be convex or concave. The function accounts for holes. + * Takes a Point and a Polygon or MultiPolygon and determines if the point resides inside the polygon. + * The polygon can be convex or concave. The function accounts for holes. * @param point Input point * @param polygon Input polygon or multipolygon * @returns true if the Point is inside the Polygon; false if the Point is not inside the Polygon From af9d89e7251afc795f4ed6aa37eeb27a8971231b Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Mon, 30 Nov 2015 11:51:47 -0500 Subject: [PATCH 225/389] Basing the duck typed Promise interface on es6 --- hapi/hapi.d.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hapi/hapi.d.ts b/hapi/hapi.d.ts index fe9e17b5b..b31c24b16 100644 --- a/hapi/hapi.d.ts +++ b/hapi/hapi.d.ts @@ -17,8 +17,15 @@ declare module "hapi" { [key: string]: T; } - interface IPromise { + interface IThenable { + then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => U | IThenable): IThenable; + then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => void): IThenable; + } + interface IPromise extends IThenable { + then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => U | IThenable): IPromise; + then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => void): IPromise; + catch(onRejected?: (error: any) => U | IThenable): IPromise; } /** Boom Module for errors. https://github.com/hapijs/boom From 92ca0f084e9362e072167164c4069c89f463affb Mon Sep 17 00:00:00 2001 From: James O'Cull Date: Mon, 30 Nov 2015 14:23:24 -0500 Subject: [PATCH 226/389] Changes to Sequelize validation promise returns that provide the appropriate property definitions for validation errors --- sequelize/sequelize.d.ts | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/sequelize/sequelize.d.ts b/sequelize/sequelize.d.ts index 0a151c60f..6785989dc 100644 --- a/sequelize/sequelize.d.ts +++ b/sequelize/sequelize.d.ts @@ -2007,7 +2007,7 @@ declare module "sequelize" { /** * The Base Error all Sequelize Errors inherit from. */ - interface BaseError extends ErrorConstructor { } + interface BaseError extends Error, ErrorConstructor { } interface ValidationError extends BaseError { @@ -2026,7 +2026,10 @@ declare module "sequelize" { * @param path The path to be checked for error items */ get( path : string ) : Array; - + + /** Array of ValidationErrorItem objects describing the validation errors */ + errors : Array + } interface ValidationErrorItem extends BaseError { @@ -2041,7 +2044,19 @@ declare module "sequelize" { * @param value The value that generated the error */ new ( message : string, type : string, path : string, value : string ) : ValidationErrorItem; - + + /** An error message */ + message : string; + + /** The type of the validation error */ + type : string; + + /** The field that triggered the validation error */ + path : string; + + /** The value that generated the error */ + value : string; + } interface DatabaseError extends BaseError { @@ -2790,7 +2805,7 @@ declare module "sequelize" { * * @param options.skip An array of strings. All properties that are in this array will not be validated */ - validate( options? : { skip?: Array } ) : Promise; + validate( options? : { skip?: Array } ) : Promise; /** * This is the same as calling `set` and then calling `save`. @@ -5571,7 +5586,7 @@ declare module "sequelize" { * @param options Query Options for authentication */ authenticate( options? : QueryOptions ) : Promise; - validate( options? : QueryOptions ) : Promise; + validate( options? : QueryOptions ) : Promise; /** * Start a transaction. When using transactions, you should pass the transaction in the options argument From d1daffcdc17f3d241bb192048f2a6286ffee1be3 Mon Sep 17 00:00:00 2001 From: James O'Cull Date: Mon, 30 Nov 2015 14:31:21 -0500 Subject: [PATCH 227/389] Minor style alignment --- sequelize/sequelize.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sequelize/sequelize.d.ts b/sequelize/sequelize.d.ts index 6785989dc..9b5e935bf 100644 --- a/sequelize/sequelize.d.ts +++ b/sequelize/sequelize.d.ts @@ -1994,7 +1994,7 @@ declare module "sequelize" { INITIALLY_IMMEDIATE: DeferrableInitiallyImmediate; NOT: DeferrableNot; SET_DEFERRED: DeferrableSetDeferred; - SET_IMMEDIATE: DeferrableSetImmediate + SET_IMMEDIATE: DeferrableSetImmediate; } // @@ -2028,7 +2028,7 @@ declare module "sequelize" { get( path : string ) : Array; /** Array of ValidationErrorItem objects describing the validation errors */ - errors : Array + errors : Array; } From e088fd2475fcda1072bbe16c54755bc6138b41bd Mon Sep 17 00:00:00 2001 From: Tim Haase Date: Mon, 30 Nov 2015 21:48:04 +0100 Subject: [PATCH 228/389] Fix module export in state-machine typing --- state-machine/state-machine.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/state-machine/state-machine.d.ts b/state-machine/state-machine.d.ts index 67f7012b1..d17c58dc6 100644 --- a/state-machine/state-machine.d.ts +++ b/state-machine/state-machine.d.ts @@ -79,5 +79,5 @@ interface StateMachine { declare var StateMachine: StateMachineStatic; declare module "state-machine" { - export = StateMachineStatic; + export = StateMachine; } From 6ffb4bca1df52db232db2d7ae42925bab79fcfd8 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Tue, 1 Dec 2015 05:15:56 +0500 Subject: [PATCH 229/389] lodash: signatures of _.groupBy have been changed --- lodash/lodash-tests.ts | 157 ++++++++++++++++++-- lodash/lodash.d.ts | 321 ++++++++++++++++++++++++++++------------- 2 files changed, 369 insertions(+), 109 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index bdc08ccdc..428f38fbd 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -3396,21 +3396,154 @@ module TestForEachRight { } } -result = <_.Dictionary>_.groupBy([4.2, 6.1, 6.4], function (num) { return Math.floor(num); }); -result = <_.Dictionary>_.groupBy([4.2, 6.1, 6.4], function (num) { return this.floor(num); }, Math); -result = <_.Dictionary>_.groupBy(['one', 'two', 'three'], 'length'); +// _.groupBy +module TestGroupBy { + type SampleType = {a: number; b: string; c: boolean;}; -result = <_.Dictionary>_.groupBy({ prop1: 4.2, prop2: 6.1, prop3: 6.4}, function (num) { return Math.floor(num); }); -result = <_.Dictionary>_.groupBy({ prop1: 4.2, prop2: 6.1, prop3: 6.4}, function (num) { return this.floor(num); }, Math); -result = <_.Dictionary>_.groupBy({ prop1: 'one', prop2: 'two', prop3: 'three'}, 'length'); + let array: SampleType[]; + let list: _.List; + let dictionary: _.Dictionary; -result = <_.Dictionary>_([4.2, 6.1, 6.4]).groupBy(function (num) { return Math.floor(num); }).value(); -result = <_.Dictionary>_([4.2, 6.1, 6.4]).groupBy(function (num) { return this.floor(num); }, Math).value(); -result = <_.Dictionary>_(['one', 'two', 'three']).groupBy('length').value(); + let stringIterator: (char: string, index: number, string: string) => number; + let listIterator: (value: SampleType, index: number, collection: _.List) => number; + let dictionaryIterator: (value: SampleType, key: string, collection: _.Dictionary) => number; -result = <_.Dictionary>_({ prop1: 4.2, prop2: 6.1, prop3: 6.4}).groupBy(function (num) { return Math.floor(num); }).value(); -result = <_.Dictionary>_({ prop1: 4.2, prop2: 6.1, prop3: 6.4}).groupBy(function (num) { return this.floor(num); }, Math).value(); -result = <_.Dictionary>_({ prop1: 'one', prop2: 'two', prop3: 'three'}).groupBy('length').value(); + { + let result: _.Dictionary; + + result = _.groupBy(''); + result = _.groupBy('', stringIterator); + result = _.groupBy('', stringIterator, any); + result = _.groupBy('', stringIterator); + result = _.groupBy('', stringIterator, any); + } + + { + let result: _.Dictionary; + + result = _.groupBy(array); + result = _.groupBy(array, listIterator); + result = _.groupBy(array, listIterator, any); + result = _.groupBy(array, ''); + result = _.groupBy(array, '', any); + result = _.groupBy(array, {a: 42}); + + result = _.groupBy(array, listIterator); + result = _.groupBy(array, listIterator, any); + result = _.groupBy(array, '', true); + result = _.groupBy<{a: number}, SampleType>(array, {a: 42}); + + result = _.groupBy(list); + result = _.groupBy(list, listIterator); + result = _.groupBy(list, listIterator, any); + result = _.groupBy(list, ''); + result = _.groupBy(list, '', any); + result = _.groupBy(list, {a: 42}); + + result = _.groupBy(list, listIterator); + result = _.groupBy(list, listIterator, any); + result = _.groupBy(list, '', true); + result = _.groupBy<{a: number}, SampleType>(list, {a: 42}); + + result = _.groupBy(dictionary); + result = _.groupBy(dictionary, dictionaryIterator); + result = _.groupBy(dictionary, dictionaryIterator, any); + result = _.groupBy(dictionary, ''); + result = _.groupBy(dictionary, '', any); + result = _.groupBy(dictionary, {a: 42}); + + result = _.groupBy(dictionary, dictionaryIterator); + result = _.groupBy(dictionary, dictionaryIterator, any); + result = _.groupBy(dictionary, '', true); + result = _.groupBy<{a: number}, SampleType>(dictionary, {a: 42}); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + result = _('').groupBy(); + result = _('').groupBy(stringIterator); + result = _('').groupBy(stringIterator, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + result = _(array).groupBy(); + result = _(array).groupBy(listIterator); + result = _(array).groupBy(listIterator, any); + result = _(array).groupBy(''); + result = _(array).groupBy('', true); + result = _(array).groupBy<{a: number}>({a: 42}); + + result = _(list).groupBy(); + result = _(list).groupBy(listIterator); + result = _(list).groupBy(listIterator, any); + result = _(list).groupBy(''); + result = _(list).groupBy('', any); + result = _(list).groupBy({a: 42}); + + result = _(list).groupBy(listIterator); + result = _(list).groupBy(listIterator, any); + result = _(list).groupBy('', true); + result = _(list).groupBy<{a: number}, SampleType>({a: 42}); + + result = _(dictionary).groupBy(); + result = _(dictionary).groupBy(dictionaryIterator); + result = _(dictionary).groupBy(dictionaryIterator, any); + result = _(dictionary).groupBy(''); + result = _(dictionary).groupBy('', any); + result = _(dictionary).groupBy({a: 42}); + + result = _(dictionary).groupBy(dictionaryIterator); + result = _(dictionary).groupBy(dictionaryIterator, any); + result = _(dictionary).groupBy('', true); + result = _(dictionary).groupBy<{a: number}, SampleType>({a: 42}); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + result = _('').chain().groupBy(); + result = _('').chain().groupBy(stringIterator); + result = _('').chain().groupBy(stringIterator, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + result = _(array).chain().groupBy(); + result = _(array).chain().groupBy(listIterator); + result = _(array).chain().groupBy(listIterator, any); + result = _(array).chain().groupBy(''); + result = _(array).chain().groupBy('', true); + result = _(array).chain().groupBy<{a: number}>({a: 42}); + + result = _(list).chain().groupBy(); + result = _(list).chain().groupBy(listIterator); + result = _(list).chain().groupBy(listIterator, any); + result = _(list).chain().groupBy(''); + result = _(list).chain().groupBy('', any); + result = _(list).chain().groupBy({a: 42}); + + result = _(list).chain().groupBy(listIterator); + result = _(list).chain().groupBy(listIterator, any); + result = _(list).chain().groupBy('', true); + result = _(list).chain().groupBy<{a: number}, SampleType>({a: 42}); + + result = _(dictionary).chain().groupBy(); + result = _(dictionary).chain().groupBy(dictionaryIterator); + result = _(dictionary).chain().groupBy(dictionaryIterator, any); + result = _(dictionary).chain().groupBy(''); + result = _(dictionary).chain().groupBy('', any); + result = _(dictionary).chain().groupBy({a: 42}); + + result = _(dictionary).chain().groupBy(dictionaryIterator); + result = _(dictionary).chain().groupBy(dictionaryIterator, any); + result = _(dictionary).chain().groupBy('', true); + result = _(dictionary).chain().groupBy<{a: number}, SampleType>({a: 42}); + } +} // _.include module TestInclude { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index ad465c5c3..bc47a062c 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -5291,130 +5291,257 @@ declare module _ { //_.groupBy interface LoDashStatic { /** - * Creates an object composed of keys generated from the results of running each element - * of a collection through the callback. The corresponding value of each key is an array - * of the elements responsible for generating the key. The callback is bound to thisArg - * and invoked with three arguments; (value, index|key, collection). - * - * If a property name is provided for callback the created "_.pluck" style callback will - * return the property value of the given element. - * If an object is provided for callback the created "_.where" style callback will return - * true for elements that have the properties of the given object, else false - * @param collection The collection to iterate over. - * @param callback The function called per iteration. - * @param thisArg The this binding of callback. - * @return Returns the composed aggregate object. - **/ - groupBy( - collection: Array, - callback?: ListIterator, - thisArg?: any): Dictionary; - - /** - * @see _.groupBy - **/ - groupBy( + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is an array of the elements responsible for generating the + * key. The iteratee is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + groupBy( collection: List, - callback?: ListIterator, - thisArg?: any): Dictionary; + iteratee?: ListIterator, + thisArg?: any + ): Dictionary; /** - * @see _.groupBy - * @param pluckValue _.pluck style callback - **/ + * @see _.groupBy + */ groupBy( - collection: Array, - pluckValue: string): Dictionary; + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): Dictionary; /** - * @see _.groupBy - * @param pluckValue _.pluck style callback - **/ - groupBy( - collection: List, - pluckValue: string): Dictionary; - - /** - * @see _.groupBy - * @param whereValue _.where style callback - **/ - groupBy( - collection: Array, - whereValue: W): Dictionary; - - /** - * @see _.groupBy - * @param whereValue _.where style callback - **/ - groupBy( - collection: List, - whereValue: W): Dictionary; - - /** - * @see _.groupBy - **/ - groupBy( + * @see _.groupBy + */ + groupBy( collection: Dictionary, - callback?: DictionaryIterator, - thisArg?: any): Dictionary; + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; /** - * @see _.groupBy - * @param pluckValue _.pluck style callback - **/ - groupBy( - collection: Dictionary, - pluckValue: string): Dictionary; + * @see _.groupBy + */ + groupBy( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; /** - * @see _.groupBy - * @param whereValue _.where style callback - **/ - groupBy( - collection: Dictionary, - whereValue: W): Dictionary; + * @see _.groupBy + */ + groupBy( + collection: List|Dictionary, + iteratee?: string, + thisArg?: TValue + ): Dictionary; + + /** + * @see _.groupBy + */ + groupBy( + collection: List|Dictionary, + iteratee?: string, + thisArg?: any + ): Dictionary; + + /** + * @see _.groupBy + */ + groupBy( + collection: List|Dictionary, + iteratee?: TWhere + ): Dictionary; + + /** + * @see _.groupBy + */ + groupBy( + collection: List|Dictionary, + iteratee?: Object + ): Dictionary; + } + + interface LoDashImplicitWrapper { + /** + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; } interface LoDashImplicitArrayWrapper { /** - * @see _.groupBy - **/ - groupBy( - callback: ListIterator, - thisArg?: any): _.LoDashImplicitObjectWrapper<_.Dictionary>; + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; /** - * @see _.groupBy - **/ - groupBy( - pluckValue: string): _.LoDashImplicitObjectWrapper<_.Dictionary>; + * @see _.groupBy + */ + groupBy( + iteratee?: string, + thisArg?: TValue + ): LoDashImplicitObjectWrapper>; /** - * @see _.groupBy - **/ - groupBy( - whereValue: W): _.LoDashImplicitObjectWrapper<_.Dictionary>; + * @see _.groupBy + */ + groupBy( + iteratee?: TWhere + ): LoDashImplicitObjectWrapper>; } interface LoDashImplicitObjectWrapper { /** - * @see _.groupBy - **/ - groupBy( - callback: ListIterator, - thisArg?: any): _.LoDashImplicitObjectWrapper<_.Dictionary>; + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; /** - * @see _.groupBy - **/ - groupBy( - pluckValue: string): _.LoDashImplicitObjectWrapper<_.Dictionary>; + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; /** - * @see _.groupBy - **/ - groupBy( - whereValue: W): _.LoDashImplicitObjectWrapper<_.Dictionary>; + * @see _.groupBy + */ + groupBy( + iteratee?: string, + thisArg?: TValue + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: string, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: TWhere + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: Object + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashExplicitWrapper { + /** + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: string, + thisArg?: TValue + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: TWhere + ): LoDashExplicitObjectWrapper>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: string, + thisArg?: TValue + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: string, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: TWhere + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: Object + ): LoDashExplicitObjectWrapper>; } //_.include From 20636b122b76644e4d8d9b4337d395a40d9f9171 Mon Sep 17 00:00:00 2001 From: vvakame Date: Tue, 1 Dec 2015 10:45:06 +0900 Subject: [PATCH 230/389] switch to TypeScript 1.7.3 --- npm-shrinkwrap.json | 441 ++++++++++++++++++++------------------------ package.json | 2 +- 2 files changed, 203 insertions(+), 240 deletions(-) diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index da07b4d07..6dc63bfb0 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -2,254 +2,217 @@ "name": "DefinitelyTyped", "version": "0.0.1", "dependencies": { + "assertion-error": { + "version": "1.0.1", + "from": "assertion-error@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.0.1.tgz" + }, + "balanced-match": { + "version": "0.3.0", + "from": "balanced-match@>=0.3.0 <0.4.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.3.0.tgz" + }, + "bluebird": { + "version": "2.10.2", + "from": "bluebird@>=2.10.1 <3.0.0", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.10.2.tgz" + }, + "brace-expansion": { + "version": "1.1.2", + "from": "brace-expansion@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.2.tgz" + }, + "concat-map": { + "version": "0.0.1", + "from": "concat-map@0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz" + }, + "core-util-is": { + "version": "1.0.2", + "from": "core-util-is@>=1.0.0 <1.1.0", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz" + }, + "definition-header": { + "version": "0.1.0", + "from": "definition-header@>=0.1.0 <0.2.0", + "resolved": "https://registry.npmjs.org/definition-header/-/definition-header-0.1.0.tgz" + }, "definition-tester": { "version": "0.3.0", "from": "definition-tester@0.3.0", + "resolved": "https://registry.npmjs.org/definition-tester/-/definition-tester-0.3.0.tgz" + }, + "findup-sync": { + "version": "0.3.0", + "from": "findup-sync@>=0.3.0 <0.4.0", + "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.3.0.tgz" + }, + "git-wrapper": { + "version": "0.1.1", + "from": "git-wrapper@>=0.1.1 <0.2.0", + "resolved": "https://registry.npmjs.org/git-wrapper/-/git-wrapper-0.1.1.tgz" + }, + "glob": { + "version": "5.0.15", + "from": "glob@>=5.0.14 <6.0.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz" + }, + "hoek": { + "version": "2.16.3", + "from": "hoek@>=2.2.0 <3.0.0", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz" + }, + "inflight": { + "version": "1.0.4", + "from": "inflight@>=1.0.4 <2.0.0", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.4.tgz" + }, + "inherits": { + "version": "2.0.1", + "from": "inherits@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" + }, + "isarray": { + "version": "0.0.1", + "from": "isarray@0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz" + }, + "isemail": { + "version": "1.2.0", + "from": "isemail@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/isemail/-/isemail-1.2.0.tgz" + }, + "joi": { + "version": "4.9.0", + "from": "joi@>=4.0.0 <5.0.0", + "resolved": "https://registry.npmjs.org/joi/-/joi-4.9.0.tgz" + }, + "joi-assert": { + "version": "0.0.3", + "from": "joi-assert@0.0.3", + "resolved": "https://registry.npmjs.org/joi-assert/-/joi-assert-0.0.3.tgz" + }, + "jsonparse": { + "version": "0.0.5", + "from": "jsonparse@0.0.5", + "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-0.0.5.tgz" + }, + "JSONStream": { + "version": "0.8.4", + "from": "JSONStream@>=0.8.4 <0.9.0", + "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-0.8.4.tgz" + }, + "lazy.js": { + "version": "0.4.2", + "from": "lazy.js@>=0.4.2 <0.5.0", + "resolved": "https://registry.npmjs.org/lazy.js/-/lazy.js-0.4.2.tgz" + }, + "manticore": { + "version": "0.2.4", + "from": "manticore@>=0.2.4 <0.3.0", + "resolved": "https://registry.npmjs.org/manticore/-/manticore-0.2.4.tgz", "dependencies": { "bluebird": { - "version": "2.10.1", - "from": "bluebird@>=2.10.1 <3.0.0", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.10.1.tgz" - }, - "definition-header": { - "version": "0.1.0", - "from": "definition-header@>=0.1.0 <0.2.0", - "resolved": "https://registry.npmjs.org/definition-header/-/definition-header-0.1.0.tgz", - "dependencies": { - "joi": { - "version": "4.9.0", - "from": "joi@>=4.0.0 <5.0.0", - "resolved": "https://registry.npmjs.org/joi/-/joi-4.9.0.tgz", - "dependencies": { - "hoek": { - "version": "2.16.3", - "from": "hoek@>=2.2.0 <3.0.0", - "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz" - }, - "topo": { - "version": "1.0.3", - "from": "topo@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/topo/-/topo-1.0.3.tgz" - }, - "isemail": { - "version": "1.2.0", - "from": "isemail@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/isemail/-/isemail-1.2.0.tgz" - }, - "moment": { - "version": "2.10.6", - "from": "moment@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.10.6.tgz" - } - } - }, - "joi-assert": { - "version": "0.0.3", - "from": "joi-assert@0.0.3", - "resolved": "https://registry.npmjs.org/joi-assert/-/joi-assert-0.0.3.tgz", - "dependencies": { - "assertion-error": { - "version": "1.0.1", - "from": "assertion-error@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.0.1.tgz" - } - } - }, - "parsimmon": { - "version": "0.5.1", - "from": "parsimmon@>=0.5.0 <0.6.0", - "resolved": "https://registry.npmjs.org/parsimmon/-/parsimmon-0.5.1.tgz", - "dependencies": { - "pjs": { - "version": "5.1.1", - "from": "pjs@>=5.0.0 <6.0.0", - "resolved": "https://registry.npmjs.org/pjs/-/pjs-5.1.1.tgz" - } - } - }, - "xregexp": { - "version": "2.0.0", - "from": "xregexp@>=2.0.0 <2.1.0", - "resolved": "https://registry.npmjs.org/xregexp/-/xregexp-2.0.0.tgz" - } - } - }, - "findup-sync": { - "version": "0.3.0", - "from": "findup-sync@>=0.3.0 <0.4.0", - "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.3.0.tgz" - }, - "git-wrapper": { - "version": "0.1.1", - "from": "git-wrapper@>=0.1.1 <0.2.0", - "resolved": "https://registry.npmjs.org/git-wrapper/-/git-wrapper-0.1.1.tgz" - }, - "glob": { - "version": "5.0.14", - "from": "glob@>=5.0.14 <6.0.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.14.tgz", - "dependencies": { - "inflight": { - "version": "1.0.4", - "from": "inflight@>=1.0.4 <2.0.0", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.4.tgz", - "dependencies": { - "wrappy": { - "version": "1.0.1", - "from": "wrappy@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz" - } - } - }, - "inherits": { - "version": "2.0.1", - "from": "inherits@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" - }, - "minimatch": { - "version": "2.0.10", - "from": "minimatch@>=2.0.1 <3.0.0", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-2.0.10.tgz", - "dependencies": { - "brace-expansion": { - "version": "1.1.0", - "from": "brace-expansion@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.0.tgz", - "dependencies": { - "balanced-match": { - "version": "0.2.0", - "from": "balanced-match@>=0.2.0 <0.3.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.2.0.tgz" - }, - "concat-map": { - "version": "0.0.1", - "from": "concat-map@0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz" - } - } - } - } - }, - "once": { - "version": "1.3.2", - "from": "once@>=1.3.0 <2.0.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.3.2.tgz", - "dependencies": { - "wrappy": { - "version": "1.0.1", - "from": "wrappy@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz" - } - } - }, - "path-is-absolute": { - "version": "1.0.0", - "from": "path-is-absolute@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.0.tgz" - } - } - }, - "lazy.js": { - "version": "0.4.2", - "from": "lazy.js@>=0.4.2 <0.5.0", - "resolved": "https://registry.npmjs.org/lazy.js/-/lazy.js-0.4.2.tgz" - }, - "manticore": { - "version": "0.2.4", - "from": "manticore@>=0.2.4 <0.3.0", - "resolved": "https://registry.npmjs.org/manticore/-/manticore-0.2.4.tgz", - "dependencies": { - "JSONStream": { - "version": "0.8.4", - "from": "JSONStream@>=0.8.4 <0.9.0", - "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-0.8.4.tgz", - "dependencies": { - "jsonparse": { - "version": "0.0.5", - "from": "jsonparse@0.0.5", - "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-0.0.5.tgz" - }, - "through": { - "version": "2.3.8", - "from": "through@>=2.2.7 <3.0.0", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz" - } - } - }, - "bluebird": { - "version": "1.2.4", - "from": "bluebird@>=1.2.4 <2.0.0", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-1.2.4.tgz" - }, - "through2": { - "version": "0.5.1", - "from": "through2@>=0.5.1 <0.6.0", - "resolved": "https://registry.npmjs.org/through2/-/through2-0.5.1.tgz", - "dependencies": { - "readable-stream": { - "version": "1.0.33", - "from": "readable-stream@>=1.0.17 <1.1.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.33.tgz", - "dependencies": { - "core-util-is": { - "version": "1.0.1", - "from": "core-util-is@>=1.0.0 <1.1.0", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz" - }, - "isarray": { - "version": "0.0.1", - "from": "isarray@0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz" - }, - "string_decoder": { - "version": "0.10.31", - "from": "string_decoder@>=0.10.0 <0.11.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz" - }, - "inherits": { - "version": "2.0.1", - "from": "inherits@>=2.0.1 <2.1.0", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" - } - } - }, - "xtend": { - "version": "3.0.0", - "from": "xtend@>=3.0.0 <3.1.0", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-3.0.0.tgz" - } - } - }, - "type-detect": { - "version": "0.1.2", - "from": "type-detect@>=0.1.2 <0.2.0", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-0.1.2.tgz" - } - } - }, - "optimist": { - "version": "0.6.1", - "from": "optimist@>=0.6.1 <0.7.0", - "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", - "dependencies": { - "wordwrap": { - "version": "0.0.3", - "from": "wordwrap@>=0.0.2 <0.1.0", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz" - }, - "minimist": { - "version": "0.0.10", - "from": "minimist@>=0.0.1 <0.1.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz" - } - } + "version": "1.2.4", + "from": "bluebird@>=1.2.4 <2.0.0", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-1.2.4.tgz" } } }, + "minimatch": { + "version": "3.0.0", + "from": "minimatch@>=2.0.0 <3.0.0||>=3.0.0 <4.0.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.0.tgz" + }, + "minimist": { + "version": "0.0.10", + "from": "minimist@>=0.0.1 <0.1.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz" + }, + "moment": { + "version": "2.10.6", + "from": "moment@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.10.6.tgz" + }, + "once": { + "version": "1.3.3", + "from": "once@>=1.3.0 <2.0.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.3.3.tgz" + }, + "optimist": { + "version": "0.6.1", + "from": "optimist@>=0.6.1 <0.7.0", + "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz" + }, + "parsimmon": { + "version": "0.5.1", + "from": "parsimmon@>=0.5.0 <0.6.0", + "resolved": "https://registry.npmjs.org/parsimmon/-/parsimmon-0.5.1.tgz" + }, + "path-is-absolute": { + "version": "1.0.0", + "from": "path-is-absolute@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.0.tgz" + }, + "pjs": { + "version": "5.1.1", + "from": "pjs@>=5.0.0 <6.0.0", + "resolved": "https://registry.npmjs.org/pjs/-/pjs-5.1.1.tgz" + }, + "readable-stream": { + "version": "1.0.33", + "from": "readable-stream@>=1.0.17 <1.1.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.33.tgz" + }, + "string_decoder": { + "version": "0.10.31", + "from": "string_decoder@>=0.10.0 <0.11.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz" + }, + "through": { + "version": "2.3.8", + "from": "through@>=2.2.7 <3.0.0", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz" + }, + "through2": { + "version": "0.5.1", + "from": "through2@>=0.5.1 <0.6.0", + "resolved": "https://registry.npmjs.org/through2/-/through2-0.5.1.tgz" + }, + "topo": { + "version": "1.1.0", + "from": "topo@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/topo/-/topo-1.1.0.tgz" + }, + "type-detect": { + "version": "0.1.2", + "from": "type-detect@>=0.1.2 <0.2.0", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-0.1.2.tgz" + }, "typescript": { - "version": "1.6.2", - "from": "typescript@1.6.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-1.6.2.tgz" + "version": "1.7.3", + "from": "typescript@1.7.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-1.7.3.tgz" + }, + "wordwrap": { + "version": "0.0.3", + "from": "wordwrap@>=0.0.2 <0.1.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz" + }, + "wrappy": { + "version": "1.0.1", + "from": "wrappy@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz" + }, + "xregexp": { + "version": "2.0.0", + "from": "xregexp@>=2.0.0 <2.1.0", + "resolved": "https://registry.npmjs.org/xregexp/-/xregexp-2.0.0.tgz" + }, + "xtend": { + "version": "3.0.0", + "from": "xtend@>=3.0.0 <3.1.0", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-3.0.0.tgz" } } } diff --git a/package.json b/package.json index 2b9d019f8..78904930b 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,6 @@ }, "devDependencies": { "definition-tester": "0.3.0", - "typescript": "1.6.2" + "typescript": "1.7.3" } } From bb3a32550916d94ce8aa75e9f1b078f9d7d921a1 Mon Sep 17 00:00:00 2001 From: vvakame Date: Tue, 1 Dec 2015 10:45:39 +0900 Subject: [PATCH 231/389] use Node.js v4 on Travis CI --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f99663162..48704282a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: node_js node_js: - - "iojs-v2" + - 4 sudo: false From ee7ca3d75acb71f06af76684be3b7e729ab56f84 Mon Sep 17 00:00:00 2001 From: vvakame Date: Tue, 1 Dec 2015 11:20:58 +0900 Subject: [PATCH 232/389] add npm-debug.log to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 2ea470b9e..2a52c95e0 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ *.map *.swp .DS_Store +npm-debug.log _Resharper.DefinitelyTyped bin From 6278aa9cf60d9a21dae9671e694e60a67e0f89bb Mon Sep 17 00:00:00 2001 From: vvakame Date: Tue, 1 Dec 2015 11:21:13 +0900 Subject: [PATCH 233/389] fix jasmine-matchers/jasmine-matchers-tests.ts --- jasmine-matchers/jasmine-matchers-tests.ts | 138 ++++++++++----------- 1 file changed, 69 insertions(+), 69 deletions(-) diff --git a/jasmine-matchers/jasmine-matchers-tests.ts b/jasmine-matchers/jasmine-matchers-tests.ts index d1cbc0f90..f281b4a83 100644 --- a/jasmine-matchers/jasmine-matchers-tests.ts +++ b/jasmine-matchers/jasmine-matchers-tests.ts @@ -27,8 +27,8 @@ describe('toBeArray', function () { }); it('should pass for [1,"",{}]', function () { expect([ - 1, - "", + 1, + "", { } ]).toBeArray(); @@ -115,13 +115,13 @@ describe('toBeOneOf', function () { describe('matches', function () { it('should find "a" in ["a", "b"]', function () { expect('a').toBeOneOf([ - 'a', + 'a', 'b' ]); }); it('should find "uxebu" in ["company", "uxebu"]', function () { expect('uxebu').toBeOneOf([ - 'company', + 'company', 'uxebu' ]); }); @@ -129,30 +129,30 @@ describe('toBeOneOf', function () { describe('non-matches', function () { it('should not find "" in [" ", "0"]', function () { expect('').not.toBeOneOf([ - ' ', + ' ', '0' ]); }); it('should not find "a" in ["b", "c"]', function () { expect('a').not.toBeOneOf([ - 'b', + 'b', 'c' ]); }); }); }); describe('toBeCloseToOneOf', function () { - function oneDigitOff(actual, expected) { + function oneDigitOff(actual: any, expected: any) { var actualInt = parseInt(actual, 10); return actualInt - 1 <= expected && actualInt + 1 >= expected; } - function tenPercentOff(actual, expected) { + function tenPercentOff(actual: any, expected: any) { return expected * 0.9 <= actual && expected * 1.1 >= actual; } - function oneDigitOrTenPercentOff(actual, expected) { + function oneDigitOrTenPercentOff(actual: any, expected: any) { return oneDigitOff(actual, expected) || tenPercentOff(actual, expected); } - function twoDecimalsOff(actual, expected) { + function twoDecimalsOff(actual: any, expected: any) { var lower = ((expected * 100) - 2) / 100; var upper = ((expected * 100) + 2) / 100; return lower <= actual && upper >= actual; @@ -160,25 +160,25 @@ describe('toBeCloseToOneOf', function () { describe('matches', function () { it('should say 7 is close to one of [8, 9]', function () { expect(7).toBeCloseToOneOf([ - 8, + 8, 9 ], oneDigitOff); }); it('should say 2 is 10% off of one of [2.2, 1.0]', function () { expect(2).toBeCloseToOneOf([ - 2.2, + 2.2, 1.0 ], tenPercentOff); }); it('should say 7 is close to one of [8, 9]', function () { expect(7).toBeCloseToOneOf([ - 8, + 8, 9 ], oneDigitOrTenPercentOff); }); it('should say 1.345 two decimals off of [1.325, 1.365]', function () { expect(1.345).toBeCloseToOneOf([ - 1.325, + 1.325, 1.365 ], twoDecimalsOff); }); @@ -186,26 +186,26 @@ describe('toBeCloseToOneOf', function () { describe('non-matches', function () { it('should say 7 is NOT one off of [9, 10, 11]', function () { expect(7).not.toBeCloseToOneOf([ - 9, - 10, + 9, + 10, 11 ], oneDigitOff); }); it('should say 1 is close to one of [8, 9]', function () { expect(1).not.toBeCloseToOneOf([ - 8, + 8, 9 ], oneDigitOrTenPercentOff); }); it('should say 1.9 is NOT 10% off of one of [2.2, 1.0]', function () { expect(1.9).not.toBeCloseToOneOf([ - 2.2, + 2.2, 1.0 ], tenPercentOff); }); it('should say 1.345 two decimals off of [1.325, 1.365]', function () { expect(1.304).not.toBeCloseToOneOf([ - 1.325, + 1.325, 1.365 ], twoDecimalsOff); }); @@ -216,7 +216,7 @@ describe('toContainOnce', function () { describe('matches', function () { it('should work for arrays', function () { expect([ - 1, + 1, 2 ]).toContainOnce(1); }); @@ -227,7 +227,7 @@ describe('toContainOnce', function () { describe('non-matches', function () { it('should work for arrays', function () { expect([ - 1, + 1, 2 ]).not.toContainOnce(3); }); @@ -257,7 +257,7 @@ describe('toHaveLength', function () { describe('toHaveProperties', function () { describe('matches', function () { it('should work for `{x:0, y:undefined}`', function () { - var obj = { + var obj: any = { x: 0, y: undefined }; @@ -268,7 +268,7 @@ describe('toHaveProperties', function () { describe('toHavePropertiesWithValues', function () { describe('matches', function () { it('should work with a reference object', function () { - function C() { + var C: any = function C() { this.x = 0; } C.prototype.y = 'arbitrary'; @@ -283,7 +283,7 @@ describe('toHavePropertiesWithValues', function () { describe('toHaveOwnProperties', function () { describe('matches', function () { it('should work for `{x:0, y:undefined}`', function () { - var obj = { + var obj: any = { x: 0, y: undefined }; @@ -322,14 +322,14 @@ describe('toHaveBeenCalledXTimes', function () { describe('toExactlyHaveProperties', function () { describe('matches', function () { it('should work for `{x:0, y:undefined}`', function () { - var obj = { + var obj: any = { x: 0, y: undefined }; expect(obj).toExactlyHaveProperties('x', 'y'); }); it('should work in any order', function () { - var obj = { + var obj: any = { x: 0, y: undefined }; @@ -338,14 +338,14 @@ describe('toExactlyHaveProperties', function () { }); describe('non-matches', function () { it('should work for too many properties', function () { - var obj = { + var obj: any = { x: 0, y: undefined }; expect(obj).not.toExactlyHaveProperties('x'); }); it('should work for missing properties', function () { - var obj = { + var obj: any = { x: 0, y: undefined }; @@ -375,17 +375,17 @@ describe('toEndWith', function () { describe('matches', function () { it('should work for string', function () { expect([ - '1', + '1', '2' ]).toEndWith('2'); }); it('should work for array', function () { expect([ - 3, - 4, + 3, + 4, 5 ]).toEndWith([ - 4, + 4, 5 ]); }); @@ -393,17 +393,17 @@ describe('toEndWith', function () { describe('non-matches', function () { it('should work for string', function () { expect([ - '1', + '1', '2' ]).not.toEndWith('3'); }); it('should work for array', function () { expect([ - 3, - 4, + 3, + 4, 5 ]).not.toEndWith([ - 3, + 3, 4 ]); }); @@ -419,8 +419,8 @@ describe('toEachEndWith', function () { }); it('should work for array with multiple elements', function () { expect([ - 'one', - 'zwee', + 'one', + 'zwee', 'three' ]).toEachEndWith('e'); }); @@ -433,8 +433,8 @@ describe('toEachEndWith', function () { }); it('should work for array with multiple elements', function () { expect([ - 'one', - 'zwei', + 'one', + 'zwei', 'three' ]).not.toEachEndWith('e'); }); @@ -449,8 +449,8 @@ describe('toSomeEndWith', function () { }); it('should work for array with multiple elements', function () { expect([ - 'one', - 'zwee', + 'one', + 'zwee', 'three' ]).toSomeEndWith('ee'); }); @@ -463,8 +463,8 @@ describe('toSomeEndWith', function () { }); it('should work for array with multiple elements', function () { expect([ - 'one', - 'zwei', + 'one', + 'zwei', 'three' ]).not.toSomeEndWith('a'); }); @@ -491,17 +491,17 @@ describe('toStartWith', function () { describe('matches', function () { it('should work for string', function () { expect([ - '1', + '1', '2' ]).toStartWith('1'); }); it('should work for array', function () { expect([ - 3, - 4, + 3, + 4, 5 ]).toStartWith([ - 3, + 3, 4 ]); }); @@ -509,17 +509,17 @@ describe('toStartWith', function () { describe('non-matches', function () { it('should work for string', function () { expect([ - '1', + '1', '2' ]).not.toStartWith('3'); }); it('should work for array', function () { expect([ - 3, - 4, + 3, + 4, 5 ]).not.toStartWith([ - 4, + 4, 5 ]); }); @@ -535,8 +535,8 @@ describe('toEachStartWith', function () { }); it('should work for array with multiple elements', function () { expect([ - 'one', - 'onetwo', + 'one', + 'onetwo', 'onethree' ]).toEachStartWith('o'); }); @@ -549,8 +549,8 @@ describe('toEachStartWith', function () { }); it('should work for array with multiple elements', function () { expect([ - 'one', - 'two', + 'one', + 'two', 'onethree' ]).not.toEachStartWith('o'); }); @@ -565,8 +565,8 @@ describe('toSomeStartWith', function () { }); it('should work for array with multiple elements', function () { expect([ - 'one', - 'onetwo', + 'one', + 'onetwo', 'three' ]).toSomeStartWith('one'); }); @@ -579,8 +579,8 @@ describe('toSomeStartWith', function () { }); it('should work for array with multiple elements', function () { expect([ - 'one', - 'two', + 'one', + 'two', 'onethree' ]).not.toSomeStartWith('a'); }); @@ -610,19 +610,19 @@ describe('toStartWithEither', function () { describe('matches', function () { it('should work for string', function () { expect([ - '1', + '1', '2' ]).toStartWithEither('1', '2'); }); it('should work for array', function () { expect([ - 3, - 4, + 3, + 4, 5 ]).toStartWithEither([ 4 ], [ - 3, + 3, 4 ]); }); @@ -630,20 +630,20 @@ describe('toStartWithEither', function () { describe('non-matches', function () { it('should work for string', function () { expect([ - '1', + '1', '2' ]).not.toStartWithEither('3'); }); it('should work for array', function () { expect([ - 3, - 4, + 3, + 4, 5 ]).not.toStartWithEither([ - 5, + 5, 6 ], [ - 4, + 4, 5 ]); }); From 245931eb8a6cd9b498a5cf39ce29a65e9979b22d Mon Sep 17 00:00:00 2001 From: vvakame Date: Tue, 1 Dec 2015 11:24:18 +0900 Subject: [PATCH 234/389] fix intro.js --- intro.js/intro.js-tests.ts | 4 ++-- intro.js/intro.js.d.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/intro.js/intro.js-tests.ts b/intro.js/intro.js-tests.ts index b49eb5078..b8e8126ae 100644 --- a/intro.js/intro.js-tests.ts +++ b/intro.js/intro.js-tests.ts @@ -9,11 +9,11 @@ intro.setOptions({ intro: "Hello world!" }, { - element: document.querySelector('#step1'), + element: document.querySelector('#step1') as HTMLElement, intro : "This is a tooltip." }, { - element : document.querySelectorAll('#step2')[0], + element : document.querySelectorAll('#step2')[0] as HTMLElement, intro : "Ok, wasn't that fun?", position: 'right' }, diff --git a/intro.js/intro.js.d.ts b/intro.js/intro.js.d.ts index d54a5456e..15a73f517 100644 --- a/intro.js/intro.js.d.ts +++ b/intro.js/intro.js.d.ts @@ -14,7 +14,7 @@ declare module IntroJs { interface Step { intro: string; element?: string|HTMLElement; - position?: Positions; + position?: string|Positions; } interface Options { From 478cd76f6ee7575d257d0022a5c78a1f97a14e39 Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Tue, 1 Dec 2015 11:40:46 +0200 Subject: [PATCH 235/389] Added declaration for commonjs --- winjs/winjs.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/winjs/winjs.d.ts b/winjs/winjs.d.ts index 903019698..5f6309b23 100644 --- a/winjs/winjs.d.ts +++ b/winjs/winjs.d.ts @@ -10620,3 +10620,7 @@ declare module WinJS.Utilities.Scheduler { //#endregion Functions } + +declare module 'winjs' { + export = WinJS; +} From 12bb4be8e25cb31f17a32ec99c1a5537353d1d15 Mon Sep 17 00:00:00 2001 From: Ritzlgrmft Date: Tue, 1 Dec 2015 10:51:24 +0100 Subject: [PATCH 236/389] Additional properties added --- cordova/plugins/Device.d.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cordova/plugins/Device.d.ts b/cordova/plugins/Device.d.ts index a25c1aadc..1abb37596 100644 --- a/cordova/plugins/Device.d.ts +++ b/cordova/plugins/Device.d.ts @@ -26,6 +26,9 @@ interface Device { version: string; /** Get the device's manufacturer. */ manufacturer: string; -} + /** Whether the device is running on a simulator. */ + isVirtual: boolean; + /** Get the device hardware serial number. */ + serial: string;} declare var device: Device; \ No newline at end of file From d9ed4d259febfdce05d5ea4bfb4db410b49c3a06 Mon Sep 17 00:00:00 2001 From: "paul.lessing" Date: Tue, 1 Dec 2015 10:59:43 +0000 Subject: [PATCH 237/389] Add email-validator 1.0.3 --- email-validator/email-validator-tests.ts | 13 +++++++++++++ email-validator/email-validator.d.ts | 8 ++++++++ 2 files changed, 21 insertions(+) create mode 100644 email-validator/email-validator-tests.ts create mode 100644 email-validator/email-validator.d.ts diff --git a/email-validator/email-validator-tests.ts b/email-validator/email-validator-tests.ts new file mode 100644 index 000000000..61d4c6dfa --- /dev/null +++ b/email-validator/email-validator-tests.ts @@ -0,0 +1,13 @@ +/// + +import emailValidator = require('email-validator'); +import { validate } from 'email-validator'; + +var result: boolean; + +// Trivial code requires trivial tests +result = validate('some email'); +result = validate(null); + +result = emailValidator.validate('some email'); +result = emailValidator.validate(null); diff --git a/email-validator/email-validator.d.ts b/email-validator/email-validator.d.ts new file mode 100644 index 000000000..299ebb19f --- /dev/null +++ b/email-validator/email-validator.d.ts @@ -0,0 +1,8 @@ +// Type definitions for email-validator 1.0.3 +// Project: https://github.com/Sembiance/email-validator +// Definitions by: Paul Lessing +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module "email-validator" { + export function validate(email: String): boolean; +} From dd3fb2e7c8d31a01e239df5c504bd8c4c7e99fed Mon Sep 17 00:00:00 2001 From: William Candillon Date: Tue, 1 Dec 2015 12:29:34 +0100 Subject: [PATCH 238/389] Fix type for SourceNode.add() --- source-map/source-map.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source-map/source-map.d.ts b/source-map/source-map.d.ts index 3ddd49b53..016798d91 100644 --- a/source-map/source-map.d.ts +++ b/source-map/source-map.d.ts @@ -73,7 +73,7 @@ declare module SourceMap { constructor(line: number, column: number, source: string); constructor(line: number, column: number, source: string, chunk?: string, name?: string); public static fromStringWithSourceMap(code: string, sourceMapConsumer: SourceMapConsumer, relativePath?: string): SourceNode; - public add(chunk: string): void; + public add(chunk: any): SourceNode; public prepend(chunk: string): void; public setSourceContent(sourceFile: string, sourceContent: string): void; public walk(fn: (chunk: string, mapping: MappedPosition) => void): void; From 1c572762b93d4b059d89339867edf54946176361 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Tue, 1 Dec 2015 12:47:58 +0100 Subject: [PATCH 239/389] :lipstick: --- source-map/source-map.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source-map/source-map.d.ts b/source-map/source-map.d.ts index 016798d91..34aae2b6a 100644 --- a/source-map/source-map.d.ts +++ b/source-map/source-map.d.ts @@ -74,7 +74,7 @@ declare module SourceMap { constructor(line: number, column: number, source: string, chunk?: string, name?: string); public static fromStringWithSourceMap(code: string, sourceMapConsumer: SourceMapConsumer, relativePath?: string): SourceNode; public add(chunk: any): SourceNode; - public prepend(chunk: string): void; + public prepend(chunk: any): SourceNode; public setSourceContent(sourceFile: string, sourceContent: string): void; public walk(fn: (chunk: string, mapping: MappedPosition) => void): void; public walkSourceContents(fn: (file: string, content: string) => void): void; From 73a82c7c312f4a8df75d62605ef984b54fda9094 Mon Sep 17 00:00:00 2001 From: Marcin Porebski Date: Tue, 1 Dec 2015 15:39:21 +0100 Subject: [PATCH 240/389] Wreck 7.0.0 - naming convention fix --- wreck/wreck.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wreck/wreck.d.ts b/wreck/wreck.d.ts index 135b2f4f2..8bc7b2d24 100644 --- a/wreck/wreck.d.ts +++ b/wreck/wreck.d.ts @@ -11,9 +11,9 @@ declare module "wreck" import stream = require('stream'); - interface IWreckObject + interface WreckObject { - defaults: (options: any) => IWreckObject; + defaults: (options: any) => WreckObject; request: (method: string, uri: string, options: any, callback?: (err: any, response: http.IncomingMessage) => void) => http.ClientRequest; @@ -35,7 +35,7 @@ declare module "wreck" }; } - var wreck: IWreckObject; + var wreck: WreckObject; export = wreck; } From 3ffd32a260e370b7622a5b0981e576e578c1efba Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Sun, 29 Nov 2015 06:56:10 +0500 Subject: [PATCH 241/389] lodash: signatures of _.throttle have been changed --- lodash/lodash-tests.ts | 57 +++++++++++++++++++++--------- lodash/lodash.d.ts | 79 +++++++++++++++++++++++++++--------------- 2 files changed, 93 insertions(+), 43 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 48f69210d..65b429e9f 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -4554,9 +4554,6 @@ source.addEventListener('message', <_.LoDashImplicitObjectWrapper>_(fu 'maxWait': 1000 }), false); -var returnedDebounce = _.throttle(function (a: any) { return a * 5; }, 5); -returnedThrottled(4); - // _.defer module TestDefer { type SampleFunc = (a: number, b: string) => boolean; @@ -4671,9 +4668,6 @@ result = _.memoize(testMemoizeFn, te result = (_(testMemoizeFn).memoize().value()); result = (_(testMemoizeFn).memoize(testMemoizeResolverFn).value()); -var returnedMemoize = _.throttle(function (a: any) { return a * 5; }, 5); -returnedMemoize(4); - // _.modArgs module TestModArgs { type Func1 = (a: boolean) => boolean; @@ -4768,9 +4762,6 @@ module TestOnce { } } -var returnedOnce = _.throttle(function (a: any) { return a * 5; }, 5); -returnedOnce(4); - var greetPartial = function (greeting: string, name: string) { return greeting + ' ' + name; }; var hi = _.partial(greetPartial, 'hi'); hi('moe'); @@ -4835,15 +4826,49 @@ interface TestSpreadResultFn { result = (_.spread(testSpreadFn))(['fred', 'hello']); result = (_(testSpreadFn).spread().value())(['fred', 'hello']); -var throttled = _.throttle(function () { }, 100); -jQuery(window).on('scroll', throttled); +// _.throttle +module TestThrottle { + interface SampleFunc { + (n: number, s: string): boolean; + } -jQuery('.interactive').on('click', _.throttle(function () { }, 300000, { - 'trailing': false -})); + interface Options { + leading?: boolean; + trailing?: boolean; + } -var returnedThrottled = _.throttle(function (a: any) { return a * 5; }, 5); -returnedThrottled(4); + interface ResultFunc { + (n: number, s: string): boolean; + cancel(): void; + } + + let func: SampleFunc; + let options: Options; + + { + let result: ResultFunc; + + result = _.throttle(func); + result = _.throttle(func, 42); + result = _.throttle(func, 42, options); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(func).throttle(); + result = _(func).throttle(42); + result = _(func).throttle(42, options); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(func).chain().throttle(); + result = _(func).chain().throttle(42); + result = _(func).chain().throttle(42, options); + } +} var helloWrap = function (name: string) { return 'hello ' + name; }; var helloWrap2 = _.wrap(helloWrap, function (func) { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 49de3691e..91d7d410c 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -8444,41 +8444,62 @@ declare module _ { //_.throttle - interface LoDashStatic { - /** - * Creates a function that, when executed, will only call the func function at most once per - * every wait milliseconds. Provide an options object to indicate that func should be invoked - * on the leading and/or trailing edge of the wait timeout. Subsequent calls to the throttled - * function will return the result of the last func call. - * - * Note: If leading and trailing options are true func will be called on the trailing edge of - * the timeout only if the the throttled function is invoked more than once during the wait timeout. - * @param func The function to throttle. - * @param wait The number of milliseconds to throttle executions to. - * @param options The options object. - * @param options.leading Specify execution on the leading edge of the timeout. - * @param options.trailing Specify execution on the trailing edge of the timeout. - * @return The new throttled function. - **/ - throttle( - func: T, - wait: number, - options?: ThrottleSettings): T; - } - interface ThrottleSettings { - /** - * If you'd like to disable the leading-edge call, pass this as false. - **/ + * If you'd like to disable the leading-edge call, pass this as false. + */ leading?: boolean; /** - * If you'd like to disable the execution on the trailing-edge, pass false. - **/ + * If you'd like to disable the execution on the trailing-edge, pass false. + */ trailing?: boolean; } + interface LoDashStatic { + /** + * Creates a throttled function that only invokes func at most once per every wait milliseconds. The throttled + * function comes with a cancel method to cancel delayed invocations. Provide an options object to indicate + * that func should be invoked on the leading and/or trailing edge of the wait timeout. Subsequent calls to + * the throttled function return the result of the last func call. + * + * Note: If leading and trailing options are true, func is invoked on the trailing edge of the timeout only if + * the the throttled function is invoked more than once during the wait timeout. + * + * @param func The function to throttle. + * @param wait The number of milliseconds to throttle invocations to. + * @param options The options object. + * @param options.leading Specify invoking on the leading edge of the timeout. + * @param options.trailing Specify invoking on the trailing edge of the timeout. + * @return Returns the new throttled function. + */ + throttle( + func: T, + wait?: number, + options?: ThrottleSettings + ): T & Cancelable; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.throttle + */ + throttle( + wait?: number, + options?: ThrottleSettings + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.throttle + */ + throttle( + wait?: number, + options?: ThrottleSettings + ): LoDashExplicitObjectWrapper; + } + //_.wrap interface LoDashStatic { /** @@ -13221,6 +13242,10 @@ declare module _ { interface StringRepresentable { toString(): string; } + + interface Cancelable { + cancel(): void; + } } declare module "lodash" { From 8888d55a20ff2c5db1a575a98196f3e926898808 Mon Sep 17 00:00:00 2001 From: gcroteau Date: Tue, 1 Dec 2015 10:04:25 -0500 Subject: [PATCH 242/389] Renamed turf/turf-test.ts to turf/turf-tests.ts --- turf/{turf-test.ts => turf-tests.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename turf/{turf-test.ts => turf-tests.ts} (100%) diff --git a/turf/turf-test.ts b/turf/turf-tests.ts similarity index 100% rename from turf/turf-test.ts rename to turf/turf-tests.ts From 5e14a5854d4e94c69657432155cc45b23585a096 Mon Sep 17 00:00:00 2001 From: Martin Helmich Date: Tue, 1 Dec 2015 16:09:47 +0100 Subject: [PATCH 243/389] Add missing attributes to VerifyOptions --- jsonwebtoken/jsonwebtoken.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jsonwebtoken/jsonwebtoken.d.ts b/jsonwebtoken/jsonwebtoken.d.ts index bb74aa853..b558df2e5 100644 --- a/jsonwebtoken/jsonwebtoken.d.ts +++ b/jsonwebtoken/jsonwebtoken.d.ts @@ -36,8 +36,10 @@ declare module "jsonwebtoken" { } export interface VerifyOptions { + algorithms?: string[]; audience?: string; issuer?: string; + ignoreExpiration?: boolean; maxAge?: string; } From d18b076ae91eb33f8d2d7d9536cda0ee3e1fb65b Mon Sep 17 00:00:00 2001 From: Martin Helmich Date: Tue, 1 Dec 2015 16:09:50 +0100 Subject: [PATCH 244/389] Add test cases for new VerifyOptions --- jsonwebtoken/jsonwebtoken-tests.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/jsonwebtoken/jsonwebtoken-tests.ts b/jsonwebtoken/jsonwebtoken-tests.ts index 52f116335..c4e42f054 100644 --- a/jsonwebtoken/jsonwebtoken-tests.ts +++ b/jsonwebtoken/jsonwebtoken-tests.ts @@ -57,6 +57,18 @@ jwt.verify(token, cert, { audience: 'urn:foo', issuer: 'urn:issuer' }, function( // if issuer mismatch, err == invalid issuer }); +// verify algorithm +cert = fs.readFileSync('public.pem'); // get public key +jwt.verify(token, cert, { algorithms: ['RS256'] }, function(err, decoded) { + // if issuer mismatch, err == invalid issuer +}); + +// verify without expiration check +cert = fs.readFileSync('public.pem'); // get public key +jwt.verify(token, cert, { ignoreExpiration: true }, function(err, decoded) { + // if issuer mismatch, err == invalid issuer +}); + /** * jwt.decode * https://github.com/auth0/node-jsonwebtoken#jwtdecodetoken From 26a6aabce67f59b1e77825481f328f268493b136 Mon Sep 17 00:00:00 2001 From: Martin Helmich Date: Tue, 1 Dec 2015 16:14:25 +0100 Subject: [PATCH 245/389] Update comments in test cases --- jsonwebtoken/jsonwebtoken-tests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jsonwebtoken/jsonwebtoken-tests.ts b/jsonwebtoken/jsonwebtoken-tests.ts index c4e42f054..6aadaa82c 100644 --- a/jsonwebtoken/jsonwebtoken-tests.ts +++ b/jsonwebtoken/jsonwebtoken-tests.ts @@ -60,13 +60,13 @@ jwt.verify(token, cert, { audience: 'urn:foo', issuer: 'urn:issuer' }, function( // verify algorithm cert = fs.readFileSync('public.pem'); // get public key jwt.verify(token, cert, { algorithms: ['RS256'] }, function(err, decoded) { - // if issuer mismatch, err == invalid issuer + // if algorithm mismatch, err == invalid algorithm }); // verify without expiration check cert = fs.readFileSync('public.pem'); // get public key jwt.verify(token, cert, { ignoreExpiration: true }, function(err, decoded) { - // if issuer mismatch, err == invalid issuer + // if ignoreExpration == false and token is expired, err == expired token }); /** From 93297476d1c3581d58f6cae25c54c14b1133b9fe Mon Sep 17 00:00:00 2001 From: Nick Malaguti Date: Mon, 30 Nov 2015 17:38:57 -0500 Subject: [PATCH 246/389] Add definitions for webdriverio --- webdriverio/webdriverio-tests.ts | 128 ++++ webdriverio/webdriverio.d.ts | 1064 ++++++++++++++++++++++++++++++ 2 files changed, 1192 insertions(+) create mode 100644 webdriverio/webdriverio-tests.ts create mode 100644 webdriverio/webdriverio.d.ts diff --git a/webdriverio/webdriverio-tests.ts b/webdriverio/webdriverio-tests.ts new file mode 100644 index 000000000..205a2c6a6 --- /dev/null +++ b/webdriverio/webdriverio-tests.ts @@ -0,0 +1,128 @@ +/// +/// +/// + +import {assert} from "chai"; + +describe("webdriver.io page", function() { + + it("should have the right title - the good old callback way", function(done) { + + browser + .url("/") + .getTitle(function(err, title) { + assert.equal(err, undefined); + assert.equal(title, "WebdriverIO - Selenium 2.0 javascript bindings for nodejs"); + }) + .call(done); + + }); + + it("should have the right title - the promise way", function() { + + return browser + .url("/") + .getTitle().then(function(title) { + assert.equal(title, "WebdriverIO - Selenium 2.0 javascript bindings for nodejs"); + }); + + }); +}); + +import * as webdriverio from "webdriverio"; + +describe("my webdriverio tests", function(){ + + this.timeout(99999999); + var client: webdriverio.Client; + + before(function(done){ + client = webdriverio.remote({ desiredCapabilities: {browserName: "phantomjs"} }); + client.init(done); + }); + + it("Github test",function(done) { + client + .url("https://github.com/") + .getElementSize(".header-logo-wordmark", function(err: any, result: webdriverio.Size) { + assert.equal(undefined, err); + assert.strictEqual(result.height, 26); + assert.strictEqual(result.width, 89); + }) + .getTitle(function(err: any, title: string) { + assert.equal(undefined, err); + assert.strictEqual(title,"GitHub · Where software is built"); + }) + .getCssProperty("a[href='/plans']", "color", function(err: any, result: webdriverio.CssProperty){ + assert.equal(undefined, err); + assert.strictEqual(result.value, "rgba(64,120,192,1)"); + }) + .call(done); + }); + + after(function(done) { + client.end(done); + }); +}); + +var matrix = webdriverio.multiremote({ + browserA: { + desiredCapabilities: { + browserName: "chrome", + chromeOptions: { + args: [ + "use-fake-device-for-media-stream", + "use-fake-ui-for-media-stream", + ] + } + } + }, + browserB: { + desiredCapabilities: { + browserName: "chrome", + chromeOptions: { + args: [ + "use-fake-device-for-media-stream", + "use-fake-ui-for-media-stream", + ] + } + } + } + }); + +var channel = Math.round(Math.random() * 100000000000); + +matrix + .init() + .url("https://apprtc.appspot.com/r/" + channel) + .click("#confirm-join-button") + .pause(5000) + .end(); + +var options = { + desiredCapabilities: { + browserName: "chrome" + } +}; + +webdriverio + .remote(options) + .init() + .url("https://news.ycombinator.com/") + .selectorExecute("//div", function(inputs: HTMLElement[], message: string) { + return inputs.length + " " + message; + }, "divs on the page") + .then(function(res){ + console.log(res); + }) + .end(); + +webdriverio + .remote(options) + .init() + .url("http://www.google.com/") + .waitForVisible("//input[@type='submit']", 5000) + .then(function(visible){ + console.log(visible); //Should return true + }) + .end(); diff --git a/webdriverio/webdriverio.d.ts b/webdriverio/webdriverio.d.ts new file mode 100644 index 000000000..c123c47c8 --- /dev/null +++ b/webdriverio/webdriverio.d.ts @@ -0,0 +1,1064 @@ +// Type definitions for webdriverio 3.3.0 +// Project: http://www.webdriver.io/ +// Definitions by: Nick Malaguti +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare namespace WebdriverIO { + // EventEmitter + export interface Client { + addListener(event: string, listener: Function): Client; + on(event: string, listener: Function): Client; + once(event: string, listener: Function): Client; + removeListener(event: string, listener: Function): Client; + removeAllListeners(event?: string): Client; + setMaxListeners(n: number): Client; + listeners(event: string): Client; + emit(event: string, ...args: any[]): Client; + } + + // Promise + export interface Client { + call(callback: () => any): Client; + finally(callback: () => any): Client; + then

    (onFulfilled?: (value: T) => P | Client

    , onRejected?: (err: any) => P | Client

    ): Client

    ; + catch

    (onRejected?: (err: any) => P | Client

    ): Client

    ; + inspect(): Q.PromiseState; + } + + // Action + export interface Client { + addValue(selector: string, value: string | number): Client; + addValue

    ( + selector: string, + value: string | number, + callback: (err: any) => P + ): Client

    ; + + clearElement(selector: string): Client; + clearElement

    ( + selector: string, + callback: (err: any) => P + ): Client

    ; + + click(selector: string): Client; + click

    ( + selector: string, + callback: (err: any) => P + ): Client

    ; + + doubleClick(selector: string): Client; + doubleClick

    ( + selector: string, + callback: (err: any) => P + ): Client

    ; + + dragAndDrop(sourceElem: string, destinationElem: string): Client; + dragAndDrop

    ( + sourceElem: string, + destinationElem: string, callback: (err: any) => P + ): Client

    ; + + leftClick(selector: string): Client; + leftClick

    ( + selector: string, + callback: (err: any) => P + ): Client

    ; + + middleClick(selector: string): Client; + middleClick

    ( + selector: string, + callback: (err: any) => P + ): Client

    ; + + moveToObject(selector: string): Client; + moveToObject(selector: string, xoffset: number, yoffset: number): Client; + moveToObject

    ( + selector: string, + callback: (err: any) => P + ): Client

    ; + moveToObject

    ( + selector: string, + xoffset: number, + yoffset: number, + callback: (err: any) => P + ): Client

    ; + + rightClick(selector: string): Client; + rightClick

    ( + selector: string, + callback: (err: any) => P + ): Client

    ; + + selectByIndex(selectElem: string, index: number): Client; + selectByIndex

    ( + selectElem: string, + index: number, + callback: (err: any) => P + ): Client

    ; + + selectByValue(selectElem: string, value: string): Client; + selectByValue

    ( + selectElem: string, + value: string, + callback: (err: any) => P + ): Client

    ; + + selectByVisibleText(selectElem: string, text: string): Client; + selectByVisibleText

    ( + selectElem: string, + text: string, + callback: (err: any) => P + ): Client

    ; + + selectorExecute

    ( + selectors: string | string[], + script: (elements: HTMLElement | HTMLElement[], ...args: any[]) => P, + ...args: any[] + ): Client

    ; + + selectorExecuteAsync

    ( + selectors: string | string[], + script: (elements: HTMLElement | HTMLElement[], ...args: any[]) => P, + ...args: any[] + ): Client

    ; + + setValue(selector: string, values: number | string | Array): Client; + setValue

    ( + selector: string, + values: number | string | Array, + callback: (err: any) => P + ): Client; + + submitForm(selector: string): Client; + submitForm

    ( + selector: string, + callback: (err: any) => P + ): Client; + } + + // Appium + export interface Client { + // backgroundApp + // closeApp + // context + // contexts + // deviceKeyEvent + // getAppStrings + // getCurrentDeviceActivity + // getNetworkConnection + // hideDeviceKeyboard + // installAppOnDevice + // isAppInstalledOnDevice + // launchApp + // lock + // openNotifications + // performMultiAction + // performTouchAction + // pullFileFromDevice + // pushFileToDevice + // removeAppFromDevice + // resetApp + // rotate + // setImmediateValueInApp + // setNetworkConnection + // shake + // toggleAirplaneModeOnDevice + // toggleDataOnDevice + // toggleLocationServicesOnDevice + // toggleWiFiOnDevice + } + + export interface Cookie { + name: string; + value: string; + } + + // Cookie + export interface Client { + deleteCookie(name?: string): Client; + deleteCookie

    ( + callback: (err: any) => P + ): Client

    ; + deleteCookie

    ( + name: string, + callback: (err: any) => P + ): Client

    ; + + getCookie(): Client; + getCookie(name: string): Client; + getCookie

    ( + callback: (err: any, cookies: Cookie[]) => P + ): Client

    ; + getCookie

    ( + name: string, + callback: (err: any, cookie: Cookie) => P + ): Client

    ; + + setCookie(cookie: Cookie): Client; + setCookie

    ( + cookie: Cookie, + callback: (err: any) => P + ): Client

    ; + } + + // Mobile + export interface Client { + // flick + // flickDown + // flickLeft + // flickRight + // flickUp + // getGeoLocation + // getOrientation + // hold + // release + // setGeoLocation + // setOrientation + // touch + } + + export interface CssProperty { + property: string; + value: string; + parsed: ParsedCssProperty; + } + + export interface ParsedCssProperty { + type: string; + string: string; + quote: string; + unit: string; + value: string | number | string[] | number[]; + } + + export interface Size { + width: number; + height: number; + } + + export interface Location { + x: number; + y: number; + } + + // Property + export interface Client { + getAttribute(selector: string, attributeName: string): Client; + getAttribute

    ( + selector: string, + attributeName: string, + callback: (err: any, attribute: string | string[]) => P + ): Client

    ; + + getCssProperty(selector: string, cssProperty: string): Client; + getCssProperty

    ( + selector: string, + cssProperty: string, + callback: (err: any, cssProperty: CssProperty | CssProperty[]) => P + ): Client

    ; + + getElementSize(selector: string): Client; + getElementSize(selector: string, dimension: string): Client; + getElementSize

    ( + selector: string, + callback: (err: any, size: Size | Size[]) => P + ): Client

    ; + getElementSize

    ( + selector: string, + dimension: string, + callback: (err: any, elementSize: number | number[]) => P + ): Client

    ; + + getHTML(selector: string, includeSelectorTag?: boolean): Client; + getHTML

    ( + selector: string, + callback: (err: any, html: string | string[]) => P + ): Client

    ; + getHTML

    ( + selector: string, + includeSelectorTag: boolean, + callback: (err: any, html: string | string[]) => P + ): Client

    ; + + getLocation(selector: string): Client; + getLocation(selector: string, axis: string): Client; + getLocation

    ( + selector: string, + callback: (err: any, size: Size) => P + ): Client

    ; + getLocation

    ( + selector: string, + axis: string, + callback: (err: any, location: number) => P + ): Client

    ; + + getLocationInView(selector: string): Client; + getLocationInView(selector: string, axis: string): Client; + getLocationInView

    ( + selector: string, + callback: (err: any, size: Size | Size[]) => P + ): Client

    ; + getLocationInView

    ( + selector: string, + axis: string, + callback: (err: any, location: number | number[]) => P + ): Client

    ; + + getSource(): Client; + getSource

    (callback: (err: any, source: string) => P): Client

    ; + + getTagName(selector: string): Client; + getTagName

    ( + selector: string, + callback: (err: any, tagName: string | string[]) => P + ): Client

    ; + + getText(selector: string): Client; + getText

    ( + selector: string, + callback: (err: any, text: string | string[]) => P + ): Client

    ; + + getTitle(): Client; + getTitle

    ( + callback: (err: any, title: string) => P + ): Client

    ; + + getUrl(): Client; + getUrl

    ( + callback: (err: any, title: string) => P + ): Client

    ; + + getValue(selector: string): Client; + getValue

    ( + selector: string, + callback: (err: any, value: string | string[]) => P + ): Client

    ; + } + + export interface LogEntry { + timestamp: number; + level: string; + message: string; + } + + export enum ApplicationCacheStatus { + UNCACHED = 0, + IDLE = 1, + CHECKING = 2, + DOWNLOADING = 3, + UPDATE_READY = 4, + OBSOLETE = 5 + } + + export enum Button { + left = 0, + middle = 1, + right = 2 + } + + export interface StorageItem { + key: string; + value: any; + } + + export interface Location { + latitude: number; + longitude: number; + altitude: number; + } + + export interface Session { + id: string; + capabilities: any; + } + + export interface RawResult { + value: T; + } + + // Navigation + export interface Client { + back(): Client; + back

    ( + callback: (err: any) => P + ): Client

    ; + + forward(): Client; + forward

    ( + callback: (err: any) => P + ): Client

    ; + + refresh(): Client; + refresh

    ( + callback: (err: any) => P + ): Client

    ; + + url(): Client>; + url(url: string): Client; + url

    ( + callback: (err: any, result: RawResult) => P + ): Client

    ; + url

    ( + url: string, + callback: (err: any) => P + ): Client

    ; + } + + // Advanced input + export interface Client { + // you probably want to use the click and drag and drop commands instead + buttonDown(button?: string | Button): Client; + buttonDown

    ( + callback: (err: any) => P + ): Client

    ; + buttonDown

    ( + button: string | Button, + callback: (err: any) => P + ): Client

    ; + + // you probably want to use the click and drag and drop commands instead + buttonPress(button?: string | Button): Client; + buttonPress

    ( + callback: (err: any) => P + ): Client

    ; + buttonPress

    ( + button: string | Button, + callback: (err: any) => P + ): Client

    ; + + // you probably want to use the click and drag and drop commands instead + buttonUp(button?: string | Button): Client; + buttonUp

    ( + callback: (err: any) => P + ): Client

    ; + buttonUp(button?: string | Button): Client; + buttonUp

    ( + button: string | Button, + callback: (err: any) => P + ): Client

    ; + + // you probably want to use the click and drag and drop commands instead + doDoubleClick(): Client; + doDoubleClick

    ( + callback: (err: any) => P + ): Client

    ; + + // you probably want to use addValue and setValue instead + keys(value: string | string[]): Client; + keys

    ( + value: string | string[], + callback: (err: any) => P + ): Client

    ; + + // you probably want to use the moveToObject command instead + moveTo(id: ElementId, xoffset?: number, yoffset?: number): Client; + moveTo(xoffset?: number, yoffset?: number): Client; + moveTo

    ( + id: ElementId, + callback: (err: any) => P + ): Client

    ; + moveTo

    ( + id: ElementId, + xoffset: number, + callback: (err: any) => P + ): Client

    ; + moveTo

    ( + id: ElementId, + xoffset: number, + yoffset: number, + callback: (err: any) => P + ): Client

    ; + + // touchClick + // touchDoubleClick + // touchDown + // touchFlick + // touchLongClick + // touchMove + // touchScroll + // touchUp + } + + // Useful Protocol + export interface Client { + alertAccept(): Client; + alertAccept

    ( + callback: (err: any) => P + ): Client

    ; + + alertDismiss(): Client; + alertDismiss

    ( + callback: (err: any) => P + ): Client

    ; + + alertText(text?: string): Client; + alertText

    ( + callback: (err: any, text: string) => P + ): Client

    ; + alertText

    ( + text: string, + callback: (err: any, text: string) => P + ): Client

    ; + + frame(id: any): Client; + frame

    ( + id: any, + callback: (err: any) => P + ): Client

    ; + + frameParent(): Client; + frameParent

    ( + callback: (err: any) => P + ): Client

    ; + + init(capabilities?: DesiredCapabilities): Client; + init

    ( + callback: (err: any) => P + ): Client

    ; + init

    ( + capabilities: DesiredCapabilities, + callback: (err: any) => P + ): Client

    ; + + log(type: string): Client>; + log

    ( + type: string, + callback: (err: any, result: RawResult) => P + ): Client

    ; + + logTypes(): Client>; + logTypes

    ( + callback: (err: any, result: RawResult) => P + ): Client

    ; + + session(action?: string, sessionId?: string): Client>; + session

    ( + callback: (err: any, result: RawResult) => P + ): Client

    ; + session

    ( + action: string, + callback: (err: any, result: RawResult) => P + ): Client

    ; + session

    ( + action: string, + sessionId: string, + callback: (err: any, result: RawResult) => P + ): Client

    ; + + sessions(): Client>; + sessions

    ( + callback: (err: any, sessions: RawResult) => P + ): Client

    ; + + // timeouts + // timeoutsAsyncScript + // timeoutsImplicitWait + + // window + // windowHandle + // windowHandleMaximize + // windowHandlePosition + // windowHandleSize + // windowHandles + } + + export type ElementId = string; + + export interface Element { + ELEMENT: ElementId; + } + + // Element + export interface Client { + element(selector: string): Client>; + element

    ( + selector: string, + callback: (err: any, result: RawResult) => P + ): Client

    ; + + elementActive(): Client>; + elementActive

    ( + callback: (err: any, element: Element) => P + ): Client

    ; + + elementIdAttribute(id: ElementId, attributeName: string): Client>; + elementIdAttribute

    ( + id: ElementId, + attributeName: string, + callback: (err: any, result: RawResult) => P + ): Client

    ; + + elementIdClear(id: ElementId): Client; + elementIdClear

    ( + id: ElementId, + callback: (err: any) => P + ): Client

    ; + + elementIdClick(id: ElementId): Client; + elementIdClick

    ( + id: ElementId, + callback: (err: any) => P + ): Client

    ; + + elementIdCssProperty(id: ElementId, propertyName: string): Client>; + elementIdCssProperty

    ( + id: ElementId, + propertyName: string, + callback: (err: any, result: RawResult) => P + ): Client

    ; + + elementIdDisplayed(id: ElementId): Client>; + elementIdDisplayed

    ( + id: ElementId, + callback: (err: any, result: RawResult) => P + ): Client

    ; + + elementIdElement(id: ElementId, selector: string): Client>; + elementIdElement

    ( + id: ElementId, + selector: string, + callback: (err: any, result: RawResult) => P + ): Client

    ; + + elementIdElements(id: ElementId, selector: string): Client>; + elementIdElements

    ( + id: ElementId, + selector: string, + callback: (err: any, result: RawResult) => P + ): Client

    ; + + elementIdEnabled(id: ElementId): Client>; + elementIdEnabled

    ( + id: ElementId, + callback: (err: any, result: RawResult) => P + ): Client

    ; + + elementIdLocation(id: ElementId): Client>; + elementIdLocation

    ( + id: ElementId, + callback: (err: any, result: RawResult) => P + ): Client

    ; + + elementIdLocationInView(id: ElementId): Client>; + elementIdLocationInView

    ( + id: ElementId, + callback: (err: any, result: RawResult) => P + ): Client

    ; + + elementIdName(id: ElementId): Client>; + elementIdName

    ( + id: ElementId, + callback: (err: any, result: RawResult) => P + ): Client

    ; + + elementIdSelected(id: ElementId): Client>; + elementIdSelected

    ( + id: ElementId, + callback: (err: any, result: RawResult) => P + ): Client

    ; + + elementIdSize(id: ElementId): Client>; + elementIdSize

    ( + id: ElementId, + callback: (err: any, result: RawResult) => P + ): Client

    ; + + elementIdText(id: ElementId): Client>; + elementIdText

    ( + id: ElementId, + callback: (err: any, result: RawResult) => P + ): Client

    ; + + elementIdValue(id: ElementId, values: string | string[]): Client>; + elementIdValue

    ( + id: ElementId, + values: string | string[], + callback: (err: any, result: RawResult) => P + ): Client

    ; + + elements(selector: string): Client>; + elements

    ( + selector: string, + callback: (err: any, result: RawResult) => P + ): Client

    ; + } + + // Unuseful Protocol + export interface Client { + // applicationCacheStatus + // cookie + + // use selectorExecute instead + execute(script: string | Function, ...args: any[]): Client>; + + // use selectorExecuteAsync instead + executeAsync(script: string | Function, ...args: any[]): Client>; + + // file + // imeActivate + // imeActivated + // imeActiveEngine + // imeAvailableEngines + // imeDeactivated + // localStorage + // localStorageSize + // location + // orientation + // screenshot + // sessionStorage + // sessionStorageSize + // source + // status + + // use submitForm instead + submit(id: ElementId): Client; + submit

    ( + id: ElementId, + callback: (err: any) => P + ): Client

    ; + + // title + } + + // State + export interface Client { + isEnabled(selector: string): Client; + isEnabled

    ( + selector: string, + callback: (err: any, isEnabled: boolean) => P + ): Client

    ; + + isExisting(selector: string): Client; + isExisting

    ( + selector: string, + callback: (err: any, isExisting: boolean) => P + ): Client

    ; + + isSelected(selector: string): Client; + isSelected

    ( + selector: string, + callback: (err: any, isSelected: boolean) => P + ): Client

    ; + + isVisible(selector: string): Client; + isVisible

    ( + selector: string, + callback: (err: any, isVisible: boolean) => P + ): Client

    ; + + isVisibleWithinViewport(selector: string): Client; + isVisibleWithinViewport

    ( + selector: string, + callback: (err: any, isVisible: boolean) => P + ): Client

    ; + } + + export interface CommandHistoryEntry { + command: string; + args: any[]; + } + + // Utility + export interface Client { + addCommand(commandName: string, customMethod: Function, overwrite?: boolean): Client; + addCommand

    ( + commandName: string, + customMethod: Function, + callback: (err: any) => P + ): Client

    ; + addCommand

    ( + commandName: string, + customMethod: Function, + overwrite: boolean, + callback: (err: any) => P + ): Client

    ; + + chooseFile(selector: string, localPath: string): Client; + chooseFile

    ( + selector: string, + localPath: string, + callback: (err: any) => P + ): Client

    ; + + debug(): Client; + debug

    ( + callback: (err: any) => P + ): Client

    ; + + end(): Client; + end

    ( + callback: (err: any) => P + ): Client

    ; + + endAll(): Client; + endAll

    ( + callback: (err: any) => P + ): Client

    ; + + getCommandHistory(): Client; + getCommandHistory

    ( + callback: (err: any, history: CommandHistoryEntry[]) => P + ): Client

    ; + + pause(milliseconds: number): Client; + pause

    (milliseconds: number, callback: (err: any) => P): Client

    ; + + saveScreenshot(filename?: string): Client; + saveScreenshot

    ( + callback: (err: any, screenshot: Buffer) => P + ): Client

    ; + saveScreenshot

    ( + filename: string, + callback: (err: any, screenshot: Buffer) => P + ): Client

    ; + + scroll(selector: string): Client; + scroll(selector: string, xoffset: number, yoffset: number): Client; + scroll(xoffset: number, yoffset: number): Client; + scroll

    ( + selector: string, + callback: (err: any) => P + ): Client

    ; + scroll

    ( + selector: string, + xoffset: number, + yoffset: number, + callback: (err: any) => P + ): Client

    ; + scroll

    ( + xoffset: number, + yoffset: number, + callback: (err: any) => P + ): Client

    ; + + uploadFile(localPath: string): Client; + uploadFile

    ( + localPath: string, + callback: (err: any) => P + ): Client

    ; + + waitForEnabled(selector: string, milliseconds?: number, reverse?: boolean): Client; + waitForEnabled

    ( + selector: string, + callback: (err: any, enabled: boolean) => P + ): Client

    ; + waitForEnabled

    ( + selector: string, + milliseconds: number, + callback: (err: any, enabled: boolean) => P + ): Client

    ; + waitForEnabled

    ( + selector: string, + milliseconds: number, + reverse: boolean, + callback: (err: any, enabled: boolean) => P + ): Client

    ; + + waitForExist(selector: string, milliseconds?: number, reverse?: boolean): Client; + waitForExist

    ( + selector: string, + callback: (err: any, enabled: boolean) => P + ): Client

    ; + waitForExist

    ( + selector: string, + milliseconds: number, + callback: (err: any, enabled: boolean) => P + ): Client

    ; + waitForExist

    ( + selector: string, + milliseconds: number, + reverse: boolean, + callback: (err: any, enabled: boolean) => P + ): Client

    ; + + waitForSelected(selector: string, milliseconds?: number, reverse?: boolean): Client; + waitForSelected

    ( + selector: string, + callback: (err: any, enabled: boolean) => P + ): Client

    ; + waitForSelected

    ( + selector: string, + milliseconds: number, + callback: (err: any, enabled: boolean) => P + ): Client

    ; + waitForSelected

    ( + selector: string, + milliseconds: number, + reverse: boolean, + callback: (err: any, enabled: boolean) => P + ): Client

    ; + + waitForText(selector: string, milliseconds?: number, reverse?: boolean): Client; + waitForText

    ( + selector: string, + callback: (err: any, enabled: boolean) => P + ): Client

    ; + waitForText

    ( + selector: string, + milliseconds: number, + callback: (err: any, enabled: boolean) => P + ): Client

    ; + waitForText

    ( + selector: string, + milliseconds: number, + reverse: boolean, + callback: (err: any, enabled: boolean) => P + ): Client

    ; + + waitForValue(selector: string, milliseconds?: number, reverse?: boolean): Client; + waitForValue

    ( + selector: string, + callback: (err: any, enabled: boolean) => P + ): Client

    ; + waitForValue

    ( + selector: string, + milliseconds: number, + callback: (err: any, enabled: boolean) => P + ): Client

    ; + waitForValue

    ( + selector: string, + milliseconds: number, + reverse: boolean, + callback: (err: any, enabled: boolean) => P + ): Client

    ; + + waitForVisible(selector: string, milliseconds?: number, reverse?: boolean): Client; + waitForVisible

    ( + selector: string, + callback: (err: any, enabled: boolean) => P + ): Client

    ; + waitForVisible

    ( + selector: string, + milliseconds: number, + callback: (err: any, enabled: boolean) => P + ): Client

    ; + waitForVisible

    ( + selector: string, + milliseconds: number, + reverse: boolean, + callback: (err: any, enabled: boolean) => P + ): Client

    ; + + waitUntil( + condition: () => boolean | Q.IPromise, + timeout?: number, + interval?: number + ): Client; + waitUntil

    ( + condition: () => boolean | Q.IPromise, + callback: (err: any, enabled: boolean) => P + ): Client

    ; + waitUntil

    ( + condition: () => boolean | Q.IPromise, + timeout: number, + callback: (err: any, enabled: boolean) => P + ): Client

    ; + waitUntil

    ( + condition: () => boolean | Q.IPromise, + timeout: number, + interval: number, + callback: (err: any, enabled: boolean) => P + ): Client

    ; + } + + // Window + export interface Client { + close(windowHandle?: string): Client; + close

    ( + callback: (err: any) => P + ): Client

    ; + close

    ( + windowHandle: string, + callback: (err: any) => P + ): Client

    ; + + getCurrentTabId(): Client; + getCurrentTabId

    ( + callback: (err: any, tabId: string) => P + ): Client

    ; + + getTabIds(): Client; + getTabIds

    ( + callback: (err: any, tabIds: string[]) => P + ): Client

    ; + + getViewportSize(): Client; + getViewportSize(dimension: string): Client; + getViewportSize

    ( + callback: (err: any, size: Size) => P + ): Client

    ; + getViewportSize

    ( + dimension: string, + callback: (err: any, viewportSize: number) => P + ): Client

    ; + + newWindow(url: string, windowName: string, windowFeatures: string): Client; + newWindow

    ( + url: string, + windowName: string, + windowFeatures: string, + callback: (err: any, windowId: string) => P + ): Client

    ; + + setViewportSize(size: Size, type: boolean): Client; + setViewportSize

    ( + size: Size, + type: boolean, + callback: (err: any) => P + ): Client

    ; + + switchTab(windowHandle?: string): Client; + switchTab

    ( + callback: (err: any) => P + ): Client

    ; + switchTab

    ( + windowHandle: string, + callback: (err: any) => P + ): Client

    ; + } + + export interface Options { + protocol: string; + waitforTimeout: number; + coloredLogs: boolean; + logLevel: string; + baseUrl: string; + desiredCapabilities: DesiredCapabilities; + screenshotPath: string; + } + + // Options + export interface Client { + options: Options; + } + + export type DesiredCapabilities = any; + + export interface RemoteOptions { + protocol?: string; + waitforTimeout?: number; + waitforInterval?: number; + coloredLogs?: boolean; + logLevel?: string; + baseUrl?: string; + desiredCapabilities?: DesiredCapabilities; + } + + export interface MultiremoteOptions { + [key: string]: RemoteOptions; + } + + export function remote(options?: RemoteOptions | string): Client; + + export function multiremote(options?: MultiremoteOptions): Client; +} + +declare var browser: WebdriverIO.Client; + +declare module "webdriverio" { + export = WebdriverIO; +} From cc35e0f7a01116f425d2a9334c7ff5c24b122ae0 Mon Sep 17 00:00:00 2001 From: SrTobi Date: Tue, 1 Dec 2015 16:35:26 +0100 Subject: [PATCH 247/389] fixed definition header --- jssha/jssha.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jssha/jssha.d.ts b/jssha/jssha.d.ts index e8e8787c5..6dc4f65d3 100644 --- a/jssha/jssha.d.ts +++ b/jssha/jssha.d.ts @@ -1,7 +1,7 @@ // Type definitions for jsSHA // Project: https://github.com/Caligatio/jsSHA -// Definitions by: Tobias Kahlert -// Definitions: https://github.com/SrTobi/DefinitelyTyped +// Definitions by: David Li , Tobias Kahlert +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module jsSHA { From a9d32277887e04382960651d1a90ac02a335cee6 Mon Sep 17 00:00:00 2001 From: olemp Date: Tue, 1 Dec 2015 17:26:14 +0100 Subject: [PATCH 248/389] Added function declarations for ExecuteOrDelayUntilBodyLoaded, ExecuteOrDelayUntilScriptLoaded and ExecuteOrDelayUntilEventNotified. --- sharepoint/SharePoint.d.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/sharepoint/SharePoint.d.ts b/sharepoint/SharePoint.d.ts index c62b68b16..4e32dade4 100644 --- a/sharepoint/SharePoint.d.ts +++ b/sharepoint/SharePoint.d.ts @@ -1,12 +1,15 @@ -// Type definitions for SharePoint 2010 and 2013 -// Project: https://github.com/gandjustas/sptypescript -// Definitions by: Stanislav Vyshchepan , Andrey Markeev -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/// +// Type definitions for SharePoint 2010 and 2013 +// Project: https://github.com/gandjustas/sptypescript +// Definitions by: Stanislav Vyshchepan , Andrey Markeev +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// declare var _spBodyOnLoadFunctions: Function[]; declare var _spBodyOnLoadFunctionNames: string[]; declare var _spBodyOnLoadCalled: boolean; +declare function ExecuteOrDelayUntilBodyLoaded(initFunc: () => void): void; +declare function ExecuteOrDelayUntilScriptLoaded(func: () => void, depScriptFileName: string): boolean; +declare function ExecuteOrDelayUntilEventNotified(func: Function, eventName: string): boolean; declare var Strings:any; declare module SP { From 3337b8a8c2f1da308b4820027a9206c0875f194f Mon Sep 17 00:00:00 2001 From: Dasa Paddock Date: Tue, 1 Dec 2015 09:55:18 -0800 Subject: [PATCH 249/389] Update for ArcGIS API for JavaScript version 3.15 --- arcgis-js-api/arcgis-js-api.d.ts | 681 ++++++++++++++++++++----------- 1 file changed, 440 insertions(+), 241 deletions(-) diff --git a/arcgis-js-api/arcgis-js-api.d.ts b/arcgis-js-api/arcgis-js-api.d.ts index ba5e0fb9f..88d68cb19 100644 --- a/arcgis-js-api/arcgis-js-api.d.ts +++ b/arcgis-js-api/arcgis-js-api.d.ts @@ -1,4 +1,4 @@ -// Type definitions for ArcGIS API for JavaScript v3.14 +// Type definitions for ArcGIS API for JavaScript v3.15 // Project: http://js.arcgis.com // Definitions by: Esri // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -146,7 +146,7 @@ declare module "esri" { /** Class attribute to set for the layer's node. */ className?: string; /** Lists which levels to draw. */ - displayLevels?: number; + displayLevels?: number[]; /** An array of objects that define areas where a tiled map service should not display tiles. */ exclusionAreas?: any[]; /** Id to assign to the layer. */ @@ -157,7 +157,7 @@ declare module "esri" { opacity?: number; /** Refresh interval of the layer in minutes. */ refreshInterval?: number; - /** When true, tile resampling is enabled. */ + /** The purpose of resampling is to enlarge the image and fill in at the levels where there are no tiles available. */ resampling?: boolean; /** Number of levels beyond the last level where tiles are available. */ resamplingTolerance?: number; @@ -215,6 +215,8 @@ declare module "esri" { opacity?: number; /** Specify subDomains where tiles are served to speed up tile retrieval (using subDomains gets around the browser limit of the max number of concurrent requests to a domain). */ subDomains?: string[]; + /** The URL template used to retrieve the tiles. */ + templateUrl?: string; /** Define the tile info for the layer including lods, rows, cols, origin and spatial reference. */ tileInfo?: TileInfo; /** Define additional tile server domains for the layer. */ @@ -307,19 +309,15 @@ declare module "esri" { export interface ClassedColorSliderOptions { /** Data map containing renderer information. */ breakInfos: any; - /** Classification method. */ + /** Indicates the classification method used to divide the range of values into bins. */ classificationMethod?: string; - /** Handles identified by their index values within the stops array. */ + /** Required: Handles identified by their index values within the stops array. */ handles: number[]; - /** Represents histogram data object. */ + /** Represents the histogram data object. */ histogram?: any; /** Width of the histogram in pixels. */ histogramWidth?: number; - /** Absolute maximum value of the slider. */ - maxValue?: number; - /** Absolute minimum value of the slider. */ - minValue?: number; - /** Normalization type. */ + /** Indicates how data values are normalized. */ normalizationType?: string; /** Handle identified by its index value within the stops array. */ primaryHandle?: number; @@ -333,61 +331,51 @@ declare module "esri" { showLabels?: boolean; /** Displays ticks on slider when true. */ showTicks?: boolean; - /** Represents statistics data object. */ + /** Represents the statistics data object. */ statistics?: any; } export interface ClassedSizeSliderOptions { - /** Data map containing renderer information. */ + /** The data map containing renderer information. */ breakInfos: any; - /** Classification method. */ + /** Optional: Indicates the classification method used to divide the range of values into bins. */ classificationMethod?: string; - /** Handles identified by their index values within the stops array. */ + /** Required: Handles identified by their index values within the stops array. */ handles: number[]; - /** Represents histogram data object. */ + /** Represents the histogram data object. */ histogram?: any; /** Width of histogram in pixels. */ histogramWidth?: number; - /** Absolute maximum value of the slider. */ - maxValue?: number; - /** Absolute minimum value of the slider. */ - minValue?: number; - /** Normalization type. */ + /** Indicates how data values are normalized. */ normalizationType?: string; - /** Handle identified by its index value within the stops array. */ + /** The handle identified by its index value within the stops array. */ primaryHandle?: number; /** Width of slider ramp in pixels. */ rampWidth?: number; /** Displays slider handles when true. */ showHandles?: boolean; - /** Displays the histogram when true. */ + /** Indicates whether to display the histogram. */ showHistogram?: boolean; /** Displays labels when true. */ showLabels?: boolean; /** Displays slider ticks when true. */ showTicks?: boolean; - /** Represents statistics data object. */ + /** Optional: Represents the statistics data object. */ statistics?: any; - /** Indicates whether to use a circle or line-based ClassedSizeSlider. */ - symbol?: any; } export interface ColorInfoSliderOptions { - /** Classification method. */ - classificationMethod?: string; - /** Data map containing renderer information. */ + /** The data map containing renderer information. */ colorInfo: any; /** Handles identified by their index values within the stops array. */ handles: number[]; - /** Represents histogram data object. */ + /** Optional: Represents the histogram data object. */ histogram?: any; /** Width of histogram in pixels. */ histogramWidth?: number; - /** Absolute maximum value of slider. */ + /** The absolute maximum value of the slider. */ maxValue?: number; - /** Absolute minimum value of slider. */ + /** The absolute minimum value of the slider. */ minValue?: number; - /** Normalization Type. */ - normalizationType?: string; - /** Handle identified by its index value within the stops array. */ + /** The handle identified by its index value within the stops array. */ primaryHandle?: number; /** Width of widget ramp in pixels. */ rampWidth?: number; @@ -397,13 +385,15 @@ declare module "esri" { showHistogram?: boolean; /** Displays labels when set to true. */ showLabels?: boolean; - /** Displays ticks when set to true. */ + /** Indicates whether to display percentage labels. */ + showRatioLabels?: boolean | string; + /** Displays tick marks when set to true. */ showTicks?: boolean; /** Displays transparent background when set to true. */ showTransparentBackground?: boolean; - /** Represents statistics data object. */ + /** Represents a statistics data object. */ statistics?: any; - /** Object containing additional options. */ + /** Additional options to customize slider. */ zoomOptions?: any; } export interface ColorPickerOptions { @@ -655,8 +645,6 @@ declare module "esri" { traffic?: boolean; /** The traffic layer used for real-time traffic. */ trafficLayer?: ArcGISDynamicMapServiceLayer; - /** An example of when to use this is when working with a proxied ArcGIS Online route service item with stored credentials. */ - travelModesServiceUrl?: string; } export interface DissolveBoundariesOptions { /** The URL to the GPServer used to execute an analysis job. */ @@ -718,7 +706,7 @@ declare module "esri" { /** Specifies whether users can add new vertices. */ allowAddVertices?: boolean; /** Specifies whether users can delete vertices. */ - allowDeletevertices?: boolean; + allowDeleteVertices?: boolean; /** Line symbol used to draw the guild lines, displayed when moving vertices. */ ghostLineSymbol?: LineSymbol; /** Marker symbol used to display the insertable vertices. */ @@ -859,8 +847,14 @@ declare module "esri" { cellNavigation?: boolean; /** Object defining the date options specifically for formatting date and time editors. */ dateOptions?: any; + /** Allows selection of a table's row via clicking a feature on the map. */ + enableLayerClick?: boolean; + /** Allows selection of a feature on a map via clicking row in the table. */ + enableLayerSelection?: boolean; /** The featureLayer that the table is associated with. */ featureLayer: FeatureLayer; + /** Reference to the 'Options' drop-down menu. */ + gridMenu?: any; /** Columns to hide by default using the dGrid ColumnHider extension. */ hiddenFields?: string[]; /** A reference to the Map. */ @@ -1173,8 +1167,12 @@ declare module "esri" { map: Map; /** Indicates whether to remove underscores from the layer title. */ removeUnderscores?: boolean; + /** Indicates whether to display a legend for the layer items. */ + showLegend?: boolean; + /** Indicates whether to display the opacity slider. */ + showOpacitySlider?: boolean; /** Indicates whether to show sublayers in the list of layers. */ - subLayers?: boolean; + showSubLayers?: boolean; /** The CSS class selector used to uniquely style the widget. */ theme?: string; /** Indicates whether to show the LayerList widget. */ @@ -1455,19 +1453,19 @@ declare module "esri" { export interface OpacitySliderOptions { /** Handles identified by their index values within the stops array. */ handles: number[]; - /** Represents histogram data object. */ + /** Represents the histogram data object. */ histogram?: any; /** Width of histogram in pixels. */ histogramWidth?: number; - /** Absolute maximum value of the slider. */ + /** The absolute maximum value of the slider. */ maxValue?: number; - /** Absolute minimum value of the slider. */ + /** The absolute minimum value of the slider. */ minValue?: number; - /** Data map containing renderer information. */ + /** The data map containing renderer information. */ opacityInfo: any; - /** Handle identified by its index value within the stops array. */ + /** The handle identified by its index value within the stops array. */ primaryHandle?: number; - /** Width of slider ramp in pixels. */ + /** Represents the width of the SVG ramp in pixels. */ rampWidth?: number; /** Displays slider handles when true. */ showHandles?: boolean; @@ -1479,9 +1477,9 @@ declare module "esri" { showTicks?: boolean; /** Displays the transparent background when true. */ showTransparentBackground?: boolean; - /** Represents statistics data object. */ + /** Represents a statistics data object. */ statistics?: any; - /** Additional options for slider customization. */ + /** Additional options to customize slider. */ zoomOptions?: any; } export interface OpenStreetMapLayerOptions { @@ -1699,7 +1697,7 @@ declare module "esri" { minimum: number; /** Bottom label for the slider. */ minLabel?: string; - /** **CHECK THIS: Is it num of dec places? - Accuracy of the data (related to rounding). */ + /** Accuracy of the data (related to rounding). */ precision?: number; /** Primary handle identified by its index value within the related infos array (color, size, break). */ primaryHandle?: number; @@ -1737,9 +1735,11 @@ declare module "esri" { activeSourceIndex?: number | string; /** Indicates whether to automatically add all the feature layers from the map. */ addLayersFromMap?: boolean; + /** This is the default value used as a hint for input text when searching on multiple sources. */ + allPlaceholder?: string; /** Indicates whether to automatically navigate to the selected result. */ autoNavigate?: boolean; - /** Indicates whether to automatically select the first result. */ + /** Indicates whether to automatically select the first geocoded result (not the first suggestion). */ autoSelect?: boolean; /** Indicates whether to enable an option to collapse/expand the search into a button. */ enableButtonMode?: boolean; @@ -1749,6 +1749,8 @@ declare module "esri" { enableInfoWindow?: boolean; /** Indicates whether to enable showing a label for the geometry.The default value is false. */ enableLabel?: boolean; + /** Indicates whether to display the option to search "All" sources. */ + enableSearchingAll?: boolean; /** Indicates whether to enable the menu for selecting different sources. */ enableSourcesMenu?: boolean; /** Indicates whether or not to enable suggest on the widget. */ @@ -1765,7 +1767,7 @@ declare module "esri" { infoTemplate?: InfoTemplate; /** The text symbol for the label graphic. */ labelSymbol?: TextSymbol; - /** The default distance specified in meters used to reverse geocode, (if not specified by source).The default value is 1500. */ + /** The default distance specified in meters used to reverse geocode, (if not specified by source). */ locationToAddressDistance?: number; /** Reference to the map. */ map?: Map; @@ -1791,23 +1793,19 @@ declare module "esri" { zoomScale?: number; } export interface SizeInfoSliderOptions { - /** Classification method. */ - classificationMethod?: string; /** Handles identified by their index values within the stops array. */ handles: number[]; - /** Represents histogram data object. */ + /** Represents the histogram data object. */ histogram?: any; /** Width of the histogram in pixels. */ histogramWidth?: number; - /** Absolute maximum value of the slider. */ + /** The absolute maximum value of the slider. */ maxValue?: number; - /** Absolute minimum value of the slider. */ + /** The absolute minimum value of the slider. */ minValue?: number; - /** Normalization type. */ - normalizationType?: string; - /** Handle identified by its index value within the stops array. */ + /** The handle identified by its index value within the stops array. */ primaryHandle?: number; - /** Width of slider ramp in pixels. */ + /** Represents the width of the SVG ramp in pixels. */ rampWidth?: number; /** Displays slider handles when true. */ showHandles?: boolean; @@ -1817,11 +1815,11 @@ declare module "esri" { showLabels?: boolean; /** Displays slider ticks when true. */ showTicks?: boolean; - /** Data map containing renderer information. */ + /** Defines the size of the symbol where feature size is proportional to data value. */ sizeInfo: any; - /** Represents statistics data object. */ + /** Represents the statistics data object. */ statistics?: any; - /** The symbol used with the widget. */ + /** The SimpleLineSymbol or SimpleMarkerSymbol used with the widget. */ symbol: Symbol; /** Additional options to customize slider. */ zoomOptions?: any; @@ -1969,10 +1967,12 @@ declare module "esri" { sumWithinLayer: FeatureLayer; } export interface SymbolStylerOptions { + /** Added at v. */ + portal?: string | any; /** Self response of Portal used as symbol provider. */ - portalSelf: string; + portalSelf?: any; /** URL to Portal used as symbol provider. */ - portalUrl: string; + portalUrl?: string; } export interface TemplatePickerOptions { /** Number of visible columns. */ @@ -2062,6 +2062,18 @@ declare module "esri" { /** A predefined style. */ style?: string; } + export interface VectorTileLayerOptions { + /** Lists which levels of the layer to draw. */ + displayLevels?: number[]; + /** Maximum visible scale for the layer. */ + maxScale?: number; + /** Minimum visible scale for the layer. */ + minScale?: number; + /** Initial opacity or transparency of layer. */ + opacity?: number; + /** Visibility of the layer. */ + visible?: boolean; + } export interface VisibleScaleRangeSliderOptions { /** Layer used to determine the suggested scale range and set the minScale, maxScale values. */ layer: FeatureLayer; @@ -2275,7 +2287,7 @@ declare module "esri/IdentityManager" { /** Dialog box widget used to challenge the user for their credentials when the application attempts to access a secure resource. */ dialog: any; /** - * When accessing secure resources via Oauth2 from ArcGIS.com or one of its sub-domains the IdentityManager redirects the user to the ArcGIS.com or Portal for ArcGIS sign-in page. + * When accessing secure resources via OAuth2 from ArcGIS.com or one of its sub-domains the IdentityManager redirects the user to the ArcGIS.com or Portal for ArcGIS sign-in page. * @param handlerFunction When called, the function passed to setOAuthRedirectionHandler receives an object containing the redirection properties. */ setOAuthRedirectionHandler(handlerFunction: Function): void; @@ -2391,7 +2403,7 @@ declare module "esri/IdentityManagerBase" { /** Return properties of this object in JSON. */ toJson(): any; /** Fired when a credential is created. */ - on(type: "credential-create", listener: (event: { target: IdentityManagerBase }) => void): esri.Handle; + on(type: "credential-create", listener: (event: { credential: Credential; target: IdentityManagerBase }) => void): esri.Handle; /** Fired when all credentials are destroyed. */ on(type: "credentials-destroy", listener: (event: { target: IdentityManagerBase }) => void): esri.Handle; on(type: string, listener: (event: any) => void): esri.Handle; @@ -2675,7 +2687,7 @@ declare module "esri/arcgis/OAuthInfo" { minTimeUntilExpiration: number; /** Set to true to show the OAuth sign in page in a popup window. */ popup: boolean; - /** The relative page URL for the user to be sent to from the OAuth sign in page. */ + /** Applicable if working with the popup user-login workflow. */ popupCallbackUrl: string; /** The window features passed to window.open(). */ popupWindowFeatures: string; @@ -2886,7 +2898,7 @@ declare module "esri/arcgis/Portal" { /** The date the group was last modified. */ modified: Date; /** The username of the group's owner. */ - owner: Portal; + owner: string; /** The portal for the group. */ portal: Portal; /** A short summary that describes the group. */ @@ -3062,7 +3074,7 @@ declare module "esri/arcgis/Portal" { * Retrieve all the items in the specified folder. * @param folderId The id of the folder that contains the items to retrieve. */ - getItems(folderId: string): any; + getItems(folderId?: string): any; /** Get information about any notifications for the portal user. */ getNotifications(): any; /** Access the tag objects that have been created by the portal user. */ @@ -3087,6 +3099,11 @@ declare module "esri/arcgis/utils" { * @param itemId The itemId for a publicly shared ArcGIS.com item. */ getItem(itemId: string): any; + /** + * Can be used with LayerList widget to get the layers list to be passed into the constructor. + * @param createMapResponse The object created from the resolved promise returned by createMap(). + */ + getLayerList(createMapResponse: any): any[]; /** * Can be used with esri.dijit.Legend to get the layerInfos list to be passed into the Legend constructor. * @param createMapResponse Object returned by .createMap() in the .then() callback. @@ -3422,37 +3439,35 @@ declare module "esri/dijit/ClassedColorSlider" { /** A widget to assist with managing a renderer used for visualizing features by their class and color. */ class ClassedColorSlider extends RendererSlider { - /** Required */ + /** Required: The data map containing renderer information. */ breakInfos: any; - /** Optional */ + /** Optional: Indicates the classification method used to divide the range of values into bins. */ classificationMethod: string; /** Required: Handles identified by their index values within the stops array. */ handles: number[]; - /** Optional: Property representing histogram data object. */ + /** Optional: Represents the histogram data object. */ histogram: any; - /** Optional */ + /** Optional: The width of the histogram in pixels. */ histogramWidth: boolean; - /** Optional */ + /** Read Only. */ maxValue: number; - /** Optional */ + /** Read Only. */ minValue: number; - /** Optional */ + /** Optional: Indicates how data values are normalized. */ normalizationType: string; - /** Optional: Handle identified by its index value within the stops array. */ + /** Optional: The handle identified by its index value within the stops array. */ primaryHandle: number; - /** Optional */ + /** Optional: Width of the widget ramp in pixels. */ rampWidth: number; - /** Property for showing handles. */ + /** Optional: Indicates whether to display handles. */ showHandles: boolean; - /** Optional: Property for displaying the histogram. */ + /** Optional: Indicates whether to display the histogram. */ showHistogram: boolean; - /** Property for showing labels. */ + /** Optional: Indicates whether to display labels. */ showLabels: boolean; - /** Property for showing ticks. */ + /** Optional: Indicates whether to display tick marks. */ showTicks: boolean; - /** Property for displaying the transparent background. */ - showTransparentBackground: boolean; - /** Optional: Property representing statistics data object. */ + /** Optional: Represents the statistics data object. */ statistics: any; /** * Creates a new ClassedColorSlider widget. @@ -3464,7 +3479,7 @@ declare module "esri/dijit/ClassedColorSlider" { startup(): void; /** Fires when the ClassedColorSlider widget properties change. */ on(type: "change", listener: (event: { breakInfos: any; target: ClassedColorSlider }) => void): esri.Handle; - /** Fires when minValue or maxValue of ClassedColorSlider changes. */ + /** Fires when minValue or maxValue of the ClassedColorSlider changes. */ on(type: "data-value-change", listener: (event: { breakInfos: any; maxValue: number; minValue: number; target: ClassedColorSlider }) => void): esri.Handle; /** Fires when a ClassedColorSlider handle is moved. */ on(type: "handle-value-change", listener: (event: { breakInfos: any; target: ClassedColorSlider }) => void): esri.Handle; @@ -3479,35 +3494,35 @@ declare module "esri/dijit/ClassedSizeSlider" { /** A widget to assist with managing a renderer for visualizing features by varying classes and size. */ class ClassedSizeSlider extends RendererSlider { - /** Required. */ + /** Required: The data map containing renderer information. */ breakInfos: any; - /** Optional. */ + /** Optional: Indicates the classification method used to divide the range of values into bins. */ classificationMethod: string; - /** Required. */ + /** Required: Handles identified by their index values within the stops array. */ handles: number[]; - /** Optional. */ + /** Optional: Represents the histogram data object. */ histogram: any; - /** Optional. */ - histogramWidth: boolean; - /** Optional. */ + /** Optional: Width of histogram in pixels. */ + histogramWidth: number; + /** Read Only. */ maxValue: number; - /** Optional. */ + /** Read Only. */ minValue: number; - /** Optional. */ + /** Optional: Indicates how data values are normalized. */ normalizationType: string; - /** Optional. */ + /** Optional: Handle identified by its index value within the stops array. */ primaryHandle: number; - /** Optional */ + /** Optional: Width of the widget ramp in pixels. */ rampWidth: number; - /** Property for showing handles. */ + /** Optional: Indicates whether to display handles. */ showHandles: boolean; - /** Optional. */ + /** Optional: Indicates whether to display the histogram. */ showHistogram: boolean; - /** Property for showing labels. */ + /** Optional: Indicates whether to display labels. */ showLabels: boolean; - /** Property for showing ticks. */ + /** Optional: Indicates whether to display ticks marks. */ showTicks: boolean; - /** Optional. */ + /** Optional: Represents the statistics data object. */ statistics: any; /** * Creates a new ClassedSizeSlider widget within the provided DOM node srcNodeRef. @@ -3517,7 +3532,7 @@ declare module "esri/dijit/ClassedSizeSlider" { constructor(params: esri.ClassedSizeSliderOptions, srcNodeRef: Node | string); /** Fires when ClassedSizeSlider changes. */ on(type: "change", listener: (event: { breakInfos: any; target: ClassedSizeSlider }) => void): esri.Handle; - /** Fires when minValue or maxValue changes in ClassedSizeSlider. */ + /** Fires when minValue or maxValue of the ClassedSizeSlider changes. */ on(type: "data-value-change", listener: (event: { breakInfos: any; maxValue: number; minValue: number; target: ClassedSizeSlider }) => void): esri.Handle; /** Fires when a ClassedSizeSlider handle is moved. */ on(type: "handle-value-change", listener: (event: { breakInfos: any; target: ClassedSizeSlider }) => void): esri.Handle; @@ -3532,39 +3547,41 @@ declare module "esri/dijit/ColorInfoSlider" { /** A widget to assist with managing a renderer for visualizing features based upon colors. */ class ColorInfoSlider extends RendererSlider { - /** Optional */ + /** The classification method used for the ColorInfoSlider. */ classificationMethod: string; - /** Required: Example colorInfo: colorRenderer.renderer.visualVariables[0]. */ + /** Required: The data map containing renderer information. */ colorInfo: any; /** Required: Handles identified by their index values within the stops array. */ handles: number[]; - /** Optional: Property representing histogram data object. */ + /** Optional: Represents the histogram data object. */ histogram: any; - /** Optional */ - histogramWidth: boolean; - /** Optional */ + /** Optional: Width of histogram in pixels. */ + histogramWidth: number; + /** Optional: The absolute maximum value of the slider. */ maxValue: number; - /** Optional */ + /** Optional: The absolute minimum value of the slider. */ minValue: number; /** Optional */ normalizationType: string; - /** Optional: Handle identified by its index value within the stops array. */ + /** Optional: The handle identified by its index value within the stops array. */ primaryHandle: number; - /** Optional */ + /** Optional: Width of the widget ramp in pixels. */ rampWidth: number; - /** Property for showing handles. */ + /** Optional: Indicates whether to display handles. */ showHandles: boolean; - /** Optional: Property for displaying the histogram. */ + /** Optional: Indicates whether to display the histogram. */ showHistogram: boolean; - /** Property for showing labels. */ + /** Optional: Indicates whether to display handles. */ showLabels: boolean; - /** Property for showing ticks. */ + /** Indicates whether to display percentage labels. */ + showRatioLabels: boolean | string; + /** Optional: Indicates whether to display ticks marks. */ showTicks: boolean; - /** Property for displaying the transparent background. */ + /** Optional: Indicates whether to display a transparent background. */ showTransparentBackground: boolean; - /** Optional: Property representing statistics data object. */ + /** Optional: Represents a statistics data object. */ statistics: any; - /** Optional */ + /** Optional: Additional options to customize slider. */ zoomOptions: any; /** * Creates a new ColorInfoSlider widget within the provided DOM node srcNodeRef. @@ -3576,10 +3593,12 @@ declare module "esri/dijit/ColorInfoSlider" { startup(): void; /** Fires when ColorInfoSlider changes. */ on(type: "change", listener: (event: { colorInfo: any; target: ColorInfoSlider }) => void): esri.Handle; - /** Fires when minValue or maxValue of ColorInfoSlider changes. */ + /** Fires when minValue or maxValue of the ColorInfoSlider changes. */ on(type: "data-value-change", listener: (event: { colorInfo: any; maxValue: number; minValue: number; target: ColorInfoSlider }) => void): esri.Handle; /** Fires when a ColorInfoSlider handle is moved. */ - on(type: "handle-value-change", listener: (event: { target: ColorInfoSlider }) => void): esri.Handle; + on(type: "handle-value-change", listener: (event: { colorInfo: any; target: ColorInfoSlider }) => void): esri.Handle; + /** Fires when the zoom state changes. */ + on(type: "zoomed", listener: (event: { zoomed: boolean; target: ColorInfoSlider }) => void): esri.Handle; on(type: string, listener: (event: any) => void): esri.Handle; } export = ColorInfoSlider; @@ -3765,6 +3784,8 @@ declare module "esri/dijit/ElevationProfile" { measureUnits: string; /** The polyline input geometry used to create the elevation profile. */ profileGeometry: Geometry; + /** The title of the resulting elevation profile. */ + title: string; /** * Create a new ElevationProfile widget using the given DOM node. * @param options See options table below for the full descriptions of the properties needed for this object. @@ -3781,6 +3802,8 @@ declare module "esri/dijit/ElevationProfile" { on(type: "clear-profile", listener: (event: { target: ElevationProfile }) => void): esri.Handle; /** Fires when the widget has fully loaded. */ on(type: "load", listener: (event: { target: ElevationProfile }) => void): esri.Handle; + /** Fires when the title of the elevation profile is changed */ + on(type: "title-changed", listener: (event: { target: ElevationProfile }) => void): esri.Handle; /** Fires when the elevation profile is updated. */ on(type: "update-profile", listener: (event: { profileResults: any; target: ElevationProfile }) => void): esri.Handle; on(type: string, listener: (event: any) => void): esri.Handle; @@ -3793,7 +3816,7 @@ declare module "esri/dijit/FeatureTable" { import FeatureLayer = require("esri/layers/FeatureLayer"); import Map = require("esri/map"); - /** (Currently in beta) Creates an instance of the FeatureTable widget within the provided DOM node. */ + /** Creates an instance of the FeatureTable widget within the provided DOM node. */ class FeatureTable { /** An optional dGrid property. */ allowSelectAll: boolean; @@ -3805,10 +3828,16 @@ declare module "esri/dijit/FeatureTable" { dataStore: any; /** Object defining the date options specifically for formatting date and time editors. */ dateOptions: any; + /** Allows selection of a table's row via clicking a feature on the map. */ + enableLayerClick: boolean; + /** Allows selection of a feature on a map via clicking row in the table. */ + enableLayerSelection: boolean; /** The featureLayer that the table is associated with. */ featureLayer: FeatureLayer; /** Reference to the dGrid. */ grid: any; + /** Reference to the 'Options' drop-down menu. */ + gridMenu: any; /** Optional columns to hide by default using the dGrid ColumnHider extension. */ hiddenFields: string[]; /** A reference to the primary key used by the dataStore to differentiate columns. */ @@ -4004,15 +4033,15 @@ declare module "esri/dijit/HeatmapSlider" { import esri = require("esri"); import RendererSlider = require("esri/dijit/RendererSlider"); - /** A widget to assist in managing properties of a HeatmapRenderer. */ + /** A widget to assist in obtaining values for managing and setting properties on a HeatmapRenderer. */ class HeatmapSlider extends RendererSlider { /** Required. */ colorStops: any; /** Required. */ handles: number[]; - /** Optional. */ + /** Optional, absolute maximum value of the slider.NOTE: This value overrides statistics' max property. */ maxValue: number; - /** Optional. */ + /** Optional, absolute minimum value of the slider.NOTE: This value overrides statistics' min property. */ minValue: number; /** Optional */ rampWidth: number; @@ -4127,6 +4156,7 @@ declare module "esri/dijit/ImageServiceMeasure" { import SimpleFillSymbol = require("esri/symbols/SimpleFillSymbol"); import SimpleLineSymbol = require("esri/symbols/SimpleLineSymbol"); import SimpleMarkerSymbol = require("esri/symbols/SimpleMarkerSymbol"); + import ImageServiceMeasureTool = require("esri/toolbars/ImageServiceMeasureTool"); /** This widget allows you to perform measurements on image services. */ class ImageServiceMeasure { @@ -4136,6 +4166,8 @@ declare module "esri/dijit/ImageServiceMeasure" { lineSymbol: SimpleLineSymbol; /** Symbol to be used when drawing a point. */ markerSymbol: SimpleMarkerSymbol; + /** The instance of ImageServiceMeasureTool associated with this widget. */ + measureToolbar: ImageServiceMeasureTool; /** * Creates an instance of the ImageServiceMeasure widget. * @param params An Object containing constructor options. @@ -4294,8 +4326,12 @@ declare module "esri/dijit/LayerList" { map: Map; /** Indicates whether to remove underscores from the layer title */ removeUnderscores: boolean; + /** Indicates whether to display a legend for the layer items. */ + showLegend: boolean; + /** Indicates whether to display the opacity slider. */ + showOpacitySlider: boolean; /** Indicates whether to show sublayers in the list of layers. */ - sublayers: boolean; + showSubLayers: boolean; /** CSS Class for uniquely styling the widget. */ theme: string; /** Indicates whether to show the widget. */ @@ -4314,7 +4350,7 @@ declare module "esri/dijit/LayerList" { startup(): void; /** Fired when the LayerList widget has fully loaded. */ on(type: "load", listener: (event: { target: LayerList }) => void): esri.Handle; - /** Fired when refresh is called on the LabelList widget. */ + /** Fired when refresh() is called on the widget. */ on(type: "refresh", listener: (event: { target: LayerList }) => void): esri.Handle; /** Fired when the layer is toggled on/off within the widget. */ on(type: "toggle", listener: (event: { layerIndex: number; subLayerIndex: number; visible: boolean; target: LayerList }) => void): esri.Handle; @@ -4622,33 +4658,35 @@ declare module "esri/dijit/OpacitySlider" { /** A widget to assist with managing opacity with a renderer. */ class OpacitySlider extends RendererSlider { - /** Required. */ + /** Required: Handles identified by their index values within the stops array. */ handles: number[]; - /** Optional. */ + /** Optional: Represents the histogram data object. */ histogram: any; - /** Optional: */ - histogramWidth: boolean; - /** Optional. */ + /** Optional: Width of histogram in pixels. */ + histogramWidth: number; + /** Optional: The absolute maximum value of the slider. */ maxValue: number; - /** Optional. */ + /** Optional: The absolute minimum value of the slider. */ minValue: number; - /** Required. */ + /** Required: The data map containing renderer information. */ opacityInfo: any; - /** Optional */ + /** Optional: The handle identified by its index value within the stops array. */ + primaryHandle: number; + /** Optional: Represents the width of the SVG ramp in pixels. */ rampWidth: number; - /** Property for showing handles. */ + /** Optional: Indicates whether to display slider handles. */ showHandles: boolean; - /** Optional. */ + /** Optional: Indicates whether to display the histogram. */ showHistogram: boolean; - /** Property for showing labels. */ + /** Optional: Indicates whether to display slider labels. */ showLabels: boolean; - /** Property for showing ticks. */ + /** Optional: Indicates whether to display slider tick marks. */ showTicks: boolean; - /** Property for displaying the transparent background. */ + /** Optional: Indicates whether to display the transparent background. */ showTransparentBackground: boolean; - /** Optional. */ + /** Optional: Represents a statistics data object. */ statistics: any; - /** Optional. */ + /** Optional: Additional options to customize slider. */ zoomOptions: any; /** * Creates a new OpacitySlider widget within the provided DOM node srcNodeRef. @@ -4658,10 +4696,12 @@ declare module "esri/dijit/OpacitySlider" { constructor(params: esri.OpacitySliderOptions, srcNodeRef: Node | string); /** Fires when OpacitySlider changes. */ on(type: "change", listener: (event: { opacityInfo: any; target: OpacitySlider }) => void): esri.Handle; - /** Fires when minValue or maxValue of OpacitySlider changes. */ + /** Fires when minValue or maxValue of the OpacitySlider changes. */ on(type: "data-value-change", listener: (event: { maxValue: number; minValue: number; opacityInfo: any; target: OpacitySlider }) => void): esri.Handle; /** Fires when an OpacitySlider handle is moved. */ on(type: "handle-value-change", listener: (event: { opacityInfo: any; target: OpacitySlider }) => void): esri.Handle; + /** Fires when the zoom state changes. */ + on(type: "zoomed", listener: (event: { zoomed: boolean; target: OpacitySlider }) => void): esri.Handle; on(type: string, listener: (event: any) => void): esri.Handle; } export = OpacitySlider; @@ -4985,7 +5025,7 @@ declare module "esri/dijit/RendererSlider" { showLabels: boolean | string[]; /** Toggle for showing the horizontal line indicators from the center of the handle. */ showTicks: boolean; - /** Handle positions represented as numbers that fall between minimum and maximum. */ + /** Required: Handle positions represented as numbers that fall between minimum and maximum. */ values: number[]; /** * Creates a new RendererSlider widget. @@ -5044,10 +5084,14 @@ declare module "esri/dijit/Search" { activeSourceIndex: number; /** Indicates whether to automatically add all the feature layers from the map. */ addLayersFromMap: boolean; + /** This is the default value used as a hint for input text when searching on multiple sources. */ + allPlaceholder: string; /** Indicates whether to automatically navigate to the selected result. */ autoNavigate: boolean; - /** Indicates whether to automatically select and zoom to the first geocoded result. */ + /** Indicates whether to automatically select the first geocoded result. */ autoSelect: boolean; + /** (Read-only), the default source used for the Search widget. */ + defaultSource: any; /** Indicates whether to enable an option to collapse/expand the search into a button. */ enableButtonMode: boolean; /** Show the selected feature on the map using a default symbol determined by the source's geometry type. */ @@ -5056,6 +5100,8 @@ declare module "esri/dijit/Search" { enableInfoWindow: boolean; /** Indicates whether to enable showing a label for the geometry. */ enableLabel: boolean; + /** Indicates whether to display the option to search "All" sources. */ + enableSearchingAll: boolean; /** Indicates whether to enable the menu for selecting different sources. */ enableSourcesMenu: boolean; /** Enable suggestions for the widget. */ @@ -5150,8 +5196,8 @@ declare module "esri/dijit/Search" { /** Finalizes the creation of the Search widget. */ startup(): void; /** - * Performs a suggest() request on the active Locator. - * @param value The string value used to suggest() on an active Locator. + * Performs a suggest() request on the active Locator or feature layer. + * @param value The string value used to suggest() on an active locator or feature layer. */ suggest(value?: string): any; /** Fired when the widget's text input loses focus. */ @@ -5176,39 +5222,44 @@ declare module "esri/dijit/Search" { declare module "esri/dijit/SizeInfoSlider" { import esri = require("esri"); import RendererSlider = require("esri/dijit/RendererSlider"); + import SimpleMarkerSymbol = require("esri/symbols/SimpleMarkerSymbol"); + import SimpleLineSymbol = require("esri/symbols/SimpleLineSymbol"); + /** A widget to assist with managing size with a renderer. */ class SizeInfoSlider extends RendererSlider { - /** Optional. */ + /** Optional, the classification method used for the SizeInfoSlider. */ classificationMethod: string; - /** Required. */ + /** Required: Handles identified by their index values within the stops array. */ handles: number[]; - /** Optional. */ + /** Optional: Represents the histogram data object. */ histogram: any; - /** Optional. */ - histogramWidth: boolean; - /** Optional. */ + /** Optional: Width of the histogram in pixels. */ + histogramWidth: number; + /** Optional: The absolute maximum value of the slider. */ maxValue: number; - /** Optional. */ + /** Optional: The absolute minimum value of the slider. */ minValue: number; - /** Optional. */ + /** Optional, indicates how data values are normalized. */ normalizationType: string; - /** Optional. */ + /** Optional: The handle identified by its index value within the stops array. */ primaryHandle: number; - /** Optional */ + /** Optional: Represents the width of the SVG ramp in pixels. */ rampWidth: number; - /** Property for showing handles. */ + /** Optional: Indicates whether to display slider handles. */ showHandles: boolean; - /** Optional. */ + /** Optional: Indicates whether to display the histogram. */ showHistogram: boolean; - /** Property for showing labels. */ + /** Optional: Indicates whether to display the slider labels. */ showLabels: boolean; - /** Property for showing ticks. */ + /** Optional: Indicates whether to display the slider tick marks. */ showTicks: boolean; - /** Required. */ + /** Required: Defines the size of the symbol where feature size is proportional to data value. */ sizeInfo: any; - /** Optional. */ + /** Optional: Represents the statistics data object. */ statistics: any; - /** Optional. */ + /** Required: The SimpleLineSymbol or SimpleMarkerSymbol used with the widget. */ + symbol: SimpleMarkerSymbol | SimpleLineSymbol; + /** Optional: Additional options to customize slider. */ zoomOptions: any; /** * Creates a new SizeInfoSlider widget. @@ -5220,10 +5271,12 @@ declare module "esri/dijit/SizeInfoSlider" { startup(): void; /** Fires when the SizeInfoSlider properties change. */ on(type: "change", listener: (event: { sizeInfo: any; target: SizeInfoSlider }) => void): esri.Handle; - /** Fires when minValue or maxValue of SizeInfoSlider change. */ + /** Fires when minValue or maxValue of the SizeInfoSlider changes. */ on(type: "data-value-change", listener: (event: { maxValue: number; minValue: number; sizeInfo: any; target: SizeInfoSlider }) => void): esri.Handle; /** Fires when a SizeInfoSlider handle is moved. */ on(type: "handle-value-change", listener: (event: { sizeInfo: any; target: SizeInfoSlider }) => void): esri.Handle; + /** Fires when the zoom state changes. */ + on(type: "zoomed", listener: (event: { zoomed: boolean; target: SizeInfoSlider }) => void): esri.Handle; on(type: string, listener: (event: any) => void): esri.Handle; } export = SizeInfoSlider; @@ -6730,7 +6783,7 @@ declare module "esri/dijit/geoenrichment/DataBrowser" { export = DataBrowser; } -declare module "esri/dijit/geoenrichment/InfoGraphic" { +declare module "esri/dijit/geoenrichment/Infographic" { import esri = require("esri"); import GeometryStudyArea = require("esri/tasks/geoenrichment/GeometryStudyArea"); import RingBuffer = require("esri/tasks/geoenrichment/RingBuffer"); @@ -7451,13 +7504,13 @@ declare module "esri/geometry/geometryEngine" { import SpatialReference = require("esri/SpatialReference"); import Point = require("esri/geometry/Point"); - /** (Currently in beta) A client-side geometry engine. */ + /** A client-side geometry engine. */ var geometryEngine: { /** * Creates planar (or Euclidean) buffer polygons at a specified distance around the input geometries. * @param geometry The buffer input geometry. * @param distance The specified distance(s) for buffering. - * @param unit Unit for the distance(s). + * @param unit Measurement unit for the distance(s). * @param unionResults Whether the output geometries should be unioned into a single polygon. */ buffer(geometry: Geometry | Geometry[], distance: number | number[], unit: string | number, unionResults?: boolean): Polygon | Polygon[]; @@ -7495,7 +7548,7 @@ declare module "esri/geometry/geometryEngine" { * Densify geometries by plotting points between existing vertices. * @param geometry The geometry to be densified. * @param maxSegmentLength The maximum segment length allowed. - * @param maxSegmentLengthUnit Unit for the maximum segment length. + * @param maxSegmentLengthUnit Measurement unit for maxSegmentLength. */ densify(geometry: Geometry, maxSegmentLength: number, maxSegmentLengthUnit: string | number): Geometry; /** @@ -7514,7 +7567,7 @@ declare module "esri/geometry/geometryEngine" { * Calculates the shortest planar distance between two geometries. * @param geometry1 First input geometry. * @param geometry2 Second input geometry. - * @param distanceUnit Units of the return value. + * @param distanceUnit Measurement unit of the return value. */ distance(geometry1: Geometry, geometry2: Geometry, distanceUnit: string | number): number; /** @@ -7545,27 +7598,34 @@ declare module "esri/geometry/geometryEngine" { * @param geometry The geometry to be generalized. * @param maxDeviation The maximum allowed deviation from the generalized geometry to the original geometry. * @param removeDegenerateParts When true, the degenerate parts of the geometry will be removed from the output (may be undesired for drawing). - * @param maxDeviationUnit A unit for maximum deviation. + * @param maxDeviationUnit Measurement unit for maxDeviation. */ generalize(geometry: Geometry, maxDeviation: number, removeDegenerateParts?: boolean, maxDeviationUnit?: string | number): Geometry; /** * Calculates the area of the input geometry. * @param geometry The input geometry. - * @param unit Units of the return value. + * @param unit Measurement unit of the return value. */ geodesicArea(geometry: Geometry, unit: string | number): number; /** * Creates geodesic buffer polygons at a specified distance around the input geometries. * @param geometry The buffer input geometry. * @param distance The specified distance(s) for buffering. - * @param unit Unit for the distance(s). + * @param unit Measurement unit for the distance(s). * @param unionResults Whether the output geometries should be unioned into a single polygon. */ geodesicBuffer(geometry: Geometry | Geometry[], distance: number | number[], unit: string | number, unionResults?: boolean): Polygon | Polygon[]; + /** + * Returns a geodesically densified version of the input geometry. + * @param geometry A polyline or polygon geometry to densify. + * @param maxSegmentLength The maximum segment length allowed. + * @param maxSegmentLengthUnit Measurement unit for maxSegmentLength. + */ + geodesicDensify(geometry: Polyline | Polygon, maxSegmentLength: number, maxSegmentLengthUnit?: number): Geometry; /** * Calculates the length of the input geometry. * @param geometry The input geometry. - * @param unit Units of the return value. + * @param unit Measurement unit of the return value. */ geodesicLength(geometry: Geometry, unit: string | number): number; /** @@ -7609,7 +7669,7 @@ declare module "esri/geometry/geometryEngine" { * Creates offset version of the input geometry. * @param geometry The geometries to offset. * @param offsetDistance The offset distance for the Geometries. - * @param offsetUnit Unit for the offset. + * @param offsetUnit Measurement unit for the offset. * @param joinType The join type. * @param bevelRatio Applicable to MITER, bevelRatio is multiplied by the offset distance and the result determines how far a mitered offset intersection can be located before it is beveled. * @param flattenError Applicable to ROUND, flattenError determines the maximum distance of the resulting segments compared to the true circular arc. @@ -7624,13 +7684,13 @@ declare module "esri/geometry/geometryEngine" { /** * Calculates the area of the input geometry. * @param geometry The input geometry. - * @param unit Units of the return value. + * @param unit Measurement unit of the return value. */ planarArea(geometry: Geometry, unit: string | number): number; /** * Calculates the length of the input geometry. * @param geometry The input geometry. - * @param unit Units of the return value. + * @param unit Measurement unit of the return value. */ planarLength(geometry: Geometry, unit: string | number): number; /** @@ -7685,14 +7745,15 @@ declare module "esri/geometry/geometryEngineAsync" { import Polyline = require("esri/geometry/Polyline"); import SpatialReference = require("esri/SpatialReference"); import Point = require("esri/geometry/Point"); + import Polygon = require("esri/geometry/Polygon"); - /** (Currently in beta) A client-side asynchronous geometry engine. */ + /** A client-side asynchronous geometry engine. */ var geometryEngineAsync: { /** * Creates planar (or Euclidean) buffer polygons at a specified distance around the input geometries. * @param geometry The buffer input geometry. * @param distance The specified distance(s) for buffering. - * @param unit Unit for the distance(s). + * @param unit Measurement unit for the distance(s). * @param unionResults Whether the output geometries should be unioned into a single polygon. */ buffer(geometry: Geometry | Geometry[], distance: number | number[], unit: string | number, unionResults?: boolean): any; @@ -7730,7 +7791,7 @@ declare module "esri/geometry/geometryEngineAsync" { * Densify geometries by plotting points between existing vertices. * @param geometry The geometry to be densified. * @param maxSegmentLength The maximum segment length allowed. - * @param maxSegmentLengthUnit Defaults to the units of the input geometries. + * @param maxSegmentLengthUnit Measurement unit for maxSegmentLength. */ densify(geometry: Geometry, maxSegmentLength: number, maxSegmentLengthUnit: string | number): any; /** @@ -7749,7 +7810,7 @@ declare module "esri/geometry/geometryEngineAsync" { * Calculates the shortest planar distance between two geometries. * @param geometry1 First input geometry. * @param geometry2 Second input geometry. - * @param distanceUnit Units of the return value. + * @param distanceUnit Measurement unit of the return value. */ distance(geometry1: Geometry, geometry2: Geometry, distanceUnit: string | number): any; /** @@ -7780,27 +7841,34 @@ declare module "esri/geometry/geometryEngineAsync" { * @param geometry The geometry to be generalized. * @param maxDeviation The maximum allowed deviation from the generalized geometry to the original geometry. * @param removeDegenerateParts When true, the degenerate parts of the geometry will be removed from the output (may be undesired for drawing). - * @param maxDeviationUnit Defaults to the units of the input geometries. + * @param maxDeviationUnit Measurement unit for maxDeviation. */ generalize(geometry: Geometry, maxDeviation: number, removeDegenerateParts?: boolean, maxDeviationUnit?: string | number): any; /** * Calculates the area of the input geometry. * @param geometry The input geometry. - * @param unit Units of the return value. + * @param unit Measurement unit of the return value. */ geodesicArea(geometry: Geometry, unit: string | number): any; /** * Creates geodesic buffer polygons at a specified distance around the input geometries. * @param geometry The buffer input geometry. * @param distance The specified distance(s) for buffering. - * @param unit Unit for the distance(s). + * @param unit Measurement unit for the distance(s). * @param unionResults Whether the output geometries should be unioned into a single polygon. */ geodesicBuffer(geometry: Geometry | Geometry[], distance: number | number[], unit: string | number, unionResults?: boolean): any; + /** + * Resolves to a geodesically densified version of the input geometry. + * @param geometry A polyline or polygon geometry to densify. + * @param maxSegmentLength The maximum segment length allowed. + * @param maxSegmentLengthUnit Measurement unit for maxSegmentLength. + */ + geodesicDensify(geometry: Polyline | Polygon, maxSegmentLength: number, maxSegmentLengthUnit?: number): any; /** * Calculates the length of the input geometry. * @param geometry The input geometry. - * @param unit Units of the return value. + * @param unit Measurement unit of the return value. */ geodesicLength(geometry: Geometry, unit: string | number): any; /** @@ -7844,7 +7912,7 @@ declare module "esri/geometry/geometryEngineAsync" { * Creates offset version of the input geometry. * @param geometry The geometries to offset. * @param offsetDistance The offset distance for the Geometries. - * @param offsetUnit Unit for the offset. + * @param offsetUnit Measurement unit for the offset. * @param joinType The join type. * @param bevelRatio Applicable to MITER, bevelRatio is multiplied by the offset distance and the result determines how far a mitered offset intersection can be located before it is beveled. * @param flattenError Applicable to ROUND, flattenError determines the maximum distance of the resulting segments compared to the true circular arc. @@ -7859,13 +7927,13 @@ declare module "esri/geometry/geometryEngineAsync" { /** * Calculates the area of the input geometry. * @param geometry The input geometry. - * @param unit Units of the return value. + * @param unit Measurement unit of the return value. */ planarArea(geometry: Geometry, unit: string | number): any; /** * Calculates the length of the input geometry. * @param geometry The input geometry. - * @param unit Units of the return value. + * @param unit Measurement unit of the return value. */ planarLength(geometry: Geometry, unit: string | number): any; /** @@ -9219,7 +9287,7 @@ declare module "esri/layers/FeatureLayer" { */ setAutoGeneralize(enable: boolean): FeatureLayer; /** - * Set's the definition expression for the FeatureLayer. + * Sets the definition expression for the FeatureLayer. * @param expression The definition expression to apply. */ setDefinitionExpression(expression: string): FeatureLayer; @@ -9275,7 +9343,7 @@ declare module "esri/layers/FeatureLayer" { */ setScaleRange(minScale: number, maxScale: number): void; /** - * Set's the selection symbol for the feature layer. + * Sets the selection symbol for the feature layer. * @param symbol Symbol for the current selection. */ setSelectionSymbol(symbol: Symbol): FeatureLayer; @@ -9285,7 +9353,7 @@ declare module "esri/layers/FeatureLayer" { */ setShowLabels(showLabels: boolean): void; /** - * Set's the time definition for the feature layer. + * Sets the time definition for the feature layer. * @param definition The new time extent used to filter the layer. */ setTimeDefinition(definition: TimeExtent): FeatureLayer; @@ -9458,6 +9526,8 @@ declare module "esri/layers/GeoRSSLayer" { items: Graphic[]; /** The name of the layer. */ name: string; + /** The publicly accessible URL to a GeoRSS file. */ + url: string; /** * Creates a new GeoRSSLayer object. * @param url URL to the GeoRSS resource. @@ -9805,10 +9875,14 @@ declare module "esri/layers/LOD" { declare module "esri/layers/LabelClass" { import TextSymbol = require("esri/symbols/TextSymbol"); - /** LabelClass defines the styles of labels for ArcGISDynamicMapServiceLayer. */ + /** Use label classes to restrict labels to certain features or to specify different label fields, symbols, scale ranges, label priorities, and sets of label placement options for different groups of labels. */ class LabelClass { + /** An array of objects representing field information to label. */ + fieldInfos: any[]; /** Adjusts the formatting of labels. */ labelExpression: string; + /** Use this when working with FeatureLayer layer types. */ + labelExpressionInfo: any; /** The position of the label. */ labelPlacement: string; /** The maximum scale to show labels. */ @@ -9824,7 +9898,7 @@ declare module "esri/layers/LabelClass" { /** A where clause determining which features are labeled. */ where: string; /** - * Create a LabelClass, in order to be added to layerDrawingOption.labelingInfo. + * Creates a label class, used for formatting parameters, symbols, date, etc. * @param json Various options to configure this LabelClass. */ constructor(json?: Object); @@ -9840,7 +9914,7 @@ declare module "esri/layers/LabelLayer" { import UniqueValueRenderer = require("esri/renderers/UniqueValueRenderer"); import ClassBreaksRenderer = require("esri/renderers/ClassBreaksRenderer"); - /** The LabelLayer inherits from the graphics layer and can be used to display texts and symbols on map. */ + /** NOTE: Deprecated as of version 3.14, read below for additional information on the suggested method of labeling. */ class LabelLayer extends GraphicsLayer { /** * Creates a new Label layer. @@ -10248,6 +10322,8 @@ declare module "esri/layers/RasterLayer" { /** The RasterLayer is used to display image services. */ class RasterLayer extends Layer { + /** A function that takes a pixelData object as input, processes it, and returns it. */ + pixelFilter: Function; /** * Creates a new RasterLayer object. * @param url URL to the ArcGIS Server REST resource that represents a raster layer service. @@ -10262,6 +10338,11 @@ declare module "esri/layers/RasterLayer" { * @param doNotRefresh Use true to avoid refreshing the layer; false to refresh it. */ setImageFormat(imageFormat: string, doNotRefresh?: boolean): void; + /** + * Sets a pixelFilter on the layer. + * @param pixelFilter The function defining the PixelFilter to set on the layer. + */ + setPixelFilter(pixelFilter: Function): void; /** * Determines if the layer will update its content based on the map's current time extent. * @param use Use true to update the layer's content based on the map's current time extent. @@ -10495,16 +10576,55 @@ declare module "esri/layers/TimeInfo" { } declare module "esri/layers/TimeReference" { - /** TimeReference contains information about how the time was measured. */ + /** TimeReference contains read-only information about how the time was captured when the data was created. */ class TimeReference { - /** Indicates whether the time reference respects daylight savings time. */ + /** A read-only property that indicates whether the time reference takes into account daylight savings time. */ respectsDaylightSaving: boolean; - /** The time zone information associated with the time reference. */ + /** The time zone in which the data was captured. */ timeZone: string; } export = TimeReference; } +declare module "esri/layers/VectorTileLayer" { + import esri = require("esri"); + import Layer = require("esri/layers/layer"); + import Extent = require("esri/geometry/Extent"); + import SpatialReference = require("esri/SpatialReference"); + import TileInfo = require("esri/layers/TileInfo"); + + /** A VectorTileLayer accesses cached tiles of data and renders it in vector format. */ + class VectorTileLayer extends Layer { + /** The full extent of the layer. */ + fullExtent: Extent; + /** The initial extent of the layer. */ + initialExtent: Extent; + /** The spatial reference of the layer. */ + spatialReference: SpatialReference; + /** The style object of the service with fully qualified URLs for glyphs and sprite. */ + style: any; + /** Contains information about the tiling scheme for the layer. */ + tileInfo: TileInfo; + /** The URL to the vector tile service or style JSON that will be used to draw the layer. */ + url: string; + /** + * Create a new VectorTileLayer object. + * @param url The URL to the vector tile service or style JSON that will be used to draw the layer. + * @param options Optional parameters. + */ + constructor(url: string | any, options?: esri.VectorTileLayerOptions); + /** + * Changes the style properties used to render the layers. + * @param styleUrl A url to a JSON file containing the stylesheet information to render the layer. + */ + setStyle(styleUrl: string | any): void; + /** Fires when the style is changed on the layer. */ + on(type: "style-change", listener: (event: { style: any; target: VectorTileLayer }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = VectorTileLayer; +} + declare module "esri/layers/WFSLayer" { import esri = require("esri"); import Field = require("esri/layers/Field"); @@ -10513,7 +10633,7 @@ declare module "esri/layers/WFSLayer" { import InfoTemplate = require("esri/InfoTemplate"); import Renderer = require("esri/renderers/Renderer"); - /** (Currently in beta)A layer for OGC Web Feature Services (WFS). */ + /** (Currently in beta) A layer for OGC Web Feature Services (WFS). */ class WFSLayer { /** An array of fields in the layer. */ fields: Field[]; @@ -11262,6 +11382,8 @@ declare module "esri/opsdashboard/DataSourceProxy" { id: string; /** Read-only: Indicates if the last query failed and the data source is in a broken state. */ isBroken: boolean; + /** Read-only: The mapWidgetId of the data source. */ + mapWidgetId: string; /** Read-only: The name of the data source. */ name: string; /** Read-only: The name of the object id field. */ @@ -11279,6 +11401,8 @@ declare module "esri/opsdashboard/DataSourceProxy" { * @param query The query object to apply. */ executeQuery(query: Query): any; + /** An object that contains service level metadata about whether or not the layer supports queries using statistics, order by fields, DISTINCT, pagination, query with distance, and returning queries with extents. */ + getAdvancedQueryCapabilities(): any; /** Retrieve the associated data source that supports selection. */ getAssociatedSelectionDataSourceProxy(): any; /** Get the associated popupInfo for the data source if any available. */ @@ -11334,8 +11458,8 @@ declare module "esri/opsdashboard/ExtensionBase" { static POLYLINE: any; /** Read-only: Indicates if the host application is the Windows Operations Dashboard. */ isNative: boolean; - /** Get the collection of data sources from the host application. */ - getDataSourceProxies(): any; + /** Read-only: The URL to the ArcGIS.com site or in-house portal that you are currently signed in to. */ + portalUrl: string; /** Get the collection of data sources from the host application. */ getDataSourceProxies(): any; /** Get the data source corresponding to the data source id from the host application. */ @@ -11386,6 +11510,8 @@ declare module "esri/opsdashboard/ExtensionConfigurationBase" { /** ExtensionConfigurationBase is a base class used by all the extension configuration proxies. */ class ExtensionConfigurationBase extends ExtensionBase { + /** The object that will store the Widget/MapTool/FeatureAction configuration. */ + config: any; /** Indicates that the configuration is ready to be persisted or not. */ readyToPersistConfig: boolean; } @@ -11467,10 +11593,10 @@ declare module "esri/opsdashboard/GraphicsLayerProxy" { */ addOrUpdateGraphic(graphic: Graphic): void; /** - * Update a graphic in the host graphics layer with a new version. - * @param graphic The graphic to update in the host graphics layer. + * Update graphics in the host graphics layer with a new version. + * @param graphics The graphics to update in the host graphics layer. */ - addOrUpdateGraphics(graphic: Graphic): void; + addOrUpdateGraphics(graphics: Graphic[]): void; /** Removes all the graphics from the host graphics layer. */ clear(): void; /** @@ -11625,8 +11751,6 @@ declare module "esri/opsdashboard/WidgetConfigurationProxy" { /** WidgetConfigurationProxy is a class used to provide the configuration user experience for an operations dashboard extension widget. */ class WidgetConfigurationProxy extends ExtensionConfigurationBase { - /** The object that will store the widget configuration. */ - config: any; /** * Called by the host application when the user has changed the selected data source in the data source selector. * @param dataSourceProxy The selected data source. @@ -11639,7 +11763,7 @@ declare module "esri/opsdashboard/WidgetConfigurationProxy" { */ getDataSourceConfig(dataSourceProxyOrDataSourceId: DataSourceProxy | string): any; /** - * Called by the host application when the user has changed the slected map widget in the map widget selector. + * Called by the host application when the user has changed the selected map widget in the map widget selector. * @param mapWidgetProxy The selected map widget. */ mapWidgetSelectionChanged(mapWidgetProxy: MapWidgetProxy): void; @@ -11897,7 +12021,7 @@ declare module "esri/renderers/BlendRenderer" { import esri = require("esri"); import Symbol = require("esri/symbols/Symbol"); - /** (Currently in beta) BlendRenderer allows you to easily identify a predominant attribute among two or more competing attributes in a feature. */ + /** (Currently in beta) BlendRenderer allows you to easily identify the predominant attribute among two or more competing attributes of a feature and visualizes the strength of that predominance using blended colors. */ class BlendRenderer { /** This determines how colors are blended together. */ blendMode: string; @@ -12129,7 +12253,7 @@ declare module "esri/renderers/Renderer" { import Color = require("esri/Color"); import Symbol = require("esri/symbols/Symbol"); - /** The base class for the renderers - SimpleRenderer, ClassBreaksRenderer, UniqueValueRenderer, DotDensityRenderer, ScaleDependentRenderer, and TemporalRenderer used with a GraphicsLayer and FeatureLayer. */ + /** The base class for the renderers - SimpleRenderer, ClassBreaksRenderer, UniqueValueRenderer, DotDensityRenderer, ScaleDependentRenderer, TemporalRenderer, HeatmapRenderer, and VectorFieldRenderer used with a GraphicsLayer and FeatureLayer. */ class Renderer { /** An object defining a color ramp used to render the layer. */ colorInfo: any; @@ -12188,11 +12312,14 @@ declare module "esri/renderers/Renderer" { * @param info An object with the same properties as rotationInfo. */ setRotationInfo(info: any): Renderer; - /** Set size info of the renderer to modify the symbol size based on data value. */ - setSizeInfo(): Renderer; + /** + * Set size info of the renderer to modify the symbol size based on data value. + * @param info An object with the same properties as sizeInfo. + */ + setSizeInfo(info: any): Renderer; /** * Sets the renderer with the specified visualVariables. - * @param visualParams The specified visualVariables. + * @param visualParams The specified visualVariables. */ setVisualVariables(visualParams: any[]): void; /** Converts object to its ArcGIS Server JSON representation. */ @@ -12503,6 +12630,11 @@ declare module "esri/renderers/smartMapping" { * @param params See the object specifications table below for the structure of the params object. */ createClassedSizeRenderer(params: any): any; + /** + * Creates an object defining a color ramp used to render a layer. + * @param params See the object specifications table below for the structure of the params object. + */ + createColorInfo(params: any): any; /** * Creates a renderer for visualizing features using colors. * @param params See the object specifications table below for the structure of the params object. @@ -12518,6 +12650,16 @@ declare module "esri/renderers/smartMapping" { * @param params See the object specifications table below for the structure of the params object. */ createOpacityInfo(params: any): any; + /** + * Creates a renderer for identifying features by their color. + * @param params See the Object Specifications table below for the structure of the params object. + */ + createPredominanceRenderer(params: any): any; + /** + * Defines the size of the symbol where feature size is proportional to data value. + * @param params See the object specifications table below for the structure of the params object. + */ + createSizeInfo(params: any): any; /** * Creates a renderer for visualizing features by varying their size based on data. * @param params See the object specifications table below for the structure of the params object. @@ -13113,6 +13255,10 @@ declare module "esri/symbols/TextSymbol" { decoration: string; /** Font for displaying text. */ font: Font; + /** The halo color used for the text symbol.Known limitations:IE 9 and below not supported.Sub-pixel halo (i.e. */ + haloColor: Color; + /** The size (in pixel units) used if setting a halo on a text symbol.Known limitations:IE 9 and below not supported.Sub-pixel halo (i.e. */ + haloSize: number; /** Horizontal alignment of the text with respect to the graphic. */ horizontalAlignment: string; /** Determines whether to adjust the spacing between characters in the text string. */ @@ -13164,6 +13310,16 @@ declare module "esri/symbols/TextSymbol" { * @param font Text font. */ setFont(font: Font): TextSymbol; + /** + * Sets a halo color for the text symbol.NOTE: Known limitations when working with the text symbol halo:IE 9 and below not supported.Sub-pixel halo (i.e. + * @param color The color used for the text symbol halo. + */ + setHaloColor(color: Color): TextSymbol; + /** + * Sets the size of the halo (in pixels) used for the text symbol.NOTE: Known limitations when working with the text symbol halo:IE 9 and below not supported.Sub-pixel halo (i.e. + * @param size The size (in pixels) of the text symbol halo. + */ + setHaloSize(size: number): TextSymbol; /** * Updates the horizontal alignment of the text symbol. * @param alignment Horizontal alignment of the text with respect to the graphic. @@ -13658,6 +13814,8 @@ declare module "esri/tasks/FindParameters" { contains: boolean; /** An array of DynamicLayerInfos used to change the layer ordering or redefine the map. */ dynamicLayerInfos: DynamicLayerInfo[]; + /** Specifies the number of decimal places for the geometries returned by the query operation. */ + geometryPrecision: number; /** Array of layer definition expressions that allows you to filter the features of individual layers. */ layerDefinitions: string[]; /** The layers to perform the find operation on. */ @@ -13731,26 +13889,26 @@ declare module "esri/tasks/FindTask" { declare module "esri/tasks/GPMessage" { /** Represents a message generated during the execution of a geoprocessing task. */ class GPMessage { - /** esriJobMessageTypeAbort */ + /** esriJobMessageTypeAbort - Indicates the job has aborted. */ static TYPE_ABORT: any; - /** esriGPMessageTypeEmpty */ + /** esriJobMessageTypeEmpty - Indicates the task returned an empty result. */ static TYPE_EMPTY: any; - /** esriGPMessageTypeError */ + /** esriJobMessageTypeError - Indicates an error was returned during the execution of the job. */ static TYPE_ERROR: any; - /** esriGPMessageTypeInformative */ + /** esriJobMessageTypeInformative - Indicates the message is informative. */ static TYPE_INFORMATIVE: any; - /** TBA */ + /** esriJobMessageTypeProcessDefinition */ static TYPE_PROCESS_DEFINITION: any; - /** TBA */ + /** esriJobMessageTypeProcessStart - Indicates the GP process has started. */ static TYPE_PROCESS_START: any; - /** TBA */ + /** esriJobMessageTypeProcessStop - Indicates the GP process has stopped. */ static TYPE_PROCESS_STOP: any; - /** esriGPMessageTypeWarning */ + /** esriJobMessageTypeWarning - Indicates the message is a warning. */ static TYPE_WARNING: any; /** A description of the geoprocessing message. */ description: string; /** The geoprocessing message type. */ - type: number; + type: string; } export = GPMessage; } @@ -14127,7 +14285,7 @@ declare module "esri/tasks/Geoprocessor" { * @param callback The function to call when the method has completed. * @param errback An error object is returned if an error occurs on the Server during task execution. */ - checkJobStatus(jobId: string, callback?: Function, errback?: Function): void; + checkJobStatus(jobId: string, callback?: Function, errback?: Function): any; /** * Sends a request to the server to execute a synchronous GP task. * @param inputParameters The inputParameters argument specifies the input parameters accepted by the task and their corresponding values. @@ -14187,7 +14345,7 @@ declare module "esri/tasks/Geoprocessor" { * @param statusCallback Checks the current status of the job. * @param errback An error object is returned if an error occurs on the Server during task execution. */ - submitJob(inputParameters: any, callback?: Function, statusCallback?: Function, errback?: Function): void; + submitJob(inputParameters: any, callback?: Function, statusCallback?: Function, errback?: Function): any; /** Fires when an error occurs when executing the task. */ on(type: "error", listener: (event: { error: Error; target: Geoprocessor }) => void): esri.Handle; /** Fires when a synchronous GP task is completed. */ @@ -14231,6 +14389,8 @@ declare module "esri/tasks/IdentifyParameters" { dynamicLayerInfos: DynamicLayerInfo[]; /** The geometry used to select features during Identify. */ geometry: Geometry; + /** Specifies the number of decimal places for the geometries returned by the query operation. */ + geometryPrecision: number; /** Height of the map currently being viewed in pixels. */ height: number; /** Array of layer definition expressions that allows you to filter the features of individual layers. */ @@ -14403,6 +14563,28 @@ declare module "esri/tasks/ImageServiceMeasureParameters" { /** Defines parameters for the ImageServiceMeasureTask. */ class ImageServiceMeasureParameters { + /** Calculates the area and perimeter of given geometry. */ + static OPERATION_AREA_PERIMETER: any; + /** Calculates the area and perimeter of the given geometry using the DEM defined by the service to refine the calculation. */ + static OPERATION_AREA_PERIMETER_3D: any; + /** Calculates the height of a structure by measuring from the base of the structure to the top of the structure. */ + static OPERATION_BASE_TOP: any; + /** Calculates the height of a structure by measuring from the base of the structure to the top of the structure's shadow on the ground. */ + static OPERATION_BASE_TOP_SHADOW: any; + /** Calculates the centroid of a given area. */ + static OPERATION_CENTROID: any; + /** Calculates the centroid of a given area, using the DEM defined by the service to refine the calculation. */ + static OPERATION_CENTROID_3D: any; + /** Calculates the distance and azimuth angle between two points. */ + static OPERATION_DISTANCE_ANGLE: any; + /** Calculates the distance and azimuth angle between two points using the DEM defined by the service to refine the calculation. */ + static OPERATION_DISTANCE_ANGLE_3D: any; + /** Measures the location of a given point. */ + static OPERATION_POINT: any; + /** Measures the location of a given point, using the DEM defined by the service to refine the calculation. */ + static OPERATION_POINT_3D: any; + /** Calculates the height of a structure by measuring from the top of the structure to the top of the structure's shadow on the ground. */ + static OPERATION_TOP_TOP_SHADOW: any; /** The angular unit in which directions of line segments will be calculated. */ angularUnit: string; /** The area unit in which areas of polygons will be calculated. */ @@ -14613,6 +14795,8 @@ declare module "esri/tasks/ParameterValue" { class ParameterValue { /** Specifies the type of data for the parameter. */ dataType: string; + /** The name of the output parameter as defined by the geoprocessing task in the Services Directory. */ + paramName: string; /** The value of the parameter. */ value: any; } @@ -14707,7 +14891,7 @@ declare module "esri/tasks/ProjectParameters" { geometries: Geometry[]; /** The spatial reference to which you are projecting the geometries. */ outSR: SpatialReference; - /** The well-known id {wkid:number} or well-known text {wkt:string} or for the datum transfomation to be applied on the projected geometries. */ + /** The well-known id {wkid:number} or well-known text {wkt:string} or for the datum transformation to be applied on the projected geometries. */ transformation: any; /** Indicates whether to transform forward or not. */ transformForward: boolean; @@ -15331,6 +15515,8 @@ declare module "esri/tasks/datareviewer/BatchValidationTask" { executeJob(parameters: BatchValidationParameters): any; /** Retrieves all adhoc jobs from the server and returns an array of BatchValidationJob with the information. */ getAdhocJobsList(): any; + /** Returns an array of custom field names defined in a Reviewer workspace. */ + getCustomFieldNames(): any; /** * Fetches Batch Validation Job details. * @param jobId Job Id of the batch validation job. @@ -15373,19 +15559,21 @@ declare module "esri/tasks/datareviewer/BatchValidationTask" { /** Fires when the executeJob method is complete. */ on(type: "execute-job", listener: (event: { jobId: string; target: BatchValidationTask }) => void): esri.Handle; /** Fires when the getAdhocJobsList method is complete. */ - on(type: "get-adhoc-jobs-list", listener: (event: { adhocJobs: any[]; target: BatchValidationTask }) => void): esri.Handle; + on(type: "get-adhoc-jobs-list", listener: (event: { adhocJobs: BatchValidationJob[]; target: BatchValidationTask }) => void): esri.Handle; + /** Fires when the getCustomFieldNames method is complete. */ + on(type: "get-custom-field-names", listener: (event: { customFieldNames: string[]; target: BatchValidationTask }) => void): esri.Handle; /** Fires when the getJobDetails method is complete. */ on(type: "get-job-details", listener: (event: { jobDetails: BatchValidationJob; target: BatchValidationTask }) => void): esri.Handle; /** Fires when the getJobExecutionDetails method is complete. */ on(type: "get-job-execution-details", listener: (event: { jobInfo: BatchValidationJobInfo; target: BatchValidationTask }) => void): esri.Handle; /** Fires when the getJobIds method is complete. */ - on(type: "get-job-ids", listener: (event: { adhocJobs: any[]; scheduledJobs: any[]; target: BatchValidationTask }) => void): esri.Handle; + on(type: "get-job-ids", listener: (event: { adhocJobs: string[]; scheduledJobs: string[]; target: BatchValidationTask }) => void): esri.Handle; /** Fires when the getLifecycleStatusStrings method is complete. */ - on(type: "get-lifecycle-status-strings", listener: (event: { lifecycleStatusStrings: any[]; target: BatchValidationTask }) => void): esri.Handle; + on(type: "get-lifecycle-status-strings", listener: (event: { lifecycleStatusStrings: string[]; target: BatchValidationTask }) => void): esri.Handle; /** Fires when the getReviewerSessions method is complete. */ - on(type: "get-reviewer-sessions", listener: (event: { reviewerSessions: any[]; target: BatchValidationTask }) => void): esri.Handle; + on(type: "get-reviewer-sessions", listener: (event: { reviewerSessions: ReviewerSession[]; target: BatchValidationTask }) => void): esri.Handle; /** Fires when the getScheduledJobsList method is complete. */ - on(type: "get-scheduled-jobs-list", listener: (event: { scheduledJobs: any[]; target: BatchValidationTask }) => void): esri.Handle; + on(type: "get-scheduled-jobs-list", listener: (event: { scheduledJobs: BatchValidationJob[]; target: BatchValidationTask }) => void): esri.Handle; /** Fires when the scheduleJob method is complete. */ on(type: "schedule-job", listener: (event: { jobId: string; target: BatchValidationTask }) => void): esri.Handle; on(type: string, listener: (event: any) => void): esri.Handle; @@ -15435,6 +15623,8 @@ declare module "esri/tasks/datareviewer/DashboardTask" { * @param sessionOptions Session properties to be used to create the session. */ createReviewerSession(sessionName: string, sessionOptions: SessionOptions): any; + /** Returns an array of custom field names defined in a Reviewer workspace. */ + getCustomFieldNames(): any; /** Requests Dashboard results field names. */ getDashboardFieldNames(): any; /** @@ -15453,14 +15643,16 @@ declare module "esri/tasks/datareviewer/DashboardTask" { on(type: "create-reviewer-sessions", listener: (event: { reviewerSession: ReviewerSession; target: DashboardTask }) => void): esri.Handle; /** Fires when an error occurs during a DashboardTask method execution. */ on(type: "error", listener: (event: { error: Error; target: DashboardTask }) => void): esri.Handle; + /** Fires when the getCustomFieldNames method is complete. */ + on(type: "get-custom-field-names", listener: (event: { customFieldNames: string[]; target: DashboardTask }) => void): esri.Handle; /** Fires when the getDashboardFieldNames method is complete. */ - on(type: "get-dashboard-field-names", listener: (event: { fieldNames: any[]; target: DashboardTask }) => void): esri.Handle; + on(type: "get-dashboard-field-names", listener: (event: { fieldNames: string[]; target: DashboardTask }) => void): esri.Handle; /** Fires when the getDashboardResults method is complete. */ on(type: "get-dashboard-results", listener: (event: { dashboardResult: DashboardResult; target: DashboardTask }) => void): esri.Handle; /** Fires when the getLifecycleStatusStrings method is complete. */ - on(type: "get-lifecycle-status-strings", listener: (event: { lifecycleStatusStrings: any[]; target: DashboardTask }) => void): esri.Handle; + on(type: "get-lifecycle-status-strings", listener: (event: { lifecycleStatusStrings: string[]; target: DashboardTask }) => void): esri.Handle; /** Fires when the getReviewerSessions method is complete. */ - on(type: "get-reviewer-sessions", listener: (event: { reviewerSessions: any[]; target: DashboardTask }) => void): esri.Handle; + on(type: "get-reviewer-sessions", listener: (event: { reviewerSessions: ReviewerSession[]; target: DashboardTask }) => void): esri.Handle; on(type: string, listener: (event: any) => void): esri.Handle; } export = DashboardTask; @@ -15542,8 +15734,8 @@ declare module "esri/tasks/datareviewer/ReviewerFilters" { } declare module "esri/tasks/datareviewer/ReviewerLifecycle" { - /** The ReviewerLifecycle class specifies constant values for all lifecycle status and lifecycle phase strings within the Reviewer quality control workflow. */ - class ReviewerLifecycle { + /** The ReviewerLifecycle object specifies constant values for all lifecycle status and lifecycle phase strings within the Reviewer quality control workflow. */ + var ReviewerLifecycle: { /** Acceptable lifecycleStatus code = 4 belongs to Verification Phase. */ ACCEPTABLE: number; /** Code for Correction Phase. */ @@ -15600,7 +15792,7 @@ declare module "esri/tasks/datareviewer/ReviewerLifecycle" { * @param lifecycleStatus The lifecycle status code. */ toLifecycleStatusString(lifecycleStatus: number): string; - } + }; export = ReviewerLifecycle; } @@ -15614,6 +15806,7 @@ declare module "esri/tasks/datareviewer/ReviewerResultsTask" { import Geometry = require("esri/geometry/Geometry"); import ReviewerSession = require("esri/tasks/datareviewer/ReviewerSession"); import FeatureSet = require("esri/tasks/FeatureSet"); + import FeatureEditResult = require("esri/layers/FeatureEditResult"); /** ReviewerResults allows access to the reviewer workspace. */ class ReviewerResultsTask { @@ -15633,6 +15826,8 @@ declare module "esri/tasks/datareviewer/ReviewerResultsTask" { * @param batchRunIds Array of batchRunIds used to get batch run details. */ getBatchRunDetails(batchRunIds: any[]): any; + /** Returns an array of custom field names defined in a Reviewer workspace. */ + getCustomFieldNames(): any; /** * Utility operation that returns a where clause given a set of input filters. * @param filters An instance of ReviewerFilters used to create a layer definition. @@ -15646,8 +15841,10 @@ declare module "esri/tasks/datareviewer/ReviewerResultsTask" { * @param filters Instance of ReviewerFilters used to query reviewer results. */ getResults(getResultsQueryParameters: GetResultsQueryParameters, filters?: ReviewerFilters): any; + /** Retrieves a list of field names that can be used to fetch or query results from reviewer workspace. */ + getResultsFieldNames(): string[]; /** Extracts the MapServer url from the full ArcGIS Data Reviewer for Server SOE url. */ - getReviewerMapServerUrl(): any; + getReviewerMapServerUrl(): string; /** Returns an array of sessions in a Reviewer workspace. */ getReviewerSessions(): any; /** @@ -15676,16 +15873,18 @@ declare module "esri/tasks/datareviewer/ReviewerResultsTask" { on(type: "error", listener: (event: { error: Error; target: ReviewerResultsTask }) => void): esri.Handle; /** Fires when the getBatchRunDetails method is complete. */ on(type: "get-batch-run-details", listener: (event: { featureSet: FeatureSet; target: ReviewerResultsTask }) => void): esri.Handle; + /** Fires when the getCustomFieldNames method is complete. */ + on(type: "get-custom-field-names", listener: (event: { customFieldNames: string[]; target: ReviewerResultsTask }) => void): esri.Handle; /** Fires when the getLayerDefinition method is complete. */ on(type: "get-layer-definition", listener: (event: { whereClause: string; target: ReviewerResultsTask }) => void): esri.Handle; /** Fires when the getLifecycleStatusStrings method is complete. */ - on(type: "get-lifecycle-status-strings", listener: (event: { lifecycleStatusStrings: any[]; target: ReviewerResultsTask }) => void): esri.Handle; + on(type: "get-lifecycle-status-strings", listener: (event: { lifecycleStatusStrings: string[]; target: ReviewerResultsTask }) => void): esri.Handle; /** Fires when the getResults method is complete. */ on(type: "get-results", listener: (event: { featureSet: FeatureSet; target: ReviewerResultsTask }) => void): esri.Handle; /** Fires when the getReviewerSessions method is complete. */ - on(type: "get-reviewer-sessions", listener: (event: { reviewerSessions: any[]; target: ReviewerResultsTask }) => void): esri.Handle; + on(type: "get-reviewer-sessions", listener: (event: { reviewerSessions: ReviewerSession[]; target: ReviewerResultsTask }) => void): esri.Handle; /** Fires when the updateLifecycleStatus method is complete. */ - on(type: "update-lifecycle-status", listener: (event: { featureEditResults: any[]; target: ReviewerResultsTask }) => void): esri.Handle; + on(type: "update-lifecycle-status", listener: (event: { featureEditResults: FeatureEditResult[]; target: ReviewerResultsTask }) => void): esri.Handle; /** Fires when the writeFeatureAsResult method is complete. */ on(type: "write-feature-as-result", listener: (event: { success: boolean; target: ReviewerResultsTask }) => void): esri.Handle; /** Fires when the writeResult method is complete. */ From aa12240367ab251ce19e4d545667022b3ea36d7f Mon Sep 17 00:00:00 2001 From: Joe Skeen Date: Tue, 1 Dec 2015 13:41:19 -0700 Subject: [PATCH 250/389] Add definitions for WordCloud --- wordcloud/wordcloud-tests.ts | 196 +++++++++++++++++++++++++++++++++++ wordcloud/wordcloud.d.ts | 95 +++++++++++++++++ 2 files changed, 291 insertions(+) create mode 100644 wordcloud/wordcloud-tests.ts create mode 100644 wordcloud/wordcloud.d.ts diff --git a/wordcloud/wordcloud-tests.ts b/wordcloud/wordcloud-tests.ts new file mode 100644 index 000000000..530d89f5d --- /dev/null +++ b/wordcloud/wordcloud-tests.ts @@ -0,0 +1,196 @@ +/// +/// + +'use strict'; +//declare function test(name: string, test: Function); +var element: HTMLElement | HTMLElement[]; + +if (!WordCloud.isSupported) + console.log('WordCloud is not supported.'); + +WordCloud.miniumFontSize = 20; + +var list = (function () { + var string = 'Grumpy wizards make toxic brew for the evil Queen and Jack'; + + var list = []; + string.split(' ').forEach(function(word) { + list.push([word, word.length * 5]); + }); + + return list; +})(); + +function getTestOptions(): WordCloud.Options { + return { + shuffle: false, + rotateRatio: 0, + color: '#000', + fontFamily: 'sans-serif', + list: list + }; +}; + +test('Test runs without any extra parameters.', function() { + var options = getTestOptions(); + WordCloud(element, options); +}); + +test('Empty list results no output.', function() { + var options = getTestOptions(); + options.list = []; + + WordCloud(element, options); +}); + +test('gridSize can be set', function() { + var options = getTestOptions(); + options.gridSize = 15; + + WordCloud(element, options); +}); + +test('ellipticity can be set', function() { + var options = getTestOptions(); + options.ellipticity = 1.5; + + WordCloud(element, options); +}); + +test('origin can be set', function() { + var options = getTestOptions(); + options.origin = [300, 0]; + + WordCloud(element, options); +}); + +test('minSize can be set', function() { + var options = getTestOptions(); + options.minSize = 10; + + WordCloud(element, options); +}); + +test('rotation can be set and locked', function() { + var options = getTestOptions(); + options.rotateRatio = 1; + options.minRotation = options.maxRotation = Math.PI / 6; + + WordCloud(element, options); +}); + +test('drawMask can be set', function() { + var options = getTestOptions(); + options.drawMask = true; + + WordCloud(element, options); +}); + +test('maskColor can be set', function() { + var options = getTestOptions(); + options.drawMask = true; + options.maskColor = 'rgba(0, 0, 255, 0.8)'; + + WordCloud(element, options); +}); + +test('backgroundColor can be set', function() { + var options = getTestOptions(); + options.backgroundColor = 'rgb(0, 0, 255)'; + + WordCloud(element, options); +}); + +test('semi-transparent backgroundColor can be set', function() { + var options = getTestOptions(); + options.backgroundColor = 'rgba(0, 0, 255, 0.3)'; + + WordCloud(element, options); +}); + +test('weightFactor can be set', function() { + var options = getTestOptions(); + options.weightFactor = 2; + + WordCloud(element, options); +}); + +test('weightFactor can be set as a function', function() { + var options = getTestOptions(); + options.weightFactor = function (w) { return Math.sqrt(w); }; + + WordCloud(element, options); +}); + +test('color can be set as a function', function() { + var options = getTestOptions(); + options.color = function (word, weight, fontSize, radius, theta) { + if (theta < 2*Math.PI/3) { + return '#600'; + } else if (theta < 2*Math.PI*2/3) { + return '#060'; + } else { + return '#006'; + } + }; + + WordCloud(element, options); +}); + +test('shape can be set to circle', function() { + var options = getTestOptions(); + options.shape = 'circle'; + + WordCloud(element, options); +}); + +test('shape can be set to cardioid', function() { + var options = getTestOptions(); + options.shape = 'cardioid'; + + WordCloud(element, options); +}); + +test('shape can be set to diamond', function() { + var options = getTestOptions(); + options.shape = 'diamond'; + + WordCloud(element, options); +}); + +test('shape can be set to triangle', function() { + var options = getTestOptions(); + options.shape = 'triangle'; + + WordCloud(element, options); +}); + +test('shape can be set to triangle-forward', function() { + var options = getTestOptions(); + options.shape = 'triangle-forward'; + + WordCloud(element, options); +}); + +test('shape can be set to pentagon', function() { + var options = getTestOptions(); + options.shape = 'pentagon'; + + WordCloud(element, options); +}); + +test('shape can be set to star', function() { + var options = getTestOptions(); + options.shape = 'star'; + + WordCloud(element, options); +}); + +test('shape can be set to a given polar equation', function() { + var options = getTestOptions(); + options.shape = function (theta) { + return theta / (2 * Math.PI); + }; + + WordCloud(element, options); +}); \ No newline at end of file diff --git a/wordcloud/wordcloud.d.ts b/wordcloud/wordcloud.d.ts new file mode 100644 index 000000000..c03b0cadb --- /dev/null +++ b/wordcloud/wordcloud.d.ts @@ -0,0 +1,95 @@ +// Type definitions for wordcloud +// Project: https://github.com/timdream/wordcloud2.js +// Definitions by: Joe Skeen +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function WordCloud(elements: HTMLElement | HTMLElement[], options: WordCloud.Options); + +declare namespace WordCloud { + var isSupported: boolean; + var miniumFontSize: number; + + interface Options { + /** + * List of words/text to paint on the canvas in a 2-d array, in the form of [word, size], + * e.g. [['foo', 12] , ['bar', 6]]. + */ + list?: Array<[string, number]> | any[]; + /** font to use. */ + fontFamily?: string; + /** font weight to use, e.g. normal, bold or 600 */ + fontWeight?: string | number; + /** + * color of the text, can be any CSS color, or a callback(word, weight, fontSize, distance, theta) + * specifies different color for each item in the list. You may also specify colors with built-in + * keywords: random-dark and random-light. + */ + color?: string | ((word: string, weight: string | number, fontSize: number, distance: number, theta: number) => string); + /** minimum font size to draw on the canvas. */ + minSize?: number; + /** function to call or number to multiply for size of each word in the list. */ + weightFactor?: number | ((weight: number) => number); + /** paint the entire canvas with background color and consider it empty before start. */ + clearCanvas?: boolean; + /** color of the background. */ + backgroundColor?: string; + + /** + * size of the grid in pixels for marking the availability of the canvas — the larger the grid size, + * the bigger the gap between words. + */ + gridSize?: number; + /** origin of the “cloud” in [x, y]. */ + origin?: [number, number]; + + /** visualize the grid by draw squares to mask the drawn areas. */ + drawMask?: boolean; + /** color of the mask squares. */ + maskColor?: string; + /** width of the gaps between mask squares. */ + maskGapWidth?: number; + + /** Wait for x milliseconds before start drawn the next item using setTimeout. */ + wait?: number; + /** If the call with in the loop takes more than x milliseconds (and blocks the browser), abort immediately. */ + abortThreshold?: number; + /** callback function to call when abort. */ + abort?: Function; + + /** If the word should rotate, the minimum rotation (in rad) the text should rotate. */ + minRotation?: number; + /** + * If the word should rotate, the maximum rotation (in rad) the text should rotate. Set the two value equal + * to keep all text in one angle. + */ + maxRotation?: number; + + /** Shuffle the points to draw so the result will be different each time for the same list and settings. */ + shuffle?: boolean; + /** Probability for the word to rotate. Set the number to 1 to always rotate. */ + rotateRatio?: number; + + /** + * The shape of the "cloud" to draw. Can be any polar equation represented as a callback function, or a + * keyword present. Available presents are circle (default), cardioid (apple or heart shape curve, the most + * known polar equation), diamond (alias of square), triangle-forward, triangle, (alias of triangle-upright, + * pentagon, and star. + */ + shape?: string | ((theta: number) => number); + /** degree of "flatness" of the shape wordcloud2.js should draw. */ + ellipticity?: number; + + /** + * callback to call when the cursor enters or leaves a region occupied by a word. The callback will take + * arugments callback(item, dimension, event), where event is the original mousemove event. This only will work + * on HTML5 canvas word clouds. + */ + hover?; + /** + * callback to call when the user clicks on a word. The callback will take arugments + * callback(item, dimension, event), where event is the original click event. This only will work on HTML5 + * canvas word clouds. + */ + click?; + } +} \ No newline at end of file From fb1f9350d14c4fa9a291090110d06d63b6bcb6af Mon Sep 17 00:00:00 2001 From: Joe Skeen Date: Tue, 1 Dec 2015 13:55:27 -0700 Subject: [PATCH 251/389] Fix implicit `any` issues --- wordcloud/wordcloud-tests.ts | 2 +- wordcloud/wordcloud.d.ts | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/wordcloud/wordcloud-tests.ts b/wordcloud/wordcloud-tests.ts index 530d89f5d..2eecca3b8 100644 --- a/wordcloud/wordcloud-tests.ts +++ b/wordcloud/wordcloud-tests.ts @@ -13,7 +13,7 @@ WordCloud.miniumFontSize = 20; var list = (function () { var string = 'Grumpy wizards make toxic brew for the evil Queen and Jack'; - var list = []; + var list: WordCloud.ListEntry[] = []; string.split(' ').forEach(function(word) { list.push([word, word.length * 5]); }); diff --git a/wordcloud/wordcloud.d.ts b/wordcloud/wordcloud.d.ts index c03b0cadb..61c7003a4 100644 --- a/wordcloud/wordcloud.d.ts +++ b/wordcloud/wordcloud.d.ts @@ -3,7 +3,7 @@ // Definitions by: Joe Skeen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare function WordCloud(elements: HTMLElement | HTMLElement[], options: WordCloud.Options); +declare function WordCloud(elements: HTMLElement | HTMLElement[], options: WordCloud.Options): void; declare namespace WordCloud { var isSupported: boolean; @@ -14,7 +14,7 @@ declare namespace WordCloud { * List of words/text to paint on the canvas in a 2-d array, in the form of [word, size], * e.g. [['foo', 12] , ['bar', 6]]. */ - list?: Array<[string, number]> | any[]; + list?: Array | any[]; /** font to use. */ fontFamily?: string; /** font weight to use, e.g. normal, bold or 600 */ @@ -84,12 +84,22 @@ declare namespace WordCloud { * arugments callback(item, dimension, event), where event is the original mousemove event. This only will work * on HTML5 canvas word clouds. */ - hover?; + hover?: EventCallback; /** * callback to call when the user clicks on a word. The callback will take arugments * callback(item, dimension, event), where event is the original click event. This only will work on HTML5 * canvas word clouds. */ - click?; + click?: EventCallback; } + + interface Dimension { + x: number; + y: number; + w: number; + h: number; + } + + type ListEntry = [string, number]; + type EventCallback = (item: ListEntry, dimension: Dimension, event: MouseEvent) => void; } \ No newline at end of file From dc61765718929572e520610c19d99c32486b7720 Mon Sep 17 00:00:00 2001 From: leonuh Date: Tue, 1 Dec 2015 23:14:22 +0100 Subject: [PATCH 252/389] fix(material-ui) - spacing, gridlist style, gridtile style --- material-ui/material-ui-tests.tsx | 7 +++++-- material-ui/material-ui.d.ts | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/material-ui/material-ui-tests.tsx b/material-ui/material-ui-tests.tsx index 0165dee1f..8c7ff2997 100644 --- a/material-ui/material-ui-tests.tsx +++ b/material-ui/material-ui-tests.tsx @@ -6,6 +6,7 @@ import * as React from "react"; import * as LinkedStateMixin from "react-addons-linked-state-mixin"; import Checkbox = require("material-ui/lib/checkbox"); import Colors = require("material-ui/lib/styles/colors"); +import Spacing = require("material-ui/lib/styles/spacing"); import AppBar = require("material-ui/lib/app-bar"); import Badge = require("material-ui/lib/badge"); import IconButton = require("material-ui/lib/icon-button"); @@ -488,7 +489,8 @@ class MaterialUiTests extends React.Component<{}, {}> implements React.LinkedSta element = ; + cellHeight={200} + style={{ color: 'red' }} />; element = implements React.LinkedSta titlePosition="top" titleBackground="rgba(0, 0, 0, 0.4)" cols={2} - rows={1} > + rows={1} + style={{ color: 'red' }}>

    Children are Required!

    ; diff --git a/material-ui/material-ui.d.ts b/material-ui/material-ui.d.ts index df6a088a7..5ea7eb8a0 100644 --- a/material-ui/material-ui.d.ts +++ b/material-ui/material-ui.d.ts @@ -870,6 +870,8 @@ declare namespace __MaterialUI { desktopSubheaderHeight?: number; desktopToolbarHeight?: number; } + export var Spacing: Spacing; + interface ThemePalette { primary1Color?: string; primary2Color?: string; @@ -1532,6 +1534,7 @@ declare namespace __MaterialUI { cols?: number; padding?: number; cellHeight?: number; + style?: React.CSSProperties; } export class GridList extends React.Component{ @@ -1547,6 +1550,7 @@ declare namespace __MaterialUI { cols?: number; rows?: number; rootClass?: string | __React.Component; + style?: React.CSSProperties; } export class GridTile extends React.Component{ From 9322940349e79faeccb65b8f4e3f898e958580ec Mon Sep 17 00:00:00 2001 From: Nathan Brown Date: Tue, 1 Dec 2015 16:44:13 -0700 Subject: [PATCH 253/389] material-ui - update to new dialog usage. --- material-ui/material-ui-tests.tsx | 30 +++++++++++++++++++++++++----- material-ui/material-ui.d.ts | 6 +++++- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/material-ui/material-ui-tests.tsx b/material-ui/material-ui-tests.tsx index 0165dee1f..ace37bdc7 100644 --- a/material-ui/material-ui-tests.tsx +++ b/material-ui/material-ui-tests.tsx @@ -47,7 +47,13 @@ type CheckboxProps = __MaterialUI.CheckboxProps; type MuiTheme = __MaterialUI.Styles.MuiTheme; type TouchTapEvent = __MaterialUI.TouchTapEvent; -class MaterialUiTests extends React.Component<{}, {}> implements React.LinkedStateMixin { +interface MaterialUiTestsState { + showDialogStandardActions: boolean; + showDialogCustomActions: boolean; + showDialogScrollable: boolean; +} + +class MaterialUiTests extends React.Component<{}, MaterialUiTestsState> implements React.LinkedStateMixin { // injected with mixin linkState: (key: string) => React.ReactLink; @@ -60,6 +66,8 @@ class MaterialUiTests extends React.Component<{}, {}> implements React.LinkedSta } private selectFieldChangeHandler(e: TouchTapEvent, si: number, mi: any) { } + private handleRequestClose(buttonClicked: boolean) { + } render() { @@ -193,7 +201,8 @@ class MaterialUiTests extends React.Component<{}, {}> implements React.LinkedSta title="Dialog With Standard Actions" actions={standardActions} actionFocus="submit" - modal={true}> + open={this.state.showDialogStandardActions} + onRequestClose={this.handleRequestClose}> The actions in this window are created from the json that's passed in. ; @@ -212,12 +221,23 @@ class MaterialUiTests extends React.Component<{}, {}> implements React.LinkedSta element = + open={this.state.showDialogCustomActions} + onRequestClose={this.handleRequestClose}> The actions in this window were passed in as an array of react objects. ; + element = +
    + Really long content +
    +
    ; + // "http://material-ui.com/#/components/dropdown-menu" let menuItems = [ diff --git a/material-ui/material-ui.d.ts b/material-ui/material-ui.d.ts index df6a088a7..a27a0ee09 100644 --- a/material-ui/material-ui.d.ts +++ b/material-ui/material-ui.d.ts @@ -1,4 +1,4 @@ -// Type definitions for material-ui v0.13.1 +// Type definitions for material-ui v0.13.4 // Project: https://github.com/callemall/material-ui // Definitions by: Nathan Brown , Oliver Herrmann // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -379,14 +379,18 @@ declare namespace __MaterialUI { openImmediately?: boolean; repositionOnUpdate?: boolean; title?: React.ReactNode; + defaultOpen?: boolean; + open?: boolean; onClickAway?: () => void; onDismiss?: () => void; onShow?: () => void; + onRequestClose?: (buttonClicked: boolean) => void; } export class Dialog extends React.Component { dismiss(): void; show(): void; + isOpen(): boolean; } interface DropDownIconProps extends React.Props { From 002ff03420252103f68752c8bfdfc40199e07e31 Mon Sep 17 00:00:00 2001 From: Jonathan Price Date: Tue, 1 Dec 2015 23:55:03 +0000 Subject: [PATCH 254/389] Bluebird: Make return type of promisifyAll less restrictive --- bluebird/bluebird-1.0.d.ts | 2 +- bluebird/bluebird.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bluebird/bluebird-1.0.d.ts b/bluebird/bluebird-1.0.d.ts index db9dd0dd2..b8287e57c 100644 --- a/bluebird/bluebird-1.0.d.ts +++ b/bluebird/bluebird-1.0.d.ts @@ -394,7 +394,7 @@ declare class Promise implements Promise.Thenable { * Note that the original methods on the object are not overwritten but new methods are created with the `Async`-postfix. For example, if you `promisifyAll()` the node.js `fs` object use `fs.statAsync()` to call the promisified `stat` method. */ // TODO how to model promisifyAll? - static promisifyAll(target: Object): Object; + static promisifyAll(target: Object): any; /** * Returns a function that can use `yield` to run asynchronous code synchronously. This feature requires the support of generators which are drafted in the next version of the language. Node version greater than `0.11.2` is required and needs to be executed with the `--harmony-generators` (or `--harmony`) command-line switch. diff --git a/bluebird/bluebird.d.ts b/bluebird/bluebird.d.ts index 9b55578ef..da3b9902a 100644 --- a/bluebird/bluebird.d.ts +++ b/bluebird/bluebird.d.ts @@ -421,7 +421,7 @@ declare class Promise implements Promise.Thenable, Promise.Inspection { * Note that the original methods on the object are not overwritten but new methods are created with the `Async`-postfix. For example, if you `promisifyAll()` the node.js `fs` object use `fs.statAsync()` to call the promisified `stat` method. */ // TODO how to model promisifyAll? - static promisifyAll(target: Object, options?: Promise.PromisifyAllOptions): Object; + static promisifyAll(target: Object, options?: Promise.PromisifyAllOptions): any; /** From 64ed3fcbf0a47510b51d167f5323ed2ea6b25caf Mon Sep 17 00:00:00 2001 From: pmccloghrylaing Date: Wed, 25 Nov 2015 01:12:37 +1100 Subject: [PATCH 255/389] ngCordova plugins: ActionSheet, Badge, File, FileTransfer --- ng-cordova/actionSheet-tests.ts | 27 +++++ ng-cordova/actionSheet.d.ts | 22 ++++ ng-cordova/badge-tests.ts | 59 ++++++++++ ng-cordova/badge.d.ts | 18 +++ ng-cordova/file-tests.ts | 184 +++++++++++++++++++++++++++++++ ng-cordova/file.d.ts | 51 +++++++++ ng-cordova/fileTransfer-tests.ts | 53 +++++++++ ng-cordova/fileTransfer.d.ts | 30 +++++ ng-cordova/tsd.d.ts | 4 + 9 files changed, 448 insertions(+) create mode 100644 ng-cordova/actionSheet-tests.ts create mode 100644 ng-cordova/actionSheet.d.ts create mode 100644 ng-cordova/badge-tests.ts create mode 100644 ng-cordova/badge.d.ts create mode 100644 ng-cordova/file-tests.ts create mode 100644 ng-cordova/file.d.ts create mode 100644 ng-cordova/fileTransfer-tests.ts create mode 100644 ng-cordova/fileTransfer.d.ts diff --git a/ng-cordova/actionSheet-tests.ts b/ng-cordova/actionSheet-tests.ts new file mode 100644 index 000000000..07d105b54 --- /dev/null +++ b/ng-cordova/actionSheet-tests.ts @@ -0,0 +1,27 @@ +/// +/// + +module ngCordova { + 'use strict'; + + angular.module('test') + // Adapted from http://ngcordova.com/docs/plugins/actionSheet/ + .controller('ThisCtrl', function($cordovaActionSheet: ngCordova.IActionSheetService) { + + var options = { + title: 'What do you want with this image?', + buttonLabels: ['Share via Facebook', 'Share via Twitter'], + addCancelButtonWithLabel: 'Cancel', + androidEnableCancelButton: true, + winphoneEnableCancelButton: true, + addDestructiveButtonWithLabel: 'Delete it' + }; + + document.addEventListener("deviceready", function() { + $cordovaActionSheet.show(options) + .then(function(btnIndex) { + var index: number = btnIndex; + }); + }, false); + }); +} diff --git a/ng-cordova/actionSheet.d.ts b/ng-cordova/actionSheet.d.ts new file mode 100644 index 000000000..1809d7fb0 --- /dev/null +++ b/ng-cordova/actionSheet.d.ts @@ -0,0 +1,22 @@ +// Type definitions for ngCordova Action Sheet plugin +// Project: https://github.com/driftyco/ng-cordova +// Definitions by: Phil McCloghry-Laing +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module ngCordova { + export interface IActionSheetService { + show(options: ShowOptions): ng.IPromise; + hide(): ng.IPromise; + } + + export interface ShowOptions { + title?: string; + buttonLabels?: string[]; + addCancelButtonWithLabel?: string; + addDestructiveButtonWithLabel?: string; + androidEnableCancelButton?: boolean; + winphoneEnableCancelButton?: boolean; + } +} diff --git a/ng-cordova/badge-tests.ts b/ng-cordova/badge-tests.ts new file mode 100644 index 000000000..854f66b39 --- /dev/null +++ b/ng-cordova/badge-tests.ts @@ -0,0 +1,59 @@ +/// +/// + +module ngCordova { + 'use strict'; + + angular.module('test') + // Adapted from http://ngcordova.com/docs/plugins/badge/ + .controller('ThisCtrl', function($cordovaBadge: ngCordova.IBadgeService) { + + $cordovaBadge.hasPermission().then(function(yes) { + // You have permission + }, function(no) { + // You do not have permission + }); + + $cordovaBadge.set(3).then(function() { + // You have permission, badge set. + }, function(err) { + // You do not have permission. + }); + + $cordovaBadge.get().then(function(badge) { + // You have permission, badge returned. + var badgeNo: number = badge; + }, function(err) { + // You do not have permission. + }); + + $cordovaBadge.clear().then(function() { + // You have permission, badge cleared. + }, function(err) { + // You do not have permission. + }); + + $cordovaBadge.increase().then(function() { + // You have permission, badge increased. + }, function(err) { + // You do not have permission. + }); + $cordovaBadge.increase(3).then(function() { + // You have permission, badge increased. + }, function(err) { + // You do not have permission. + }); + + $cordovaBadge.decrease().then(function() { + // You have permission, badge increased. + }, function(err) { + // You do not have permission. + }); + $cordovaBadge.decrease(2).then(function() { + // You have permission, badge increased. + }, function(err) { + // You do not have permission. + }); + + }); +} diff --git a/ng-cordova/badge.d.ts b/ng-cordova/badge.d.ts new file mode 100644 index 000000000..b73b3182c --- /dev/null +++ b/ng-cordova/badge.d.ts @@ -0,0 +1,18 @@ +// Type definitions for ngCordova badge plugin +// Project: https://github.com/driftyco/ng-cordova +// Definitions by: Phil McCloghry-Laing +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module ngCordova { + export interface IBadgeService { + hasPermission(): ng.IPromise; + promptForPermission(): ng.IPromise; + set(badge: number, callback?: Function, scope?: {}): ng.IPromise; + get(): ng.IPromise; + clear(callback?: Function, scope?: {}): ng.IPromise; + increase(count?: number, callback?: Function, scope?: {}): ng.IPromise; + decrease(count?: number, callback?: Function, scope?: {}): ng.IPromise; + } +} diff --git a/ng-cordova/file-tests.ts b/ng-cordova/file-tests.ts new file mode 100644 index 000000000..6a4297394 --- /dev/null +++ b/ng-cordova/file-tests.ts @@ -0,0 +1,184 @@ +/// +/// +/// + +module ngCordova { + 'use strict'; + + + angular.module('test') + // Adapted from http://ngcordova.com/docs/plugins/file/ + .controller('MyCtrl', function($scope: ng.IScope, $cordovaFile: ngCordova.IFileService) { + + document.addEventListener('deviceready', function() { + + $cordovaFile.getFreeDiskSpace() + .then(function(success) { + // success in kilobytes + var freeSpace: number = success; + }, function(error) { + // error + }); + + + // CHECK + $cordovaFile.checkDir(cordova.file.dataDirectory, "dir/other_dir") + .then(function(success) { + // success + var dir: DirectoryEntry = success; + }, function(error) { + // error + }); + + + $cordovaFile.checkFile(cordova.file.dataDirectory, "some_file.txt") + .then(function(success) { + // success + var fileResult: FileEntry = success; + }, function(error) { + // error + }); + + + // CREATE + $cordovaFile.createDir(cordova.file.dataDirectory, "new_dir", false) + .then(function(success) { + // success + var dir: DirectoryEntry = success; + }, function(error) { + // error + }); + + $cordovaFile.createFile(cordova.file.dataDirectory, "new_file.txt", true) + .then(function(success) { + // success + var fileResult: FileEntry = success; + }, function(error) { + // error + }); + + + // REMOVE + $cordovaFile.removeDir(cordova.file.dataDirectory, "some_dir") + .then(function(success) { + // success + if (success.success) { + var dirResult: DirectoryEntry = success.fileRemoved; + } + }, function(error) { + // error + }); + + $cordovaFile.removeFile(cordova.file.dataDirectory, "some_file.txt") + .then(function(success) { + // success + if (success.success) { + var fileResult: FileEntry = success.fileRemoved; + } + }, function(error) { + // error + }); + + $cordovaFile.removeRecursively(cordova.file.dataDirectory, "") + .then(function(success) { + // success + if (success.success) { + var dirResult: DirectoryEntry = success.fileRemoved; + } + }, function(error) { + // error + }); + + + // WRITE + $cordovaFile.writeFile(cordova.file.dataDirectory, "file.txt", "text", true) + .then(function(success) { + // success + var endEvent: ProgressEvent = success; + }, function(error) { + // error + }); + + $cordovaFile.writeExistingFile(cordova.file.dataDirectory, "file.txt", "text") + .then(function(success) { + // success + var endEvent: ProgressEvent = success; + }, function(error) { + // error + }); + + + // READ + $cordovaFile.readAsText(cordova.file.dataDirectory, "file.txt") + .then(function(success) { + // success + var text: string = success; + }, function(error) { + // error + }); + + $cordovaFile.readAsDataURL(cordova.file.dataDirectory, "file.txt") + .then(function(success) { + // success + var text: string = success; + }, function(error) { + // error + }); + + $cordovaFile.readAsBinaryString(cordova.file.dataDirectory, "file.txt") + .then(function(success) { + // success + var text: string = success; + }, function(error) { + // error + }); + + $cordovaFile.readAsArrayBuffer(cordova.file.dataDirectory, "file.txt") + .then(function(success) { + // success + var buffer: ArrayBuffer = success; + }, function(error) { + // error + }); + + + // MOVE + $cordovaFile.moveDir(cordova.file.dataDirectory, "dir", cordova.file.tempDirectory, "new_dir") + .then(function(success) { + // success + var dirResult: DirectoryEntry = success; + }, function(error) { + // error + }); + + $cordovaFile.moveFile(cordova.file.dataDirectory, "file.txt", cordova.file.tempDirectory) + .then(function(success) { + // success + var fileResult: FileEntry = success; + }, function(error) { + // error + }); + + + // COPY + $cordovaFile.copyDir(cordova.file.dataDirectory, "dir", cordova.file.tempDirectory, "new_dir") + .then(function(success) { + // success + var dirResult: DirectoryEntry = success; + }, function(error) { + // error + }); + + $cordovaFile.copyFile(cordova.file.dataDirectory, "file.txt", cordova.file.tempDirectory, "new_file.txt") + .then(function(success) { + // success + var fileResult: FileEntry = success; + }, function(error) { + // error + }); + + + }); + + }); +} diff --git a/ng-cordova/file.d.ts b/ng-cordova/file.d.ts new file mode 100644 index 000000000..04f19080a --- /dev/null +++ b/ng-cordova/file.d.ts @@ -0,0 +1,51 @@ +// Type definitions for ngCordova file plugin +// Project: https://github.com/driftyco/ng-cordova +// Definitions by: Phil McCloghry-Laing +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// + +declare module ngCordova { + export interface IFileService { + getFreeDiskSpace(): IFilePromise; + + checkDir(path: string, directory: string): IFilePromise; + checkFile(path: string, file: string): IFilePromise; + + createDir(path: string, directory: string, replace?: boolean): IFilePromise; + createFile(path: string, file: string, replace?: boolean): IFilePromise; + + removeDir(path: string, directory: string): IFilePromise>; + removeFile(path: string, file: string): IFilePromise>; + removeRecursively(path: string, directory: string): IFilePromise>; + + writeFile(path: string, file: string, text: string | Blob, replace?: boolean): IFilePromise; + writeExistingFile(path: string, file: string, text: string | Blob): IFilePromise; + + readAsText(path: string, file: string): ng.IPromise; + readAsDataURL(path: string, file: string): ng.IPromise; + readAsBinaryString(path: string, file: string): ng.IPromise; + readAsArrayBuffer(path: string, file: string): ng.IPromise; + + moveDir(path: string, directory: string, newPath: string, newDirectory?: string): IFilePromise; + moveFile(path: string, file: string, newPath: string, newFile?: string): IFilePromise; + + copyDir(path: string, directory: string, newPath: string, newDirectory?: string): IFilePromise; + copyFile(path: string, file: string, newPath: string, newFile?: string): IFilePromise; + } + + export interface IFilePromise extends ng.IPromise { + then(successCallback: (promiseValue: T) => ng.IPromise | TResult, errorCallback?: (error: IFileError) => ng.IPromise | TResult): ng.IPromise; + catch(onRejected: (error: IFileError) => ng.IPromise | TResult): ng.IPromise; + } + + export interface IFileRemoveResult { + success: boolean; + fileRemoved: TEntry; + } + + export interface IFileError extends FileError { + message: string; + } +} diff --git a/ng-cordova/fileTransfer-tests.ts b/ng-cordova/fileTransfer-tests.ts new file mode 100644 index 000000000..0c188f239 --- /dev/null +++ b/ng-cordova/fileTransfer-tests.ts @@ -0,0 +1,53 @@ +/// +/// +/// + +module ngCordova { + 'use strict'; + + angular.module('test') + // Adapted from http://ngcordova.com/docs/plugins/fileTransfer/ + .controller('MyCtrl', function($scope: ng.IScope & { downloadProgress: number; }, $timeout: ng.ITimeoutService, $cordovaFileTransfer: ngCordova.IFileTransferService) { + + document.addEventListener('deviceready', function() { + + var url = "http://cdn.wall-pix.net/albums/art-space/00030109.jpg"; + var targetPath = cordova.file.documentsDirectory + "testImage.png"; + var trustHosts = true + var options = {}; + + $cordovaFileTransfer.download(url, targetPath, options, trustHosts) + .then(function(result) { + // Success! + var file: FileEntry = result; + }, function(err) { + // Error + }, function(progress) { + $timeout(function() { + $scope.downloadProgress = (progress.loaded / progress.total) * 100; + }) + }); + + }, false); + + + document.addEventListener('deviceready', function() { + + var url = "http://cdn.wall-pix.net/uploads"; + var filePath = cordova.file.documentsDirectory + "testImage.png"; + var trustHosts = true + var options = {}; + + $cordovaFileTransfer.upload(url, filePath, options, trustHosts) + .then(function(result) { + // Success! + var file: FileUploadResult = result; + }, function(err) { + // Error + }, function(progress) { + // constant progress updates + }); + + }, false); + }); +} diff --git a/ng-cordova/fileTransfer.d.ts b/ng-cordova/fileTransfer.d.ts new file mode 100644 index 000000000..838302e10 --- /dev/null +++ b/ng-cordova/fileTransfer.d.ts @@ -0,0 +1,30 @@ +// Type definitions for ngCordova file-transfer plugin +// Project: https://github.com/driftyco/ng-cordova +// Definitions by: Phil McCloghry-Laing +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// +/// + +declare module ngCordova { + export interface IFileTransferService { + download(url: string, filePath: string, options?: IFileDownloadOptions, trustAllHosts?: boolean): IFileTransferPromise; + upload(url: string, filePath: string, options?: IFileUploadOptions, trustAllHosts?: boolean): IFileTransferPromise; + } + + export interface IFileTransferPromise extends ng.IPromise { + then(successCallback: (promiseValue: T) => ng.IPromise | TResult, errorCallback?: (error: FileTransferError) => ng.IPromise | TResult, notifyCallback?: (state: any) => any): ng.IPromise; + catch(onRejected: (error: FileTransferError) => ng.IPromise | TResult): ng.IPromise; + } + + export interface IFileDownloadOptions extends FileDownloadOptions { + encodeURI?: boolean; + timeout?: number; + } + + export interface IFileUploadOptions extends FileUploadOptions { + encodeURI?: boolean; + timeout?: number; + } +} diff --git a/ng-cordova/tsd.d.ts b/ng-cordova/tsd.d.ts index 5f17dd706..791b61144 100644 --- a/ng-cordova/tsd.d.ts +++ b/ng-cordova/tsd.d.ts @@ -15,3 +15,7 @@ /// /// /// +/// +/// +/// +/// From db8c6b7997a689a6aec02ede8abe369f6eeae92b Mon Sep 17 00:00:00 2001 From: Leon Yu Date: Wed, 18 Nov 2015 04:06:07 -0500 Subject: [PATCH 256/389] ZeroCLipboard 2.x.x and jsdoc Test for 1.x.x Fix encoding Fix styling Code review --- zeroclipboard/zeroclipboard-1.x.x-tests.ts | 158 ++++++ zeroclipboard/zeroclipboard-1.x.x.d.ts | 79 +++ zeroclipboard/zeroclipboard-tests.ts | 542 ++++++++++++++++++++ zeroclipboard/zeroclipboard.d.ts | 554 ++++++++++++++++++--- 4 files changed, 1271 insertions(+), 62 deletions(-) create mode 100644 zeroclipboard/zeroclipboard-1.x.x-tests.ts create mode 100644 zeroclipboard/zeroclipboard-1.x.x.d.ts create mode 100644 zeroclipboard/zeroclipboard-tests.ts diff --git a/zeroclipboard/zeroclipboard-1.x.x-tests.ts b/zeroclipboard/zeroclipboard-1.x.x-tests.ts new file mode 100644 index 000000000..e087561f6 --- /dev/null +++ b/zeroclipboard/zeroclipboard-1.x.x-tests.ts @@ -0,0 +1,158 @@ +/// +/// + +// main.js +var client = new ZeroClipboard( document.getElementById("copy-button"), { + moviePath: "/path/to/ZeroClipboard.swf" +} ); + +client.on( "load", function(client) { + // alert( "movie is loaded" ); + + client.on( "complete", function(client, args) { + // `this` is the element that was clicked + this.style.display = "none"; + alert("Copied text to clipboard: " + args.text ); + } ); +} ); + +ZeroClipboard.config( { moviePath: 'http://YOURSERVER/path/ZeroClipboard.swf' } ); + +var client = new ZeroClipboard(); + +var client = new ZeroClipboard($(".copy-button")); + +var _globalConfig = { + // NOTE: For versions >= v1.3.x and < v2.x, you must use `swfPath` by setting `moviePath`: + // `ZeroClipboard.config({ moviePath: ZeroClipboard.config("swfPath") });` + // URL to movie, relative to the page. Default value will be "ZeroClipboard.swf" under the + // same path as the ZeroClipboard JS file. + swfPath: "path/to/ZeroClipboard.swf", + + // SWF inbound scripting policy: page domains that the SWF should trust. (single string or array of strings) + trustedDomains: [window.location.host], + + // Include a "nocache" query parameter on requests for the SWF + cacheBust: true, + + // Forcibly set the hand cursor ("pointer") for all clipped elements + forceHandCursor: false, + + // The z-index used by the Flash object. Max value (32-bit): 2147483647 + zIndex: 999999999, + + // Debug enabled: send `console` messages with deprecation warnings, etc. + debug: true, + + // Sets the title of the `div` encapsulating the Flash object + title: 'div', + + // Setting this to `false` would allow users to handle calling `ZeroClipboard.activate(...);` + // themselves instead of relying on our per-element `mouseover` handler + autoActivate: true, + + + /** @deprecated */ + // The class used to indicate that a clipped element is being hovered over + hoverClass: "zeroclipboard-is-hover", + + /** @deprecated */ + // The class used to indicate that a clipped element is active (is being clicked) + activeClass: "zeroclipboard-is-active", + + /** @deprecated */ + // DEPRECATED!!! Use `trustedDomains` instead! + // SWF inbound scripting policy: page origins that the SWF should trust. (single string or array of strings) + trustedOrigins: ['origin'], + + /** @deprecated */ + // SWF outbound scripting policy. Possible values: "never", "sameDomain", "always" + allowScriptAccess: 'always', + + /** @deprecated */ + // Include a "nocache" query parameter on requests for the SWF + useNoCache: true, + + /** @deprecated */ + // URL to movie + moviePath: "ZeroClipboard.swf" +}; + +ZeroClipboard.config(_globalConfig); + +ZeroClipboard.config({ moviePath: "new/path" }); + +var client = new ZeroClipboard($("#d_clip_button"), { moviePath: "new/path" }); +client.on( 'dataRequested', function (client, args) { + client.setText( "Copy me!" ); + }); + +client.setText( "Copy me!" ); + +client.clip( document.getElementById('d_clip_button') ); + +var client = new ZeroClipboard( $("button#my-button") ); + +function my_load_handler() { + +} + +client.on( 'load', my_load_handler ); + +client.off( 'load', my_load_handler ); + +client.on( 'load', function ( client, args ) { + alert( "movie has loaded" ); +}); + +client.on( 'mouseover', function ( client, args ) { + alert( "mouse is over movie" ); +}); + +client.on( 'mouseout', function ( client, args ) { + alert( "mouse has left movie" ); +} ); + +client.on( 'mousedown', function ( client, args ) { + alert( "mouse button is down" ); +} ); + +client.on( 'mouseup', function ( client, args ) { + alert( "mouse button is up" ); +} ); + +client.on( 'complete', function ( client, args ) { + alert("Copied text to clipboard: " + args.text ); +} ); + +client.on( 'noflash', function ( client, args ) { + alert("You don't support flash"); +} ); + +client.on( 'wrongflash', function ( client, args ) { + alert("Your flash is too old " + args.flashVersion); +} ); + +client.on( 'dataRequested', function ( client, args ) { + client.setText( 'Copied to clipboard.' ); +} ); + +var client = new ZeroClipboard( $('.clip_button') ); + +client.on( 'load', function(client) { + // alert( "movie is loaded" ); + + client.on( 'datarequested', function(client) { + client.setText(this.innerHTML); + } ); + + client.on( 'complete', function(client, args) { + alert("Copied text to clipboard: " + args.text ); + } ); +} ); + +client.on( 'wrongflash noflash', function() { + ZeroClipboard.destroy(); +}); + +ZeroClipboard.config({ debug: false }); diff --git a/zeroclipboard/zeroclipboard-1.x.x.d.ts b/zeroclipboard/zeroclipboard-1.x.x.d.ts new file mode 100644 index 000000000..4305c18bc --- /dev/null +++ b/zeroclipboard/zeroclipboard-1.x.x.d.ts @@ -0,0 +1,79 @@ +// Type definitions for ZeroClipboard v1.x.x +// Project: https://github.com/jonrohan/ZeroClipboard +// Definitions by: Eric J. Smith , Blake Niemyjski , György Balássy , Leon Yu +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare class ZeroClipboard { + constructor(elements?: Element | { [index: number]: Element }, options?: ZeroClipboardOptions); + + activate(element: Element): void; + setText(newText: string): void; + title(newTitle: string): void; + setSize(width: number, height: number): void; + version: string; + moviePath: string; + trustedDomains: any; + text: string; + hoverClass: string; + activeClass: string; + deactivate(): void; + ready: boolean; + reposition(): void; // returns false in some scenarios, but never returns true + on(eventName: string, func: (client: ZeroClipboard, args: any) => void): void; + off(eventName: string, func: (client: ZeroClipboard, args: any) => void): void; + clip(elements: Element | { [index: number]: Element }): void; + unclip(elements: Element | { [index: number]: Element }): void; + + + static config(options: ZeroClipboardOptions): void; + static destroy(): void; + static emit(eventName: string, args: any): void; +} + +interface ZeroClipboardOptions { + + /** Setting this to false would allow users to handle calling ZeroClipboard.activate(...); themselves instead of relying on our per-element mouseover handler */ + autoActivate?: boolean; + + /** Include a "nocache" query parameter on requests for the SWF. */ + cacheBust?: boolean; + + /** Debug enabled: send console messages with deprecation warnings, etc. */ + debug?: boolean; + + /** Forcibly set the hand cursor ("pointer") for all clipped elements. */ + forceHandCursor?: boolean; + + /** URL to the movie. NOTE: For versions >= v1.3.x and < v2.x, you must use swfPath by setting moviePath! */ + moviePath?: string; + + /** URL to the movie, relative to the page. NOTE: For versions >= v1.3.x and < v2.x, you must use swfPath by setting moviePath! */ + swfPath?: string; + + /** Forcibly set the hand cursor ("pointer") for all clipped elements. */ + trustedDomains?: any; + + /** Sets the title of the div encapsulating the Flash object. */ + title?: string; + + /** The z-index used by the Flash object. */ + zIndex?: number; + + /** DEPRECATED. The class used to indicate that a clipped element is active (is being clicked). */ + activeClass?: string; + + /** DEPRECATED. The class used to indicate that a clipped element is being hovered over. */ + hoverClass?: string; + + /** DEPRECATED. SWF outbound scripting policy. Possible values: "never", "sameDomain", "always". */ + allowScriptAccess?: string; + + /** DEPRECATED, use trustedDomains instead! SWF inbound scripting policy: page origins that the SWF should trust. (single string or array of strings. */ + trustedOrigins?: any; + + /** DEPRECATED, use cacheBust instead! Include a "nocache" query parameter on requests for the SWF. */ + useNoCache?: boolean; +} + +// Support AMD. +declare module "zeroclipboard" { export = ZeroClipboard; } diff --git a/zeroclipboard/zeroclipboard-tests.ts b/zeroclipboard/zeroclipboard-tests.ts new file mode 100644 index 000000000..26855210d --- /dev/null +++ b/zeroclipboard/zeroclipboard-tests.ts @@ -0,0 +1,542 @@ +/// +/// + +import ZeroClipboard = require("zeroclipboard"); +// import * as ZeroClipboard from "zeroclipboard"; + +namespace SimpleExample { + ZeroClipboard.config( { swfPath: "http://YOURSERVER/path/ZeroClipboard.swf" } ); + + let client = new ZeroClipboard(document.getElementById("copy-button")); + let client2 = new ZeroClipboard(jQuery('.copy-button')); + + client.on( "ready", function( readyEvent ) { + // alert( "ZeroClipboard SWF is ready!" ); + + client.on( "aftercopy", function( event ) { + this === client; + event.target === document.getElementById('el') + event.target.style.display = "none"; + alert("Copied text to clipboard: " + event.data["text/plain"] ); + }); + }); + + client.on( "copy", function (event) { + var clipboard = event.clipboardData; + clipboard.setData( "text/plain", "Copy me!" ); + clipboard.setData( "text/html", "Copy me!" ); + clipboard.setData( "application/rtf", "{\\rtf1\\ansi\n{\\b Copy me!}}" ); + }); + + ZeroClipboard.setData( "text/plain", "Copy me!" ); + + client.setText( "Copy me!" ); + + client.clip( document.getElementById("d_clip_button") ); + + var $client = new ZeroClipboard( $("button#my-button") ); + + function example() { + var client = new ZeroClipboard( $('.clip_button') ); + + client.on( 'ready', function(event) { + // console.log( 'movie is loaded' ); + + client.on( 'copy', function(event) { + event.clipboardData.setData('text/plain', event.target.innerHTML); + } ); + + client.on( 'aftercopy', function(event) { + console.log('Copied text to clipboard: ' + event.data['text/plain']); + } ); + } ); + + client.on( 'error', function(event) { + // console.log( 'ZeroClipboard error of type "' + event.name + '": ' + event.message ); + ZeroClipboard.destroy(); + } ); + } + + ZeroClipboard.config({ + fixLineEndings: false + }); + + ZeroClipboard.config({ + forceEnhancedClipboard: true + }); + +} + +namespace Static { + var version:String = ZeroClipboard.version; + + var config = ZeroClipboard.config(); + + var swfPath:String = ZeroClipboard.config("swfPath"); + + ZeroClipboard.config({}); + + ZeroClipboard.destroy(); + + ZeroClipboard.setData("text/plain", "Blah"); + + ZeroClipboard.setData({ + "text/plain": "Blah", + "text/html": "Blah" + }); + + ZeroClipboard.clearData("text/plain"); + + var text:String = ZeroClipboard.getData("text/plain"); + + var dataObj = ZeroClipboard.getData(); + + ZeroClipboard.focus(document.getElementById("d_clip_button")); + + ZeroClipboard.blur(); + + var el = document.getElementById("d_clip_button"); + ZeroClipboard.focus(el); + var activeEl = ZeroClipboard.activeElement(); + activeEl === el; + + ZeroClipboard.state(); + + let b:boolean = ZeroClipboard.isFlashUnusable(); + + var listenerFn = function(e: Object) { var ZeroClipboard = this; /* ... */ }; + ZeroClipboard.on("ready", listenerFn); + + var listenerObj = { + handleEvent: function(e: Object) { var listenerObj = this; /* ... */ } + }; + ZeroClipboard.on("error", listenerObj); + + ZeroClipboard.on("ready error", function(e) { /* ... */ }); + + ZeroClipboard.on({ + "ready": function(e) { /* ... */ }, + "error": function(e) { /* ... */ } + }); + + ZeroClipboard.off("ready", listenerFn); + ZeroClipboard.off("error", listenerObj); + + ZeroClipboard.off("ready error", listenerFn); + + ZeroClipboard.off({ + "ready": function(e) { /* ... */ }, + "error": function(e) { /* ... */ } + }); + + ZeroClipboard.off("ready"); + + ZeroClipboard.off(); + + ZeroClipboard.emit("ready"); + ZeroClipboard.emit({ + type: "error", + name: "flash-disabled" + }); + + var pendingCopyData = ZeroClipboard.emit("copy"); + + var listener = ZeroClipboard.handlers("ready"); + + var listeners = ZeroClipboard.handlers(); + + var currentlyActivatedElementOrNull = document.getElementById('currentlyActivatedElementOrNull'); + var dataClipboardElementTargetOfCurrentlyActivatedElementOrNull = document.getElementById('dataClipboardElementTargetOfCurrentlyActivatedElementOrNull') + var flashSwfObjectRef = document.getElementById('flashSwfObjectRef') as HTMLObjectElement; + + ZeroClipboard.on("ready", function(e) { + e = { + type: "ready", + message: "Flash communication is established", + target: currentlyActivatedElementOrNull, + relatedTarget: dataClipboardElementTargetOfCurrentlyActivatedElementOrNull, + currentTarget: flashSwfObjectRef, + version: "11.2.202", + timeStamp: Date.now() + }; + }); + + ZeroClipboard.on("beforecopy", function(e) { + e = { + type: "beforecopy", + target: currentlyActivatedElementOrNull, + relatedTarget: dataClipboardElementTargetOfCurrentlyActivatedElementOrNull, + currentTarget: flashSwfObjectRef, + timeStamp: Date.now() + }; + }); + + ZeroClipboard.on("copy", function(e) { + e.clipboardData.setData('text/html','
    '); + e.clipboardData.setData({'text/html':'
    '}); + e = { + type: "copy", + target: currentlyActivatedElementOrNull, + relatedTarget: dataClipboardElementTargetOfCurrentlyActivatedElementOrNull, + currentTarget: flashSwfObjectRef, + timeStamp: Date.now(), + clipboardData: { + setData: ZeroClipboard.setData, + clearData: ZeroClipboard.clearData + } + }; + }); + + + ZeroClipboard.on("aftercopy", function(e) { + e = { + type: "aftercopy", + target: currentlyActivatedElementOrNull, + relatedTarget: dataClipboardElementTargetOfCurrentlyActivatedElementOrNull, + currentTarget: flashSwfObjectRef, + timeStamp: Date.now(), + success: { + "text/plain": true, + "text/html": true, + "application/rtf": false + }, + data: { + "text/plain": "Blah", + "text/html": "Blah", + "application/rtf": "{\\rtf1\\ansi\n{\\b Blah}}" + }, + errors: [ + { + name: "SecurityError", + message: "Clipboard security error OMG", + errorID: 7320, + stack: null, + format: "application/rtf", + clipboard: "desktop" + } + ] + }; + }); + + ZeroClipboard.on("destroy", function(e) { + e = { + type: "destroy", + target: null, + relatedTarget: null, + currentTarget: flashSwfObjectRef, + timeStamp: Date.now(), + success: { + "text/plain": true, + "text/html": true, + "application/rtf": false + }, + data: { + "text/plain": "Blah", + "text/html": "Blah", + "application/rtf": "{\\rtf1\\ansi\n{\\b Blah}}" + } + }; + }); + + ZeroClipboard.on("error", function(e) { + e = { + type: "error", + name: "flash-disabled", + message: "Flash is disabled or not installed. May also be attempting to run Flash in a sandboxed iframe, which is impossible.", + target: null, + relatedTarget: null, + currentTarget: flashSwfObjectRef, + timeStamp: Date.now(), + minimumVersion: "11.0.0" + }; + }); + + ZeroClipboard.on("error", function(e) { + e = { + type: "error", + name: "flash-sandboxed", + message: "Attempting to run Flash in a sandboxed iframe, which is impossible", + target: null, + relatedTarget: null, + currentTarget: flashSwfObjectRef, + timeStamp: Date.now(), + minimumVersion: "11.0.0", + version: "11.2.202" + }; + }); + + ZeroClipboard.on("error", function(e) { + e = { + type: "error", + name: "flash-unavailable", + message: "Flash is unable to communicate bidirectionally with JavaScript", + target: null, + relatedTarget: null, + currentTarget: flashSwfObjectRef, + timeStamp: Date.now(), + minimumVersion: "11.0.0", + version: "11.2.202" + }; + }); + + ZeroClipboard.on("error", function(e) { + e = { + type: "error", + name: "flash-degraded", + message: "Flash is unable to preserve data fidelity when communicating with JavaScript", + target: null, + relatedTarget: null, + currentTarget: flashSwfObjectRef, + timeStamp: Date.now(), + minimumVersion: "11.0.0", + version: "11.2.202" + }; + }); + + ZeroClipboard.on("error", function(e) { + e = { + type: "error", + name: "flash-deactivated", + message: "Flash is too outdated for your browser and/or is configured as click-to-activate. This may also mean that the ZeroClipboard SWF object could not be loaded, so please check your `swfPath` configuration and/or network connectivity. May also be attempting to run Flash in a sandboxed iframe, which is impossible.", + target: null, + relatedTarget: null, + currentTarget: flashSwfObjectRef, + timeStamp: Date.now(), + minimumVersion: "11.0.0", + version: "11.2.202" + }; + }); + + ZeroClipboard.on("error", function(e) { + e = { + type: "error", + name: "flash-overdue", + message: "Flash communication was established but NOT within the acceptable time limit", + target: null, + relatedTarget: null, + currentTarget: flashSwfObjectRef, + timeStamp: Date.now(), + minimumVersion: "11.0.0", + version: "11.2.202" + }; + }); + + ZeroClipboard.on("error", function(e) { + e = { + type: "error", + name: "version-mismatch", + message: "ZeroClipboard JS version number does not match ZeroClipboard SWF version number", + target: null, + relatedTarget: null, + currentTarget: flashSwfObjectRef, + timeStamp: Date.now(), + jsVersion: "2.2.1", + swfVersion: "2.2.0" + }; + }); + + ZeroClipboard.on("error", function(e) { + e = { + type: "error", + name: "clipboard-error", + message: "At least one error was thrown while ZeroClipboard was attempting to inject your data into the clipboard", + target: currentlyActivatedElementOrNull, + relatedTarget: dataClipboardElementTargetOfCurrentlyActivatedElementOrNull, + currentTarget: flashSwfObjectRef, + timeStamp: Date.now(), + data: { + "text/plain": "Blah", + "text/html": "Blah", + "application/rtf": "{\\rtf1\\ansi\n{\\b Blah}}" + }, + errors: [ + { + name: "SecurityError", + message: "Clipboard security error OMG", + errorID: 7320, + stack: null, + format: "application/rtf", + clipboard: "desktop" + } + ] + }; + }); + + ZeroClipboard.on("error", function(e) { + e = { + type: "error", + name: "config-mismatch", + message: "ZeroClipboard configuration does not match Flash's reality", + target: null, + relatedTarget: null, + currentTarget: flashSwfObjectRef, + timeStamp: Date.now(), + property: "swfObjectId", + configuredValue: "my-zeroclipboard-object", + actualValue: "global-zeroclipboard-flash-bridge" + }; + }); + + ZeroClipboard.on("error", function(e) { + e = { + type: "error", + name: "swf-not-found", + message: "The ZeroClipboard SWF object could not be loaded, so please check your `swfPath` configuration and/or network connectivity", + target: null, + relatedTarget: null, + currentTarget: flashSwfObjectRef, + timeStamp: Date.now() + }; + }); +} + +namespace Instance { + var clippedEl = document.getElementById("d_clip_button"); + var client = new ZeroClipboard(clippedEl); + + client.setText("Blah"); + + client.setHtml("Blah"); + + client.setRichText("{\\rtf1\\ansi\n{\\b Blah}}"); + + client.setData("text/plain", "Blah"); + client.setData({ + "text/plain": "Blah", + "text/html": "Blah" + }); + + client.clearData("text/plain"); + client.clearData(); + + var text:String = client.getData("text/plain"); + var dataObj = client.getData(); + + client.clip(document.getElementById("d_clip_button")) + client.clip(document.querySelectorAll(".clip_button")); + client.clip(jQuery(".clip_button")); + + client.unclip(document.getElementById("d_clip_button")) + client.unclip(document.querySelectorAll(".clip_button")); + client.unclip(jQuery(".clip_button")); + client.unclip(); + + var els:HTMLElement[] = client.elements(); + + var listenerFn = function(e: Object) { var client = this; /* ... */ }; + client.on("ready", listenerFn); + + var listenerObj = { + handleEvent: function(e: Object) { var listenerObj = this; /* ... */ } + }; + client.on("error", listenerObj); + + client.on("ready error", function(e) { /* ... */ }); + + client.on({ + "ready": function(e) { /* ... */ }, + "error": function(e) { /* ... */ } + }); + + client.off("ready", listenerFn); + client.off("error", listenerObj); + + client.off("ready error", listenerFn); + + client.off({ + "ready": function(e) { /* ... */ }, + "error": function(e) { /* ... */ } + }); + + client.off("ready"); + + client.off(); + + client.emit("ready"); + client.emit({ + type: "error", + name: "flash-disabled" + }); + + var readyListeners = client.handlers("ready"); + + var listeners = client.handlers(); + + var client = new ZeroClipboard(); + client.on("ready", function(e) { + if (e.client === client && client === this) { + console.log("This client instance is ready!"); + } + }); +} + +namespace GlobalConfig { + var _globalConfig = { + + // SWF URL, relative to the page. Default value will be "ZeroClipboard.swf" + // under the same path as the ZeroClipboard JS file. + swfPath: '_swfPath', + + // SWF inbound scripting policy: page domains that the SWF should trust. + // (single string, or array of strings) + trustedDomains: window.location.host ? [window.location.host] : [], + + // Include a "noCache" query parameter on requests for the SWF. + cacheBust: true, + + // Enable use of the fancy "Desktop" clipboard, even on Linux where it is + // known to suck. + forceEnhancedClipboard: false, + + // How many milliseconds to wait for the Flash SWF to load and respond before assuming that + // Flash is deactivated (e.g. click-to-play) in the user's browser. If you don't care about + // how long it takes to load the SWF, you can set this to `null`. + flashLoadTimeout: 30000, + + // Setting this to `false` would allow users to handle calling `ZeroClipboard.focus(...);` + // themselves instead of relying on our per-element `mouseover` handler. + autoActivate: true, + + // Bubble synthetic events in JavaScript after they are received by the Flash object. + bubbleEvents: true, + + // Ensure OS-compliant line endings, i.e. "\r\n" on Windows, "\n" elsewhere + fixLineEndings: true, + + // Sets the ID of the `div` encapsulating the Flash object. + // Value is validated against the [HTML4 spec for `ID` tokens][valid_ids]. + containerId: "global-zeroclipboard-html-bridge", + + // Sets the class of the `div` encapsulating the Flash object. + containerClass: "global-zeroclipboard-container", + + // Sets the ID and name of the Flash `object` element. + // Value is validated against the [HTML4 spec for `ID` and `Name` tokens][valid_ids]. + swfObjectId: "global-zeroclipboard-flash-bridge", + + // The class used to indicate that a clipped element is being hovered over. + hoverClass: "zeroclipboard-is-hover", + + // The class used to indicate that a clipped element is active (is being clicked). + activeClass: "zeroclipboard-is-active", + + + + // Forcibly set the hand cursor ("pointer") for all clipped elements. + // IMPORTANT: This configuration value CAN be modified while a SWF is actively embedded. + forceHandCursor: false, + + // Sets the title of the `div` encapsulating the Flash object. + // IMPORTANT: This configuration value CAN be modified while a SWF is actively embedded. + title: 'title', + + // The z-index used by the Flash object. + // Max value (32-bit): 2147483647. + // IMPORTANT: This configuration value CAN be modified while a SWF is actively embedded. + zIndex: 999999999 + + }; + + ZeroClipboard.config(_globalConfig); + +} diff --git a/zeroclipboard/zeroclipboard.d.ts b/zeroclipboard/zeroclipboard.d.ts index 6db1ba180..2a192a71e 100644 --- a/zeroclipboard/zeroclipboard.d.ts +++ b/zeroclipboard/zeroclipboard.d.ts @@ -1,75 +1,505 @@ -// Type definitions for ZeroClipboard -// Project: https://github.com/jonrohan/ZeroClipboard -// Definitions by: Eric J. Smith , Blake Niemyjski , György Balássy -// Definitions: https://github.com/borisyankov/DefinitelyTyped +// Type definitions for ZeroClipboard v2.x.x +// Project: https://github.com/zeroclipboard/zeroclipboard +// Definitions by: Eric J. Smith , Blake Niemyjski , György Balássy , Leon Yu +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare class ZeroClipboard { - constructor(elements?: any, options?: ZeroClipboardOptions); - activate(element: any): void; - setText(newText: string): void; - title(newTitle: string): void; - setSize(width: number, height: number): void; +declare namespace ZC { + // Basic collection types for shorthands and interoperation + interface List { [index: number]: T; length: number; } + interface Dictionary { [key: string]: T; } + + // Generic version EventHandler containers. + // Mimicking native interfaces in lib.dom.d.ts of the same name. + interface EventListener { (ev: T): void; } + interface EventListenerObject { handleEvent(ev: T): void; } + type EventListenerOrEventListenerObject = EventListener | EventListenerObject; + + export interface ZeroClipboardStatic extends ZeroClipboardCommon { + new(elements?: Element | List): ZeroClipboardClient; + + /** + * The version of the ZeroClipboard library being used, e.g. "2.0.0". + * @type {string} + */ version: string; - moviePath: string; - trustedDomains: any; - text: string; - hoverClass: string; - activeClass: string; + /** + * Get a copy of the active configuration for ZeroClipboard. + * @return {ZeroClipboardConfig} + */ + config(): ZeroClipboardConfig; + /** + * Get a copy of the actively configured value for this configuration property for ZeroClipboard. + * @param {string} propName + * @return {any} + */ + config(propName: string): any; + config(propName: "swfPath"): string; + config(propName: "trustedDomains"): string[]; + config(propName: "cacheBust"): boolean; + config(propName: "forceEnhancedClipboard"): boolean; + config(propName: "flashLoadTimeout"): number; + config(propName: "autoActivate"): boolean; + config(propName: "bubbleEvents"): boolean; + config(propName: "fixLineEndings"): boolean; + config(propName: "containerId"): string; + config(propName: "containerClass"): string; + config(propName: "swfObjectId"): string; + config(propName: "hoverClass"): string; + config(propName: "activeClass"): string; + config(propName: "forceHandCursor"): boolean; + config(propName: "title"): string; + config(propName: "zIndex"): number; + /** + * Set the active configuration for ZeroClipboard. Returns a copy of the updated active configuration. + * @param {ZeroClipboardConfig} config + * @return {ZeroClipboardConfig} + */ + config(config: ZeroClipboardConfig): ZeroClipboardConfig; + /** + * Create the Flash bridge SWF object. + * IMPORTANT: This method should be considered private. + * @private + */ + create(): void; + /** + * Emit the "destroy" event, remove all event handlers, and destroy the Flash bridge. + */ + destroy(): void; + /** + * Focus/"activate" the provided element by moving the Flash SWF object in front of it. + * @param {Element} element + * @since 2.1.0 + */ + focus(element: Element): void; + /** + * Focus/"activate" the provided element by moving the Flash SWF object in front of it. + * @param {Element} element + * @deprecated: The preferred method to use is focus but the alias activate is available for backward compatibility's sake. + */ + activate(element: Element): void; + /** + * Blur/"deactivate" the currently focused/"activated" element, moving the Flash SWF object off the screen. + * @since 2.1.0 + */ + blur(): void; + /** + * Blur/"deactivate" the currently focused/"activated" element, moving the Flash SWF object off the screen. + * @deprecated: The preferred method to use is blur but the alias deactivate is available for backward compatibility's sake. + */ deactivate(): void; - ready: boolean; - reposition(): void; // returns false in some scenarios, but never returns true - on(eventName: string, func: Function): void; - off(eventName: string, func: Function): void; - clip(elements: any): void; - unclip(elements: any): void; - static config(options: ZeroClipboardOptions): void; - static destroy(): void; - static emit(eventName: string, args: any): void; -} + /** + * Return the currently "activated" element that the Flash SWF object is in front of it. + * @return {HTMLElement} or {null} + */ + activeElement(): HTMLElement; + /** + * Diagnostic method that describes the state of the browser, Flash Player, and ZeroClipboard. + * @return {Object} + */ + state(): Object; + /** + * Indicates if Flash Player is definitely unusable (disabled, outdated, unavailable, or deactivated). + * IMPORTANT: This method should be considered private. + * @return {boolean} + * @private + */ + isFlashUnusable(): boolean; + } -interface ZeroClipboardOptions { - /** Setting this to false would allow users to handle calling ZeroClipboard.activate(...); themselves instead of relying on our per-element mouseover handler */ - autoActivate?: boolean; + interface ZeroClipboardClient extends ZeroClipboardCommon { + /** + * A unique identifier for this ZeroClipboard client instance. + * @type {string} + */ + id: string; + /** + * Remove all event handlers and unclip all clipped elements. + */ + destroy(): void; + /** + * Set the pending data of type "text/plain" for clipboard injection. + * @param {string} data + */ + setText(data: string): void; + /** + * Set the pending data of type "text/html" for clipboard injection. + * @param {string} data + */ + setHtml(data: string): void; + /** + * Set the pending data of type "application/rtf" for clipboard injection. + * @param {string} data + */ + setRichText(data: string): void; + /** + * Register clipboard actions for new element(s) to the client. This includes automatically invoking + * ZeroClipboard.focus on the current element when it is hovered over, unless the autoActivate configuration + * property is set to false. + * @param {Element[]} elements + * @return {ZeroClipboardClient} + */ + clip(elements: List): ZeroClipboardClient; + /** + * Register clipboard actions for new element(s) to the client. This includes automatically invoking + * ZeroClipboard.focus on the current element when it is hovered over, unless the autoActivate configuration + * property is set to false. + * @param {Element} element + * @return {ZeroClipboardClient} + */ + clip(element: Element): ZeroClipboardClient; + /** + * Unregister the clipboard actions of previously registered element(s) on the page. If no elements are provided, + * ALL clipped/registered elements will be unregistered. + * @param {Element[]} elements + * @return {ZeroClipboardClient} + */ + unclip(elements: List): ZeroClipboardClient; + /** + * Unregister the clipboard actions of previously registered element(s) on the page. If no elements are provided, + * ALL clipped/registered elements will be unregistered. + * @param {Element} element + * @return {ZeroClipboardClient} + */ + unclip(elements?: Element): ZeroClipboardClient; + /** + * Get all of the elements to which this client is clipped/registered. + * @return {HTMLElement[]} + */ + elements(): HTMLElement[]; + } - /** Include a "nocache" query parameter on requests for the SWF. */ - cacheBust?: boolean; + interface ZeroClipboardEvent { + client?: ZeroClipboardClient; + type: string; + target: HTMLElement; + relatedTarget: HTMLElement; + currentTarget: HTMLObjectElement; + timeStamp: number; + } - /** Debug enabled: send console messages with deprecation warnings, etc. */ - debug?: boolean; + interface ZeroClipboardReadyEvent extends ZeroClipboardEvent { + message: string; + version: string; + } - /** Forcibly set the hand cursor ("pointer") for all clipped elements. */ - forceHandCursor?: boolean; + interface ZeroClipboardBeforeCopyEvent extends ZeroClipboardEvent { - /** URL to the movie. NOTE: For versions >= v1.3.x and < v2.x, you must use swfPath by setting moviePath! */ - moviePath?: string; + } - /** URL to the movie, relative to the page. NOTE: For versions >= v1.3.x and < v2.x, you must use swfPath by setting moviePath! */ + interface ZeroClipboardCopyEvent extends ZeroClipboardEvent { + clipboardData: { + setData(format: string, data: string): void; + setData(data: Dictionary): void; + clearData(mimeType?: string): void; + }; + } + + interface ZeroClipboardAfterCopyEvent extends ZeroClipboardEvent { + success: Dictionary; + data: Dictionary; + errors: any[]; + } + + interface ZeroClipboardDestroyEvent extends ZeroClipboardEvent { + success: Dictionary; + data: Dictionary; + } + + interface ZeroClipboardErrorEvent extends ZeroClipboardEvent { + name: string; + message: string; + minimumVersion?: string; + version?: string; + jsVersion?: string; + swfVersion?: string; + property?: string; + configuredValue?: string; + actualValue?: string; + data?: Dictionary; + errors?: any[]; + } + + interface ZeroClipboardCommon { + /** + * Set the pending data of type format for clipboard injection. + * @param {string} format + * @param {string} data + */ + setData(format: string, data: string): void; + /** + * Set the pending data of various formats for clipboard injection. This particular function signature (passing in + * an Object) will implicitly clear out any existing pending data. + * @param {Dictionary} data + */ + setData(data: Dictionary): void; + /** + * Clear the pending data of type format for clipboard injection. + * @param {string} mimeType + */ + clearData(mimeType: string): void; + /** + * Clear the pending data of ALL formats for clipboard injection. + */ + clearData(): void; + /** + * Get the pending data of type format for clipboard injection. + * @param {string} format + * @return {string} + * @since 2.1.0 + */ + getData(format: string): string; + /** + * Get a copy of the pending data of ALL formats for clipboard injection. + * @return {Dictionary} + * @since 2.1.0 + */ + getData(): Dictionary; + /** + * Add a listener function/object for an eventType. If called as a client method will be within the client instance. + * @param {string} eventType + * @param {EventListener} listener + */ + on(eventType: string, listener: EventListenerOrEventListenerObject): void; + /** + * The ready event is fired when the Flash SWF completes loading and is ready for action. Please note that you need + * to set most configuration options [with ZeroClipboard.config(...)] before ZeroClipboard.create() is invoked. + * @param {"ready"} eventType + * @param {EventListener} listener + */ + on(eventType: "ready", listener: EventListenerOrEventListenerObject): void; + /** + * On click, the Flash object will fire off a beforecopy event. This event is generally only used for "UI + * preparation" if you want to alter anything before the copy event fires. + * IMPORTANT: Handlers of this event are expected to operate synchronously if they intend to be finished before + * the "copy" event is triggered. + * @param {"beforecopy"} eventType + * @param {EventListener} listener + */ + on(eventType: "beforecopy", listener: EventListenerOrEventListenerObject): void; + /** + * On click (and after the beforecopy event), the Flash object will fire off a copy event. If the HTML object has + * data-clipboard-text or data-clipboard-target, then ZeroClipboard will take care of getting an initial set of + * data. It will then invoke any copy event handlers, in which you can call event.clipboardData.setData to set the + * text, which will complete the loop. + * IMPORTANT: If a handler of this event intends to modify the pending data for clipboard injection, it MUST + * operate synchronously in order to maintain the temporarily elevated permissions granted by the user's click + * event. The most common "gotcha" for this restriction is if someone wants to make an asynchronous XMLHttpRequest + * in response to the copy event to get the data to inject - this won't work; make it a synchronous XMLHttpRequest + * instead, or do the work in advance before the copy event is fired. + * @param {"copy"} eventType + * @param {EventListener} listener + */ + on(eventType: "copy", listener: EventListenerOrEventListenerObject): void; + /** + * The aftercopy event is fired when the text is copied [or failed to copy] to the clipboard. + * @param {"aftercopy"} eventType + * @param {EventListener} listener + */ + on(eventType: "aftercopy", listener: EventListenerOrEventListenerObject): void; + /** + * The destroy event is fired when ZeroClipboard.destroy() is invoked. + * IMPORTANT: Handlers of this event are expected to operate synchronously if they intend to be finished before the + * destruction is complete. + * @param {"destroy"} eventType + * @param {EventListener} listener + */ + on(eventType: "destroy", listener: EventListenerOrEventListenerObject): void; + /** + * The error event is fired under a number of conditions, which will be detailed as sub-sections. Some consumers + * may not consider all error types to be critical, and thus ZeroClipboard does not take it upon itself to implode + * by calling ZeroClipboard.destroy() under error conditions. However, many consumers may want to do just that. + * @param {"error"} eventType + * @param {EventListener} listener + */ + on(eventType: "error", listener: EventListenerOrEventListenerObject): void; + /** + * Add a set of eventType to listener function/object mappings. + * @param {EventListener} listenerObj + */ + on(listenerObj: { + ready?: EventListenerOrEventListenerObject; + beforecopy?: EventListenerOrEventListenerObject; + copy?: EventListenerOrEventListenerObject; + aftercopy?: EventListenerOrEventListenerObject; + destroy?: EventListenerOrEventListenerObject; + error?: EventListenerOrEventListenerObject; + }): void; + /** + * Remove a listener function/object for an eventType. + * @param {string} eventType + * @param {EventListener} listener + */ + off(eventType: string, listener: EventListenerOrEventListenerObject): void; + off(eventType: "ready", listener: EventListenerOrEventListenerObject): void; + off(eventType: "beforecopy", listener: EventListenerOrEventListenerObject): void; + off(eventType: "copy", listener: EventListenerOrEventListenerObject): void; + off(eventType: "aftercopy", listener: EventListenerOrEventListenerObject): void; + off(eventType: "destroy", listener: EventListenerOrEventListenerObject): void; + off(eventType: "error", listener: EventListenerOrEventListenerObject): void; + /** + * Remove a set of eventType to listener function/object mappings. + * @param {EventListener} listenerObj + */ + off(listenerObj: { + ready?: EventListenerOrEventListenerObject; + beforecopy?: EventListenerOrEventListenerObject; + copy?: EventListenerOrEventListenerObject; + aftercopy?: EventListenerOrEventListenerObject; + destroy?: EventListenerOrEventListenerObject; + error?: EventListenerOrEventListenerObject; + }): void; + /** + * Remove ALL listener functions/objects for ALL registered event types. + */ + off(): void; + /** + * Dispatch an event to all registered listeners. The emission of some types of events will result in side effects. + * @param {string} eventType + * @return {any} + */ + emit(eventType: string): any; + emit(eventType: "ready"): void; + emit(eventType: "beforecopy"): void; + emit(eventType: "copy"): any; + emit(eventType: "aftercopy"): void; + emit(eventType: "destroy"): void; + emit(eventType: "error"): void; + /** + * Dispatch an event to all registered listeners. The emission of some types of events will result in side effects. + * @param {string} data + * @param {string} name + * @return {any} + */ + emit(data: {type: string, name: string}): any; + /** + * Retrieves a copy of the registered listener functions/objects for the given eventType. + * @param {string} eventType + * @return {EventListener} + */ + handlers(eventType: string): EventListenerOrEventListenerObject[]; + handlers(eventType: "ready"): EventListenerOrEventListenerObject[]; + handlers(eventType: "beforecopy"): EventListenerOrEventListenerObject[]; + handlers(eventType: "copy"): EventListenerOrEventListenerObject[]; + handlers(eventType: "aftercopy"): EventListenerOrEventListenerObject[]; + handlers(eventType: "destroy"): EventListenerOrEventListenerObject[]; + handlers(eventType: "error"): EventListenerOrEventListenerObject[]; + /** + * Retrieves a copy of the map of registered listener functions/objects for ALL event types. + * @return {Object} + */ + handlers(): { + ready?: EventListenerOrEventListenerObject[]; + beforecopy?: EventListenerOrEventListenerObject[]; + copy?: EventListenerOrEventListenerObject[]; + aftercopy?: EventListenerOrEventListenerObject[]; + destroy?: EventListenerOrEventListenerObject[]; + error?: EventListenerOrEventListenerObject[]; + }; + } + + interface ZeroClipboardConfig { + /** + * SWF URL, relative to the page. Default value will be "ZeroClipboard.swf" under the same path as the ZeroClipboard JS file. + * @type {string} + */ swfPath?: string; - - /** Forcibly set the hand cursor ("pointer") for all clipped elements. */ - trustedDomains?: any; - - /** Sets the title of the div encapsulating the Flash object. */ - title?: string; - - /** The z-index used by the Flash object. */ - zIndex?: number; - - /** DEPRECATED. The class used to indicate that a clipped element is active (is being clicked). */ - activeClass?: string; - - /** DEPRECATED. The class used to indicate that a clipped element is being hovered over. */ + /** + * SWF inbound scripting policy: page domains that the SWF should trust. (single string, or array of strings) + * @type {SingleOrList} + */ + trustedDomains?: string[]; + /** + * Include a "noCache" query parameter on requests for the SWF. + * @type {boolean} + */ + cacheBust?: boolean; + /** + * Enable use of the fancy "Desktop" clipboard, even on Linux where it is known to suck. + * @type {boolean} + */ + forceEnhancedClipboard?: boolean; + /** + * How many milliseconds to wait for the Flash SWF to load and respond before assuming that + * Flash is deactivated (e.g. click-to-play) in the user's browser. If you don't care about + * how long it takes to load the SWF, you can set this to `null`. + * @type {number} + */ + flashLoadTimeout?: number; + /** + * Setting this to `false` would allow users to handle calling `ZeroClipboard.focus(...);` + * themselves instead of relying on our per-element `mouseover` handler. + * @type {boolean} + */ + autoActivate?: boolean; + /** + * Bubble synthetic events in JavaScript after they are received by the Flash object. + * @type {boolean} + */ + bubbleEvents?: boolean; + /** + * Ensure OS-compliant line endings, i.e. "\r\n" on Windows, "\n" elsewhere + * @type {boolean} + */ + fixLineEndings?: boolean; + /** + * Sets the ID of the `div` encapsulating the Flash object. + * Value is validated against the [HTML4 spec for `ID` tokens][valid_ids]. + * @type {string} + */ + containerId?: string; + /** + * Sets the class of the `div` encapsulating the Flash object. + * @type {string} + */ + containerClass?: string; + /** + * Sets the ID and name of the Flash `object` element. + * Value is validated against the [HTML4 spec for `ID` and `Name` tokens][valid_ids]. + * @type {string} + */ + swfObjectId?: string; + /** + * The class used to indicate that a clipped element is being hovered over. + * @type {string} + */ hoverClass?: string; - - /** DEPRECATED. SWF outbound scripting policy. Possible values: "never", "sameDomain", "always". */ - allowScriptAccess?: string; - - /** DEPRECATED, use trustedDomains instead! SWF inbound scripting policy: page origins that the SWF should trust. (single string or array of strings. */ - trustedOrigins?: any; - - /** DEPRECATED, use cacheBust instead! Include a "nocache" query parameter on requests for the SWF. */ - useNoCache?: boolean; + /** + * The class used to indicate that a clipped element is active (is being clicked). + * @type {string} + */ + activeClass?: string; + /** + * Forcibly set the hand cursor ("pointer") for all clipped elements. + * IMPORTANT: This configuration value CAN be modified while a SWF is actively embedded. + * @type {boolean} + */ + forceHandCursor?: boolean; + /** + * Sets the title of the `div` encapsulating the Flash object. + * IMPORTANT: This configuration value CAN be modified while a SWF is actively embedded. + * @type {string} + */ + title?: string; + /** + * The z-index used by the Flash object. + * Max value (32-bit): 2147483647. + * IMPORTANT: This configuration value CAN be modified while a SWF is actively embedded. + * @type {number} + */ + zIndex?: number; + } } -// Support AMD. -declare module "zeroclipboard" { export = ZeroClipboard; } +/** + * [ZeroClipboard description] + * @type {ZC.ZeroClipboardStatic} + */ +declare var ZeroClipboard: ZC.ZeroClipboardStatic; + +/** + * AMD and CommonJS module `zeroclipboard` + * @module + */ +declare module "zeroclipboard" { + export = ZeroClipboard; +} From 025706049a03269ff69b82b77321d1b7e0d24804 Mon Sep 17 00:00:00 2001 From: Lars Michaelis Date: Wed, 2 Dec 2015 11:19:26 +0100 Subject: [PATCH 257/389] Initial commit --- jsf/jsf-tests.ts | 3 ++ jsf/jsf.d.ts | 72 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 jsf/jsf-tests.ts create mode 100644 jsf/jsf.d.ts diff --git a/jsf/jsf-tests.ts b/jsf/jsf-tests.ts new file mode 100644 index 000000000..c944bc72d --- /dev/null +++ b/jsf/jsf-tests.ts @@ -0,0 +1,3 @@ +/// + +import jsf = require("jsf"); diff --git a/jsf/jsf.d.ts b/jsf/jsf.d.ts new file mode 100644 index 000000000..14f7b407d --- /dev/null +++ b/jsf/jsf.d.ts @@ -0,0 +1,72 @@ +// Type definitions for for the JSF 2.0 Ajax request API. +// Project: https://docs.oracle.com/cd/E17802_01/j2ee/javaee/javaserverfaces/2.0/docs/js-api/symbols/jsf.ajax.html +// Definitions by: Lars Michaelis and Stephan Zerhusen +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module "jsf" { + module ajax { + + interface RequestData { + status: string; + description: string; + } + + interface RequestOptions { + /** + * space seperated list of client identifiers + */ + execute?: String; + + /** + * space seperated list of client identifiers + */ + render?: String; + + /** + * function to callback for event + * @param callback the callback function + */ + onevent?(callback:(data:RequestData) => void): void; + + /** + * function to callback for error + * @param callback the callback function + */ + onerror?(callback:(data:RequestData) => void): void; + + /** + * object containing parameters to include in the request + */ + params?: any; + } + + /** + * Register a callback for event handling. + * @param callback a reference to a function to call on an event + */ + function addOnEvent(callback:(data:RequestData) => void):void; + + /** + * Register a callback for error handling. + * @param callback a reference to a function to call on an error + */ + function addOnError(callback:(data:RequestData) => void):void; + + /** + * Send an asynchronous Ajax request to the server. + * @param source The DOM element that triggered this Ajax request, or an id string of the element to use as the triggering element. + * @param event The DOM event that triggered this Ajax request. The event argument is optional. + * @param options The set of available options that can be sent as request parameters to control client and/or server side request processing. + */ + function request(source:any, event?:String, options?:RequestOptions):void; + + /** + * Receive an Ajax response from the server. + * @param request The XMLHttpRequest instance that contains the status code and response message from the server. + * @param context An object containing the request context, including the following properties: the source element, per call onerror callback function, and per call onevent callback function. + * @throws EmptyResponse error if request contains no data + */ + function response(request:any, context:any):void; + + } +} From 56b3481c312ea9318b10b7f26df2b269c247c92d Mon Sep 17 00:00:00 2001 From: Lars Michaelis Date: Wed, 2 Dec 2015 11:30:10 +0100 Subject: [PATCH 258/389] make it compile with npm test --- jsf/jsf-tests.ts | 1 - jsf/jsf.d.ts | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/jsf/jsf-tests.ts b/jsf/jsf-tests.ts index c944bc72d..b56749a4a 100644 --- a/jsf/jsf-tests.ts +++ b/jsf/jsf-tests.ts @@ -1,3 +1,2 @@ /// -import jsf = require("jsf"); diff --git a/jsf/jsf.d.ts b/jsf/jsf.d.ts index 14f7b407d..9c7f6a43d 100644 --- a/jsf/jsf.d.ts +++ b/jsf/jsf.d.ts @@ -1,6 +1,6 @@ -// Type definitions for for the JSF 2.0 Ajax request API. +// Type definitions for for the JSF 2.0 Ajax request API // Project: https://docs.oracle.com/cd/E17802_01/j2ee/javaee/javaserverfaces/2.0/docs/js-api/symbols/jsf.ajax.html -// Definitions by: Lars Michaelis and Stephan Zerhusen +// Definitions by: Lars Michaelis and Stephan Zerhusen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module "jsf" { From 2c123744f00cb74676333a45e1ef4f0750b3b39f Mon Sep 17 00:00:00 2001 From: Lars Michaelis Date: Wed, 2 Dec 2015 11:46:17 +0100 Subject: [PATCH 259/389] add tests --- jsf/jsf-tests.ts | 25 +++++++++++++++++++++++++ jsf/jsf.d.ts | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/jsf/jsf-tests.ts b/jsf/jsf-tests.ts index b56749a4a..3c594f1e5 100644 --- a/jsf/jsf-tests.ts +++ b/jsf/jsf-tests.ts @@ -1,2 +1,27 @@ /// +function callbackWithoutData() { + +} + +function callback(data: jsf.ajax.RequestData) { + +} + +class RequestOptionsImpl implements jsf.ajax.RequestOptions { + execute = "@all"; + render = "@none"; +} + + +jsf.ajax.addOnEvent(callbackWithoutData); +jsf.ajax.addOnEvent(callback); + +jsf.ajax.addOnError(callbackWithoutData); +jsf.ajax.addOnError(callback); + +jsf.ajax.request("someSource"); +jsf.ajax.request("someSource", "change"); +jsf.ajax.request("someSource", "change", new RequestOptionsImpl()); + +jsf.ajax.response("someRequestObject", "someContextObject"); diff --git a/jsf/jsf.d.ts b/jsf/jsf.d.ts index 9c7f6a43d..d19dafe0e 100644 --- a/jsf/jsf.d.ts +++ b/jsf/jsf.d.ts @@ -3,7 +3,7 @@ // Definitions by: Lars Michaelis and Stephan Zerhusen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare module "jsf" { +declare module jsf { module ajax { interface RequestData { From 722e48a621b68c5acae43f51373bd799731dfb74 Mon Sep 17 00:00:00 2001 From: Lars Michaelis Date: Wed, 2 Dec 2015 11:49:37 +0100 Subject: [PATCH 260/389] add tests --- jsf/jsf-tests.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jsf/jsf-tests.ts b/jsf/jsf-tests.ts index 3c594f1e5..76815bf9e 100644 --- a/jsf/jsf-tests.ts +++ b/jsf/jsf-tests.ts @@ -4,13 +4,13 @@ function callbackWithoutData() { } -function callback(data: jsf.ajax.RequestData) { +function callback(data:jsf.ajax.RequestData) { } class RequestOptionsImpl implements jsf.ajax.RequestOptions { execute = "@all"; - render = "@none"; + render = "@none"; } @@ -24,4 +24,4 @@ jsf.ajax.request("someSource"); jsf.ajax.request("someSource", "change"); jsf.ajax.request("someSource", "change", new RequestOptionsImpl()); -jsf.ajax.response("someRequestObject", "someContextObject"); +jsf.ajax.response("someRequestObject", {context: "someContextObject"}); From a5a3eac40c1c4228acda1a08623e0921fab9b2d4 Mon Sep 17 00:00:00 2001 From: fbouquet Date: Wed, 2 Dec 2015 12:39:04 +0100 Subject: [PATCH 261/389] Adds definitions for missing attributes in PDFJSStatic. --- pdf/pdf.d.ts | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) diff --git a/pdf/pdf.d.ts b/pdf/pdf.d.ts index 523cfc5e8..8cac3a81c 100644 --- a/pdf/pdf.d.ts +++ b/pdf/pdf.d.ts @@ -306,11 +306,123 @@ interface PDFJSStatic { **/ maxImageSize: number; + /** + * The url of where the predefined Adobe CMaps are located. Include trailing + * slash. + */ + cMapUrl: string; + + /** + * Specifies if CMaps are binary packed. + */ + cMapPacked: boolean; + /** * By default fonts are converted to OpenType fonts and loaded via font face rules. If disabled, the font will be rendered using a built in font renderer that constructs the glyphs with primitive path commands. **/ disableFontFace: boolean; + /** + * Path for image resources, mainly for annotation icons. Include trailing + * slash. + */ + imageResourcesPath: string; + + /** + * Disable the web worker and run all code on the main thread. This will happen + * automatically if the browser doesn't support workers or sending typed arrays + * to workers. + */ + disableWorker: boolean; + + /** + * Path and filename of the worker file. Required when the worker is enabled in + * development mode. If unspecified in the production build, the worker will be + * loaded based on the location of the pdf.js file. + */ + workerSrc: string; + + /** + * Disable range request loading of PDF files. When enabled and if the server + * supports partial content requests then the PDF will be fetched in chunks. + * Enabled (false) by default. + */ + disableRange: boolean; + + /** + * Disable streaming of PDF file data. By default PDF.js attempts to load PDF + * in chunks. This default behavior can be disabled. + */ + disableStream: boolean; + + /** + * Disable pre-fetching of PDF file data. When range requests are enabled PDF.js + * will automatically keep fetching more data even if it isn't needed to display + * the current page. This default behavior can be disabled. + * + * NOTE: It is also necessary to disable streaming, see above, + * in order for disabling of pre-fetching to work correctly. + */ + disableAutoFetch: boolean; + + /** + * Enables special hooks for debugging PDF.js. + */ + pdfBug: boolean; + + /** + * Enables transfer usage in postMessage for ArrayBuffers. + */ + postMessageTransfers: boolean; + + /** + * Disables URL.createObjectURL usage. + */ + disableCreateObjectURL: boolean; + + /** + * Disables WebGL usage. + */ + disableWebGL: boolean; + + /** + * Disables fullscreen support, and by extension Presentation Mode, + * in browsers which support the fullscreen API. + */ + disableFullscreen: boolean; + + /** + * Enables CSS only zooming. + */ + useOnlyCssZoom: boolean; + + /** + * Controls the logging level. + * The constants from PDFJS.VERBOSITY_LEVELS should be used: + * - errors + * - warnings [default] + * - infos + */ + verbosity: number; + + /** + * The maximum supported canvas size in total pixels e.g. width * height. + * The default value is 4096 * 4096. Use -1 for no limit. + */ + maxCanvasPixels: number; + + /** + * Opens external links in a new window if enabled. The default behavior opens + * external links in the PDF.js window. + */ + openExternalLinksInNewWindow: boolean; + + /** + * Determines if we can eval strings as JS. Primarily used to improve + * performance for font rendering. + */ + isEvalSupported: boolean; + /** * This is the main entry point for loading a PDF and interacting with it. * NOTE: If a URL is used to fetch the PDF data a standard XMLHttpRequest(XHR) From f90557a3c9dc454eb3d30d7e6785899e9dcc6c22 Mon Sep 17 00:00:00 2001 From: Jan Aagaard Date: Wed, 2 Dec 2015 13:15:40 +0100 Subject: [PATCH 262/389] Fixed typing for find, findWhere, pluck and sum. --- lazy.js/lazy.js-tests.ts | 12 ++++++------ lazy.js/lazy.js.d.ts | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lazy.js/lazy.js-tests.ts b/lazy.js/lazy.js-tests.ts index 5e45ccf13..57d1ef37e 100644 --- a/lazy.js/lazy.js-tests.ts +++ b/lazy.js/lazy.js-tests.ts @@ -28,6 +28,7 @@ var anyObjectSeq: LazyJS.ObjectLikeSequence; var fooAsyncSeq: LazyJS.AsyncSequence; var strSequence: LazyJS.Sequence; +var anySequence: LazyJS.Sequence; var stringSeq: LazyJS.StringLikeSequence; var obj: Object; @@ -44,7 +45,6 @@ function fnCallback(): void { } function fnErrorCallback(error: any): void { - } function fnValueCallback(value: Foo): void { @@ -108,8 +108,8 @@ fooSequence = fooSequence.dropWhile(fnTestCallback); fooSequence = fooSequence.each(fnValueCallback); bool = fooSequence.every(fnTestCallback); fooSequence = fooSequence.filter(fnTestCallback); -fooSequence = fooSequence.find(fnTestCallback); -fooSequence = fooSequence.findWhere(obj); +foo = fooSequence.find(fnTestCallback); +foo = fooSequence.findWhere(obj); x = fooSequence.first(); fooSequence = fooSequence.first(num); @@ -134,7 +134,7 @@ foo = fooSequence.max(); foo = fooSequence.max(fnNumberCallback); foo = fooSequence.min(); foo = fooSequence.min(fnNumberCallback); -fooSequence = fooSequence.pluck(str); +anySequence = fooSequence.pluck(str); bar = fooSequence.reduce(fnMemoCallback); bar = fooSequence.reduce(fnMemoCallback, bar); bar = fooSequence.reduceRight(fnMemoCallback, bar); @@ -152,8 +152,8 @@ fooSequence = fooSequence.sortBy(str, bool); fooSequence = fooSequence.sortBy(fnNumberCallback); fooSequence = fooSequence.sortBy(fnNumberCallback, bool); fooSequence = fooSequence.sortedIndex(foo); -fooSequence = fooSequence.sum(); -fooSequence = fooSequence.sum(fnNumberCallback); +foo = fooSequence.sum(); +foo = fooSequence.sum(fnNumberCallback); fooSequence = fooSequence.takeWhile(fnTestCallback); fooSequence = fooSequence.union(fooArr); fooSequence = fooSequence.uniq(); diff --git a/lazy.js/lazy.js.d.ts b/lazy.js/lazy.js.d.ts index 02cf1833b..55406d5c5 100644 --- a/lazy.js/lazy.js.d.ts +++ b/lazy.js/lazy.js.d.ts @@ -135,8 +135,8 @@ declare module LazyJS { dropWhile(predicateFn: TestCallback): Sequence; every(predicateFn: TestCallback): boolean; filter(predicateFn: TestCallback): Sequence; - find(predicateFn: TestCallback): Sequence; - findWhere(properties: Object): Sequence; + find(predicateFn: TestCallback): T; + findWhere(properties: Object): T; flatten(): Sequence; groupBy(keyFn: GetKeyCallback): ObjectLikeSequence; @@ -150,7 +150,7 @@ declare module LazyJS { max(valueFn?: NumberCallback): T; min(valueFn?: NumberCallback): T; none(valueFn?: TestCallback): boolean; - pluck(propertyName: string): Sequence; + pluck(propertyName: string): Sequence; reduce(aggregatorFn: MemoCallback, memo?: U): U; reduceRight(aggregatorFn: MemoCallback, memo: U): U; reject(predicateFn: TestCallback): Sequence; @@ -162,7 +162,7 @@ declare module LazyJS { sortBy(sortFn: NumberCallback, descending?: boolean): Sequence; sortedIndex(value: T): Sequence; size(): number; - sum(valueFn?: NumberCallback): Sequence; + sum(valueFn?: NumberCallback): T; takeWhile(predicateFn: TestCallback): Sequence; union(var_args: T[]): Sequence; uniq(): Sequence; From e7791ea53eb7cbfe3357f1a15e9f304698bfacea Mon Sep 17 00:00:00 2001 From: rhysd Date: Thu, 3 Dec 2015 01:13:31 +0900 Subject: [PATCH 263/389] Add type definitions for react-infinite package Project: https://github.com/seatgeek/react-infinite --- react-infinite/react-infinite-tests.tsx | 113 ++++++++++++++++++++++++ react-infinite/react-infinite.d.ts | 36 ++++++++ 2 files changed, 149 insertions(+) create mode 100644 react-infinite/react-infinite-tests.tsx create mode 100644 react-infinite/react-infinite.d.ts diff --git a/react-infinite/react-infinite-tests.tsx b/react-infinite/react-infinite-tests.tsx new file mode 100644 index 000000000..91a86abce --- /dev/null +++ b/react-infinite/react-infinite-tests.tsx @@ -0,0 +1,113 @@ +/// +/// + +import * as React from 'react'; +import Infinite = require('react-infinite'); + +class Test1 extends React.Component<{}, {}> { + render() { + return ( + +
    +
    +
    + + ); + } +} + +class Test2 extends React.Component<{}, {}> { + render() { + return ( + +
    +
    +
    + + ); + } +} + +class Test3 extends React.Component<{}, {}> { + render() { + return ( + +
    +
    +
    + + ); + } +} + +class Test4 extends React.Component<{}, {}> { + render() { + return ( + +
    +
    +
    + + ); + } +} + +var ListItem = React.createClass<{key: number; num: number;}, {}>({ + render: function() { + return
    + List Item {this.props.num} +
    ; + } +}); + +var InfiniteList = React.createClass({ + getInitialState: function() { + return { + elements: this.buildElements(0, 20), + isInfiniteLoading: false + } + }, + + buildElements: function(start: number, end: number) { + var elements = [] as React.ReactElement[]; + for (var i = start; i < end; i++) { + elements.push() + } + return elements; + }, + + handleInfiniteLoad: function() { + var that = this; + this.setState({ + isInfiniteLoading: true + }); + setTimeout(function() { + var elemLength = that.state.elements.length, + newElements = that.buildElements(elemLength, elemLength + 1000); + that.setState({ + isInfiniteLoading: false, + elements: that.state.elements.concat(newElements) + }); + }, 2500); + }, + + elementInfiniteLoad: function() { + return
    + Loading... +
    ; + }, + + render: function() { + return + {this.state.elements} + ; + } +}); diff --git a/react-infinite/react-infinite.d.ts b/react-infinite/react-infinite.d.ts new file mode 100644 index 000000000..123883a0e --- /dev/null +++ b/react-infinite/react-infinite.d.ts @@ -0,0 +1,36 @@ +// Type definitions for react-infinite +// Project: https://github.com/seatgeek/react-infinite +// Definitions by: rhysd +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "react-infinite" { + import Infinite = ReactInfinite.Infinite; + export = Infinite; +} + +declare namespace ReactInfinite { + import React = __React; + + interface InfiniteProps extends React.Props { + elementHeight: number | number[]; + containerHeight?: number; + preloadBatchSize?: number | Object; + preloadAdditionalHeight?: number | Object; + handleScroll?: (node: React.ReactElement) => void; + infiniteLoadBeginBottomOffset?: number; + infiniteLoadBeginEdgeOffset?: number; + onInfiniteLoad?: () => void; + loadingSpinnerDelegate?: React.ReactElement; + isInfiniteLoading?: boolean; + timeScrollStateLastsForAfterUserScrolls?: number; + className?: string; + useWindowAsScrollContainer?: boolean; + displayBottomUpwards?: boolean; + } + + export class Infinite extends React.Component { + static containerHeightScaleFactor(n: number): any; + } +} From f91008d4cd78bc2e8b419a7f19c2b0267aef932c Mon Sep 17 00:00:00 2001 From: gscshoyru Date: Wed, 2 Dec 2015 12:19:39 -0500 Subject: [PATCH 264/389] Add unregister functions to handlebars.d.ts --- handlebars/handlebars.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/handlebars/handlebars.d.ts b/handlebars/handlebars.d.ts index 9a0aa510a..54dc7e9ae 100644 --- a/handlebars/handlebars.d.ts +++ b/handlebars/handlebars.d.ts @@ -7,6 +7,8 @@ declare module Handlebars { export function registerHelper(name: string, fn: Function, inverse?: boolean): void; export function registerPartial(name: string, str: any): void; + export function unregisterHelper(name: string): void; + export function unregisterPartial(name: string): void; export function K(): void; export function createFrame(object: any): any; export function Exception(message: string): void; From c27b57a8460685c6d181fe7e3effbe06009a8795 Mon Sep 17 00:00:00 2001 From: Tim Perry Date: Wed, 2 Dec 2015 18:25:59 +0100 Subject: [PATCH 265/389] Add very basic minimal hopscotch API --- hopscotch/hopscotch-tests.ts | 55 ++++++++++++++++++++++++++++++++++++ hopscotch/hopscotch.d.ts | 45 +++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 hopscotch/hopscotch-tests.ts create mode 100644 hopscotch/hopscotch.d.ts diff --git a/hopscotch/hopscotch-tests.ts b/hopscotch/hopscotch-tests.ts new file mode 100644 index 000000000..52d021395 --- /dev/null +++ b/hopscotch/hopscotch-tests.ts @@ -0,0 +1,55 @@ +/// + +var tourDefinition = { + id: 'intro-tour', + steps: [ + { + target: '.popupTarget', + placement: 'bottom', + title: 'A tour step', + content: 'A tour message' + }, + { + target: [".aSelector"], + placement: 'bottom', + + yOffset: 10, + width: 400, + xOffset: -420, + arrowOffset: 380 + }, + { + target: '.domainPatterns form', + placement: 'right', + title: 'A question?', + content: "Hello!", + onShow: function () { } + }, + { + target: '.home-button', + placement: 'left', + title: "Let's get started", + content: "Content", + + multipage: true, + nextOnTargetClick: true, + showNextButton: false + }, + { + target: '.buttons', + placement: 'top', + + title: 'Another title', + content: "A message", + + showNextButton: false, + nextOnTargetClick: true, + onShow: function () { } + } + ], + skipIfNoElement: false, + onClose: function () { }, + onEnd: function () { } +}; + +hopscotch.startTour(tourDefinition); diff --git a/hopscotch/hopscotch.d.ts b/hopscotch/hopscotch.d.ts new file mode 100644 index 000000000..e7f7be6e9 --- /dev/null +++ b/hopscotch/hopscotch.d.ts @@ -0,0 +1,45 @@ +// Type definitions for Hopscotch v0.2.5 +// Project: http://linkedin.github.io/hopscotch/ +// Definitions by: Tim Perry +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface TourDefinition { + id: string; + steps: StepDefinition[]; + + skipIfNoElement: boolean; + + onEnd: () => void; + onClose: () => void; +} + +interface StepDefinition { + placement: string; + target: string | HTMLElement | Array + + title?: string; + content?: string; + + xOffset?: number; + yOffset?: number; + arrowOffset?: number; + + height?: number; + width?: number; + + multipage?: boolean; + showNextButton?: boolean; + nextOnTargetClick?: boolean; + + onShow?: () => void; +} + +interface HopscotchStatic { + startTour(tour: TourDefinition, stepNum?: number): void; +} + +declare var hopscotch: HopscotchStatic; + +declare module "hopscotch" { + export = hopscotch; +} From 2162519f36fb92efda7641788fb8e34fd9029be9 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Wed, 2 Dec 2015 23:05:34 +0500 Subject: [PATCH 266/389] lodash: signatures of _.sortedLastIndex have been changed --- lodash/lodash-tests.ts | 91 +++++++++++++-- lodash/lodash.d.ts | 249 +++++++++++++++++++++++++++++++++-------- 2 files changed, 280 insertions(+), 60 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 9cae2a872..b64751cf4 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -1315,17 +1315,86 @@ module TestSortedIndex { // _.sortedLastIndex module TestSortedLastIndex { - result = _.sortedLastIndex([20, 30, 50], 40); - result = _.sortedLastIndex([{ 'x': 20 }, { 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x'); - var sortedLastIndexDict: { wordToNumber: { [idx: string]: number } } = { - 'wordToNumber': { 'twenty': 20, 'thirty': 30, 'fourty': 40, 'fifty': 50 } - }; - result = _.sortedLastIndex(['twenty', 'thirty', 'fifty'], 'fourty', function (word: string) { - return sortedLastIndexDict.wordToNumber[word]; - }); - result = _.sortedLastIndex(['twenty', 'thirty', 'fifty'], 'fourty', function (word: string) { - return this.wordToNumber[word]; - }, sortedLastIndexDict); + type SampleType = {a: number; b: string; c: boolean;}; + + let array: SampleType[]; + let list: _.List; + + let value: SampleType; + + let stringIterator: (x: string) => number; + let arrayIterator: (x: SampleType) => number; + let listIterator: (x: SampleType) => number; + + { + let result: number; + + result = _.sortedLastIndex('', ''); + result = _.sortedLastIndex('', '', stringIterator); + result = _.sortedLastIndex('', '', stringIterator, any); + result = _.sortedLastIndex('', '', stringIterator); + result = _.sortedLastIndex('', '', stringIterator, any); + + result = _.sortedLastIndex(array, value); + result = _.sortedLastIndex(array, value, arrayIterator); + result = _.sortedLastIndex(array, value, arrayIterator, any); + result = _.sortedLastIndex(array, value, ''); + result = _.sortedLastIndex(array, value, {a: 42}); + result = _.sortedLastIndex(array, value, arrayIterator); + result = _.sortedLastIndex(array, value, arrayIterator, any); + result = _.sortedLastIndex<{a: number}, SampleType>(array, value, {a: 42}); + + result = _.sortedLastIndex(list, value); + result = _.sortedLastIndex(list, value, listIterator); + result = _.sortedLastIndex(list, value, listIterator, any); + result = _.sortedLastIndex(list, value, ''); + result = _.sortedLastIndex(list, value, {a: 42}); + result = _.sortedLastIndex(list, value, listIterator); + result = _.sortedLastIndex(list, value, listIterator, any); + result = _.sortedLastIndex<{a: number}, SampleType>(list, value, {a: 42}); + + result = _('').sortedLastIndex(''); + result = _('').sortedLastIndex('', stringIterator); + result = _('').sortedLastIndex('', stringIterator, any); + + result = _(array).sortedLastIndex(value); + result = _(array).sortedLastIndex(value, arrayIterator); + result = _(array).sortedLastIndex(value, arrayIterator, any); + result = _(array).sortedLastIndex(value, ''); + result = _(array).sortedLastIndex<{a: number}>(value, {a: 42}); + + result = _(list).sortedLastIndex(value); + result = _(list).sortedLastIndex(value, listIterator); + result = _(list).sortedLastIndex(value, listIterator, any); + result = _(list).sortedLastIndex(value, ''); + result = _(list).sortedLastIndex(value, {a: 42}); + result = _(list).sortedLastIndex(value, listIterator); + result = _(list).sortedLastIndex(value, listIterator, any); + result = _(list).sortedLastIndex<{a: number}, SampleType>(value, {a: 42}); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('').chain().sortedLastIndex(''); + result = _('').chain().sortedLastIndex('', stringIterator); + result = _('').chain().sortedLastIndex('', stringIterator, any); + + result = _(array).chain().sortedLastIndex(value); + result = _(array).chain().sortedLastIndex(value, arrayIterator); + result = _(array).chain().sortedLastIndex(value, arrayIterator, any); + result = _(array).chain().sortedLastIndex(value, ''); + result = _(array).chain().sortedLastIndex<{a: number}>(value, {a: 42}); + + result = _(list).chain().sortedLastIndex(value); + result = _(list).chain().sortedLastIndex(value, listIterator); + result = _(list).chain().sortedLastIndex(value, listIterator, any); + result = _(list).chain().sortedLastIndex(value, ''); + result = _(list).chain().sortedLastIndex(value, {a: 42}); + result = _(list).chain().sortedLastIndex(value, listIterator); + result = _(list).chain().sortedLastIndex(value, listIterator, any); + result = _(list).chain().sortedLastIndex<{a: number}, SampleType>(value, {a: 42}); + } } // _.tail diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index ed8d72443..a8d6e5736 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -2156,71 +2156,222 @@ declare module _ { //_.sortedLastIndex interface LoDashStatic { /** - * Uses a binary search to determine the highest index at which a value should be inserted - * into a given sorted array in order to maintain the sort order of the array. If a callback - * is provided it will be executed for value and each element of array to compute their sort - * ranking. The callback is bound to thisArg and invoked with one argument; (value). - * - * If a property name is provided for callback the created "_.pluck" style callback will - * return the property value of the given element. - * - * If an object is provided for callback the created "_.where" style callback will return - * true for elements that have the properties of the given object, else false. - * @param array The sorted list. - * @param value The value to determine its index within `list`. - * @param callback Iterator to compute the sort ranking of each value, optional. - * @return The index at which value should be inserted into array. - **/ - sortedLastIndex( - array: Array, - value: T, - callback?: (x: T) => TSort, - thisArg?: any): number; - - /** - * @see _.sortedLastIndex - **/ + * This method is like _.sortedIndex except that it returns the highest index at which value should be + * inserted into array in order to maintain its sort order. + * + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the index at which value should be inserted into array. + */ sortedLastIndex( array: List, value: T, - callback?: (x: T) => TSort, - thisArg?: any): number; + iteratee?: (x: T) => TSort, + thisArg?: any + ): number; /** - * @see _.sortedLastIndex - * @param pluckValue the _.pluck style callback - **/ - sortedLastIndex( - array: Array, - value: T, - pluckValue: string): number; - - /** - * @see _.sortedLastIndex - * @param pluckValue the _.pluck style callback - **/ + * @see _.sortedLastIndex + */ sortedLastIndex( array: List, value: T, - pluckValue: string): number; + iteratee?: (x: T) => any, + thisArg?: any + ): number; /** - * @see _.sortedLastIndex - * @param pluckValue the _.where style callback - **/ - sortedLastIndex( - array: Array, + * @see _.sortedLastIndex + */ + sortedLastIndex( + array: List, value: T, - whereValue: W): number; + iteratee: string + ): number; /** - * @see _.sortedLastIndex - * @param pluckValue the _.where style callback - **/ + * @see _.sortedLastIndex + */ sortedLastIndex( array: List, value: T, - whereValue: W): number; + iteratee: W + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + array: List, + value: T, + iteratee: Object + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: string, + iteratee?: (x: string) => TSort, + thisArg?: any + ): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: W + ): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee?: (x: T) => any, + thisArg?: any + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: W + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: Object + ): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: string, + iteratee?: (x: string) => TSort, + thisArg?: any + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: string + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: W + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee?: (x: T) => any, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: string + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: W + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: Object + ): LoDashExplicitWrapper; } //_.tail From c9fe6c37beb8305805ed3f63749e1b6454f913fd Mon Sep 17 00:00:00 2001 From: Nathan Brown Date: Wed, 2 Dec 2015 11:41:00 -0700 Subject: [PATCH 267/389] material-ui - add missing event handler. Add `onClick` to `ListItem` component. --- material-ui/material-ui.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/material-ui/material-ui.d.ts b/material-ui/material-ui.d.ts index a27a0ee09..5da618dc7 100644 --- a/material-ui/material-ui.d.ts +++ b/material-ui/material-ui.d.ts @@ -571,6 +571,7 @@ declare namespace __MaterialUI { nestedItems?: React.ReactElement[]; onKeyboardFocus?: React.FocusEventHandler; onNestedListToggle?: (item: ListItem) => void; + onClick?: React.MouseEventHandler; rightAvatar?: React.ReactElement; rightIcon?: React.ReactElement; rightIconButton?: React.ReactElement; From ac1ab0907523267019a1ee4f0dc4dc268b5bc1d4 Mon Sep 17 00:00:00 2001 From: Chris Barr Date: Wed, 2 Dec 2015 15:42:15 -0500 Subject: [PATCH 268/389] Intro.js - Fixing types --- intro.js/intro.js-tests.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/intro.js/intro.js-tests.ts b/intro.js/intro.js-tests.ts index b8e8126ae..0ec5938f5 100644 --- a/intro.js/intro.js-tests.ts +++ b/intro.js/intro.js-tests.ts @@ -3,6 +3,8 @@ var intro = introJs(); intro.setOption('doneLabel', 'Next page'); +intro.setOption('overlayOpacity', 50); +intro.setOption('showProgress', true); intro.setOptions({ steps: [ { From c569355ceb6aaf433a17910ed943b2638fd9ecd1 Mon Sep 17 00:00:00 2001 From: Chris Barr Date: Wed, 2 Dec 2015 15:43:44 -0500 Subject: [PATCH 269/389] Fixing Types --- intro.js/intro.js.d.ts | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/intro.js/intro.js.d.ts b/intro.js/intro.js.d.ts index 15a73f517..6763124ba 100644 --- a/intro.js/intro.js.d.ts +++ b/intro.js/intro.js.d.ts @@ -1,20 +1,13 @@ -// Type definitions for intro.js 1.0.0 +// Type definitions for intro.js 1.1.1 // Project: https://github.com/usablica/intro.js // Definitions by: Maxime Fabre // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module IntroJs { - enum Positions { - top, - left, - right, - bottom - } - interface Step { intro: string; - element?: string|HTMLElement; - position?: string|Positions; + element?: string|HTMLElement|Element; + position?: string; } interface Options { @@ -49,7 +42,7 @@ declare module IntroJs { refresh(): IntroJs; - setOption(option: string, value: string|number): IntroJs; + setOption(option: string, value: string|number|boolean): IntroJs; setOptions(options: Options): IntroJs; onexit(callback: Function): IntroJs; From ea650f84de4600c5b20a4cb9d6991e89aa218928 Mon Sep 17 00:00:00 2001 From: Merott Movahedi Date: Wed, 2 Dec 2015 21:06:24 +0000 Subject: [PATCH 270/389] add Stamplay.init definition for setting the app ID --- stamplay-js-sdk/stamplay-js-sdk-tests.ts | 2 +- stamplay-js-sdk/stamplay-js-sdk.d.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/stamplay-js-sdk/stamplay-js-sdk-tests.ts b/stamplay-js-sdk/stamplay-js-sdk-tests.ts index bfc229d49..88b6d713d 100644 --- a/stamplay-js-sdk/stamplay-js-sdk-tests.ts +++ b/stamplay-js-sdk/stamplay-js-sdk-tests.ts @@ -1,5 +1,5 @@ /// - +Stamplay.init('sample'); var userFn = Stamplay.User(); var user = new userFn.Model; var colTags = Stamplay.Cobject('tag'); diff --git a/stamplay-js-sdk/stamplay-js-sdk.d.ts b/stamplay-js-sdk/stamplay-js-sdk.d.ts index 154dc414e..ebd0d31b3 100644 --- a/stamplay-js-sdk/stamplay-js-sdk.d.ts +++ b/stamplay-js-sdk/stamplay-js-sdk.d.ts @@ -26,6 +26,7 @@ declare module Stamplay { } export interface StamplayStatic { + init(appId : string) : void; User() : IStamplayObject Cobject(object : string) : IStamplayObject } From f43a366a923d3e03f23c509a426e5818b72dcca1 Mon Sep 17 00:00:00 2001 From: matb Date: Wed, 2 Dec 2015 22:21:24 +0100 Subject: [PATCH 271/389] Add missing ; to swig.d.ts Swig.d.ts was missing a ; in line 31. This leads to warnings in this file. --- swig/swig.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/swig/swig.d.ts b/swig/swig.d.ts index 4f2b22123..5de872c10 100644 --- a/swig/swig.d.ts +++ b/swig/swig.d.ts @@ -28,7 +28,7 @@ declare module "swig" { compileFile(pathname: string, options?: SwigOptions): (locals?: any) => string; render(source: string, options?: SwigOptions): string; renderFile(pathName: string, locals: any, cb: (err: Error, output: string) => void): void; - renderFile(pathName: string, locals?: any): string + renderFile(pathName: string, locals?: any): string; run(templateFn: Function, locals?: any, filePath?: string): string; invalidateCache(): void; @@ -155,4 +155,4 @@ declare module "swig" { export function renderFile(pathName: string, locals?: any): string export function run(templateFn: Function, locals?: any, filePath?: string): string; export function invalidateCache(): void; -} \ No newline at end of file +} From 9cb096f5de68d76b1faecde6f233b193f0736b6a Mon Sep 17 00:00:00 2001 From: Tim Schubert Date: Thu, 3 Dec 2015 11:00:59 +1100 Subject: [PATCH 272/389] ISpawnOptions.cmd is optional These options are perfectly valid but will cause a ts build to fail: grunt.util.spawn({grunt: true, args: ['"mytask"]}); --- gruntjs/gruntjs.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gruntjs/gruntjs.d.ts b/gruntjs/gruntjs.d.ts index e503cb572..a3a3a67e5 100644 --- a/gruntjs/gruntjs.d.ts +++ b/gruntjs/gruntjs.d.ts @@ -1172,7 +1172,7 @@ declare module grunt { /** * The command to execute. It should be in the system path. */ - cmd: string + cmd?: string /** * If specified, the same grunt bin that is currently running will be From dc36a0774fc9d9fba862daad4f42ad89513d8473 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Thu, 3 Dec 2015 06:43:54 +0500 Subject: [PATCH 273/389] lodash: signatures of _.isNaN have been changed --- lodash/lodash-tests.ts | 25 +++++++++++++++++++------ lodash/lodash.d.ts | 9 +++++++++ 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 9cae2a872..dff86b8d2 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -5397,12 +5397,25 @@ result = _({}).isMatch({}, testIsMatchCustiomizerFn); result = _({}).isMatch({}, testIsMatchCustiomizerFn, {}); // _.isNaN -result = _.isNaN(NaN); -result = _.isNaN(new Number(NaN)); -result = _.isNaN(undefined); -result = _(NaN).isNaN(); -result = _(new Number(NaN)).isNaN(); -result = _(undefined).isNaN(); +module TestIsNaN { + { + let result: boolean; + + result = _.isNaN(any); + + result = _(1).isNaN(); + result = _([]).isNaN(); + result = _({}).isNaN(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isNaN(); + result = _([]).chain().isNaN(); + result = _({}).chain().isNaN(); + } +} // _.isNative result = _.isNative(Array.prototype.push); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index ed8d72443..a2142896b 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -9272,7 +9272,9 @@ declare module _ { interface LoDashStatic { /** * Checks if value is NaN. + * * Note: This method is not the same as isNaN which returns true for undefined and other non-numeric values. + * * @param value The value to check. * @return Returns true if value is NaN, else false. */ @@ -9286,6 +9288,13 @@ declare module _ { isNaN(): boolean; } + interface LoDashExplicitWrapperBase { + /** + * @see _.isNaN + */ + isNaN(): LoDashExplicitWrapper; + } + //_.isNative interface LoDashStatic { /** From 0ab253f326e45430cbad0e2182b080a13cfd0b60 Mon Sep 17 00:00:00 2001 From: Long Yinan Date: Thu, 3 Dec 2015 14:45:42 +0800 Subject: [PATCH 274/389] fix(angularjs): add toJSON method --- angularjs/angular-resource-tests.ts | 5 +++++ angularjs/angular-resource.d.ts | 3 +++ 2 files changed, 8 insertions(+) diff --git a/angularjs/angular-resource-tests.ts b/angularjs/angular-resource-tests.ts index cfa7712cc..fcf0bd0a9 100644 --- a/angularjs/angular-resource-tests.ts +++ b/angularjs/angular-resource-tests.ts @@ -89,6 +89,9 @@ resource = resourceClass.save({ key: 'value' }, { key: 'value' }, function () { var promise : angular.IPromise; var arrayPromise : angular.IPromise; +var json: { + [index: string]: any; +}; promise = resource.$delete(); promise = resource.$delete({ key: 'value' }); @@ -127,6 +130,8 @@ promise = resource.$save(function () { }); promise = resource.$save(function () { }, function () { }); promise = resource.$save({ key: 'value' }, function () { }, function () { }); +json = resource.toJSON(); + /////////////////////////////////////// // IResourceService /////////////////////////////////////// diff --git a/angularjs/angular-resource.d.ts b/angularjs/angular-resource.d.ts index 76930196b..2187130ac 100644 --- a/angularjs/angular-resource.d.ts +++ b/angularjs/angular-resource.d.ts @@ -136,6 +136,9 @@ declare module angular.resource { /** the promise of the original server interaction that created this instance. **/ $promise : angular.IPromise; $resolved : boolean; + toJSON: () => { + [index: string]: any; + } } /** From 288805ab6ecdd11305d39168abaaeba9e4924650 Mon Sep 17 00:00:00 2001 From: Sam Vloeberghs Date: Thu, 3 Dec 2015 08:28:19 +0100 Subject: [PATCH 275/389] added type defs for foundation-sites 6.0.4 --- foundation-sites/foundation.d.ts | 426 +++++++++++++++++++++++++++++++ 1 file changed, 426 insertions(+) create mode 100644 foundation-sites/foundation.d.ts diff --git a/foundation-sites/foundation.d.ts b/foundation-sites/foundation.d.ts new file mode 100644 index 000000000..c72a93ba1 --- /dev/null +++ b/foundation-sites/foundation.d.ts @@ -0,0 +1,426 @@ +// Type definitions for Foundation Sites v6.0.4 +// Project: http://foundation.zurb.com/ +// Definitions by: Sam Vloeberghs +// Definitions by: Michał Wrześniewski +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module Foundation { + + // http://foundation.zurb.com/sites/docs/abide.html#javascript-reference + export interface Abide { + requiredCheck: (element:Object) => boolean; + findLabel: (element:Object) => boolean; + addErrorClasses: (element:Object) => void; + removeErrorClasses: (element:Object) => void; + validateInput: (element:Object, form:Object) => void; + validateForm: (element:Object) => void; + validateText: (element:Object) => boolean; + validateRadio: (group:String) => boolean; + resetform: ($form:Object) => void; + } + + interface IAbidePaterns { + alpha?: RegExp; + alpha_numeric?: RegExp; + integer?: RegExp; + number?: RegExp; + card?: RegExp; + cvv?: RegExp; + email ?: RegExp; + url?: RegExp; + domain?: RegExp; + datetime?: RegExp; + date?: RegExp; + time?: RegExp; + dateISO?: RegExp; + month_day_year?: RegExp; + day_month_year?: RegExp; + color?: RegExp; + } + + interface IAbideOptions { + slideSpeed?: number + multiOpen?: boolean; + } + + // http://foundation.zurb.com/sites/docs/accordion.html#javascript-reference + export interface Accordion { + toggle: ($target:JQuery) => void; + down: ($target:JQuery, firstTime:boolean) => void; + up: ($target:JQuery) => void; + destroy: () => void; + } + + interface IAccordionOptions { + slideSpeed?: number + multiOpen?: boolean; + } + + // http://foundation.zurb.com/sites/docs/accordion-menu.html#javascript-reference + export interface AccordionMenu { + toggle: ($target:JQuery) => void; + down: ($target:JQuery, firstTime:boolean) => void; + up: ($target:JQuery) => void; + destroy: () => void; + } + + // http://foundation.zurb.com/sites/docs/drilldown-menu.html#javascript-reference + export interface Drilldown { + _hideAll: ($elem:JQuery) => void; + _show: ($elem:JQuery) => void; + _hide: ($elem:JQuery) => void; + destroy: () => void; + } + + interface IDrilldownOptions { + backButton?: String; + wrapper?: String + closeOnClick?: boolean + } + + // http://foundation.zurb.com/sites/docs/dropdown.html#javascript-reference + export interface Dropdown { + getPositionClass: () => String; + open: () => void; + close: () => void; + toggle: () => void; + destroy: () => void; + } + + interface IDropdownOptions { + hoverDelay?: number; + hover?: boolean; + vOffset?: number; + hOffset?: number; + positionClass?: String; + trapFocus?: boolean; + autoFocus?: boolean; + } + + // http://foundation.zurb.com/sites/docs/dropdown-menu.html#javascript-reference + export interface DropdownMenu { + destroy: () => void; + } + + interface IDropdownMenuOptions { + disableHover?: boolean; + autoclose?: boolean; + hoverDelay?: number; + clickOpen?: boolean; + closingTime?: number; + alignments?: String; + verticalClasss?: String; + rightClasss?: String; + } + + // http://foundation.zurb.com/sites/docs/equalizer.html#javascript-reference + export interface Equalizer { + getHeights: (element:Object) => Array; + applyHeight: ($eqParent:Object, heights:Array) => void; + destroy: () => void; + } + + interface IEqualizerOptions { + equalizeOnStack?: boolean; + throttleInterval?: number; + } + + // http://foundation.zurb.com/sites/docs/interchange.html#javascript-reference + export interface Interchange { + replace: (path:String) => void; + destroy: () => void; + } + + interface IInterchangeOptions { + rules?: Array + } + + // http://foundation.zurb.com/sites/docs/magellan.html#javascript-reference + export interface Magellan { + calcPoints: () => void; + reflow: () => void; + destroy: () => void; + } + + interface IMagellanOptions { + animationDuration?: number; + animationEasing?: String; + threshold?: number; + activeClass?: String; + deepLinking?: boolean; + } + + // http://foundation.zurb.com/sites/docs/offcanvas.html#javascript-reference + export interface OffCanvas { + open: (event:Object, trigger:JQuery) => void; + toggle: (event:Object, trigger:JQuery) => void; + close: () => void; + destroy: () => void; + } + + interface IOffCanvasOptions { + closeOnClick?: boolean; + transitionTime?: number; + position?: String; + forceTop?: boolean; + isRevealed?: boolean; + revealOn?: String; + autoFocus?: boolean; + revealClass?: String; + } + + // http://foundation.zurb.com/sites/docs/orbit.html#javascript-reference + export interface Orbit { + changeSlide: (isLTR:boolean, chosenSlide?:Object, idx?:number) => void; + geoSync: () => void; + destroy: () => void; + } + + interface IOrbitOptions { + bullets?: boolean; + navButtons?: boolean; + animInFromRight?: String; + animOutToRight?: String; + animInFromLeft?: String; + animOutToLeft?: String; + autoPlay?: boolean; + timerDelay?: number; + infiniteWrap?: boolean; + swipe?: boolean; + pauseOnHover?: boolean; + accessible?: boolean; + containerClass?: String; + slideClass?: String; + boxOfBullets?: String; + nextClass?: String; + prevClass?: String; + } + + // http://foundation.zurb.com/sites/docs/reveal.html#javascript-reference + export interface Reveal { + open: () => void; + toggle: () => void; + close: () => void; + destroy: () => void; + } + + interface IRevealOptions { + animationIn?: String; + animationOut?: String; + showDelay?: number; + hideDelay?: number; + closeOnClick?: boolean; + closeOnEsc?: boolean; + multipleOpened?: boolean; + vOffset?: number; + hOffset?: number; + fullScreen?: boolean; + btmOffsetPct?: number; + overlay?: boolean; + resetOnClose?: boolean; + } + + // http://foundation.zurb.com/sites/docs/slider.html#javascript-reference + export interface Slider { + destroy: () => void; + } + + interface ISliderOptions { + start?: number; + end?: number; + step?: number; + initialStart ?: number; + initialEnd?: number; + binding?: boolean; + clickSelect?: boolean; + vertical?: boolean; + draggable?: boolean; + disabled?: boolean; + doubleSided?: boolean; + decimal?: number; + moveTime?: number; + disabledClass?: String; + } + + // http://foundation.zurb.com/sites/docs/sticky.html#javascript-reference + export interface Sticky { + _pauseListeners: (scrollListener:String) => void; + _calc: (checkSizes:boolean, scroll:number) => void; + destroy: () => void; + emCalc: (number:any) => void; + } + + interface IStickyOptions { + container?: String; + stickTo?: String; + anchor?: String; + topAnchor?: String; + btmAnchor?: String; + marginTop?: number; + marginBottom?: number; + stickyOn?: String; + stickyClass?: String; + containerClass?: String; + checkEvery?: number; + } + + // http://foundation.zurb.com/sites/docs/tabs.html#javascript-reference + export interface Tabs { + _handleTabChange: ($target:JQuery) => void; + selectTab: ($target:JQuery) => void; + destroy: () => void; + } + + interface ITabsOptions { + animate?: boolean; + } + + // http://foundation.zurb.com/sites/docs/toggler.html#javascript-reference + export interface Toggler { + toggle: () => void; + destroy: () => void; + } + + interface ITogglerOptions { + animate?: boolean; + } + + // http://foundation.zurb.com/sites/docs/tooltip.html#javascript-reference + export interface Tooltip { + show: () => void; + hide: () =>void; + toggle: () => void; + destroy: () => void; + } + + interface ITooltipOptions { + hoverDelay?: number; + fadeInDuration?: number; + fadeOutDuration?: number; + disableHover?: boolean; + templateClasses?: String; + tooltipClass?: String; + triggerClass?: String; + showOn?: String; + template?: String; + tipText?: String; + clickOpen?: boolean; + positionClass?: String; + vOffset?: number; + hOffset?:number; + } + + // Utilities + // --------- + + export interface Box { + ImNotTouchingYou: (element:Object, parent?:Object, lrOnly?:boolean, tbOnly?:boolean) => boolean; + GetDimensions: (element:Object) => Object; + GetOffsets: (element:Object, anchor:Object, position:String, vOffset:number, hOffset:number, isOverflow:boolean) => Object; + } + + export interface KeyBoard { + parseKey: (event:any) => String; + findFocusable: ($element:Object) => Object; + } + + export interface MediaQuery { + get: (size:String) => String; + atLeast: (size:String) => boolean; + queries:Array; + current:any; + } + + export interface Motion { + animateIn: (element:Object, animation:any, cb:Function) => void; + animateOut: (element:Object, animation:any, cb:Function) => void; + } + + interface Move { + // TODO + } + + interface Nest { + // TODO + } + + export interface Timer { + start: () => void; + restart: () => void; + pause: () => void; + } + + interface Touch { + // TODO :extension on jQuery + } + + interface Triggers { + // TODO :extension on jQuery + } + + export interface InterChange { + destroy: () => void; + } + interface IInterChangeOptions { + rules ?: Array; + } + interface ITooltipOptions { + hoverDelay ?: number; + fadeInDuration ?: number; + fadeOutDuration ?: number; + disableHover ?: boolean; + templateClasses ?: String; + tooltipClass ?: String; + triggerClass ?: String; + showOn ?: String; + template ?: String; + tipText ?: String; + clickOpenr ?: boolean; + positionClass ?: String; + vOffset ?: number; + hOffset ?: number; + } + + interface FoundationStatic { + version : String; + + rtl: () => boolean; + plugin: (plugin:Object, name:String) => void; + registerPlugin: (plugin:Object) => void; + unregisterPlugin: (plugin:Object) => void; + GetYoDigits: (length:number, namespace?:String) => String; + reflow: (elem:Object, plugins?:Array|String) => void; + getFnName: (fofn:String) => String; + transitionend: () => String; + + util : { + throttle(func:(...args:any[]) => any, delay:number) : (...args:any[]) => any; + }; + onImagesLoaded: (images:Object, cb:Function) => void; + + Abide: (element:Object, options:IAbideOptions) => void; + Accordion: (element:Object, options:IAccordionOptions) => void; + Dropdown: (element:Object, options:IDropdownOptions) => void; + DropdownMenu: (element:Object, options:IDropdownMenuOptions) => void; + Equalizer: (element:Object, options:IEqualizerOptions) => void; + Interchange: (element:Object, options:IInterChangeOptions) => void; + Magellan: (element:Object, options:IMagellanOptions) => void; + OffCanvas: (element:Object, options:IOffCanvasOptions) => void; + Orbit: (element:Object, options:IOrbitOptions) => void; + Reveal: (element:Object, options:IRevealOptions) => void; + Slider: (element:Object, options:ISliderOptions) => void; + Sticky: (element:Object, options:IStickyOptions) => void; + Tabs: (element:Object, options:ITabsOptions) => void; + Toggler: (element:Object, options:ITogglerOptions) => void; + Tooltip: (element:Object, options:ITooltipOptions) => void; + + } +} + +interface JQuery { + foundation(method:String|Array) : JQuery; +} + +declare var Foundation:Foundation.FoundationStatic; From 6ced381e2f78f050b810e1b2c8387734a35f62eb Mon Sep 17 00:00:00 2001 From: Michal Wrzesniewski Date: Thu, 3 Dec 2015 10:32:56 +0100 Subject: [PATCH 276/389] test file created --- foundation-sites/foundation-tests.ts | 2 ++ foundation-sites/foundation.d.ts | 25 +++++-------------------- 2 files changed, 7 insertions(+), 20 deletions(-) create mode 100644 foundation-sites/foundation-tests.ts diff --git a/foundation-sites/foundation-tests.ts b/foundation-sites/foundation-tests.ts new file mode 100644 index 000000000..7aab47e80 --- /dev/null +++ b/foundation-sites/foundation-tests.ts @@ -0,0 +1,2 @@ +/// +/// \ No newline at end of file diff --git a/foundation-sites/foundation.d.ts b/foundation-sites/foundation.d.ts index c72a93ba1..1093a954a 100644 --- a/foundation-sites/foundation.d.ts +++ b/foundation-sites/foundation.d.ts @@ -344,6 +344,8 @@ declare module Foundation { interface Nest { // TODO + //Feather: function(menu, type) + // Burn: function(menu, type){ } export interface Timer { @@ -360,29 +362,12 @@ declare module Foundation { // TODO :extension on jQuery } - export interface InterChange { - destroy: () => void; - } + interface IInterChangeOptions { - rules ?: Array; - } - interface ITooltipOptions { - hoverDelay ?: number; - fadeInDuration ?: number; - fadeOutDuration ?: number; - disableHover ?: boolean; - templateClasses ?: String; - tooltipClass ?: String; - triggerClass ?: String; - showOn ?: String; - template ?: String; - tipText ?: String; - clickOpenr ?: boolean; - positionClass ?: String; - vOffset ?: number; - hOffset ?: number; + rules ?: Array; } + interface FoundationStatic { version : String; From 400a0e998dcf4acec0049aa1282010129b792401 Mon Sep 17 00:00:00 2001 From: Michal Wrzesniewski Date: Thu, 3 Dec 2015 10:35:11 +0100 Subject: [PATCH 277/389] test file: Header added --- foundation-sites/foundation-tests.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/foundation-sites/foundation-tests.ts b/foundation-sites/foundation-tests.ts index 7aab47e80..e99545d6d 100644 --- a/foundation-sites/foundation-tests.ts +++ b/foundation-sites/foundation-tests.ts @@ -1,2 +1,8 @@ +// Tests for type definitions for Foundation Sites v6.0.4 +// Project: http://foundation.zurb.com/ +// Definitions by: Sam Vloeberghs +// Definitions by: Michał Wrześniewski +// Definitions: https://github.com/borisyankov/DefinitelyTyped + /// /// \ No newline at end of file From 281dabc4bef9a2e2219a26c10d567ab3d024891e Mon Sep 17 00:00:00 2001 From: Michal Wrzesniewski Date: Thu, 3 Dec 2015 10:37:50 +0100 Subject: [PATCH 278/389] Equalizer compiler error fixed --- foundation-sites/foundation.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foundation-sites/foundation.d.ts b/foundation-sites/foundation.d.ts index 1093a954a..27d761a38 100644 --- a/foundation-sites/foundation.d.ts +++ b/foundation-sites/foundation.d.ts @@ -118,7 +118,7 @@ declare module Foundation { // http://foundation.zurb.com/sites/docs/equalizer.html#javascript-reference export interface Equalizer { getHeights: (element:Object) => Array; - applyHeight: ($eqParent:Object, heights:Array) => void; + applyHeight: ($eqParent:Object, heights:Array) => void; destroy: () => void; } From 9416558e735d2a959b1f752080eae78fd66acedd Mon Sep 17 00:00:00 2001 From: Sam Vloeberghs Date: Thu, 3 Dec 2015 10:52:54 +0100 Subject: [PATCH 279/389] update --- foundation-sites/foundation-tests.ts | 9 + foundation-sites/foundation.d.ts | 236 +++++++++++++-------------- foundation/foundation-tests.ts | 1 + 3 files changed, 122 insertions(+), 124 deletions(-) create mode 100644 foundation-sites/foundation-tests.ts diff --git a/foundation-sites/foundation-tests.ts b/foundation-sites/foundation-tests.ts new file mode 100644 index 000000000..7238fe047 --- /dev/null +++ b/foundation-sites/foundation-tests.ts @@ -0,0 +1,9 @@ +/// +/// + +$(document).foundation(); +$(document).foundation('method'); +$(document).foundation(['method', 'method2']); + +Foundation.Abide($('.selector')); + diff --git a/foundation-sites/foundation.d.ts b/foundation-sites/foundation.d.ts index c72a93ba1..afacabb43 100644 --- a/foundation-sites/foundation.d.ts +++ b/foundation-sites/foundation.d.ts @@ -9,19 +9,19 @@ declare module Foundation { // http://foundation.zurb.com/sites/docs/abide.html#javascript-reference - export interface Abide { - requiredCheck: (element:Object) => boolean; - findLabel: (element:Object) => boolean; - addErrorClasses: (element:Object) => void; - removeErrorClasses: (element:Object) => void; - validateInput: (element:Object, form:Object) => void; - validateForm: (element:Object) => void; - validateText: (element:Object) => boolean; - validateRadio: (group:String) => boolean; - resetform: ($form:Object) => void; + interface Abide { + requiredCheck(element:Object): boolean; + findLabel(element:Object): boolean; + addErrorClasses(element:Object): void; + removeErrorClasses(element:Object): void; + validateInput(element:Object, form:Object): void; + validateForm(element:Object): void; + validateText(element:Object): boolean; + validateRadio(group:String): boolean; + resetform($form:Object): void; } - interface IAbidePaterns { + export interface IAbidePatterns { alpha?: RegExp; alpha_numeric?: RegExp; integer?: RegExp; @@ -40,17 +40,17 @@ declare module Foundation { color?: RegExp; } - interface IAbideOptions { + export interface IAbideOptions { slideSpeed?: number multiOpen?: boolean; } // http://foundation.zurb.com/sites/docs/accordion.html#javascript-reference export interface Accordion { - toggle: ($target:JQuery) => void; - down: ($target:JQuery, firstTime:boolean) => void; - up: ($target:JQuery) => void; - destroy: () => void; + toggle($target:JQuery): void; + down($target:JQuery, firstTime:boolean): void; + up($target:JQuery): void; + destroy(): void; } interface IAccordionOptions { @@ -60,18 +60,18 @@ declare module Foundation { // http://foundation.zurb.com/sites/docs/accordion-menu.html#javascript-reference export interface AccordionMenu { - toggle: ($target:JQuery) => void; - down: ($target:JQuery, firstTime:boolean) => void; - up: ($target:JQuery) => void; - destroy: () => void; + toggle($target:JQuery): void; + down($target:JQuery, firstTime:boolean): void; + up($target:JQuery): void; + destroy(): void; } // http://foundation.zurb.com/sites/docs/drilldown-menu.html#javascript-reference export interface Drilldown { - _hideAll: ($elem:JQuery) => void; - _show: ($elem:JQuery) => void; - _hide: ($elem:JQuery) => void; - destroy: () => void; + _hideAll($elem:JQuery): void; + _show($elem:JQuery): void; + _hide($elem:JQuery): void; + destroy(): void; } interface IDrilldownOptions { @@ -82,11 +82,11 @@ declare module Foundation { // http://foundation.zurb.com/sites/docs/dropdown.html#javascript-reference export interface Dropdown { - getPositionClass: () => String; - open: () => void; - close: () => void; - toggle: () => void; - destroy: () => void; + getPositionClass(): String; + open(): void; + close(): void; + toggle(): void; + destroy(): void; } interface IDropdownOptions { @@ -101,7 +101,7 @@ declare module Foundation { // http://foundation.zurb.com/sites/docs/dropdown-menu.html#javascript-reference export interface DropdownMenu { - destroy: () => void; + destroy(): void; } interface IDropdownMenuOptions { @@ -117,9 +117,9 @@ declare module Foundation { // http://foundation.zurb.com/sites/docs/equalizer.html#javascript-reference export interface Equalizer { - getHeights: (element:Object) => Array; - applyHeight: ($eqParent:Object, heights:Array) => void; - destroy: () => void; + getHeights(element:Object): Array; + applyHeight($eqParent:Object, heights:Array): void; + destroy(): void; } interface IEqualizerOptions { @@ -129,8 +129,8 @@ declare module Foundation { // http://foundation.zurb.com/sites/docs/interchange.html#javascript-reference export interface Interchange { - replace: (path:String) => void; - destroy: () => void; + replace(path:String): void; + destroy(): void; } interface IInterchangeOptions { @@ -139,9 +139,9 @@ declare module Foundation { // http://foundation.zurb.com/sites/docs/magellan.html#javascript-reference export interface Magellan { - calcPoints: () => void; - reflow: () => void; - destroy: () => void; + calcPoints(): void; + reflow(): void; + destroy(): void; } interface IMagellanOptions { @@ -154,10 +154,10 @@ declare module Foundation { // http://foundation.zurb.com/sites/docs/offcanvas.html#javascript-reference export interface OffCanvas { - open: (event:Object, trigger:JQuery) => void; - toggle: (event:Object, trigger:JQuery) => void; - close: () => void; - destroy: () => void; + open(event:Object, trigger:JQuery): void; + toggle(event:Object, trigger:JQuery): void; + close(): void; + destroy(): void; } interface IOffCanvasOptions { @@ -173,9 +173,9 @@ declare module Foundation { // http://foundation.zurb.com/sites/docs/orbit.html#javascript-reference export interface Orbit { - changeSlide: (isLTR:boolean, chosenSlide?:Object, idx?:number) => void; - geoSync: () => void; - destroy: () => void; + changeSlide(isLTR:boolean, chosenSlide?:Object, idx?:number): void; + geoSync(): void; + destroy(): void; } interface IOrbitOptions { @@ -200,10 +200,10 @@ declare module Foundation { // http://foundation.zurb.com/sites/docs/reveal.html#javascript-reference export interface Reveal { - open: () => void; - toggle: () => void; - close: () => void; - destroy: () => void; + open(): void; + toggle(): void; + close(): void; + destroy(): void; } interface IRevealOptions { @@ -224,7 +224,7 @@ declare module Foundation { // http://foundation.zurb.com/sites/docs/slider.html#javascript-reference export interface Slider { - destroy: () => void; + destroy(): void; } interface ISliderOptions { @@ -246,10 +246,10 @@ declare module Foundation { // http://foundation.zurb.com/sites/docs/sticky.html#javascript-reference export interface Sticky { - _pauseListeners: (scrollListener:String) => void; - _calc: (checkSizes:boolean, scroll:number) => void; - destroy: () => void; - emCalc: (number:any) => void; + _pauseListeners(scrollListener:String): void; + _calc(checkSizes:boolean, scroll:number): void; + destroy(): void; + emCalc(number:any): void; } interface IStickyOptions { @@ -268,9 +268,9 @@ declare module Foundation { // http://foundation.zurb.com/sites/docs/tabs.html#javascript-reference export interface Tabs { - _handleTabChange: ($target:JQuery) => void; - selectTab: ($target:JQuery) => void; - destroy: () => void; + _handleTabChange($target:JQuery): void; + selectTab($target:JQuery): void; + destroy(): void; } interface ITabsOptions { @@ -279,8 +279,8 @@ declare module Foundation { // http://foundation.zurb.com/sites/docs/toggler.html#javascript-reference export interface Toggler { - toggle: () => void; - destroy: () => void; + toggle(): void; + destroy(): void; } interface ITogglerOptions { @@ -289,10 +289,10 @@ declare module Foundation { // http://foundation.zurb.com/sites/docs/tooltip.html#javascript-reference export interface Tooltip { - show: () => void; - hide: () =>void; - toggle: () => void; - destroy: () => void; + show(): void; + hide() =>void; + toggle(): void; + destroy(): void; } interface ITooltipOptions { @@ -316,26 +316,26 @@ declare module Foundation { // --------- export interface Box { - ImNotTouchingYou: (element:Object, parent?:Object, lrOnly?:boolean, tbOnly?:boolean) => boolean; - GetDimensions: (element:Object) => Object; - GetOffsets: (element:Object, anchor:Object, position:String, vOffset:number, hOffset:number, isOverflow:boolean) => Object; + ImNotTouchingYou(element:Object, parent?:Object, lrOnly?:boolean, tbOnly?:boolean): boolean; + GetDimensions(element:Object): Object; + GetOffsets(element:Object, anchor:Object, position:String, vOffset:number, hOffset:number, isOverflow:boolean): Object; } export interface KeyBoard { - parseKey: (event:any) => String; - findFocusable: ($element:Object) => Object; + parseKey(event:any): String; + findFocusable($element:Object): Object; } export interface MediaQuery { - get: (size:String) => String; - atLeast: (size:String) => boolean; + get(size:String): String; + atLeast(size:String): boolean; queries:Array; current:any; } export interface Motion { - animateIn: (element:Object, animation:any, cb:Function) => void; - animateOut: (element:Object, animation:any, cb:Function) => void; + animateIn(element:Object, animation:any, cb:Function): void; + animateOut(element:Object, animation:any, cb:Function): void; } interface Move { @@ -347,9 +347,9 @@ declare module Foundation { } export interface Timer { - start: () => void; - restart: () => void; - pause: () => void; + start(): void; + restart(): void; + pause(): void; } interface Touch { @@ -360,67 +360,55 @@ declare module Foundation { // TODO :extension on jQuery } - export interface InterChange { - destroy: () => void; - } - interface IInterChangeOptions { - rules ?: Array; - } - interface ITooltipOptions { - hoverDelay ?: number; - fadeInDuration ?: number; - fadeOutDuration ?: number; - disableHover ?: boolean; - templateClasses ?: String; - tooltipClass ?: String; - triggerClass ?: String; - showOn ?: String; - template ?: String; - tipText ?: String; - clickOpenr ?: boolean; - positionClass ?: String; - vOffset ?: number; - hOffset ?: number; - } - interface FoundationStatic { version : String; - rtl: () => boolean; - plugin: (plugin:Object, name:String) => void; - registerPlugin: (plugin:Object) => void; - unregisterPlugin: (plugin:Object) => void; - GetYoDigits: (length:number, namespace?:String) => String; - reflow: (elem:Object, plugins?:Array|String) => void; - getFnName: (fofn:String) => String; - transitionend: () => String; + rtl(): boolean; + plugin(plugin:Object, name:String): void; + registerPlugin(plugin:Object): void; + unregisterPlugin(plugin:Object): void; + GetYoDigits(length:number, namespace?:String): String; + reflow(elem:Object, plugins?:Array|String): void; + getFnName(fn:String): String; + transitionend(): String; util : { - throttle(func:(...args:any[]) => any, delay:number) : (...args:any[]) => any; + throttle(func:(...args:any[]) => any, delay:number) (...args:any[]) => any; }; - onImagesLoaded: (images:Object, cb:Function) => void; + onImagesLoaded(images:Object, cb:Function): void; - Abide: (element:Object, options:IAbideOptions) => void; - Accordion: (element:Object, options:IAccordionOptions) => void; - Dropdown: (element:Object, options:IDropdownOptions) => void; - DropdownMenu: (element:Object, options:IDropdownMenuOptions) => void; - Equalizer: (element:Object, options:IEqualizerOptions) => void; - Interchange: (element:Object, options:IInterChangeOptions) => void; - Magellan: (element:Object, options:IMagellanOptions) => void; - OffCanvas: (element:Object, options:IOffCanvasOptions) => void; - Orbit: (element:Object, options:IOrbitOptions) => void; - Reveal: (element:Object, options:IRevealOptions) => void; - Slider: (element:Object, options:ISliderOptions) => void; - Sticky: (element:Object, options:IStickyOptions) => void; - Tabs: (element:Object, options:ITabsOptions) => void; - Toggler: (element:Object, options:ITogglerOptions) => void; - Tooltip: (element:Object, options:ITooltipOptions) => void; + Abide(element:Object, options?:IAbideOptions): Foundation.Abide; + Accordion(element:Object, options?:IAccordionOptions): Foundation.Accordion; + Dropdown(element:Object, options?:IDropdownOptions): Foundation.Dropdown; + DropdownMenu(element:Object, options?:IDropdownMenuOptions): Foundation.DropdownMenu; + Equalizer(element:Object, options?:IEqualizerOptions): Foundation.Equalizer; + Interchange(element:Object, options?:IInterChangeOptions): Foundation.Interchange; + Magellan(element:Object, options?:IMagellanOptions): Foundation.Magellan; + OffCanvas(element:Object, options?:IOffCanvasOptions): Foundation.OffCanvas; + Orbit(element:Object, options?:IOrbitOptions): Foundation.Orbit; + Reveal(element:Object, options?:IRevealOptions): Foundation.Reveal; + Slider(element:Object, options?:ISliderOptions): Foundation.Slider; + Sticky(element:Object, options?:IStickyOptions): Foundation.Sticky; + Tabs(element:Object, options?:ITabsOptions): Foundation.Tabs; + Toggler(element:Object, options?:ITogglerOptions): Foundation.Toggler; + Tooltip(element:Object, options?:ITooltipOptions): Foundation.Tooltip; + + // utils + Box: Foundation.Box; + KeyBoard: Foundation.Box; + MediaQuery: Foundation.MediaQuery; + Motion: Foundation.Motion; + Move: Foundation.Move; + Nest: Foundation.Nest; + Timer: Foundation.Timer; + Touch: Foundation.Touch; + Triggers: Foundation.Triggers; } } interface JQuery { - foundation(method:String|Array) : JQuery; + foundation(method?:String|Array) : JQuery; } declare var Foundation:Foundation.FoundationStatic; diff --git a/foundation/foundation-tests.ts b/foundation/foundation-tests.ts index 9706fbf97..ff7bb015b 100644 --- a/foundation/foundation-tests.ts +++ b/foundation/foundation-tests.ts @@ -344,3 +344,4 @@ $(document).foundation("reflow"); plugin_list().forEach((plugin) => $(document).foundation(plugin, "reflow")); $(document).foundation("slider", "set_value", 100); +Foundatio From 326a957e9df792e9d184f7567820f1280ea5ad41 Mon Sep 17 00:00:00 2001 From: Sam Vloeberghs Date: Thu, 3 Dec 2015 11:20:18 +0100 Subject: [PATCH 280/389] update to tests --- foundation-sites/foundation-tests.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/foundation-sites/foundation-tests.ts b/foundation-sites/foundation-tests.ts index ca5bf283a..8daba37ac 100644 --- a/foundation-sites/foundation-tests.ts +++ b/foundation-sites/foundation-tests.ts @@ -11,7 +11,10 @@ $(document).foundation(); $(document).foundation('method'); $(document).foundation(['method', 'method2']); -function pluginList(){ +function pluginList() { + + 'use strict'; + return [ 'Abide', 'Accordion', From dc1a12df3ef2c2f308581a7b6c72ec717ddfde63 Mon Sep 17 00:00:00 2001 From: Sam Vloeberghs Date: Thu, 3 Dec 2015 11:20:41 +0100 Subject: [PATCH 281/389] update to tests --- foundation-sites/foundation-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foundation-sites/foundation-tests.ts b/foundation-sites/foundation-tests.ts index 8daba37ac..f7da5e49c 100644 --- a/foundation-sites/foundation-tests.ts +++ b/foundation-sites/foundation-tests.ts @@ -38,5 +38,5 @@ function pluginList() { pluginList().forEach((value:String) => { Foundation[value].($('.selector')); - Foundation[value].($('.selector'), {}, []); + Foundation[value].($('.selector'), {}); }); From 4e7e79f99f5acb6e17f310775f69ccc0b47ceb45 Mon Sep 17 00:00:00 2001 From: Sam Vloeberghs Date: Thu, 3 Dec 2015 11:22:02 +0100 Subject: [PATCH 282/389] update to change i shouldn't have done :) --- foundation/foundation-tests.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/foundation/foundation-tests.ts b/foundation/foundation-tests.ts index ff7bb015b..9706fbf97 100644 --- a/foundation/foundation-tests.ts +++ b/foundation/foundation-tests.ts @@ -344,4 +344,3 @@ $(document).foundation("reflow"); plugin_list().forEach((plugin) => $(document).foundation(plugin, "reflow")); $(document).foundation("slider", "set_value", 100); -Foundatio From 245c7df0958929a3e0e8bc05b2cd292217e8534d Mon Sep 17 00:00:00 2001 From: Harm Berntsen Date: Thu, 3 Dec 2015 13:00:04 +0100 Subject: [PATCH 283/389] Add module declaration for graham_scan --- graham_scan/graham_scan.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/graham_scan/graham_scan.d.ts b/graham_scan/graham_scan.d.ts index 617df2e7e..dbc30517b 100644 --- a/graham_scan/graham_scan.d.ts +++ b/graham_scan/graham_scan.d.ts @@ -6,3 +6,7 @@ declare class ConvexHullGrahamScan { addPoint(x: number, y: number): void; getHull(): {x: number, y: number}[]; } + +declare module 'graham_scan' { + export = ConvexHullGrahamScan; +} From 283cf3643ef1774fa0a95b1ab383a0efe3cf8eba Mon Sep 17 00:00:00 2001 From: Igor Kriklivetc Date: Thu, 3 Dec 2015 15:33:46 +0300 Subject: [PATCH 284/389] Update to 15.2.3 --- devextreme/devextreme-15.1.8.d.ts | 6580 +++++++++++++++++++++++++++++ devextreme/devextreme.d.ts | 1587 +++++-- 2 files changed, 7741 insertions(+), 426 deletions(-) create mode 100644 devextreme/devextreme-15.1.8.d.ts diff --git a/devextreme/devextreme-15.1.8.d.ts b/devextreme/devextreme-15.1.8.d.ts new file mode 100644 index 000000000..83e69504b --- /dev/null +++ b/devextreme/devextreme-15.1.8.d.ts @@ -0,0 +1,6580 @@ +// Type definitions for DevExtreme 15.1.8 +// Project: http://js.devexpress.com/ +// Definitions by: DevExpress Inc. +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module DevExpress { + /** A mixin that provides a capability to fire and subscribe to events. */ + export interface EventsMixin { + /** Subscribes to a specified event. */ + on(eventName: string, eventHandler: Function): T; + /** Subscribes to the specified events. */ + on(events: { [eventName: string]: Function; }): T; + /** Detaches all event handlers from the specified event. */ + off(eventName: string): Object; + /** Detaches a particular event handler from the specified event. */ + off(eventName: string, eventHandler: Function): T; + } + /** An object that serves as a namespace for the methods required to perform validation. */ + export module validationEngine { + export interface IValidator { + validate(): ValidatorValidationResult; + reset(): void; + } + export interface ValidatorValidationResult { + isValid: boolean; + name?: string; + value: any; + brokenRule: any; + validationRules: any[]; + } + export interface ValidationGroupValidationResult { + isValid: boolean; + brokenRules: any[]; + validators: IValidator[]; + } + export interface GroupConfig extends EventsMixin { + group: any; + validators: IValidator[]; + validate(): ValidationGroupValidationResult; + reset(): void; + } + /** Provides access to the object that represents the specified validation group. */ + export function getGroupConfig(group: any): GroupConfig + /** Provides access to the object that represents the default validation group. */ + export function getGroupConfig(): GroupConfig + /** Validates rules of the validators that belong to the specified validation group. */ + export function validateGroup(group: any): ValidationGroupValidationResult; + /** Validates rules of the validators that belong to the default validation group. */ + export function validateGroup(): ValidationGroupValidationResult; + /** Resets the values and validation result of the editors that belong to the specified validation group. */ + export function resetGroup(group: any): void; + /** Resets the values and validation result of the editors that belong to the default validation group. */ + export function resetGroup(): void; + /** Validates the rules that are defined within the dxValidator objects that are registered for the specified ViewModel. */ + export function validateModel(model: Object): ValidationGroupValidationResult; + /** Registers all the dxValidator objects by which the fields of the specified ViewModel are extended. */ + export function registerModelForValidation(model: Object) : void; + } + export var hardwareBackButton: JQueryCallback; + /** Processes the hardware back button click. */ + export function processHardwareBackButton(): void; + /** Hides the last displayed overlay widget. */ + export function hideTopOverlay(): boolean; + /** Specifies whether or not the entire application/site supports right-to-left representation. */ + export var rtlEnabled: boolean; + /** Registers a new component in the DevExpress.ui namespace as a jQuery plugin, Angular directive and Knockout binding. */ + export function registerComponent(name: string, componentClass: Object): void; + /** Registers a new component in the specified namespace as a jQuery plugin, Angular directive and Knockout binding. */ + export function registerComponent(name: string, namespace: Object, componentClass: Object): void; + /** Requests that the browser call a specified function to update animation before the next repaint. */ + export function requestAnimationFrame(callback: Function): number; + /** Cancels an animation frame request scheduled with the requestAnimationFrame method. */ + export function cancelAnimationFrame(requestID: number): void; + /** Custom Knockout binding that links an HTML element with a specific action. */ + export class Action { } + /** Used to get URLs that vary in a locally running application and the application running on production. */ + export class EndpointSelector { + constructor(options: { + [key: string]: { + local?: string; + production?: string; + } + }); + /** Returns a local or a productional URL depending on how the application is currently running. */ + urlFor(key: string): string; + } + /** An object that serves as a namespace for the methods that are used to animate UI elements. */ + export module fx { + /** Defines animation options. */ + export interface AnimationOptions { + /** A function called after animation is completed. */ + complete?: (element: JQuery, config: AnimationOptions) => void; + /** A number specifying wait time before animation execution. */ + delay?: number; + /** A number specifying the time period to wait before the animation of the next stagger item starts. */ + staggerDelay?: number; + /** A number specifying the time in milliseconds spent on animation. */ + duration?: number; + /** A string specifying the type of an easing function used for animation. */ + easing?: string; + /** Specifies the initial animation state. */ + from?: any; + /** A function called before animation is started. */ + start?: (element: JQuery, config: AnimationOptions) => void; + /** Specifies a final animation state. */ + to?: any; + /** A string value specifying the animation type. */ + type?: string; + /** Specifies the animation direction for the "slideIn" and "slideOut" animation types. */ + direction?: string; + } + /** Animates the specified element. */ + export function animate(element: HTMLElement, config: AnimationOptions): Object; + /** Returns a value indicating whether the specified element is being animated. */ + export function isAnimating(element: HTMLElement): boolean; + /** Stops the animation. */ + export function stop(element: HTMLElement, jumpToEnd: boolean): void; + } + /** The manager that performs several specified animations at a time. */ + export class TransitionExecutor { + /** Deletes all the animations registered in the Transition Executor by using the enter(elements, animation) and leave(elements, animation) methods. */ + reset(): void; + /** Registers a set of elements that should be animated as "entering" using the specified animation configuration. */ + enter(elements: JQuery, animation: any): void; + /** Registers a set of elements that should be animated as "leaving" using the specified animation configuration. */ + leave(elements: JQuery, animation: any): void; + /** Starts all the animations registered using the enter(elements, animation) and leave(elements, animation) methods beforehand. */ + start(config: Object): JQueryPromise; + } + export class AnimationPresetCollection { + /** Resets all the changes made in the animation repository. */ + resetToDefaults(): void; + /** Deletes the specified animation or clears all the animation repository, if an animation name is not passed. */ + clear(name: string): void; + /** Adds the specified animation preset to the animation repository by the specified name. */ + registerPreset(name: string, config: any): void; + /** Applies the changes made in the animation repository. */ + applyChanges(): void; + /** Returns the configuration of the animation found in the animation repository by the specified name for the current device. */ + getPreset(name: string): void; + /** Registers predefined animations in the animation repository. */ + registerDefaultPresets(): void; + } + /** A repository of animations. */ + export var animationPresets: AnimationPresetCollection; + /** The device object defines the device on which the application is running. */ + export interface Device { + /** Indicates whether or not the device platform is Android. */ + android?: boolean; + /** Specifies the type of the device on which the application is running. */ + deviceType?: string; + /** Indicates whether or not the device platform is generic, which means that the application will look and behave according to a generic "light" or "dark" theme. */ + generic?: boolean; + /** Indicates whether or not the device platform is iOS. */ + ios?: boolean; + /** Indicates whether or not the device type is 'phone'. */ + phone?: boolean; + /** Specifies the platform of the device on which the application is running. */ + platform?: string; + /** Indicates whether or not the device type is 'tablet'. */ + tablet?: boolean; + /** Specifies an array with the major and minor versions of the device platform. */ + version?: Array; + /** Indicates whether or not the device platform is Windows8. */ + win8?: boolean; + /** Specifies a performance grade of the current device. */ + grade?: string; + } + export class Devices implements EventsMixin { + constructor(options: { window: Window }); + /** Overrides actual device information to force the application to operate as if it was running on the specified device. */ + current(deviceName: any): void; + /** Returns information about the current device. */ + current(): Device; + orientationChanged: JQueryCallback; + /** Returns the current device orientation. */ + orientation(): string; + /** Returns real information about the current device regardless of the value passed to the devices.current(deviceName) method. */ + real(): Device; + on(eventName: "orientationChanged", eventHandler: (e: { orientation: string }) => void): Devices; + on(eventName: string, eventHandler: Function): Devices; + on(events: { [eventName: string]: Function; }): Devices; + off(eventName: "orientationChanged"): Devices; + off(eventName: string): Devices; + off(eventName: "orientationChanged", eventHandler: (e: { orientation: string }) => void): Devices; + off(eventName: string, eventHandler: Function): Devices; + } + /** An object that serves as a namespace for the methods and events specifying information on the current device. */ + export var devices: Devices; + /** The position object specifies the widget positioning options. */ + export interface PositionOptions { + /** The target element position that the widget is positioned against. */ + at?: string; + /** The element within which the widget is positioned. */ + boundary?: Element; + /** A string value holding horizontal and vertical offset from the window's boundaries. */ + boundaryOffset?: string; + /** Specifies how to move the widget if it overflows the screen. */ + collision?: any; + /** The position of the widget to align against the target element. */ + my?: string; + /** The target element that the widget is positioned against. */ + of?: HTMLElement; + /** A string value holding horizontal and vertical offset in pixels, separated by a space (e.g., "5 -10"). */ + offset?: string; + } + export interface ComponentOptions { + /** A handler for the initialized event. */ + onInitialized?: Function; + /** A handler for the optionChanged event. */ + onOptionChanged?: Function; + /** A handler for the disposing event. */ + onDisposing?: Function; + } + /** A base class for all components and widgets. */ + export class Component { + constructor(options?: ComponentOptions) + /** Prevents the component from refreshing until the endUpdate method is called. */ + beginUpdate(): void; + /** Enables the component to refresh after the beginUpdate method call. */ + endUpdate(): void; + /** Returns an instance of this component class. */ + instance(): Component; + /** Returns the configuration options of this component. */ + option(): { + [optionKey: string]: any; + }; + /** Sets one or more options of this component. */ + option(options: { + [optionKey: string]: any; + }): void; + /** Gets the value of the specified configuration option of this component. */ + option(optionName: string): any; + /** Sets a value to the specified configuration option of this component. */ + option(optionName: string, optionValue: any): void; + } + export interface DOMComponentOptions extends ComponentOptions { + /** Specifies whether or not the current component supports a right-to-left representation. */ + rtlEnabled?: boolean; + /** Specifies the height of the widget. */ + height?: any; + /** Specifies the width of the widget. */ + width?: any; + } + /** A base class for all components. */ + export class DOMComponent extends Component { + constructor(element: JQuery, options?: DOMComponentOptions); + constructor(element: HTMLElement, options?: DOMComponentOptions); + /** Returns the root HTML element of the widget. */ + element(): JQuery; + /** Specifies the device-dependent default configuration options for this component. */ + static defaultOptions(rule: { + device?: any; + options?: any; + }): void; + } + export module data { + export interface ODataError extends Error { + httpStatus?: number; + errorDetails?: any; + } + export interface StoreOptions { + inserted?: (values: Object, key: any) => void; + inserting?: (values: Object) => void; + loaded?: (result: Array) => void; + loading?: (loadOptions: LoadOptions) => void; + modified?: () => void; + modifying?: () => void; + removed?: (key: any) => void; + removing?: (key: any) => void; + updated?: (key: any, values: Object) => void; + updating?: (key: any, values: Object) => void; + /** A handler for the modified event. */ + onModified?: () => void; + /** A handler for the modifying event. */ + onModifying?: () => void; + /** A handler for the removed event. */ + onRemoved?: (key: any) => void; + /** A handler for the removing event. */ + onRemoving?: (key: any) => void; + /** A handler for the updated event. */ + onUpdated?: (key: any, values: Object) => void; + /** A handler for the updating event. */ + onUpdating?: (key: any, values: Object) => void; + /** A handler for the loaded event. */ + onLoaded?: (result: Array) => void; + /** A handler for the loading event. */ + onLoading?: (loadOptions: LoadOptions) => void; + /** A handler for the inserted event. */ + onInserted?: (values: Object, key: any) => void; + /** A handler for the inserting event. */ + onInserting?: (values: Object) => void; + /** Specifies the function called when the Store causes an error. */ + errorHandler?: (e: Error) => void; + /** Specifies the key properties within the data associated with the Store. */ + key?: any; + } + export interface LoadOptions { + filter?: Object; + sort?: Object; + select?: Object; + expand?: Object; + group?: Object; + skip?: number; + take?: number; + userData?: Object; + requireTotalCount?: boolean; + } + /** The base class for all Stores. */ + export class Store implements EventsMixin { + inserted: JQueryCallback; + inserting: JQueryCallback; + loaded: JQueryCallback; + loading: JQueryCallback; + modified: JQueryCallback; + modifying: JQueryCallback; + removed: JQueryCallback; + removing: JQueryCallback; + updated: JQueryCallback; + updating: JQueryCallback; + constructor(options?: StoreOptions); + /** Returns the data item specified by the key. */ + byKey(key: any): JQueryPromise; + /** Adds an item to the data associated with this Store. */ + insert(values: Object): JQueryPromise; + /** Returns the key expression specified via the key configuration option. */ + key(): any; + /** Returns the key of the Store item that matches the specified object. */ + keyOf(obj: Object): any; + /** Starts loading data. */ + load(obj?: LoadOptions): JQueryPromise; + /** Removes the data item specified by the key. */ + remove(key: any): JQueryPromise; + /** Obtains the total count of items that will be returned by the load() function. */ + totalCount(options?: { + filter?: Object; + group?: Object; + }): JQueryPromise; + /** Updates the data item specified by the key. */ + update(key: any, values: Object): JQueryPromise; + on(eventName: "removing", eventHandler: (key: any) => void): Store; + on(eventName: "removed", eventHandler: (key: any) => void): Store; + on(eventName: "updating", eventHandler: (key: any, values: Object) => void): Store; + on(eventName: "updated", eventHandler: (key: any, values: Object) => void): Store; + on(eventName: "inserting", eventHandler: (values: Object) => void): Store; + on(eventName: "inserted", eventHandler: (values: Object, key: any) => void): Store; + on(eventName: "modifying", eventHandler: () => void): Store; + on(eventName: "modified", eventHandler: () => void): Store; + on(eventName: "loading", eventHandler: (loadOptions: LoadOptions) => void): Store; + on(eventName: "loaded", eventHandler: (result: Array) => void): Store; + on(eventName: string, eventHandler: Function): Store; + on(events: { [eventName: string]: Function; }): Store; + off(eventName: "removing"): Store; + off(eventName: "removed"): Store; + off(eventName: "updating"): Store; + off(eventName: "updated"): Store; + off(eventName: "inserting"): Store; + off(eventName: "inserted"): Store; + off(eventName: "modifying"): Store; + off(eventName: "modified"): Store; + off(eventName: "loading"): Store; + off(eventName: "loaded"): Store; + off(eventName: string): Store; + off(eventName: "removing", eventHandler: (key: any) => void): Store; + off(eventName: "removed", eventHandler: (key: any) => void): Store; + off(eventName: "updating", eventHandler: (key: any, values: Object) => void): Store; + off(eventName: "updated", eventHandler: (key: any, values: Object) => void): Store; + off(eventName: "inserting", eventHandler: (values: Object) => void): Store; + off(eventName: "inserted", eventHandler: (values: Object, key: any) => void): Store; + off(eventName: "modifying", eventHandler: () => void): Store; + off(eventName: "modified", eventHandler: () => void): Store; + off(eventName: "loading", eventHandler: (loadOptions: LoadOptions) => void): Store; + off(eventName: "loaded", eventHandler: (result: Array) => void): Store; + off(eventName: string, eventHandler: Function): Store; + } + export interface ArrayStoreOptions extends StoreOptions { + /** Specifies the array associated with this Store. */ + data?: Array; + } + /** A Store accessing an in-memory array. */ + export class ArrayStore extends Store { + constructor(options?: ArrayStoreOptions); + /** Clears all data associated with the current ArrayStore. */ + clear(): void; + /** Creates the Query object for the underlying array. */ + createQuery(): Query; + } + interface Promise { + then(doneFn?: Function, failFn?: Function, progressFn?: Function): Promise; + } + export interface CustomStoreOptions extends StoreOptions { + /** The user implementation of the byKey(key, extraOptions) method. */ + byKey?: (key: any) => Promise; + /** The user implementation of the insert(values) method. */ + insert?: (values: Object) => Promise; + /** The user implementation of the load(options) method. */ + load?: (options?: LoadOptions) => Promise; + /** The user implementation of the remove(key) method. */ + remove?: (key: any) => Promise; + /** The user implementation of the totalCount(options) method. */ + totalCount?: (options?: { + filter?: Object; + group?: Object; + }) => Promise; + /** The user implementation of the update(key, values) method. */ + update?: (key: any, values: Object) => Promise; + } + /** A Store object that enables you to implement your own data access logic. */ + export class CustomStore extends Store { + constructor(options: CustomStoreOptions); + } + export interface DataSourceOptions { + /** Specifies data filtering conditions. */ + filter?: Object; + /** Specifies data grouping conditions. */ + group?: Object; + /** The item mapping function. */ + map?: (record: any) => any; + /** Specifies the maximum number of items the page can contain. */ + pageSize?: number; + /** Specifies whether a DataSource loads data by pages, or all items at once. */ + paginate?: boolean; + /** The data post processing function. */ + postProcess?: (data: any[]) => any[]; + /** Specifies a value by which the required items are searched. */ + searchExpr?: Object; + /** Specifies the comparison operation used to search for the required items. */ + searchOperation?: string; + /** Specifies the value to which the search expression is compared. */ + searchValue?: Object; + /** Specifies the initial select option value. */ + select?: Object; + /** An array of the strings that represent the names of the navigation properties to be loaded simultaneously with the OData store's entity. */ + expand?: Object; + /** Specifies whether or not the DataSource instance requests the total count of items available in the storage. */ + requireTotalCount?: boolean; + /** Specifies the initial sort option value. */ + sort?: Object; + /** Specifies the underlying Store instance used to access data. */ + store?: any; + /** A handler for the changed event. */ + onChanged?: () => void; + /** A handler for the loadingChanged event. */ + onLoadingChanged?: (isLoading: boolean) => void; + /** A handler for the loadError event. */ + onLoadError?: (e?: Error) => void; + } + /** An object that provides access to a data web service or local data storage for collection container widgets. */ + export class DataSource implements EventsMixin { + constructor(options?: DataSourceOptions); + changed: JQueryCallback; + loadError: JQueryCallback; + loadingChanged: JQueryCallback; + /** Disposes all resources associated with this DataSource. */ + dispose(): void; + /** Returns the current filter option value. */ + filter(): Object; + /** Sets the filter option value. */ + filter(filterExpr: Object): void; + /** Returns the current group option value. */ + group(): Object; + /** Sets the group option value. */ + group(groupExpr: Object): void; + /** Indicates whether or not the current page contains fewer items than the number of items specified by the pageSize configuration option. */ + isLastPage(): boolean; + /** Indicates whether or not at least one load() method execution has successfully finished. */ + isLoaded(): boolean; + /** Indicates whether or not the DataSource is currently being loaded. */ + isLoading(): boolean; + /** Returns the array of items currently operated by the DataSource. */ + items(): Array; + /** Returns the key expression. */ + key(): any; + /** Starts loading data. */ + load(): JQueryPromise>; + /** Returns an object that would be passed to the load() method of the underlying Store according to the current data shaping option values of the current DataSource instance. */ + loadOptions(): Object; + /** Returns the current pageSize option value. */ + pageSize(): number; + /** Sets the pageSize option value. */ + pageSize(value: number): void; + /** Specifies the index of the currently loaded page. */ + pageIndex(): number; + /** Specifies the index of the page to be loaded during the next load() method execution. */ + pageIndex(newIndex: number): void; + /** Returns the current paginate option value. */ + paginate(): boolean; + /** Sets the paginate option value. */ + paginate(value: boolean): void; + /** Returns the searchExpr option value. */ + searchExpr(): Object; + /** Sets the searchExpr option value. */ + searchExpr(expr: Object): void; + /** Returns the currently specified search operation. */ + searchOperation(): string; + /** Sets the current search operation. */ + searchOperation(op: string): void; + /** Returns the searchValue option value. */ + searchValue(): Object; + /** Sets the searchValue option value. */ + searchValue(value: Object): void; + /** Returns the current select option value. */ + select(): Object; + /** Sets the select option value. */ + select(expr: Object): void; + /** Returns the current requireTotalCount option value. */ + requireTotalCount(): boolean; + /** Sets the requireTotalCount option value. */ + requireTotalCount(value: boolean): void; + /** Returns the current sort option value. */ + sort(): Object; + /** Sets the sort option value. */ + sort(sortExpr: Object): void; + /** Returns the underlying Store instance. */ + store(): Store; + /** Returns the number of data items available in an underlying Store after the last load() operation without paging. */ + totalCount(): number; + on(eventName: "loadingChanged", eventHandler: (isLoading: boolean) => void): DataSource; + on(eventName: "loadError", eventHandler: (e?: Error) => void): DataSource; + on(eventName: "changed", eventHandler: () => void): DataSource; + on(eventName: string, eventHandler: Function): DataSource; + on(events: { [eventName: string]: Function; }): DataSource; + off(eventName: "loadingChanged"): DataSource; + off(eventName: "loadError"): DataSource; + off(eventName: "changed"): DataSource; + off(eventName: string): DataSource; + off(eventName: "loadingChanged", eventHandler: (isLoading: boolean) => void): DataSource; + off(eventName: "loadError", eventHandler: (e?: Error) => void): DataSource; + off(eventName: "changed", eventHandler: () => void): DataSource; + off(eventName: string, eventHandler: Function): DataSource; + } + /** An object used to work with primitive data types not supported by JavaScript when accessing an OData web service. */ + export class EdmLiteral { + /** Creates an EdmLiteral instance and assigns the specified value to it. */ + constructor(value: string); + /** Returns a string representation of the value associated with this EdmLiteral object. */ + valueOf(): string; + } + /** An object used to generate and hold the GUID. */ + export class Guid { + /** Creates a new Guid instance that holds the specified GUID. */ + constructor(value: string); + /** Creates a new Guid instance holding the generated GUID. */ + constructor(); + /** Returns a string representation of the Guid instance. */ + toString(): string; + /** Returns a string representation of the Guid instance. */ + valueOf(): string; + } + export interface LocalStoreOptions extends ArrayStoreOptions { + /** Specifies the time (in miliseconds) after the change operation, before the data is flushed. */ + flushInterval?: number; + /** Specifies whether the data is flushed immediatelly after each change operation, or after the delay specified via the flushInterval option. */ + immediate?: boolean; + /** The unique identifier used to distinguish the data within the HTML5 Web Storage. */ + name?: string; + } + /** A Store providing access to the HTML5 Web Storage. */ + export class LocalStore extends ArrayStore { + constructor(options?: LocalStoreOptions); + /** Removes all data associated with this Store. */ + clear(): void; + } + export interface ODataContextOptions extends ODataStoreOptions { + /** Specifies the list of entities to be accessed via the ODataContext. */ + entities?: Object; + /** Specifies the function called if the ODataContext causes an error. */ + errorHandler?: (e: Error) => void; + } + /** Provides access to the entire OData service. */ + export class ODataContext { + constructor(options?: ODataContextOptions); + /** Initiates the specified WebGet service operation that returns a value. For the information on service operations, refer to the OData documentation. */ + get(operationName: string, params: Object): JQueryPromise; + /** Initiates the specified WebGet service operation that returns nothing. For the information on service operations, refer to the OData documentation. */ + invoke(operationName: string, params: Object, httpMethod: Object): JQueryPromise; + /** Return a special proxy object to describe the entity link. */ + objectLink(entityAlias: string, key: any): Object; + } + export interface ODataStoreOptions extends StoreOptions { + /** A function used to customize a web request before it is sent. */ + beforeSend?: (request: { + url: string; + method: string; + timeout: number; + params: Object; + payload: Object; + headers: Object; + }) => void; + /** Specifies whether the ODataStore uses the JSONP approach to access non-CORS-compatible remote services. */ + jsonp?: boolean; + /** Specifies the type of the ODataStore key property. The following key types are supported out of the box: String, Int32, Int64, and Guid. */ + keyType?: any; + /** Specifies the URL of the data service being accessed via the current ODataContext. */ + url?: string; + /** Specifies the version of the OData protocol used to interact with the data service. */ + version?: number; + /** Specifies the value of the withCredentials field of the underlying jqXHR object. */ + withCredentials?: boolean; + } + /** A Store providing access to a separate OData web service entity. */ + export class ODataStore extends Store { + constructor(options?: ODataStoreOptions); + /** Creates the Query object for the OData endpoint. */ + createQuery(loadOptions: Object): Object; + /** Returns the data item specified by the key. */ + byKey(key: any, extraOptions?: { expand?: Object }): JQueryPromise; + } + /** An universal chainable data query interface object. */ + export interface Query { + /** Calculates a custom summary for the items in the current Query. */ + aggregate(step: (accumulator: any, value: any) => any): JQueryPromise; + /** Calculates a custom summary for the items in the current Query. */ + aggregate(seed: any, step: (accumulator: any, value: any) => any, finalize: (result: any) => any): JQueryPromise; + /** Calculates the average item value for the current Query. */ + avg(getter: Object): JQueryPromise; + /** Finds the item with the maximum getter value. */ + max(getter: Object): JQueryPromise; + /** Finds the item with the maximum value in the Query. */ + max(): JQueryPromise; + /** Finds the item with the minimum value in the Query. */ + min(): JQueryPromise; + /** Finds the item with the minimum getter value. */ + min(getter: Object): JQueryPromise; + /** Calculates the average item value for the current Query, if each Query item has a numeric type. */ + avg(): JQueryPromise; + /** Returns the total count of items in the current Query. */ + count(): JQueryPromise; + /** Executes the Query. */ + enumerate(): JQueryPromise; + /** Filters the current Query data. */ + filter(criteria: Array): Query; + /** Groups the current Query data. */ + groupBy(getter: Object): Query; + /** Applies the specified transformation to each item. */ + select(getter: Object): Query; + /** Limits the data item count. */ + slice(skip: number, take?: number): Query; + /** Sorts current Query data. */ + sortBy(getter: Object, desc: boolean): Query; + /** Sorts current Query data. */ + sortBy(getter: Object): Query; + /** Calculates the sum of item getter values in the current Query. */ + sum(getter: Object): JQueryPromise; + /** Calculates the sum of item values in the current Query. */ + sum(): JQueryPromise; + /** Adds one more sorting condition to the current Query. */ + thenBy(getter: Object): Query; + /** Adds one more sorting condition to the current Query. */ + thenBy(getter: Object, desc: boolean): Query; + /** Returns the array of current Query items. */ + toArray(): Array; + } + /** The global data layer error handler. */ + export var errorHandler: (e: Error) => void; + /** Encodes the specified string or array of bytes to base64 encoding. */ + export function base64_encode(input: any): string; + /** Creates a Query instance. */ + export function query(array: Array): Query; + /** Creates a Query instance for accessing the remote service specified by a URL. */ + export function query(url: string, queryOptions: Object): Query; + /** This section describes the utility objects provided by the DevExtreme data layer. */ + export var utils: { + /** Compiles a getter function from the getter expression. */ + compileGetter(expr: any): Function; + /** Compiles a setter function from the setter expression. */ + compileSetter(expr: any): Function; + odata: { + /** Holds key value converters for OData. */ + keyConverters: { + String(value: any): string; + Int32(value: any): number; + Int64(value: any): EdmLiteral; + Guid(value: any): Guid; + Boolean(value: any): boolean; + Single(value: any): EdmLiteral; + Decimal(value: any): EdmLiteral; + }; + } + } + } + /** An object that serves as a namespace for DevExtreme UI widgets as well as for methods implementing UI logic in DevExtreme sites/applications. */ + export module ui { + export interface WidgetOptions extends DOMComponentOptions { + /** A Boolean value specifying whether or not the widget changes its state when interacting with a user. */ + activeStateEnabled?: boolean; + /** A Boolean value specifying whether or not the widget can respond to user interaction. */ + disabled?: boolean; + /** A Boolean value specifying whether or not the widget changes its state when being hovered by an end user. */ + hoverStateEnabled?: boolean; + /** Specifies whether or not the widget can be focused. */ + focusStateEnabled?: boolean; + /** Specifies a shortcut key that sets focus on the widget element. */ + accessKey?: string; + /** A Boolean value specifying whether or not the widget is visible. */ + visible?: boolean; + /** Specifies the widget tab index. */ + tabIndex?: number; + /** Specifies the text of the hint displayed for the widget. */ + hint?: string; + } + /** The base class for widgets. */ + export class Widget extends DOMComponent { + constructor(options?: WidgetOptions); + /** Redraws the widget. */ + repaint(): void; + /** Sets focus on the widget. */ + focus(): void; + /** Registers a handler when a specified key is pressed. */ + registerKeyHandler(key: string, handler: Function): void; + } + export interface CollectionWidgetOptions extends WidgetOptions { + /** A data source used to fetch data to be displayed by the widget. */ + dataSource?: any; + itemClickAction?: any; + itemHoldAction?: Function; + /** The time period in milliseconds before the onItemHold event is raised. */ + itemHoldTimeout?: number; + itemRender?: any; + itemRenderedAction?: Function; + /** An array of items displayed by the widget. */ + items?: Array; + /** + * A function performed when a widget item is selected. + * @deprecated onSelectionChanged.md + */ + itemSelectAction?: Function; + /** The template to be used for rendering items. */ + itemTemplate?: any; + loopItemFocus?: boolean; + /** The text or HTML markup displayed by the widget if the item collection is empty. */ + noDataText?: string; + onContentReady?: any; + contentReadyAction?: any; + /** A handler for the itemClick event. */ + onItemClick?: any; + /** A handler for the itemContextMenu event. */ + onItemContextMenu?: Function; + /** A handler for the itemHold event. */ + onItemHold?: Function; + /** A handler for the itemRendered event. */ + onItemRendered?: Function; + /** A handler for the selectionChanged event. */ + onSelectionChanged?: Function; + /** The index of the currently selected widget item. */ + selectedIndex?: number; + /** The selected item object. */ + selectedItem?: Object; + /** An array of currently selected item objects. */ + selectedItems?: Array; + /** A handler for the itemDeleting event. */ + onItemDeleting?: Function; + /** A handler for the itemDeleted event. */ + onItemDeleted?: Function; + /** A handler for the itemReordered event. */ + onItemReordered?: Function; + } + /** The base class for widgets containing an item collection. */ + export class CollectionWidget extends Widget { + constructor(element: JQuery, options?: CollectionWidgetOptions); + constructor(element: HTMLElement, options?: CollectionWidgetOptions); + selectItem(itemElement: any): void; + unselectItem(itemElement: any): void; + deleteItem(itemElement: any): JQueryPromise; + isItemSelected(itemElement: any): boolean; + reorderItem(itemElement: any, toItemElement: any): JQueryPromise; + } + export interface DataExpressionMixinOptions { + /** A data source used to fetch data to be displayed by the widget. */ + dataSource?: any; + /** Specifies the name of the data source item field whose value is displayed by the widget. */ + displayExpr?: any; + /** Specifies the name of a data source item field whose value is held in the value configuration option. */ + valueExpr?: any; + itemRender?: any; + /** An array of items displayed by the widget. */ + items?: Array; + /** The template to be used for rendering items. */ + itemTemplate?: any; + /** The currently selected value in the widget. */ + value?: Object; + } + export interface EditorOptions extends WidgetOptions { + /** The currently specified value. */ + value?: Object; + /** A handler for the valueChanged event. */ + onValueChanged?: Function; + valueChangeAction?: Function; + /** A Boolean value specifying whether or not the widget is read-only. */ + readOnly?: boolean; + /** Holds the object that defines the error that occurred during validation. */ + validationError?: Object; + /** Specifies whether the editor's value is valid. */ + isValid?: boolean; + /** Specifies how the message about the validation rules that are not satisfied by this editor's value is displayed. */ + validationMessageMode?: string; + } + /** A base class for editors. */ + export class Editor extends Widget { + /** Resets the editor's value to undefined. */ + reset(): void; + } + /** An object that serves as a namespace for methods displaying a message in an application/site. */ + export var dialog: { + /** Creates an alert dialog message containing a single "OK" button. */ + alert(message: string, title: string): JQueryPromise; + /** Creates a confirm dialog that contains "Yes" and "No" buttons. */ + confirm(message: string, title: string): JQueryPromise; + /** Creates a custom dialog using the options specified by the passed configuration object. */ + custom(options: { title?: string; message?: string; buttons?: Array; }): { + show(): JQueryPromise; + hide(): void; + hide(value: any): void; + }; + }; + /** Creates a toast message. */ + export function notify(message: any, type: string, displayTime: number): void; + /** Creates a toast message. */ + export function notify(options: Object): void; + /** An object that serves as a namespace for the methods that work with DevExtreme CSS Themes. */ + export var themes: { + /** Returns the name of the currently applied theme. */ + current(): string; + /** Changes the current theme to the specified one. */ + current(themeName: string): void; + }; + /** Sets a specified template engine. */ + export function setTemplateEngine(name: string): void; + /** Sets a custom template engine defined via custom compile and render functions. */ + export function setTemplateEngine(options: Object): void; + } + /** An object that serves as a namespace for utility methods that can be helpful when working with the DevExtreme framework and UI widgets. */ + export var utils: { + /** Sets parameters for the viewport meta tag. */ + initMobileViewport(options: { allowZoom?: boolean; allowPan?: boolean; allowSelection?: boolean }): void; + }; + /** An object that serves as a namespace for DevExtreme Data Visualization Widgets. */ + export module viz { + /** Applies a theme for the entire page with several DevExtreme visualization widgets. */ + export function currentTheme(theme: string): void; + /** Applies a new theme (with the color scheme defined separately) for the entire page with several DevExtreme visualization widgets. */ + export function currentTheme(platform: string, colorScheme: string): void; + /** Registers a new theme based on the existing one. */ + export function registerTheme(customTheme: Object, baseTheme: string): void; + /** Applies a predefined or registered custom palette to all visualization widgets at once. */ + export function currentPalette(paletteName: string): void; + /** Obtains the color sets of a predefined or registered palette. */ + export function getPalette(paletteName: string): Object; + /** Registers a new palette. */ + export function registerPalette(paletteName: string, palette: Object): void; + } +} +declare module DevExpress.ui { + export interface dxValidatorOptions extends DOMComponentOptions { + /** An array of validation rules to be checked for the editor with which the dxValidator object is associated. */ + validationRules?: Array; + /** Specifies the editor name to be used in the validation default messages. */ + name?: string; + /** An object that specifies what and when to validate and how to apply the validation result. */ + adapter?: Object; + /** Specifies the validation group the editor will be related to. */ + validationGroup?: string; + /** A handler for the validated event. */ + onValidated?: (params: validationEngine.ValidatorValidationResult) => void; + } + /** A widget that is used to validate the associated DevExtreme editors against the defined validation rules. */ + export class dxValidator extends DOMComponent implements validationEngine.IValidator { + constructor(element: JQuery, options?: dxValidatorOptions); + constructor(element: Element, options?: dxValidatorOptions); + /** Validates the value of the editor that is controlled by the current dxValidator object against the list of the specified validation rules. */ + validate(): validationEngine.ValidatorValidationResult; + /** Resets the value and validation result of the editor associated with the current dxValidator object. */ + reset(): void; + } + /** The widget that is used in the Knockout and Angular approaches to combine the editors to be validated. */ + export class dxValidationGroup extends DOMComponent { + constructor(element: JQuery); + constructor(element: Element); + /** Validates rules of the validators that belong to the current validation group. */ + validate(): validationEngine.ValidationGroupValidationResult; + /** Resets the value and validation result of the editors that are included to the current validation group. */ + reset(): void; + } + export interface dxValidationSummaryOptions extends CollectionWidgetOptions { + /** Specifies the validation group for which summary should be generated. */ + validationGroup?: string; + } + /** A widget for displaying the result of checking validation rules for editors. */ + export class dxValidationSummary extends CollectionWidget { + constructor(element: JQuery, options?: dxValidationSummaryOptions); + constructor(element: Element, options?: dxValidationSummaryOptions); + } + export interface dxResizableOptions extends DOMComponentOptions { + /** Specifies which borders of the widget element are used as a handle. */ + handles?: string; + /** Specifies the lower width boundary for resizing. */ + minWidth?: number; + /** Specifies the upper width boundary for resizing. */ + maxWidth?: number; + /** Specifies the lower height boundary for resizing. */ + minHeight?: number; + /** Specifies the upper height boundary for resizing. */ + maxHeight?: number; + /** A handler for the resizeStart event. */ + onResizeStart?: Function; + /** A handler for the resize event. */ + onResize?: Function; + /** A handler for the resizeEnd event. */ + onResizeEnd?: Function; + } + /** A widget that displays required content in a resizable element. */ + export class dxResizable extends DOMComponent { + constructor(element: JQuery, options?: dxResizableOptions); + constructor(element: Element, options?: dxResizableOptions); + } + export interface dxTooltipOptions extends dxPopoverOptions { + } + /** A tooltip widget. */ + export class dxTooltip extends dxPopover { + constructor(element: JQuery, options?: dxTooltipOptions); + constructor(element: Element, options?: dxTooltipOptions); + } + export interface dxDropDownListOptions extends dxDropDownEditorOptions, DataExpressionMixinOptions { + /** Returns the value currently displayed by the widget. */ + displayValue?: string; + /** The minimum number of characters that must be entered into the text box to begin a search. */ + minSearchLength?: number; + /** Specifies the name of a data source item field or an expression whose value is compared to the search criterion. */ + searchExpr?: Object; + /** Specifies the binary operation used to filter data. */ + searchMode?: string; + /** Specifies the time delay, in milliseconds, after the last character has been typed in, before a search is executed. */ + searchTimeout?: number; + /** A handler for the valueChanged event. */ + onValueChanged?: Function; + /** Specifies DOM event names that update a widget's value. */ + valueChangeEvent?: string; + /** Specifies whether or not the widget supports searching. */ + searchEnabled?: boolean; + /** + * Specifies whether or not the widget displays items by pages. + * @deprecated dataSource.paginate.md + */ + pagingEnabled?: boolean; + /** The text or HTML markup displayed by the widget if the item collection is empty. */ + noDataText?: string; + /** A handler for the selectionChanged event. */ + onSelectionChanged?: Function; + /** A handler for the itemClick event. */ + onItemClick?: Function; + onContentReady?: Function; + } + /** A base class for drop-down list widgets. */ + export class dxDropDownList extends dxDropDownEditor { + constructor(element: JQuery, options?: dxDropDownListOptions); + constructor(element: Element, options?: dxDropDownListOptions); + } + export interface dxToolbarOptions extends CollectionWidgetOptions { + menuItemRender?: any; + /** The template used to render menu items. */ + menuItemTemplate?: any; + /** Informs the widget about its location in a view HTML markup. */ + renderAs?: string; + } + /** A toolbar widget. */ + export class dxToolbar extends CollectionWidget { + constructor(element: JQuery, options?: dxToolbarOptions); + constructor(element: Element, options?: dxToolbarOptions); + } + export interface dxToastOptions extends dxOverlayOptions { + animation?: fx.AnimationOptions; + /** The time span in milliseconds during which the dxToast widget is visible. */ + displayTime?: number; + height?: any; + /** The dxToast message text. */ + message?: string; + position?: PositionOptions; + shading?: boolean; + /** Specifies the dxToast widget type. */ + type?: string; + width?: any; + closeOnBackButton?: boolean; + } + /** The toast message widget. */ + export class dxToast extends dxOverlay { + constructor(element: JQuery, options?: dxToastOptions); + constructor(element: Element, options?: dxToastOptions); + } + export interface dxTextEditorOptions extends EditorOptions { + /** A handler for the change event. */ + onChange?: Function; + changeAction?: Function; + /** A handler for the copy event. */ + onCopy?: Function; + copyAction?: Function; + /** A handler for the cut event. */ + onCut?: Function; + cutAction?: Function; + /** A handler for the enterKey event. */ + onEnterKey?: Function; + enterKeyAction?: Function; + /** A handler for the focusIn event. */ + onFocusIn?: Function; + focusInAction?: Function; + /** A handler for the focusOut event. */ + onFocusOut?: Function; + focusOutAction?: Function; + /** A handler for the input event. */ + onInput?: Function; + inputAction?: Function; + /** A handler for the keyDown event. */ + onKeyDown?: Function; + keyDownAction?: Function; + /** A handler for the keyPress event. */ + onKeyPress?: Function; + keyPressAction?: Function; + /** A handler for the keyUp event. */ + onKeyUp?: Function; + keyUpAction?: Function; + /** A handler for the paste event. */ + onPaste?: Function; + pasteAction?: Function; + /** The text displayed by the widget when the widget value is empty. */ + placeholder?: string; + /** Specifies whether to display the Clear button in the widget. */ + showClearButton?: boolean; + /** Specifies the current value displayed by the widget. */ + value?: any; + /** Specifies DOM event names that update a widget's value. */ + valueChangeEvent?: string; + /** Specifies whether or not the widget checks the inner text for spelling mistakes. */ + spellcheck?: boolean; + /** Specifies HTML attributes applied to the inner input element of the widget. */ + attr?: Object; + /** The read-only option that holds the text displayed by the widget input element. */ + text?: string; + /** Specifies whether or not the widget supports the focused state and keyboard navigation. */ + focusStateEnabled?: boolean; + /** A Boolean value specifying whether or not the widget changes its state when being hovered by an end user. */ + hoverStateEnabled?: boolean; + /** The editor mask that specifies the format of the entered string. */ + mask?: string; + /** Specifies a mask placeholder character. */ + maskChar?: string; + /** Specifies custom mask rules. */ + maskRules?: Object; + /** A message displayed when the entered text does not match the specified pattern. */ + maskInvalidMessage?: string; + } + /** A base class for text editing widgets. */ + export class dxTextEditor extends Editor { + constructor(element: JQuery, options?: dxTextEditorOptions); + constructor(element: Element, options?: dxTextEditorOptions); + /** Removes focus from the input element. */ + blur(): void; + /** Sets focus to the input element representing the widget. */ + focus(): void; + } + export interface dxTextBoxOptions extends dxTextEditorOptions { + /** Specifies the maximum number of characters you can enter into the textbox. */ + maxLength?: any; + /** The "mode" attribute value of the actual HTML input element representing the text box. */ + mode?: string; + } + /** A single-line text box widget. */ + export class dxTextBox extends dxTextEditor { + constructor(element: JQuery, options?: dxTextBoxOptions); + constructor(element: Element, options?: dxTextBoxOptions); + } + export interface dxTextAreaOptions extends dxTextBoxOptions { + /** Specifies whether or not the widget checks the inner text for spelling mistakes. */ + spellcheck?: boolean; + } + /** A widget used to display and edit multi-line text. */ + export class dxTextArea extends dxTextBox { + constructor(element: JQuery, options?: dxTextAreaOptions); + constructor(element: Element, options?: dxTextAreaOptions); + } + export interface dxTabsOptions extends CollectionWidgetOptions { + /** Specifies whether the widget enables an end-user to select only a single item or multiple items. */ + selectionMode?: string; + /** Specifies whether or not an end-user can scroll tabs by swiping. */ + scrollByContent?: boolean; + /** Specifies whether or not an end-user can scroll tabs. */ + scrollingEnabled?: boolean; + /** A Boolean value that specifies the availability of navigation buttons. */ + showNavButtons?: boolean; + } + /** A tab strip used to switch between pages. */ + export class dxTabs extends CollectionWidget { + constructor(element: JQuery, options?: dxTabsOptions); + constructor(element: Element, options?: dxTabsOptions); + } + export interface dxTabPanelOptions extends dxMultiViewOptions { + /** A handler for the titleClick event. */ + onTitleClick?: any; + /** A handler for the titleHold event. */ + onTitleHold?: Function; + /** A handler for the titleRendered event. */ + onTitleRendered?: Function; + titleTemplate?: any; + /** The template to be used for rendering an item title. */ + itemTitleTemplate?: any; + } + /** A widget used to display a view and to switch between several views by clicking the appropriate tabs. */ + export class dxTabPanel extends dxMultiView { + constructor(element: JQuery, options?: dxTabPanelOptions); + constructor(element: Element, options?: dxTabPanelOptions); + } + export interface dxSelectBoxOptions extends dxDropDownListOptions { + /** The template to be used for rendering the widget text field. */ + fieldTemplate?: any; + /** The text that is provided as a hint in the select box editor. */ + placeholder?: string; + /** Specifies whether or not the widget allows an end-user to enter a custom value. */ + fieldEditEnabled?: boolean; + } + /** A widget that allows you to select an item in a dropdown list. */ + export class dxSelectBox extends dxDropDownList { + constructor(element: JQuery, options?: dxSelectBoxOptions); + constructor(element: Element, options?: dxSelectBoxOptions); + } + export interface dxTagBoxOptions extends dxSelectBoxOptions { + /** Holds the list of selected values. */ + values?: Array; + } + /** A widget that allows you to select multiple items from a dropdown list. */ + export class dxTagBox extends dxSelectBox { + constructor(element: JQuery, options?: dxTagBoxOptions); + constructor(element: Element, options?: dxTagBoxOptions); + } + export interface dxScrollViewOptions extends dxScrollableOptions { + /** A handler for the pullDown event. */ + onPullDown?: Function; + pullDownAction?: Function; + /** Specifies the text shown in the pullDown panel when pulling the content down lowers the refresh threshold. */ + pulledDownText?: string; + /** Specifies the text shown in the pullDown panel while pulling the content down to the refresh threshold. */ + pullingDownText?: string; + /** A handler for the reachBottom event. */ + onReachBottom?: Function; + reachBottomAction?: Function; + /** Specifies the text shown in the pullDown panel displayed when content is scrolled to the bottom. */ + reachBottomText?: string; + /** Specifies the text shown in the pullDown panel displayed when the content is being refreshed. */ + refreshingText?: string; + /** Returns a value indicating if the scrollView content is larger then the widget container. */ + isFull(): boolean; + /** Locks the widget until the release(preventScrollBottom) method is called and executes the function passed to the onPullDown option and the handler assigned to the pullDown event. */ + refresh(): void; + /** Notifies the scroll view that data loading is finished. */ + release(preventScrollBottom: boolean): JQueryPromise; + /** Toggles the loading state of the widget. */ + toggleLoading(showOrHide: boolean): void; + } + /** A widget used to display scrollable content. */ + export class dxScrollView extends dxScrollable { + constructor(element: JQuery, options?: dxScrollViewOptions); + constructor(element: Element, options?: dxScrollViewOptions); + } + export interface dxScrollableLocation { + top?: number; + left?: number; + } + export interface dxScrollableOptions extends DOMComponentOptions { + /** A string value specifying the available scrolling directions. */ + direction?: string; + /** A Boolean value specifying whether or not the widget can respond to user interaction. */ + disabled?: boolean; + /** A handler for the scroll event. */ + onScroll?: Function; + scrollAction?: Function; + /** Specifies when the widget shows the scrollbar. */ + showScrollbar?: string; + /** A handler for the update event. */ + onUpdated?: Function; + updateAction?: Function; + /** Indicates whether to use native or simulated scrolling. */ + useNative?: boolean; + /** A Boolean value specifying whether to enable or disable the bounce-back effect. */ + bounceEnabled?: boolean; + /** A Boolean value specifying whether or not an end-user can scroll the widget content swiping it up or down. */ + scrollByContent?: boolean; + /** A Boolean value specifying whether or not an end-user can scroll the widget content using the scrollbar. */ + scrollByThumb?: boolean; + } + /** A widget used to display scrollable content. */ + export class dxScrollable extends DOMComponent { + constructor(element: JQuery, options?: dxScrollableOptions); + constructor(element: Element, options?: dxScrollableOptions); + /** Returns the height of the scrollable widget in pixels. */ + clientHeight(): number; + /** Returns the width of the scrollable widget in pixels. */ + clientWidth(): number; + /** Returns an HTML element of the widget. */ + content(): JQuery; + /** Scrolls the widget content by the specified number of pixels. */ + scrollBy(distance: number): void; + /** Scrolls widget content by the specified number of pixels in horizontal and vertical directions. */ + scrollBy(distanceObject: dxScrollableLocation): void; + /** Returns the height of the scrollable content in pixels. */ + scrollHeight(): number; + /** Returns the current scroll position against the leftmost position. */ + scrollLeft(): number; + /** Returns how far the scrollable content is scrolled from the top and from the left. */ + scrollOffset(): dxScrollableLocation; + /** Scrolls widget content to the specified position. */ + scrollTo(targetLocation: number): void; + /** Scrolls widget content to a specified position. */ + scrollTo(targetLocation: dxScrollableLocation): void; + /** Scrolls widget content to the specified element. */ + scrollToElement(element: Element): void; + /** Returns the current scroll position against the topmost position. */ + scrollTop(): number; + /** Returns the width of the scrollable content in pixels. */ + scrollWidth(): number; + /** Updates the dimensions of the scrollable contents. */ + update(): void; + } + export interface dxRadioGroupOptions extends CollectionWidgetOptions, DataExpressionMixinOptions { + /** Specifies the radio group layout. */ + layout?: string; + } + /** A widget that enables a user to select one item within a list of items represented by radio buttons. */ + export class dxRadioGroup extends CollectionWidget { + constructor(element: JQuery, options?: dxRadioGroupOptions); + constructor(element: Element, options?: dxRadioGroupOptions); + } + export interface dxPopupOptions extends dxOverlayOptions { + animation?: fx.AnimationOptions; + /** Specifies whether or not to allow a user to drag the popup window. */ + dragEnabled?: boolean; + /** A Boolean value specifying whether or not to display the widget in full-screen mode. */ + fullScreen?: boolean; + position?: PositionOptions; + /** A Boolean value specifying whether or not to display the title in the popup window. */ + showTitle?: boolean; + /** The title in the overlay window. */ + title?: string; + /** A template to be used for rendering the widget title. */ + titleTemplate?: any; + width?: any; + /** Specifies items displayed on the top or bottom toolbar of the popup window. */ + buttons?: Array; + /** Specifies whether or not the widget displays the Close button. */ + showCloseButton?: boolean; + /** A handler for the titleRendered event. */ + onTitleRendered?: Function; + } + /** A widget that displays required content in a popup window. */ + export class dxPopup extends dxOverlay { + constructor(element: JQuery, options?: dxPopupOptions); + constructor(element: Element, options?: dxPopupOptions); + } + export interface dxPopoverOptions extends dxPopupOptions { + /** An object defining animation options of the widget. */ + animation?: fx.AnimationOptions; + /** Specifies the height of the widget. */ + height?: any; + /** An object defining widget positioning options. */ + position?: PositionOptions; + shading?: boolean; + /** A Boolean value specifying whether or not to display the title in the overlay window. */ + showTitle?: boolean; + /** The target element associated with a popover. */ + target?: any; + /** Specifies the width of the widget. */ + width?: any; + } + /** A widget that displays the required content in a popup window. */ + export class dxPopover extends dxPopup { + constructor(element: JQuery, options?: dxPopoverOptions); + constructor(element: Element, options?: dxPopoverOptions); + /** Displays the widget for the specified target element. */ + show(target?: any): JQueryPromise; + } + export interface dxOverlayOptions extends WidgetOptions { + /** An object that defines the animation options of the widget. */ + animation?: fx.AnimationOptions; + /** A Boolean value specifying whether or not the widget is closed if a user presses the Back hardware button. */ + closeOnBackButton?: boolean; + /** A Boolean value specifying whether or not the widget is closed if a user clicks outside of the overlapping window. */ + closeOnOutsideClick?: any; + /** A template to be used for rendering widget content. */ + contentTemplate?: any; + /** Specifies whether widget content is rendered when the widget is shown or when rendering the widget. */ + deferRendering?: boolean; + /** Specifies whether or not an end-user can drag the widget. */ + dragEnabled?: boolean; + /** Specifies whether or not an end user can resize the widget. */ + resizeEnabled?: boolean; + /** The height of the widget in pixels. */ + height?: any; + /** A handler for the hidden event. */ + onHidden?: Function; + hiddenAction?: Function; + /** A handler for the hiding event. */ + onHiding?: Function; + hidingAction?: Function; + /** An object defining widget positioning options. */ + position?: PositionOptions; + /** A Boolean value specifying whether or not the main screen is inactive while the widget is active. */ + shading?: boolean; + /** Specifies the shading color. */ + shadingColor?: string; + /** A handler for the showing event. */ + onShowing?: Function; + showingAction?: Function; + /** A handler for the shown event. */ + onShown?: Function; + shownAction?: Function; + /** A Boolean value specifying whether or not the widget is visible. */ + visible?: boolean; + /** The widget width in pixels. */ + width?: any; + } + /** A widget displaying the required content in an overlay window. */ + export class dxOverlay extends Widget { + constructor(element: JQuery, options?: dxOverlayOptions); + constructor(element: Element, options?: dxOverlayOptions); + /** An HTML element of the widget. */ + content(): JQuery; + /** Hides the widget. */ + hide(): JQueryPromise; + /** Recalculates the overlay's size and position. */ + repaint(): void; + /** Shows the widget. */ + show(): JQueryPromise; + /** Toggles the visibility of the widget. */ + toggle(showing: boolean): JQueryPromise; + /** A static method that specifies the base z-index for all overlay widgets. */ + static baseZIndex(zIndex: number): void; + } + export interface dxNumberBoxOptions extends dxTextEditorOptions { + /** The maximum value accepted by the number box. */ + max?: number; + /** The minimum value accepted by the number box. */ + min?: number; + /** Specifies whether or not to show spin buttons. */ + showSpinButtons?: boolean; + useTouchSpinButtons?: boolean; + /** Specifies by which value the widget value changes when a spin button is clicked. */ + step?: number; + /** The current number box value. */ + value?: number; + } + /** A textbox widget that enables a user to enter numeric values. */ + export class dxNumberBox extends dxTextEditor { + constructor(element: JQuery, options?: dxNumberBoxOptions); + constructor(element: Element, options?: dxNumberBoxOptions); + } + export interface dxNavBarOptions extends dxTabsOptions { + scrollingEnabled?: boolean; + } + /** A widget that contains items used to navigate through application views. */ + export class dxNavBar extends dxTabs { + constructor(element: JQuery, options?: dxNavBarOptions); + constructor(element: Element, options?: dxNavBarOptions); + } + export interface dxMultiViewOptions extends CollectionWidgetOptions { + /** Specifies whether or not to animate the displayed item change. */ + animationEnabled?: boolean; + /** A Boolean value specifying whether or not to scroll back to the first item after the last item is swiped. */ + loop?: boolean; + /** The index of the currently displayed item. */ + selectedIndex?: number; + /** A Boolean value specifying whether or not to allow users to change the selected index by swiping. */ + swipeEnabled?: boolean; + /** Specifies whether widget content is rendered when the widget is shown or when rendering the widget. */ + deferRendering?: boolean; + } + /** A widget used to display a view and to switch between several views. */ + export class dxMultiView extends CollectionWidget { + constructor(element: JQuery, options?: dxMultiViewOptions); + constructor(element: Element, options?: dxMultiViewOptions); + } + export interface dxMapOptions extends WidgetOptions { + /** Specifies whether or not the widget automatically adjusts center and zoom option values when adding a new marker or route. */ + autoAdjust?: boolean; + /** An object, a string, or an array specifying the location displayed at the center of the widget. */ + center?: { + /** The latitude location displayed in the center of the widget. */ + lat?: number; + /** The longitude location displayed in the center of the widget. */ + lng?: number; + }; + /** A handler for the click event. */ + onClick?: any; + clickAction?: any; + /** Specifies whether or not map widget controls are available. */ + controls?: boolean; + /** Specifies the height of the widget. */ + height?: any; + /** A key used to authenticate the application within the required map provider. */ + key?: { + /** A key used to authenticate the application within the "Bing" map provider. */ + bing?: string; + /** A key used to authenticate the application within the "Google" map provider. */ + google?: string; + /** A key used to authenticate the application within the "Google Static" map provider. */ + googleStatic?: string; + } + /** A handler for the markerAdded event. */ + onMarkerAdded?: Function; + markerAddedAction?: Function; + /** A URL pointing to the custom icon to be used for map markers. */ + markerIconSrc?: string; + /** A handler for the markerRemoved event. */ + onMarkerRemoved?: Function; + markerRemovedAction?: Function; + /** An array of markers displayed on a map. */ + markers?: Array; + /** The name of the current map data provider. */ + provider?: string; + /** A handler for the ready event. */ + onReady?: Function; + readyAction?: Function; + /** A handler for the routeAdded event. */ + onRouteAdded?: Function; + routeAddedAction?: Function; + /** A handler for the routeRemoved event. */ + onRouteRemoved?: Function; + routeRemovedAction?: Function; + /** An array of routes shown on the map. */ + routes?: Array; + /** The type of a map to display. */ + type?: string; + /** Specifies the width of the widget. */ + width?: any; + /** The zoom level of the map. */ + zoom?: number; + } + /** An interactive map widget. */ + export class dxMap extends Widget { + constructor(element: JQuery, options?: dxMapOptions); + constructor(element: Element, options?: dxMapOptions); + /** Adds a marker to the map. */ + addMarker(markerOptions: Object): JQueryPromise; + /** Adds a route to the map. */ + addRoute(routeOptions: Object): JQueryPromise; + /** Removes a marker from the map. */ + removeMarker(marker: Object): JQueryPromise; + /** Removes a route from the map. */ + removeRoute(route: any): JQueryPromise; + } + export interface dxLookupOptions extends dxDropDownListOptions { + /** An object defining widget animation options. */ + animation?: fx.AnimationOptions; + /** The text displayed on the Cancel button. */ + cancelButtonText?: string; + /** The text displayed on the Clear button. */ + clearButtonText?: string; + /** Specifies whether or not the widget cleans the search box when the popup window is displayed. */ + cleanSearchOnOpening?: boolean; + /** A Boolean value specifying whether or not the widget is closed if a user clicks outside of the overlaying window. */ + closeOnOutsideClick?: any; + /** The text displayed on the Apply button. */ + applyButtonText?: string; + /** A Boolean value specifying whether or not to display the lookup in full-screen mode. */ + fullScreen?: boolean; + focusStateEnabled?: boolean; + /** A Boolean value specifying whether or not to group widget items. */ + grouped?: boolean; + groupRender?: any; + /** The name of the template used to display a group header. */ + groupTemplate?: any; + /** The text displayed on the button used to load the next page from the data source. */ + nextButtonText?: string; + /** A handler for the pageLoading event. */ + onPageLoading?: Function; + /** Specifies whether the next page is loaded when a user scrolls the widget to the bottom or when the "next" button is clicked. */ + pageLoadMode?: string; + pageLoadingAction?: Function; + /** Specifies the text shown in the pullDown panel, which is displayed when the widget is scrolled to the bottom. */ + pageLoadingText?: string; + /** The text displayed by the widget when nothing is selected. */ + placeholder?: string; + /** The height of the widget popup element. */ + popupHeight?: any; + /** The width of the widget popup element. */ + popupWidth?: any; + /** An object defining widget positioning options. */ + position?: PositionOptions; + /** Specifies the text displayed in the pullDown panel when the widget is pulled below the refresh threshold. */ + pulledDownText?: string; + /** Specifies the text shown in the pullDown panel while the list is being pulled down to the refresh threshold. */ + pullingDownText?: string; + /** A handler for the pullRefresh event. */ + onPullRefresh?: Function; + pullRefreshAction?: Function; + /** A Boolean value specifying whether or not the widget supports the "pull down to refresh" gesture. */ + pullRefreshEnabled?: boolean; + /** Specifies the text displayed in the pullDown panel while the widget is being refreshed. */ + refreshingText?: string; + /** A handler for the scroll event. */ + onScroll?: Function; + scrollAction?: Function; + /** A Boolean value specifying whether or not the search bar is visible. */ + searchEnabled?: boolean; + /** The text that is provided as a hint in the lookup's search bar. */ + searchPlaceholder?: string; + /** A Boolean value specifying whether or not the main screen is inactive while the lookup is active. */ + shading?: boolean; + /** Specifies whether to display the Cancel button in the lookup window. */ + showCancelButton?: boolean; + /** + * A Boolean value specifying whether the widget loads the next page automatically when you reach the bottom of the list or when a button is clicked. + * @deprecated pageLoadMode.md + */ + showNextButton?: boolean; + /** The title of the lookup window. */ + title?: string; + /** A template to be used for rendering the widget title. */ + titleTemplate?: any; + /** Specifies whether or not the widget uses native scrolling. */ + useNativeScrolling?: boolean; + /** Specifies whether or not to show lookup contents in a dxPopover widget. */ + usePopover?: boolean; + /** A handler for the valueChanged event. */ + onValueChanged?: Function; + contentReadyAction?: Function; + titleRender?: any; + /** A handler for the titleRendered event. */ + onTitleRendered?: Function; + /** A Boolean value specifying whether or not to display the title in the popup window. */ + showPopupTitle?: boolean; + } + /** A widget that allows a user to select predefined values from a lookup window. */ + export class dxLookup extends dxDropDownList { + constructor(element: JQuery, options?: dxLookupOptions); + constructor(element: Element, options?: dxLookupOptions); + /** This section lists the data source fields that are used in a default template for lookup drop-down items. */ + } + export interface dxLoadPanelOptions extends dxOverlayOptions { + /** An object defining the animation options of the widget. */ + animation?: fx.AnimationOptions; + /** The delay in milliseconds after which the load panel is displayed. */ + delay?: number; + /** The height of the widget. */ + height?: number; + /** A URL pointing to an image to be used as a load indicator. */ + indicatorSrc?: string; + /** The text displayed in the load panel. */ + message?: string; + /** A Boolean value specifying whether or not to show a load indicator. */ + showIndicator?: boolean; + /** A Boolean value specifying whether or not to show the pane behind the load indicator. */ + showPane?: boolean; + /** The width of the widget. */ + width?: number; + } + /** A widget used to indicate whether or not an element is loading. */ + export class dxLoadPanel extends dxOverlay { + constructor(element: JQuery, options?: dxLoadPanelOptions); + constructor(element: Element, options?: dxLoadPanelOptions); + } + export interface dxLoadIndicatorOptions extends WidgetOptions { + /** Specifies the path to an image used as the indicator. */ + indicatorSrc?: string; + } + /** The widget used to indicate the loading process. */ + export class dxLoadIndicator extends Widget { + constructor(element: JQuery, options?: dxLoadIndicatorOptions); + constructor(element: Element, options?: dxLoadIndicatorOptions); + } + export interface dxListOptions extends CollectionWidgetOptions { + /** A Boolean value specifying whether or not to display a grouped list. */ + grouped?: boolean; + groupRender?: any; + /** The template to be used for rendering item groups. */ + groupTemplate?: any; + onItemDeleting?: Function; + /** A handler for the itemDeleted event. */ + onItemDeleted?: Function; + /** A handler for the groupRendered event. */ + onGroupRendered?: Function; + itemDeleteAction?: Function; + /** A handler for the itemReordered event. */ + onItemReordered?: Function; + itemReorderAction?: Function; + /** A handler for the itemClick event. */ + onItemClick?: any; + /** A handler for the itemSwipe event. */ + onItemSwipe?: Function; + itemSwipeAction?: Function; + /** The text displayed on the button used to load the next page from the data source. */ + nextButtonText?: string; + /** A handler for the pageLoading event. */ + onPageLoading?: Function; + pageLoadingAction?: Function; + /** Specifies the text shown in the pullDown panel, which is displayed when the list is scrolled to the bottom. */ + pageLoadingText?: string; + /** Specifies the text displayed in the pullDown panel when the list is pulled below the refresh threshold. */ + pulledDownText?: string; + /** Specifies the text shown in the pullDown panel while the list is being pulled down to the refresh threshold. */ + pullingDownText?: string; + /** A handler for the pullRefresh event. */ + onPullRefresh?: Function; + pullRefreshAction?: Function; + /** A Boolean value specifying whether or not the widget supports the "pull down to refresh" gesture. */ + pullRefreshEnabled?: boolean; + /** Specifies the text displayed in the pullDown panel while the list is being refreshed. */ + refreshingText?: string; + /** A handler for the scroll event. */ + onScroll?: Function; + scrollAction?: Function; + /** A Boolean value specifying whether to enable or disable list scrolling. */ + scrollingEnabled?: boolean; + /** Specifies when the widget shows the scrollbar. */ + showScrollbar?: string; + /** Specifies whether or not the widget uses native scrolling. */ + useNativeScrolling?: boolean; + /** A Boolean value specifying whether to enable or disable the bounce-back effect. */ + bounceEnabled?: boolean; + /** A Boolean value specifying if the list is scrolled by content. */ + scrollByContent?: boolean; + /** A Boolean value specifying if the list is scrolled using the scrollbar. */ + scrollByThumb?: boolean; + itemUnselectAction?: Function; + onItemContextMenu?: Function; + onItemHold?: Function; + /** Specifies whether or not an end-user can collapse groups. */ + collapsibleGroups?: boolean; + /** Specifies whether the next page is loaded when a user scrolls the widget to the bottom or when the "next" button is clicked. */ + pageLoadMode?: string; + /** Specifies whether or not to display controls used to select list items. */ + showSelectionControls?: boolean; + /** Specifies item selection mode. */ + selectionMode?: string; + selectAllText?: string; + /** Specifies the array of items for a context menu called for a list item. */ + menuItems?: Array; + /** Specifies whether an item context menu is shown when a user holds or swipes an item. */ + menuMode?: string; + /** Specifies whether or not an end user can delete list items. */ + allowItemDeleting?: boolean; + /** Specifies the way a user can delete items from the list. */ + itemDeleteMode?: string; + /** Specifies whether or not an end user can reorder list items. */ + allowItemReordering?: boolean; + /** Specifies whether or not to show the loading panel when the DataSource bound to the widget is loading data. */ + indicateLoading?: boolean; + activeStateEnabled?: boolean; + } + /** A list widget. */ + export class dxList extends CollectionWidget { + constructor(element: JQuery, options?: dxListOptions); + constructor(element: Element, options?: dxListOptions); + /** Returns the height of the widget in pixels. */ + clientHeight(): number; + /** Removes the specified item from the list. */ + deleteItem(itemIndex: any): JQueryPromise; + /** Removes the specified item from the list. */ + deleteItem(itemElement: Element): JQueryPromise; + /** Returns a Boolean value that indicates whether or not the specified item is selected. */ + isItemSelected(itemIndex: any): boolean; + /** Returns a Boolean value that indicates whether or not the specified item is selected. */ + isItemSelected(itemElement: Element): boolean; + /** Reloads list data. */ + reload(): void; + /** Moves the specified item to the specified position in the list. */ + reorderItem(itemElement: Element, toItemElement: Element): JQueryPromise; + /** Moves the specified item to the specified position in the list. */ + reorderItem(itemIndex: any, toItemIndex: any): JQueryPromise; + /** Scrolls the list content by the specified number of pixels. */ + scrollBy(distance: number): void; + /** Returns the height of the list content in pixels. */ + scrollHeight(): number; + /** Scrolls list content to the specified position. */ + scrollTo(location: number): void; + /** Scrolls the list to the specified item. */ + scrollToItem(itemElement: Element): void; + /** Scrolls the list to the specified item. */ + scrollToItem(itemIndex: any): void; + /** Returns how far the list content is scrolled from the top. */ + scrollTop(): number; + /** Selects the specified item from the list. */ + selectItem(itemElement: Element): void; + /** Selects the specified item from the list. */ + selectItem(itemIndex: any): void; + /** Deselects the specified item from the list. */ + unselectItem(itemElement: Element): void; + /** Unselects the specified item from the list. */ + unselectItem(itemIndex: any): void; + /** Updates the widget scrollbar according to widget content size. */ + updateDimensions(): JQueryPromise; + /** Expands the specified group. */ + expandGroup(groupIndex: number): JQueryPromise; + /** Collapses the specified group. */ + collapseGroup(groupIndex: number): JQueryPromise; + } + export interface dxGalleryOptions extends CollectionWidgetOptions { + /** The time, in milliseconds, spent on slide animation. */ + animationDuration?: number; + /** Specifies whether or not to animate the displayed item change. */ + animationEnabled?: boolean; + /** A Boolean value specifying whether or not to allow users to switch between items by clicking an indicator. */ + indicatorEnabled?: boolean; + /** A Boolean value specifying whether or not to scroll back to the first item after the last item is swiped. */ + loop?: boolean; + /** The index of the currently active gallery item. */ + selectedIndex?: number; + /** A Boolean value specifying whether or not to display an indicator that points to the selected gallery item. */ + showIndicator?: boolean; + /** A Boolean value that specifies the availability of the "Forward" and "Back" navigation buttons. */ + showNavButtons?: boolean; + /** The time interval in milliseconds, after which the gallery switches to the next item. */ + slideshowDelay?: number; + /** A Boolean value specifying whether or not to allow users to switch between items by swiping. */ + swipeEnabled?: boolean; + /** Specifies whether or not to display parts of previous and next images along the sides of the current image. */ + wrapAround?: boolean; + /** Specifies if the widget stretches images to fit the total gallery width. */ + stretchImages?: boolean; + /** Specifies the width of an area used to display a single image. */ + initialItemWidth?: number; + } + /** An image gallery widget. */ + export class dxGallery extends CollectionWidget { + constructor(element: JQuery, options?: dxGalleryOptions); + constructor(element: Element, options?: dxGalleryOptions); + /** Shows the specified gallery item. */ + goToItem(itemIndex: number, animation: boolean): JQueryPromise; + /** Shows the next gallery item. */ + nextItem(animation: boolean): JQueryPromise; + /** Shows the previous gallery item. */ + prevItem(animation: boolean): JQueryPromise; + } + export interface dxDropDownEditorOptions extends dxTextBoxOptions { + /** Specifies the current value displayed by the widget. */ + value?: Object; + /** A handler for the closed event. */ + onClosed?: Function; + /** A handler for the opened event. */ + onOpened?: Function; + /** Specifies whether or not the drop-down editor is displayed. */ + opened?: boolean; + closeAction?: Function; + openAction?: Function; + shownAction?: Function; + hiddenAction?: Function; + /** Specifies whether or not the widget allows an end-user to enter a custom value. */ + fieldEditEnabled?: boolean; + editEnabled?: boolean; + /** Specifies the way an end-user applies the selected value. */ + applyValueMode?: string; + /** Specifies whether widget content is rendered when the widget is shown or when rendering the widget. */ + deferRendering?: boolean; + } + /** A drop-down editor widget. */ + export class dxDropDownEditor extends dxTextBox { + constructor(element: JQuery, options?: dxDropDownEditorOptions); + constructor(element: Element, options?: dxDropDownEditorOptions); + /** Closes the drop-down editor. */ + close(): void; + /** Opens the drop-down editor. */ + open(): void; + /** Resets the widget's value to null. */ + reset(): void; + /** Returns an <input> element of the widget. */ + field(): JQuery; + /** Returns an HTML element of the popup window content. */ + content(): JQuery; + } + export interface dxDateBoxOptions extends dxTextEditorOptions { + /** A format used to display date/time information. */ + format?: string; + /** A Globalize format string specifying the date display format. */ + formatString?: string; + /** The last date that can be selected within the widget. */ + max?: any; + /** The minimum date that can be selected within the widget. */ + min?: any; + /** The text displayed by the widget when the widget value is not yet specified. This text is also used as a title of the date picker. */ + placeholder?: string; + /** + * Specifies whether or not a user can pick out a date using the drop-down calendar. + * @deprecated Use 'pickerType' option instead. + */ + useCalendar?: boolean; + /** An object or a value, specifying the date and time currently selected using the date box. */ + value?: any; + /** + * Specifies whether or not the widget uses the native HTML input element. + * @deprecated Use 'pickerType' option instead. + */ + useNative?: boolean; + /** Specifies the interval between neighboring values in the popup list in minutes. */ + interval?: number; + /** Specifies the maximum zoom level of a calendar, which is used to pick the date. */ + maxZoomLevel?: string; + /** Specifies the minimal zoom level of a calendar, which is used to pick the date. */ + minZoomLevel?: string; + /** Specifies the type of date/time picker. */ + pickerType?: string; + } + /** A date box widget. */ + export class dxDateBox extends dxDropDownEditor { + constructor(element: JQuery, options?: dxDateBoxOptions); + constructor(element: Element, options?: dxDateBoxOptions); + } + export interface dxCheckBoxOptions extends EditorOptions { + /** Specifies the widget state. */ + value?: boolean; + /** Specifies the text displayed by the check box. */ + text?: string; + } + /** A check box widget. */ + export class dxCheckBox extends Editor { + constructor(element: JQuery, options?: dxCheckBoxOptions); + constructor(element: Element, options?: dxCheckBoxOptions); + } + export interface dxCalendarOptions extends EditorOptions { + /** Specifies a date displayed on the current calendar page. */ + currentDate?: Date; + /** Specifies the first day of a week. */ + firstDayOfWeek?: number; + /** The latest date the widget allows to select. */ + max?: Date; + /** The earliest date the widget allows to select. */ + min?: Date; + /** Specifies whether or not the widget displays a button that selects the current date. */ + showTodayButton?: boolean; + /** Specifies the current calendar zoom level. */ + zoomLevel?: string; + /** Specifies the maximum zoom level of the calendar. */ + maxZoomLevel?: string; + /** Specifies the minimum zoom level of the calendar. */ + minZoomLevel?: string; + /** The template to be used for rendering calendar cells. */ + cellTemplate?: any; + } + /** A calendar widget. */ + export class dxCalendar extends Editor { + constructor(element: JQuery, options?: dxCalendarOptions); + constructor(element: Element, options?: dxCalendarOptions); + } + export interface dxButtonOptions extends WidgetOptions { + /** A Boolean value specifying whether or not the widget changes its state when interacting with a user. */ + activeStateEnabled?: boolean; + /** A handler for the click event. */ + onClick?: any; + clickAction?: any; + /** Specifies the icon to be displayed on the button. */ + icon?: string; + iconSrc?: string; + /** A template to be used for rendering the dxButton widget. */ + template?: any; + /** The text displayed on the button. */ + text?: string; + /** Specifies the button type. */ + type?: string; + /** Specifies the name of the validation group to be accessed in the click event handler. */ + validationGroup?: string; + } + /** A button widget. */ + export class dxButton extends Widget { + constructor(element: JQuery, options?: dxButtonOptions); + constructor(element: Element, options?: dxButtonOptions); + } + export interface dxBoxOptions extends CollectionWidget { + /** Specifies how widget items are aligned along the main direction. */ + align?: string; + /** Specifies the direction of item positioning in the widget. */ + direction?: string; + /** Specifies how widget items are aligned cross-wise. */ + crossAlign?: string; + } + /** A container widget used to arrange inner elements. */ + export class dxBox extends CollectionWidget { + constructor(element: JQuery, options?: dxBoxOptions); + constructor(element: Element, options?: dxBoxOptions); + } + export interface dxResponsiveBoxOptions extends CollectionWidgetOptions { + /** Specifies the collection of rows for the grid used to position layout elements. */ + rows?: Array; + /** Specifies the collection of columns for the grid used to position layout elements. */ + cols?: Array; + /** Specifies the function returning the screen factor depending on the screen width. */ + screenByWidth?: (width: number) => string; + /** Specifies the screen factor with which all elements are located in a single column. */ + singleColumnScreen?: string; + } + /** A widget used to build an adaptive markup that is dependent on screen resolution. */ + export class dxResponsiveBox extends CollectionWidget { + constructor(element: JQuery, options?: dxBoxOptions); + constructor(element: Element, options?: dxBoxOptions); + } + export interface dxAutocompleteOptions extends dxDropDownListOptions { + /** Specifies the current value displayed by the widget. */ + value?: string; + /** The minimum number of characters that must be entered into the text box to begin a search. */ + minSearchLength?: number; + /** Specifies the maximum count of items displayed by the widget. */ + maxItemCount?: number; + /** Gets the currently selected item. */ + selectedItem?: Object; + } + /** A textbox widget that supports autocompletion. */ + export class dxAutocomplete extends dxDropDownList { + constructor(element: JQuery, options?: dxAutocompleteOptions); + constructor(element: Element, options?: dxAutocompleteOptions); + /** Opens the drop-down editor. */ + open(): void; + /** Closes the drop-down editor. */ + close(): void; + } + export interface dxAccordionOptions extends CollectionWidgetOptions { + /** A number specifying the time in milliseconds spent on the animation of the expanding or collapsing of a panel. */ + animationDuration?: number; + /** Specifies the height of the widget. */ + height?: any; + /** Specifies whether all items can be collapsed or whether at least one item must always be expanded. */ + collapsible?: boolean; + /** Specifies whether the widget can expand several items or only a single item at once. */ + multiple?: boolean; + /** The template to be used for rendering dxAccordion items. */ + itemTemplate?: any; + /** A handler for the itemTitleClick event. */ + onItemTitleClick?: any; + /** A handler for the itemTitleHold event. */ + onItemTitleHold?: Function; + /** The template to be used for rendering an item title. */ + itemTitleTemplate?: any; + /** The index number of the currently selected item. */ + selectedIndex?: number; + /** Specifies whether widget content is rendered when the widget is shown or when rendering the widget. */ + deferRendering?: boolean; + } + /** A widget that displays data source items on collapsible panels. */ + export class dxAccordion extends CollectionWidget { + constructor(element: JQuery, options?: dxAccordionOptions); + constructor(element: Element, options?: dxAccordionOptions); + /** Collapses the specified item. */ + collapseItem(index: number): JQueryPromise; + /** Expands the specified item. */ + expandItem(index: number): JQueryPromise; + /** Updates the dimensions of the widget contents. */ + updateDimensions(): JQueryPromise; + } + export interface dxFileUploaderOptions extends EditorOptions { + /** A read-only option that holds a File instance representing the selected file. */ + value?: File; + /** Holds the File instances representing files selected in the widget. */ + values?: Array; + buttonText?: string; + /** The text displayed on the button that opens the file browser. */ + selectButtonText?: string; + /** The text displayed on the button that starts uploading. */ + uploadButtonText?: string; + /** Specifies the text displayed on the area to which an end-user can drop a file. */ + labelText?: string; + /** Specifies the value passed to the name attribute of the underlying input element. */ + name?: string; + /** Specifies whether the widget enables an end-user to select a single file or multiple files. */ + multiple?: boolean; + /** Specifies a file type or several types accepted by the widget. */ + accept?: string; + /** Specifies a target Url for the upload request. */ + uploadUrl?: string; + /** Specifies if an end user can remove a file from the selection and interrupt uploading. */ + allowCanceling?: boolean; + /** Specifies whether or not the widget displays the list of selected files. */ + showFileList?: boolean; + /** Gets the current progress in percentages. */ + progress?: number; + /** The message displayed by the widget when it is ready to upload the specified files. */ + readyToUploadMessage?: string; + /** The message displayed by the widget when uploading is finished. */ + uploadedMessage?: string; + /** The message displayed by the widget on uploading failure. */ + uploadFailedMessage?: string; + /** Specifies how the widget uploads files. */ + uploadMode?: string; + /** A handler for the uploaded event. */ + onUploaded?: Function; + /** A handler for the uploaded event. */ + onProgress?: Function; + /** A handler for the uploadError event. */ + onUploadError?: Function; + /** A handler for the valueChanged event. */ + onValueChanged?: Function; + } + /** A widget used to select and upload a file or multiple files. */ + export class dxFileUploader extends Editor { + constructor(element: JQuery, options?: dxFileUploaderOptions); + constructor(element: Element, options?: dxFileUploaderOptions); + } + export interface dxTrackBarOptions extends EditorOptions { + /** The minimum value the widget can accept. */ + min?: number; + /** The maximum value the widget can accept. */ + max?: number; + /** The current widget value. */ + value?: number; + } + /** A base class for track bar widgets. */ + export class dxTrackBar extends Editor { + constructor(element: JQuery, options?: dxTrackBarOptions); + constructor(element: Element, options?: dxTrackBarOptions); + } + export interface dxProgressBarOptions extends dxTrackBarOptions { + /** Specifies a format for the progress status. */ + statusFormat?: any; + /** Specifies whether or not the widget displays a progress status. */ + showStatus?: boolean; + /** A handler for the complete event. */ + onComplete?: Function; + } + /** A widget used to indicate progress. */ + export class dxProgressBar extends dxTrackBar { + constructor(element: JQuery, options?: dxProgressBarOptions); + constructor(element: Element, options?: dxProgressBarOptions); + } + export interface dxSliderOptions extends dxTrackBarOptions { + /** The slider step size. */ + step?: number; + /** The current slider value. */ + value?: number; + /** Specifies whether or not to highlight a range selected within the widget. */ + showRange?: boolean; + /** Specifies the size of a step by which a slider handle is moved when a user uses the Page up or Page down keyboard shortcuts. */ + keyStep?: number; + /** Specifies options for the slider tooltip. */ + tooltip?: { + /** Specifies whether or not the tooltip is enabled. */ + enabled?: boolean; + /** Specifies format for the tooltip. */ + format?: any; + /** Specifies whether the tooltip is located over or under the slider. */ + position?: string; + /** Specifies whether the widget always shows a tooltip or only when a pointer is over the slider. */ + showMode?: string; + }; + /** Specifies options for labels displayed at the min and max values. */ + label?: { + /** Specifies whether or not slider labels are visible. */ + visible?: boolean; + /** Specifies whether labels are located over or under the scale. */ + position?: string; + /** Specifies a format for labels. */ + format?: any; + }; + } + /** A widget that allows a user to select a numeric value within a given range. */ + export class dxSlider extends dxTrackBar { + constructor(element: JQuery, options?: dxSliderOptions); + constructor(element: Element, options?: dxSliderOptions); + } + export interface dxRangeSliderOptions extends dxSliderOptions { + /** The left edge of the interval currently selected using the range slider. */ + start?: number; + /** The right edge of the interval currently selected using the range slider. */ + end?: number; + } + /** A widget that enables a user to select a range of numeric values. */ + export class dxRangeSlider extends dxSlider { + constructor(element: JQuery, options?: dxRangeSliderOptions); + constructor(element: Element, options?: dxRangeSliderOptions); + } +} +interface JQuery { + dxProgressBar(): JQuery; + dxProgressBar(options: "instance"): DevExpress.ui.dxProgressBar; + dxProgressBar(options: string): any; + dxProgressBar(options: string, ...params: any[]): any; + dxProgressBar(options: DevExpress.ui.dxProgressBarOptions): JQuery; + dxSlider(): JQuery; + dxSlider(options: "instance"): DevExpress.ui.dxSlider; + dxSlider(options: string): any; + dxSlider(options: string, ...params: any[]): any; + dxSlider(options: DevExpress.ui.dxSliderOptions): JQuery; + dxRangeSlider(): JQuery; + dxRangeSlider(options: "instance"): DevExpress.ui.dxRangeSlider; + dxRangeSlider(options: string): any; + dxRangeSlider(options: string, ...params: any[]): any; + dxRangeSlider(options: DevExpress.ui.dxRangeSliderOptions): JQuery; + dxFileUploader(): JQuery; + dxFileUploader(options: "instance"): DevExpress.ui.dxFileUploader; + dxFileUploader(options: string): any; + dxFileUploader(options: string, ...params: any[]): any; + dxFileUploader(options: DevExpress.ui.dxFileUploaderOptions): JQuery; + dxValidator(): JQuery; + dxValidator(options: "instance"): DevExpress.ui.dxValidator; + dxValidator(options: string): any; + dxValidator(options: string, ...params: any[]): any; + dxValidator(options: DevExpress.ui.dxValidatorOptions): JQuery; + dxValidationGroup(): JQuery; + dxValidationGroup(options: "instance"): DevExpress.ui.dxValidationGroup; + dxValidationGroup(options: string): any; + dxValidationGroup(options: string, ...params: any[]): any; + dxValidationSummary(): JQuery; + dxValidationSummary(options: "instance"): DevExpress.ui.dxValidationSummary; + dxValidationSummary(options: string): any; + dxValidationSummary(options: string, ...params: any[]): any; + dxValidationSummary(options: DevExpress.ui.dxValidationSummaryOptions): JQuery; + dxTooltip(): JQuery; + dxTooltip(options: "instance"): DevExpress.ui.dxTooltip; + dxTooltip(options: string): any; + dxTooltip(options: string, ...params: any[]): any; + dxTooltip(options: DevExpress.ui.dxTooltipOptions): JQuery; + dxResizable(): JQuery; + dxResizable(options: "instance"): DevExpress.ui.dxResizable; + dxResizable(options: string): any; + dxResizable(options: string, ...params: any[]): any; + dxResizable(options: DevExpress.ui.dxResizableOptions): JQuery; + dxDropDownList(): JQuery; + dxDropDownList(options: "instance"): DevExpress.ui.dxDropDownList; + dxDropDownList(options: string): any; + dxDropDownList(options: string, ...params: any[]): any; + dxDropDownList(options: DevExpress.ui.dxDropDownListOptions): JQuery; + dxToolbar(): JQuery; + dxToolbar(options: "instance"): DevExpress.ui.dxToolbar; + dxToolbar(options: string): any; + dxToolbar(options: string, ...params: any[]): any; + dxToolbar(options: DevExpress.ui.dxToolbarOptions): JQuery; + dxToast(): JQuery; + dxToast(options: "instance"): DevExpress.ui.dxToast; + dxToast(options: string): any; + dxToast(options: string, ...params: any[]): any; + dxToast(options: DevExpress.ui.dxToastOptions): JQuery; + dxTextEditor(): JQuery; + dxTextEditor(options: "instance"): DevExpress.ui.dxTextEditor; + dxTextEditor(options: string): any; + dxTextEditor(options: string, ...params: any[]): any; + dxTextEditor(options: DevExpress.ui.dxTextEditorOptions): JQuery; + dxTextBox(): JQuery; + dxTextBox(options: "instance"): DevExpress.ui.dxTextBox; + dxTextBox(options: string): any; + dxTextBox(options: string, ...params: any[]): any; + dxTextBox(options: DevExpress.ui.dxTextBoxOptions): JQuery; + dxTextArea(): JQuery; + dxTextArea(options: "instance"): DevExpress.ui.dxTextArea; + dxTextArea(options: string): any; + dxTextArea(options: string, ...params: any[]): any; + dxTextArea(options: DevExpress.ui.dxTextAreaOptions): JQuery; + dxTabs(): JQuery; + dxTabs(options: "instance"): DevExpress.ui.dxTabs; + dxTabs(options: string): any; + dxTabs(options: string, ...params: any[]): any; + dxTabs(options: DevExpress.ui.dxTabsOptions): JQuery; + dxTabPanel(): JQuery; + dxTabPanel(options: "instance"): DevExpress.ui.dxTabPanel; + dxTabPanel(options: string): any; + dxTabPanel(options: string, ...params: any[]): any; + dxTabPanel(options: DevExpress.ui.dxTabPanelOptions): JQuery; + dxSelectBox(): JQuery; + dxSelectBox(options: "instance"): DevExpress.ui.dxSelectBox; + dxSelectBox(options: string): any; + dxSelectBox(options: string, ...params: any[]): any; + dxSelectBox(options: DevExpress.ui.dxSelectBoxOptions): JQuery; + dxTagBox(): JQuery; + dxTagBox(options: "instance"): DevExpress.ui.dxTagBox; + dxTagBox(options: string): any; + dxTagBox(options: string, ...params: any[]): any; + dxTagBox(options: DevExpress.ui.dxTagBoxOptions): JQuery; + dxScrollView(): JQuery; + dxScrollView(options: "instance"): DevExpress.ui.dxScrollView; + dxScrollView(options: string): any; + dxScrollView(options: string, ...params: any[]): any; + dxScrollView(options: DevExpress.ui.dxScrollViewOptions): JQuery; + dxScrollable(): JQuery; + dxScrollable(options: "instance"): DevExpress.ui.dxScrollable; + dxScrollable(options: string): any; + dxScrollable(options: string, ...params: any[]): any; + dxScrollable(options: DevExpress.ui.dxScrollableOptions): JQuery; + dxRadioGroup(): JQuery; + dxRadioGroup(options: "instance"): DevExpress.ui.dxRadioGroup; + dxRadioGroup(options: string): any; + dxRadioGroup(options: string, ...params: any[]): any; + dxRadioGroup(options: DevExpress.ui.dxRadioGroupOptions): JQuery; + dxPopup(): JQuery; + dxPopup(options: "instance"): DevExpress.ui.dxPopup; + dxPopup(options: string): any; + dxPopup(options: string, ...params: any[]): any; + dxPopup(options: DevExpress.ui.dxPopupOptions): JQuery; + dxPopover(): JQuery; + dxPopover(options: "instance"): DevExpress.ui.dxPopover; + dxPopover(options: string): any; + dxPopover(options: string, ...params: any[]): any; + dxPopover(options: DevExpress.ui.dxPopoverOptions): JQuery; + dxOverlay(): JQuery; + dxOverlay(options: "instance"): DevExpress.ui.dxOverlay; + dxOverlay(options: string): any; + dxOverlay(options: string, ...params: any[]): any; + dxOverlay(options: DevExpress.ui.dxOverlayOptions): JQuery; + dxNumberBox(): JQuery; + dxNumberBox(options: "instance"): DevExpress.ui.dxNumberBox; + dxNumberBox(options: string): any; + dxNumberBox(options: string, ...params: any[]): any; + dxNumberBox(options: DevExpress.ui.dxNumberBoxOptions): JQuery; + dxNavBar(): JQuery; + dxNavBar(options: "instance"): DevExpress.ui.dxNavBar; + dxNavBar(options: string): any; + dxNavBar(options: string, ...params: any[]): any; + dxNavBar(options: DevExpress.ui.dxNavBarOptions): JQuery; + dxMultiView(): JQuery; + dxMultiView(options: "instance"): DevExpress.ui.dxMultiView; + dxMultiView(options: string): any; + dxMultiView(options: string, ...params: any[]): any; + dxMultiView(options: DevExpress.ui.dxMultiViewOptions): JQuery; + dxMap(): JQuery; + dxMap(options: "instance"): DevExpress.ui.dxMap; + dxMap(options: string): any; + dxMap(options: string, ...params: any[]): any; + dxMap(options: DevExpress.ui.dxMapOptions): JQuery; + dxLookup(): JQuery; + dxLookup(options: "instance"): DevExpress.ui.dxLookup; + dxLookup(options: string): any; + dxLookup(options: string, ...params: any[]): any; + dxLookup(options: DevExpress.ui.dxLookupOptions): JQuery; + dxLoadPanel(): JQuery; + dxLoadPanel(options: "instance"): DevExpress.ui.dxLoadPanel; + dxLoadPanel(options: string): any; + dxLoadPanel(options: string, ...params: any[]): any; + dxLoadPanel(options: DevExpress.ui.dxLoadPanelOptions): JQuery; + dxLoadIndicator(): JQuery; + dxLoadIndicator(options: "instance"): DevExpress.ui.dxLoadIndicator; + dxLoadIndicator(options: string): any; + dxLoadIndicator(options: string, ...params: any[]): any; + dxLoadIndicator(options: DevExpress.ui.dxLoadIndicatorOptions): JQuery; + dxList(): JQuery; + dxList(options: "instance"): DevExpress.ui.dxList; + dxList(options: string): any; + dxList(options: string, ...params: any[]): any; + dxList(options: DevExpress.ui.dxListOptions): JQuery; + dxGallery(): JQuery; + dxGallery(options: "instance"): DevExpress.ui.dxGallery; + dxGallery(options: string): any; + dxGallery(options: string, ...params: any[]): any; + dxGallery(options: DevExpress.ui.dxGalleryOptions): JQuery; + dxDropDownEditor(): JQuery; + dxDropDownEditor(options: "instance"): DevExpress.ui.dxDropDownEditor; + dxDropDownEditor(options: string): any; + dxDropDownEditor(options: string, ...params: any[]): any; + dxDropDownEditor(options: DevExpress.ui.dxDropDownEditorOptions): JQuery; + dxDateBox(): JQuery; + dxDateBox(options: "instance"): DevExpress.ui.dxDateBox; + dxDateBox(options: string): any; + dxDateBox(options: string, ...params: any[]): any; + dxDateBox(options: DevExpress.ui.dxDateBoxOptions): JQuery; + dxCheckBox(): JQuery; + dxCheckBox(options: "instance"): DevExpress.ui.dxCheckBox; + dxCheckBox(options: string): any; + dxCheckBox(options: string, ...params: any[]): any; + dxCheckBox(options: DevExpress.ui.dxCheckBoxOptions): JQuery; + dxBox(): JQuery; + dxBox(options: "instance"): DevExpress.ui.dxBox; + dxBox(options: string): any; + dxBox(options: string, ...params: any[]): any; + dxBox(options: DevExpress.ui.dxBoxOptions): JQuery; + dxButton(): JQuery; + dxButton(options: "instance"): DevExpress.ui.dxButton; + dxButton(options: string): any; + dxButton(options: string, ...params: any[]): any; + dxButton(options: DevExpress.ui.dxButtonOptions): JQuery; + dxCalendar(): JQuery; + dxCalendar(options: "instance"): DevExpress.ui.dxCalendar; + dxCalendar(options: string): any; + dxCalendar(options: string, ...params: any[]): any; + dxCalendar(options: DevExpress.ui.dxCalendarOptions): JQuery; + dxAccordion(): JQuery; + dxAccordion(options: "instance"): DevExpress.ui.dxAccordion; + dxAccordion(options: string): any; + dxAccordion(options: string, ...params: any[]): any; + dxAccordion(options: DevExpress.ui.dxAccordionOptions): JQuery; + dxResponsiveBox(): JQuery; + dxResponsiveBox(options: "instance"): DevExpress.ui.dxResponsiveBox; + dxResponsiveBox(options: string): any; + dxResponsiveBox(options: string, ...params: any[]): any; + dxResponsiveBox(options: DevExpress.ui.dxResponsiveBoxOptions): JQuery; + dxAutocomplete(): JQuery; + dxAutocomplete(options: "instance"): DevExpress.ui.dxAutocomplete; + dxAutocomplete(options: string): any; + dxAutocomplete(options: string, ...params: any[]): any; + dxAutocomplete(options: DevExpress.ui.dxAutocompleteOptions): JQuery; +} + +declare module DevExpress.ui { + export interface dxTileViewOptions extends CollectionWidgetOptions { + /** A Boolean value specifying whether or not the widget changes its state when interacting with a user. */ + activeStateEnabled?: boolean; + /** Specifies the height of the base tile view item. */ + baseItemHeight?: number; + /** Specifies the width of the base tile view item. */ + baseItemWidth?: number; + /** Specifies the height of the widget. */ + height?: any; + /** Specifies the distance in pixels between adjacent tiles. */ + itemMargin?: number; + /** A Boolean value specifying whether or not to display a scrollbar. */ + showScrollbar?: boolean; + } + /** A widget displaying several blocks of data as tiles. */ + export class dxTileView extends CollectionWidget { + constructor(element: JQuery, options?: dxTileViewOptions); + constructor(element: Element, options?: dxTileViewOptions); + /** Returns the current scroll position of the widget content. */ + scrollPosition(): number; + } + export interface dxSwitchOptions extends EditorOptions { + /** Text displayed when the widget is in a disabled state. */ + offText?: string; + /** Text displayed when the widget is in an enabled state. */ + onText?: string; + /** A Boolean value specifying whether the current switch state is "On" or "Off". */ + value?: boolean; + } + /** A switch widget. */ + export class dxSwitch extends Editor { + constructor(element: JQuery, options?: dxSwitchOptions); + constructor(element: Element, options?: dxSwitchOptions); + } + export interface dxSlideOutViewOptions extends WidgetOptions { + /** Specifies whether or not the menu panel is visible. */ + menuVisible?: boolean; + /** Specifies whether or not the menu is shown when a user swipes the widget content. */ + swipeEnabled?: boolean; + /** A template to be used for rendering menu panel content. */ + menuTemplate?: any; + /** A template to be used for rendering widget content. */ + contentTemplate?: any; + } + /** The widget that allows you to slide-out the current view to reveal a custom menu. */ + export class dxSlideOutView extends Widget { + constructor(element: JQuery, options?: dxSlideOutViewOptions); + constructor(element: Element, options?: dxSlideOutViewOptions); + /** Returns an HTML element of the widget menu block. */ + menuContent(): JQuery; + /** Returns an HTML element of the widget content block. */ + content(): JQuery; + /** Displays the widget's menu block. */ + showMenu(): JQueryPromise; + /** Hides the widget's menu block. */ + hideMenu(): JQueryPromise; + /** Toggles the visibility of the widget's menu block. */ + toggleMenuVisibility(): JQueryPromise; + } + export interface dxSlideOutOptions extends CollectionWidgetOptions { + /** A Boolean value specifying whether or not the widget changes its state when interacting with a user. */ + activeStateEnabled?: boolean; + /** A Boolean value specifying whether or not to display a grouped menu. */ + menuGrouped?: boolean; + menuGroupRender?: any; + /** The name of the template used to display a group header. */ + menuGroupTemplate?: any; + menuItemRender?: any; + /** The template used to render menu items. */ + menuItemTemplate?: any; + /** A handler for the menuGroupRendered event. */ + onMenuGroupRendered?: Function; + /** A handler for the menuItemRendered event. */ + onMenuItemRendered?: Function; + /** Specifies whether or not the slide-out menu is displayed. */ + menuVisible?: boolean; + /** Indicates whether the menu can be shown/hidden by swiping the widget's main panel. */ + swipeEnabled?: boolean; + /** A template to be used for rendering widget content. */ + contentTemplate?: any; + } + /** The widget that allows you to slide-out the current view to reveal an item list. */ + export class dxSlideOut extends CollectionWidget { + constructor(element: JQuery, options?: dxSlideOutOptions); + constructor(element: Element, options?: dxSlideOutOptions); + /** Hides the widget's slide-out menu. */ + hideMenu(): JQueryPromise; + /** Displays the widget's slide-out menu. */ + showMenu(): JQueryPromise; + /** Toggles the visibility of the widget's slide-out menu. */ + toggleMenuVisibility(showing: boolean): JQueryPromise; + } + export interface dxPivotOptions extends CollectionWidgetOptions { + /** The index of the currently active pivot item. */ + selectedIndex?: number; + /** A Boolean value specifying whether or not to allow users to switch between items by swiping. */ + swipeEnabled?: boolean; + /** A template to be used for rendering widget content. */ + contentTemplate?: any; + /** The template to be used for rendering an item title. */ + itemTitleTemplate?: any; + } + /** A widget that is similar to a traditional tab control, but optimized for the phone with simplified end-user interaction. */ + export class dxPivot extends CollectionWidget { + constructor(element: JQuery, options?: dxPivotOptions); + constructor(element: Element, options?: dxPivotOptions); + } + export interface dxPanoramaOptions extends CollectionWidgetOptions { + /** An object exposing options for setting a background image for the panorama. */ + backgroundImage?: { + /** Specifies the height of the panorama's background image. */ + height?: number; + /** Specifies the URL of the image that is used as the panorama's background image. */ + url?: string; + /** Specifies the width of the panorama's background image. */ + width?: number; + }; + /** The index of the currently active panorama item. */ + selectedIndex?: number; + /** Specifies the widget content title. */ + title?: string; + } + /** A widget displaying the required content in a long horizontal canvas that extends beyond the frames of the screen. */ + export class dxPanorama extends CollectionWidget { + constructor(element: JQuery, options?: dxDropDownEditorOptions); + constructor(element: Element, options?: dxDropDownEditorOptions); + } + export interface dxDropDownMenuOptions extends WidgetOptions { + /** A handler for the buttonClick event. */ + onButtonClick?: any; + buttonClickAction?: any; + /** The name of the icon to be displayed by the DropDownMenu button. */ + buttonIcon?: string; + buttonIconSrc?: string; + /** The text displayed in the DropDownMenu button. */ + buttonText?: string; + /** A data source used to fetch data to be displayed by the widget. */ + dataSource?: any; + /** A handler for the itemClick event. */ + onItemClick?: any; + itemClickAction?: any; + itemRender?: any; + /** An array of items displayed by the widget. */ + items?: Array; + /** The template to be used for rendering items. */ + itemTemplate?: any; + /** Specifies whether or not to show the drop down menu within a dxPopover widget. */ + usePopover?: boolean; + /** The width of the menu popup in pixels. */ + popupWidth?: any; + /** The height of the menu popup in pixels. */ + popupHeight?: any; + /** Specifies whether or not the drop-down menu is displayed. */ + opened?: boolean; + /** A Boolean value specifying whether or not the widget changes its state when being hovered by an end user. */ + hoverStateEnabled?: boolean; + } + /** A drop-down menu widget. */ + export class dxDropDownMenu extends Widget { + constructor(element: JQuery, options?: dxDropDownEditorOptions); + constructor(element: Element, options?: dxDropDownEditorOptions); + /** This section lists the data source fields that are used in a default template for drop-down menu items. */ + /** Opens the drop-down menu. */ + open(): void; + /** Closes the drop-down menu. */ + close(): void; + } + export interface dxActionSheetOptions extends CollectionWidgetOptions { + cancelClickAction?: any; + /** A handler for the cancelClick event. */ + onCancelClick?: any; + /** The text displayed in the button that closes the action sheet. */ + cancelText?: string; + /** Specifies whether or not to display the Cancel button in action sheet. */ + showCancelButton?: boolean; + /** A Boolean value specifying whether or not the title of the action sheet is visible. */ + showTitle?: boolean; + /** Specifies the element the action sheet popover points at. */ + target?: any; + /** The title of the action sheet. */ + title?: string; + /** Specifies whether or not to show the action sheet within a dxPopover widget. */ + usePopover?: boolean; + /** A Boolean value specifying whether or not the dxActionSheet widget is visible. */ + visible?: boolean; + } + /** A widget consisting of a set of choices related to a certain task. */ + export class dxActionSheet extends CollectionWidget { + constructor(element: JQuery, options?: dxActionSheetOptions); + constructor(element: Element, options?: dxActionSheetOptions); + /** Hides the widget. */ + hide(): JQueryPromise; + /** Shows the widget. */ + show(): JQueryPromise; + /** Shows or hides the widget depending on the Boolean value passed as the parameter. */ + toggle(showing: boolean): JQueryPromise; + } +} +interface JQuery { + dxTileView(): JQuery; + dxTileView(options: "instance"): DevExpress.ui.dxTileView; + dxTileView(options: string): any; + dxTileView(options: string, ...params: any[]): any; + dxTileView(options: DevExpress.ui.dxTileViewOptions): JQuery; + dxSwitch(): JQuery; + dxSwitch(options: "instance"): DevExpress.ui.dxSwitch; + dxSwitch(options: string): any; + dxSwitch(options: string, ...params: any[]): any; + dxSwitch(options: DevExpress.ui.dxSwitchOptions): JQuery; + dxSlideOut(): JQuery; + dxSlideOut(options: "instance"): DevExpress.ui.dxSlideOut; + dxSlideOut(options: string): any; + dxSlideOut(options: string, ...params: any[]): any; + dxSlideOut(options: DevExpress.ui.dxSlideOutOptions): JQuery; + dxPivot(): JQuery; + dxPivot(options: "instance"): DevExpress.ui.dxPivot; + dxPivot(options: string): any; + dxPivot(options: string, ...params: any[]): any; + dxPivot(options: DevExpress.ui.dxPivotOptions): JQuery; + dxPanorama(): JQuery; + dxPanorama(options: "instance"): DevExpress.ui.dxPanorama; + dxPanorama(options: string): any; + dxPanorama(options: string, ...params: any[]): any; + dxPanorama(options: DevExpress.ui.dxPanoramaOptions): JQuery; + dxActionSheet(): JQuery; + dxActionSheet(options: "instance"): DevExpress.ui.dxActionSheet; + dxActionSheet(options: string): any; + dxActionSheet(options: string, ...params: any[]): any; + dxActionSheet(options: DevExpress.ui.dxActionSheetOptions): JQuery; + dxDropDownMenu(): JQuery; + dxDropDownMenu(options: "instance"): DevExpress.ui.dxDropDownMenu; + dxDropDownMenu(options: string): any; + dxDropDownMenu(options: string, ...params: any[]): any; + dxDropDownMenu(options: DevExpress.ui.dxDropDownMenuOptions): JQuery; +} +declare module DevExpress.data { + export interface XmlaStoreOptions { + /** The HTTP address to an XMLA OLAP server. */ + url?: string; + /** The name of the database associated with the Store. */ + catalog?: string; + /** The cube name. */ + cube?: string; + beforeSend?: (request: Object) => void; + } + /** A Store that provides access to an OLAP cube using the XMLA standard. */ + export class XmlaStore { + constructor(options: XmlaStoreOptions); + } + export interface PivotGridField { + index?: number; + /** A boolean value specifying whether or not the field is visible in the pivot grid and the Field Chooser. */ + visible?: boolean; + /** Name of the data source field containing data for the pivot grid field. */ + dataField?: string; + /** A caption that will be displayed in the pivot grid's field chooser to identify the field. */ + caption?: string; + /** Specifies a type of field values. */ + dataType?: string; + /** Specifies how the values of the current field are combined into groups. Cannot be used for the XmlaStore store type. */ + groupInterval?: any; + /** Specifies how to aggregate field data. Cannot be used for th XmlaStore store type. */ + summaryType?: string; + /** Allows you to use a custom aggregate function to calculate the summary values. Cannot be used for the XmlaStore store type. */ + calculateCustomSummary?: (options: { + summaryProcess?: string; + value?: any; + totalValue?: any; + }) => void; + /** Specifies the function that determines how to split data from the data source into ranges for header items. Cannot be used for the XmlaStore store type. */ + selector?: (data: Object) => any; + /** Type of the area where the field is located. */ + area?: string; + /** Index among the other fields displayed within the same area. */ + areaIndex?: number; + /** The name of the folder in which the field is located. */ + displayFolder?: string; + /** The name of the group to which the field belongs. */ + groupName?: string; + /** The index of the field within a group. */ + groupIndex?: number; + /** Specifies the initial sort order of field values. */ + sortOrder?: string; + /** Specifies how field data should be sorted. Can be used for the XmlaStore store type only. */ + sortBy?: string; + /** Specifies the data field against which the header items of this field should be sorted. */ + sortBySummaryField?: string; + /** The array of field names that specify a path to column/row whose summary field is used for sorting of this field's header items. */ + sortBySummaryPath?: Array; + /** The filter values for the current field. */ + filterValues?: Array; + /** The filter type for the current field. */ + filterType?: string; + /** Indicates whether all header items of the field's header level are expanded. */ + expanded?: boolean; + /** Specifies whether the field should be treated as a Data Field. */ + isMeasure?: boolean; + /** Specifies a display format for field values. */ + format?: string; + /** Specifies a callback function that returns the text to be displayed in the cells of a field. */ + customizeText?: (cellInfo: { value: any; valueText: string }) => string; + /** Specifies a precision for formatted field values. */ + precision?: number; + /** Specifies how to sort the header items. */ + sortingMethod?: (a: Object, b: Object) => number; + /** Allows an end-user to change sorting options. */ + allowSorting?: boolean; + /** Allows an end-user to sort columns by summary values. */ + allowSortingBySummary?: boolean; + /** Allows an end-user to change filtering options. */ + allowFiltering?: boolean; + /** Allows an end-user to expand/collapse all header items within a header level. */ + allowExpandAll?: boolean; + /** Specifies the absolute width of the field in the pivot grid. */ + width?: number; + } + export interface PivotGridDataSourceOptions { + /** Specifies the underlying Store instance used to access data. */ + store?: any; + /** Indicates whether or not the automatic field generation from data in the Store is enabled. */ + retrieveFields?: boolean; + /** Specifies data filtering conditions. */ + filter?: Object; + /** An array of pivot grid fields. */ + fields?: Array; + /** Indicates whether or not the local sorting of the XMLA data should be performed. */ + localSorting?: boolean; + /** A handler for the changed event. */ + onChanged?: () => void; + /** A handler for the loadingChanged event. */ + onLoadingChanged?: (isLoading: boolean) => void; + /** A handler for the loadError event. */ + onLoadError?: (e?: Object) => void; + /** A handler for the fieldsPrepared event. */ + onFieldsPrepared?: (e?: Array) => void; + } + /** An object that provides access to data for the dxPivotGrid widget. */ + export class PivotGridDataSource implements EventsMixin { + constructor(options?: PivotGridDataSource); + /** Starts loading data. */ + load(): JQueryPromise; + /** Indicates whether or not the PivotGridDataSource is currently being loaded. */ + isLoading(): boolean; + /** Gets data displayed in a PivotGrid. */ + getData(): Object; + /** Gets all fields within a specified area. */ + getAreaFields(area: string, collectGroups: boolean): Array; + /** Gets all fields from the data source. */ + fields(): Array; + /** Sets the fields option. */ + fields(fields: Array): void; + /** Gets current options of a specified field. */ + field(id: any): PivotGridField; + /** Sets one or more options of a specified field. */ + field(id: any, field: PivotGridField): void; + /** Collapses a specified header item. */ + collapseHeaderItem(area: string, path: Array): void; + /** Expands a specified header item. */ + expandHeaderItem(area: string, path: Array): void; + /** Expands all header items of a field. */ + expandAll(id: any): void; + /** Collapses all header items of a field. */ + collapseAll(id: any): void; + /** Disposes of all resources associated with this PivotGridDataSource. */ + dispose(): void; + on(eventName: string, eventHandler: Function): PivotGridDataSource; + on(events: { [eventName: string]: Function; }): PivotGridDataSource; + off(eventName: string): PivotGridDataSource; + off(eventName: string, eventHandler: Function): PivotGridDataSource; + } +} +declare module DevExpress.ui { + export interface dxSchedulerOptions extends WidgetOptions { + /** Specifies a date displayed on the current scheduler view by default. */ + currentDate?: Date; + /** The earliest date the widget allows you to select. */ + min?: Date; + /** The latest date the widget allows you to select. */ + max?: Date; + /** Specifies the view used in the scheduler by default. */ + currentView?: string; + /** A data source used to fetch data to be displayed by the widget. */ + dataSource?: any; + /** Specifies the first day of a week. */ + firstDayOfWeek?: number; + /** The template to be used for rendering appointments. */ + appointmentTemplate?: any; + /** Lists the views to be available within the scheduler's View Selector. */ + views?: Array; + /** Specifies the resource kinds by which the scheduler's appointments are grouped in a timetable. */ + groups?: Array; + /** Specifies a start hour in the scheduler view's time interval. */ + startDayHour?: number; + /** Specifies an end hour in the scheduler view's time interval. */ + endDayHour?: number; + /** Specifies whether the scheduler data can be edited at runtime. */ + editing?: boolean; + /** Specifies an array of resources available in the scheduler. */ + resources?: Array<{ + /** Indicates whether or not several resources of this kind can be assigned to an appointment. */ + allowMultiple?: boolean; + /** Indicates whether or not resources of this kind have priority in the color identification of the appointments that have resources of different kinds assigned. */ + mainColor?: boolean; + /** A data source used to fetch resources to be available in the scheduler. */ + dataSource?: any; + /** Specifies the resource object field whose value is displayed by the Resource editor in the Appointment popup window. */ + displayExpr?: any; + /** Specifies the resource object field that is used as a value of the Resource editor in the Appointment popup window. */ + valueExpr?: any; + /** The name of the appointment object field that specifies a resource of this kind. */ + field?: string; + /** Specifies the label of the Appointment popup window field that allows end users to assign a resource of this kind. */ + label?: string; + }>; + /** A handler for the AppointmentAdding event. */ + onAppointmentAdding?: Function; + /** A handler for the appointmentAdded event. */ + onAppointmentAdded?: Function; + /** A handler for the AppointmentUpdating event. */ + onAppointmentUpdating?: Function; + /** A handler for the appointmentUpdated event. */ + onAppointmentUpdated?: Function; + /** A handler for the AppointmentDeleting event. */ + onAppointmentDeleting?: Function; + /** A handler for the appointmentDeleted event. */ + onAppointmentDeleted?: Function; + /** A handler for the appointmentRendered event. */ + onAppointmentRendered?: Function; + } + /** A widget that displays scheduled data using different views and provides the capability to load, add and edit appointments. */ + export class dxScheduler extends Widget { + constructor(element: JQuery, options?: dxSchedulerOptions); + constructor(element: Element, options?: dxSchedulerOptions); + /** Add the appointment defined by the object passed as a parameter to the data associated with the widget. */ + addAppointment(appointment: Object): void; + /** Updates the appointment specified by the first method parameter by the appointment object specified by the second method parameter in the the data associated with the widget. */ + updateAppointment(target: Object, appointment: Object): void; + /** Deletes the appointment defined by the parameter from the the data associated with the widget. */ + deleteAppointment(appointment: Object): void; + /** Scrolls the scheduler work space to the specified time. */ + scrollToTime(hours: number, minutes: number): void; + } + export interface dxColorBoxOptions extends dxDropDownEditorOptions { + /** Specifies the text displayed on the button that applies changes and closes the drop-down editor. */ + applyButtonText?: string; + applyValueMode?: string; + /** Specifies the text displayed on the button that cancels changes and closes the drop-down editor. */ + cancelButtonText?: string; + /** Specifies whether or not the widget value includes the alpha channel component. */ + editAlphaChannel?: boolean; + /** Specifies the size of a step by which a handle is moved using a keyboard shortcut. */ + keyStep?: number; + } + /** A widget used to specify a color value. */ + export class dxColorBox extends dxDropDownEditor { + constructor(element: JQuery, options?: dxColorBoxOptions); + constructor(element: Element, options?: dxColorBoxOptions); + } + export interface dxColorPickerOptions extends dxColorBoxOptions { } + /** + * A widget used to specify a color value. + * @deprecated Use the dxColorBox widget instead + */ + export class dxColorPicker extends dxColorBox { + constructor(element: JQuery, options?: dxColorPickerOptions); + constructor(element: Element, options?: dxColorPickerOptions); + } + export interface dxTreeViewOptions extends CollectionWidgetOptions { + /** Specifies whether or not to animate item collapsing and expanding. */ + animationEnabled?: boolean; + /** Specifies whether a nested or plain array is used as a data source. */ + dataStructure?: string; + /** Specifies whether or not a user can expand all tree view items by the "*" hot key. */ + expandAllEnabled?: boolean; + /** + * An array of currently expanded item objects. + * @deprecated Use item.expanded field instead + */ + expandedItems?: Array; + /** Specifies whether or not a check box is displayed at each tree view item. */ + showCheckBoxes?: boolean; + /** Specifies whether or not to select nodes recursively. */ + selectNodesRecursive?: boolean; + /** Specifies whether the "Select All" check box is displayed over the tree view. */ + selectAllEnabled?: boolean; + /** Specifies the text displayed at the "Select All" check box. */ + selectAllText?: string; + /** Specifies the name of the data source item field used as a key. */ + keyExpr?: any; + /** Specifies the name of the data source item field whose value is displayed by the widget. */ + displayExpr?: any; + /** Specifies the name of the data source item field whose value defines whether or not the corresponding node is selected. */ + selectedExpr?: any; + /** Specifies the name of the data source item field whose value defines whether or not the corresponding node is expanded. */ + expandedExpr?: any; + /** Specifies the name of the data source item field that contains an array of nested items. */ + itemsExpr?: any; + /** Specifies the name of the data source item field that holds the key of the parent item. */ + parentIdExpr?: any; + /** Specifies the name of the data source item field whose value defines whether or not the corresponding node is disabled. */ + disabledExpr?: any; + /** Specifies the name of the data source item field whose value defines whether or not the corresponding node includes child nodes. */ + hasItemsExpr?: any; + /** Specifies if the virtual mode is enabled. */ + virtualModeEnabled?: boolean; + /** Specifies the parent ID value of the root item. */ + rootValue?: any; + /** A string value specifying available scrolling directions. */ + scrollDirection?: string; + /** A handler for the itemSelected event. */ + onItemSelected?: Function; + /** A handler for the itemExpanded event. */ + onItemExpanded?: Function; + /** A handler for the itemCollapsed event. */ + onItemCollapsed?: Function; + onItemClick?: Function; + onItemContextMenu?: Function; + onItemRendered?: Function; + onItemHold?: Function; + hoverStateEnabled?: boolean; + focusStateEnabled?: boolean; + } + /** A widget displaying specified data items as a tree. */ + export class dxTreeView extends CollectionWidget { + constructor(element: JQuery, options?: dxTreeViewOptions); + constructor(element: Element, options?: dxTreeViewOptions); + /** Updates the tree view scrollbars according to the current size of the widget content. */ + updateDimensions(): JQueryPromise; + /** Selects the specified item. */ + selectItem(itemElement: any): void; + /** Unselects the specified item. */ + unselectItem(itemElement: any): void; + /** Expands the specified item. */ + expandItem(itemElement: any): void; + /** Collapses the specified item. */ + collapseItem(itemElement: any): void; + /** Returns all nodes of the tree view. */ + getNodes(): Array; + /** Selects all widget items. */ + selectAll(): void; + /** Unselects all widget items. */ + unselectAll(): void; + } + export interface dxMenuBaseOptions extends CollectionWidgetOptions { + /** An object that defines the animation options of the widget. */ + animation?: fx.AnimationOptions; + /** A Boolean value specifying whether or not the widget changes its state when interacting with a user. */ + activeStateEnabled?: boolean; + /** Specifies the name of the CSS class associated with the menu. */ + cssClass?: string; + /** Holds an array of menu items. */ + items?: Array; + /** Specifies whether or not an item becomes selected if an end-user clicks it. */ + selectionByClick?: boolean; + /** Specifies the selection mode supported by the menu. */ + selectionMode?: string; + /** Specifies options of submenu showing and hiding. */ + showSubmenuMode?: { + /** Specifies the mode name. */ + name?: string; + /** Specifies the delay of submenu show and hiding. */ + delay?: { + /** The time span after which the submenu is shown. */ + show?: number; + /** The time span after which the submenu is hidden. */ + hide?: number; + }; + }; + /** A Boolean value specifying whether or not the widget changes its state when being hovered by an end user. */ + hoverStateEnabled?: boolean; + } + export class dxMenuBase extends CollectionWidget { + constructor(element: JQuery, options?: dxMenuBaseOptions); + constructor(element: Element, options?: dxMenuBaseOptions); + /** Selects the specified item. */ + selectItem(itemElement: any): void; + /** Unselects the specified item. */ + unselectItem(itemElement: any): void; + } + export interface dxMenuOptions extends dxMenuBaseOptions { + /** Specifies whether or not the submenu is hidden when the mouse pointer leaves it. */ + hideSubmenuOnMouseLeave?: boolean; + /** Specifies whether the menu has horizontal or vertical orientation. */ + orientation?: string; + /** Specifies options for showing and hiding the first level submenu. */ + showFirstSubmenuMode?: { + /** Specifies the mode name. */ + name?: string; + /** Specifies the delay of submenu showing and hiding. */ + delay?: { + /** The time span after which the submenu is shown. */ + show?: number; + /** The time span after which the submenu is hidden. */ + hide?: number; + }; + }; + /** Specifies the direction at which the submenus are displayed. */ + submenuDirection?: string; + /** A handler for the submenuHidden event. */ + onSubmenuHidden?: Function; + submenuHiddenAction?: Function; + /** A handler for the submenuHiding event. */ + onSubmenuHiding?: Function; + submenuHidingAction?: Function; + /** A handler for the submenuShowing event. */ + onSubmenuShowing?: Function; + submenuShowingAction?: Function; + /** A handler for the submenuShown event. */ + onSubmenuShown?: Function; + submenuShownAction?: Function; + } + /** A menu widget. */ + export class dxMenu extends dxMenuBase { + constructor(element: JQuery, options?: dxMenuOptions); + constructor(element: Element, options?: dxMenuOptions); + } + export interface dxContextMenuOptions extends dxMenuBaseOptions { + /** Holds an object that specifies options of alternative menu invocation. */ + alternativeInvocationMode?: { + /** Specifies whether or not the standard context menu invocation (on a right mouse click or on a long tap) is disabled. */ + enabled?: Boolean; + /** Specifies the element used to invoke the context menu. */ + invokingElement?: any; + }; + /** A handler for the hidden event. */ + onHidden?: Function; + /** A handler for the hiding event. */ + onHiding?: Function; + /** A handler for the positioning event. */ + onPositioning?: Function; + /** A handler for the showing event. */ + onShowing?: Function; + /** A handler for the shown event. */ + onShown?: Function; + /** An object defining widget positioning options. */ + position?: PositionOptions; + /** Specifies the direction at which submenus are displayed. */ + submenuDirection?: string; + /** The target element associated with a popover. */ + target?: any; + /** A Boolean value specifying whether or not the widget is visible. */ + visible?: boolean; + } + /** A context menu widget. */ + export class dxContextMenu extends dxMenuBase { + constructor(element: JQuery, options?: dxContextMenuOptions); + constructor(element: Element, options?: dxContextMenuOptions); + /** Toggles the visibility of the widget. */ + toggle(showing: boolean): JQueryPromise; + /** Shows the widget. */ + show(): JQueryPromise; + /** Hides the widget. */ + hide(): JQueryPromise; + } + export interface dxRemoteOperations { + /** Specifies whether or not filtering must be performed on the server side. */ + filtering?: boolean; + /** Specifies whether or not paging must be performed on the server side. */ + paging?: boolean; + /** Specifies whether or not sorting must be performed on the server side. */ + sorting?: boolean; + } + export interface dxDataGridColumn { + /** Specifies the content alignment within column cells. */ + alignment?: string; + /** Specifies whether the values in a column can be edited at runtime. Setting this option makes sense only when editing is enabled for a grid. */ + allowEditing?: boolean; + /** Specifies whether or not a column can be used for filtering grid records. Setting this option makes sense only when the filter row and column header filtering are visible. */ + allowFiltering?: boolean; + /** Specifies whether or not the column can be anchored to a grid edge by end users. Setting this option makes sense only when the columnFixing | enabled option is set to true. */ + allowFixing?: boolean; + /** Specifies if a column can be used for searching grid records. Setting this option makes sense only when the search panel is visible. */ + allowSearch?: boolean; + /** Specifies whether a column can be used for grouping grid records at runtime. Setting this option makes sense only when the group panel is visible. */ + allowGrouping?: boolean; + /** Specifies whether or not a column can be hidden by a user. Setting this option makes sense only when the column chooser is visible. */ + allowHiding?: boolean; + /** Specifies whether or not a particular column can be used in column reordering. Setting this option makes sense only when the allowColumnReordering option is set to true. */ + allowReordering?: boolean; + /** Specifies whether or not a particular column can be resized by a user. Setting this option makes sense only when the allowColumnResizing option is true. */ + allowResizing?: boolean; + /** Specifies whether grid records can be sorted by a specific column at runtime. Setting this option makes sense only when the sorting mode differs from none. */ + allowSorting?: boolean; + /** Specifies whether groups appear expanded or not when records are grouped by a specific column. Setting this option makes sense only when grouping is allowed for this column. */ + autoExpandGroup?: boolean; + /** Specifies a callback function that returns a value to be displayed in a column cell. */ + calculateCellValue?: (rowData: Object) => string; + /** Specifies a callback function that defines filters for customary calculated grid cells. */ + calculateFilterExpression?: (filterValue: any, selectedFilterOperation: string) => Array; + /** Specifies a caption for a column. */ + caption?: string; + /** Specifies a custom template for grid column cells. */ + cellTemplate?: any; + /** Specifies a CSS class to be applied to a column. */ + cssClass?: string; + /** Specifies a field name or a function that returns a field name or a value to be used for grouping column cells. */ + calculateGroupValue?: any; + /** Specifies a field name or a function that returns a field name or a value to be used for sorting column cells. */ + calculateSortValue?: any; + /** Specifies a callback function that returns the text to be displayed in the cells of a column. */ + customizeText?: (cellInfo: { value: any; valueText: string }) => string; + /** Specifies the field of a data source that provides data for a column. */ + dataField?: string; + /** Specifies the required type of column values. */ + dataType?: string; + /** Specifies a custom template for the cell of a grid column when it is in an editing state. */ + editCellTemplate?: any; + /** Specifies whether HTML tags are displayed as plain text or applied to the values of the column. */ + encodeHtml?: boolean; + /** In a boolean column, replaces all false items with a specified text. */ + falseText?: string; + /** Specifies the set of available filter operations. */ + filterOperations?: Array; + /** Specifies a filter value for a column. */ + filterValue?: any; + /** Specifies initial filter values for the column's header filter. */ + filterValues?: Array; + /** Specifies whether to include or exclude the records with the values selected in the column's header filter. */ + filterType?: string; + /** Indicates whether the column takes part in horizontal grid scrolling or is anchored to a grid edge. */ + fixed?: boolean; + /** Specifies the grid edge to which the column is anchored. */ + fixedPosition?: string; + /** Specifies a format for the values displayed in a column. */ + format?: string; + /** Specifies a custom template for the group cell of a grid column. */ + groupCellTemplate?: any; + /** Specifies the index of a column when grid records are grouped by the values of this column. */ + groupIndex?: number; + /** Specifies a custom template for the header of a grid column. */ + headerCellTemplate?: any; + /** Specifies options of a lookup column. */ + lookup?: { + /** Specifies whether or not a user can nullify values of a lookup column. */ + allowClearing?: boolean; + /** Specifies the data source providing data for a lookup column. */ + dataSource?: any; + /** Specifies the expression defining the data source field whose values must be displayed. */ + displayExpr?: any; + /** Specifies the expression defining the data source field whose values must be replaced. */ + valueExpr?: string; + }; + /** Specifies a precision for formatted values displayed in a column. */ + precision?: number; + /** Specifies a filter operation applied to a column. */ + selectedFilterOperation?: string; + /** Specifies whether or not the column displays its values by using editors. */ + showEditorAlways?: boolean; + /** Specifies whether or not to display the column when grid records are grouped by it. */ + showWhenGrouped?: boolean; + /** Specifies the index of a column when grid records are sorted by the values of this column. */ + sortIndex?: number; + /** Specifies the initial sort order of column values. */ + sortOrder?: string; + /** In a boolean column, replaces all true items with a specified text. */ + trueText?: string; + /** Specifies whether a column is visible or not. */ + visible?: boolean; + /** Specifies the sequence number of the column in the grid. */ + visibleIndex?: number; + /** Specifies a column width in pixels or percentages. */ + width?: any; + /** Specifies an array of validation rules to be checked when updating column cell values. */ + validationRules?: Array; + /** Specifies whether or not to display the header of a hidden column in the column chooser. */ + showInColumnChooser?: boolean; + /** Specifies the identifier of the column. */ + name?: string; + } + export interface dxDataGridOptions extends WidgetOptions { + /** Specifies whether the outer borders of the grid are visible or not. */ + showBorders?: boolean; + /** Indicates whether to show the error row for the grid. */ + errorRowEnabled?: boolean; + /** A handler for the rowValidating event. */ + onRowValidating?: (e: Object) => void; + /** A handler for the contextMenuPreparing event. */ + onContextMenuPreparing?: (e: Object) => void; + initNewRow?: (e: { data: Object }) => void; + /** A handler for the initNewRow event. */ + onInitNewRow?: (e: { data: Object }) => void; + rowInserted?: (e: { data: Object; key: any }) => void; + /** A handler for the rowInserted event. */ + onRowInserted?: (e: { data: Object; key: any }) => void; + rowInserting?: (e: { data: Object; cancel: boolean }) => void; + /** A handler for the rowInserting event. */ + onRowInserting?: (e: { data: Object; cancel: boolean }) => void; + rowRemoved?: (e: { data: Object; key: any }) => void; + /** A handler for the rowRemoved event. */ + onRowRemoved?: (e: { data: Object; key: any }) => void; + rowRemoving?: (e: { data: Object; key: any; cancel: boolean }) => void; + /** A handler for the rowRemoving event. */ + onRowRemoving?: (e: { data: Object; key: any; cancel: boolean }) => void; + rowUpdated?: (e: { data: Object; key: any }) => void; + /** A handler for the rowUpdated event. */ + onRowUpdated?: (e: { data: Object; key: any }) => void; + rowUpdating?: (e: { oldData: Object; newData: Object; key: any; cancel: boolean }) => void; + /** A handler for the rowUpdating event. */ + onRowUpdating?: (e: { oldData: Object; newData: Object; key: any; cancel: boolean }) => void; + /** Enables a hint that appears when a user hovers the mouse pointer over a cell with truncated content. */ + cellHintEnabled?: boolean; + /** Specifies whether or not grid columns can be reordered by a user. */ + allowColumnReordering?: boolean; + /** Specifies whether or not grid columns can be resized by a user. */ + allowColumnResizing?: boolean; + cellClick?: any; + /** A handler for the cellClick event. */ + onCellClick?: any; + cellHoverChanged?: (e: Object) => void; + /** A handler for the cellHoverChanged event. */ + onCellHoverChanged?: (e: Object) => void; + cellPrepared?: (e: Object) => void; + /** A handler for the cellPrepared event. */ + onCellPrepared?: (e: Object) => void; + /** Specifies whether or not the width of grid columns depends on column content. */ + columnAutoWidth?: boolean; + /** Specifies the options of a column chooser. */ + columnChooser?: { + /** Specifies text displayed by the column chooser panel when it does not contain any columns. */ + emptyPanelText?: string; + /** Specifies whether a user can invoke the column chooser or not. */ + enabled?: boolean; + /** Specifies the height of the column chooser panel. */ + height?: number; + /** Specifies text displayed in the title of the column chooser panel. */ + title?: string; + /** Specifies the width of the column chooser panel. */ + width?: number; + }; + /** Specifies options for column fixing. */ + columnFixing?: { + /** Indicates if column fixing is enabled. */ + enabled?: boolean; + /** Contains options that specify texts for column-fixing related commands in the column header's context menu. */ + texts?: { + /** Specifies text for a context menu item that fixes the column for which the context menu is invoked. */ + fix?: string; + /** Specifies text for a context menu item that unfixes the column for which the context menu is invoked. */ + unfix?: string; + /** Specifies text for a context menu subitem that fixes a column, for which the context menu is invoked, to the left grid edge. */ + leftPosition?: string; + /** Specifies text for a context menu subitem that fixes a column, for which the context menu is invoked, to the right grid edge. */ + rightPosition?: string; + }; + }; + /** Specifies options for filtering using a column header filter. */ + headerFilter?: { + /** Indicates whether or not the column header filter button is visible. */ + visible?: boolean; + /** Specifies the height of the dropdown menu invoked when using a column header filter. */ + height?: number; + /** Specifies the width of the dropdown menu invoked when using a column header filter. */ + width?: number; + /** Contains options that specify texts for the dropdown menu invoked when you use a column header filter. */ + texts?: { + /** Specifies text for the item specifying an empty value in the column header filter's dropdown menu. */ + emptyValue?: string; + /** Specifies text for a button that closes the column header filter's dropdown menu and applies specified filtering. */ + ok?: string; + /** Specifies text for a button that closes the column header filter's dropdown menu without applying performed selection. */ + cancel?: string; + } + }; + /** An array of grid columns. */ + columns?: Array; + onContentReady?: Function; + contentReadyAction?: Function; + /** Specifies a function that customizes grid columns after they are created. */ + customizeColumns?: (columns: Array) => void; + dataErrorOccurred?: (errorObject: Error) => void; + /** Specifies a data source for the grid. */ + dataSource?: any; + editingStart?: (e: { + data: Object; + key: any; + cancel: boolean; + column: dxDataGridColumn + }) => void; + /** A handler for the editingStart event. */ + onEditingStart?: (e: { + data: Object; + key: any; + cancel: boolean; + column: dxDataGridColumn + }) => void; + editorPrepared?: (e: Object) => void; + /** A handler for the editorPrepared event. */ + onEditorPrepared?: (e: Object) => void; + editorPreparing?: (e: Object) => void; + /** A handler for the editorPreparing event. */ + onEditorPreparing?: (e: Object) => void; + /** Contains options that specify how grid content can be changed. */ + editing?: { + /** Specifies whether or not grid records can be edited at runtime. */ + editEnabled?: boolean; + /** Specifies how grid values can be edited manually. */ + editMode?: string; + /** Specifies whether or not new records can be inserted into a grid. */ + insertEnabled?: boolean; + /** Specifies whether or not records can be deleted from a grid. */ + removeEnabled?: boolean; + /** Contains options that specify texts for editing-related grid controls. */ + texts?: { + /** Specifies text for a hint that appears when a user hovers the mouse pointer over the "Save" button. Setting this option makes sense only when the editMode option is set to batch. */ + saveAllChanges?: string; + /** Specifies text for a cancel button displayed when a row is in the editing state. Setting this option makes sense only when the editEnabled option is set to true. */ + cancelRowChanges?: string; + /** Specifies text for a hint that appears when a user hovers the mouse pointer over the "Revert" button. Setting this option makes sense only when the editMode option is set to batch. */ + cancelAllChanges?: string; + /** Specifies a message to be displayed by a confirmation window. Setting this option makes sense only when the edit mode is "row". */ + confirmDeleteMessage?: string; + /** Specifies text to be displayed in the title of a confirmation window. Setting this option makes sense only when the edit mode is "row". */ + confirmDeleteTitle?: string; + /** Specifies text for a button that deletes a row from a grid. Setting this option makes sense only when the removeEnabled option is set to true. */ + deleteRow?: string; + /** Specifies text for a hint that appears when a user hovers the mouse pointer over the "Add" button. Setting this option makes sense only when the insertEnabled option is true. */ + addRow?: string; + /** Specifies text for a button that turns a row into the editing state. Setting this option makes sense only when the editEnabled option is set to true. */ + editRow?: string; + /** Specifies text for a save button displayed when a row is in the editing state. Setting this option makes sense only when the editEnabled option is set to true. */ + saveRowChanges?: string; + /** Specifies text for a button that recovers a deleted row. Setting this option makes sense only if the grid uses the batch edit mode and the removeEnabled option is set to true. */ + undeleteRow?: string; + }; + }; + /** Specifies filter row options. */ + filterRow?: { + /** Specifies when to apply a filter. */ + applyFilter?: string; + /** Specifies text for the hint that pops up when a user hovers the mouse pointer over the "Apply Filter" button. */ + applyFilterText?: string; + /** Specifies descriptions for filter operations. */ + operationDescriptions?: { + "=": string; + "<>": string; + "<": string; + "<=": string; + ">": string; + ">=": string; + "startswith": string; + "contains": string; + "notcontains": string; + "endswith": string; + }; + /** Specifies text for the reset operation in a filter list. */ + resetOperationText?: string; + /** Specifies text for the operation of clearing the applied filter when a select box is used. */ + showAllText?: string; + /** Specifies whether or not an icon that allows the user to choose a filter operation is visible. */ + showOperationChooser?: boolean; + /** Specifies whether the filter row is visible or not. */ + visible?: boolean; + }; + /** Specifies the behavior of grouped grid records. */ + grouping?: { + /** Specifies whether the user can collapse grouped records in a grid or not. */ + allowCollapsing?: boolean; + /** Specifies whether groups appear expanded or not. */ + autoExpandAll?: boolean; + /** Specifies the message displayed in a group row when the corresponding group is continued from the previous page. */ + groupContinuedMessage?: string; + /** Specifies the message displayed in a group row when the corresponding group continues on the next page. */ + groupContinuesMessage?: string; + }; + /** Specifies options that configure the group panel. */ + groupPanel?: { + /** Specifies whether columns can be dragged onto or from the group panel. */ + allowColumnDragging?: boolean; + /** Specifies text displayed by the group panel when it does not contain any columns. */ + emptyPanelText?: string; + /** Specifies whether the group panel is visible or not. */ + visible?: boolean; + }; + /** Specifies options configuring the load panel. */ + loadPanel?: { + /** Specifies whether to show the load panel or not. */ + enabled?: boolean; + /** Specifies the height of the load panel in pixels. */ + height?: number; + /** Specifies a URL pointing to an image to be used as a loading indicator. */ + indicatorSrc?: string; + /** Specifies whether or not a loading indicator must be displayed on the load panel. */ + showIndicator?: boolean; + /** Specifies whether or not the pane of the load panel must be displayed. */ + showPane?: boolean; + /** Specifies text displayed by the load panel. */ + text?: string; + /** Specifies the width of the load panel in pixels. */ + width?: number; + }; + /** Specifies text displayed when a grid does not contain any records. */ + noDataText?: string; + /** Specifies the options of a grid pager. */ + pager?: { + /** Specifies the page sizes that can be selected at runtime. */ + allowedPageSizes?: any; + /** Specifies whether to show the page size selector or not. */ + showPageSizeSelector?: boolean; + /** Specifies whether to show the pager or not. */ + visible?: any; + /** Specifies the text accompanying the page navigator. */ + infoText?: string; + /** Specifies whether or not to display the text accompanying the page navigator. This text is specified by the infoText option. */ + showInfo?: boolean; + /** Specifies whether or not to display buttons that switch the grid to the previous or next page. */ + showNavigationButtons?: boolean; + }; + /** Specifies paging options. */ + paging?: { + /** Specifies whether dxDataGrid loads data page by page or all at once. */ + enabled?: boolean; + /** Specifies the grid page that should be displayed by default. */ + pageIndex?: number; + /** Specifies the size of grid pages. */ + pageSize?: number; + }; + /** Specifies whether or not grid rows must be shaded in a different way. */ + rowAlternationEnabled?: boolean; + rowClick?: any; + /** A handler for the rowClick event. */ + onRowClick?: any; + rowPrepared?: (e: Object) => void; + /** A handler for the rowPrepared event. */ + onRowPrepared?: (e: Object) => void; + /** Specifies a custom template for grid rows. */ + rowTemplate?: any; + /** A configuration object specifying scrolling options. */ + scrolling?: { + /** Specifies the scrolling mode. */ + mode?: string; + /** Specifies whether or not a grid must preload pages adjacent to the current page when using virtual scrolling. */ + preloadEnabled?: boolean; + }; + /** Specifies options of the search panel. */ + searchPanel?: { + /** Specifies whether or not search strings in the located grid records should be highlighted. */ + highlightSearchText?: boolean; + /** Specifies text displayed by the search panel when no search string was typed. */ + placeholder?: string; + /** Specifies whether the search panel is visible or not. */ + visible?: boolean; + /** Specifies the width of the search panel in pixels. */ + width?: number; + /** Sets a search string for the search panel. */ + text?: string; + }; + /** Specifies the operations that must be performed on the server side. */ + remoteOperations?: any; + /** Allows you to sort groups according to the values of group summary items. */ + sortByGroupSummaryInfo?: Array<{ + /** Specifies the group summary item whose values must be used to sort groups. */ + summaryItem?: string; + /** Specifies the identifier of the column that must be used in grouping so that sorting by group summary item values be applied. */ + groupColumn?: string; + /** Specifies the sort order of group summary item values. */ + sortOrder?: string; + }>; + /** Allows you to build a master-detail interface in the grid. */ + masterDetail?: { + /** Enables an end-user to expand/collapse detail sections. */ + enabled?: boolean; + /** Specifies whether detail sections appear expanded or collapsed. */ + autoExpandAll?: boolean; + /** Specifies the template for detail sections. */ + template?: any; + }; + /** Specifies options for exporting grid data. */ + export?: { + /** Indicates if the export feature is enabled in the grid. */ + enabled?: boolean; + /** Specifies a default name for the file to which grid data is exported. */ + fileName?: string; + /** Specifies whether to enable Excel filtering for the exported data in the resulting XLSX file. */ + excelFilterEnabled?: boolean; + /** Specifies whether to enable word wrapping for the exported data in the resulting XLSX file. */ + excelWrapTextEnabled?: boolean; + /** Specifies the URL of the server-side proxy that streams the resulting file to the end user to enable export in IE8, IE9 and Safari browsers. */ + proxyUrl?: string; + /** Indicates whether to allow end users to export not only the data displayed in the grid, but the selected rows only. */ + allowExportSelectedData?: boolean; + /** Contains options that specify texts for the export-related commands and hints. */ + texts?: { + /** Specifies text for the Export button when this button invokes a dropdown menu so you can choose the required export format. */ + exportTo?: string; + /** Specifies text for the Export button when this button exports to the XSLX format. */ + exportToExcel?: string; + /** Specifies text for the item in the Export dropdown menu that exports grid data to Excel. */ + excelFormat?: string; + /** Specifies text for the option in the Export dropdown menu that allows you to choose whether to export all the grid data or the selected rows only. */ + selectedRows?: string; + } + }; + /** Specifies the keys of the records that must appear selected initially. */ + selectedRowKeys?: Array; + /** Specifies options of runtime selection. */ + selection?: { + /** Specifies whether the user can select all grid records at once. */ + allowSelectAll?: boolean; + /** Specifies the selection mode. */ + mode?: string; + }; + selectionChanged?: (e: { + currentSelectedRowKeys: Array; + currentDeselectedRowKeys: Array; + selectedRowKeys: Array; + selectedRowsData: Array; + }) => void; + /** A handler for the dataErrorOccured event. */ + onDataErrorOccurred?: (e: { error: Error }) => void; + /** A handler for the selectionChanged event. */ + onSelectionChanged?: (e: { + currentSelectedRowKeys: Array; + currentDeselectedRowKeys: Array; + selectedRowKeys: Array; + selectedRowsData: Array; + }) => void; + /** A handler for the exporting event. */ + onExporting?: (e: { + fileName: string; + format: string; + cancel: boolean; + }) => void; + /** A handler for the exported event. */ + onExported?: (e: Object) => void; + /** A handler for the keyDown event. */ + onKeyDown?: (e: Object) => void; + /** A handler for the rowExpanding event. */ + onRowExpanding?: (e: Object) => void; + /** A handler for the rowExpanded event. */ + onRowExpanded?: (e: Object) => void; + /** A handler for the rowCollapsing event. */ + onRowCollapsing?: (e: Object) => void; + /** A handler for the rowCollapsed event. */ + onRowCollapsed?: (e: Object) => void; + /** Specifies whether column headers are visible or not. */ + showColumnHeaders?: boolean; + /** Specifies whether or not vertical lines separating one grid column from another are visible. */ + showColumnLines?: boolean; + /** Specifies whether or not horizontal lines separating one grid row from another are visible. */ + showRowLines?: boolean; + /** Specifies options of runtime sorting. */ + sorting?: { + /** Specifies text for the context menu item that sets an ascending sort order in a column. */ + ascendingText?: string; + /** Specifies text for the context menu item that resets sorting settings for a column. */ + clearText?: string; + /** Specifies text for the context menu item that sets a descending sort order in a column. */ + descendingText?: string; + /** Specifies the runtime sorting mode. */ + mode?: string; + }; + /** Specifies options of state storing. */ + stateStoring?: { + /** Specifies a callback function that performs specific actions on state loading. */ + customLoad?: () => JQueryPromise; + /** Specifies a callback function that performs specific actions on state saving. */ + customSave?: (gridState: Object) => void; + /** Specifies whether or not a grid saves its state. */ + enabled?: boolean; + /** Specifies the delay between the last change of a grid state and the operation of saving this state in milliseconds. */ + savingTimeout?: number; + /** Specifies a unique key to be used for storing the grid state. */ + storageKey?: string; + /** Specifies the type of storage to be used for state storing. */ + type?: string; + }; + /** Specifies the options of the grid summary. */ + summary?: { + /** Contains options that specify text patterns for summary items. */ + texts?: { + /** Specifies a pattern for the 'sum' summary items when they are displayed in the parent column. */ + sum?: string; + /** Specifies a pattern for the 'sum' summary items displayed in a group row or in any other column rather than the parent one. */ + sumOtherColumn?: string; + /** Specifies a pattern for the 'min' summary items when they are displayed in the parent column. */ + min?: string; + /** Specifies a pattern for the 'min' summary items displayed in a group row or in any other column rather than the parent one. */ + minOtherColumn?: string; + /** Specifies a pattern for the 'max' summary items when they are displayed in the parent column. */ + max?: string; + /** Specifies a pattern for the 'max' summary items displayed in a group row or in any other column rather than the parent one. */ + maxOtherColumn?: string; + /** Specifies a pattern for the 'avg' summary items when they are displayed in the parent column. */ + avg?: string; + /** Specifies a pattern for the 'avg' summary items displayed in a group row or in any other column rather than the parent one. */ + avgOtherColumn?: string; + /** Specifies a pattern for the 'count' summary items. */ + count?: string; + }; + /** Specifies items of the group summary. */ + groupItems?: Array<{ + /** Specifies the identifier of a summary item. */ + name?: string; + /** Specifies the column that provides data for a group summary item. */ + column?: string; + /** Customizes the text to be displayed in the summary item. */ + customizeText?: (itemInfo: { + value: any; + valueText: string; + }) => string; + /** Specifies a pattern for the summary item text. */ + displayFormat?: string; + /** Specifies a precision for the summary item value of a numeric format. */ + precision?: number; + /** Specifies whether or not a summary item must be displayed in the group footer. */ + showInGroupFooter?: boolean; + /** Indicates whether to display group summary items in parentheses after the group row header or to align them by the corresponding columns within the group row. */ + alignByColumn?: boolean; + /** Specifies the column that must hold the summary item when this item is displayed in the group footer or aligned by a column in the group row. */ + showInColumn?: string; + /** Specifies how to aggregate data for a summary item. */ + summaryType?: string; + /** Specifies a format for the summary item value. */ + valueFormat?: string; + }>; + /** Specifies items of the total summary. */ + totalItems?: Array<{ + /** Specifies the identifier of a summary item. */ + name?: string; + /** Specifies the alignment of a summary item. */ + alignment?: string; + /** Specifies the column that provides data for a summary item. */ + column?: string; + /** Specifies a CSS class to be applied to a summary item. */ + cssClass?: string; + /** Customizes the text to be displayed in the summary item. */ + customizeText?: (itemInfo: { + value: any; + valueText: string; + }) => string; + /** Specifies a pattern for the summary item text. */ + displayFormat?: string; + /** Specifies a precision for the summary item value of a numeric format. */ + precision?: number; + /** Specifies the column that must hold the summary item. */ + showInColumn?: string; + /** Specifies how to aggregate data for a summary item. */ + summaryType?: string; + /** Specifies a format for the summary item value. */ + valueFormat?: string; + }>; + /** Allows you to use a custom aggregate function to calculate the value of a summary item. */ + calculateCustomSummary?: (options: { + component: dxDataGrid; + name?: string; + value: any; + totalValue: any; + summaryProcess: string + }) => void; + }; + /** Specifies whether text that does not fit into a column should be wrapped. */ + wordWrapEnabled?: boolean; + } + /** A data grid widget. */ + export class dxDataGrid extends Widget { + constructor(element: JQuery, options?: dxDataGridOptions); + constructor(element: Element, options?: dxDataGridOptions); + /** Ungroups grid records. */ + clearGrouping(): void; + /** Clears sorting settings of all grid columns at once. */ + clearSorting(): void; + /** Allows you to obtain a cell by its row index and the data field of its column. */ + getCellElement(rowIndex: number, dataField: string): any; + /** Allows you to obtain a cell by its row index and the visible index of its column. */ + getCellElement(rowIndex: number, visibleColumnIndex: number): any; + /** Returns the current state of the grid. */ + state(): Object; + /** Sets the grid state. */ + state(state: Object): void; + /** Allows you to obtain the row index by a data key. */ + getRowIndexByKey(key: any): number; + /** Allows you to obtain the data key by a row index. */ + getKeyByRowIndex(rowIndex: number): any; + /** Adds a new column to a grid. */ + addColumn(columnOptions: dxDataGridColumn): void; + /** Displays the load panel. */ + beginCustomLoading(messageText: string): void; + /** Discards changes made in a grid. */ + cancelEditData(): void; + /** Clears all the filters of a specific type applied to grid records. */ + clearFilter(): void; + /** Deselects all grid records. */ + clearSelection(): void; + /** Draws the cell being edited from the editing state. Use this method when the edit mode is batch. */ + closeEditCell(): void; + /** Collapses groups or master rows in a grid. */ + collapseAll(groupIndex?: number): void; + /** Returns the number of data columns in a grid. */ + columnCount(): number; + /** Returns the value of a specific column option. */ + columnOption(id: any, optionName: string): any; + /** Sets an option of a specific column. */ + columnOption(id: any, optionName: string, optionValue: any): void; + /** Returns the options of a column by an identifier. */ + columnOption(id: any): Object; + /** Sets several options of a column at once. */ + columnOption(id: any, options: Object): void; + /** Sets a specific cell into the editing state. */ + editCell(rowIndex: number, columnIndex: number): void; + /** Sets a specific row into the editing state. */ + editRow(rowIndex: number): void; + /** Hides the load panel. */ + endCustomLoading(): void; + /** Expands groups or master rows in a grid. */ + expandAll(groupIndex: number): void; + /** Allows you to find out whether a specific group or master row is expanded or collapsed. */ + isRowExpanded(key: any): boolean; + /** Allows you to expand a specific group or master row by its key. */ + expandRow(key: any): void; + /** Allows you to collapse a specific group or master row by its key. */ + collapseRow(key: any): void; + /** Applies a filter to the grid's data source. */ + filter(filterExpr?: any): void; + /** Returns a filter expression applied to the grid's data source using the filter(filterExpr) method. */ + filter(): any; + /** Returns a filter expression applied to the grid using all possible scenarious. */ + getCombinedFilter(): any; + /** Gets the keys of currently selected grid records. */ + getSelectedRowKeys(): Array; + /** Gets the data objects of currently selected grid records. */ + getSelectedRowsData(): Array; + /** Hides the column chooser panel. */ + hideColumnChooser(): void; + /** Adds a new data row to a grid. */ + insertRow(): void; + /** Returns the key corresponding to the passed data object. */ + keyOf(obj: Object): any; + /** Switches a grid to a specified page. */ + pageIndex(newIndex: number): void; + /** Gets the index of the current page. */ + pageIndex(): number; + /** Sets the page size. */ + pageSize(value: number): void; + /** Gets the current page size. */ + pageSize(): number; + /** Refreshes grid data. */ + refresh(): void; + /** Removes a specific row from a grid. */ + removeRow(rowIndex: number): void; + /** Saves changes made in a grid. */ + saveEditData(): void; + /** Searches grid records by a search string. */ + searchByText(text: string): void; + /** Selects all grid records. */ + selectAll(): void; + /** Deselects the rows that are currently selected within the applied filter. */ + deselectAll(): void; + /** Selects specific grid records. */ + selectRows(keys: Array, preserve: boolean): void; + /** Deselects specific grid records. */ + deselectRows(keys: Array): void; + /** Selects grid rows by indexes. */ + selectRowsByIndexes(indexes: Array): void; + /** Allows you to find out whether a row is selected or not. */ + isRowSelected(key: any): boolean; + /** Invokes the column chooser panel. */ + showColumnChooser(): void; + startSelectionWithCheckboxes(): boolean; + /** Returns the number of records currently held by a grid. */ + totalCount(): number; + /** Recovers a row deleted in the batch edit mode. */ + undeleteRow(rowIndex: number): void; + /** Allows you to obtain a data object by its key. */ + byKey(key: any): JQueryPromise; + /** Gets the value of a total summary item. */ + getTotalSummaryValue(summaryItemName: string): any; + /** Exports grid data to Excel. */ + exportToExcel(selectionOnly: boolean): void; + /** Updates the grid to the size of its content. */ + updateDimensions(): void; + /** Focuses the specified cell element in the grid. */ + focus(element?: JQuery): void; + } + export interface dxPivotGridOptions extends WidgetOptions { + onContentReady?: Function; + /** Specifies a data source for the pivot grid. */ + dataSource?: any; + /** Specifies whether or not the widget uses native scrolling. */ + useNativeScrolling?: any; + /** Allows an end-user to change sorting options. */ + allowSorting?: boolean; + /** Allows an end-user to sort columns by summary values. */ + allowSortingBySummary?: boolean; + /** Allows an end-user to change filtering options. */ + allowFiltering?: boolean; + /** Allows an end-user to expand/collapse all header items within a header level. */ + allowExpandAll?: boolean; + /** Specifies whether to display the Total rows. */ + showRowTotals?: boolean; + /** Specifies whether to display the Grand Total row. */ + showRowGrandTotals?: boolean; + /** Specifies whether to display the Total columns. */ + showColumnTotals?: boolean; + /** Specifies whether to display the Grand Total column. */ + showColumnGrandTotals?: boolean; + /** The Field Chooser configuration options. */ + fieldChooser?: { + /** Enables or disables the field chooser. */ + enabled?: boolean; + /** Specifies the field chooser layout. */ + layout?: number; + /** Specifies the text to display as a title of the field chooser popup window. */ + title?: string; + /** Specifies the field chooser width. */ + width?: number; + /** Specifies the field chooser height. */ + height?: number; + /** Strings that can be changed or localized in the pivot grid's integrated Field Chooser. */ + texts?: { + /** The string to display instead of Row Fields. */ + rowFields?: string; + /** The string to display instead of Column Fields. */ + columnFields?: string; + /** The string to display instead of Data Fields. */ + dataFields?: string; + /** The string to display instead of Filter Fields. */ + filterFields?: string; + /** The string to display instead of All Fields. */ + allFields?: string; + }; + } + /** Strings that can be changed or localized in the dxPivotGrid widget. */ + texts?: { + /** The string to display as a header of the Grand Total row and column. */ + grandTotal?: string; + /** The string to display as a header of the Total row and column. */ + total?: string; + /** Specifies the text displayed when a pivot grid does not contain any fields. */ + noData?: string; + /** The string to display as a Show Field Chooser context menu item. */ + showFieldChooser?: string; + /** The string to display as an Expand All context menu item. */ + expandAll?: string; + /** The string to display as a Collapse All context menu item. */ + collapseAll?: string; + /** The string to display as a Sort Column by Summary Value context menu item. */ + sortColumnBySummary?: string; + /** The string to display as a Sort Row by Summary Value context menu item. */ + sortRowBySummary?: string; + /** The string to display as a Remove All Sorting context menu item. */ + removeAllSorting?: string; + }; + /** The Load panel configuration options. */ + loadPanel?: { + /** Enables or disables the load panel. */ + enabled?: boolean; + /** Specifies the height of the load panel. */ + height?: number; + /** Specifies the URL pointing to an image that will be used as a load indicator. */ + indicatorSrc?: string; + /** Specifies whether or not to show a load indicator. */ + showIndicator?: boolean; + /** Specifies whether or not to show load panel background. */ + showPane?: boolean; + /** Specifies the text to display inside a load panel. */ + text?: string; + /** Specifies the width of the load panel. */ + width?: number; + }; + /** A handler for the cellClick event. */ + onCellClick?: (e: any) => void; + /** A handler for the cellPrepared event. */ + onCellPrepared?: (e: any) => void; + /** A handler for the contextMenuPreparing event. */ + onContextMenuPreparing?: (e: Object) => void; + } + /** A data summarization widget for multi-dimensional data analysis and data mining. */ + export class dxPivotGrid extends Widget { + constructor(element: JQuery, options?: dxPivotGridOptions); + constructor(element: Element, options?: dxPivotGridOptions); + /** Gets the PivotGridDataSource instance. */ + getDataSource(): DevExpress.data.PivotGridDataSource; + /** Updates the widget to the size of its content. */ + updateDimensions(): void; + } + export interface dxPivotGridFieldChooserOptions extends WidgetOptions { + /** Specifies the height of the widget. */ + height?: any; + /** Specifies the field chooser layout. */ + layout?: number; + /** The data source of a dxPivotGrid widget. */ + dataSource?: DevExpress.data.PivotGridDataSource; + onContentReady?: Function; + /** Strings that can be changed or localized in the dxPivotGridFieldChooser widget. */ + texts?: { + /** The string to display instead of Row Fields. */ + rowFields?: string; + /** The string to display instead of Column Fields. */ + columnFields?: string; + /** The string to display instead of Data Fields. */ + dataFields?: string; + /** The string to display instead of Filter Fields. */ + filterFields?: string; + /** The string to display instead of All Fields. */ + allFields?: string; + }; + } + /** A complementary widget for dxPivotGrid that allows you to manage data displayed in the dxPivotGrid. */ + export class dxPivotGridFieldChooser extends Widget { + constructor(element: JQuery, options?: dxPivotGridFieldChooserOptions); + constructor(element: Element, options?: dxPivotGridFieldChooserOptions); + /** Updates the widget to the size of its content. */ + updateDimensions(): void; + } +} +interface JQuery { + dxTreeView(): JQuery; + dxTreeView(options: "instance"): DevExpress.ui.dxTreeView; + dxTreeView(options: string): any; + dxTreeView(options: string, ...params: any[]): any; + dxTreeView(options: DevExpress.ui.dxTreeViewOptions): JQuery; + dxMenuBase(): JQuery; + dxMenuBase(options: "instance"): DevExpress.ui.dxMenuBase; + dxMenuBase(options: string): any; + dxMenuBase(options: string, ...params: any[]): any; + dxMenuBase(options: DevExpress.ui.dxMenuBaseOptions): JQuery; + dxMenu(): JQuery; + dxMenu(options: "instance"): DevExpress.ui.dxMenu; + dxMenu(options: string): any; + dxMenu(options: string, ...params: any[]): any; + dxMenu(options: DevExpress.ui.dxMenuOptions): JQuery; + dxContextMenu(): JQuery; + dxContextMenu(options: "instance"): DevExpress.ui.dxContextMenu; + dxContextMenu(options: string): any; + dxContextMenu(options: string, ...params: any[]): any; + dxContextMenu(options: DevExpress.ui.dxContextMenuOptions): JQuery; + dxColorBox(): JQuery; + dxColorBox(options: "instance"): DevExpress.ui.dxColorBox; + dxColorBox(options: string): any; + dxColorBox(options: string, ...params: any[]): any; + dxColorBox(options: DevExpress.ui.dxColorBoxOptions): JQuery; + dxDataGrid(): JQuery; + dxDataGrid(options: "instance"): DevExpress.ui.dxDataGrid; + dxDataGrid(options: string): any; + dxDataGrid(options: string, ...params: any[]): any; + dxDataGrid(options: DevExpress.ui.dxDataGridOptions): JQuery; + dxPivotGrid(): JQuery; + dxPivotGrid(options: "instance"): DevExpress.ui.dxPivotGrid; + dxPivotGrid(options: string): any; + dxPivotGrid(options: string, ...params: any[]): any; + dxPivotGrid(options: DevExpress.ui.dxPivotGridOptions): JQuery; + dxPivotGridFieldChooser(): JQuery; + dxPivotGridFieldChooser(options: "instance"): DevExpress.ui.dxPivotGridFieldChooser; + dxPivotGridFieldChooser(options: string): any; + dxPivotGridFieldChooser(options: string, ...params: any[]): any; + dxPivotGridFieldChooser(options: DevExpress.ui.dxPivotGridFieldChooserOptions): JQuery; + dxScheduler(): JQuery; + dxScheduler(options: "instance"): DevExpress.ui.dxScheduler; + dxScheduler(options: string): any; + dxScheduler(options: string, ...params: any[]): any; + dxScheduler(options: DevExpress.ui.dxSchedulerOptions): JQuery; +} +declare module DevExpress.framework { + /** An object used to store information on the views displayed in an application. */ + export class ViewCache { + viewRemoved: JQueryCallback; + /** Removes all the viewInfo objects from the cache. */ + clear(): void; + /** Obtains a viewInfo object from the cache by the specified key. */ + getView(key: string): Object; + /** Checks whether or not a viewInfo object is contained in the view cache under the specified key. */ + hasView(key: string): boolean; + /** Removes a viewInfo object from the cache by the specified key. */ + removeView(key: string): Object; + /** Adds the specified viewInfo object to the cache under the specified key. */ + setView(key: string, viewInfo: Object): void; + } + export interface dxCommandOptions extends DOMComponentOptions { + action?: any; + /** Specifies an action performed when the execute() method of the command is called. */ + onExecute?: any; + /** Indicates whether or not the widget that displays this command is disabled. */ + disabled?: boolean; + /** Specifies whether the current command is rendered when a view is being rendered or after a view is shown. */ + renderStage?: string; + /** Specifies the name of the icon shown inside the widget associated with this command. */ + icon?: string; + iconSrc?: string; + /** The identifier of the command. */ + id?: string; + /** Specifies the title of the widget associated with this command. */ + title?: string; + /** Specifies the type of the button, if the command is rendered as a dxButton widget. */ + type?: string; + /** A Boolean value specifying whether or not the widget associated with this command is visible. */ + visible?: boolean; + } + /** A markup component used to define markup options for a command. */ + export class dxCommand extends DOMComponent { + constructor(element: JQuery, options: dxCommandOptions); + constructor(options: dxCommandOptions); + /** Executes the action associated with this command. */ + execute(): void; + } + /** An object responsible for routing. */ + export class Router { + /** Adds a routing rule to the list of registered rules. */ + register(pattern: string, defaults?: Object, constraints?: Object): void; + /** Decodes the specified URI to an object using the registered routing rules. */ + parse(uri: string): Object; + /** Formats an object to a URI. */ + format(obj: Object): string; + } + export interface StateManagerOptions { + /** A storage to which the state manager saves the application state. */ + storage?: Object; + } + /** An object used to store the current application state. */ + export class StateManager { + constructor(options?: StateManagerOptions); + /** Adds an object that implements an interface of a state source to the state manager's collection of state sources. */ + addStateSource(stateSource: Object): void; + /** Removes a specified state source from the state manager's collection of state sources. */ + removeStateSource(stateSource: Object): void; + /** Saves the current application state. */ + saveState(): void; + /** Restores the application state that has been saved by the saveState() method to the state storage. */ + restoreState(): void; + /** Removes the application state that has been saved by the saveState() method to the state storage. */ + clearState(): void; + } + export module html { + export var layoutSets: Array; + export var animationSets: { [animationSetName: string]: AnimationSet }; + export interface AnimationSet { + [animationName: string]: any + } + export interface HtmlApplicationOptions { + /** Specifies where the commands that are defined in the application's views must be displayed. */ + commandMapping?: Object; + /** Specifies whether or not view caching is disabled. */ + disableViewCache?: boolean; + /** An array of layout controllers that should be used to show application views in the current navigation context. */ + layoutSet?: any; + /** Specifies the animation presets that are used to animate different UI elements in the current application. */ + animationSet?: AnimationSet; + /** Specifies whether the current application must behave as a mobile or web application. */ + mode?: string; + /** Specifies the object that represents a root namespace of the application. */ + namespace?: Object; + /** Specifies application behavior when the user navigates to a root view. */ + navigateToRootViewMode?: string; + /** An array of dxCommand configuration objects used to define commands available from the application's global navigation. */ + navigation?: Array; + /** A state manager to be used in the application. */ + stateManager?: StateManager; + /** Specifies the storage to be used by the application's state manager to store the application state. */ + stateStorage?: Object; + /** Indicates whether on not to use the title of the previously displayed view as text on the Back button. */ + useViewTitleAsBackText?: boolean; + /** A custom view cache to be used in the application. */ + viewCache?: Object; + /** Specifies a limit for the views that can be cached. */ + viewCacheSize?: number; + /** Specifies options for the viewport meta tag of a mobile browser. */ + viewPort?: JQuery; + /** A custom router to be used in the application. */ + router?: Router; + } + /** An object used to manage views, as well as control the application life cycle. */ + export class HtmlApplication implements EventsMixin { + constructor(options: HtmlApplicationOptions); + afterViewSetup: JQueryCallback; + beforeViewSetup: JQueryCallback; + initialized: JQueryCallback; + navigating: JQueryCallback; + navigatingBack: JQueryCallback; + resolveLayoutController: JQueryCallback; + viewDisposed: JQueryCallback; + viewDisposing: JQueryCallback; + viewHidden: JQueryCallback; + viewRendered: JQueryCallback; + viewShowing: JQueryCallback; + viewShown: JQueryCallback; + /** Provides access to the ViewCache object. */ + viewCache: ViewCache; + /** An array of dxCommand components that are created based on the application's navigation option value. */ + navigation: Array; + /** Provides access to the StateManager object. */ + stateManager: StateManager; + /** Provides access to the Router object. */ + router: Router; + /** Navigates to the URI preceding the current one in the navigation history. */ + back(): void; + /** Returns a Boolean value indicating whether or not backwards navigation is currently possible. */ + canBack(): boolean; + /** Calls the clearState() method of the application's StateManager object. */ + clearState(): void; + /** Creates global navigation commands. */ + createNavigation(navigationConfig: Array): void; + /** Returns an HTML template of the specified view. */ + getViewTemplate(viewName: string): JQuery; + /** Returns a configuration object used to create a dxView component for a specified view. */ + getViewTemplateInfo(viewName: string): Object; + /** Adds a specified HTML template to a collection of view or layout templates. */ + loadTemplates(source: any): JQueryPromise; + /** Navigates to the specified URI. */ + navigate(uri?: any, options?: Object): void; + /** Renders navigation commands to the navigation command containers that are located in the layouts used in the application. */ + renderNavigation(): void; + /** Calls the restoreState() method of the application's StateManager object. */ + restoreState(): void; + /** Calls the saveState method of the application's StateManager object. */ + saveState(): void; + /** Provides access to the object that defines the current context to be considered when choosing an appropriate template for a view. */ + templateContext(): Object; + on(eventName: "initialized", eventHandler: () => void): HtmlApplication; + on(eventName: "afterViewSetup", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + on(eventName: "beforeViewSetup", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + on(eventName: "navigating", eventHandler: (e: { + currentUri: string; + uri: string; + cancel: boolean; + options: { + root: boolean; + target: string; + direction: string; + rootInDetailPane: boolean; + modal: boolean; + }; + }) => void): HtmlApplication; + on(eventName: "navigatingBack", eventHandler: (e: { + cancel: boolean; + isHardwareButton: boolean; + }) => void): HtmlApplication; + on(eventName: "resolveLayoutController", eventHandler: (e: { + viewInfo: Object; + layoutController: Object; + availableLayoutControllers: Array; + }) => void): HtmlApplication; + on(eventName: "viewDisposed", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + on(eventName: "viewDisposing", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + on(eventName: "viewHidden", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + on(eventName: "viewRendered", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + on(eventName: "viewShowing", eventHandler: (e: { + viewInfo: Object; + direction: string; + }) => void): HtmlApplication; + on(eventName: "viewShown", eventHandler: (e: { + viewInfo: Object; + direction: string; + }) => void): HtmlApplication; + on(eventName: string, eventHandler: Function): HtmlApplication; + on(events: { [eventName: string]: Function; }): HtmlApplication; + off(eventName: "initialized"): HtmlApplication; + off(eventName: "afterViewSetup"): HtmlApplication; + off(eventName: "beforeViewSetup"): HtmlApplication; + off(eventName: "navigating"): HtmlApplication; + off(eventName: "navigatingBack"): HtmlApplication; + off(eventName: "resolveLayoutController"): HtmlApplication; + off(eventName: "viewDisposed"): HtmlApplication; + off(eventName: "viewDisposing"): HtmlApplication; + off(eventName: "viewHidden"): HtmlApplication; + off(eventName: "viewRendered"): HtmlApplication; + off(eventName: "viewShowing"): HtmlApplication; + off(eventName: "viewShown"): HtmlApplication; + off(eventName: string): HtmlApplication; + off(eventName: "initialized", eventHandler: () => void): HtmlApplication; + off(eventName: "afterViewSetup", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + off(eventName: "beforeViewSetup", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + off(eventName: "navigating", eventHandler: (e: { + currentUri: string; + uri: string; + cancel: boolean; + options: { + root: boolean; + target: string; + direction: string; + rootInDetailPane: boolean; + modal: boolean; + }; + }) => void): HtmlApplication; + off(eventName: "navigatingBack", eventHandler: (e: { + cancel: boolean; + isHardwareButton: boolean; + }) => void): HtmlApplication; + off(eventName: "resolveLayoutController", eventHandler: (e: { + viewInfo: Object; + layoutController: Object; + availableLayoutControllers: Array; + }) => void): HtmlApplication; + off(eventName: "viewDisposed", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + off(eventName: "viewDisposing", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + off(eventName: "viewHidden", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + off(eventName: "viewRendered", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + off(eventName: "viewShowing", eventHandler: (e: { + viewInfo: Object; + direction: string; + }) => void): HtmlApplication; + off(eventName: "viewShown", eventHandler: (e: { + viewInfo: Object; + direction: string; + }) => void): HtmlApplication; + off(eventName: string, eventHandler: Function): HtmlApplication; + } + } +} +declare module DevExpress.viz.core { + /** + * Applies a theme for the entire page with several DevExtreme visualization widgets. + * @deprecated Use the DevExpress.viz.currentTheme(theme) method instead. + */ + export function currentTheme(theme: string): void; + /** + * Applies a new theme (with the color scheme defined separately) for the entire page with several DevExtreme visualization widgets. + * @deprecated Use the DevExpress.viz.currentTheme(platform, colorScheme) method instead. + */ + export function currentTheme(platform: string, colorScheme: string): void; + /** + * Registers a new theme based on the existing one. + * @deprecated Use the DevExpress.viz.registerTheme(customTheme, baseTheme) method instead. + */ + export function registerTheme(customTheme: Object, baseTheme: string): void; + /** + * Applies a predefined or registered custom palette to all visualization widgets at once. + * @deprecated Use the DevExpress.viz.currentPalette(paletteName) method instead. + */ + export function currentPalette(paletteName: string): void; + /** + * Obtains the color sets of a predefined or registered palette. + * @deprecated Use the DevExpress.viz.getPalette(paletteName) method instead. + */ + export function getPalette(paletteName: string): Object; + /** + * Registers a new palette. + * @deprecated Use the DevExpress.viz.registerPalette(paletteName, palette) method instead. + */ + export function registerPalette(paletteName: string, palette: Object): void; + export interface Border { + /** Sets a border color for a selected series. */ + color?: string; + /** Sets border visibility for a selected series. */ + visible?: boolean; + /** Sets a border width for a selected series. */ + width?: number; + } + export interface DashedBorder extends Border { + /** Specifies a dash style for the border of a selected series point. */ + dashStyle?: string; + } + export interface DashedBorderWithOpacity extends DashedBorder { + /** Specifies the opacity of the tooltip's border. */ + opacity?: number; + } + export interface Font { + /** Specifies the font color for a strip label. */ + color?: string; + /** Specifies the font family for a strip label. */ + family?: string; + /** Specifies the font opacity for a strip label. */ + opacity?: number; + /** Specifies the font size for a strip label. */ + size?: any; + /** Specifies the font weight for the text displayed in strips. */ + weight?: number; + } + export interface Hatching { + direction?: string; + /** Specifies the opacity of hatching lines. */ + opacity?: number; + /** Specifies the distance between hatching lines in pixels. */ + step?: number; + /** Specifies the width of hatching lines in pixels. */ + width?: number; + } + export interface Margins { + /** Specifies the legend's bottom margin in pixels. */ + bottom?: number; + /** Specifies the legend's left margin in pixels. */ + left?: number; + /** Specifies the legend's right margin in pixels. */ + right?: number; + /** Specifies the legend's bottom margin in pixels. */ + top?: number; + } + export interface Size { + /** Specifies the width of the widget. */ + width?: number; + /** Specifies the height of the widget. */ + height?: number; + } + export interface Tooltip { + /** Specifies the length of the tooltip's arrow in pixels. */ + arrowLength?: number; + /** Specifies the appearance of the tooltip's border. */ + border?: viz.core.DashedBorderWithOpacity; + /** Specifies a color for the tooltip. */ + color?: string; + /** Specifies the z-index for tooltips. */ + zIndex?: number; + container?: any; + /** Specifies text and appearance of a set of tooltips. */ + customizeTooltip?: (arg: Object) => { color?: string; text?: string }; + /** Specifies whether or not the tooltip is enabled. */ + enabled?: boolean; + /** Specifies font options for the text displayed by the tooltip. */ + font?: Font; + /** Specifies a format for the text displayed by the tooltip. */ + format?: string; + /** Specifies the opacity of a tooltip. */ + opacity?: number; + /** Specifies a distance from the tooltip's left/right boundaries to the inner text in pixels. */ + paddingLeftRight?: number; + /** Specifies a distance from the tooltip's top/bottom boundaries to the inner text in pixels. */ + paddingTopBottom?: number; + /** Specifies a precision for formatted values displayed by the tooltip. */ + precision?: number; + /** Specifies options of the tooltip's shadow. */ + shadow?: { + /** Specifies the blur distance of the tooltip's shadow. */ + blur?: number; + /** Specifies the color of the tooltip's shadow. */ + color?: string; + /** Specifies the horizontal offset of the tooltip's shadow relative to the tooltip in pixels. */ + offsetX?: number; + /** Specifies the vertical offset of the tooltip's shadow relative to the tooltip in pixels. */ + offsetY?: number; + /** Specifies the opacity of the tooltip's shadow. */ + opacity?: number; + }; + } + export interface Animation { + /** Determines how long animation runs. */ + duration?: number; + /** Specifies the animation easing mode. */ + easing?: string; + /** Indicates whether or not animation is enabled. */ + enabled?: boolean; + } + export interface LoadingIndicator { + /** Specifies a color for the loading indicator background. */ + backgroundColor?: string; + /** Specifies font options for the loading indicator text. */ + font?: viz.core.Font; + /** Specifies whether to show the loading indicator or not. */ + show?: boolean; + /** Specifies a text to be displayed by the loading indicator. */ + text?: string; + } + export interface LegendBorder extends viz.core.DashedBorderWithOpacity { + /** Specifies a radius for the corners of the legend border. */ + cornerRadius?: number; + } + export interface BaseLegend { + /** Specifies the color of the legend's background. */ + backgroundColor?: string; + /** Specifies legend border settings. */ + border?: viz.core.LegendBorder; + /** Specifies how many columns must be taken to arrange legend items. */ + columnCount?: number; + /** Specifies the spacing between a pair of neighboring legend columns in pixels. */ + columnItemSpacing?: number; + /** Specifies font options for legend items. */ + font?: viz.core.Font; + /** Specifies the legend's position on the map. */ + horizontalAlignment?: string; + /** Specifies the alignment of legend items. */ + itemsAlignment?: string; + /** Specifies the position of text relative to the item marker. */ + itemTextPosition?: string; + /** Specifies the distance between the legend and the container borders in pixels. */ + margin?: viz.core.Margins; + /** Specifies the size of item markers in the legend in pixels. */ + markerSize?: number; + /** Specifies whether to arrange legend items horizontally or vertically. */ + orientation?: string; + /** Specifies the spacing between the legend left/right border and legend items in pixels. */ + paddingLeftRight?: number; + /** Specifies the spacing between the legend top/bottom border and legend items in pixels. */ + paddingTopBottom?: number; + /** Specifies how many rows must be taken to arrange legend items. */ + rowCount?: number; + /** Specifies the spacing between a pair of neighboring legend rows in pixels. */ + rowItemSpacing?: number; + /** Specifies the legend's position on the map. */ + verticalAlignment?: string; + /** Specifies whether or not the legend is visible on the map. */ + visible?: boolean; + } + export interface BaseWidgetOptions { + drawn?: (widget: Object) => void; + /** A handler for the drawn event. */ + onDrawn?: (e: { + component: BaseWidget; + element: Element; + }) => void; + incidentOccured?: (incidentInfo: { + id: string; + type: string; + args: any; + text: string; + widget: string; + version: string; + }) => void; + /** A handler for the incidentOccurred event. */ + onIncidentOccurred?: ( + component: BaseWidget, + element: Element, + target: { + id: string; + type: string; + args: any; + text: string; + widget: string; + version: string; + } + ) => void; + /** Notifies a widget that it is embedded into an HTML page that uses a path modifier. */ + pathModified?: boolean; + /** Specifies whether or not the widget supports right-to-left representation. */ + rtlEnabled?: boolean; + /** Sets the name of the theme to be used in the widget. */ + theme?: string; + } + /** This section describes options and methods that are common to all widgets. */ + export class BaseWidget extends DOMComponent { + /** Returns the widget's SVG markup. */ + svg(): string; + } +} +declare module DevExpress.viz.charts { + /** This section describes the fields and methods that can be used in code to manipulate the Series object. */ + export interface BaseSeries { + /** Provides information about the state of the series object. */ + fullState: number; + /** Returns the type of the series. */ + type: string; + /** Unselects all the selected points of the series. The points are displayed in an initial style. */ + clearSelection(): void; + /** Gets the color of a particular series. */ + getColor(): string; + /** + * Gets a point from the series point collection based on the specified argument. + * @deprecated getPointsByArg(pointArg).md + */ + getPointByArg(pointArg: any): Object; + /** Gets points from the series point collection based on the specified argument. */ + getPointsByArg(pointArg: any): Array; + /** Gets a point from the series point collection based on the specified point position. */ + getPointByPos(positionIndex: number): Object; + /** Selects the series. The series is displayed in a 'selected' style until another series is selected or the current series is deselected programmatically. */ + select(): void; + /** Selects the specified point. The point is displayed in a 'selected' style. */ + selectPoint(point: BasePoint): void; + /** Deselects the specified point. The point is displayed in an initial style. */ + deselectPoint(point: BasePoint): void; + /** Returns an array of all points in the series. */ + getAllPoints(): Array; + /** Returns visible series points. */ + getVisiblePoints(): Array; + } + /** This section describes the methods that can be used in code to manipulate the Point object. */ + export interface BasePoint { + /** Provides information about the state of the point object. */ + fullState: number; + /** Returns the point's argument value that was set in the data source. */ + originalArgument: any; + /** Returns the point's value that was set in the data source. */ + originalValue: any; + /** Returns the tag of the point. */ + tag: string; + /** Deselects the point. */ + clearSelection(): void; + /** Gets the color of a particular point. */ + getColor(): string; + /** Hides the tooltip of the point. */ + hideTooltip(): void; + /** Provides information about the hover state of a point. */ + isHovered(): any; + /** Provides information about the selection state of a point. */ + isSelected(): any; + /** Selects the point. The point is displayed in a 'selected' style until another point is selected or the current point is deselected programmatically. */ + select(): void; + /** Shows the tooltip of the point. */ + showTooltip(): void; + /** Allows you to obtain the label of a series point. */ + getLabel(): any; + /** Returns the series object to which the point belongs. */ + series: BaseSeries; + } + /** This section describes the fields and methods that can be used in code to manipulate the Series object. */ + export interface ChartSeries extends BaseSeries { + /** Returns the name of the series pane. */ + pane: string; + /** Returns the name of the value axis of the series. */ + axis: string; + /** Returns the name of the series. */ + name: string; + /** Returns the tag of the series. */ + tag: string; + /** Hides a series. */ + hide(): void; + /** Provides information about the hover state of a series. */ + isHovered(): any; + /** Provides information about the selection state of a series. */ + isSelected(): any; + /** Provides information about the visibility state of a series. */ + isVisible(): boolean; + /** Makes a particular series visible. */ + show(): void; + selectPoint(point: ChartPoint): void; + deselectPoint(point: ChartPoint): void; + getAllPoints(): Array; + getVisiblePoints(): Array; + } + /** This section describes the methods that can be used in code to manipulate the Point object. */ + export interface ChartPoint extends BasePoint { + /** Contains the close value of the point. This field is useful for points belonging to a series of the candle stick or stock type only. */ + originalCloseValue: any; + /** Contains the high value of the point. This field is useful for points belonging to a series of the candle stick or stock type only. */ + originalHighValue: any; + /** Contains the low value of the point. This field is useful for points belonging to a series of the candle stick or stock type only. */ + originalLowValue: any; + /** Contains the first value of the point. This field is useful for points belonging to a series of the range area or range bar type only. */ + originalMinValue: any; + /** Contains the open value of the point. This field is useful for points belonging to a series of the candle stick or stock type only. */ + originalOpenValue: any; + /** Contains the size of the bubble as it was set in the data source. This field is useful for points belonging to a series of the bubble type only. */ + size: any; + /** Gets the parameters of the point's minimum bounding rectangle (MBR). */ + getBoundingRect(): { x: number; y: number; width: number; height: number; }; + series: ChartSeries; + } + /** This section describes the methods that can be used in code to manipulate the Label object. */ + export interface Label { + /** Gets the parameters of the label's minimum bounding rectangle (MBR). */ + getBoundingRect(): { x: number; y: number; width: number; height: number; }; + /** Hides the point label. */ + hide(): void; + /** Shows the point label. */ + show(): void; + } + export interface PieSeries extends BaseSeries { + selectPoint(point: PiePoint): void; + deselectPoint(point: PiePoint): void; + getAllPoints(): Array; + getVisiblePoints(): Array; + } + /** This section describes the methods that can be used in code to manipulate the Point object. */ + export interface PiePoint extends BasePoint { + /** Gets the percentage value of the specific point. */ + percent: any; + /** Provides information about the visibility state of a point. */ + isVisible(): boolean; + /** Makes a specific point visible. */ + show(): void; + /** Hides a specific point. */ + hide(): void; + series: PieSeries; + } + /** This section describes the fields and methods that can be used in code to manipulate the Series object. */ + export interface PolarSeries extends BaseSeries { + /** Returns the name of the value axis of the series. */ + axis: string; + /** Returns the name of the series. */ + name: string; + /** Returns the tag of the series. */ + tag: string; + /** Hides a series. */ + hide(): void; + /** Provides information about the hover state of a series. */ + isHovered(): any; + /** Provides information about the selection state of a series. */ + isSelected(): any; + /** Provides information about the visibility state of a series. */ + isVisible(): boolean; + /** Makes a particular series visible. */ + show(): void; + selectPoint(point: PolarPoint): void; + deselectPoint(point: PolarPoint): void; + getAllPoints(): Array; + getVisiblePoints(): Array; + } + /** This section describes the methods that can be used in code to manipulate the Point object. */ + export interface PolarPoint extends BasePoint { + series: PolarSeries; + } + export interface Strip { + /** Specifies a color for a strip. */ + color?: string; + /** An object that defines the label configuration options of a strip. */ + label?: { + /** Specifies the text displayed in a strip. */ + text?: string; + }; + /** Specifies a start value for a strip. */ + startValue?: any; + /** Specifies an end value for a strip. */ + endValue?: any; + } + export interface BaseSeriesConfigLabel { + /** Specifies a format for arguments displayed by point labels. */ + argumentFormat?: string; + /** Specifies a precision for formatted point arguments displayed in point labels. */ + argumentPrecision?: number; + /** Specifies a background color for point labels. */ + backgroundColor?: string; + /** Specifies border options for point labels. */ + border?: viz.core.DashedBorder; + /** Specifies connector options for series point labels. */ + connector?: { + /** Specifies the color of label connectors. */ + color?: string; + /** Indicates whether or not label connectors are visible. */ + visible?: boolean; + /** Specifies the width of label connectors. */ + width?: number; + }; + /** Specifies a callback function that returns the text to be displayed by point labels. */ + customizeText?: (pointInfo: Object) => string; + /** Specifies font options for the text displayed in point labels. */ + font?: viz.core.Font; + /** Specifies a format for the text displayed by point labels. */ + format?: string; + position?: string; + /** Specifies a precision for formatted point values displayed in point labels. */ + precision?: number; + /** Specifies the angle used to rotate point labels from their initial position. */ + rotationAngle?: number; + /** Specifies the visibility of point labels. */ + visible?: boolean; + } + export interface SeriesConfigLabel extends BaseSeriesConfigLabel { + /** Specifies whether or not to show a label when the point has a zero value. */ + showForZeroValues?: boolean; + } + export interface ChartSeriesConfigLabel extends SeriesConfigLabel { + /** Specifies how to align point labels relative to the corresponding data points that they represent. */ + alignment?: string; + /** Specifies how to shift point labels horizontally from their initial positions. */ + horizontalOffset?: number; + /** Specifies how to shift point labels vertically from their initial positions. */ + verticalOffset?: number; + /** Specifies a precision for the percentage values displayed in the labels of a full-stacked-like series. */ + percentPrecision?: number; + } + export interface BaseCommonSeriesConfig { + /** Specifies the data source field that provides arguments for series points. */ + argumentField?: string; + axis?: string; + /** An object defining the label configuration options for a series in the dxChart widget. */ + label?: ChartSeriesConfigLabel; + /** Specifies border options for point labels. */ + border?: viz.core.DashedBorder; + /** Specifies a series color. */ + color?: string; + /** Specifies the dash style of the series' line. */ + dashStyle?: string; + hoverMode?: string; + hoverStyle?: { + /** An object defining the border options for a hovered series. */ + border?: viz.core.DashedBorder; + /**

    Sets a color for a series when it is hovered over.

    */ + color?: string; + /** Specifies the dash style for the line in a hovered series. */ + dashStyle?: string; + hatching?: viz.core.Hatching; + /** Specifies the width of a line in a hovered series. */ + width?: number; + }; + /** Specifies whether a chart ignores null data points or not. */ + ignoreEmptyPoints?: boolean; + /** Specifies how many points are acceptable to be in a series to display all labels for these points. Otherwise, the labels will not be displayed. */ + maxLabelCount?: number; + /** Specifies the minimal length of a displayed bar in pixels. */ + minBarSize?: number; + /** Specifies opacity for a series. */ + opacity?: number; + /** Specifies the series elements to highlight when the series is selected. */ + selectionMode?: string; + selectionStyle?: { + /** An object defining the border options for a selected series. */ + border?: viz.core.DashedBorder; + /** Sets a color for a series when it is selected. */ + color?: string; + /** Specifies the dash style for the line in a selected series. */ + dashStyle?: string; + hatching?: viz.core.Hatching; + /** Specifies the width of a line in a selected series. */ + width?: number; + }; + /** Specifies whether or not to show the series in the chart's legend. */ + showInLegend?: boolean; + /** Specifies the name of the stack where the values of the _stackedBar_ series must be located. */ + stack?: string; + /** Specifies the name of the data source field that provides data about a point. */ + tagField?: string; + /** Specifies the data source field that provides values for series points. */ + valueField?: string; + /** Specifies the visibility of a series. */ + visible?: boolean; + /** Specifies a line width. */ + width?: number; + /** Configures error bars. */ + valueErrorBar?: { + /** Specifies whether error bars must be displayed in full or partially. */ + displayMode?: string; + /** Specifies the data field that provides data for low error values. */ + lowValueField?: string; + /** Specifies the data field that provides data for high error values. */ + highValueField?: string; + /** Specifies how error bar values must be calculated. */ + type?: string; + /** Specifies the value to be used for generating error bars. */ + value?: number; + /** Specifies the color of error bars. */ + color?: string; + /** Specifies the opacity of error bars. */ + opacity?: number; + /** Specifies the length of the lines that indicate the error bar edges. */ + edgeLength?: number; + /** Specifies the width of the error bar line. */ + lineWidth?: number; + }; + } + export interface CommonPointOptions { + /** Specifies border options for points in the line and area series. */ + border?: viz.core.Border; + /** Specifies the points color. */ + color?: string; + /** Specifies what series points to highlight when a point is hovered over. */ + hoverMode?: string; + /** An object defining configuration options for a hovered point. */ + hoverStyle?: { + /** An object defining the border options for a hovered point. */ + border?: viz.core.Border; + /** Sets a color for a point when it is hovered over. */ + color?: string; + /** Specifies the diameter of a hovered point in the series that represents data points as symbols (not as bars for instance). */ + size?: number; + }; + /** Specifies what series points to highlight when a point is selected. */ + selectionMode?: string; + /** An object defining configuration options for a selected point. */ + selectionStyle?: { + /** An object defining the border options for a selected point. */ + border?: viz.core.Border; + /**

    Sets a color for a point when it is selected.

    */ + color?: string; + /** Specifies the diameter of a selected point in the series that represents data points as symbols (not as bars for instance). */ + size?: number; + }; + /** Specifies the point diameter in pixels for those series that represent data points as symbols (not as bars for instance). */ + size?: number; + /** Specifies a symbol for presenting points of the line and area series. */ + symbol?: string; + visible?: boolean; + } + export interface ChartCommonPointOptions extends CommonPointOptions { + /** An object specifying the parameters of an image that is used as a point marker. */ + image?: { + /** Specifies the height of an image that is used as a point marker. */ + height?: any; + /** Specifies a URL leading to the image to be used as a point marker. */ + url?: any; + /** Specifies the width of an image that is used as a point marker. */ + width?: any; + }; + } + export interface PolarCommonPointOptions extends CommonPointOptions { + /** An object specifying the parameters of an image that is used as a point marker. */ + image?: { + /** Specifies the height of an image that is used as a point marker. */ + height?: number; + /** Specifies a URL leading to the image to be used as a point marker. */ + url?: string; + /** Specifies the width of an image that is used as a point marker. */ + width?: number; + }; + } + /** An object that defines configuration options for chart series. */ + export interface CommonSeriesConfig extends BaseCommonSeriesConfig { + /** Specifies the data source field that provides a 'close' value for a _candleStick_ or _stock_ series. */ + closeValueField?: string; + /** Specifies a radius for bar corners. */ + cornerRadius?: number; + /** Specifies the data source field that provides a 'high' value for a _candleStick_ or _stock_ series. */ + highValueField?: string; + /** Specifies the color for the body (rectangle) of a _candleStick_ series. */ + innerColor?: string; + /** Specifies the data source field that provides a 'low' value for a _candleStick_ or _stock_ series. */ + lowValueField?: string; + /** Specifies the data source field that provides an 'open' value for a _candleStick_ or _stock_ series. */ + openValueField?: string; + /** Specifies the pane that will be used to display a series. */ + pane?: string; + /** An object defining configuration options for points in line-, scatter- and area-like series. */ + point?: ChartCommonPointOptions; + /** Specifies the data source field that provides values for one end of a range series. To set the data source field for the other end of the range series, use the rangeValue2Field property. */ + rangeValue1Field?: string; + /** Specifies the data source field that provides values for the second end of a range series. To set the data source field for the other end of the range series, use the rangeValue1Field property. */ + rangeValue2Field?: string; + /** Specifies reduction options for the stock or candleStick series. */ + reduction?: { + /** Specifies a color for the points whose reduction level price is lower in comparison to the value in the previous point. */ + color?: string; + /** Specifies for which price level (open, high, low or close) to enable reduction options in the series. */ + level?: string; + }; + /** Specifies the data source field that defines the size of bubbles. */ + sizeField?: string; + } + export interface CommonSeriesSettings extends CommonSeriesConfig { + /**

    An object that specifies configuration options for all series of the area type in the chart.

    */ + area?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _bar_ type in the chart. */ + bar?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the bubble type in the chart. */ + bubble?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _candleStick_ type in the chart. */ + candlestick?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _fullStackedArea_ type in the chart. */ + fullstackedarea?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the Full-Stacked Spline Area type in the chart. */ + fullstackedsplinearea?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _fullStackedBar_ type in the chart. */ + fullstackedbar?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _fullStackedLine_ type in the chart. */ + fullstackedline?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the Full-Stacked Spline type in the chart. */ + fullstackedspline?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _line_ type in the chart. */ + line?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _rangeArea_ type in the chart. */ + rangearea?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _rangeBar_ type in the chart. */ + rangebar?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _scatter_ type in the chart. */ + scatter?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _spline_ type in the chart. */ + spline?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _splineArea_ type in the chart. */ + splinearea?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _stackedArea_ type in the chart. */ + stackedarea?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the Stacked Spline Area type in the chart. */ + stackedsplinearea?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _stackedBar_ type in the chart. */ + stackedbar?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _stackedLine_ type in the chart. */ + stackedline?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the Stacked Spline type in the chart. */ + stackedspline?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _stepArea_ type in the chart. */ + steparea?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _stepLine_ type in the chart. */ + stepline?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _stock_ type in the chart. */ + stock?: CommonSeriesConfig; + /** Sets a series type. */ + type?: string; + } + export interface SeriesConfig extends CommonSeriesConfig { + /** Specifies the name that identifies the series. */ + name?: string; + /** Specifies data about a series. */ + tag?: any; + /** Sets the series type. */ + type?: string; + } + /** An object that defines configuration options for polar chart series. */ + export interface CommonPolarSeriesConfig extends BaseCommonSeriesConfig { + /** Specifies whether or not to close the chart by joining the end point with the first point. */ + closed?: boolean; + label?: SeriesConfigLabel; + point?: PolarCommonPointOptions; + } + export interface CommonPolarSeriesSettings extends CommonPolarSeriesConfig { + /** An object that specifies configuration options for all series of the area type in the chart. */ + area?: CommonPolarSeriesConfig; + /** An object that specifies configuration options for all series of the _bar_ type in the chart. */ + bar?: CommonPolarSeriesConfig; + /** An object that specifies configuration options for all series of the _line_ type in the chart. */ + line?: CommonPolarSeriesConfig; + /** An object that specifies configuration options for all series of the _scatter_ type in the chart. */ + scatter?: CommonPolarSeriesConfig; + /** An object that specifies configuration options for all series of the _stackedBar_ type in the chart. */ + stackedbar?: CommonPolarSeriesConfig; + /** Sets a series type. */ + type?: string; + } + export interface PolarSeriesConfig extends CommonPolarSeriesConfig { + /** Specifies the name that identifies the series. */ + name?: string; + /** Specifies data about a series. */ + tag?: any; + /** Sets the series type. */ + type?: string; + } + export interface PieSeriesConfigLabel extends BaseSeriesConfigLabel { + /** Specifies how to shift labels from their initial position in a radial direction in pixels. */ + radialOffset?: number; + /** Specifies a precision for the percentage values displayed in labels. */ + percentPrecision?: number; + } + /** An object that defines configuration options for chart series. */ + export interface CommonPieSeriesConfig { + /** Specifies the data source field that provides arguments for series points. */ + argumentField?: string; + /** Specifies the required type for series arguments. */ + argumentType?: string; + /** An object defining the series border configuration options. */ + border?: viz.core.DashedBorder; + /** Specifies a series color. */ + color?: string; + /** Specifies the chart elements to highlight when a series is hovered over. */ + hoverMode?: string; + /** An object defining configuration options for a hovered series. */ + hoverStyle?: { + /** An object defining the border options for a hovered series. */ + border?: viz.core.DashedBorder; + /** Sets a color for the series when it is hovered over. */ + color?: string; + /** Specifies the hatching options to be applied when a point is hovered over. */ + hatching?: viz.core.Hatching; + }; + /** Specifies the fraction of the inner radius relative to the total radius in the series of the 'doughnut' type. */ + innerRadius?: number; + /** An object defining the label configuration options. */ + label?: PieSeriesConfigLabel; + /** Specifies how many points are acceptable to be in a series to display all labels for these points. Otherwise, the labels will not be displayed. */ + maxLabelCount?: number; + /** Specifies a minimal size of a displayed pie segment. */ + minSegmentSize?: number; + /** Specifies the direction in which the dxPieChart's series points are located. */ + segmentsDirection?: string; + /**

    Specifies the chart elements to highlight when the series is selected.

    */ + selectionMode?: string; + /** An object defining configuration options for the series when it is selected. */ + selectionStyle?: { + /** An object defining the border options for a selected series. */ + border?: viz.core.DashedBorder; + /** Sets a color for a series when it is selected. */ + color?: string; + /** Specifies the hatching options to be applied when a point is selected. */ + hatching?: viz.core.Hatching; + }; + /** Specifies chart segment grouping options. */ + smallValuesGrouping?: { + /** Specifies the name of the grouped chart segment. This name represents the segment in the chart legend. */ + groupName?: string; + /** Specifies the segment grouping mode. */ + mode?: string; + /** Specifies a threshold for segment values. */ + threshold?: number; + /** Specifies how many segments must not be grouped. */ + topCount?: number; + }; + /** Specifies a start angle for a pie chart in arc degrees. */ + startAngle?: number; + /**

    Specifies the name of the data source field that provides data about a point.

    */ + tagField?: string; + /** Specifies the data source field that provides values for series points. */ + valueField?: string; + } + export interface PieSeriesConfig extends CommonPieSeriesConfig { + /** Sets the series type. */ + type?: string; + } + export interface SeriesTemplate { + /** Specifies a callback function that returns a series object with individual series settings. */ + customizeSeries?: (seriesName: string) => SeriesConfig; + /** Specifies a data source field that represents the series name. */ + nameField?: string; + } + export interface PolarSeriesTemplate { + /** Specifies a callback function that returns a series object with individual series settings. */ + customizeSeries?: (seriesName: string) => PolarSeriesConfig; + /** Specifies a data source field that represents the series name. */ + nameField?: string; + } + export interface ChartCommonConstantLineLabel { + /** Specifies font options for a constant line label. */ + font?: viz.core.Font; + /** Specifies the position of the constant line label relative to the chart plot. */ + position?: string; + /** Indicates whether or not to display labels for the axis constant lines. */ + visible?: boolean; + } + export interface PolarCommonConstantLineLabel { + /** Indicates whether or not to display labels for the axis constant lines. */ + visible?: boolean; + /** Specifies font options for a constant line label. */ + font?: viz.core.Font; + } + export interface ConstantLineStyle { + /** Specifies a color for a constant line. */ + color?: string; + /** Specifies a dash style for a constant line. */ + dashStyle?: string; + /** Specifies a constant line width in pixels. */ + width?: number; + } + export interface ChartCommonConstantLineStyle extends ConstantLineStyle { + /** An object defining constant line label options. */ + label?: ChartCommonConstantLineLabel; + /** Specifies the space between the constant line label and the left/right side of the constant line. */ + paddingLeftRight?: number; + /** Specifies the space between the constant line label and the top/bottom side of the constant line. */ + paddingTopBottom?: number; + } + export interface PolarCommonConstantLineStyle extends ConstantLineStyle { + /** An object defining constant line label options. */ + label?: PolarCommonConstantLineLabel; + } + export interface CommonAxisLabel { + /** Specifies font options for axis labels. */ + font?: viz.core.Font; + /** Specifies the spacing between an axis and its labels in pixels. */ + indentFromAxis?: number; + /** Indicates whether or not axis labels are visible. */ + visible?: boolean; + } + export interface ChartCommonAxisLabel extends CommonAxisLabel { + /** Specifies the label's position relative to the tick (grid line). */ + alignment?: string; + /** Specifies the overlap resolving algorithm to be applied to axis labels. */ + overlappingBehavior?: { + /** Specifies how to arrange axis labels. */ + mode?: string; + /** Specifies the angle used to rotate axis labels. */ + rotationAngle?: number; + /** Specifies the spacing that must be set between staggered rows when the 'stagger' algorithm is applied. */ + staggeringSpacing?: number; + }; + } + export interface PolarCommonAxisLabel extends CommonAxisLabel { + /** Specifies the overlap resolving algorithm to be applied to axis labels. */ + overlappingBehavior?: string; + } + export interface CommonAxisTitle { + /** Specifies font options for an axis title. */ + font?: viz.core.Font; + /** Specifies a margin for an axis title in pixels. */ + margin?: number; + } + export interface BaseCommonAxisSettings { + /** Specifies the color of the line that represents an axis. */ + color?: string; + /** Specifies whether ticks/grid lines of a discrete axis are located between labels or cross the labels. */ + discreteAxisDivisionMode?: string; + /** An object defining the configuration options for the grid lines of an axis in the dxPolarChart widget. */ + grid?: { + /** Specifies a color for grid lines. */ + color?: string; + /** Specifies an opacity for grid lines. */ + opacity?: number; + /** Indicates whether or not the grid lines of an axis are visible. */ + visible?: boolean; + /** Specifies the width of grid lines. */ + width?: number; + }; + /** Specifies the options of the minor grid. */ + minorGrid?: { + /** Specifies a color for the lines of the minor grid. */ + color?: string; + /** Specifies an opacity for the lines of the minor grid. */ + opacity?: number; + /** Indicates whether the minor grid is visible or not. */ + visible?: boolean; + /** Specifies a width for the lines of the minor grid. */ + width?: number; + }; + /** Indicates whether or not an axis is inverted. */ + inverted?: boolean; + /** Specifies the opacity of the line that represents an axis. */ + opacity?: number; + /** Indicates whether or not to set ticks/grid lines of a continuous axis of the 'date-time' type at the beginning of each date-time interval. */ + setTicksAtUnitBeginning?: boolean; + /** An object defining the configuration options for axis ticks. */ + tick?: { + /** Specifies ticks color. */ + color?: string; + /** Specifies tick opacity. */ + opacity?: number; + /** Indicates whether or not ticks are visible on an axis. */ + visible?: boolean; + }; + /** Specifies the options of the minor ticks. */ + minorTick?: { + /** Specifies a color for the minor ticks. */ + color?: string; + /** Specifies an opacity for the minor ticks. */ + opacity?: number; + /** Indicates whether or not the minor ticks are displayed on an axis. */ + visible?: boolean; + }; + /** Indicates whether or not the line that represents an axis in a chart is visible. */ + visible?: boolean; + /** Specifies the width of the line that represents an axis in the chart. */ + width?: number; + } + export interface ChartCommonAxisSettings extends BaseCommonAxisSettings { + /** Specifies the appearance of all the widget's constant lines. */ + constantLineStyle?: ChartCommonConstantLineStyle; + /** An object defining the label configuration options that are common for all axes in the dxChart widget. */ + label?: ChartCommonAxisLabel; + /** Specifies a coefficient that determines the spacing between the maximum series point and the axis. */ + maxValueMargin?: number; + /** Specifies a coefficient that determines the spacing between the minimum series point and the axis. */ + minValueMargin?: number; + /** Specifies, in pixels, the space reserved for an axis. */ + placeholderSize?: number; + /** An object defining configuration options for strip style. */ + stripStyle?: { + /** An object defining the configuration options for a strip label style. */ + label?: { + /** Specifies font options for a strip label. */ + font?: viz.core.Font; + /** Specifies the label's position on a strip. */ + horizontalAlignment?: string; + /** Specifies a label's position on a strip. */ + verticalAlignment?: string; + }; + /** Specifies the spacing, in pixels, between the left/right strip border and the strip label. */ + paddingLeftRight?: number; + /** Specifies the spacing, in pixels, between the top/bottom strip borders and the strip label. */ + paddingTopBottom?: number; + }; + /** An object defining the title configuration options that are common for all axes in the dxChart widget. */ + title?: CommonAxisTitle; + /** Indicates whether or not to display series with indents from axis boundaries. */ + valueMarginsEnabled?: boolean; + } + export interface PolarCommonAxisSettings extends BaseCommonAxisSettings { + /** Specifies the appearance of all the widget's constant lines. */ + constantLineStyle?: PolarCommonConstantLineStyle; + /** An object defining the label configuration options that are common for all axes in the dxPolarChart widget. */ + label?: PolarCommonAxisLabel; + /** An object defining configuration options for strip style. */ + stripStyle?: { + /** An object defining the configuration options for a strip label style. */ + label?: { + /** Specifies font options for a strip label. */ + font?: viz.core.Font; + }; + }; + } + export interface ChartConstantLineLabel extends ChartCommonConstantLineLabel { + /** Specifies the horizontal alignment of a constant line label. */ + horizontalAlignment?: string; + /** Specifies the vertical alignment of a constant line label. */ + verticalAlignment?: string; + /** Specifies the text to be displayed in a constant line label. */ + text?: string; + } + export interface PolarConstantLineLabel extends PolarCommonConstantLineLabel { + /** Specifies the text to be displayed in a constant line label. */ + text?: string; + } + export interface AxisLabel { + /** Specifies the text for a hint that appears when a user hovers the mouse pointer over a label on the value axis. */ + customizeHint?: (argument: { value: any; valueText: string }) => string; + /** Specifies a callback function that returns the text to be displayed in value axis labels. */ + customizeText?: (argument: { value: any; valueText: string }) => string; + /** Specifies a format for the text displayed by axis labels. */ + format?: string; + /** Specifies a precision for the formatted value displayed in the axis labels. */ + precision?: number; + } + export interface ChartAxisLabel extends ChartCommonAxisLabel, AxisLabel { } + export interface PolarAxisLabel extends PolarCommonAxisLabel, AxisLabel { } + export interface AxisTitle extends CommonAxisTitle { + /** Specifies the text for the value axis title. */ + text?: string; + } + export interface ChartConstantLineStyle extends ChartCommonConstantLineStyle { + /** An object defining constant line label options. */ + label?: ChartConstantLineLabel; + } + export interface ChartConstantLine extends ChartConstantLineStyle { + /** An object defining constant line label options. */ + label?: ChartConstantLineLabel; + /** Specifies a value to be displayed by a constant line. */ + value?: any; + } + export interface PolarConstantLine extends PolarCommonConstantLineStyle { + /** An object defining constant line label options. */ + label?: PolarConstantLineLabel; + /** Specifies a value to be displayed by a constant line. */ + value?: any; + } + export interface Axis { + /** Specifies a coefficient for dividing the value axis. */ + axisDivisionFactor?: number; + /** Specifies the order in which discrete values are arranged on the value axis. */ + categories?: Array; + /** Specifies the value to be raised to a power when generating ticks for a logarithmic axis. */ + logarithmBase?: number; + /** Specifies an interval between axis ticks/grid lines. */ + tickInterval?: any; + /** Specifies the interval between minor ticks. */ + minorTickInterval?: any; + /** Specifies the number of minor ticks between two neighboring major ticks. */ + minorTickCount?: number; + /** Specifies the required type of the value axis. */ + type?: string; + /** Specifies the pane on which the current value axis will be displayed. */ + pane?: string; + /** Specifies options for value axis strips. */ + strips?: Array; + } + export interface ChartAxis extends ChartCommonAxisSettings, Axis { + /** Defines an array of the value axis constant lines. */ + constantLines?: Array; + /** Specifies the appearance options for the constant lines of the value axis. */ + constantLineStyle?: ChartCommonConstantLineStyle; + /** Specifies options for value axis labels. */ + label?: ChartAxisLabel; + /** Specifies the maximum value on the value axis. */ + max?: any; + /** Specifies the minimum value on the value axis. */ + min?: any; + /** Specifies the position of the value axis on a chart. */ + position?: string; + /** Specifies the title for a value axis. */ + title?: AxisTitle; + } + export interface PolarAxis extends PolarCommonAxisSettings, Axis { + /** Defines an array of the value axis constant lines. */ + constantLines?: Array; + /** Specifies options for value axis labels. */ + label?: PolarAxisLabel; + } + export interface ArgumentAxis { + /** Specifies the desired type of axis values. */ + argumentType?: string; + /** Specifies the elements that will be highlighted when the argument axis is hovered over. */ + hoverMode?: string; + } + export interface ChartArgumentAxis extends ChartAxis, ArgumentAxis { } + export interface PolarArgumentAxis extends PolarAxis, ArgumentAxis { + /** Specifies a start angle for the argument axis in degrees. */ + startAngle?: number; + /** Specifies whether or not to display the first point at the angle specified by the startAngle option. */ + firstPointOnStartAngle?: boolean; + /** Specifies the period of the argument values in the data source. */ + period?: number; + } + export interface ValueAxis { + /** Specifies the name of the value axis. */ + name?: string; + /** Specifies whether or not to indicate a zero value on the value axis. */ + showZero?: boolean; + /** Specifies the desired type of axis values. */ + valueType?: string; + } + export interface ChartValueAxis extends ChartAxis, ValueAxis { + /** Specifies the spacing, in pixels, between multiple value axes in a chart. */ + multipleAxesSpacing?: number; + /** Specifies the value by which the chart's value axes are synchronized. */ + synchronizedValue?: number; + } + export interface PolarValueAxis extends PolarAxis, ValueAxis { + /** Indicates whether to display series with indents from axis boundaries. */ + valueMarginsEnabled?: boolean; + /** Specifies a coefficient that determines the spacing between the maximum series point and the axis. */ + maxValueMargin?: number; + /** Specifies a coefficient that determines the spacing between the minimum series point and the axis. */ + minValueMargin?: number; + tick?: { + visible?: boolean; + } + } + export interface CommonPane { + /** Specifies a background color in a pane. */ + backgroundColor?: string; + /** Specifies the border options of a chart's pane. */ + border?: PaneBorder; + } + export interface Pane extends CommonPane { + /** Specifies the name of a pane. */ + name?: string; + } + export interface PaneBorder extends viz.core.DashedBorderWithOpacity { + /** Specifies the bottom border's visibility state in a pane. */ + bottom?: boolean; + /** Specifies the left border's visibility state in a pane. */ + left?: boolean; + /** Specifies the right border's visibility state in a pane. */ + right?: boolean; + /** Specifies the top border's visibility state in a pane. */ + top?: boolean; + } + export interface ChartAnimation extends viz.core.Animation { + /** Specifies the maximum series point count in the chart that the animation supports. */ + maxPointCountSupported?: number; + } + export interface BaseChartTooltip extends viz.core.Tooltip { + /** Specifies a format for arguments of the chart's series points. */ + argumentFormat?: string; + /** Specifies a precision for formatted arguments displayed in tooltips. */ + argumentPrecision?: number; + /** Specifies a precision for a percent value displayed in tooltips for stacked series and dxPieChart series. */ + percentPrecision?: number; + } + export interface BaseChartOptions extends viz.core.BaseWidgetOptions { + /** Specifies adaptive layout options. */ + adaptiveLayout?: { + /** Specifies the width of the widget that is small enough for the layout to begin adapting. */ + width?: number; + /** Specifies the height of the widget that is small enough for the layout to begin adapting. */ + height?: number; + /** Specifies whether or not point labels can be hidden when the layout is adapting. */ + keepLabels?: boolean; + }; + /** Specifies animation options. */ + animation?: ChartAnimation; + /** Specifies a callback function that returns an object with options for a specific point label. */ + customizeLabel?: (labelInfo: Object) => Object; + /** Specifies a callback function that returns an object with options for a specific point. */ + customizePoint?: (pointInfo: Object) => Object; + /** Specifies a data source for the chart. */ + dataSource?: any; + done?: Function; + /** Specifies the appearance of the loading indicator. */ + loadingIndicator?: viz.core.LoadingIndicator; + /** Specifies options of a dxChart's (dxPieChart's) legend. */ + legend?: core.BaseLegend; + /** Specifies the blank space between the chart's extreme elements and the boundaries of the area provided for the widget (see size) in pixels. */ + margin?: viz.core.Margins; + /** Sets the name of the palette to be used in the chart. Alternatively, an array of colors can be set as a custom palette to be used within this chart. */ + palette?: any; + /** A handler for the done event. */ + onDone?: (e: { + component: BaseChart; + element: Element; + }) => void; + /** A handler for the pointClick event. */ + onPointClick?: any; + pointClick?: any; + /** A handler for the pointHoverChanged event. */ + onPointHoverChanged?: (e: { + component: BaseChart; + element: Element; + target: TPoint; + }) => void; + pointHoverChanged?: (point: TPoint) => void; + /** A handler for the pointSelectionChanged event. */ + onPointSelectionChanged?: (e: { + component: BaseChart; + element: Element; + target: TPoint; + }) => void; + pointSelectionChanged?: (point: TPoint) => void; + /** Specifies whether a single point or multiple points can be selected in the chart. */ + pointSelectionMode?: string; + /** Specifies whether to redraw the widget when the size of the parent browser window changes or a mobile device rotates. */ + redrawOnResize?: boolean; + /** Specifies options for the dxChart and dxPieChart widget series. */ + series?: any; + /** Specifies the size of the widget in pixels. */ + size?: viz.core.Size; + /** Specifies a title for the chart. */ + title?: { + /** Specifies font options for the title. */ + font?: viz.core.Font; + /** Specifies the title's horizontal position in the chart. */ + horizontalAlignment?: string; + /** Specifies a title's position on the chart in the vertical direction. */ + verticalAlignment?: string; + /** Specifies the distance between the title and surrounding chart elements in pixels. */ + margin?: viz.core.Margins; + /** Specifies the height of the space reserved for the title. */ + placeholderSize?: number; + /** Specifies a text for the chart's title. */ + text?: string; + }; + /** Specifies tooltip options. */ + tooltip?: BaseChartTooltip; + /** A handler for the tooltipShown event. */ + onTooltipShown?: (e: { + component: BaseChart; + element: Element; + target: BasePoint; + }) => void; + /** A handler for the tooltipHidden event. */ + onTooltipHidden?: (e: { + component: BaseChart; + element: Element; + target: BasePoint; + }) => void; + tooltipHidden?: (point: TPoint) => void; + tooltipShown?: (point: TPoint) => void; + } + /** A base class for all chart widgets included in the ChartJS library. */ + export class BaseChart extends viz.core.BaseWidget { + /** Deselects the chart's selected series. The series is displayed in an initial style. */ + clearSelection(): void; + /** Gets the current size of the widget. */ + getSize(): { width: number; height: number }; + /** Displays the loading indicator. */ + showLoadingIndicator(): void; + /** Conceals the loading indicator. */ + hideLoadingIndicator(): void; + /** Hides all widget tooltips. */ + hideTooltip(): void; + /** Redraws a widget. */ + render(renderOptions?: { + force?: boolean; + animate?: boolean; + asyncSeriesRendering?: boolean; + }): void; + } + export interface AdvancedLegend extends core.BaseLegend { + /** Specifies the text for a hint that appears when a user hovers the mouse pointer over a legend item. */ + customizeHint?: (seriesInfo: { seriesName: string; seriesIndex: number; seriesColor: string; }) => string; + /**

    Specifies a callback function that returns the text to be displayed by legend items.

    */ + customizeText?: (seriesInfo: { seriesName: string; seriesIndex: number; seriesColor: string; }) => string; + /** Specifies what series elements to highlight when a corresponding item in the legend is hovered over. */ + hoverMode?: string; + } + export interface AdvancedOptions extends BaseChartOptions { + /** A handler for the argumentAxisClick event. */ + onArgumentAxisClick?: any; + /** Specifies the color of the parent page element. */ + containerBackgroundColor?: string; + /** An object providing options for managing data from a data source. */ + dataPrepareSettings?: { + /** Specifies whether or not to validate the values from a data source. */ + checkTypeForAllData?: boolean; + /** Specifies whether or not to convert the values from a data source into the data type of an axis. */ + convertToAxisDataType?: boolean; + /** Specifies how to sort the series points. */ + sortingMethod?: any; + }; + /** A handler for the legendClick event. */ + onLegendClick?: any; + /** A handler for the seriesClick event. */ + onSeriesClick?: any; + /** A handler for the seriesHoverChanged event. */ + onSeriesHoverChanged?: (e: { + component: BaseChart; + element: Element; + target: TSeries; + }) => void; + /** A handler for the seriesSelectionChanged event. */ + onSeriesSelectionChanged?: (e: { + component: BaseChart; + element: Element; + target: TSeries; + }) => void; + /** Specifies whether a single series or multiple series can be selected in the chart. */ + seriesSelectionMode?: string; + /** Specifies how the chart must behave when series point labels overlap. */ + resolveLabelOverlapping?: string; + } + export interface Legend extends AdvancedLegend { + /** Specifies whether the legend is located outside or inside the chart's plot. */ + position?: string; + } + export interface ChartTooltip extends BaseChartTooltip { + /** Specifies whether the tooltip must be located in the center of a bar or on its edge. Applies to the Bar and Bubble series. */ + location?: string; + /** Specifies the kind of information to display in a tooltip. */ + shared?: boolean; + } + export interface dxChartOptions extends AdvancedOptions { + /** Specifies a value indicating whether all bars in a series must have the same width, or may have different widths if any points in other series are missing. */ + equalBarWidth?: any; + adaptiveLayout?: { + keepLabels?: boolean; + }; + /** Indicates whether or not to synchronize value axes when they are displayed on a single pane. */ + synchronizeMultiAxes?: boolean; + /** Specifies whether or not to filter the series points depending on their quantity. */ + useAggregation?: boolean; + /** Indicates whether or not to adjust a value axis to the current minimum and maximum values of a zoomed chart. */ + adjustOnZoom?: boolean; + /** Specifies argument axis options for the dxChart widget. */ + argumentAxis?: ChartArgumentAxis; + argumentAxisClick?: any; + /** An object defining the configuration options that are common for all axes of the dxChart widget. */ + commonAxisSettings?: ChartCommonAxisSettings; + /** An object defining the configuration options that are common for all panes in the dxChart widget. */ + commonPaneSettings?: CommonPane; + /** An object defining the configuration options that are common for all series of the dxChart widget. */ + commonSeriesSettings?: CommonSeriesSettings; + /** An object that specifies the appearance options of the chart crosshair. */ + crosshair?: { + /** Specifies a color for the crosshair lines. */ + color?: string; + /** Specifies a dash style for the crosshair lines. */ + dashStyle?: string; + /** Specifies whether to enable the crosshair or not. */ + enabled?: boolean; + /** Specifies the opacity of the crosshair lines. */ + opacity?: number; + /** Specifies the width of the crosshair lines. */ + width?: number; + /** Specifies the appearance of the horizontal crosshair line. */ + horizontalLine?: CrosshaierWithLabel; + /** Specifies the appearance of the vertical crosshair line. */ + verticalLine?: CrosshaierWithLabel; + /** Specifies the options of the crosshair labels. */ + label?: { + /** Specifies a color for the background of the crosshair labels. */ + backgroundColor?: string; + /** Specifies whether the crosshair labels are visible or not. */ + visible?: boolean; + /** Specifies font options for the text of the crosshair labels. */ + font?: viz.core.Font; + } + }; + /** Specifies a default pane for the chart's series. */ + defaultPane?: string; + /** Specifies a coefficient determining the diameter of the largest bubble. */ + maxBubbleSize?: number; + /** Specifies the diameter of the smallest bubble measured in pixels. */ + minBubbleSize?: number; + /** Defines the dxChart widget's pane(s). */ + panes?: Array; + /** Swaps the axes round so that the value axis becomes horizontal and the argument axes becomes vertical. */ + rotated?: boolean; + /** Specifies the options of a chart's legend. */ + legend?: Legend; + /** Specifies options for dxChart widget series. */ + series?: Array; + legendClick?: any; + seriesClick?: any; + seriesHoverChanged?: (series: ChartSeries) => void; + seriesSelectionChanged?: (series: ChartSeries) => void; + /** Defines options for the series template. */ + seriesTemplate?: SeriesTemplate; + /** Specifies tooltip options. */ + tooltip?: ChartTooltip; + /** Specifies value axis options for the dxChart widget. */ + valueAxis?: Array; + /** Enables scrolling in your chart. */ + scrollingMode?: string; + /** Enables zooming in your chart. */ + zoomingMode?: string; + /** Specifies the settings of the scroll bar. */ + scrollBar?: { + /** Specifies whether the scroll bar is visible or not. */ + visible?: boolean; + /** Specifies the spacing between the scroll bar and the chart's plot in pixels. */ + offset?: number; + /** Specifies the color of the scroll bar. */ + color?: string; + /** Specifies the width of the scroll bar in pixels. */ + width?: number; + /** Specifies the opacity of the scroll bar. */ + opacity?: number; + /** Specifies the position of the scroll bar in the chart. */ + position?: string; + }; + } + /** A widget used to embed charts into HTML JS applications. */ + export class dxChart extends BaseChart { + constructor(element: JQuery, options?: dxChartOptions); + constructor(element: Element, options?: dxChartOptions); + /** Returns an array of all series in the chart. */ + getAllSeries(): Array; + /** Gets a series within the chart's series collection by the specified name (see the name option). */ + getSeriesByName(seriesName: string): ChartSeries; + /** Gets a series within the chart's series collection by its position number. */ + getSeriesByPos(seriesIndex: number): ChartSeries; + /** Sets the specified start and end values for the chart's argument axis. */ + zoomArgument(startValue: any, endValue: any): void; + } + interface CrosshaierWithLabel extends viz.core.DashedBorderWithOpacity { + /** Configures the label that belongs to the horizontal crosshair line. */ + label?: { + /** Specifies a color for the background of the label that belongs to the horizontal crosshair line. */ + backgroundColor?: string; + /** Specifies whether the label of the horizontal crosshair line is visible or not. */ + visible?: boolean; + /** Specifies font options for the text of the label that belongs to the horizontal crosshair line. */ + font?: viz.core.Font; + } + } + export interface PolarChartTooltip extends BaseChartTooltip { + /** Specifies the kind of information to display in a tooltip. */ + shared?: boolean; + } + export interface dxPolarChartOptions extends AdvancedOptions { + /** Specifies a value indicating whether all bars in a series must have the same angle, or may have different angles if any points in other series are missing. */ + equalBarWidth?: boolean; + /** Specifies adaptive layout options. */ + adaptiveLayout?: { + width?: number; + height?: number; + /** Specifies whether or not point labels can be hidden when the layout is adapting. */ + keepLabels?: boolean; + }; + /** Indicates whether or not to display a "spider web". */ + useSpiderWeb?: boolean; + /** Specifies argument axis options for the dxPolarChart widget. */ + argumentAxis?: PolarArgumentAxis; + /** An object defining the configuration options that are common for all axes of the dxPolarChart widget. */ + commonAxisSettings?: PolarCommonAxisSettings; + /** An object defining the configuration options that are common for all series of the dxPolarChart widget. */ + commonSeriesSettings?: CommonPolarSeriesSettings; + /** Specifies the options of a chart's legend. */ + legend?: AdvancedLegend; + /** Specifies options for dxPolarChart widget series. */ + series?: Array; + /** Defines options for the series template. */ + seriesTemplate?: PolarSeriesTemplate; + /** Specifies tooltip options. */ + tooltip?: PolarChartTooltip; + /** Specifies value axis options for the dxPolarChart widget. */ + valueAxis?: PolarValueAxis; + } + /** A chart widget displaying data in a polar coordinate system. */ + export class dxPolarChart extends BaseChart { + constructor(element: JQuery, options?: dxPolarChartOptions); + constructor(element: Element, options?: dxPolarChartOptions); + /** Returns an array of all series in the chart. */ + getAllSeries(): Array; + /** Gets a series within the chart's series collection by the specified name (see the name option). */ + getSeriesByName(seriesName: string): PolarSeries; + /** Gets a series within the chart's series collection by its position number. */ + getSeriesByPos(seriesIndex: number): PolarSeries; + } + export interface PieLegend extends core.BaseLegend { + /** Specifies what chart elements to highlight when a corresponding item in the legend is hovered over. */ + hoverMode?: string; + /** Specifies the text for a hint that appears when a user hovers the mouse pointer over a legend item. */ + customizeHint?: (pointInfo: { pointName: string; pointIndex: number; pointColor: string; }) => string; + /** Specifies a callback function that returns the text to be displayed by a legend item. */ + customizeText?: (pointInfo: { pointName: string; pointIndex: number; pointColor: string; }) => string; + } + export interface dxPieChartOptions extends BaseChartOptions { + /** Specifies adaptive layout options. */ + adaptiveLayout?: { + /** Specifies whether or not point labels can be hidden when the layout is adapting. */ + keepLabels?: boolean; + }; + /** Specifies dxPieChart legend options. */ + legend?: PieLegend; + /** Specifies options for the series of the dxPieChart widget. */ + series?: Array; + /** Specifies the diameter of the pie. */ + diameter?: number; + /** A handler for the legendClick event. */ + onLegendClick?: any; + legendClick?: any; + /** Specifies how a chart must behave when series point labels overlap. */ + resolveLabelOverlapping?: string; + } + /** A circular chart widget for HTML JS applications. */ + export class dxPieChart extends BaseChart { + constructor(element: JQuery, options?: dxPieChartOptions); + constructor(element: Element, options?: dxPieChartOptions); + /** Provides access to the dxPieChart series. */ + getSeries(): PieSeries; + } +} +interface JQuery { + dxChart(options?: DevExpress.viz.charts.dxChartOptions): JQuery; + dxChart(methodName: string, ...params: any[]): any; + dxChart(methodName: "instance"): DevExpress.viz.charts.dxChart; + dxPieChart(options?: DevExpress.viz.charts.dxPieChartOptions): JQuery; + dxPieChart(methodName: string, ...params: any[]): any; + dxPieChart(methodName: "instance"): DevExpress.viz.charts.dxPieChart; + dxPolarChart(options?: DevExpress.viz.charts.dxPolarChartOptions): JQuery; + dxPolarChart(methodName: string, ...params: any[]): any; + dxPolarChart(methodName: "instance"): DevExpress.viz.charts.dxPolarChart; +} +declare module DevExpress.viz.gauges { + export interface BaseRangeContainer { + /** Specifies a range container's background color. */ + backgroundColor?: string; + /** Specifies the offset of the range container from an invisible scale line in pixels. */ + offset?: number; + /** Sets the name of the palette or an array of colors to be used for coloring the gauge range container. */ + palette?: any; + /** An array of objects representing ranges contained in the range container. */ + ranges?: Array<{ startValue: number; endValue: number; color: string }>; + /** Specifies a color of a range. */ + color?: string; + /** Specifies an end value of a range. */ + endValue?: number; + /** Specifies a start value of a range. */ + startValue?: number; + } + export interface ScaleTick { + /** Specifies the color of the scale's minor ticks. */ + color?: string; + /** Specifies an array of custom minor ticks. */ + customTickValues?: Array; + /** Specifies the length of the scale's minor ticks. */ + length?: number; + /** Indicates whether automatically calculated minor ticks are visible or not. */ + showCalculatedTicks?: boolean; + /** Specifies an interval between minor ticks. */ + tickInterval?: number; + /** Indicates whether scale minor ticks are visible or not. */ + visible?: boolean; + /** Specifies the width of the scale's minor ticks. */ + width?: number; + } + export interface ScaleMajorTick extends ScaleTick { + /** Specifies whether or not to expand the current major tick interval if labels overlap each other. */ + useTicksAutoArrangement?: boolean; + } + export interface BaseScaleLabel { + /** Specifies whether or not scale labels should be colored similarly to their corresponding ranges in the range container. */ + useRangeColors?: boolean; + /** Specifies a callback function that returns the text to be displayed in scale labels. */ + customizeText?: (scaleValue: { value: number; valueText: string }) => string; + /** Specifies font options for the text displayed in the scale labels of the gauge. */ + font?: viz.core.Font; + /** Specifies a format for the text displayed in scale labels. */ + format?: string; + /** Specifies a precision for the formatted value displayed in the scale labels. */ + precision?: number; + /** Specifies whether or not scale labels are visible on the gauge. */ + visible?: boolean; + } + export interface BaseScale { + /** Specifies the end value for the scale of the gauge. */ + endValue?: number; + /** Specifies whether or not to hide the first scale label. */ + hideFirstLabel?: boolean; + /** Specifies whether or not to hide the first major tick on the scale. */ + hideFirstTick?: boolean; + /** Specifies whether or not to hide the last scale label. */ + hideLastLabel?: boolean; + /** Specifies whether or not to hide the last major tick on the scale. */ + hideLastTick?: boolean; + /** Specifies common options for scale labels. */ + label?: BaseScaleLabel; + /** Specifies options of the gauge's major ticks. */ + majorTick?: ScaleMajorTick; + /** Specifies options of the gauge's minor ticks. */ + minorTick?: ScaleTick; + /** Specifies the start value for the scale of the gauge. */ + startValue?: number; + } + export interface BaseValueIndicator { + /** Specifies the type of subvalue indicators. */ + type?: string; + /** Specifies the background color for the indicator of the rangeBar type. */ + backgroundColor?: string; + /** Specifies the base value for the indicator of the rangeBar type. */ + baseValue?: number; + /** Specifies a color of the indicator. */ + color?: string; + /** Specifies the range bar size for an indicator of the rangeBar type. */ + size?: number; + text?: { + /** Specifies a callback function that returns the text to be displayed in an indicator. */ + customizeText?: (indicatedValue: { value: number; valueText: string }) => string; + font?: viz.core.Font; + /** Specifies a format for the text displayed in an indicator. */ + format?: string; + /** Specifies the range bar's label indent in pixels. */ + indent?: number; + /** Specifies a precision for the formatted value displayed by an indicator. */ + precision?: number; + }; + offset?: number; + length?: number; + width?: number; + /** Specifies the length of an arrow for the indicator of the textCloud type in pixels. */ + arrowLength?: number; + /** Sets the array of colors to be used for coloring subvalue indicators. */ + palette?: Array; + /** Specifies the distance between the needle and the center of a gauge for the indicator of a needle-like type. */ + indentFromCenter?: number; + /** Specifies the second color for the indicator of the twoColorNeedle type. */ + secondColor?: string; + /** Specifies the length of a twoNeedleColor type indicator tip as a percentage. */ + secondFraction?: number; + /** Specifies the spindle's diameter in pixels for the indicator of a needle-like type. */ + spindleSize?: number; + /** Specifies the inner diameter in pixels, so that the spindle has the shape of a ring. */ + spindleGapSize?: number; + /** Specifies the orientation of the rangeBar indicator on a vertically oriented dxLinearGauge widget. */ + horizontalOrientation?: string; + /** Specifies the orientation of the rangeBar indicator on a horizontally oriented dxLinearGauge widget. */ + verticalOrientation?: string; + } + export interface SharedGaugeOptions { + /** Specifies animation options. */ + animation?: viz.core.Animation; + /** Specifies the appearance of the loading indicator. */ + loadingIndicator?: viz.core.LoadingIndicator; + /** Specifies whether to redraw the widget when the size of the parent browser window changes or a mobile device rotates. */ + redrawOnResize?: boolean; + /** Specifies the size of the widget in pixels. */ + size?: viz.core.Size; + /** Specifies a subtitle for a gauge. */ + subtitle?: { + /** Specifies font options for the subtitle. */ + font?: viz.core.Font; + /** Specifies a text for the subtitle. */ + text?: string; + }; + /** Specifies a title for a gauge. */ + title?: { + /** Specifies font options for the title. */ + font?: viz.core.Font; + /** Specifies a title's position on the gauge. */ + position?: string; + /** Specifies a text for the title. */ + text?: string; + }; + /** Specifies options for gauge tooltips. */ + tooltip?: viz.core.Tooltip; + /** A handler for the tooltipShown event. */ + onTooltipShown?: (e: { + component: dxBaseGauge; + element: Element; + target: {}; + }) => void; + /** A handler for the tooltipHidden event. */ + onTooltipHidden?: (e: { + component: dxBaseGauge; + element: Element; + target: {}; + }) => void; + } + export interface BaseGaugeOptions extends viz.core.BaseWidgetOptions, SharedGaugeOptions { + /** Specifies the color of the parent page element. */ + containerBackgroundColor?: string; + /** Specifies the blank space in pixels between the widget's extreme elements and the boundaries of the area provided for the widget (see the size option). */ + margin?: viz.core.Margins; + /** Specifies options of the gauge's range container. */ + rangeContainer?: BaseRangeContainer; + /** Specifies a gauge's scale options. */ + scale?: BaseScale; + /** Specifies the appearance options of subvalue indicators. */ + subvalueIndicator?: BaseValueIndicator; + /** Specifies a set of subvalues to be designated by the subvalue indicators. */ + subvalues?: Array; + /** Specifies the main value on a gauge. */ + value?: number; + /** Specifies the appearance options of the value indicator. */ + valueIndicator?: BaseValueIndicator; + } + /** A gauge widget. */ + export class dxBaseGauge extends viz.core.BaseWidget { + /** Displays the loading indicator. */ + showLoadingIndicator(): void; + /** Conceals the loading indicator. */ + hideLoadingIndicator(): void; + /** Redraws a widget. */ + render(): void; + /** Returns the main gauge value. */ + value(): number; + /** Updates a gauge value. */ + value(value: number): void; + /** Returns an array of gauge subvalues. */ + subvalues(): Array; + /** Updates gauge subvalues. */ + subvalues(subvalues: Array): void; + } + export interface LinearRangeContainer extends BaseRangeContainer { + /** Specifies the orientation of the range container on a vertically oriented dxLinearGauge widget. */ + horizontalOrientation?: string; + /** Specifies the orientation of a range container on a horizontally oriented dxLinearGauge widget. */ + verticalOrientation?: string; + /** Specifies the width of the range container's start and end boundaries in the dxLinearGauge widget. */ + width?: any; + /** Specifies an end width of a range container. */ + end?: number; + /** Specifies a start width of a range container. */ + start?: number; + } + export interface LinearScaleLabel extends BaseScaleLabel { + /** Specifies the spacing between scale labels and ticks. */ + indentFromTick?: number; + } + export interface LinearScale extends BaseScale { + /** Specifies the orientation of scale ticks on a vertically oriented dxLinearGauge widget. */ + horizontalOrientation?: string; + label?: LinearScaleLabel; + /** Specifies the orientation of scale ticks on a horizontally oriented dxLinearGauge widget. */ + verticalOrientation?: string; + } + export interface dxLinearGaugeOptions extends BaseGaugeOptions { + /** Specifies the options required to set the geometry of the dxLinearGauge widget. */ + geometry?: { + /** Indicates whether to display the dxLinearGauge widget vertically or horizontally. */ + orientation?: string; + }; + /** Specifies gauge range container options. */ + rangeContainer?: LinearRangeContainer; + scale?: LinearScale; + } + /** A widget that represents a gauge with a linear scale. */ + export class dxLinearGauge extends dxBaseGauge { + constructor(element: JQuery, options?: dxLinearGaugeOptions); + constructor(element: Element, options?: dxLinearGaugeOptions); + } + export interface CircularRangeContainer extends BaseRangeContainer { + /** Specifies the orientation of the range container in the dxCircularGauge widget. */ + orientation?: string; + /** Specifies the range container's width in pixels. */ + width?: number; + } + export interface CircularScaleLabel extends BaseScaleLabel { + /** Specifies the spacing between scale labels and ticks. */ + indentFromTick?: number; + } + export interface CircularScale extends BaseScale { + label?: CircularScaleLabel; + /** Specifies the orientation of scale ticks. */ + orientation?: string; + } + export interface dxCircularGaugeOptions extends BaseGaugeOptions { + /** Specifies the options required to set the geometry of the dxCircularGauge widget. */ + geometry?: { + /** Specifies the end angle of the circular gauge's arc. */ + endAngle?: number; + /** Specifies the start angle of the circular gauge's arc. */ + startAngle?: number; + }; + /** Specifies gauge range container options. */ + rangeContainer?: CircularRangeContainer; + scale?: CircularScale; + } + /** A widget that represents a gauge with a circular scale. */ + export class dxCircularGauge extends dxBaseGauge { + constructor(element: JQuery, options?: dxCircularGaugeOptions); + constructor(element: Element, options?: dxCircularGaugeOptions); + } + export interface dxBarGaugeOptions extends viz.core.BaseWidgetOptions, SharedGaugeOptions { + /** Specifies a color for the remaining segment of the bar's track. */ + backgroundColor?: string; + /** Specifies a distance between bars in pixels. */ + barSpacing?: number; + /** Specifies a base value for bars. */ + baseValue?: number; + /** Specifies an end value for the gauge's invisible scale. */ + endValue?: number; + /** Defines the shape of the gauge's arc. */ + geometry?: { + /** Specifies the end angle of the bar gauge's arc. */ + endAngle?: number; + /** Specifies the start angle of the bar gauge's arc. */ + startAngle?: number; + }; + /** Specifies the options of the labels that accompany gauge bars. */ + label?: { + /** Specifies a color for the label connector text. */ + connectorColor?: string; + /** Specifies the width of the label connector in pixels. */ + connectorWidth?: number; + /** Specifies a callback function that returns a text for labels. */ + customizeText?: (barValue: { value: number; valueText: string }) => string; + /** Specifies font options for bar labels. */ + font?: viz.core.Font; + /** Specifies a format for bar labels. */ + format?: string; + /** Specifies the distance between the upper bar and bar labels in pixels. */ + indent?: number; + /** Specifies a precision for the formatted value displayed by labels. */ + precision?: number; + /** Specifies whether bar labels appear on a gauge or not. */ + visible?: boolean; + }; + /** Sets the name of the palette or an array of colors to be used for coloring the gauge range container. */ + palette?: string; + /** Defines the radius of the bar that is closest to the center relatively to the radius of the topmost bar. */ + relativeInnerRadius?: number; + /** Specifies a start value for the gauge's invisible scale. */ + startValue?: number; + /** Specifies the array of values to be indicated on a bar gauge. */ + values?: Array; + } + /** A circular bar widget. */ + export class dxBarGauge extends viz.core.BaseWidget { + constructor(element: JQuery, options?: dxBarGaugeOptions); + constructor(element: Element, options?: dxBarGaugeOptions); + /** Displays the loading indicator. */ + showLoadingIndicator(): void; + /** Conceals the loading indicator. */ + hideLoadingIndicator(): void; + /** Redraws the widget. */ + render(): void; + /** Returns an array of gauge values. */ + values(): Array; + /** Updates the values displayed by a gauge. */ + values(values: Array): void; + } +} +interface JQuery { + dxLinearGauge(options?: DevExpress.viz.gauges.dxLinearGaugeOptions): JQuery; + dxLinearGauge(methodName: string, ...params: any[]): any; + dxLinearGauge(methodName: "instance"): DevExpress.viz.gauges.dxLinearGauge; + dxCircularGauge(options?: DevExpress.viz.gauges.dxCircularGaugeOptions): JQuery; + dxCircularGauge(methodName: string, ...params: any[]): any; + dxCircularGauge(methodName: "instance"): DevExpress.viz.gauges.dxCircularGauge; + dxBarGauge(options?: DevExpress.viz.gauges.dxBarGaugeOptions): JQuery; + dxBarGauge(methodName: string, ...params: any[]): any; + dxBarGauge(methodName: "instance"): DevExpress.viz.gauges.dxBarGauge; +} +declare module DevExpress.viz.rangeSelector { + export interface dxRangeSelectorOptions extends viz.core.BaseWidgetOptions { + /** Specifies the options for the range selector's background. */ + background?: { + /** Specifies the background color for the dxRangeSelector. */ + color?: string; + /** Specifies image options. */ + image?: { + /** Specifies a location for the image in the background of a range selector. */ + location?: string; + /** Specifies the image's URL. */ + url?: string; + }; + /** Indicates whether or not the background (background color and/or image) is visible. */ + visible?: boolean; + }; + /** Specifies the dxRangeSelector's behavior options. */ + behavior?: { + /** Indicates whether or not you can swap sliders. */ + allowSlidersSwap?: boolean; + /** Indicates whether or not animation is enabled. */ + animationEnabled?: boolean; + /** Specifies when to call the onSelectedRangeChanged function. */ + callSelectedRangeChanged?: string; + /** Indicates whether or not an end user can specify the range using a mouse, without the use of sliders. */ + manualRangeSelectionEnabled?: boolean; + /** Indicates whether or not an end user can shift the selected range to the required location on a scale by clicking. */ + moveSelectedRangeByClick?: boolean; + /** Indicates whether to snap a slider to ticks. */ + snapToTicks?: boolean; + }; + /** Specifies the options required to display a chart as the range selector's background. */ + chart?: { + /** Specifies a coefficient for determining an indent from the bottom background boundary to the lowest chart point. */ + bottomIndent?: number; + /** An object defining the common configuration options for the chart’s series. */ + commonSeriesSettings?: viz.charts.CommonSeriesSettings; + /** An object providing options for managing data from a data source. */ + dataPrepareSettings?: { + /** Specifies whether or not to validate values from a data source. */ + checkTypeForAllData?: boolean; + /** Specifies whether or not to convert the values from a data source into the data type of an axis. */ + convertToAxisDataType?: boolean; + /** Specifies how to sort series points. */ + sortingMethod?: any; + }; + /** Specifies a value indicating whether all bars in a series must have the same width, or may have different widths if any points in other series are missing. */ + equalBarWidth?: any; + /** Sets the name of the palette to be used in the range selector's chart. Alternatively, an array of colors can be set as a custom palette to be used within this chart. */ + palette?: any; + /** An object defining the chart’s series. */ + series?: Array; + /** Defines options for the series template. */ + seriesTemplate?: viz.charts.SeriesTemplate; + /** Specifies a coefficient for determining an indent from the background's top boundary to the topmost chart point. */ + topIndent?: number; + /** Specifies whether or not to filter the series points depending on their quantity. */ + useAggregation?: boolean; + /** Specifies options for the chart's value axis. */ + valueAxis?: { + /** Indicates whether or not the chart's value axis must be inverted. */ + inverted?: boolean; + /** Specifies the value to be raised to a power when generating ticks for a logarithmic value axis. */ + logarithmBase?: number; + /** Specifies the maximum value of the chart's value axis. */ + max?: number; + /** Specifies the minimum value of the chart's value axis. */ + min?: number; + /** Specifies the type of the value axis. */ + type?: string; + /** Specifies the desired type of axis values. */ + valueType?: string; + }; + }; + /** Specifies the color of the parent page element. */ + containerBackgroundColor?: string; + /** Specifies a data source for the scale values and for the chart at the background. */ + dataSource?: any; + /** Specifies the data source field that provides data for the scale. */ + dataSourceField?: string; + /** Specifies the appearance of the loading indicator. */ + loadingIndicator?: viz.core.LoadingIndicator; + /** Specifies the blank space in pixels between the dxRangeSelector widget's extreme elements and the boundaries of the area provided for the widget (see size). */ + margin?: viz.core.Margins; + /** Specifies whether to redraw the widget when the size of the parent browser window changes or a mobile device rotates. */ + redrawOnResize?: boolean; + /** Specifies options of the range selector's scale. */ + scale?: { + /** Specifies the scale's end value. */ + endValue?: any; + /** Specifies common options for scale labels. */ + label?: { + /** Specifies a callback function that returns the text to be displayed in scale labels. */ + customizeText?: (scaleValue: { value: any; valueText: string; }) => string; + /** Specifies font options for the text displayed in the range selector's scale labels. */ + font?: viz.core.Font; + /** Specifies a format for the text displayed in scale labels. */ + format?: string; + /** Specifies a precision for the formatted value displayed in the scale labels. */ + precision?: number; + /** Specifies a spacing between scale labels and the background bottom edge. */ + topIndent?: number; + /** Specifies whether or not the scale's labels are visible. */ + visible?: boolean; + }; + /** Specifies the value to be raised to a power when generating ticks for a logarithmic scale. */ + logarithmBase?: number; + /** Specifies an interval between major ticks. */ + majorTickInterval?: any; + /** Specifies options for the date-time scale's markers. */ + marker?: { + /** Defines the options that can be set for the text that is displayed by the scale markers. */ + label?: { + /** Specifies a callback function that returns the text to be displayed in scale markers. */ + customizeText?: (markerValue: { value: any; valueText: string }) => string; + /** Specifies a format for the text displayed in scale markers. */ + format?: string; + }; + /** Specifies the height of the marker's separator. */ + separatorHeight?: number; + /** Specifies the space between the marker label and the marker separator. */ + textLeftIndent?: number; + /** Specifies the space between the marker's label and the top edge of the marker's separator. */ + textTopIndent?: number; + /** Specified the indent between the marker and the scale lables. */ + topIndent?: number; + /** Indicates whether scale markers are visible. */ + visible?: boolean; + }; + /** Specifies the maximum range that can be selected. */ + maxRange?: any; + /** Specifies the number of minor ticks between neighboring major ticks. */ + minorTickCount?: number; + /** Specifies an interval between minor ticks. */ + minorTickInterval?: any; + /** Specifies the minimum range that can be selected. */ + minRange?: any; + /** Specifies the height of the space reserved for the scale in pixels. */ + placeholderHeight?: number; + /** Indicates whether or not to set ticks of a date-time scale at the beginning of each date-time interval. */ + setTicksAtUnitBeginning?: boolean; + /** Specifies whether or not to show ticks for the boundary scale values, when neither major ticks nor minor ticks are created for these values. */ + showCustomBoundaryTicks?: boolean; + /** Indicates whether or not to show minor ticks on the scale. */ + showMinorTicks?: boolean; + /** Specifies the scale's start value. */ + startValue?: any; + /** Specifies options defining the appearance of scale ticks. */ + tick?: { + /** Specifies the color of scale ticks (both major and minor ticks). */ + color?: string; + /** Specifies the opacity of scale ticks (both major and minor ticks). */ + opacity?: number; + /** Specifies the width of the scale's ticks (both major and minor ticks). */ + width?: number; + }; + /** Specifies the type of the scale. */ + type?: string; + /** Specifies whether or not to expand the current tick interval if labels overlap each other. */ + useTicksAutoArrangement?: boolean; + /** Specifies the type of values on the scale. */ + valueType?: string; + /** Specifies the order of arguments on a discrete scale. */ + categories?: Array; + }; + /** Specifies the range to be selected when displaying the dxRangeSelector. */ + selectedRange?: { + /** Specifies the start value of the range to be selected when displaying the dxRangeSelector widget on a page. */ + startValue?: any; + /** Specifies the end value of the range to be selected when displaying the dxRangeSelector widget on a page. */ + endValue?: any; + }; + /** Specifies the color of the selected range. */ + selectedRangeColor?: string; + /** Range selector's indent options. */ + indent?: { + /** Specifies range selector's left indent. */ + left?: number; + /** Specifies range selector's right indent. */ + right?: number; + }; + selectedRangeChanged?: (selectedRange: { startValue: any; endValue: any; }) => void; + /** A handler for the selectedRangeChanged event. */ + onSelectedRangeChanged?: (e: { + startValue: any; + endValue: any; + component: dxRangeSelector; + element: Element; + }) => void; + /** Specifies range selector shutter options. */ + shutter?: { + /** Specifies shutter color. */ + color?: string; + /** Specifies the opacity of the color of shutters. */ + opacity?: number; + }; + /** Specifies in pixels the size of the dxRangeSelector widget. */ + size?: viz.core.Size; + /** Specifies the appearance of the range selector's slider handles. */ + sliderHandle?: { + /** Specifies the color of the slider handles. */ + color?: string; + /** Specifies the opacity of the slider handles. */ + opacity?: number; + /** Specifies the width of the slider handles. */ + width?: number; + }; + /** Defines the options of the range selector slider markers. */ + sliderMarker?: { + /** Specifies the color of the slider markers. */ + color?: string; + /** Specifies a callback function that returns the text to be displayed by slider markers. */ + customizeText?: (scaleValue: { value: any; valueText: any; }) => string; + /** Specifies font options for the text displayed by the range selector slider markers. */ + font?: viz.core.Font; + /** Specifies a format for the text displayed in slider markers. */ + format?: string; + /** Specifies the color used for the slider marker text when the currently selected range does not match the minRange and maxRange values. */ + invalidRangeColor?: string; + /** + * Specifies the empty space between the marker's border and the marker’s text. + * @deprecated Use the 'paddingTopBottom' and 'paddingLeftRight' options instead + */ + padding?: number; + /** Specifies the empty space between the marker's top and bottom borders and the marker's text. */ + paddingTopBottom?: number; + /** Specifies the empty space between the marker's left and right borders and the marker's text. */ + paddingLeftRight?: number; + /** Specifies the placeholder height of the slider marker. */ + placeholderHeight?: number; + /** + * Specifies in pixels the height and width of the space reserved for the range selector slider markers. + * @deprecated Use the 'placeholderHeight' and 'indent' options instead + */ + placeholderSize?: { + /** Specifies the height of the placeholder for the left and right slider markers. */ + height?: number; + /** Specifies the width of the placeholder for the left and right slider markers. */ + width?: { + /** Specifies the width of the left slider marker's placeholder. */ + left?: number; + /** Specifies the width of the right slider marker's placeholder. */ + right?: number; + }; + }; + /** Specifies a precision for the formatted value displayed in slider markers. */ + precision?: number; + /** Indicates whether or not the slider markers are visible. */ + visible?: boolean; + }; + } + /** A widget that allows end users to select a range of values on a scale. */ + export class dxRangeSelector extends viz.core.BaseWidget { + constructor(element: JQuery, options?: dxRangeSelectorOptions); + constructor(element: Element, options?: dxRangeSelectorOptions); + /** Displays the loading indicator. */ + showLoadingIndicator(): void; + /** Conceals the loading indicator. */ + hideLoadingIndicator(): void; + /** Redraws a widget. */ + render(skipChartAnimation?: boolean): void; + /** Returns the currently selected range. */ + getSelectedRange(): { startValue: any; endValue: any; }; + /** Sets a specified range. */ + setSelectedRange(selectedRange: { startValue: any; endValue: any; }): void; + } +} +interface JQuery { + dxRangeSelector(options?: DevExpress.viz.rangeSelector.dxRangeSelectorOptions): JQuery; + dxRangeSelector(methodName: string, ...params: any[]): any; + dxRangeSelector(methodName: "instance"): DevExpress.viz.rangeSelector.dxRangeSelector; +} +declare module DevExpress.viz.map { + /** This section describes the fields and methods that can be used in code to manipulate the Area object. */ + export interface Area { + /** Contains the element type. */ + type: string; + /** Return the value of an attribute. */ + attribute(name: string): any; + /** Provides information about the selection state of an area. */ + selected(): boolean; + /** Sets a new selection state for an area. */ + selected(state: boolean): void; + /** Applies the area settings specified as a parameter and updates the area appearance. */ + applySettings(settings: any): void; + } + /** This section describes the fields and methods that can be used in code to manipulate the Markers object. */ + export interface Marker { + /** Contains the descriptive text accompanying the map marker. */ + text: string; + /** Contains the type of the element. */ + type: string; + /** Contains the URL of an image map marker. */ + url: string; + /** Contains the value of a bubble map marker. */ + value: number; + /** Contains the values of a pie map marker. */ + values: Array; + /** Returns the value of an attribute. */ + attribute(name: string): any; + /** Returns the coordinates of a specific marker. */ + coordinates(): Array; + /** Provides information about the selection state of a marker. */ + selected(): boolean; + /** Sets a new selection state for a marker. */ + selected(state: boolean): void; + /** Applies the marker settings specified as a parameter and updates the marker appearance. */ + applySettings(settings: any): void; + } + export interface AreaSettings { + /** Specifies the width of the area border in pixels. */ + borderWidth?: number; + /** Specifies a color for the area border. */ + borderColor?: string; + click?: any; + /** Specifies a color for an area. */ + color?: string; + /** Specifies the function that customizes each area individually. */ + customize?: (areaInfo: Area) => AreaSettings; + /** Specifies a color for the area border when the area is hovered over. */ + hoveredBorderColor?: string; + /** Specifies the pixel-measured width of the area border when the area is hovered over. */ + hoveredBorderWidth?: number; + /** Specifies a color for an area when this area is hovered over. */ + hoveredColor?: string; + /** Specifies whether or not to change the appearance of an area when it is hovered over. */ + hoverEnabled?: boolean; + /** Configures area labels. */ + label?: { + /** Specifies the data field that provides data for area labels. */ + dataField?: string; + /** Enables area labels. */ + enabled?: boolean; + /** Specifies font options for area labels. */ + font?: viz.core.Font; + }; + /** Specifies the name of the palette or a custom range of colors to be used for coloring a map. */ + palette?: any; + /** Specifies the number of colors in a palette. */ + paletteSize?: number; + /** Allows you to paint areas with similar attributes in the same color. */ + colorGroups?: Array; + /** Specifies the field that provides data to be used for coloring areas. */ + colorGroupingField?: string; + /** Specifies a color for the area border when the area is selected. */ + selectedBorderColor?: string; + /** Specifies a color for an area when this area is selected. */ + selectedColor?: string; + /** Specifies the pixel-measured width of the area border when the area is selected. */ + selectedBorderWidth?: number; + selectionChanged?: (area: Area) => void; + /** Specifies whether single or multiple areas can be selected on a vector map. */ + selectionMode?: string; + } + export interface MarkerSettings { + /** Specifies a color for the marker border. */ + borderColor?: string; + /** Specifies the width of the marker border in pixels. */ + borderWidth?: number; + click?: any; + /** Specifies a color for a marker of the dot or bubble type. */ + color?: string; + /** Specifies the function that customizes each marker individually. */ + customize?: (markerInfo: Marker) => MarkerSettings; + font?: Object; + /** Specifies the pixel-measured width of the marker border when the marker is hovered over. */ + hoveredBorderWidth?: number; + /** Specifies a color for the marker border when the marker is hovered over. */ + hoveredBorderColor?: string; + /** Specifies a color for a marker of the dot or bubble type when this marker is hovered over. */ + hoveredColor?: string; + /** Specifies whether or not to change the appearance of a marker when it is hovered over. */ + hoverEnabled?: boolean; + /** Specifies marker label options. */ + label?: { + /** Enables marker labels. */ + enabled?: boolean; + /** Specifies font options for marker labels. */ + font?: viz.core.Font; + }; + /** Specifies the pixel-measured diameter of the marker that represents the biggest value. Setting this option makes sense only if you use markers of the bubble type. */ + maxSize?: number; + /** Specifies the pixel-measured diameter of the marker that represents the smallest value. Setting this option makes sense only if you use markers of the bubble type. */ + minSize?: number; + /** Specifies the opacity of markers. Setting this option makes sense only if you use markers of the bubble type. */ + opacity?: number; + /** Specifies the pixel-measured width of the marker border when the marker is selected. */ + selectedBorderWidth?: number; + /** Specifies a color for the marker border when the marker is selected. */ + selectedBorderColor?: string; + /** Specifies a color for a marker of the dot or bubble type when this marker is selected. */ + selectedColor?: string; + selectionChanged?: (marker: Marker) => void; + /** Specifies whether a single or multiple markers can be selected on a vector map. */ + selectionMode?: string; + /** Specifies the size of markers. Setting this option makes sense for any type of marker except bubble. */ + size?: number; + /** Specifies the type of markers to be used on the map. */ + type?: string; + /** Specifies the name of a palette or a custom set of colors to be used for coloring markers of the pie type. */ + palette?: any; + /** Allows you to paint markers with similar attributes in the same color. */ + colorGroups?: Array; + /** Specifies the field that provides data to be used for coloring markers. */ + colorGroupingField?: string; + /** Allows you to display bubbles with similar attributes in the same size. */ + sizeGroups?: Array; + /** Specifies the field that provides data to be used for sizing bubble markers. */ + sizeGroupingField?: string; + } + export interface dxVectorMapOptions extends viz.core.BaseWidgetOptions { + /** An object specifying options for the map areas. */ + areaSettings?: AreaSettings; + /** Specifies the options for the map background. */ + background?: { + /** Specifies a color for the background border. */ + borderColor?: string; + /** Specifies a color for the background. */ + color?: string; + }; + /** Specifies the positioning of a map in geographical coordinates. */ + bounds?: Array; + /** Specifies the options of the control bar. */ + controlBar?: { + /** Specifies a color for the outline of the control bar elements. */ + borderColor?: string; + /** Specifies a color for the inner area of the control bar elements. */ + color?: string; + /** Specifies whether or not to display the control bar. */ + enabled?: boolean; + /** Specifies the margin of the control bar in pixels. */ + margin?: number; + /** Specifies the position of the control bar. */ + horizontalAlignment?: string; + /** Specifies the position of the control bar. */ + verticalAlignment?: string; + /** Specifies the opacity of the Control_Bar. */ + opacity?: number; + }; + /** Specifies the appearance of the loading indicator. */ + loadingIndicator?: viz.core.LoadingIndicator; + /** Specifies a data source for the map area. */ + mapData?: any; + /** Specifies a data source for the map markers. */ + markers?: any; + /** An object specifying options for the map markers. */ + markerSettings?: MarkerSettings; + /** Specifies the size of the dxVectorMap widget. */ + size?: viz.core.Size; + /** Specifies tooltip options. */ + tooltip?: viz.core.Tooltip; + /** Configures map legends. */ + legends?: Array; + /** Specifies whether or not the map should respond when a user rolls the mouse wheel. */ + wheelEnabled?: boolean; + /** Specifies whether the map should respond to touch gestures. */ + touchEnabled?: boolean; + /** Disables the zooming capability. */ + zoomingEnabled?: boolean; + /** Specifies the geographical coordinates of the center for a map. */ + center?: Array; + centerChanged?: (center: Array) => void; + /** A handler for the centerChanged event. */ + onCenterChanged?: (e: { + center: Array; + component: dxVectorMap; + element: Element; + }) => void; + /** A handler for the tooltipShown event. */ + onTooltipShown?: (e: { + component: dxVectorMap; + element: Element; + target: {}; + }) => void; + /** A handler for the tooltipHidden event. */ + onTooltipHidden?: (e: { + component: dxVectorMap; + element: Element; + target: {}; + }) => void; + /** Specifies a number that is used to zoom a map initially. */ + zoomFactor?: number; + /** Specifies a map's maximum zoom factor. */ + maxZoomFactor?: number; + zoomFactorChanged?: (zoomFactor: number) => void; + /** A handler for the zoomFactorChanged event. */ + onZoomFactorChanged?: (e: { + zoomFactor: number; + component: dxVectorMap; + element: Element; + }) => void; + click?: any; + /** A handler for the click event. */ + onClick?: any; + /** A handler for the areaClick event. */ + onAreaClick?: any; + /** A handler for the areaSelectionChanged event. */ + onAreaSelectionChanged?: (e: { + target: Area; + component: dxVectorMap; + element: Element; + }) => void; + /** A handler for the markerClick event. */ + onMarkerClick?: any; + /** A handler for the markerSelectionChanged event. */ + onMarkerSelectionChanged?: (e: { + target: Marker; + component: dxVectorMap; + element: Element; + }) => void; + /** Disables the panning capability. */ + panningEnabled?: boolean; + } + export interface Legend extends viz.core.BaseLegend { + /** Specifies text for legend items. */ + customizeText?: (itemInfo: { start: number; end: number; index: number; color: string; size: number; }) => string; + /** Specifies text for a hint that appears when a user hovers the mouse pointer over the text of a legend item. */ + customizeHint?: (itemInfo: { start: number; end: number; index: number; color: string; size: number }) => string; + /** Specifies the source of data for the legend. */ + source?: string; + } + /** A vector map widget. */ + export class dxVectorMap extends viz.core.BaseWidget { + constructor(element: JQuery, options?: dxVectorMapOptions); + constructor(element: Element, options?: dxVectorMapOptions); + /** Displays the loading indicator. */ + showLoadingIndicator(): void; + /** Conceals the loading indicator. */ + hideLoadingIndicator(): void; + /** Redraws a widget. */ + render(): void; + /** Gets the current coordinates of the map center. */ + center(): Array; + /** Sets the coordinates of the map center. */ + center(centerCoordinates: Array): void; + /** Deselects all the selected areas on a map. The areas are displayed in their initial style after. */ + clearAreaSelection(): void; + /** Deselects all the selected markers on a map. The markers are displayed in their initial style after. */ + clearMarkerSelection(): void; + /** Deselects all the selected area and markers on a map at once. The areas and markers are displayed in their initial style after. */ + clearSelection(): void; + /** Converts client area coordinates into map coordinates. */ + convertCoordinates(x: number, y: number): Array; + /** Returns an array with all the map areas. */ + getAreas(): Array; + /** Returns an array with all the map markers. */ + getMarkers(): Array; + /** Gets the current coordinates of the map viewport. */ + viewport(): Array; + /** Sets the coordinates of the map viewport. */ + viewport(viewportCoordinates: Array): void; + /** Gets the current value of the map zoom factor. */ + zoomFactor(): number; + /** Sets the value of the map zoom factor. */ + zoomFactor(zoomFactor: number): void; + } +} +interface JQuery { + dxVectorMap(options?: DevExpress.viz.map.dxVectorMapOptions): JQuery; + dxVectorMap(methodName: string, ...params: any[]): any; + dxVectorMap(methodName: "instance"): DevExpress.viz.map.dxVectorMap; +} +declare module DevExpress.viz.sparklines { + export interface SparklineTooltip extends viz.core.Tooltip { + /** + * Specifies how a tooltip is horizontally aligned relative to the graph. + * @deprecated Tooltip alignment is no more available. + */ + horizontalAlignment?: string; + /** + * Specifies how a tooltip is vertically aligned relative to the graph. + * @deprecated Tooltip alignment is no more available. + */ + verticalAlignment?: string; + } + export interface BaseSparklineOptions extends viz.core.BaseWidgetOptions { + /** Specifies the blank space between the widget's extreme elements and the boundaries of the area provided for the widget in pixels. */ + margin?: viz.core.Margins; + /** Specifies the size of the widget. */ + size?: viz.core.Size; + /** Specifies tooltip options. */ + tooltip?: SparklineTooltip; + /** A handler for the tooltipShown event. */ + onTooltipShown?: (e: { + component: BaseSparkline; + element: Element; + }) => void; + /** A handler for the tooltipHidden event. */ + onTooltipHidden?: (e: { + component: BaseSparkline; + element: Element; + }) => void; + } + /** Overridden by descriptions for particular widgets. */ + export class BaseSparkline extends viz.core.BaseWidget { + /** Redraws a widget. */ + render(): void; + } + export interface dxBulletOptions extends BaseSparkline { + /** Specifies a color for the bullet bar. */ + color?: string; + /** Specifies an end value for the invisible scale. */ + endScaleValue?: number; + /** Specifies whether or not to show the target line. */ + showTarget?: boolean; + /** Specifies whether or not to show the line indicating zero on the invisible scale. */ + showZeroLevel?: boolean; + /** Specifies a start value for the invisible scale. */ + startScaleValue?: number; + /** Specifies the value indicated by the target line. */ + target?: number; + /** Specifies a color for both the target and zero level lines. */ + targetColor?: string; + /** Specifies the width of the target line. */ + targetWidth?: number; + /** Specifies the primary value indicated by the bullet bar. */ + value?: number; + } + /** A bullet graph widget. */ + export class dxBullet extends BaseSparkline { + constructor(element: JQuery, options?: dxBulletOptions); + constructor(element: Element, options?: dxBulletOptions); + } + export interface dxSparklineOptions extends BaseSparklineOptions { + /** Specifies the data source field that provides arguments for a sparkline. */ + argumentField?: string; + /** Sets a color for the bars indicating negative values. Available for a sparkline of the bar type only. */ + barNegativeColor?: string; + /** Sets a color for the bars indicating positive values. Available for a sparkline of the bar type only. */ + barPositiveColor?: string; + /** Specifies a data source for the sparkline. */ + dataSource?: Array; + /** Sets a color for the boundary of both the first and last points on a sparkline. */ + firstLastColor?: string; + /** Specifies whether a sparkline ignores null data points or not. */ + ignoreEmptyPoints?: boolean; + /** Sets a color for a line on a sparkline. Available for the sparklines of the line- and area-like types. */ + lineColor?: string; + /** Specifies a width for a line on a sparkline. Available for the sparklines of the line- and area-like types. */ + lineWidth?: number; + /** Sets a color for the bars indicating the values that are less than the winloss threshold. Available for a sparkline of the winloss type only. */ + lossColor?: string; + /** Sets a color for the boundary of the maximum point on a sparkline. */ + maxColor?: string; + /** Sets a color for the boundary of the minimum point on a sparkline. */ + minColor?: string; + /** Sets a color for points on a sparkline. Available for the sparklines of the line- and area-like types. */ + pointColor?: string; + /** Specifies the diameter of sparkline points in pixels. Available for the sparklines of line- and area-like types. */ + pointSize?: number; + /** Specifies a symbol to use as a point marker on a sparkline. Available for the sparklines of the line- and area-like types. */ + pointSymbol?: string; + /** Specifies whether or not to indicate both the first and last values on a sparkline. */ + showFirstLast?: boolean; + /** Specifies whether or not to indicate both the minimum and maximum values on a sparkline. */ + showMinMax?: boolean; + /** Determines the type of a sparkline. */ + type?: string; + /** Specifies the data source field that provides values for a sparkline. */ + valueField?: string; + /** Sets a color for the bars indicating the values greater than a winloss threshold. Available for a sparkline of the winloss type only. */ + winColor?: string; + /** Specifies a value that serves as a threshold for the sparkline of the winloss type. */ + winlossThreshold?: number; + /** Specifies the minimum value of the sparkline value axis. */ + minValue?: number; + /** Specifies the maximum value of the sparkline's value axis. */ + maxValue?: number; + } + /** A sparkline widget. */ + export class dxSparkline extends BaseSparkline { + constructor(element: JQuery, options?: dxSparklineOptions); + constructor(element: Element, options?: dxSparklineOptions); + } +} +interface JQuery { + dxBullet(options?: DevExpress.viz.sparklines.dxBulletOptions): JQuery; + dxBullet(methodName: string, ...params: any[]): any; + dxBullet(methodName: "instance"): DevExpress.viz.sparklines.dxBullet; + dxSparkline(options?: DevExpress.viz.sparklines.dxSparklineOptions): JQuery; + dxSparkline(methodName: string, ...params: any[]): any; + dxSparkline(methodName: "instance"): DevExpress.viz.sparklines.dxSparkline; +} \ No newline at end of file diff --git a/devextreme/devextreme.d.ts b/devextreme/devextreme.d.ts index 83e69504b..706b4bded 100644 --- a/devextreme/devextreme.d.ts +++ b/devextreme/devextreme.d.ts @@ -1,4 +1,4 @@ -// Type definitions for DevExtreme 15.1.8 +// Type definitions for DevExtreme 15.2.3 // Project: http://js.devexpress.com/ // Definitions by: DevExpress Inc. // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -69,9 +69,7 @@ declare module DevExpress { export function registerComponent(name: string, componentClass: Object): void; /** Registers a new component in the specified namespace as a jQuery plugin, Angular directive and Knockout binding. */ export function registerComponent(name: string, namespace: Object, componentClass: Object): void; - /** Requests that the browser call a specified function to update animation before the next repaint. */ export function requestAnimationFrame(callback: Function): number; - /** Cancels an animation frame request scheduled with the requestAnimationFrame method. */ export function cancelAnimationFrame(requestID: number): void; /** Custom Knockout binding that links an HTML element with a specific action. */ export class Action { } @@ -128,6 +126,8 @@ declare module DevExpress { leave(elements: JQuery, animation: any): void; /** Starts all the animations registered using the enter(elements, animation) and leave(elements, animation) methods beforehand. */ start(config: Object): JQueryPromise; + /** Stops all started animations. */ + stop(): void; } export class AnimationPresetCollection { /** Resets all the changes made in the animation repository. */ @@ -163,8 +163,8 @@ declare module DevExpress { tablet?: boolean; /** Specifies an array with the major and minor versions of the device platform. */ version?: Array; - /** Indicates whether or not the device platform is Windows8. */ - win8?: boolean; + /** Indicates whether or not the device platform is Windows. */ + win?: boolean; /** Specifies a performance grade of the current device. */ grade?: string; } @@ -262,16 +262,6 @@ declare module DevExpress { errorDetails?: any; } export interface StoreOptions { - inserted?: (values: Object, key: any) => void; - inserting?: (values: Object) => void; - loaded?: (result: Array) => void; - loading?: (loadOptions: LoadOptions) => void; - modified?: () => void; - modifying?: () => void; - removed?: (key: any) => void; - removing?: (key: any) => void; - updated?: (key: any, values: Object) => void; - updating?: (key: any, values: Object) => void; /** A handler for the modified event. */ onModified?: () => void; /** A handler for the modifying event. */ @@ -310,16 +300,6 @@ declare module DevExpress { } /** The base class for all Stores. */ export class Store implements EventsMixin { - inserted: JQueryCallback; - inserting: JQueryCallback; - loaded: JQueryCallback; - loading: JQueryCallback; - modified: JQueryCallback; - modifying: JQueryCallback; - removed: JQueryCallback; - removing: JQueryCallback; - updated: JQueryCallback; - updating: JQueryCallback; constructor(options?: StoreOptions); /** Returns the data item specified by the key. */ byKey(key: any): JQueryPromise; @@ -450,9 +430,6 @@ declare module DevExpress { /** An object that provides access to a data web service or local data storage for collection container widgets. */ export class DataSource implements EventsMixin { constructor(options?: DataSourceOptions); - changed: JQueryCallback; - loadError: JQueryCallback; - loadingChanged: JQueryCallback; /** Disposes all resources associated with this DataSource. */ dispose(): void; /** Returns the current filter option value. */ @@ -583,6 +560,7 @@ declare module DevExpress { /** A function used to customize a web request before it is sent. */ beforeSend?: (request: { url: string; + async: boolean; method: string; timeout: number; params: Object; @@ -593,6 +571,8 @@ declare module DevExpress { jsonp?: boolean; /** Specifies the type of the ODataStore key property. The following key types are supported out of the box: String, Int32, Int64, and Guid. */ keyType?: any; + /** Specifies whether or not dates found in the response are deserialized. */ + deserializeDates?: boolean; /** Specifies the URL of the data service being accessed via the current ODataContext. */ url?: string; /** Specifies the version of the OData protocol used to interact with the data service. */ @@ -714,26 +694,16 @@ declare module DevExpress { export interface CollectionWidgetOptions extends WidgetOptions { /** A data source used to fetch data to be displayed by the widget. */ dataSource?: any; - itemClickAction?: any; - itemHoldAction?: Function; /** The time period in milliseconds before the onItemHold event is raised. */ itemHoldTimeout?: number; - itemRender?: any; - itemRenderedAction?: Function; /** An array of items displayed by the widget. */ items?: Array; - /** - * A function performed when a widget item is selected. - * @deprecated onSelectionChanged.md - */ - itemSelectAction?: Function; /** The template to be used for rendering items. */ itemTemplate?: any; loopItemFocus?: boolean; /** The text or HTML markup displayed by the widget if the item collection is empty. */ noDataText?: string; onContentReady?: any; - contentReadyAction?: any; /** A handler for the itemClick event. */ onItemClick?: any; /** A handler for the itemContextMenu event. */ @@ -774,7 +744,6 @@ declare module DevExpress { displayExpr?: any; /** Specifies the name of a data source item field whose value is held in the value configuration option. */ valueExpr?: any; - itemRender?: any; /** An array of items displayed by the widget. */ items?: Array; /** The template to be used for rendering items. */ @@ -787,7 +756,6 @@ declare module DevExpress { value?: Object; /** A handler for the valueChanged event. */ onValueChanged?: Function; - valueChangeAction?: Function; /** A Boolean value specifying whether or not the widget is read-only. */ readOnly?: boolean; /** Holds the object that defines the error that occurred during validation. */ @@ -835,6 +803,10 @@ declare module DevExpress { export var utils: { /** Sets parameters for the viewport meta tag. */ initMobileViewport(options: { allowZoom?: boolean; allowPan?: boolean; allowSelection?: boolean }): void; + /** Requests that the browser call a specified function to update animation before the next repaint. */ + requestAnimationFrame(callback: Function): number; + /** Cancels an animation frame request scheduled with the requestAnimationFrame method. */ + cancelAnimationFrame(requestID: number): void; }; /** An object that serves as a namespace for DevExtreme Data Visualization Widgets. */ export module viz { @@ -927,6 +899,8 @@ declare module DevExpress.ui { displayValue?: string; /** The minimum number of characters that must be entered into the text box to begin a search. */ minSearchLength?: number; + /** Specifies whether or not the widget displays unfiltered values until a user types a number of characters exceeding the minSearchLength option value. */ + showDataBeforeSearch?: boolean; /** Specifies the name of a data source item field or an expression whose value is compared to the search criterion. */ searchExpr?: Object; /** Specifies the binary operation used to filter data. */ @@ -958,7 +932,6 @@ declare module DevExpress.ui { constructor(element: Element, options?: dxDropDownListOptions); } export interface dxToolbarOptions extends CollectionWidgetOptions { - menuItemRender?: any; /** The template used to render menu items. */ menuItemTemplate?: any; /** Informs the widget about its location in a view HTML markup. */ @@ -982,6 +955,10 @@ declare module DevExpress.ui { type?: string; width?: any; closeOnBackButton?: boolean; + /** A Boolean value specifying whether or not the toast is closed if a user swipes it out of the screen boundaries. */ + closeOnSwipe?: boolean; + /** A Boolean value specifying whether or not the toast is closed if a user clicks it. */ + closeOnClick?: boolean; } /** The toast message widget. */ export class dxToast extends dxOverlay { @@ -991,37 +968,26 @@ declare module DevExpress.ui { export interface dxTextEditorOptions extends EditorOptions { /** A handler for the change event. */ onChange?: Function; - changeAction?: Function; /** A handler for the copy event. */ onCopy?: Function; - copyAction?: Function; /** A handler for the cut event. */ onCut?: Function; - cutAction?: Function; /** A handler for the enterKey event. */ onEnterKey?: Function; - enterKeyAction?: Function; /** A handler for the focusIn event. */ onFocusIn?: Function; - focusInAction?: Function; /** A handler for the focusOut event. */ onFocusOut?: Function; - focusOutAction?: Function; /** A handler for the input event. */ onInput?: Function; - inputAction?: Function; /** A handler for the keyDown event. */ onKeyDown?: Function; - keyDownAction?: Function; /** A handler for the keyPress event. */ onKeyPress?: Function; - keyPressAction?: Function; /** A handler for the keyUp event. */ onKeyUp?: Function; - keyUpAction?: Function; /** A handler for the paste event. */ onPaste?: Function; - pasteAction?: Function; /** The text displayed by the widget when the widget value is empty. */ placeholder?: string; /** Specifies whether to display the Clear button in the widget. */ @@ -1036,9 +1002,7 @@ declare module DevExpress.ui { attr?: Object; /** The read-only option that holds the text displayed by the widget input element. */ text?: string; - /** Specifies whether or not the widget supports the focused state and keyboard navigation. */ focusStateEnabled?: boolean; - /** A Boolean value specifying whether or not the widget changes its state when being hovered by an end user. */ hoverStateEnabled?: boolean; /** The editor mask that specifies the format of the entered string. */ mask?: string; @@ -1048,6 +1012,8 @@ declare module DevExpress.ui { maskRules?: Object; /** A message displayed when the entered text does not match the specified pattern. */ maskInvalidMessage?: string; + /** Specifies whether the value option holds only characters entered by a user or prompt characters as well. */ + useMaskedValue?: boolean; } /** A base class for text editing widgets. */ export class dxTextEditor extends Editor { @@ -1100,9 +1066,14 @@ declare module DevExpress.ui { onTitleHold?: Function; /** A handler for the titleRendered event. */ onTitleRendered?: Function; - titleTemplate?: any; /** The template to be used for rendering an item title. */ itemTitleTemplate?: any; + /** A Boolean value specifying if the list is scrolled by content. */ + scrollByContent?: boolean; + /** A Boolean value specifying whether to enable or disable scrolling. */ + scrollingEnabled?: boolean; + /** A Boolean value that specifies the availability of navigation buttons. */ + showNavButtons?: boolean; } /** A widget used to display a view and to switch between several views by clicking the appropriate tabs. */ export class dxTabPanel extends dxMultiView { @@ -1110,6 +1081,8 @@ declare module DevExpress.ui { constructor(element: Element, options?: dxTabPanelOptions); } export interface dxSelectBoxOptions extends dxDropDownListOptions { + /** Specifies DOM event names that update a widget's value. */ + valueChangeEvent?: string; /** The template to be used for rendering the widget text field. */ fieldTemplate?: any; /** The text that is provided as a hint in the select box editor. */ @@ -1125,6 +1098,8 @@ declare module DevExpress.ui { export interface dxTagBoxOptions extends dxSelectBoxOptions { /** Holds the list of selected values. */ values?: Array; + /** A read-only option that holds the last selected value. */ + value?: Object; } /** A widget that allows you to select multiple items from a dropdown list. */ export class dxTagBox extends dxSelectBox { @@ -1134,14 +1109,12 @@ declare module DevExpress.ui { export interface dxScrollViewOptions extends dxScrollableOptions { /** A handler for the pullDown event. */ onPullDown?: Function; - pullDownAction?: Function; /** Specifies the text shown in the pullDown panel when pulling the content down lowers the refresh threshold. */ pulledDownText?: string; /** Specifies the text shown in the pullDown panel while pulling the content down to the refresh threshold. */ pullingDownText?: string; /** A handler for the reachBottom event. */ onReachBottom?: Function; - reachBottomAction?: Function; /** Specifies the text shown in the pullDown panel displayed when content is scrolled to the bottom. */ reachBottomText?: string; /** Specifies the text shown in the pullDown panel displayed when the content is being refreshed. */ @@ -1171,12 +1144,10 @@ declare module DevExpress.ui { disabled?: boolean; /** A handler for the scroll event. */ onScroll?: Function; - scrollAction?: Function; /** Specifies when the widget shows the scrollbar. */ showScrollbar?: string; /** A handler for the update event. */ onUpdated?: Function; - updateAction?: Function; /** Indicates whether to use native or simulated scrolling. */ useNative?: boolean; /** A Boolean value specifying whether to enable or disable the bounce-back effect. */ @@ -1220,6 +1191,7 @@ declare module DevExpress.ui { update(): void; } export interface dxRadioGroupOptions extends CollectionWidgetOptions, DataExpressionMixinOptions { + activeStateEnabled?: boolean; /** Specifies the radio group layout. */ layout?: string; } @@ -1293,12 +1265,24 @@ declare module DevExpress.ui { resizeEnabled?: boolean; /** The height of the widget in pixels. */ height?: any; + /** Specifies the maximum height the widget can reach while resizing. */ + maxHeight?: any; + /** Specifies the maximum width the widget can reach while resizing. */ + maxWidth?: any; + /** Specifies the minimum height the widget can reach while resizing. */ + minHeight?: any; + /** Specifies the minimum width the widget can reach while resizing. */ + minWidth?: any; /** A handler for the hidden event. */ onHidden?: Function; - hiddenAction?: Function; + /** A handler for the resizeStart event. */ + onResizeStart?: Function; + /** A handler for the resize event. */ + onResize?: Function; + /** A handler for the resizeEnd event. */ + onResizeEnd?: Function; /** A handler for the hiding event. */ onHiding?: Function; - hidingAction?: Function; /** An object defining widget positioning options. */ position?: PositionOptions; /** A Boolean value specifying whether or not the main screen is inactive while the widget is active. */ @@ -1307,10 +1291,8 @@ declare module DevExpress.ui { shadingColor?: string; /** A handler for the showing event. */ onShowing?: Function; - showingAction?: Function; /** A handler for the shown event. */ onShown?: Function; - shownAction?: Function; /** A Boolean value specifying whether or not the widget is visible. */ visible?: boolean; /** The widget width in pixels. */ @@ -1379,7 +1361,6 @@ declare module DevExpress.ui { export interface dxMapOptions extends WidgetOptions { /** Specifies whether or not the widget automatically adjusts center and zoom option values when adding a new marker or route. */ autoAdjust?: boolean; - /** An object, a string, or an array specifying the location displayed at the center of the widget. */ center?: { /** The latitude location displayed in the center of the widget. */ lat?: number; @@ -1388,7 +1369,6 @@ declare module DevExpress.ui { }; /** A handler for the click event. */ onClick?: any; - clickAction?: any; /** Specifies whether or not map widget controls are available. */ controls?: boolean; /** Specifies the height of the widget. */ @@ -1404,25 +1384,20 @@ declare module DevExpress.ui { } /** A handler for the markerAdded event. */ onMarkerAdded?: Function; - markerAddedAction?: Function; /** A URL pointing to the custom icon to be used for map markers. */ markerIconSrc?: string; /** A handler for the markerRemoved event. */ onMarkerRemoved?: Function; - markerRemovedAction?: Function; /** An array of markers displayed on a map. */ markers?: Array; /** The name of the current map data provider. */ provider?: string; /** A handler for the ready event. */ onReady?: Function; - readyAction?: Function; /** A handler for the routeAdded event. */ onRouteAdded?: Function; - routeAddedAction?: Function; /** A handler for the routeRemoved event. */ onRouteRemoved?: Function; - routeRemovedAction?: Function; /** An array of routes shown on the map. */ routes?: Array; /** The type of a map to display. */ @@ -1463,7 +1438,6 @@ declare module DevExpress.ui { focusStateEnabled?: boolean; /** A Boolean value specifying whether or not to group widget items. */ grouped?: boolean; - groupRender?: any; /** The name of the template used to display a group header. */ groupTemplate?: any; /** The text displayed on the button used to load the next page from the data source. */ @@ -1472,7 +1446,6 @@ declare module DevExpress.ui { onPageLoading?: Function; /** Specifies whether the next page is loaded when a user scrolls the widget to the bottom or when the "next" button is clicked. */ pageLoadMode?: string; - pageLoadingAction?: Function; /** Specifies the text shown in the pullDown panel, which is displayed when the widget is scrolled to the bottom. */ pageLoadingText?: string; /** The text displayed by the widget when nothing is selected. */ @@ -1489,14 +1462,12 @@ declare module DevExpress.ui { pullingDownText?: string; /** A handler for the pullRefresh event. */ onPullRefresh?: Function; - pullRefreshAction?: Function; /** A Boolean value specifying whether or not the widget supports the "pull down to refresh" gesture. */ pullRefreshEnabled?: boolean; /** Specifies the text displayed in the pullDown panel while the widget is being refreshed. */ refreshingText?: string; /** A handler for the scroll event. */ onScroll?: Function; - scrollAction?: Function; /** A Boolean value specifying whether or not the search bar is visible. */ searchEnabled?: boolean; /** The text that is provided as a hint in the lookup's search bar. */ @@ -1520,8 +1491,6 @@ declare module DevExpress.ui { usePopover?: boolean; /** A handler for the valueChanged event. */ onValueChanged?: Function; - contentReadyAction?: Function; - titleRender?: any; /** A handler for the titleRendered event. */ onTitleRendered?: Function; /** A Boolean value specifying whether or not to display the title in the popup window. */ @@ -1568,7 +1537,6 @@ declare module DevExpress.ui { export interface dxListOptions extends CollectionWidgetOptions { /** A Boolean value specifying whether or not to display a grouped list. */ grouped?: boolean; - groupRender?: any; /** The template to be used for rendering item groups. */ groupTemplate?: any; onItemDeleting?: Function; @@ -1576,20 +1544,16 @@ declare module DevExpress.ui { onItemDeleted?: Function; /** A handler for the groupRendered event. */ onGroupRendered?: Function; - itemDeleteAction?: Function; /** A handler for the itemReordered event. */ onItemReordered?: Function; - itemReorderAction?: Function; /** A handler for the itemClick event. */ onItemClick?: any; /** A handler for the itemSwipe event. */ onItemSwipe?: Function; - itemSwipeAction?: Function; /** The text displayed on the button used to load the next page from the data source. */ nextButtonText?: string; /** A handler for the pageLoading event. */ onPageLoading?: Function; - pageLoadingAction?: Function; /** Specifies the text shown in the pullDown panel, which is displayed when the list is scrolled to the bottom. */ pageLoadingText?: string; /** Specifies the text displayed in the pullDown panel when the list is pulled below the refresh threshold. */ @@ -1598,14 +1562,12 @@ declare module DevExpress.ui { pullingDownText?: string; /** A handler for the pullRefresh event. */ onPullRefresh?: Function; - pullRefreshAction?: Function; /** A Boolean value specifying whether or not the widget supports the "pull down to refresh" gesture. */ pullRefreshEnabled?: boolean; /** Specifies the text displayed in the pullDown panel while the list is being refreshed. */ refreshingText?: string; /** A handler for the scroll event. */ onScroll?: Function; - scrollAction?: Function; /** A Boolean value specifying whether to enable or disable list scrolling. */ scrollingEnabled?: boolean; /** Specifies when the widget shows the scrollbar. */ @@ -1618,7 +1580,6 @@ declare module DevExpress.ui { scrollByContent?: boolean; /** A Boolean value specifying if the list is scrolled using the scrollbar. */ scrollByThumb?: boolean; - itemUnselectAction?: Function; onItemContextMenu?: Function; onItemHold?: Function; /** Specifies whether or not an end-user can collapse groups. */ @@ -1630,6 +1591,7 @@ declare module DevExpress.ui { /** Specifies item selection mode. */ selectionMode?: string; selectAllText?: string; + onSelectAllChanged?: Function; /** Specifies the array of items for a context menu called for a list item. */ menuItems?: Array; /** Specifies whether an item context menu is shown when a user holds or swipes an item. */ @@ -1737,17 +1699,13 @@ declare module DevExpress.ui { onOpened?: Function; /** Specifies whether or not the drop-down editor is displayed. */ opened?: boolean; - closeAction?: Function; - openAction?: Function; - shownAction?: Function; - hiddenAction?: Function; /** Specifies whether or not the widget allows an end-user to enter a custom value. */ fieldEditEnabled?: boolean; - editEnabled?: boolean; /** Specifies the way an end-user applies the selected value. */ applyValueMode?: string; /** Specifies whether widget content is rendered when the widget is shown or when rendering the widget. */ deferRendering?: boolean; + activeStateEnabled?: boolean; } /** A drop-down editor widget. */ export class dxDropDownEditor extends dxTextBox { @@ -1791,10 +1749,14 @@ declare module DevExpress.ui { interval?: number; /** Specifies the maximum zoom level of a calendar, which is used to pick the date. */ maxZoomLevel?: string; - /** Specifies the minimal zoom level of a calendar, which is used to pick the date. */ + /** Specifies the minimal zoom level of a calendar, which is used to pick the date. */ minZoomLevel?: string; /** Specifies the type of date/time picker. */ pickerType?: string; + /** Specifies the message displayed if the typed value is not a valid date or time. */ + invalidDateMessage?: string; + /** Specifies the message displayed if the specified date is later than the max value or earlier than the min value. */ + dateOutOfRangeMessage?: string; } /** A date box widget. */ export class dxDateBox extends dxDropDownEditor { @@ -1802,6 +1764,7 @@ declare module DevExpress.ui { constructor(element: Element, options?: dxDateBoxOptions); } export interface dxCheckBoxOptions extends EditorOptions { + activeStateEnabled?: boolean; /** Specifies the widget state. */ value?: boolean; /** Specifies the text displayed by the check box. */ @@ -1813,6 +1776,7 @@ declare module DevExpress.ui { constructor(element: Element, options?: dxCheckBoxOptions); } export interface dxCalendarOptions extends EditorOptions { + activeStateEnabled?: boolean; /** Specifies a date displayed on the current calendar page. */ currentDate?: Date; /** Specifies the first day of a week. */ @@ -1829,8 +1793,8 @@ declare module DevExpress.ui { maxZoomLevel?: string; /** Specifies the minimum zoom level of the calendar. */ minZoomLevel?: string; - /** The template to be used for rendering calendar cells. */ - cellTemplate?: any; + /** The template to be used for rendering calendar cells. */ + cellTemplate?: any; } /** A calendar widget. */ export class dxCalendar extends Editor { @@ -1842,7 +1806,6 @@ declare module DevExpress.ui { activeStateEnabled?: boolean; /** A handler for the click event. */ onClick?: any; - clickAction?: any; /** Specifies the icon to be displayed on the button. */ icon?: string; iconSrc?: string; @@ -2015,6 +1978,7 @@ declare module DevExpress.ui { constructor(element: Element, options?: dxProgressBarOptions); } export interface dxSliderOptions extends dxTrackBarOptions { + activeStateEnabled?: boolean; /** The slider step size. */ step?: number; /** The current slider value. */ @@ -2060,6 +2024,135 @@ declare module DevExpress.ui { constructor(element: JQuery, options?: dxRangeSliderOptions); constructor(element: Element, options?: dxRangeSliderOptions); } + export interface dxFormItemLabel { + /** Specifies the label text. */ + text?: string; + /** Specifies whether or not the label is visible. */ + visible?: boolean; + /** Specifies whether or not a colon is displayed at the end of the current label. */ + showColon?: boolean; + /** Specifies the location of a label against the editor. */ + location?: string; + /** Specifies the label horizontal alignment. */ + alignment?: string; + } + export interface dxFormItem { + /** Specifies the type of the current item. */ + itemType?: string; + /** Specifies whether or not the current form item is visible. */ + visible?: boolean; + /** Specifies the sequence number of the item in a form, group or tab. */ + visibleIndex?: number; + /** Specifies a CSS class to be applied to the form item. */ + cssClass?: string; + /** Specifies the number of columns spanned by the item. */ + colSpan?: number; + } + export interface dxFormSimpleItem extends dxFormItem { + /** Specifies the path to the formData object field bound to the current form item. */ + dataField?: string; + /** Specifies the form item name. */ + name?: string; + /** Specifie which editor widget is used to display and edit the form item value. */ + editorType?: string; + /** Specifies configuration options for the editor widget of the current form item. */ + editorOptions?: Object; + /** A template to be used for rendering the form item. */ + template?: any; + /** Specifies the help text displayed for the current form item. */ + helpText?: string; + /** Specifies whether the current form item is required. */ + isRequired?: boolean; + /** Specifies options for the form item label. */ + label?: dxFormItemLabel; + /** An array of validation rules to be checked for the form item editor. */ + validationRules?: Array; + } + export interface dxFormGroupItem extends dxFormItem { + /** Specifies the group caption. */ + caption?: string; + /** A template to be used for rendering the group item. */ + template?: any; + /** The count of columns in the group layout. */ + colCount?: number; + /** Specifies whether or not all group item labels are aligned. */ + alignItemLabels?: boolean; + /** Holds an array of form items displayed within the group. */ + items?: Array; + } + export interface dxFormTab { + /** Specifies the tab title. */ + title?: string; + /** The count of columns in the tab layout. */ + colCount?: number; + /** Specifies whether or not labels of items displayed within the current tab are aligned. */ + alignItemLabels?: boolean; + /** Holds an array of form items displayed within the tab. */ + items?: Array; + } + export interface dxFormTabbedItem extends dxFormItem { + /** Holds a configuration object for the dxTabPanel widget used to display the current form item. */ + tabPanelOptions?: Object; + /** An array of tab configuration objects. */ + tabs?: Array; + } + export interface dxFormOptions extends WidgetOptions { + /** An object providing data for the form. */ + formData?: Object; + /** The count of columns in the form layout. */ + colCount?: any; + /** Specifies the location of a label against the editor. */ + labelLocation?: string; + /** Specifies whether or not all editors on the form are read-only. */ + readOnly?: boolean; + /** A handler for the fieldDataChanged event. */ + onFieldDataChanged?: (e: Object) => void; + /** A handler for the editorEnterKey event. */ + onEditorEnterKey?: (e: Object) => void; + /** Specifies a function that customizes a form item after it has been created. */ + customizeItem?: Function; + /** The minimum column width used for calculating column count in the form layout. */ + minColWidth?: number; + /** Specifies whether or not all root item labels are aligned. */ + alignItemLabels?: boolean; + /** Specifies whether or not item labels in all groups are aligned. */ + alignItemLabelsInAllGroups?: boolean; + /** Specifies whether or not a colon is displayed at the end of form labels. */ + showColonAfterLabel?: boolean; + /** Specifies whether or not the required mark is displayed for optional fields. */ + showRequiredMark?: boolean; + /** Specifies whether or not the optional mark is displayed for optional fields. */ + showOptionalMark?: boolean; + /** The text displayed for required fields. */ + requiredMark?: string; + /** The text displayed for optional fields. */ + optionalMark?: string; + /** Specifies whether or not the total validation summary is displayed on the form. */ + showValidationSummary?: boolean; + /** Holds an array of form items. */ + items?: Array; + /** A Boolean value specifying whether to enable or disable form scrolling. */ + scrollingEnabled?: boolean; + } + /** A form widget used to display and edit values of object fields. */ + export class dxForm extends Widget { + constructor(element: JQuery, options?: dxFormOptions); + constructor(element: Element, options?: dxFormOptions); + /** Updates the specified field of the formData object and the corresponding editor on the form. */ + updateData(dataField: string, value: any): void; + /** Updates the specified fields of the formData object and the corresponding editors on the form. */ + updateData(data: Object): void; + /** Updates the value of a form item option. */ + itemOption(field: string, option: string, value: any): void; + /** Updates the values of form item options. */ + itemOption(field: string, options: Object): void; + /** Returns an editor instance associated with the specified formData field. */ + getEditor(field: string): Object; + /** Updates the dimensions of the widget contents. */ + updateDimensions(): JQueryPromise; + /** Validates the values of all editors on the form against the list of the validation rules specified for each form item. */ + validate(): Object; + } } interface JQuery { dxProgressBar(): JQuery; @@ -2276,6 +2369,11 @@ interface JQuery { dxAutocomplete(options: string): any; dxAutocomplete(options: string, ...params: any[]): any; dxAutocomplete(options: DevExpress.ui.dxAutocompleteOptions): JQuery; + dxForm(): JQuery; + dxForm(options: "instance"): DevExpress.ui.dxForm; + dxForm(options: string): any; + dxForm(options: string, ...params: any[]): any; + dxForm(options: DevExpress.ui.dxForm): JQuery; } declare module DevExpress.ui { @@ -2286,6 +2384,8 @@ declare module DevExpress.ui { baseItemHeight?: number; /** Specifies the width of the base tile view item. */ baseItemWidth?: number; + /** Specifies whether tiles are placed horizontally or vertically. */ + direction?: string; /** Specifies the height of the widget. */ height?: any; /** Specifies the distance in pixels between adjacent tiles. */ @@ -2301,6 +2401,7 @@ declare module DevExpress.ui { scrollPosition(): number; } export interface dxSwitchOptions extends EditorOptions { + activeStateEnabled?: boolean; /** Text displayed when the widget is in a disabled state. */ offText?: string; /** Text displayed when the widget is in an enabled state. */ @@ -2314,6 +2415,8 @@ declare module DevExpress.ui { constructor(element: Element, options?: dxSwitchOptions); } export interface dxSlideOutViewOptions extends WidgetOptions { + /** Specifies the current menu position. */ + menuPosition?: string; /** Specifies whether or not the menu panel is visible. */ menuVisible?: boolean; /** Specifies whether or not the menu is shown when a user swipes the widget content. */ @@ -2343,10 +2446,10 @@ declare module DevExpress.ui { activeStateEnabled?: boolean; /** A Boolean value specifying whether or not to display a grouped menu. */ menuGrouped?: boolean; - menuGroupRender?: any; + /** Specifies the current menu position. */ + menuPosition?: string; /** The name of the template used to display a group header. */ menuGroupTemplate?: any; - menuItemRender?: any; /** The template used to render menu items. */ menuItemTemplate?: any; /** A handler for the menuGroupRendered event. */ @@ -2409,18 +2512,15 @@ declare module DevExpress.ui { export interface dxDropDownMenuOptions extends WidgetOptions { /** A handler for the buttonClick event. */ onButtonClick?: any; - buttonClickAction?: any; /** The name of the icon to be displayed by the DropDownMenu button. */ buttonIcon?: string; - buttonIconSrc?: string; /** The text displayed in the DropDownMenu button. */ buttonText?: string; + buttonIconSrc?: string; /** A data source used to fetch data to be displayed by the widget. */ dataSource?: any; /** A handler for the itemClick event. */ onItemClick?: any; - itemClickAction?: any; - itemRender?: any; /** An array of items displayed by the widget. */ items?: Array; /** The template to be used for rendering items. */ @@ -2433,7 +2533,6 @@ declare module DevExpress.ui { popupHeight?: any; /** Specifies whether or not the drop-down menu is displayed. */ opened?: boolean; - /** A Boolean value specifying whether or not the widget changes its state when being hovered by an end user. */ hoverStateEnabled?: boolean; } /** A drop-down menu widget. */ @@ -2447,7 +2546,6 @@ declare module DevExpress.ui { close(): void; } export interface dxActionSheetOptions extends CollectionWidgetOptions { - cancelClickAction?: any; /** A handler for the cancelClick event. */ onCancelClick?: any; /** The text displayed in the button that closes the action sheet. */ @@ -2540,7 +2638,7 @@ declare module DevExpress.data { dataType?: string; /** Specifies how the values of the current field are combined into groups. Cannot be used for the XmlaStore store type. */ groupInterval?: any; - /** Specifies how to aggregate field data. Cannot be used for th XmlaStore store type. */ + /** Specifies how to aggregate field data. Cannot be used for the XmlaStore store type. */ summaryType?: string; /** Allows you to use a custom aggregate function to calculate the summary values. Cannot be used for the XmlaStore store type. */ calculateCustomSummary?: (options: { @@ -2594,18 +2692,60 @@ declare module DevExpress.data { allowExpandAll?: boolean; /** Specifies the absolute width of the field in the pivot grid. */ width?: number; + /** Specifies the summary post-processing algorithm. */ + summaryDisplayMode?: string; + /** Specifies whether to summarize each next summary value with the previous one by rows or columns. */ + runningTotal?: string; + /** Specifies whether to allow the predefined summary post-processing functions ('absoluteVariation' and 'percentVariation') and runningTotal to take values of different groups into account. */ + allowCrossGroupCalculation?: boolean; + /** Specifies a callback function that allows you to modify summary values after they are calculated. */ + calculateSummaryValue?: (e: Object) => number; + /** Specifies whether or not to display Total values for the field. */ + showTotals?: boolean; + /** Specifies whether or not to display Grand Total values for the field. */ + showGrandTotals?: boolean; + } + export class SummaryCell { + /** Gets the parent cell in a specified direction. */ + parent(direction: string): SummaryCell; + /** Gets all children cells in a specified direction. */ + children(direction: string): Array; + /** Gets a partial Grand Total cell of a row or column. */ + grandTotal(direction: string): SummaryCell; + /** Gets the Grand Total of the entire pivot grid. */ + grandTotal(): SummaryCell; + /** Gets the cell next to the current one in a specified direction. */ + next(direction: string): SummaryCell; + /** Gets the cell next to current in a specified direction. */ + next(direction: string, allowCrossGroup: boolean): SummaryCell; + /** Gets the cell prior to the current one in a specified direction. */ + prev(direction: string): SummaryCell; + /** Gets the cell previous to current in a specified direction. */ + prev(direction: string, allowCrossGroup: boolean): SummaryCell; + /** Gets the child cell in a specified direction. */ + child(direction: string, fieldValue: any): SummaryCell; + /** Gets the cell located by the path of the source cell with one field value changed. */ + slice(field: PivotGridField, value: any): SummaryCell; + /** Gets the header cell of a row or column field to which the current cell belongs. */ + field(area: string): PivotGridField; + /** Gets the value of the current cell. */ + value(): any; + /** Gets the value of the current cell. */ + value(isCalculatedValue: boolean): any; + /** Gets the value of any field linked with the current cell. */ + value(field: PivotGridField): any; + /** Gets the value of any field linked with the current cell. */ + value(field: PivotGridField, isCalculatedValue: boolean): any; } export interface PivotGridDataSourceOptions { /** Specifies the underlying Store instance used to access data. */ store?: any; /** Indicates whether or not the automatic field generation from data in the Store is enabled. */ retrieveFields?: boolean; - /** Specifies data filtering conditions. */ + /** Specifies data filtering conditions. Cannot be used for the XmlaStore store type. */ filter?: Object; /** An array of pivot grid fields. */ fields?: Array; - /** Indicates whether or not the local sorting of the XMLA data should be performed. */ - localSorting?: boolean; /** A handler for the changed event. */ onChanged?: () => void; /** A handler for the loadingChanged event. */ @@ -2618,7 +2758,9 @@ declare module DevExpress.data { /** An object that provides access to data for the dxPivotGrid widget. */ export class PivotGridDataSource implements EventsMixin { constructor(options?: PivotGridDataSource); - /** Starts loading data. */ + /** Starts reloading data from any store and updating the data source. */ + reload(): JQueryPromise; + /** Starts updating the data source. Reloads data from the XMLA store only. */ load(): JQueryPromise; /** Indicates whether or not the PivotGridDataSource is currently being loaded. */ isLoading(): boolean; @@ -2644,6 +2786,22 @@ declare module DevExpress.data { collapseAll(id: any): void; /** Disposes of all resources associated with this PivotGridDataSource. */ dispose(): void; + /** Gets the current filter expression. Cannot be used for the XmlaStore store type. */ + filter(): Object; + /** Applies a new filter expression. Cannot be used for the XmlaStore store type. */ + filter(filterExpr: Object): void; + /** Provides access to a list of records (facts) that were used to calculate a specific summary. */ + createDrillDownDataSource(options: { + columnPath?: Array; + rowPath?: Array; + dataIndex?: number; + maxRowCount?: number; + customColumns?: Array; + }): DevExpress.data.DataSource; + /** Gets the current PivotGridDataSource state (fields configuration, sorting, filters, expanded headers, etc.) */ + state(): Object; + /** Sets the PivotGridDataSource state. */ + state(state: Object): void; on(eventName: string, eventHandler: Function): PivotGridDataSource; on(events: { [eventName: string]: Function; }): PivotGridDataSource; off(eventName: string): PivotGridDataSource; @@ -2666,6 +2824,8 @@ declare module DevExpress.ui { firstDayOfWeek?: number; /** The template to be used for rendering appointments. */ appointmentTemplate?: any; + /** The template to be used for rendering an appointment tooltip. */ + appointmentTooltipTemplate?: any; /** Lists the views to be available within the scheduler's View Selector. */ views?: Array; /** Specifies the resource kinds by which the scheduler's appointments are grouped in a timetable. */ @@ -2674,14 +2834,36 @@ declare module DevExpress.ui { startDayHour?: number; /** Specifies an end hour in the scheduler view's time interval. */ endDayHour?: number; - /** Specifies whether the scheduler data can be edited at runtime. */ - editing?: boolean; + /** Specifies whether or not the "All-day" panel is visible. */ + showAllDayPanel?: boolean; + /** Specifies cell duration in minutes. */ + cellDuration?: number; + /** Specifies the edit mode for recurrent appointments. */ + recurrenceEditMode?: string; + /** Specifies which editing operations an end-user can perform on appointments. */ + editing?: { + /** Specifies whether or not an end-user can add appointments. */ + allowAdding?: boolean; + /** Specifies whether or not an end-user can change appointment options. */ + allowUpdating?: boolean; + /** Specifies whether or not an end-user can delete appointments. */ + allowDeleting?: boolean; + /** Specifies whether or not an end-user can change an appointment duration. */ + allowResizing?: boolean; + /** Specifies whether or not an end-user can drag appointments. */ + allowDragging?: boolean; + } /** Specifies an array of resources available in the scheduler. */ resources?: Array<{ /** Indicates whether or not several resources of this kind can be assigned to an appointment. */ allowMultiple?: boolean; - /** Indicates whether or not resources of this kind have priority in the color identification of the appointments that have resources of different kinds assigned. */ + /** + * Indicates whether or not resources of this kind have priority in the color identification of the appointments that have resources of different kinds assigned. + * @deprecated Use the 'useColorAsDefault' property instead + */ mainColor?: boolean; + /** Indicates whether or not resources of this kind have priority in the color identification of the appointments that have resources of different kinds assigned. */ + useColorAsDefault?: boolean; /** A data source used to fetch resources to be available in the scheduler. */ dataSource?: any; /** Specifies the resource object field whose value is displayed by the Resource editor in the Appointment popup window. */ @@ -2707,6 +2889,18 @@ declare module DevExpress.ui { onAppointmentDeleted?: Function; /** A handler for the appointmentRendered event. */ onAppointmentRendered?: Function; + /** A handler for the appointmentClick event. */ + onAppointmentClick?: any; + /** A handler for the appointmentDblClick event. */ + onAppointmentDblClick?: any; + /** A handler for the cellClick event. */ + onCellClick?: any; + /** A handler for the appointmentFormCreated event. */ + onAppointmentFormCreated?: Function; + /** Specifies whether or not an end-user can scroll the view horizontally. */ + horizontalScrollingEnabled?: boolean; + /** Specifies whether a user can switch views using tabs or a drop-down menu. */ + useDropDownViewSwitcher?: boolean; } /** A widget that displays scheduled data using different views and provides the capability to load, add and edit appointments. */ export class dxScheduler extends Widget { @@ -2720,6 +2914,8 @@ declare module DevExpress.ui { deleteAppointment(appointment: Object): void; /** Scrolls the scheduler work space to the specified time. */ scrollToTime(hours: number, minutes: number): void; + /** Displays the Appointment Details popup. */ + showAppointmentPopup(appointmentData: Object, createNewAppointment?: boolean): void; } export interface dxColorBoxOptions extends dxDropDownEditorOptions { /** Specifies the text displayed on the button that applies changes and closes the drop-down editor. */ @@ -2737,55 +2933,53 @@ declare module DevExpress.ui { constructor(element: JQuery, options?: dxColorBoxOptions); constructor(element: Element, options?: dxColorBoxOptions); } - export interface dxColorPickerOptions extends dxColorBoxOptions { } - /** - * A widget used to specify a color value. - * @deprecated Use the dxColorBox widget instead - */ - export class dxColorPicker extends dxColorBox { - constructor(element: JQuery, options?: dxColorPickerOptions); - constructor(element: Element, options?: dxColorPickerOptions); + export interface HierarchicalCollectionWidgetOptions extends CollectionWidgetOptions { + /** Specifies the name of the data source item field whose value is displayed by the widget. */ + displayExpr?: any; + /** Specifies the name of the data source item field used as a key. */ + keyExpr?: any; + /** Specifies the name of the data source item field whose value defines whether or not the corresponding widget items is selected. */ + selectedExpr?: any; + /** Specifies the name of the data source item field that contains an array of nested items. */ + itemsExpr?: any; + /** Specifies the name of the data source item field whose value defines whether or not the corresponding widget item is disabled. */ + disabledExpr?: any; + /** Specifies the name of the data source item field that holds the key of the parent item. */ + parentIdExpr?: any; + /** Specifies the name of the data source item field whose value defines whether or not the corresponding widget items is expanded. */ + expandedExpr?: any; + hoverStateEnabled?: boolean; + focusStateEnabled?: boolean; } - export interface dxTreeViewOptions extends CollectionWidgetOptions { + export class HierarchicalCollectionWidget extends CollectionWidget { + } + export interface dxTreeViewOptions extends HierarchicalCollectionWidgetOptions { /** Specifies whether or not to animate item collapsing and expanding. */ animationEnabled?: boolean; /** Specifies whether a nested or plain array is used as a data source. */ dataStructure?: string; /** Specifies whether or not a user can expand all tree view items by the "*" hot key. */ expandAllEnabled?: boolean; - /** - * An array of currently expanded item objects. - * @deprecated Use item.expanded field instead - */ - expandedItems?: Array; /** Specifies whether or not a check box is displayed at each tree view item. */ showCheckBoxes?: boolean; + /** Specifies the current check boxes display mode. */ + showCheckBoxesMode?: string; /** Specifies whether or not to select nodes recursively. */ selectNodesRecursive?: boolean; + /** Specifies whether or not all parent nodes of an initially expanded node are displayed expanded. */ + expandNodesRecursive?: boolean; /** Specifies whether the "Select All" check box is displayed over the tree view. */ selectAllEnabled?: boolean; /** Specifies the text displayed at the "Select All" check box. */ selectAllText?: string; - /** Specifies the name of the data source item field used as a key. */ - keyExpr?: any; - /** Specifies the name of the data source item field whose value is displayed by the widget. */ - displayExpr?: any; - /** Specifies the name of the data source item field whose value defines whether or not the corresponding node is selected. */ - selectedExpr?: any; - /** Specifies the name of the data source item field whose value defines whether or not the corresponding node is expanded. */ - expandedExpr?: any; - /** Specifies the name of the data source item field that contains an array of nested items. */ - itemsExpr?: any; - /** Specifies the name of the data source item field that holds the key of the parent item. */ - parentIdExpr?: any; - /** Specifies the name of the data source item field whose value defines whether or not the corresponding node is disabled. */ - disabledExpr?: any; /** Specifies the name of the data source item field whose value defines whether or not the corresponding node includes child nodes. */ hasItemsExpr?: any; /** Specifies if the virtual mode is enabled. */ virtualModeEnabled?: boolean; /** Specifies the parent ID value of the root item. */ rootValue?: any; + /** Specifies the current value used to filter tree view items. */ + searchValue?: string; /** A string value specifying available scrolling directions. */ scrollDirection?: string; /** A handler for the itemSelected event. */ @@ -2798,11 +2992,9 @@ declare module DevExpress.ui { onItemContextMenu?: Function; onItemRendered?: Function; onItemHold?: Function; - hoverStateEnabled?: boolean; - focusStateEnabled?: boolean; } /** A widget displaying specified data items as a tree. */ - export class dxTreeView extends CollectionWidget { + export class dxTreeView extends HierarchicalCollectionWidget { constructor(element: JQuery, options?: dxTreeViewOptions); constructor(element: Element, options?: dxTreeViewOptions); /** Updates the tree view scrollbars according to the current size of the widget content. */ @@ -2822,7 +3014,7 @@ declare module DevExpress.ui { /** Unselects all widget items. */ unselectAll(): void; } - export interface dxMenuBaseOptions extends CollectionWidgetOptions { + export interface dxMenuBaseOptions extends HierarchicalCollectionWidgetOptions { /** An object that defines the animation options of the widget. */ animation?: fx.AnimationOptions; /** A Boolean value specifying whether or not the widget changes its state when interacting with a user. */ @@ -2847,10 +3039,8 @@ declare module DevExpress.ui { hide?: number; }; }; - /** A Boolean value specifying whether or not the widget changes its state when being hovered by an end user. */ - hoverStateEnabled?: boolean; } - export class dxMenuBase extends CollectionWidget { + export class dxMenuBase extends HierarchicalCollectionWidget { constructor(element: JQuery, options?: dxMenuBaseOptions); constructor(element: Element, options?: dxMenuBaseOptions); /** Selects the specified item. */ @@ -2879,16 +3069,12 @@ declare module DevExpress.ui { submenuDirection?: string; /** A handler for the submenuHidden event. */ onSubmenuHidden?: Function; - submenuHiddenAction?: Function; /** A handler for the submenuHiding event. */ onSubmenuHiding?: Function; - submenuHidingAction?: Function; /** A handler for the submenuShowing event. */ onSubmenuShowing?: Function; - submenuShowingAction?: Function; /** A handler for the submenuShown event. */ onSubmenuShown?: Function; - submenuShownAction?: Function; } /** A menu widget. */ export class dxMenu extends dxMenuBase { @@ -2940,6 +3126,10 @@ declare module DevExpress.ui { paging?: boolean; /** Specifies whether or not sorting must be performed on the server side. */ sorting?: boolean; + /** Specifies whether or not grouping must be performed on the server side. */ + grouping?: boolean; + /** Specifies whether or not summaries calculation must be performed on the server side. */ + summary?: boolean; } export interface dxDataGridColumn { /** Specifies the content alignment within column cells. */ @@ -2948,6 +3138,8 @@ declare module DevExpress.ui { allowEditing?: boolean; /** Specifies whether or not a column can be used for filtering grid records. Setting this option makes sense only when the filter row and column header filtering are visible. */ allowFiltering?: boolean; + /** Specifies whether or not to allow filtering by this column using its header. */ + allowHeaderFiltering?: boolean; /** Specifies whether or not the column can be anchored to a grid edge by end users. Setting this option makes sense only when the columnFixing | enabled option is set to true. */ allowFixing?: boolean; /** Specifies if a column can be used for searching grid records. Setting this option makes sense only when the search panel is visible. */ @@ -2966,14 +3158,18 @@ declare module DevExpress.ui { autoExpandGroup?: boolean; /** Specifies a callback function that returns a value to be displayed in a column cell. */ calculateCellValue?: (rowData: Object) => string; + /** Specifies a callback function to be invoked after the cell value is edited by an end-user and before the new value is saved to the data source. */ + setCellValue?: (rowData: Object, value: any) => void; /** Specifies a callback function that defines filters for customary calculated grid cells. */ - calculateFilterExpression?: (filterValue: any, selectedFilterOperation: string) => Array; + calculateFilterExpression?: (filterValue: any, selectedFilterOperation: string, target: string) => Array; /** Specifies a caption for a column. */ caption?: string; /** Specifies a custom template for grid column cells. */ cellTemplate?: any; /** Specifies a CSS class to be applied to a column. */ cssClass?: string; + /** Specifies how to get a value to be displayed in a cell when it is not in an editing state. */ + calculateDisplayValue?: any; /** Specifies a field name or a function that returns a field name or a value to be used for grouping column cells. */ calculateGroupValue?: any; /** Specifies a field name or a function that returns a field name or a value to be used for sorting column cells. */ @@ -2986,6 +3182,8 @@ declare module DevExpress.ui { dataType?: string; /** Specifies a custom template for the cell of a grid column when it is in an editing state. */ editCellTemplate?: any; + /** Specifies configuration options for the editor widget of the current column. */ + editorOptions?: Object; /** Specifies whether HTML tags are displayed as plain text or applied to the values of the column. */ encodeHtml?: boolean; /** In a boolean column, replaces all false items with a specified text. */ @@ -3021,6 +3219,13 @@ declare module DevExpress.ui { /** Specifies the expression defining the data source field whose values must be replaced. */ valueExpr?: string; }; + /** Specifies column-level options for filtering using a column header filter. */ + headerFilter?: { + /** Specifies the data source to be used for header filter. */ + dataSource?: any; + /** Specifies how header filter values should be combined into groups. */ + groupInterval?: any; + }; /** Specifies a precision for formatted values displayed in a column. */ precision?: number; /** Specifies a filter operation applied to a column. */ @@ -3047,6 +3252,8 @@ declare module DevExpress.ui { showInColumnChooser?: boolean; /** Specifies the identifier of the column. */ name?: string; + /** The form item configuration object. Used only when the editing mode is "form". */ + formItem?: DevExpress.ui.dxFormItem; } export interface dxDataGridOptions extends WidgetOptions { /** Specifies whether the outer borders of the grid are visible or not. */ @@ -3057,40 +3264,30 @@ declare module DevExpress.ui { onRowValidating?: (e: Object) => void; /** A handler for the contextMenuPreparing event. */ onContextMenuPreparing?: (e: Object) => void; - initNewRow?: (e: { data: Object }) => void; /** A handler for the initNewRow event. */ onInitNewRow?: (e: { data: Object }) => void; - rowInserted?: (e: { data: Object; key: any }) => void; /** A handler for the rowInserted event. */ onRowInserted?: (e: { data: Object; key: any }) => void; - rowInserting?: (e: { data: Object; cancel: boolean }) => void; /** A handler for the rowInserting event. */ - onRowInserting?: (e: { data: Object; cancel: boolean }) => void; - rowRemoved?: (e: { data: Object; key: any }) => void; + onRowInserting?: (e: { data: Object; cancel: any }) => void; /** A handler for the rowRemoved event. */ onRowRemoved?: (e: { data: Object; key: any }) => void; - rowRemoving?: (e: { data: Object; key: any; cancel: boolean }) => void; /** A handler for the rowRemoving event. */ - onRowRemoving?: (e: { data: Object; key: any; cancel: boolean }) => void; - rowUpdated?: (e: { data: Object; key: any }) => void; + onRowRemoving?: (e: { data: Object; key: any; cancel: any }) => void; /** A handler for the rowUpdated event. */ onRowUpdated?: (e: { data: Object; key: any }) => void; - rowUpdating?: (e: { oldData: Object; newData: Object; key: any; cancel: boolean }) => void; /** A handler for the rowUpdating event. */ - onRowUpdating?: (e: { oldData: Object; newData: Object; key: any; cancel: boolean }) => void; + onRowUpdating?: (e: { oldData: Object; newData: Object; key: any; cancel: any }) => void; /** Enables a hint that appears when a user hovers the mouse pointer over a cell with truncated content. */ cellHintEnabled?: boolean; /** Specifies whether or not grid columns can be reordered by a user. */ allowColumnReordering?: boolean; /** Specifies whether or not grid columns can be resized by a user. */ allowColumnResizing?: boolean; - cellClick?: any; /** A handler for the cellClick event. */ onCellClick?: any; - cellHoverChanged?: (e: Object) => void; /** A handler for the cellHoverChanged event. */ onCellHoverChanged?: (e: Object) => void; - cellPrepared?: (e: Object) => void; /** A handler for the cellPrepared event. */ onCellPrepared?: (e: Object) => void; /** Specifies whether or not the width of grid columns depends on column content. */ @@ -3145,18 +3342,12 @@ declare module DevExpress.ui { /** An array of grid columns. */ columns?: Array; onContentReady?: Function; - contentReadyAction?: Function; /** Specifies a function that customizes grid columns after they are created. */ customizeColumns?: (columns: Array) => void; - dataErrorOccurred?: (errorObject: Error) => void; /** Specifies a data source for the grid. */ dataSource?: any; - editingStart?: (e: { - data: Object; - key: any; - cancel: boolean; - column: dxDataGridColumn - }) => void; + /** Specifies whether or not to enable data caching. */ + cacheEnabled?: boolean; /** A handler for the editingStart event. */ onEditingStart?: (e: { data: Object; @@ -3164,27 +3355,31 @@ declare module DevExpress.ui { cancel: boolean; column: dxDataGridColumn }) => void; - editorPrepared?: (e: Object) => void; /** A handler for the editorPrepared event. */ onEditorPrepared?: (e: Object) => void; - editorPreparing?: (e: Object) => void; /** A handler for the editorPreparing event. */ onEditorPreparing?: (e: Object) => void; /** Contains options that specify how grid content can be changed. */ editing?: { - /** Specifies whether or not grid records can be edited at runtime. */ - editEnabled?: boolean; - /** Specifies how grid values can be edited manually. */ editMode?: string; - /** Specifies whether or not new records can be inserted into a grid. */ + editEnabled?: boolean; insertEnabled?: boolean; - /** Specifies whether or not records can be deleted from a grid. */ removeEnabled?: boolean; + /** Specifies how grid values can be edited manually. */ + mode?: string; + /** Specifies whether or not grid records can be edited at runtime. */ + allowUpdating?: boolean; + /** Specifies whether or not new grid records can be added at runtime. */ + allowAdding?: boolean; + /** Specifies whether or not grid records can be deleted at runtime. */ + allowDeleting?: boolean; + /** The form configuration object. Used only when the editing mode is "form". */ + form?: DevExpress.ui.dxFormOptions; /** Contains options that specify texts for editing-related grid controls. */ texts?: { /** Specifies text for a hint that appears when a user hovers the mouse pointer over the "Save" button. Setting this option makes sense only when the editMode option is set to batch. */ saveAllChanges?: string; - /** Specifies text for a cancel button displayed when a row is in the editing state. Setting this option makes sense only when the editEnabled option is set to true. */ + /** Specifies text for a cancel button displayed when a row is in the editing state. Setting this option makes sense only when the allowUpdating option is set to true. */ cancelRowChanges?: string; /** Specifies text for a hint that appears when a user hovers the mouse pointer over the "Revert" button. Setting this option makes sense only when the editMode option is set to batch. */ cancelAllChanges?: string; @@ -3192,15 +3387,17 @@ declare module DevExpress.ui { confirmDeleteMessage?: string; /** Specifies text to be displayed in the title of a confirmation window. Setting this option makes sense only when the edit mode is "row". */ confirmDeleteTitle?: string; - /** Specifies text for a button that deletes a row from a grid. Setting this option makes sense only when the removeEnabled option is set to true. */ + /** Specifies text for a hint that appears when a user hovers the mouse pointer over the "Cancel changes" button. Setting this option makes sense only when the editMode option is set to cell and the validation capabilities are enabled. */ + validationCancelChanges?: string; + /** Specifies text for a button that deletes a row from a grid. Setting this option makes sense only when the allowDeleting option is set to true. */ deleteRow?: string; - /** Specifies text for a hint that appears when a user hovers the mouse pointer over the "Add" button. Setting this option makes sense only when the insertEnabled option is true. */ + /** Specifies text for a hint that appears when a user hovers the mouse pointer over the "Add" button. Setting this option makes sense only when the allowAdding option is true. */ addRow?: string; - /** Specifies text for a button that turns a row into the editing state. Setting this option makes sense only when the editEnabled option is set to true. */ + /** Specifies text for a button that turns a row into the editing state. Setting this option makes sense only when the allowUpdating option is set to true. */ editRow?: string; - /** Specifies text for a save button displayed when a row is in the editing state. Setting this option makes sense only when the editEnabled option is set to true. */ + /** Specifies text for a save button displayed when a row is in the editing state. Setting this option makes sense only when the allowUpdating option is set to true. */ saveRowChanges?: string; - /** Specifies text for a button that recovers a deleted row. Setting this option makes sense only if the grid uses the batch edit mode and the removeEnabled option is set to true. */ + /** Specifies text for a button that recovers a deleted row. Setting this option makes sense only if the grid uses the batch edit mode and the allowDeleting option is set to true. */ undeleteRow?: string; }; }; @@ -3227,6 +3424,10 @@ declare module DevExpress.ui { resetOperationText?: string; /** Specifies text for the operation of clearing the applied filter when a select box is used. */ showAllText?: string; + /** Specifies text for the range start in the 'between' filter type. */ + betweenStartText?: string; + /** Specifies text for the range end in the 'between' filter type. */ + betweenEndText?: string; /** Specifies whether or not an icon that allows the user to choose a filter operation is visible. */ showOperationChooser?: boolean; /** Specifies whether the filter row is visible or not. */ @@ -3297,10 +3498,8 @@ declare module DevExpress.ui { }; /** Specifies whether or not grid rows must be shaded in a different way. */ rowAlternationEnabled?: boolean; - rowClick?: any; /** A handler for the rowClick event. */ onRowClick?: any; - rowPrepared?: (e: Object) => void; /** A handler for the rowPrepared event. */ onRowPrepared?: (e: Object) => void; /** Specifies a custom template for grid rows. */ @@ -3311,6 +3510,14 @@ declare module DevExpress.ui { mode?: string; /** Specifies whether or not a grid must preload pages adjacent to the current page when using virtual scrolling. */ preloadEnabled?: boolean; + /** Specifies whether or not the widget uses native scrolling. */ + useNative?: any; + /** Specifies the scrollbar display policy. */ + showScrollbar?: string; + /** Specifies whether or not the scrolling by content is enabled. */ + scrollByContent?: boolean; + /** Specifies whether or not the scrollbar thumb scrolling enabled. */ + scrollByThumb?: boolean; }; /** Specifies options of the search panel. */ searchPanel?: { @@ -3375,17 +3582,13 @@ declare module DevExpress.ui { selectedRowKeys?: Array; /** Specifies options of runtime selection. */ selection?: { + /** Specifies the checkbox row display policy in the multiple mode. */ + showCheckBoxesMode?: string; /** Specifies whether the user can select all grid records at once. */ allowSelectAll?: boolean; /** Specifies the selection mode. */ mode?: string; }; - selectionChanged?: (e: { - currentSelectedRowKeys: Array; - currentDeselectedRowKeys: Array; - selectedRowKeys: Array; - selectedRowsData: Array; - }) => void; /** A handler for the dataErrorOccured event. */ onDataErrorOccurred?: (e: { error: Error }) => void; /** A handler for the selectionChanged event. */ @@ -3435,7 +3638,7 @@ declare module DevExpress.ui { /** Specifies a callback function that performs specific actions on state loading. */ customLoad?: () => JQueryPromise; /** Specifies a callback function that performs specific actions on state saving. */ - customSave?: (gridState: Object) => void; + customSave?: (state: Object) => void; /** Specifies whether or not a grid saves its state. */ enabled?: boolean; /** Specifies the delay between the last change of a grid state and the operation of saving this state in milliseconds. */ @@ -3554,10 +3757,14 @@ declare module DevExpress.ui { getKeyByRowIndex(rowIndex: number): any; /** Adds a new column to a grid. */ addColumn(columnOptions: dxDataGridColumn): void; + /** Removes the column from the grid. */ + deleteColumn(id: any): void; /** Displays the load panel. */ beginCustomLoading(messageText: string): void; /** Discards changes made in a grid. */ cancelEditData(): void; + /** Checks whether or not the grid contains unsaved changes. */ + hasEditData(): boolean; /** Clears all the filters of a specific type applied to grid records. */ clearFilter(): void; /** Deselects all grid records. */ @@ -3577,9 +3784,19 @@ declare module DevExpress.ui { /** Sets several options of a column at once. */ columnOption(id: any, options: Object): void; /** Sets a specific cell into the editing state. */ - editCell(rowIndex: number, columnIndex: number): void; + editCell(rowIndex: number, visibleColumnIndex: number): void; + /** Sets a specific cell into the editing state. */ + editCell(rowIndex: number, dataField: string): void; /** Sets a specific row into the editing state. */ editRow(rowIndex: number): void; + /** Gets the cell value. */ + cellValue(rowIndex: number, dataField: string): any; + /** Gets the cell value. */ + cellValue(rowIndex: number, visibleColumnIndex: number): any; + /** Sets the cell value. */ + cellValue(rowIndex: number, dataField: string, value: any): void; + /** Sets the cell value. */ + cellValue(rowIndex: number, visibleColumnIndex: number, value: any): void; /** Hides the load panel. */ endCustomLoading(): void; /** Expands groups or master rows in a grid. */ @@ -3603,6 +3820,11 @@ declare module DevExpress.ui { /** Hides the column chooser panel. */ hideColumnChooser(): void; /** Adds a new data row to a grid. */ + addRow(): void; + /** + * Adds a new data row to a grid. + * @deprecated Use the addRow() method instead. + */ insertRow(): void; /** Returns the key corresponding to the passed data object. */ keyOf(obj: Object): any; @@ -3617,6 +3839,11 @@ declare module DevExpress.ui { /** Refreshes grid data. */ refresh(): void; /** Removes a specific row from a grid. */ + deleteRow(rowIndex: number): void; + /** + * Removes a specific row from a grid. + * @deprecated Use the deleteRow() method instead. + */ removeRow(rowIndex: number): void; /** Saves changes made in a grid. */ saveEditData(): void; @@ -3656,8 +3883,14 @@ declare module DevExpress.ui { onContentReady?: Function; /** Specifies a data source for the pivot grid. */ dataSource?: any; - /** Specifies whether or not the widget uses native scrolling. */ useNativeScrolling?: any; + /** A configuration object specifying scrolling options. */ + scrolling?: { + /** Specifies the scrolling mode. */ + mode?: string; + /** Specifies whether or not the widget uses native scrolling. */ + useNative?: any; + }; /** Allows an end-user to change sorting options. */ allowSorting?: boolean; /** Allows an end-user to sort columns by summary values. */ @@ -3674,6 +3907,12 @@ declare module DevExpress.ui { showColumnTotals?: boolean; /** Specifies whether to display the Grand Total column. */ showColumnGrandTotals?: boolean; + /** Specifies whether or not to hide rows and columns with no data. */ + hideEmptySummaryCells?: boolean; + /** Specifies where to show the total rows or columns. */ + showTotalsPrior?: string; + /** Specifies whether the outer borders of the grid are visible or not. */ + showBorders?: boolean; /** The Field Chooser configuration options. */ fieldChooser?: { /** Enables or disables the field chooser. */ @@ -3720,6 +3959,8 @@ declare module DevExpress.ui { sortRowBySummary?: string; /** The string to display as a Remove All Sorting context menu item. */ removeAllSorting?: string; + /** The string to display as an Export to Excel file context menu item. */ + exportToExcel?: string; }; /** The Load panel configuration options. */ loadPanel?: { @@ -3744,6 +3985,38 @@ declare module DevExpress.ui { onCellPrepared?: (e: any) => void; /** A handler for the contextMenuPreparing event. */ onContextMenuPreparing?: (e: Object) => void; + /** Specifies options for exporting pivot grid data. */ + export?: { + /** Indicates whether the export feature is enabled for the pivot grid. */ + enabled?: boolean; + /** Specifies a default name for the file to which grid data is exported. */ + fileName?: string; + /** Specifies the URL of the server-side proxy that streams the resulting file to the end user to enable export in IE8, IE9 and Safari browsers. */ + proxyUrl?: string; + }; + /** A handler for the exporting event. */ + onExporting?: (e: { + fileName: string; + format: string; + cancel: boolean; + }) => void; + /** A handler for the exported event. */ + onExported?: (e: Object) => void; + /** A configuration object specifying options related to state storing. */ + stateStoring?: { + /** Specifies a callback function that performs specific actions on state loading. */ + customLoad?: () => JQueryPromise; + /** Specifies a callback function that performs specific actions on state saving. */ + customSave?: (gridState: Object) => void; + /** Specifies whether or not a grid saves its state. */ + enabled?: boolean; + /** Specifies the delay between the last change of a grid state and the operation of saving this state in milliseconds. */ + savingTimeout?: number; + /** Specifies a unique key to be used for storing the grid state. */ + storageKey?: string; + /** Specifies the type of storage to be used for state storing. */ + type?: string; + }; } /** A data summarization widget for multi-dimensional data analysis and data mining. */ export class dxPivotGrid extends Widget { @@ -3751,8 +4024,12 @@ declare module DevExpress.ui { constructor(element: Element, options?: dxPivotGridOptions); /** Gets the PivotGridDataSource instance. */ getDataSource(): DevExpress.data.PivotGridDataSource; + /** Gets the dxPopup instance of the field chooser window. */ + getFieldChooserPopup(): DevExpress.ui.dxPopup; /** Updates the widget to the size of its content. */ updateDimensions(): void; + /** Exports pivot grid data to the Excel file. */ + exportToExcel(): void; } export interface dxPivotGridFieldChooserOptions extends WidgetOptions { /** Specifies the height of the widget. */ @@ -3847,7 +4124,6 @@ declare module DevExpress.framework { setView(key: string, viewInfo: Object): void; } export interface dxCommandOptions extends DOMComponentOptions { - action?: any; /** Specifies an action performed when the execute() method of the command is called. */ onExecute?: any; /** Indicates whether or not the widget that displays this command is disabled. */ @@ -3933,6 +4209,8 @@ declare module DevExpress.framework { viewCache?: Object; /** Specifies a limit for the views that can be cached. */ viewCacheSize?: number; + /** Specifies the current version of application templates. */ + templatesVersion?: string; /** Specifies options for the viewport meta tag of a mobile browser. */ viewPort?: JQuery; /** A custom router to be used in the application. */ @@ -3947,6 +4225,7 @@ declare module DevExpress.framework { navigating: JQueryCallback; navigatingBack: JQueryCallback; resolveLayoutController: JQueryCallback; + resolveViewCacheKey: JQueryCallback; viewDisposed: JQueryCallback; viewDisposing: JQueryCallback; viewHidden: JQueryCallback; @@ -4013,6 +4292,11 @@ declare module DevExpress.framework { layoutController: Object; availableLayoutControllers: Array; }) => void): HtmlApplication; + on(eventName: "resolveViewCacheKey", eventHandler: (e: { + key: string; + navigationItem: Object; + routeData: Object; + }) => void): HtmlApplication; on(eventName: "viewDisposed", eventHandler: (e: { viewInfo: Object; }) => void): HtmlApplication; @@ -4041,6 +4325,7 @@ declare module DevExpress.framework { off(eventName: "navigating"): HtmlApplication; off(eventName: "navigatingBack"): HtmlApplication; off(eventName: "resolveLayoutController"): HtmlApplication; + off(eventName: "resolveViewCacheKey"): HtmlApplication; off(eventName: "viewDisposed"): HtmlApplication; off(eventName: "viewDisposing"): HtmlApplication; off(eventName: "viewHidden"): HtmlApplication; @@ -4076,6 +4361,11 @@ declare module DevExpress.framework { layoutController: Object; availableLayoutControllers: Array; }) => void): HtmlApplication; + off(eventName: "resolveViewCacheKey", eventHandler: (e: { + key: string; + navigationItem: Object; + routeData: Object; + }) => void): HtmlApplication; off(eventName: "viewDisposed", eventHandler: (e: { viewInfo: Object; }) => void): HtmlApplication; @@ -4169,13 +4459,13 @@ declare module DevExpress.viz.core { width?: number; } export interface Margins { - /** Specifies the legend's bottom margin in pixels. */ + /** Specifies the distance in pixels between the bottom side of the title and the surrounding widget elements. */ bottom?: number; - /** Specifies the legend's left margin in pixels. */ + /** Specifies the distance in pixels between the left side of the title and the surrounding widget elements. */ left?: number; - /** Specifies the legend's right margin in pixels. */ + /** Specifies the distance between the right side of the title and surrounding widget elements in pixels. */ right?: number; - /** Specifies the legend's bottom margin in pixels. */ + /** Specifies the distance between the top side of the title and surrounding widget elements in pixels. */ top?: number; } export interface Size { @@ -4184,6 +4474,27 @@ declare module DevExpress.viz.core { /** Specifies the height of the widget. */ height?: number; } + export interface Title { + /** Specifies font options for the title. */ + font?: viz.core.Font; + /** Specifies the widget title's horizontal position. */ + horizontalAlignment?: string; + /** Specifies the widget title's position in the vertical direction. */ + verticalAlignment?: string; + /** Specifies the distance between the title and surrounding widget elements in pixels. */ + margin?: viz.core.Margins; + /** Specifies the height of the space reserved for the title. */ + placeholderSize?: number; + /** Specifies text for the title. */ + text?: string; + /** Specifies a subtitle for the widget. */ + subtitle?: { + /** Specifies font options for the subtitle. */ + font?: viz.core.Font; + /** Specifies text for the subtitle. */ + text?: string; + } + } export interface Tooltip { /** Specifies the length of the tooltip's arrow in pixels. */ arrowLength?: number; @@ -4193,6 +4504,7 @@ declare module DevExpress.viz.core { color?: string; /** Specifies the z-index for tooltips. */ zIndex?: number; + /** Specifies the container to draw tooltips inside of it. */ container?: any; /** Specifies text and appearance of a set of tooltips. */ customizeTooltip?: (arg: Object) => { color?: string; text?: string }; @@ -4283,32 +4595,23 @@ declare module DevExpress.viz.core { visible?: boolean; } export interface BaseWidgetOptions { - drawn?: (widget: Object) => void; /** A handler for the drawn event. */ onDrawn?: (e: { component: BaseWidget; element: Element; }) => void; - incidentOccured?: (incidentInfo: { + /** A handler for the incidentOccurred event. */ + onIncidentOccurred?: ( + component: BaseWidget, + element: Element, + target: { id: string; type: string; args: any; text: string; widget: string; version: string; - }) => void; - /** A handler for the incidentOccurred event. */ - onIncidentOccurred?: ( - component: BaseWidget, - element: Element, - target: { - id: string; - type: string; - args: any; - text: string; - widget: string; - version: string; - } + } ) => void; /** Notifies a widget that it is embedded into an HTML page that uses a path modifier. */ pathModified?: boolean; @@ -4334,11 +4637,6 @@ declare module DevExpress.viz.charts { clearSelection(): void; /** Gets the color of a particular series. */ getColor(): string; - /** - * Gets a point from the series point collection based on the specified argument. - * @deprecated getPointsByArg(pointArg).md - */ - getPointByArg(pointArg: any): Object; /** Gets points from the series point collection based on the specified argument. */ getPointsByArg(pointArg: any): Array; /** Gets a point from the series point collection based on the specified point position. */ @@ -4353,6 +4651,20 @@ declare module DevExpress.viz.charts { getAllPoints(): Array; /** Returns visible series points. */ getVisiblePoints(): Array; + /** Returns the name of the series. */ + name: string; + /** Returns the tag of the series. */ + tag: string; + /** Hides a series. */ + hide(): void; + /** Provides information about the hover state of a series. */ + isHovered(): boolean; + /** Provides information about the selection state of a series. */ + isSelected(): boolean; + /** Provides information about the visibility state of a series. */ + isVisible(): boolean; + /** Makes a particular series visible. */ + show(): void; } /** This section describes the methods that can be used in code to manipulate the Point object. */ export interface BasePoint { @@ -4371,9 +4683,9 @@ declare module DevExpress.viz.charts { /** Hides the tooltip of the point. */ hideTooltip(): void; /** Provides information about the hover state of a point. */ - isHovered(): any; + isHovered(): boolean; /** Provides information about the selection state of a point. */ - isSelected(): any; + isSelected(): boolean; /** Selects the point. The point is displayed in a 'selected' style until another point is selected or the current point is deselected programmatically. */ select(): void; /** Shows the tooltip of the point. */ @@ -4389,20 +4701,6 @@ declare module DevExpress.viz.charts { pane: string; /** Returns the name of the value axis of the series. */ axis: string; - /** Returns the name of the series. */ - name: string; - /** Returns the tag of the series. */ - tag: string; - /** Hides a series. */ - hide(): void; - /** Provides information about the hover state of a series. */ - isHovered(): any; - /** Provides information about the selection state of a series. */ - isSelected(): any; - /** Provides information about the visibility state of a series. */ - isVisible(): boolean; - /** Makes a particular series visible. */ - show(): void; selectPoint(point: ChartPoint): void; deselectPoint(point: ChartPoint): void; getAllPoints(): Array; @@ -4457,20 +4755,6 @@ declare module DevExpress.viz.charts { export interface PolarSeries extends BaseSeries { /** Returns the name of the value axis of the series. */ axis: string; - /** Returns the name of the series. */ - name: string; - /** Returns the tag of the series. */ - tag: string; - /** Hides a series. */ - hide(): void; - /** Provides information about the hover state of a series. */ - isHovered(): any; - /** Provides information about the selection state of a series. */ - isSelected(): any; - /** Provides information about the visibility state of a series. */ - isVisible(): boolean; - /** Makes a particular series visible. */ - show(): void; selectPoint(point: PolarPoint): void; deselectPoint(point: PolarPoint): void; getAllPoints(): Array; @@ -4819,7 +5103,10 @@ declare module DevExpress.viz.charts { /** Specifies the hatching options to be applied when a point is hovered over. */ hatching?: viz.core.Hatching; }; - /** Specifies the fraction of the inner radius relative to the total radius in the series of the 'doughnut' type. */ + /** + * Specifies the fraction of the inner radius relative to the total radius in the series of the 'doughnut' type. + * @deprecated use the 'innerRadius' option instead + */ innerRadius?: number; /** An object defining the label configuration options. */ label?: PieSeriesConfigLabel; @@ -4827,7 +5114,10 @@ declare module DevExpress.viz.charts { maxLabelCount?: number; /** Specifies a minimal size of a displayed pie segment. */ minSegmentSize?: number; - /** Specifies the direction in which the dxPieChart's series points are located. */ + /** + * Specifies the direction in which the dxPieChart series points are located. + * @deprecated use the 'segmentsDirection' option instead + */ segmentsDirection?: string; /**

    Specifies the chart elements to highlight when the series is selected.

    */ selectionMode?: string; @@ -4851,17 +5141,34 @@ declare module DevExpress.viz.charts { /** Specifies how many segments must not be grouped. */ topCount?: number; }; - /** Specifies a start angle for a pie chart in arc degrees. */ + /** + * Specifies a start angle for a pie chart in arc degrees. + * @deprecated use the 'startAngle' option instead + */ startAngle?: number; /**

    Specifies the name of the data source field that provides data about a point.

    */ tagField?: string; /** Specifies the data source field that provides values for series points. */ valueField?: string; } - export interface PieSeriesConfig extends CommonPieSeriesConfig { - /** Sets the series type. */ + export interface CommonPieSeriesSettings extends CommonPieSeriesConfig { + /** + * Sets a series type for all series. + * @deprecated use the 'type' option instead + */ type?: string; } + export interface PieSeriesConfig extends CommonPieSeriesConfig { + /** + * Sets the series type. + * @deprecated use the 'type' option instead + */ + type?: string; + /** Specifies the name that identifies the series. */ + name?: string; + /** Specifies data about a series. */ + tag?: any; + } export interface SeriesTemplate { /** Specifies a callback function that returns a series object with individual series settings. */ customizeSeries?: (seriesName: string) => SeriesConfig; @@ -4980,6 +5287,10 @@ declare module DevExpress.viz.charts { opacity?: number; /** Indicates whether or not ticks are visible on an axis. */ visible?: boolean; + /** Specifies tick width. */ + width?: number; + /** Specifies tick length. */ + length?: number; }; /** Specifies the options of the minor ticks. */ minorTick?: { @@ -4989,6 +5300,10 @@ declare module DevExpress.viz.charts { opacity?: number; /** Indicates whether or not the minor ticks are displayed on an axis. */ visible?: boolean; + /** Specifies minor tick width. */ + width?: number; + /** Specifies minor tick length. */ + length?: number; }; /** Indicates whether or not the line that represents an axis in a chart is visible. */ visible?: boolean; @@ -5217,7 +5532,6 @@ declare module DevExpress.viz.charts { customizePoint?: (pointInfo: Object) => Object; /** Specifies a data source for the chart. */ dataSource?: any; - done?: Function; /** Specifies the appearance of the loading indicator. */ loadingIndicator?: viz.core.LoadingIndicator; /** Specifies options of a dxChart's (dxPieChart's) legend. */ @@ -5233,21 +5547,18 @@ declare module DevExpress.viz.charts { }) => void; /** A handler for the pointClick event. */ onPointClick?: any; - pointClick?: any; /** A handler for the pointHoverChanged event. */ onPointHoverChanged?: (e: { component: BaseChart; element: Element; target: TPoint; }) => void; - pointHoverChanged?: (point: TPoint) => void; /** A handler for the pointSelectionChanged event. */ onPointSelectionChanged?: (e: { component: BaseChart; element: Element; target: TPoint; }) => void; - pointSelectionChanged?: (point: TPoint) => void; /** Specifies whether a single point or multiple points can be selected in the chart. */ pointSelectionMode?: string; /** Specifies whether to redraw the widget when the size of the parent browser window changes or a mobile device rotates. */ @@ -5257,20 +5568,7 @@ declare module DevExpress.viz.charts { /** Specifies the size of the widget in pixels. */ size?: viz.core.Size; /** Specifies a title for the chart. */ - title?: { - /** Specifies font options for the title. */ - font?: viz.core.Font; - /** Specifies the title's horizontal position in the chart. */ - horizontalAlignment?: string; - /** Specifies a title's position on the chart in the vertical direction. */ - verticalAlignment?: string; - /** Specifies the distance between the title and surrounding chart elements in pixels. */ - margin?: viz.core.Margins; - /** Specifies the height of the space reserved for the title. */ - placeholderSize?: number; - /** Specifies a text for the chart's title. */ - text?: string; - }; + title?: viz.core.Title; /** Specifies tooltip options. */ tooltip?: BaseChartTooltip; /** A handler for the tooltipShown event. */ @@ -5285,8 +5583,6 @@ declare module DevExpress.viz.charts { element: Element; target: BasePoint; }) => void; - tooltipHidden?: (point: TPoint) => void; - tooltipShown?: (point: TPoint) => void; } /** A base class for all chart widgets included in the ChartJS library. */ export class BaseChart extends viz.core.BaseWidget { @@ -5294,6 +5590,12 @@ declare module DevExpress.viz.charts { clearSelection(): void; /** Gets the current size of the widget. */ getSize(): { width: number; height: number }; + /** Returns an array of all series in the chart. */ + getAllSeries(): Array; + /** Gets a series within the chart's series collection by the specified name (see the name option). */ + getSeriesByName(seriesName: string): BaseSeries; + /** Gets a series within the chart's series collection by its position number. */ + getSeriesByPos(seriesIndex: number): BaseSeries; /** Displays the loading indicator. */ showLoadingIndicator(): void; /** Conceals the loading indicator. */ @@ -5349,6 +5651,10 @@ declare module DevExpress.viz.charts { seriesSelectionMode?: string; /** Specifies how the chart must behave when series point labels overlap. */ resolveLabelOverlapping?: string; + /** Specifies whether or not all bars in a series must have the same angle, or may have different angles if any points in other series are missing. */ + equalBarWidth?: boolean; + /** Specifies a common bar width as a percentage from 0 to 1. */ + barWidth?: number; } export interface Legend extends AdvancedLegend { /** Specifies whether the legend is located outside or inside the chart's plot. */ @@ -5361,8 +5667,6 @@ declare module DevExpress.viz.charts { shared?: boolean; } export interface dxChartOptions extends AdvancedOptions { - /** Specifies a value indicating whether all bars in a series must have the same width, or may have different widths if any points in other series are missing. */ - equalBarWidth?: any; adaptiveLayout?: { keepLabels?: boolean; }; @@ -5374,7 +5678,6 @@ declare module DevExpress.viz.charts { adjustOnZoom?: boolean; /** Specifies argument axis options for the dxChart widget. */ argumentAxis?: ChartArgumentAxis; - argumentAxisClick?: any; /** An object defining the configuration options that are common for all axes of the dxChart widget. */ commonAxisSettings?: ChartCommonAxisSettings; /** An object defining the configuration options that are common for all panes in the dxChart widget. */ @@ -5413,7 +5716,7 @@ declare module DevExpress.viz.charts { maxBubbleSize?: number; /** Specifies the diameter of the smallest bubble measured in pixels. */ minBubbleSize?: number; - /** Defines the dxChart widget's pane(s). */ + /** Defines the dxChart widget's pane(s). */ panes?: Array; /** Swaps the axes round so that the value axis becomes horizontal and the argument axes becomes vertical. */ rotated?: boolean; @@ -5421,10 +5724,6 @@ declare module DevExpress.viz.charts { legend?: Legend; /** Specifies options for dxChart widget series. */ series?: Array; - legendClick?: any; - seriesClick?: any; - seriesHoverChanged?: (series: ChartSeries) => void; - seriesSelectionChanged?: (series: ChartSeries) => void; /** Defines options for the series template. */ seriesTemplate?: SeriesTemplate; /** Specifies tooltip options. */ @@ -5455,12 +5754,6 @@ declare module DevExpress.viz.charts { export class dxChart extends BaseChart { constructor(element: JQuery, options?: dxChartOptions); constructor(element: Element, options?: dxChartOptions); - /** Returns an array of all series in the chart. */ - getAllSeries(): Array; - /** Gets a series within the chart's series collection by the specified name (see the name option). */ - getSeriesByName(seriesName: string): ChartSeries; - /** Gets a series within the chart's series collection by its position number. */ - getSeriesByPos(seriesIndex: number): ChartSeries; /** Sets the specified start and end values for the chart's argument axis. */ zoomArgument(startValue: any, endValue: any): void; } @@ -5480,8 +5773,6 @@ declare module DevExpress.viz.charts { shared?: boolean; } export interface dxPolarChartOptions extends AdvancedOptions { - /** Specifies a value indicating whether all bars in a series must have the same angle, or may have different angles if any points in other series are missing. */ - equalBarWidth?: boolean; /** Specifies adaptive layout options. */ adaptiveLayout?: { width?: number; @@ -5512,12 +5803,6 @@ declare module DevExpress.viz.charts { export class dxPolarChart extends BaseChart { constructor(element: JQuery, options?: dxPolarChartOptions); constructor(element: Element, options?: dxPolarChartOptions); - /** Returns an array of all series in the chart. */ - getAllSeries(): Array; - /** Gets a series within the chart's series collection by the specified name (see the name option). */ - getSeriesByName(seriesName: string): PolarSeries; - /** Gets a series within the chart's series collection by its position number. */ - getSeriesByPos(seriesIndex: number): PolarSeries; } export interface PieLegend extends core.BaseLegend { /** Specifies what chart elements to highlight when a corresponding item in the legend is hovered over. */ @@ -5539,17 +5824,29 @@ declare module DevExpress.viz.charts { series?: Array; /** Specifies the diameter of the pie. */ diameter?: number; + /** Specifies the direction that the pie chart segments will occupy. */ + segmentsDirection?: string; + /** Specifies the starting angle in arc degrees for the first segment in a pie chart. */ + startAngle?: number; + /** Specifies the fraction of the inner radius relative to the total radius in the series of the 'doughnut' type. The value should be between 0 and 1. */ + innerRadius?: number; /** A handler for the legendClick event. */ onLegendClick?: any; - legendClick?: any; /** Specifies how a chart must behave when series point labels overlap. */ resolveLabelOverlapping?: string; + /** An object defining the configuration options that are common for all series of the dxPieChart widget. */ + commonSeriesSettings?: CommonPieSeriesSettings; + /** Specifies the type of the pie chart series. */ + type?: string; } /** A circular chart widget for HTML JS applications. */ export class dxPieChart extends BaseChart { constructor(element: JQuery, options?: dxPieChartOptions); constructor(element: Element, options?: dxPieChartOptions); - /** Provides access to the dxPieChart series. */ + /** + * Provides access to the dxPieChart series. + * @deprecated ..\..\BaseChart\3 Methods\getAllSeries().md + */ getSeries(): PieSeries; } } @@ -5584,13 +5881,22 @@ declare module DevExpress.viz.gauges { export interface ScaleTick { /** Specifies the color of the scale's minor ticks. */ color?: string; - /** Specifies an array of custom minor ticks. */ + /** + * Specifies an array of custom minor ticks. + * @deprecated ..\customMinorTicks.md + */ customTickValues?: Array; /** Specifies the length of the scale's minor ticks. */ length?: number; - /** Indicates whether automatically calculated minor ticks are visible or not. */ + /** + * Indicates whether automatically calculated minor ticks are visible or not. + * @deprecated This functionality in not more available + */ showCalculatedTicks?: boolean; - /** Specifies an interval between minor ticks. */ + /** + * Specifies an interval between minor ticks. + * @deprecated ..\minorTickInterval.md + */ tickInterval?: number; /** Indicates whether scale minor ticks are visible or not. */ visible?: boolean; @@ -5598,14 +5904,28 @@ declare module DevExpress.viz.gauges { width?: number; } export interface ScaleMajorTick extends ScaleTick { - /** Specifies whether or not to expand the current major tick interval if labels overlap each other. */ + /** + * Specifies whether or not to expand the current major tick interval if labels overlap each other. + * @deprecated ..\label\overlappingBehavior\useAutoArrangement.md + */ useTicksAutoArrangement?: boolean; } + export interface ScaleMinorTick extends ScaleTick { + /** Specifies the opacity of the scale's minor ticks. */ + opacity?: number; + } export interface BaseScaleLabel { /** Specifies whether or not scale labels should be colored similarly to their corresponding ranges in the range container. */ useRangeColors?: boolean; /** Specifies a callback function that returns the text to be displayed in scale labels. */ customizeText?: (scaleValue: { value: number; valueText: string }) => string; + /** Specifies the overlap resolving options to be applied to scale labels. */ + overlappingBehavior?: { + /** Specifies whether or not to expand the current major tick interval if labels overlap each other. */ + useAutoArrangement?: boolean; + /** Specifies what label to hide in case of overlapping. */ + hideFirstOrLast?: string; + }; /** Specifies font options for the text displayed in the scale labels of the gauge. */ font?: viz.core.Font; /** Specifies a format for the text displayed in scale labels. */ @@ -5618,20 +5938,56 @@ declare module DevExpress.viz.gauges { export interface BaseScale { /** Specifies the end value for the scale of the gauge. */ endValue?: number; - /** Specifies whether or not to hide the first scale label. */ + /** + * Specifies whether or not to hide the first scale label. + * @deprecated This functionality in not more available + */ hideFirstLabel?: boolean; - /** Specifies whether or not to hide the first major tick on the scale. */ + /** + * Specifies whether or not to hide the first major tick on the scale. + * @deprecated This functionality in not more available + */ hideFirstTick?: boolean; - /** Specifies whether or not to hide the last scale label. */ + /** + * Specifies whether or not to hide the last scale label. + * @deprecated This functionality in not more available + */ hideLastLabel?: boolean; - /** Specifies whether or not to hide the last major tick on the scale. */ + /** + * Specifies whether or not to hide the last major tick on the scale. + * @deprecated This functionality in not more available + */ hideLastTick?: boolean; + /** Specifies an interval between major ticks. */ + tickInterval?: number; + /** Specifies an interval between minor ticks. */ + minorTickInterval?: number; + /** Specifies an array of custom major ticks. */ + customTicks?: Array; + /** Specifies an array of custom minor ticks. */ + customMinorTicks?: Array; /** Specifies common options for scale labels. */ label?: BaseScaleLabel; - /** Specifies options of the gauge's major ticks. */ + /** + * Specifies options of the gauge's major ticks. + * @deprecated ..\tick\tick.md + */ majorTick?: ScaleMajorTick; + /** Specifies options of the gauge's major ticks. */ + tick?: { + /** Specifies the color of the scale's major ticks. */ + color?: string; + /** Specifies the length of the scale's major ticks. */ + length?: number; + /** Indicates whether scale major ticks are visible or not. */ + visible?: boolean; + /** Specifies the width of the scale's major ticks. */ + width?: number; + /** Specifies the opacity of the scale's major ticks. */ + opacity?: number; + }; /** Specifies options of the gauge's minor ticks. */ - minorTick?: ScaleTick; + minorTick?: ScaleMinorTick; /** Specifies the start value for the scale of the gauge. */ startValue?: number; } @@ -5688,21 +6044,48 @@ declare module DevExpress.viz.gauges { redrawOnResize?: boolean; /** Specifies the size of the widget in pixels. */ size?: viz.core.Size; - /** Specifies a subtitle for a gauge. */ + /** + * Specifies a subtitle for the widget. + * @deprecated ..\..\..\BaseGauge\1 Configuration\title\subtitle\subtitle.md + */ subtitle?: { - /** Specifies font options for the subtitle. */ + /** + * Specifies font options for the subtitle. + * @deprecated ..\..\title\subtitle\font\font.md + */ font?: viz.core.Font; - /** Specifies a text for the subtitle. */ + /** + * Specifies a text for the subtitle. + * @deprecated ..\title\subtitle\text.md + */ text?: string; }; /** Specifies a title for a gauge. */ title?: { /** Specifies font options for the title. */ font?: viz.core.Font; - /** Specifies a title's position on the gauge. */ + /** + * Specifies a title's position on the gauge. + * @deprecated basegaugeoptions_title_verticalAlignment and basegaugeoptions_title_horizontalAlignment + */ position?: string; - /** Specifies a text for the title. */ + /** Specifies the distance between the title and surrounding gauge elements in pixels. */ + margin?: viz.core.Margins; + /** Specifies the height of the space reserved for the title. */ + placeholderSize?: number; + /** Specifies the gauge title's position in the vertical direction. */ + verticalAlignment?: string; + /** Specifies the gauge title's horizontal position. */ + horizontalAlignment?: string; + /** Specifies text for the title. */ text?: string; + /** Specifies a subtitle for the widget. */ + subtitle?: { + /** Specifies font options for the subtitle. */ + font?: viz.core.Font; + /** Specifies text for the subtitle. */ + text?: string; + } }; /** Specifies options for gauge tooltips. */ tooltip?: viz.core.Tooltip; @@ -5911,6 +6294,8 @@ declare module DevExpress.viz.rangeSelector { /** Indicates whether or not the background (background color and/or image) is visible. */ visible?: boolean; }; + /** Specifies a title for the range selector. */ + title?: viz.core.Title; /** Specifies the dxRangeSelector's behavior options. */ behavior?: { /** Indicates whether or not you can swap sliders. */ @@ -5941,8 +6326,10 @@ declare module DevExpress.viz.rangeSelector { /** Specifies how to sort series points. */ sortingMethod?: any; }; - /** Specifies a value indicating whether all bars in a series must have the same width, or may have different widths if any points in other series are missing. */ - equalBarWidth?: any; + /** Specifies whether all bars in a series must have the same width, or may have different widths if any points in other series are missing. */ + equalBarWidth?: boolean; + /** Specifies a common bar width as a percentage from 0 to 1. */ + barWidth?: number; /** Sets the name of the palette to be used in the range selector's chart. Alternatively, an array of colors can be set as a custom palette to be used within this chart. */ palette?: any; /** An object defining the chart’s series. */ @@ -6076,7 +6463,6 @@ declare module DevExpress.viz.rangeSelector { /** Specifies range selector's right indent. */ right?: number; }; - selectedRangeChanged?: (selectedRange: { startValue: any; endValue: any; }) => void; /** A handler for the selectedRangeChanged event. */ onSelectedRangeChanged?: (e: { startValue: any; @@ -6168,145 +6554,426 @@ interface JQuery { dxRangeSelector(methodName: "instance"): DevExpress.viz.rangeSelector.dxRangeSelector; } declare module DevExpress.viz.map { - /** This section describes the fields and methods that can be used in code to manipulate the Area object. */ + /** This section describes the fields and methods that can be used in code to manipulate the Layer object. */ + export interface MapLayer { + /** The name of the layer. */ + name: string; + /** The layer index in the layers array. */ + index: number; + /** The layer type. Can be "area", "line" or "marker". */ + type: string; + /** The type of the layer elements. */ + elementType: string; + /** Gets all layer elements. */ + getElements(): Array; + /** Deselects all layer elements. */ + clearSelection(): void; + } + /** This section describes the fields and methods that can be used in code to manipulate the Layer Element object. */ + export interface MapLayerElement { + /** The parent layer of the layer element. */ + layer: MapLayer; + /** Gets the layer element coordinates. */ + coordinates(): Object; + /** Sets the value of an attribute. */ + attribute(name: string, value: any): void; + /** Gets the value of an attribute. */ + attribute(name: string): any; + /** Gets the selection state of the layer element. */ + selected(): boolean; + /** Sets the selection state of the layer element. */ + selected(state: boolean): void; + /** Applies the layer element settings and updates the element appearance. */ + applySettings(settings: any): void; + } + /** + * This section describes the fields and methods that can be used in code to manipulate the Area object. + * @deprecated Use the "Layer Element" instead + */ export interface Area { - /** Contains the element type. */ + /** + * Contains the element type. + * @deprecated ..\..\Layer\2 Fields\type.md + */ type: string; - /** Return the value of an attribute. */ + /** + * Return the value of an attribute. + * @deprecated ..\..\Layer Element\3 Methods\attribute(name_value).md + */ attribute(name: string): any; - /** Provides information about the selection state of an area. */ + /** + * Provides information about the selection state of an area. + * @deprecated Use the "selected()" method of the Layer Element + */ selected(): boolean; - /** Sets a new selection state for an area. */ + /** + * Sets a new selection state for an area. + * @deprecated Use the "selected(state)" method of the Layer Element + */ selected(state: boolean): void; - /** Applies the area settings specified as a parameter and updates the area appearance. */ + /** + * Applies the area settings specified as a parameter and updates the area appearance. + * @deprecated ..\..\Layer Element\3 Methods\applySettings(settings).md + */ applySettings(settings: any): void; } - /** This section describes the fields and methods that can be used in code to manipulate the Markers object. */ + /** + * This section describes the fields and methods that can be used in code to manipulate the Markers object. + * @deprecated Use the "Layer Element" instead + */ export interface Marker { - /** Contains the descriptive text accompanying the map marker. */ + /** + * Contains the descriptive text accompanying the map marker. + * @deprecated Get the text with the "attribute" method (using the "layers.label.dataField" value) + */ text: string; - /** Contains the type of the element. */ + /** + * Contains the type of the element. + * @deprecated ..\..\Layer\2 Fields\type.md + */ type: string; - /** Contains the URL of an image map marker. */ + /** + * Contains the URL of an image map marker. + * @deprecated Get the url with the "attribute" method (using the "layers.dataField" value) + */ url: string; - /** Contains the value of a bubble map marker. */ + /** + * Contains the value of a bubble map marker. + * @deprecated Get the value with the "attribute" method (using the "layers.dataField" value) + */ value: number; - /** Contains the values of a pie map marker. */ + /** + * Contains the values of a pie map marker. + * @deprecated Get the values with the "attribute" method (using the "layers.dataField" value) + */ values: Array; - /** Returns the value of an attribute. */ + /** + * Returns the value of an attribute. + * @deprecated ..\..\Layer Element\3 Methods\attribute(name_value).md + */ attribute(name: string): any; - /** Returns the coordinates of a specific marker. */ + /** + * Returns the coordinates of a specific marker. + * @deprecated ..\..\Layer Element\3 Methods\coordinates().md + */ coordinates(): Array; - /** Provides information about the selection state of a marker. */ + /** + * Provides information about the selection state of a marker. + * @deprecated Use the "selected()" method of the Layer Element + */ selected(): boolean; - /** Sets a new selection state for a marker. */ + /** + * Sets a new selection state for a marker. + * @deprecated Use the "selected(state)" method of the Layer Element + */ selected(state: boolean): void; - /** Applies the marker settings specified as a parameter and updates the marker appearance. */ + /** + * Applies the marker settings specified as a parameter and updates marker appearance. + * @deprecated ..\..\Layer Element\3 Methods\applySettings(settings).md + */ applySettings(settings: any): void; } - export interface AreaSettings { - /** Specifies the width of the area border in pixels. */ + export interface MapLayerSettings { + /** Specifies the layer name. */ + name?: string; + /** Specifies layer type. */ + type?: string; + /** Specifies the type of a marker element. Setting this option makes sense only if the layer type is "marker". */ + elementType?: string; + /** Specifies a data source for the layer element. */ + data?: any; + /** Specifies the width of the layer elements border in pixels. */ borderWidth?: number; - /** Specifies a color for the area border. */ + /** Specifies a color for the border of the layer elements. */ borderColor?: string; - click?: any; - /** Specifies a color for an area. */ + /** Specifies a color for layer elements. */ color?: string; - /** Specifies the function that customizes each area individually. */ - customize?: (areaInfo: Area) => AreaSettings; - /** Specifies a color for the area border when the area is hovered over. */ + /** Specifies a color for the border of the layer element when it is hovered over. */ hoveredBorderColor?: string; - /** Specifies the pixel-measured width of the area border when the area is hovered over. */ + /** Specifies the pixel-measured width for the border of the layer element when it is hovered over. */ hoveredBorderWidth?: number; - /** Specifies a color for an area when this area is hovered over. */ + /** Specifies a color for a layer element when it is hovered over. */ hoveredColor?: string; - /** Specifies whether or not to change the appearance of an area when it is hovered over. */ + /** Specifies a pixel-measured width for the border of the layer element when it is selected. */ + selectedBorderWidth?: number; + /** Specifies a color for the border of the layer element when it is selected. */ + selectedBorderColor?: string; + /** Specifies a color for the layer element when it is selected. */ + selectedColor?: string; + /** Specifies the layer opacity (from 0 to 1). */ + opacity?: number; + /** Specifies the size of markers. Setting this option makes sense only if the layer type is "marker" and the elementType is "dot", "pie" or "image". */ + size?: number; + /** Specifies the pixel-measured diameter of the marker that represents the smallest value. Setting this option makes sense only if the layer type is "marker". */ + minSize?: number; + /** Specifies the pixel-measured diameter of the marker that represents the biggest value. Setting this option makes sense only if the layer type is "marker". */ + maxSize?: number; + /** Specifies whether or not to change the appearance of a layer element when it is hovered over. */ hoverEnabled?: boolean; - /** Configures area labels. */ - label?: { - /** Specifies the data field that provides data for area labels. */ - dataField?: string; - /** Enables area labels. */ - enabled?: boolean; - /** Specifies font options for area labels. */ - font?: viz.core.Font; - }; - /** Specifies the name of the palette or a custom range of colors to be used for coloring a map. */ + /** Specifies whether single or multiple map elements can be selected on a vector map. */ + selectionMode?: string; + /** Specifies the name of the palette or a custom range of colors to be used for coloring a layer. */ palette?: any; /** Specifies the number of colors in a palette. */ paletteSize?: number; - /** Allows you to paint areas with similar attributes in the same color. */ + /** Allows you to paint layer elements with similar attributes in the same color. */ colorGroups?: Array; - /** Specifies the field that provides data to be used for coloring areas. */ + /** Specifies the field that provides data to be used for coloring of layer elements. */ colorGroupingField?: string; - /** Specifies a color for the area border when the area is selected. */ - selectedBorderColor?: string; - /** Specifies a color for an area when this area is selected. */ - selectedColor?: string; - /** Specifies the pixel-measured width of the area border when the area is selected. */ - selectedBorderWidth?: number; - selectionChanged?: (area: Area) => void; - /** Specifies whether single or multiple areas can be selected on a vector map. */ - selectionMode?: string; - } - export interface MarkerSettings { - /** Specifies a color for the marker border. */ - borderColor?: string; - /** Specifies the width of the marker border in pixels. */ - borderWidth?: number; - click?: any; - /** Specifies a color for a marker of the dot or bubble type. */ - color?: string; - /** Specifies the function that customizes each marker individually. */ - customize?: (markerInfo: Marker) => MarkerSettings; - font?: Object; - /** Specifies the pixel-measured width of the marker border when the marker is hovered over. */ - hoveredBorderWidth?: number; - /** Specifies a color for the marker border when the marker is hovered over. */ - hoveredBorderColor?: string; - /** Specifies a color for a marker of the dot or bubble type when this marker is hovered over. */ - hoveredColor?: string; - /** Specifies whether or not to change the appearance of a marker when it is hovered over. */ - hoverEnabled?: boolean; + /** Allows you to display bubbles with similar attributes in the same size. Setting this option makes sense only if the layer type is "marker" and the elementType is "bubble". */ + sizeGroups?: Array; + /** Specifies the field that provides data to be used for sizing bubble markers. Setting this option makes sense only if the layer type is "marker" and the elementType is "bubble". */ + sizeGroupingField?: string; + /** Specifies the name of the attribute containing marker data. Setting this option makes sense only if the layer type is "marker" and the elementType is "bubble", "pie" or "image". */ + dataField?: string; + /** Specifies the function that customizes each layer element individually. */ + customize?: (eleemnts: Array) => void; /** Specifies marker label options. */ label?: { + /** The name of the data attribute containing marker texts. */ + dataField?: string; /** Enables marker labels. */ enabled?: boolean; /** Specifies font options for marker labels. */ font?: viz.core.Font; }; - /** Specifies the pixel-measured diameter of the marker that represents the biggest value. Setting this option makes sense only if you use markers of the bubble type. */ - maxSize?: number; - /** Specifies the pixel-measured diameter of the marker that represents the smallest value. Setting this option makes sense only if you use markers of the bubble type. */ - minSize?: number; - /** Specifies the opacity of markers. Setting this option makes sense only if you use markers of the bubble type. */ - opacity?: number; - /** Specifies the pixel-measured width of the marker border when the marker is selected. */ - selectedBorderWidth?: number; - /** Specifies a color for the marker border when the marker is selected. */ - selectedBorderColor?: string; - /** Specifies a color for a marker of the dot or bubble type when this marker is selected. */ - selectedColor?: string; - selectionChanged?: (marker: Marker) => void; - /** Specifies whether a single or multiple markers can be selected on a vector map. */ - selectionMode?: string; - /** Specifies the size of markers. Setting this option makes sense for any type of marker except bubble. */ - size?: number; - /** Specifies the type of markers to be used on the map. */ - type?: string; - /** Specifies the name of a palette or a custom set of colors to be used for coloring markers of the pie type. */ + } + export interface AreaSettings { + /** + * Specifies the width of the area border in pixels. + * @deprecated ..\layers\borderWidth.md + */ + borderWidth?: number; + /** + * Specifies a color for the area border. + * @deprecated ..\layers\borderColor.md + */ + borderColor?: string; + /** + * Specifies a color for an area. + * @deprecated ..\layers\color.md + */ + color?: string; + /** + * Specifies the function that customizes each area individually. + * @deprecated ..\layers\customize.md + */ + customize?: (areaInfo: Area) => AreaSettings; + /** + * Specifies a color for the area border when the area is hovered over. + * @deprecated ..\layers\hoveredBorderColor.md + */ + hoveredBorderColor?: string; + /** + * Specifies the pixel-measured width of the area border when the area is hovered over. + * @deprecated ..\layers\hoveredBorderWidth.md + */ + hoveredBorderWidth?: number; + /** + * Specifies a color for an area when this area is hovered over. + * @deprecated ..\layers\hoveredColor.md + */ + hoveredColor?: string; + /** + * Specifies whether or not to change the appearance of an area when it is hovered over. + * @deprecated ..\layers\hoverEnabled.md + */ + hoverEnabled?: boolean; + /** + * Configures area labels. + * @deprecated ..\..\layers\label\label.md + */ + label?: { + /** + * Specifies the data field that provides data for area labels. + * @deprecated ..\..\layers\label\dataField.md + */ + dataField?: string; + /** + * Enables area labels. + * @deprecated ..\..\layers\label\enabled.md + */ + enabled?: boolean; + /** + * Specifies font options for area labels. + * @deprecated ..\..\..\layers\label\font\font.md + */ + font?: viz.core.Font; + }; + /** + * Specifies the name of the palette or a custom range of colors to be used for coloring a map. + * @deprecated ..\layers\palette.md + */ palette?: any; - /** Allows you to paint markers with similar attributes in the same color. */ + /** + * Specifies the number of colors in a palette. + * @deprecated ..\layers\paletteSize.md + */ + paletteSize?: number; + /** + * Allows you to paint areas with similar attributes in the same color. + * @deprecated ..\layers\colorGroups.md + */ colorGroups?: Array; - /** Specifies the field that provides data to be used for coloring markers. */ + /** + * Specifies the field that provides data to be used for coloring areas. + * @deprecated ..\layers\colorGroupingField.md + */ colorGroupingField?: string; - /** Allows you to display bubbles with similar attributes in the same size. */ + /** + * Specifies a color for the area border when the area is selected. + * @deprecated ..\layers\selectedBorderColor.md + */ + selectedBorderColor?: string; + /** + * Specifies a color for an area when this area is selected. + * @deprecated ..\layers\selectedColor.md + */ + selectedColor?: string; + /** + * Specifies the pixel-measured width of the area border when the area is selected. + * @deprecated ..\layers\selectedBorderWidth.md + */ + selectedBorderWidth?: number; + /** + * Specifies whether single or multiple areas can be selected on a vector map. + * @deprecated ..\layers\selectionMode.md + */ + selectionMode?: string; + } + export interface MarkerSettings { + /** + * Specifies a color for the marker border. + * @deprecated ..\layers\borderColor.md + */ + borderColor?: string; + /** + * Specifies the width of the marker border in pixels. + * @deprecated ..\layers\borderWidth.md + */ + borderWidth?: number; + /** + * Specifies a color for a marker of the dot or bubble type. + * @deprecated ..\layers\color.md + */ + color?: string; + /** + * Specifies the function that customizes each marker individually. + * @deprecated ..\layers\customize.md + */ + customize?: (markerInfo: Marker) => MarkerSettings; + /** + * Specifies the pixel-measured width of the marker border when the marker is hovered over. + * @deprecated ..\layers\hoveredBorderWidth.md + */ + hoveredBorderWidth?: number; + /** + * Specifies a color for the marker border when the marker is hovered over. + * @deprecated ..\layers\hoveredBorderColor.md + */ + hoveredBorderColor?: string; + /** + * Specifies a color for a marker of the dot or bubble type when this marker is hovered over. + * @deprecated ..\layers\hoveredColor.md + */ + hoveredColor?: string; + /** + * Specifies whether or not to change the appearance of a marker when it is hovered over. + * @deprecated ..\layers\hoverEnabled.md + */ + hoverEnabled?: boolean; + /** + * Specifies marker label options. + * @deprecated ..\..\layers\label\label.md + */ + label?: { + /** + * Enables marker labels. + * @deprecated ..\..\layers\label\enabled.md + */ + enabled?: boolean; + /** + * Specifies font options for marker labels. + * @deprecated ..\..\..\layers\label\font\font.md + */ + font?: viz.core.Font; + }; + /** + * Specifies the pixel-measured diameter of the marker that represents the biggest value. Setting this option makes sense only if you use markers of the bubble type. + * @deprecated ..\layers\maxSize.md + */ + maxSize?: number; + /** + * Specifies the pixel-measured diameter of the marker that represents the smallest value. Setting this option makes sense only if you use markers of the bubble type. + * @deprecated ..\layers\minSize.md + */ + minSize?: number; + /** + * Specifies the opacity of markers. Setting this option makes sense only if you use markers of the bubble type. + * @deprecated ..\layers\opacity.md + */ + opacity?: number; + /** + * Specifies the pixel-measured width of the marker border when the marker is selected. + * @deprecated ..\layers\selectedBorderWidth.md + */ + selectedBorderWidth?: number; + /** + * Specifies a color for the marker border when the marker is selected. + * @deprecated ..\layers\selectedBorderColor.md + */ + selectedBorderColor?: string; + /** + * Specifies a color for a marker of the dot or bubble type when this marker is selected. + * @deprecated ..\layers\selectedColor.md + */ + selectedColor?: string; + /** + * Specifies whether a single or multiple markers can be selected on a vector map. + * @deprecated ..\layers\selectionMode.md + */ + selectionMode?: string; + /** + * Specifies the size of markers. Setting this option makes sense for any type of marker except bubble. + * @deprecated ..\layers\size.md + */ + size?: number; + /** + * Specifies the type of markers to be used on the map. + * @deprecated ..\layers\elementType.md + */ + type?: string; + /** + * Specifies the name of a palette or a custom set of colors to be used for coloring markers of the pie type. + * @deprecated ..\layers\palette.md + */ + palette?: any; + /** + * Allows you to paint markers with similar attributes in the same color. + * @deprecated ..\layers\colorGroups.md + */ + colorGroups?: Array; + /** + * Specifies the field that provides data to be used for coloring markers. + * @deprecated ..\layers\colorGroupingField.md + */ + colorGroupingField?: string; + /** + * Allows you to display bubbles with similar attributes in the same size. + * @deprecated ..\layers\sizeGroups.md + */ sizeGroups?: Array; - /** Specifies the field that provides data to be used for sizing bubble markers. */ + /** + * Specifies the field that provides data to be used for sizing bubble markers. + * @deprecated ..\layers\sizeGroupingField.md + */ sizeGroupingField?: string; } export interface dxVectorMapOptions extends viz.core.BaseWidgetOptions { - /** An object specifying options for the map areas. */ + /** + * An object specifying options for the map areas. + * @deprecated Use the 'layers' option instead + */ areaSettings?: AreaSettings; /** Specifies the options for the map background. */ background?: { @@ -6315,6 +6982,10 @@ declare module DevExpress.viz.map { /** Specifies a color for the background. */ color?: string; }; + /** Specifies options for dxVectorMap widget layers. */ + layers?: Array; + /** Specifies the map projection. */ + projection?: Object; /** Specifies the positioning of a map in geographical coordinates. */ bounds?: Array; /** Specifies the options of the control bar. */ @@ -6336,14 +7007,25 @@ declare module DevExpress.viz.map { }; /** Specifies the appearance of the loading indicator. */ loadingIndicator?: viz.core.LoadingIndicator; - /** Specifies a data source for the map area. */ + /** + * Specifies a data source for the map area. + * @deprecated Use the 'layers.data' option instead + */ mapData?: any; - /** Specifies a data source for the map markers. */ + /** + * Specifies a data source for the map markers. + * @deprecated Use the 'layers.data' option instead + */ markers?: any; - /** An object specifying options for the map markers. */ + /** + * An object specifying options for the map markers. + * @deprecated Use the 'layers' option instead + */ markerSettings?: MarkerSettings; /** Specifies the size of the dxVectorMap widget. */ size?: viz.core.Size; + /** Specifies a title for the vector map. */ + title?: viz.core.Title; /** Specifies tooltip options. */ tooltip?: viz.core.Tooltip; /** Configures map legends. */ @@ -6356,7 +7038,6 @@ declare module DevExpress.viz.map { zoomingEnabled?: boolean; /** Specifies the geographical coordinates of the center for a map. */ center?: Array; - centerChanged?: (center: Array) => void; /** A handler for the centerChanged event. */ onCenterChanged?: (e: { center: Array; @@ -6379,27 +7060,43 @@ declare module DevExpress.viz.map { zoomFactor?: number; /** Specifies a map's maximum zoom factor. */ maxZoomFactor?: number; - zoomFactorChanged?: (zoomFactor: number) => void; /** A handler for the zoomFactorChanged event. */ onZoomFactorChanged?: (e: { - zoomFactor: number; component: dxVectorMap; element: Element; + zoomFactor: number; }) => void; - click?: any; /** A handler for the click event. */ onClick?: any; - /** A handler for the areaClick event. */ + /** A handler for the selectionChanged event. */ + onSelectionChanged?: (e: { + component: dxVectorMap; + element: Element; + target: MapLayerElement; + }) => void; + /** + * A handler for the areaClick event. + * @deprecated Use the 'onClick' option instead + */ onAreaClick?: any; - /** A handler for the areaSelectionChanged event. */ + /** + * A handler for the areaSelectionChanged event. + * @deprecated Use the 'onSelectionChanged' option instead + */ onAreaSelectionChanged?: (e: { target: Area; component: dxVectorMap; element: Element; }) => void; - /** A handler for the markerClick event. */ + /** + * A handler for the markerClick event. + * @deprecated Use the 'onClick' option instead + */ onMarkerClick?: any; - /** A handler for the markerSelectionChanged event. */ + /** + * A handler for the markerSelectionChanged event. + * @deprecated Use the 'onSelecitonChanged' option instead + */ onMarkerSelectionChanged?: (e: { target: Marker; component: dxVectorMap; @@ -6409,12 +7106,19 @@ declare module DevExpress.viz.map { panningEnabled?: boolean; } export interface Legend extends viz.core.BaseLegend { + /** Specifies the color of item markers in the legend. The specified color applied only when the legend uses 'size' source. */ + markerColor?: string; /** Specifies text for legend items. */ customizeText?: (itemInfo: { start: number; end: number; index: number; color: string; size: number; }) => string; /** Specifies text for a hint that appears when a user hovers the mouse pointer over the text of a legend item. */ customizeHint?: (itemInfo: { start: number; end: number; index: number; color: string; size: number }) => string; /** Specifies the source of data for the legend. */ - source?: string; + source?: { + /** Specifies a layer to which the legend belongs. */ + layer?: string; + /** Specifies the type of the legend grouping. */ + grouping?: string; + } } /** A vector map widget. */ export class dxVectorMap extends viz.core.BaseWidget { @@ -6430,17 +7134,35 @@ declare module DevExpress.viz.map { center(): Array; /** Sets the coordinates of the map center. */ center(centerCoordinates: Array): void; - /** Deselects all the selected areas on a map. The areas are displayed in their initial style after. */ + /** + * Deselects all the selected areas on a map. The areas are displayed in their initial style after. + * @deprecated Use the 'clearSelection' method on a layer instead + */ clearAreaSelection(): void; - /** Deselects all the selected markers on a map. The markers are displayed in their initial style after. */ + /** + * Deselects all the selected markers on a map. The markers are displayed in their initial style after. + * @deprecated Use the 'clearSelection' method on a layer instead + */ clearMarkerSelection(): void; /** Deselects all the selected area and markers on a map at once. The areas and markers are displayed in their initial style after. */ clearSelection(): void; /** Converts client area coordinates into map coordinates. */ convertCoordinates(x: number, y: number): Array; - /** Returns an array with all the map areas. */ + /** Gets all map layers. */ + getLayers(): Array; + /** Gets the layer by its index. */ + getLayerByIndex(index: number): MapLayer; + /** Gets the layer by its name. */ + getLayerByName(name: string): MapLayer; + /** + * Returns an array with all the map areas. + * @deprecated Use the 'getElements' method on a layer instead + */ getAreas(): Array; - /** Returns an array with all the map markers. */ + /** + * Returns an array with all the map markers. + * @deprecated Use the 'getElements' method on a layer instead + */ getMarkers(): Array; /** Gets the current coordinates of the map viewport. */ viewport(): Array; @@ -6451,6 +7173,19 @@ declare module DevExpress.viz.map { /** Sets the value of the map zoom factor. */ zoomFactor(zoomFactor: number): void; } + export var projection: ProjectionCreator; + export interface ProjectionCreator { + /** Creates a new projection. */ + (data: { + to?: (coordinates: Array) => Array; + from?: (coordinates: Array) => Array; + aspectRatio?: number; + }): Object; + /** Gets the default or custom projection from the projection storage. */ + get(name: string): Object; + /** Adds a new projection to the internal projections storage. */ + add(name: string, projection: Object): void; + } } interface JQuery { dxVectorMap(options?: DevExpress.viz.map.dxVectorMapOptions): JQuery; From 44474f1af32f15eda11142ca4898cab3c596200c Mon Sep 17 00:00:00 2001 From: Sam Vloeberghs Date: Thu, 3 Dec 2015 13:49:21 +0100 Subject: [PATCH 285/389] update --- foundation-sites/foundation-tests.ts | 57 +++++++++++++++++++++++++++- foundation-sites/foundation.d.ts | 48 ++++++++++++----------- npm-debug.log | 45 ++++++++++++++++++++++ 3 files changed, 127 insertions(+), 23 deletions(-) create mode 100644 npm-debug.log diff --git a/foundation-sites/foundation-tests.ts b/foundation-sites/foundation-tests.ts index f7da5e49c..54da9fb79 100644 --- a/foundation-sites/foundation-tests.ts +++ b/foundation-sites/foundation-tests.ts @@ -1,7 +1,6 @@ // Tests for type definitions for Foundation Sites v6.0.4 // Project: http://foundation.zurb.com/ // Definitions by: Sam Vloeberghs -// Definitions by: Michał Wrześniewski // Definitions: https://github.com/borisyankov/DefinitelyTyped /// @@ -11,6 +10,60 @@ $(document).foundation(); $(document).foundation('method'); $(document).foundation(['method', 'method2']); + + Foundation.Abide.($('.selector')); + Foundation.Abide.($('.selector'), {}); +/* + Foundation.Accordion.($('.selector')); + Foundation.Accordion.($('.selector'), {}); + + Foundation.AccordionMenu.($('.selector')); + Foundation.AccordionMenu.($('.selector'), {}); + + Foundation.DrillDown.($('.selector')); + Foundation.DrillDown.($('.selector'), {}); + + Foundation.Dropdown.($('.selector')); + Foundation.Dropdown.($('.selector'), {}); + + Foundation.DropdownMenu.($('.selector')); + Foundation.DropdownMenu.($('.selector'), {}); + + Foundation.Equalizer.($('.selector')); + Foundation.Equalizer.($('.selector'), {}); + + Foundation.Interchange.($('.selector')); + Foundation.Interchange.($('.selector'), {}); + + Foundation.Magellan.($('.selector')); + Foundation.Magellan.($('.selector'), {}); + + Foundation.OffCanvas.($('.selector')); + Foundation.OffCanvas.($('.selector'), {}); + + Foundation.Orbit.($('.selector')); + Foundation.Orbit.($('.selector'), {}); + + Foundation.Reveal.($('.selector')); + Foundation.Reveal.($('.selector'), {}); + + Foundation.Slider.($('.selector')); + Foundation.Slider.($('.selector'), {}); + + Foundation.Sticky.($('.selector')); + Foundation.Sticky.($('.selector'), {}); + + Foundation.Tabs.($('.selector')); + Foundation.Tabs.($('.selector'), {}); + + Foundation.Toggler.($('.selector')); + Foundation.Toggler.($('.selector'), {}); + + Foundation.Tooltip.($('.selector')); + Foundation.Tooltip.($('.selector'), {}); + */ + +/* function pluginList() { 'use strict'; @@ -40,3 +93,5 @@ pluginList().forEach((value:String) => { Foundation[value].($('.selector')); Foundation[value].($('.selector'), {}); }); + +*/ diff --git a/foundation-sites/foundation.d.ts b/foundation-sites/foundation.d.ts index bcd012ec9..3ec7f344e 100644 --- a/foundation-sites/foundation.d.ts +++ b/foundation-sites/foundation.d.ts @@ -1,7 +1,6 @@ // Type definitions for Foundation Sites v6.0.4 // Project: http://foundation.zurb.com/ // Definitions by: Sam Vloeberghs -// Definitions by: Michał Wrześniewski // Definitions: https://github.com/borisyankov/DefinitelyTyped /// @@ -18,10 +17,10 @@ declare module Foundation { validateForm(element:Object): void; validateText(element:Object): boolean; validateRadio(group:String): boolean; - resetform($form:Object): void; + resetForm($form:Object): void; } - export interface IAbidePatterns { + interface IAbidePatterns { alpha?: RegExp; alpha_numeric?: RegExp; integer?: RegExp; @@ -40,8 +39,8 @@ declare module Foundation { color?: RegExp; } - export interface IAbideOptions { - slideSpeed?: number + interface IAbideOptions { + slideSpeed?: number; multiOpen?: boolean; patters?: Foundation.IAbidePatterns; } @@ -54,7 +53,7 @@ declare module Foundation { destroy(): void; } - export interface IAccordionOptions { + interface IAccordionOptions { slideSpeed?: number multiOpen?: boolean; } @@ -67,7 +66,7 @@ declare module Foundation { destroy(): void; } - export interface IAccordionMenuOptions { + interface IAccordionMenuOptions { slideSpeed?: number; multiOpen?: boolean; } @@ -80,7 +79,7 @@ declare module Foundation { destroy(): void; } - export interface IDrilldownOptions { + interface IDrilldownOptions { backButton?: String; wrapper?: String closeOnClick?: boolean @@ -95,7 +94,7 @@ declare module Foundation { destroy(): void; } - export interface IDropdownOptions { + interface IDropdownOptions { hoverDelay?: number; hover?: boolean; vOffset?: number; @@ -110,7 +109,7 @@ declare module Foundation { destroy(): void; } - export interface IDropdownMenuOptions { + interface IDropdownMenuOptions { disableHover?: boolean; autoclose?: boolean; hoverDelay?: number; @@ -128,7 +127,7 @@ declare module Foundation { destroy(): void; } - export interface IEqualizerOptions { + interface IEqualizerOptions { equalizeOnStack?: boolean; throttleInterval?: number; } @@ -139,7 +138,7 @@ declare module Foundation { destroy(): void; } - export interface IInterchangeOptions { + interface IInterchangeOptions { rules?: Array } @@ -150,7 +149,7 @@ declare module Foundation { destroy(): void; } - export interface IMagellanOptions { + interface IMagellanOptions { animationDuration?: number; animationEasing?: String; threshold?: number; @@ -166,7 +165,7 @@ declare module Foundation { destroy(): void; } - export interface IOffCanvasOptions { + interface IOffCanvasOptions { closeOnClick?: boolean; transitionTime?: number; position?: String; @@ -184,7 +183,7 @@ declare module Foundation { destroy(): void; } - export interface IOrbitOptions { + interface IOrbitOptions { bullets?: boolean; navButtons?: boolean; animInFromRight?: String; @@ -212,7 +211,7 @@ declare module Foundation { destroy(): void; } - export interface IRevealOptions { + interface IRevealOptions { animationIn?: String; animationOut?: String; showDelay?: number; @@ -233,7 +232,7 @@ declare module Foundation { destroy(): void; } - export interface ISliderOptions { + interface ISliderOptions { start?: number; end?: number; step?: number; @@ -258,7 +257,7 @@ declare module Foundation { emCalc(number:any): void; } - export interface IStickyOptions { + interface IStickyOptions { container?: String; stickTo?: String; anchor?: String; @@ -279,7 +278,7 @@ declare module Foundation { destroy(): void; } - export interface ITabsOptions { + interface ITabsOptions { animate?: boolean; } @@ -289,7 +288,7 @@ declare module Foundation { destroy(): void; } - export interface ITogglerOptions { + interface ITogglerOptions { animate?: boolean; } @@ -301,7 +300,7 @@ declare module Foundation { destroy(): void; } - export interface ITooltipOptions { + interface ITooltipOptions { hoverDelay?: number; fadeInDuration?: number; fadeOutDuration?: number; @@ -381,7 +380,7 @@ declare module Foundation { transitionend(): String; util : { - throttle(func:(...args:any[]) => any, delay:number) (...args:any[]) => any; + throttle(func:(...args:any[]) => any, delay:number): (...args:any[]) => any; }; onImagesLoaded(images:Object, cb:Function): void; @@ -415,6 +414,7 @@ declare module Foundation { Triggers: Foundation.Triggers; } + } interface JQuery { @@ -422,3 +422,7 @@ interface JQuery { } declare var Foundation:Foundation.FoundationStatic; + +declare module "Foundation" { + export = Foundation; +} diff --git a/npm-debug.log b/npm-debug.log new file mode 100644 index 000000000..19dc7e7fd --- /dev/null +++ b/npm-debug.log @@ -0,0 +1,45 @@ +0 info it worked if it ends with ok +1 verbose cli [ '/usr/local/Cellar/node/4.2.1/bin/node', +1 verbose cli '/usr/local/bin/npm', +1 verbose cli 'run', +1 verbose cli 'test' ] +2 info using npm@3.3.9 +3 info using node@v4.2.1 +4 verbose run-script [ 'pretest', 'test', 'posttest' ] +5 info lifecycle DefinitelyTyped@0.0.1~pretest: DefinitelyTyped@0.0.1 +6 silly lifecycle DefinitelyTyped@0.0.1~pretest: no script for pretest, continuing +7 info lifecycle DefinitelyTyped@0.0.1~test: DefinitelyTyped@0.0.1 +8 verbose lifecycle DefinitelyTyped@0.0.1~test: unsafe-perm in lifecycle true +9 verbose lifecycle DefinitelyTyped@0.0.1~test: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Volumes/Data/Kwerri/playground/DefinitelyTyped/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin +10 verbose lifecycle DefinitelyTyped@0.0.1~test: CWD: /Volumes/Data/Kwerri/playground/DefinitelyTyped +11 silly lifecycle DefinitelyTyped@0.0.1~test: Args: [ '-c', 'dt --changes' ] +12 silly lifecycle DefinitelyTyped@0.0.1~test: Returned: code: 1 signal: null +13 info lifecycle DefinitelyTyped@0.0.1~test: Failed to exec test script +14 verbose stack Error: DefinitelyTyped@0.0.1 test: `dt --changes` +14 verbose stack Exit status 1 +14 verbose stack at EventEmitter. (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:233:16) +14 verbose stack at emitTwo (events.js:87:13) +14 verbose stack at EventEmitter.emit (events.js:172:7) +14 verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:24:14) +14 verbose stack at emitTwo (events.js:87:13) +14 verbose stack at ChildProcess.emit (events.js:172:7) +14 verbose stack at maybeClose (internal/child_process.js:818:16) +14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5) +15 verbose pkgid DefinitelyTyped@0.0.1 +16 verbose cwd /Volumes/Data/Kwerri/playground/DefinitelyTyped +17 error Darwin 15.0.0 +18 error argv "/usr/local/Cellar/node/4.2.1/bin/node" "/usr/local/bin/npm" "run" "test" +19 error node v4.2.1 +20 error npm v3.3.9 +21 error code ELIFECYCLE +22 error DefinitelyTyped@0.0.1 test: `dt --changes` +22 error Exit status 1 +23 error Failed at the DefinitelyTyped@0.0.1 test script 'dt --changes'. +23 error This is most likely a problem with the DefinitelyTyped package, +23 error not with npm itself. +23 error Tell the author that this fails on your system: +23 error dt --changes +23 error You can get their info via: +23 error npm owner ls DefinitelyTyped +23 error There is likely additional logging output above. +24 verbose exit [ 1, true ] From 3ff68ab822646d166995d02c40dd9ba97586d93f Mon Sep 17 00:00:00 2001 From: Per Kastman Date: Thu, 3 Dec 2015 14:26:25 +0100 Subject: [PATCH 286/389] Added possibility to register for events --- jquery-cropbox/jquery-cropbox-tests.ts | 6 ++++++ jquery-cropbox/jquery-cropbox.d.ts | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/jquery-cropbox/jquery-cropbox-tests.ts b/jquery-cropbox/jquery-cropbox-tests.ts index e8db3847c..270802cd9 100644 --- a/jquery-cropbox/jquery-cropbox-tests.ts +++ b/jquery-cropbox/jquery-cropbox-tests.ts @@ -37,3 +37,9 @@ cropboxWithOptions.update(); cropboxWithOptions.getDataURL(); cropboxWithOptions.getBlob(); cropboxWithOptions.remove(); + +cropboxWithOptions.on("cropbox",(e: Event, data: any, img: jQueryCropBox.Cropbox) => { + + //DoStuff + +}); \ No newline at end of file diff --git a/jquery-cropbox/jquery-cropbox.d.ts b/jquery-cropbox/jquery-cropbox.d.ts index 82b550bf3..9f91e06a2 100644 --- a/jquery-cropbox/jquery-cropbox.d.ts +++ b/jquery-cropbox/jquery-cropbox.d.ts @@ -103,7 +103,13 @@ declare module jQueryCropBox { * Remove the cropbox functionality from the image. */ remove(): void; + /** + * Attach an event handler function for one event on the Crop Box + */ + on(event: string, callback: jQueryCropBox.EventCallback): void; } + + type EventCallback = (e: Event, data: any, img: jQueryCropBox.Cropbox) => void; } interface JQuery { From 60caa355e54203f3880bbbdce05af9627ada0b5e Mon Sep 17 00:00:00 2001 From: Michael Tiller Date: Thu, 3 Dec 2015 08:29:49 -0500 Subject: [PATCH 287/389] Including types from angular-ui-router This change to the module definition allows both classic CommonJS imports as well as new ES6 style imports, e.g. import { IState } from 'angular-ui-router'; --- angular-ui-router/angular-ui-router.d.ts | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/angular-ui-router/angular-ui-router.d.ts b/angular-ui-router/angular-ui-router.d.ts index 014baf5ac..257446f69 100644 --- a/angular-ui-router/angular-ui-router.d.ts +++ b/angular-ui-router/angular-ui-router.d.ts @@ -5,10 +5,27 @@ /// -// Support for AMD require +// Support for AMD require and CommonJS declare module 'angular-ui-router' { - var _: string; - export = _; + // Since angular-ui-router adds providers for a bunch of + // injectable dependencies, it doesn't really return any + // actual data except the plain string 'ui.router'. + // + // As such, I don't think anybody will ever use the actual + // default value of the module. So I've only included the + // the types. (@xogeny) + export type IState = angular.ui.IState; + export type IStateProvider = angular.ui.IStateProvider; + export type IUrlMatcher = angular.ui.IUrlMatcher; + export type IUrlRouterProvider = angular.ui.IUrlRouterProvider; + export type IStateOptions = angular.ui.IStateOptions; + export type IHrefOptions = angular.ui.IHrefOptions; + export type IStateService = angular.ui.IStateService; + export type IResolvedState = angular.ui.IResolvedState; + export type IStateParamsService = angular.ui.IStateParamsService; + export type IUrlRouterService = angular.ui.IUrlRouterService; + export type IUiViewScrollProvider = angular.ui.IUiViewScrollProvider; + export type IType = angular.ui.IType; } declare module angular.ui { From 3ec3169f642ef2970422bf38298c11cd8eaaf33e Mon Sep 17 00:00:00 2001 From: James O'Cull Date: Thu, 3 Dec 2015 09:55:13 -0500 Subject: [PATCH 288/389] Commit / Rollback on Transaction interface should return promise --- sequelize/sequelize.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sequelize/sequelize.d.ts b/sequelize/sequelize.d.ts index 9b5e935bf..46a0ba41a 100644 --- a/sequelize/sequelize.d.ts +++ b/sequelize/sequelize.d.ts @@ -5706,12 +5706,12 @@ declare module "sequelize" { /** * Commit the transaction */ - commit() : Transaction; + commit() : Promise; /** * Rollback (abort) the transaction */ - rollback() : Transaction; + rollback() : Promise; } From 06509c824951af47ddd2853cb4fb9bbb76152eb3 Mon Sep 17 00:00:00 2001 From: brnls Date: Thu, 3 Dec 2015 09:19:21 -0800 Subject: [PATCH 289/389] Fix Observable Array sort/reverse return type --- knockout/knockout.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/knockout/knockout.d.ts b/knockout/knockout.d.ts index 8f5d6fef4..883ed43b7 100644 --- a/knockout/knockout.d.ts +++ b/knockout/knockout.d.ts @@ -30,9 +30,9 @@ interface KnockoutObservableArrayFunctions { push(...items: T[]): void; shift(): T; unshift(...items: T[]): number; - reverse(): T[]; - sort(): void; - sort(compareFunction: (left: T, right: T) => number): void; + reverse(): KnockoutObservableArray; + sort(): KnockoutObservableArray; + sort(compareFunction: (left: T, right: T) => number): KnockoutObservableArray; // Ko specific [key: string]: KnockoutBindingHandler; From 7fb9bf8417f91f68c896eae9a2351493e9122aeb Mon Sep 17 00:00:00 2001 From: Deividas Bakanas Date: Thu, 3 Dec 2015 19:24:06 +0200 Subject: [PATCH 290/389] google-maps definitions added --- google-maps/google-maps.d.ts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 google-maps/google-maps.d.ts diff --git a/google-maps/google-maps.d.ts b/google-maps/google-maps.d.ts new file mode 100644 index 000000000..753aa4f49 --- /dev/null +++ b/google-maps/google-maps.d.ts @@ -0,0 +1,26 @@ +// Type definitions for google-maps 3.1.0 +// Project: https://www.npmjs.com/package/google-maps +// Definitions by: Deividas Bakanas , Giedrius Grabauskas +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace GoogleMapsLoader { + interface CallBack { + (google: { maps: { Map: google.maps.Map } }): void; + } + export var KEY: string; + export var CLIENT: string; + export var VERSION: string; + export var SENSO: boolean; + export var LIBRARIES: Array; + export var LANGUAGE: string; + export function release(callBack: Function): void; + export function onLoad(callBack?: CallBack): void; + export function load(callBack?: CallBack): void; + export function isLoaded(): boolean; + +} +declare module 'google-maps' { + export = GoogleMapsLoader; +} From f3dcb689eaf3fc8f903051766cdc0791e97c5783 Mon Sep 17 00:00:00 2001 From: Deividas Bakanas Date: Thu, 3 Dec 2015 19:30:27 +0200 Subject: [PATCH 291/389] Created google-maps-tests file. --- google-maps/google-maps-tests.ts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 google-maps/google-maps-tests.ts diff --git a/google-maps/google-maps-tests.ts b/google-maps/google-maps-tests.ts new file mode 100644 index 000000000..2256b254b --- /dev/null +++ b/google-maps/google-maps-tests.ts @@ -0,0 +1,26 @@ +/// + +var GoogleMapsLoader = require('google-maps'); + +GoogleMapsLoader.load(function(google) { + new google.maps.Map(el, options); +}); + +GoogleMapsLoader.KEY = 'qwertyuiopasdfghjklzxcvbnm'; + +GoogleMapsLoader.CLIENT = 'yourclientkey'; +GoogleMapsLoader.VERSION = '3.14'; + +GoogleMapsLoader.SENSOR = true + +GoogleMapsLoader.LIBRARIES = ['geometry', 'places']; + +GoogleMapsLoader.LANGUAGE = 'fr'; + +GoogleMapsLoader.release(function() { + console.log('No google maps api around'); +}); + +GoogleMapsLoader.onLoad(function(google) { + console.log('I just loaded google maps api'); +}); From 64dc5896a52b88fbff3b793e3c71236f1692ed35 Mon Sep 17 00:00:00 2001 From: Deividas Bakanas Date: Thu, 3 Dec 2015 19:31:49 +0200 Subject: [PATCH 292/389] Edited authors links. --- google-maps/google-maps.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google-maps/google-maps.d.ts b/google-maps/google-maps.d.ts index 753aa4f49..6c528c6ef 100644 --- a/google-maps/google-maps.d.ts +++ b/google-maps/google-maps.d.ts @@ -1,6 +1,6 @@ // Type definitions for google-maps 3.1.0 // Project: https://www.npmjs.com/package/google-maps -// Definitions by: Deividas Bakanas , Giedrius Grabauskas +// Definitions by: Deividas Bakanas , Giedrius Grabauskas // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// From 50170b0b7a64cfc655177a953e71210d7f8c13c1 Mon Sep 17 00:00:00 2001 From: Deividas Bakanas Date: Thu, 3 Dec 2015 19:36:53 +0200 Subject: [PATCH 293/389] Fixed import. --- google-maps/google-maps-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google-maps/google-maps-tests.ts b/google-maps/google-maps-tests.ts index 2256b254b..16f917b40 100644 --- a/google-maps/google-maps-tests.ts +++ b/google-maps/google-maps-tests.ts @@ -1,6 +1,6 @@ /// -var GoogleMapsLoader = require('google-maps'); +import GoogleMapsLoader = require('google-maps'); GoogleMapsLoader.load(function(google) { new google.maps.Map(el, options); From 91f11851435d731dc7e5524b32d0064d21fa90d9 Mon Sep 17 00:00:00 2001 From: Deividas Bakanas Date: Thu, 3 Dec 2015 19:39:56 +0200 Subject: [PATCH 294/389] Fixed tests. --- google-maps/google-maps-tests.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/google-maps/google-maps-tests.ts b/google-maps/google-maps-tests.ts index 16f917b40..50f848936 100644 --- a/google-maps/google-maps-tests.ts +++ b/google-maps/google-maps-tests.ts @@ -3,7 +3,7 @@ import GoogleMapsLoader = require('google-maps'); GoogleMapsLoader.load(function(google) { - new google.maps.Map(el, options); + var loadedMap = google.maps.Map; }); GoogleMapsLoader.KEY = 'qwertyuiopasdfghjklzxcvbnm'; @@ -11,7 +11,7 @@ GoogleMapsLoader.KEY = 'qwertyuiopasdfghjklzxcvbnm'; GoogleMapsLoader.CLIENT = 'yourclientkey'; GoogleMapsLoader.VERSION = '3.14'; -GoogleMapsLoader.SENSOR = true +GoogleMapsLoader.SENSOR = true; GoogleMapsLoader.LIBRARIES = ['geometry', 'places']; @@ -22,5 +22,6 @@ GoogleMapsLoader.release(function() { }); GoogleMapsLoader.onLoad(function(google) { + var loadedMap = google.maps.Map; console.log('I just loaded google maps api'); }); From c21a2d49821b1a7d882b85e72255cdcf1532d1a3 Mon Sep 17 00:00:00 2001 From: Deividas Bakanas Date: Thu, 3 Dec 2015 19:40:25 +0200 Subject: [PATCH 295/389] Fixed definition mistype. --- google-maps/google-maps.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google-maps/google-maps.d.ts b/google-maps/google-maps.d.ts index 6c528c6ef..edc37822c 100644 --- a/google-maps/google-maps.d.ts +++ b/google-maps/google-maps.d.ts @@ -12,7 +12,7 @@ declare namespace GoogleMapsLoader { export var KEY: string; export var CLIENT: string; export var VERSION: string; - export var SENSO: boolean; + export var SENSOR: boolean; export var LIBRARIES: Array; export var LANGUAGE: string; export function release(callBack: Function): void; From 5ff03e2f4153ba30e5418e7dcd6200fa81a108b6 Mon Sep 17 00:00:00 2001 From: James O'Cull Date: Thu, 3 Dec 2015 14:30:10 -0500 Subject: [PATCH 296/389] Changes to unify transaction support across various interfaces, especially association mixins --- sequelize/sequelize.d.ts | 166 ++++++++++++++------------------------- 1 file changed, 58 insertions(+), 108 deletions(-) diff --git a/sequelize/sequelize.d.ts b/sequelize/sequelize.d.ts index 46a0ba41a..74f682e27 100644 --- a/sequelize/sequelize.d.ts +++ b/sequelize/sequelize.d.ts @@ -19,13 +19,12 @@ declare module "sequelize" { // // https://github.com/sequelize/sequelize/tree/v3.4.1/lib/associations // - - + /** * The options for the getAssociation mixin of the belongsTo association. * @see BelongsToGetAssociationMixin */ - interface BelongsToGetAssociationMixinOptions { + interface BelongsToGetAssociationMixinOptions extends Transactable { /** * Apply a scope on the related model, or remove its default scope by passing false. */ @@ -62,7 +61,7 @@ declare module "sequelize" { * The options for the setAssociation mixin of the belongsTo association. * @see BelongsToSetAssociationMixin */ - interface BelongsToSetAssociationMixinOptions { + interface BelongsToSetAssociationMixinOptions extends Transactable { /** * Skip saving this after setting the foreign key if false. */ @@ -103,7 +102,7 @@ declare module "sequelize" { * The options for the createAssociation mixin of the belongsTo association. * @see BelongsToCreateAssociationMixin */ - interface BelongsToCreateAssociationMixinOptions { } + interface BelongsToCreateAssociationMixinOptions extends Transactable { } /** * The createAssociation mixin applied to models with belongsTo. @@ -139,7 +138,7 @@ declare module "sequelize" { * The options for the getAssociation mixin of the hasOne association. * @see HasOneGetAssociationMixin */ - interface HasOneGetAssociationMixinOptions { + interface HasOneGetAssociationMixinOptions extends Transactable { /** * Apply a scope on the related model, or remove its default scope by passing false. */ @@ -176,7 +175,7 @@ declare module "sequelize" { * The options for the setAssociation mixin of the hasOne association. * @see HasOneSetAssociationMixin */ - interface HasOneSetAssociationMixinOptions { + interface HasOneSetAssociationMixinOptions extends Transactable { /** * Skip saving this after setting the foreign key if false. */ @@ -217,7 +216,7 @@ declare module "sequelize" { * The options for the createAssociation mixin of the hasOne association. * @see HasOneCreateAssociationMixin */ - interface HasOneCreateAssociationMixinOptions { } + interface HasOneCreateAssociationMixinOptions extends Transactable { } /** * The createAssociation mixin applied to models with hasOne. @@ -253,7 +252,7 @@ declare module "sequelize" { * The options for the getAssociations mixin of the hasMany association. * @see HasManyGetAssociationsMixin */ - interface HasManyGetAssociationsMixinOptions { + interface HasManyGetAssociationsMixinOptions extends Transactable { /** * An optional where clause to limit the associated models. @@ -303,7 +302,7 @@ declare module "sequelize" { * The options for the setAssociations mixin of the hasMany association. * @see HasManySetAssociationsMixin */ - interface HasManySetAssociationsMixinOptions { + interface HasManySetAssociationsMixinOptions extends Transactable { /** * Run validation for the join model. @@ -353,7 +352,7 @@ declare module "sequelize" { * The options for the addAssociations mixin of the hasMany association. * @see HasManyAddAssociationsMixin */ - interface HasManyAddAssociationsMixinOptions { + interface HasManyAddAssociationsMixinOptions extends Transactable { /** * Run validation for the join model. @@ -402,7 +401,7 @@ declare module "sequelize" { * The options for the addAssociation mixin of the hasMany association. * @see HasManyAddAssociationMixin */ - interface HasManyAddAssociationMixinOptions { + interface HasManyAddAssociationMixinOptions extends Transactable { /** * Run validation for the join model. @@ -451,7 +450,7 @@ declare module "sequelize" { * The options for the createAssociation mixin of the hasMany association. * @see HasManyCreateAssociationMixin */ - interface HasManyCreateAssociationMixinOptions { } + interface HasManyCreateAssociationMixinOptions extends Transactable { } /** * The createAssociation mixin applied to models with hasMany. @@ -494,7 +493,7 @@ declare module "sequelize" { * The options for the removeAssociation mixin of the hasMany association. * @see HasManyRemoveAssociationMixin */ - interface HasManyRemoveAssociationMixinOptions { } + interface HasManyRemoveAssociationMixinOptions extends Transactable { } /** * The removeAssociation mixin applied to models with hasMany. @@ -537,7 +536,7 @@ declare module "sequelize" { * The options for the removeAssociations mixin of the hasMany association. * @see HasManyRemoveAssociationsMixin */ - interface HasManyRemoveAssociationsMixinOptions { } + interface HasManyRemoveAssociationsMixinOptions extends Transactable { } /** * The removeAssociations mixin applied to models with hasMany. @@ -580,7 +579,7 @@ declare module "sequelize" { * The options for the hasAssociation mixin of the hasMany association. * @see HasManyHasAssociationMixin */ - interface HasManyHasAssociationMixinOptions { } + interface HasManyHasAssociationMixinOptions extends Transactable { } /** * The hasAssociation mixin applied to models with hasMany. @@ -623,7 +622,7 @@ declare module "sequelize" { * The options for the hasAssociations mixin of the hasMany association. * @see HasManyHasAssociationsMixin */ - interface HasManyHasAssociationsMixinOptions { } + interface HasManyHasAssociationsMixinOptions extends Transactable { } /** * The removeAssociations mixin applied to models with hasMany. @@ -666,7 +665,7 @@ declare module "sequelize" { * The options for the countAssociations mixin of the hasMany association. * @see HasManyCountAssociationsMixin */ - interface HasManyCountAssociationsMixinOptions { + interface HasManyCountAssociationsMixinOptions extends Transactable { /** * An optional where clause to limit the associated models. @@ -716,7 +715,7 @@ declare module "sequelize" { * The options for the getAssociations mixin of the belongsToMany association. * @see BelongsToManyGetAssociationsMixin */ - interface BelongsToManyGetAssociationsMixinOptions { + interface BelongsToManyGetAssociationsMixinOptions extends Transactable { /** * An optional where clause to limit the associated models. @@ -766,7 +765,7 @@ declare module "sequelize" { * The options for the setAssociations mixin of the belongsToMany association. * @see BelongsToManySetAssociationsMixin */ - interface BelongsToManySetAssociationsMixinOptions { + interface BelongsToManySetAssociationsMixinOptions extends Transactable { /** * Run validation for the join model. @@ -816,7 +815,7 @@ declare module "sequelize" { * The options for the addAssociations mixin of the belongsToMany association. * @see BelongsToManyAddAssociationsMixin */ - interface BelongsToManyAddAssociationsMixinOptions { + interface BelongsToManyAddAssociationsMixinOptions extends Transactable { /** * Run validation for the join model. @@ -865,7 +864,7 @@ declare module "sequelize" { * The options for the addAssociation mixin of the belongsToMany association. * @see BelongsToManyAddAssociationMixin */ - interface BelongsToManyAddAssociationMixinOptions { + interface BelongsToManyAddAssociationMixinOptions extends Transactable { /** * Run validation for the join model. @@ -914,7 +913,7 @@ declare module "sequelize" { * The options for the createAssociation mixin of the belongsToMany association. * @see BelongsToManyCreateAssociationMixin */ - interface BelongsToManyCreateAssociationMixinOptions { } + interface BelongsToManyCreateAssociationMixinOptions extends Transactable { } /** * The createAssociation mixin applied to models with belongsToMany. @@ -957,7 +956,7 @@ declare module "sequelize" { * The options for the removeAssociation mixin of the belongsToMany association. * @see BelongsToManyRemoveAssociationMixin */ - interface BelongsToManyRemoveAssociationMixinOptions { } + interface BelongsToManyRemoveAssociationMixinOptions extends Transactable { } /** * The removeAssociation mixin applied to models with belongsToMany. @@ -1000,7 +999,7 @@ declare module "sequelize" { * The options for the removeAssociations mixin of the belongsToMany association. * @see BelongsToManyRemoveAssociationsMixin */ - interface BelongsToManyRemoveAssociationsMixinOptions { } + interface BelongsToManyRemoveAssociationsMixinOptions extends Transactable { } /** * The removeAssociations mixin applied to models with belongsToMany. @@ -1043,7 +1042,7 @@ declare module "sequelize" { * The options for the hasAssociation mixin of the belongsToMany association. * @see BelongsToManyHasAssociationMixin */ - interface BelongsToManyHasAssociationMixinOptions { } + interface BelongsToManyHasAssociationMixinOptions extends Transactable { } /** * The hasAssociation mixin applied to models with belongsToMany. @@ -1086,7 +1085,7 @@ declare module "sequelize" { * The options for the hasAssociations mixin of the belongsToMany association. * @see BelongsToManyHasAssociationsMixin */ - interface BelongsToManyHasAssociationsMixinOptions { } + interface BelongsToManyHasAssociationsMixinOptions extends Transactable { } /** * The removeAssociations mixin applied to models with belongsToMany. @@ -1129,7 +1128,7 @@ declare module "sequelize" { * The options for the countAssociations mixin of the belongsToMany association. * @see BelongsToManyCountAssociationsMixin */ - interface BelongsToManyCountAssociationsMixinOptions { + interface BelongsToManyCountAssociationsMixinOptions extends Transactable { /** * An optional where clause to limit the associated models. @@ -2538,7 +2537,7 @@ declare module "sequelize" { /** * Options used for Instance.increment method */ - interface InstanceIncrementDecrementOptions { + interface InstanceIncrementDecrementOptions extends Transactable { /** * The number to increment by @@ -2552,39 +2551,29 @@ declare module "sequelize" { */ logging? : boolean | Function; - /** - * Transaction to run query under - */ - transaction? : Transaction; - /** * A hash of attributes to describe your search. See above for examples. */ where? : WhereOptions | Array; - + } /** * Options used for Instance.restore method */ - interface InstanceRestoreOptions { + interface InstanceRestoreOptions extends Transactable { /** * A function that gets executed while running the query to log the sql. */ logging? : boolean | Function; - - /** - * Transaction to run query under - */ - transaction? : Transaction; - + } /** * Options used for Instance.destroy method */ - interface InstanceDestroyOptions { + interface InstanceDestroyOptions extends Transactable { /** * If set to true, paranoid models will actually be deleted @@ -2595,12 +2584,7 @@ declare module "sequelize" { * A function that gets executed while running the query to log the sql. */ logging? : boolean | Function; - - /** - * Transaction to run the query in - */ - transaction? : Transaction; - + } /** @@ -2635,7 +2619,7 @@ declare module "sequelize" { /** * Options used for Instance.save method */ - interface InstanceSaveOptions { + interface InstanceSaveOptions extends Transactable { /** * An optional array of strings, representing database columns. If fields is provided, only those columns @@ -2661,12 +2645,7 @@ declare module "sequelize" { * A function that gets executed while running the query to log the sql. */ logging? : boolean | Function; - - /** - * Transaction to run the query in - */ - transaction? : Transaction; - + } /** @@ -3091,7 +3070,7 @@ declare module "sequelize" { * * A hash of options to describe the scope of the search */ - interface FindOptions { + interface FindOptions extends Transactable { /** * A hash of attributes to describe your search. See above for examples. @@ -3138,11 +3117,6 @@ declare module "sequelize" { */ offset?: number; - /** - * Transaction to run query under - */ - transaction? : Transaction; - /** * Lock the selected rows. Possible options are transaction.LOCK.UPDATE and transaction.LOCK.SHARE. * Postgres also supports transaction.LOCK.KEY_SHARE, transaction.LOCK.NO_KEY_UPDATE and specific model @@ -3170,7 +3144,7 @@ declare module "sequelize" { /** * Options for Model.count method */ - interface CountOptions { + interface CountOptions extends Transactable { /** * A hash of search attributes. @@ -3203,8 +3177,7 @@ declare module "sequelize" { * A function that gets executed while running the query to log the sql. */ logging? : boolean | Function; - - transaction?: Transaction; + } /** @@ -3234,7 +3207,7 @@ declare module "sequelize" { /** * Options for Model.create method */ - interface CreateOptions extends BuildOptions { + interface CreateOptions extends BuildOptions, Transactable { /** * If set, only columns matching those in fields will be saved @@ -3246,11 +3219,6 @@ declare module "sequelize" { */ onDuplicate? : string; - /** - * Transaction to run query under - */ - transaction? : Transaction; - /** * A function that gets executed while running the query to log the sql. */ @@ -3259,12 +3227,13 @@ declare module "sequelize" { silent? : boolean; returning? : boolean; + } /** * Options for Model.findOrInitialize method */ - interface FindOrInitializeOptions { + interface FindOrInitializeOptions extends Transactable { /** * A hash of search attributes. @@ -3276,11 +3245,6 @@ declare module "sequelize" { */ defaults? : TAttributes; - /** - * Transaction to run query under - */ - transaction? : Transaction; - /** * A function that gets executed while running the query to log the sql. */ @@ -3313,7 +3277,7 @@ declare module "sequelize" { /** * Options for Model.bulkCreate method */ - interface BulkCreateOptions { + interface BulkCreateOptions extends Transactable { /** * Fields to insert (defaults to all fields) @@ -3350,11 +3314,6 @@ declare module "sequelize" { */ updateOnDuplicate? : Array; - /** - * Transaction to run query under - */ - transaction? : Transaction; - /** * A function that gets executed while running the query to log the sql. */ @@ -3365,12 +3324,7 @@ declare module "sequelize" { /** * The options passed to Model.destroy in addition to truncate */ - interface TruncateOptions { - - /** - * Transaction to run query under - */ - transaction? : Transaction; + interface TruncateOptions extends Transactable { /** * Only used in conjuction with TRUNCATE. Truncates all tables that have foreign-key references to the @@ -3429,7 +3383,7 @@ declare module "sequelize" { /** * Options for Model.restore */ - interface RestoreOptions { + interface RestoreOptions extends Transactable { /** * Filter the restore @@ -3457,17 +3411,12 @@ declare module "sequelize" { */ logging? : boolean | Function; - /** - * Transaction to run query under - */ - transaction? : Transaction; - } /** * Options used for Model.update */ - interface UpdateOptions { + interface UpdateOptions extends Transactable { /** * Options to describe the scope of the search. @@ -3524,11 +3473,6 @@ declare module "sequelize" { */ logging? : boolean | Function; - /** - * Transaction to run query under - */ - transaction? : Transaction; - } /** @@ -4422,7 +4366,7 @@ declare module "sequelize" { * * @see Options */ - interface QueryOptions { + interface QueryOptions extends Transactable { /** * If true, sequelize will not try to format the results of the query, or build an instance of a model from @@ -4430,11 +4374,6 @@ declare module "sequelize" { */ raw?: boolean; - /** - * The transaction that the query should be executed under - */ - transaction?: Transaction; - /** * The type of query you are executing. The query type affects how results are formatted before they are * passed back. The type is a string, but `Sequelize.QueryTypes` is provided as convenience shortcuts. @@ -5838,7 +5777,18 @@ declare module "sequelize" { * A function that gets executed while running the query to log the sql. */ logging?: Function; - + } + + /** + * An interface that allows an item to support working under a transaction + * + * @param transaction Transaction The optional transaction to run under + */ + interface Transactable { + /** + * Transaction to run query under + */ + transaction?: Transaction; } // From 4f0c326e4553fc4b96d9560717e28473817699bb Mon Sep 17 00:00:00 2001 From: Vinh Tran Date: Thu, 3 Dec 2015 14:35:42 -0500 Subject: [PATCH 297/389] Update search request optional fields Update PlaceSearchRequest, RadarSearchRequest, and TextSearchRequest interfaces to better reflect their optional fields. Reference: https://developers.google.com/maps/documentation/javascript/places --- googlemaps/google.maps.d.ts | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/googlemaps/google.maps.d.ts b/googlemaps/google.maps.d.ts index 3ac35b048..770151f33 100644 --- a/googlemaps/google.maps.d.ts +++ b/googlemaps/google.maps.d.ts @@ -1917,16 +1917,16 @@ declare module google.maps { } export interface PlaceSearchRequest { - bounds: LatLngBounds; - keyword: string; - location: LatLng|LatLngLiteral; + bounds?: LatLngBounds; + keyword?: string; + location?: LatLng|LatLngLiteral; maxPriceLevel?: number; minPriceLevel?: number; - name: string; - openNow: boolean; - radius: number; - rankBy: RankBy; - types: string[]; + name?: string; + openNow?: boolean; + radius?: number; + rankBy?: RankBy; + types?: string[]; } export class PlacesService { @@ -1963,11 +1963,11 @@ declare module google.maps { export interface RadarSearchRequest { bounds?: LatLngBounds; - keyword: string; - location: LatLng|LatLngLiteral; - name: string; - radius: number; - types: string[]; + keyword?: string; + location?: LatLng|LatLngLiteral; + name?: string; + radius?: number; + types?: string[]; } export enum RankBy { @@ -1988,10 +1988,10 @@ declare module google.maps { export interface TextSearchRequest { bounds?: LatLngBounds; - location: LatLng|LatLngLiteral; + location?: LatLng|LatLngLiteral; query: string; - radius: number; - types: string[]; + radius?: number; + types?: string[]; } } From 2e5439d881f3e744175633c21c26a656fbc66763 Mon Sep 17 00:00:00 2001 From: James O'Cull Date: Thu, 3 Dec 2015 17:29:21 -0500 Subject: [PATCH 298/389] Revert "Changes to unify transaction support across various interfaces, especially association mixins" This reverts commit 5ff03e2f4153ba30e5418e7dcd6200fa81a108b6. --- sequelize/sequelize.d.ts | 166 +++++++++++++++++++++++++-------------- 1 file changed, 108 insertions(+), 58 deletions(-) diff --git a/sequelize/sequelize.d.ts b/sequelize/sequelize.d.ts index 74f682e27..46a0ba41a 100644 --- a/sequelize/sequelize.d.ts +++ b/sequelize/sequelize.d.ts @@ -19,12 +19,13 @@ declare module "sequelize" { // // https://github.com/sequelize/sequelize/tree/v3.4.1/lib/associations // - + + /** * The options for the getAssociation mixin of the belongsTo association. * @see BelongsToGetAssociationMixin */ - interface BelongsToGetAssociationMixinOptions extends Transactable { + interface BelongsToGetAssociationMixinOptions { /** * Apply a scope on the related model, or remove its default scope by passing false. */ @@ -61,7 +62,7 @@ declare module "sequelize" { * The options for the setAssociation mixin of the belongsTo association. * @see BelongsToSetAssociationMixin */ - interface BelongsToSetAssociationMixinOptions extends Transactable { + interface BelongsToSetAssociationMixinOptions { /** * Skip saving this after setting the foreign key if false. */ @@ -102,7 +103,7 @@ declare module "sequelize" { * The options for the createAssociation mixin of the belongsTo association. * @see BelongsToCreateAssociationMixin */ - interface BelongsToCreateAssociationMixinOptions extends Transactable { } + interface BelongsToCreateAssociationMixinOptions { } /** * The createAssociation mixin applied to models with belongsTo. @@ -138,7 +139,7 @@ declare module "sequelize" { * The options for the getAssociation mixin of the hasOne association. * @see HasOneGetAssociationMixin */ - interface HasOneGetAssociationMixinOptions extends Transactable { + interface HasOneGetAssociationMixinOptions { /** * Apply a scope on the related model, or remove its default scope by passing false. */ @@ -175,7 +176,7 @@ declare module "sequelize" { * The options for the setAssociation mixin of the hasOne association. * @see HasOneSetAssociationMixin */ - interface HasOneSetAssociationMixinOptions extends Transactable { + interface HasOneSetAssociationMixinOptions { /** * Skip saving this after setting the foreign key if false. */ @@ -216,7 +217,7 @@ declare module "sequelize" { * The options for the createAssociation mixin of the hasOne association. * @see HasOneCreateAssociationMixin */ - interface HasOneCreateAssociationMixinOptions extends Transactable { } + interface HasOneCreateAssociationMixinOptions { } /** * The createAssociation mixin applied to models with hasOne. @@ -252,7 +253,7 @@ declare module "sequelize" { * The options for the getAssociations mixin of the hasMany association. * @see HasManyGetAssociationsMixin */ - interface HasManyGetAssociationsMixinOptions extends Transactable { + interface HasManyGetAssociationsMixinOptions { /** * An optional where clause to limit the associated models. @@ -302,7 +303,7 @@ declare module "sequelize" { * The options for the setAssociations mixin of the hasMany association. * @see HasManySetAssociationsMixin */ - interface HasManySetAssociationsMixinOptions extends Transactable { + interface HasManySetAssociationsMixinOptions { /** * Run validation for the join model. @@ -352,7 +353,7 @@ declare module "sequelize" { * The options for the addAssociations mixin of the hasMany association. * @see HasManyAddAssociationsMixin */ - interface HasManyAddAssociationsMixinOptions extends Transactable { + interface HasManyAddAssociationsMixinOptions { /** * Run validation for the join model. @@ -401,7 +402,7 @@ declare module "sequelize" { * The options for the addAssociation mixin of the hasMany association. * @see HasManyAddAssociationMixin */ - interface HasManyAddAssociationMixinOptions extends Transactable { + interface HasManyAddAssociationMixinOptions { /** * Run validation for the join model. @@ -450,7 +451,7 @@ declare module "sequelize" { * The options for the createAssociation mixin of the hasMany association. * @see HasManyCreateAssociationMixin */ - interface HasManyCreateAssociationMixinOptions extends Transactable { } + interface HasManyCreateAssociationMixinOptions { } /** * The createAssociation mixin applied to models with hasMany. @@ -493,7 +494,7 @@ declare module "sequelize" { * The options for the removeAssociation mixin of the hasMany association. * @see HasManyRemoveAssociationMixin */ - interface HasManyRemoveAssociationMixinOptions extends Transactable { } + interface HasManyRemoveAssociationMixinOptions { } /** * The removeAssociation mixin applied to models with hasMany. @@ -536,7 +537,7 @@ declare module "sequelize" { * The options for the removeAssociations mixin of the hasMany association. * @see HasManyRemoveAssociationsMixin */ - interface HasManyRemoveAssociationsMixinOptions extends Transactable { } + interface HasManyRemoveAssociationsMixinOptions { } /** * The removeAssociations mixin applied to models with hasMany. @@ -579,7 +580,7 @@ declare module "sequelize" { * The options for the hasAssociation mixin of the hasMany association. * @see HasManyHasAssociationMixin */ - interface HasManyHasAssociationMixinOptions extends Transactable { } + interface HasManyHasAssociationMixinOptions { } /** * The hasAssociation mixin applied to models with hasMany. @@ -622,7 +623,7 @@ declare module "sequelize" { * The options for the hasAssociations mixin of the hasMany association. * @see HasManyHasAssociationsMixin */ - interface HasManyHasAssociationsMixinOptions extends Transactable { } + interface HasManyHasAssociationsMixinOptions { } /** * The removeAssociations mixin applied to models with hasMany. @@ -665,7 +666,7 @@ declare module "sequelize" { * The options for the countAssociations mixin of the hasMany association. * @see HasManyCountAssociationsMixin */ - interface HasManyCountAssociationsMixinOptions extends Transactable { + interface HasManyCountAssociationsMixinOptions { /** * An optional where clause to limit the associated models. @@ -715,7 +716,7 @@ declare module "sequelize" { * The options for the getAssociations mixin of the belongsToMany association. * @see BelongsToManyGetAssociationsMixin */ - interface BelongsToManyGetAssociationsMixinOptions extends Transactable { + interface BelongsToManyGetAssociationsMixinOptions { /** * An optional where clause to limit the associated models. @@ -765,7 +766,7 @@ declare module "sequelize" { * The options for the setAssociations mixin of the belongsToMany association. * @see BelongsToManySetAssociationsMixin */ - interface BelongsToManySetAssociationsMixinOptions extends Transactable { + interface BelongsToManySetAssociationsMixinOptions { /** * Run validation for the join model. @@ -815,7 +816,7 @@ declare module "sequelize" { * The options for the addAssociations mixin of the belongsToMany association. * @see BelongsToManyAddAssociationsMixin */ - interface BelongsToManyAddAssociationsMixinOptions extends Transactable { + interface BelongsToManyAddAssociationsMixinOptions { /** * Run validation for the join model. @@ -864,7 +865,7 @@ declare module "sequelize" { * The options for the addAssociation mixin of the belongsToMany association. * @see BelongsToManyAddAssociationMixin */ - interface BelongsToManyAddAssociationMixinOptions extends Transactable { + interface BelongsToManyAddAssociationMixinOptions { /** * Run validation for the join model. @@ -913,7 +914,7 @@ declare module "sequelize" { * The options for the createAssociation mixin of the belongsToMany association. * @see BelongsToManyCreateAssociationMixin */ - interface BelongsToManyCreateAssociationMixinOptions extends Transactable { } + interface BelongsToManyCreateAssociationMixinOptions { } /** * The createAssociation mixin applied to models with belongsToMany. @@ -956,7 +957,7 @@ declare module "sequelize" { * The options for the removeAssociation mixin of the belongsToMany association. * @see BelongsToManyRemoveAssociationMixin */ - interface BelongsToManyRemoveAssociationMixinOptions extends Transactable { } + interface BelongsToManyRemoveAssociationMixinOptions { } /** * The removeAssociation mixin applied to models with belongsToMany. @@ -999,7 +1000,7 @@ declare module "sequelize" { * The options for the removeAssociations mixin of the belongsToMany association. * @see BelongsToManyRemoveAssociationsMixin */ - interface BelongsToManyRemoveAssociationsMixinOptions extends Transactable { } + interface BelongsToManyRemoveAssociationsMixinOptions { } /** * The removeAssociations mixin applied to models with belongsToMany. @@ -1042,7 +1043,7 @@ declare module "sequelize" { * The options for the hasAssociation mixin of the belongsToMany association. * @see BelongsToManyHasAssociationMixin */ - interface BelongsToManyHasAssociationMixinOptions extends Transactable { } + interface BelongsToManyHasAssociationMixinOptions { } /** * The hasAssociation mixin applied to models with belongsToMany. @@ -1085,7 +1086,7 @@ declare module "sequelize" { * The options for the hasAssociations mixin of the belongsToMany association. * @see BelongsToManyHasAssociationsMixin */ - interface BelongsToManyHasAssociationsMixinOptions extends Transactable { } + interface BelongsToManyHasAssociationsMixinOptions { } /** * The removeAssociations mixin applied to models with belongsToMany. @@ -1128,7 +1129,7 @@ declare module "sequelize" { * The options for the countAssociations mixin of the belongsToMany association. * @see BelongsToManyCountAssociationsMixin */ - interface BelongsToManyCountAssociationsMixinOptions extends Transactable { + interface BelongsToManyCountAssociationsMixinOptions { /** * An optional where clause to limit the associated models. @@ -2537,7 +2538,7 @@ declare module "sequelize" { /** * Options used for Instance.increment method */ - interface InstanceIncrementDecrementOptions extends Transactable { + interface InstanceIncrementDecrementOptions { /** * The number to increment by @@ -2551,29 +2552,39 @@ declare module "sequelize" { */ logging? : boolean | Function; + /** + * Transaction to run query under + */ + transaction? : Transaction; + /** * A hash of attributes to describe your search. See above for examples. */ where? : WhereOptions | Array; - + } /** * Options used for Instance.restore method */ - interface InstanceRestoreOptions extends Transactable { + interface InstanceRestoreOptions { /** * A function that gets executed while running the query to log the sql. */ logging? : boolean | Function; - + + /** + * Transaction to run query under + */ + transaction? : Transaction; + } /** * Options used for Instance.destroy method */ - interface InstanceDestroyOptions extends Transactable { + interface InstanceDestroyOptions { /** * If set to true, paranoid models will actually be deleted @@ -2584,7 +2595,12 @@ declare module "sequelize" { * A function that gets executed while running the query to log the sql. */ logging? : boolean | Function; - + + /** + * Transaction to run the query in + */ + transaction? : Transaction; + } /** @@ -2619,7 +2635,7 @@ declare module "sequelize" { /** * Options used for Instance.save method */ - interface InstanceSaveOptions extends Transactable { + interface InstanceSaveOptions { /** * An optional array of strings, representing database columns. If fields is provided, only those columns @@ -2645,7 +2661,12 @@ declare module "sequelize" { * A function that gets executed while running the query to log the sql. */ logging? : boolean | Function; - + + /** + * Transaction to run the query in + */ + transaction? : Transaction; + } /** @@ -3070,7 +3091,7 @@ declare module "sequelize" { * * A hash of options to describe the scope of the search */ - interface FindOptions extends Transactable { + interface FindOptions { /** * A hash of attributes to describe your search. See above for examples. @@ -3117,6 +3138,11 @@ declare module "sequelize" { */ offset?: number; + /** + * Transaction to run query under + */ + transaction? : Transaction; + /** * Lock the selected rows. Possible options are transaction.LOCK.UPDATE and transaction.LOCK.SHARE. * Postgres also supports transaction.LOCK.KEY_SHARE, transaction.LOCK.NO_KEY_UPDATE and specific model @@ -3144,7 +3170,7 @@ declare module "sequelize" { /** * Options for Model.count method */ - interface CountOptions extends Transactable { + interface CountOptions { /** * A hash of search attributes. @@ -3177,7 +3203,8 @@ declare module "sequelize" { * A function that gets executed while running the query to log the sql. */ logging? : boolean | Function; - + + transaction?: Transaction; } /** @@ -3207,7 +3234,7 @@ declare module "sequelize" { /** * Options for Model.create method */ - interface CreateOptions extends BuildOptions, Transactable { + interface CreateOptions extends BuildOptions { /** * If set, only columns matching those in fields will be saved @@ -3219,6 +3246,11 @@ declare module "sequelize" { */ onDuplicate? : string; + /** + * Transaction to run query under + */ + transaction? : Transaction; + /** * A function that gets executed while running the query to log the sql. */ @@ -3227,13 +3259,12 @@ declare module "sequelize" { silent? : boolean; returning? : boolean; - } /** * Options for Model.findOrInitialize method */ - interface FindOrInitializeOptions extends Transactable { + interface FindOrInitializeOptions { /** * A hash of search attributes. @@ -3245,6 +3276,11 @@ declare module "sequelize" { */ defaults? : TAttributes; + /** + * Transaction to run query under + */ + transaction? : Transaction; + /** * A function that gets executed while running the query to log the sql. */ @@ -3277,7 +3313,7 @@ declare module "sequelize" { /** * Options for Model.bulkCreate method */ - interface BulkCreateOptions extends Transactable { + interface BulkCreateOptions { /** * Fields to insert (defaults to all fields) @@ -3314,6 +3350,11 @@ declare module "sequelize" { */ updateOnDuplicate? : Array; + /** + * Transaction to run query under + */ + transaction? : Transaction; + /** * A function that gets executed while running the query to log the sql. */ @@ -3324,7 +3365,12 @@ declare module "sequelize" { /** * The options passed to Model.destroy in addition to truncate */ - interface TruncateOptions extends Transactable { + interface TruncateOptions { + + /** + * Transaction to run query under + */ + transaction? : Transaction; /** * Only used in conjuction with TRUNCATE. Truncates all tables that have foreign-key references to the @@ -3383,7 +3429,7 @@ declare module "sequelize" { /** * Options for Model.restore */ - interface RestoreOptions extends Transactable { + interface RestoreOptions { /** * Filter the restore @@ -3411,12 +3457,17 @@ declare module "sequelize" { */ logging? : boolean | Function; + /** + * Transaction to run query under + */ + transaction? : Transaction; + } /** * Options used for Model.update */ - interface UpdateOptions extends Transactable { + interface UpdateOptions { /** * Options to describe the scope of the search. @@ -3473,6 +3524,11 @@ declare module "sequelize" { */ logging? : boolean | Function; + /** + * Transaction to run query under + */ + transaction? : Transaction; + } /** @@ -4366,7 +4422,7 @@ declare module "sequelize" { * * @see Options */ - interface QueryOptions extends Transactable { + interface QueryOptions { /** * If true, sequelize will not try to format the results of the query, or build an instance of a model from @@ -4374,6 +4430,11 @@ declare module "sequelize" { */ raw?: boolean; + /** + * The transaction that the query should be executed under + */ + transaction?: Transaction; + /** * The type of query you are executing. The query type affects how results are formatted before they are * passed back. The type is a string, but `Sequelize.QueryTypes` is provided as convenience shortcuts. @@ -5777,18 +5838,7 @@ declare module "sequelize" { * A function that gets executed while running the query to log the sql. */ logging?: Function; - } - - /** - * An interface that allows an item to support working under a transaction - * - * @param transaction Transaction The optional transaction to run under - */ - interface Transactable { - /** - * Transaction to run query under - */ - transaction?: Transaction; + } // From 3b74f5ae2ca561aea50be0cf7aec6723fa37c64a Mon Sep 17 00:00:00 2001 From: rhysd Date: Fri, 4 Dec 2015 09:57:43 +0900 Subject: [PATCH 299/389] github-electron: Add missing menu item option 'role' --- github-electron/github-electron-main-tests.ts | 35 ++++++++++++++++++- github-electron/github-electron.d.ts | 4 +++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/github-electron/github-electron-main-tests.ts b/github-electron/github-electron-main-tests.ts index bafbaa49f..a60e32611 100644 --- a/github-electron/github-electron-main-tests.ts +++ b/github-electron/github-electron-main-tests.ts @@ -125,7 +125,40 @@ var dockMenu = Menu.buildFromTemplate([ { label: 'Pro' } ] }, - { label: 'New Command...' } + { label: 'New Command...' }, + { + label: 'Edit', + submenu: [ + { + label: 'Undo', + accelerator: 'CmdOrCtrl+Z', + role: 'undo' + }, + { + label: 'Redo', + accelerator: 'Shift+CmdOrCtrl+Z', + role: 'redo' + }, + { + type: 'separator' + }, + { + label: 'Cut', + accelerator: 'CmdOrCtrl+X', + role: 'cut' + }, + { + label: 'Copy', + accelerator: 'CmdOrCtrl+C', + role: 'copy' + }, + { + label: 'Paste', + accelerator: 'CmdOrCtrl+V', + role: 'paste' + }, + ] + }, ]); app.dock.setMenu(dockMenu); diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts index d4ab0099f..679cc6700 100644 --- a/github-electron/github-electron.d.ts +++ b/github-electron/github-electron.d.ts @@ -880,6 +880,10 @@ declare module GitHubElectron { * a given menu. */ position?: string; + /** + * Define the action of the menu item, when specified the click property will be ignored + */ + role?: string; } class BrowserWindowProxy { From cb5206a8ac1c9a3ddfd126f5ecea6729b2361452 Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Thu, 3 Dec 2015 20:34:58 -0600 Subject: [PATCH 300/389] Add default_type --- mime/mime.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/mime/mime.d.ts b/mime/mime.d.ts index bfaa7a51f..1009f006c 100644 --- a/mime/mime.d.ts +++ b/mime/mime.d.ts @@ -16,4 +16,5 @@ declare module "mime" { } export var charsets: Charsets; + export var default_type: string; } From 37ee1fd3be5abea113a1a04ddfd4f269e642719d Mon Sep 17 00:00:00 2001 From: Sam Vloeberghs Date: Fri, 4 Dec 2015 09:31:31 +0100 Subject: [PATCH 301/389] progress --- foundation-sites/foundation-tests.ts | 115 +++++++++---------- foundation-sites/foundation.d.ts | 166 +++++++++++++-------------- foundation-sites/npm-debug.log | 45 ++++++++ 3 files changed, 185 insertions(+), 141 deletions(-) create mode 100644 foundation-sites/npm-debug.log diff --git a/foundation-sites/foundation-tests.ts b/foundation-sites/foundation-tests.ts index 54da9fb79..50f88559b 100644 --- a/foundation-sites/foundation-tests.ts +++ b/foundation-sites/foundation-tests.ts @@ -10,60 +10,6 @@ $(document).foundation(); $(document).foundation('method'); $(document).foundation(['method', 'method2']); - - Foundation.Abide.($('.selector')); - Foundation.Abide.($('.selector'), {}); -/* - Foundation.Accordion.($('.selector')); - Foundation.Accordion.($('.selector'), {}); - - Foundation.AccordionMenu.($('.selector')); - Foundation.AccordionMenu.($('.selector'), {}); - - Foundation.DrillDown.($('.selector')); - Foundation.DrillDown.($('.selector'), {}); - - Foundation.Dropdown.($('.selector')); - Foundation.Dropdown.($('.selector'), {}); - - Foundation.DropdownMenu.($('.selector')); - Foundation.DropdownMenu.($('.selector'), {}); - - Foundation.Equalizer.($('.selector')); - Foundation.Equalizer.($('.selector'), {}); - - Foundation.Interchange.($('.selector')); - Foundation.Interchange.($('.selector'), {}); - - Foundation.Magellan.($('.selector')); - Foundation.Magellan.($('.selector'), {}); - - Foundation.OffCanvas.($('.selector')); - Foundation.OffCanvas.($('.selector'), {}); - - Foundation.Orbit.($('.selector')); - Foundation.Orbit.($('.selector'), {}); - - Foundation.Reveal.($('.selector')); - Foundation.Reveal.($('.selector'), {}); - - Foundation.Slider.($('.selector')); - Foundation.Slider.($('.selector'), {}); - - Foundation.Sticky.($('.selector')); - Foundation.Sticky.($('.selector'), {}); - - Foundation.Tabs.($('.selector')); - Foundation.Tabs.($('.selector'), {}); - - Foundation.Toggler.($('.selector')); - Foundation.Toggler.($('.selector'), {}); - - Foundation.Tooltip.($('.selector')); - Foundation.Tooltip.($('.selector'), {}); - */ - -/* function pluginList() { 'use strict'; @@ -89,9 +35,62 @@ function pluginList() { ]; } -pluginList().forEach((value:String) => { - Foundation[value].($('.selector')); - Foundation[value].($('.selector'), {}); +pluginList().forEach((value:string) => { + Foundation[value]($('.selector')); + Foundation[value]($('.selector'), {}); }); -*/ +/* + Foundation.Abide($('.selector')); + Foundation.Abide($('.selector'), {}); + + Foundation.Accordion($('.selector')); + Foundation.Accordion($('.selector'), {}); + + Foundation.AccordionMenu($('.selector')); + Foundation.AccordionMenu($('.selector'), {}); + + Foundation.DrillDown($('.selector')); + Foundation.DrillDown($('.selector'), {}); + + Foundation.Dropdown($('.selector')); + Foundation.Dropdown($('.selector'), {}); + + Foundation.DropdownMenu($('.selector')); + Foundation.DropdownMenu($('.selector'), {}); + + Foundation.Equalizer($('.selector')); + Foundation.Equalizer($('.selector'), {}); + + Foundation.Interchange($('.selector')); + Foundation.Interchange($('.selector'), {}); + + Foundation.Magellan($('.selector')); + Foundation.Magellan($('.selector'), {}); + + Foundation.OffCanvas($('.selector')); + Foundation.OffCanvas($('.selector'), {}); + + Foundation.Orbit($('.selector')); + Foundation.Orbit($('.selector'), {}); + + Foundation.Reveal($('.selector')); + Foundation.Reveal($('.selector'), {}); + + Foundation.Slider($('.selector')); + Foundation.Slider($('.selector'), {}); + + Foundation.Sticky($('.selector')); + Foundation.Sticky($('.selector'), {}); + + Foundation.Tabs($('.selector')); + Foundation.Tabs($('.selector'), {}); + + Foundation.Toggler($('.selector')); + Foundation.Toggler($('.selector'), {}); + + Foundation.Tooltip($('.selector')); + Foundation.Tooltip($('.selector'), {}); + */ + + diff --git a/foundation-sites/foundation.d.ts b/foundation-sites/foundation.d.ts index 3ec7f344e..dbdb56446 100644 --- a/foundation-sites/foundation.d.ts +++ b/foundation-sites/foundation.d.ts @@ -5,7 +5,7 @@ /// -declare module Foundation { +declare module FoundationSites { // http://foundation.zurb.com/sites/docs/abide.html#javascript-reference interface Abide { @@ -16,7 +16,7 @@ declare module Foundation { validateInput(element:Object, form:Object): void; validateForm(element:Object): void; validateText(element:Object): boolean; - validateRadio(group:String): boolean; + validateRadio(group:string): boolean; resetForm($form:Object): void; } @@ -42,7 +42,7 @@ declare module Foundation { interface IAbideOptions { slideSpeed?: number; multiOpen?: boolean; - patters?: Foundation.IAbidePatterns; + patters?: IAbidePatterns; } // http://foundation.zurb.com/sites/docs/accordion.html#javascript-reference @@ -80,14 +80,14 @@ declare module Foundation { } interface IDrilldownOptions { - backButton?: String; - wrapper?: String + backButton?: string; + wrapper?: string closeOnClick?: boolean } // http://foundation.zurb.com/sites/docs/dropdown.html#javascript-reference interface Dropdown { - getPositionClass(): String; + getPositionClass(): string; open(): void; close(): void; toggle(): void; @@ -99,7 +99,7 @@ declare module Foundation { hover?: boolean; vOffset?: number; hOffset?: number; - positionClass?: String; + positionClass?: string; trapFocus?: boolean; autoFocus?: boolean; } @@ -115,9 +115,9 @@ declare module Foundation { hoverDelay?: number; clickOpen?: boolean; closingTime?: number; - alignments?: String; - verticalClasss?: String; - rightClasss?: String; + alignments?: string; + verticalClasss?: string; + rightClasss?: string; } // http://foundation.zurb.com/sites/docs/equalizer.html#javascript-reference @@ -134,7 +134,7 @@ declare module Foundation { // http://foundation.zurb.com/sites/docs/interchange.html#javascript-reference interface Interchange { - replace(path:String): void; + replace(path:string): void; destroy(): void; } @@ -151,9 +151,9 @@ declare module Foundation { interface IMagellanOptions { animationDuration?: number; - animationEasing?: String; + animationEasing?: string; threshold?: number; - activeClass?: String; + activeClass?: string; deepLinking?: boolean; } @@ -168,12 +168,12 @@ declare module Foundation { interface IOffCanvasOptions { closeOnClick?: boolean; transitionTime?: number; - position?: String; + position?: string; forceTop?: boolean; isRevealed?: boolean; - revealOn?: String; + revealOn?: string; autoFocus?: boolean; - revealClass?: String; + revealClass?: string; } // http://foundation.zurb.com/sites/docs/orbit.html#javascript-reference @@ -186,21 +186,21 @@ declare module Foundation { interface IOrbitOptions { bullets?: boolean; navButtons?: boolean; - animInFromRight?: String; - animOutToRight?: String; - animInFromLeft?: String; - animOutToLeft?: String; + animInFromRight?: string; + animOutToRight?: string; + animInFromLeft?: string; + animOutToLeft?: string; autoPlay?: boolean; timerDelay?: number; infiniteWrap?: boolean; swipe?: boolean; pauseOnHover?: boolean; accessible?: boolean; - containerClass?: String; - slideClass?: String; - boxOfBullets?: String; - nextClass?: String; - prevClass?: String; + containerClass?: string; + slideClass?: string; + boxOfBullets?: string; + nextClass?: string; + prevClass?: string; } // http://foundation.zurb.com/sites/docs/reveal.html#javascript-reference @@ -212,8 +212,8 @@ declare module Foundation { } interface IRevealOptions { - animationIn?: String; - animationOut?: String; + animationIn?: string; + animationOut?: string; showDelay?: number; hideDelay?: number; closeOnClick?: boolean; @@ -246,28 +246,28 @@ declare module Foundation { doubleSided?: boolean; decimal?: number; moveTime?: number; - disabledClass?: String; + disabledClass?: string; } // http://foundation.zurb.com/sites/docs/sticky.html#javascript-reference interface Sticky { - _pauseListeners(scrollListener:String): void; + _pauseListeners(scrollListener:string): void; _calc(checkSizes:boolean, scroll:number): void; destroy(): void; emCalc(number:any): void; } interface IStickyOptions { - container?: String; - stickTo?: String; - anchor?: String; - topAnchor?: String; - btmAnchor?: String; + container?: string; + stickTo?: string; + anchor?: string; + topAnchor?: string; + btmAnchor?: string; marginTop?: number; marginBottom?: number; - stickyOn?: String; - stickyClass?: String; - containerClass?: String; + stickyOn?: string; + stickyClass?: string; + containerClass?: string; checkEvery?: number; } @@ -305,14 +305,14 @@ declare module Foundation { fadeInDuration?: number; fadeOutDuration?: number; disableHover?: boolean; - templateClasses?: String; - tooltipClass?: String; - triggerClass?: String; - showOn?: String; - template?: String; - tipText?: String; + templateClasses?: string; + tooltipClass?: string; + triggerClass?: string; + showOn?: string; + template?: string; + tipText?: string; clickOpen?: boolean; - positionClass?: String; + positionClass?: string; vOffset?: number; hOffset?:number; } @@ -323,17 +323,17 @@ declare module Foundation { interface Box { ImNotTouchingYou(element:Object, parent?:Object, lrOnly?:boolean, tbOnly?:boolean): boolean; GetDimensions(element:Object): Object; - GetOffsets(element:Object, anchor:Object, position:String, vOffset:number, hOffset:number, isOverflow:boolean): Object; + GetOffsets(element:Object, anchor:Object, position:string, vOffset:number, hOffset:number, isOverflow:boolean): Object; } interface KeyBoard { - parseKey(event:any): String; + parseKey(event:any): string; findFocusable($element:Object): Object; } interface MediaQuery { - get(size:String): String; - atLeast(size:String): boolean; + get(size:string): string; + atLeast(size:string): boolean; queries:Array; current:any; } @@ -367,61 +367,61 @@ declare module Foundation { // TODO :extension on jQuery } - interface FoundationStatic { - version : String; + interface FoundationSitesStatic { + version : string; rtl(): boolean; - plugin(plugin:Object, name:String): void; + plugin(plugin:Object, name:string): void; registerPlugin(plugin:Object): void; unregisterPlugin(plugin:Object): void; - GetYoDigits(length:number, namespace?:String): String; - reflow(elem:Object, plugins?:Array|String): void; - getFnName(fn:String): String; - transitionend(): String; + GetYoDigits(length:number, namespace?:string): string; + reflow(elem:Object, plugins?:Array|string): void; + getFnName(fn:string): string; + transitionend(): string; util : { throttle(func:(...args:any[]) => any, delay:number): (...args:any[]) => any; }; onImagesLoaded(images:Object, cb:Function): void; - Abide(element:Object, options?:IAbideOptions): Foundation.Abide; - Accordion(element:Object, options?:IAccordionOptions): Foundation.Accordion; - AccordionMenu(element:Object, options?:IAccordionMenuOptions): Foundation.AccordionMenu; - DrillDown(element:Object, options?:IDrilldownOptions): Foundation.Drilldown; - Dropdown(element:Object, options?:IDropdownOptions): Foundation.Dropdown; - DropdownMenu(element:Object, options?:IDropdownMenuOptions): Foundation.DropdownMenu; - Equalizer(element:Object, options?:IEqualizerOptions): Foundation.Equalizer; - Interchange(element:Object, options?:IInterchangeOptions): Foundation.Interchange; - Magellan(element:Object, options?:IMagellanOptions): Foundation.Magellan; - OffCanvas(element:Object, options?:IOffCanvasOptions): Foundation.OffCanvas; - Orbit(element:Object, options?:IOrbitOptions): Foundation.Orbit; - Reveal(element:Object, options?:IRevealOptions): Foundation.Reveal; - Slider(element:Object, options?:ISliderOptions): Foundation.Slider; - Sticky(element:Object, options?:IStickyOptions): Foundation.Sticky; - Tabs(element:Object, options?:ITabsOptions): Foundation.Tabs; - Toggler(element:Object, options?:ITogglerOptions): Foundation.Toggler; - Tooltip(element:Object, options?:ITooltipOptions): Foundation.Tooltip; + Abide(element:Object, options?:IAbideOptions): Abide; + Accordion(element:Object, options?:IAccordionOptions): Accordion; + AccordionMenu(element:Object, options?:IAccordionMenuOptions): AccordionMenu; + DrillDown(element:Object, options?:IDrilldownOptions): Drilldown; + Dropdown(element:Object, options?:IDropdownOptions): Dropdown; + DropdownMenu(element:Object, options?:IDropdownMenuOptions): DropdownMenu; + Equalizer(element:Object, options?:IEqualizerOptions): Equalizer; + Interchange(element:Object, options?:IInterchangeOptions): Interchange; + Magellan(element:Object, options?:IMagellanOptions): Magellan; + OffCanvas(element:Object, options?:IOffCanvasOptions): OffCanvas; + Orbit(element:Object, options?:IOrbitOptions): Orbit; + Reveal(element:Object, options?:IRevealOptions): Reveal; + Slider(element:Object, options?:ISliderOptions): Slider; + Sticky(element:Object, options?:IStickyOptions): Sticky; + Tabs(element:Object, options?:ITabsOptions): Tabs; + Toggler(element:Object, options?:ITogglerOptions): Toggler; + Tooltip(element:Object, options?:ITooltipOptions): Tooltip; // utils - Box: Foundation.Box; - KeyBoard: Foundation.KeyBoard; - MediaQuery: Foundation.MediaQuery; - Motion: Foundation.Motion; - Move: Foundation.Move; - Nest: Foundation.Nest; - Timer: Foundation.Timer; - Touch: Foundation.Touch; - Triggers: Foundation.Triggers; + Box: Box; + KeyBoard: KeyBoard; + MediaQuery: MediaQuery; + Motion: Motion; + Move: Move; + Nest: Nest; + Timer: Timer; + Touch: Touch; + Triggers: Triggers; } } interface JQuery { - foundation(method?:String|Array) : JQuery; + foundation(method?:string|Array) : JQuery; } -declare var Foundation:Foundation.FoundationStatic; +declare var Foundation:FoundationSites.FoundationSitesStatic; declare module "Foundation" { export = Foundation; diff --git a/foundation-sites/npm-debug.log b/foundation-sites/npm-debug.log new file mode 100644 index 000000000..5a8786ce4 --- /dev/null +++ b/foundation-sites/npm-debug.log @@ -0,0 +1,45 @@ +0 info it worked if it ends with ok +1 verbose cli [ '/usr/local/Cellar/node/4.2.1/bin/node', +1 verbose cli '/usr/local/bin/npm', +1 verbose cli 'run', +1 verbose cli 'test' ] +2 info using npm@3.3.9 +3 info using node@v4.2.1 +4 verbose run-script [ 'pretest', 'test', 'posttest' ] +5 info lifecycle DefinitelyTyped@0.0.1~pretest: DefinitelyTyped@0.0.1 +6 silly lifecycle DefinitelyTyped@0.0.1~pretest: no script for pretest, continuing +7 info lifecycle DefinitelyTyped@0.0.1~test: DefinitelyTyped@0.0.1 +8 verbose lifecycle DefinitelyTyped@0.0.1~test: unsafe-perm in lifecycle true +9 verbose lifecycle DefinitelyTyped@0.0.1~test: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Volumes/Data/Kwerri/playground/DefinitelyTyped/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin +10 verbose lifecycle DefinitelyTyped@0.0.1~test: CWD: /Volumes/Data/Kwerri/playground/DefinitelyTyped +11 silly lifecycle DefinitelyTyped@0.0.1~test: Args: [ '-c', 'dt --changes' ] +12 silly lifecycle DefinitelyTyped@0.0.1~test: Returned: code: 1 signal: null +13 info lifecycle DefinitelyTyped@0.0.1~test: Failed to exec test script +14 verbose stack Error: DefinitelyTyped@0.0.1 test: `dt --changes` +14 verbose stack Exit status 1 +14 verbose stack at EventEmitter. (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:233:16) +14 verbose stack at emitTwo (events.js:87:13) +14 verbose stack at EventEmitter.emit (events.js:172:7) +14 verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:24:14) +14 verbose stack at emitTwo (events.js:87:13) +14 verbose stack at ChildProcess.emit (events.js:172:7) +14 verbose stack at maybeClose (internal/child_process.js:818:16) +14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5) +15 verbose pkgid DefinitelyTyped@0.0.1 +16 verbose cwd /Volumes/Data/Kwerri/playground/DefinitelyTyped/foundation-sites +17 error Darwin 15.0.0 +18 error argv "/usr/local/Cellar/node/4.2.1/bin/node" "/usr/local/bin/npm" "run" "test" +19 error node v4.2.1 +20 error npm v3.3.9 +21 error code ELIFECYCLE +22 error DefinitelyTyped@0.0.1 test: `dt --changes` +22 error Exit status 1 +23 error Failed at the DefinitelyTyped@0.0.1 test script 'dt --changes'. +23 error This is most likely a problem with the DefinitelyTyped package, +23 error not with npm itself. +23 error Tell the author that this fails on your system: +23 error dt --changes +23 error You can get their info via: +23 error npm owner ls DefinitelyTyped +23 error There is likely additional logging output above. +24 verbose exit [ 1, true ] From 60205dabae191b1fd68fb7830103a6ec7a83a342 Mon Sep 17 00:00:00 2001 From: Sam Vloeberghs Date: Fri, 4 Dec 2015 10:10:36 +0100 Subject: [PATCH 302/389] update to tests --- foundation-sites/foundation-tests.ts | 149 ++++++++++++++------------- foundation-sites/foundation.d.ts | 2 +- foundation-sites/npm-debug.log | 45 -------- 3 files changed, 77 insertions(+), 119 deletions(-) delete mode 100644 foundation-sites/npm-debug.log diff --git a/foundation-sites/foundation-tests.ts b/foundation-sites/foundation-tests.ts index 50f88559b..225f3c0fa 100644 --- a/foundation-sites/foundation-tests.ts +++ b/foundation-sites/foundation-tests.ts @@ -7,90 +7,93 @@ /// $(document).foundation(); -$(document).foundation('method'); +$(document).foundation('method5'); $(document).foundation(['method', 'method2']); -function pluginList() { +Foundation.Abide($('.selector')); +Foundation.Abide($('.selector'), {}); - 'use strict'; +Foundation.Accordion($('.selector')); +Foundation.Accordion($('.selector'), {}); - return [ - 'Abide', - 'Accordion', - 'AccordionMenu', - 'DrillDown', - 'Dropdown', - 'DropdownMenu', - 'Equalizer', - 'Interchange', - 'Magellan', - 'OffCanvas', - 'Orbit', - 'Reveal', - 'Slider', - 'Sticky', - 'Tabs', - 'Toggler', - 'Tooltip' - ]; -} +Foundation.AccordionMenu($('.selector')); +Foundation.AccordionMenu($('.selector'), {}); -pluginList().forEach((value:string) => { - Foundation[value]($('.selector')); - Foundation[value]($('.selector'), {}); -}); +Foundation.DrillDown($('.selector')); +Foundation.DrillDown($('.selector'), {}); + +Foundation.Dropdown($('.selector')); +Foundation.Dropdown($('.selector'), {}); + +Foundation.DropdownMenu($('.selector')); +Foundation.DropdownMenu($('.selector'), {}); + +Foundation.Equalizer($('.selector')); +Foundation.Equalizer($('.selector'), {}); + +Foundation.Interchange($('.selector')); +Foundation.Interchange($('.selector'), {}); + +Foundation.Magellan($('.selector')); +Foundation.Magellan($('.selector'), {}); + +Foundation.OffCanvas($('.selector')); +Foundation.OffCanvas($('.selector'), {}); + +Foundation.Orbit($('.selector')); +Foundation.Orbit($('.selector'), {}); + +Foundation.Reveal($('.selector')); +Foundation.Reveal($('.selector'), {}); + +Foundation.Slider($('.selector')); +Foundation.Slider($('.selector'), {}); + +Foundation.Sticky($('.selector')); +Foundation.Sticky($('.selector'), {}); + +Foundation.Tabs($('.selector')); +Foundation.Tabs($('.selector'), {}); + +Foundation.Toggler($('.selector')); +Foundation.Toggler($('.selector'), {}); + +Foundation.Tooltip($('.selector')); +Foundation.Tooltip($('.selector'), {}); /* - Foundation.Abide($('.selector')); - Foundation.Abide($('.selector'), {}); + TODO: fix this: + error TS7017: Index signature of object type implicitly has an 'any' type. - Foundation.Accordion($('.selector')); - Foundation.Accordion($('.selector'), {}); + function pluginList() { - Foundation.AccordionMenu($('.selector')); - Foundation.AccordionMenu($('.selector'), {}); + 'use strict'; - Foundation.DrillDown($('.selector')); - Foundation.DrillDown($('.selector'), {}); + return [ + 'Abide', + 'Accordion', + 'AccordionMenu', + 'DrillDown', + 'Dropdown', + 'DropdownMenu', + 'Equalizer', + 'Interchange', + 'Magellan', + 'OffCanvas', + 'Orbit', + 'Reveal', + 'Slider', + 'Sticky', + 'Tabs', + 'Toggler', + 'Tooltip' + ]; + } - Foundation.Dropdown($('.selector')); - Foundation.Dropdown($('.selector'), {}); - - Foundation.DropdownMenu($('.selector')); - Foundation.DropdownMenu($('.selector'), {}); - - Foundation.Equalizer($('.selector')); - Foundation.Equalizer($('.selector'), {}); - - Foundation.Interchange($('.selector')); - Foundation.Interchange($('.selector'), {}); - - Foundation.Magellan($('.selector')); - Foundation.Magellan($('.selector'), {}); - - Foundation.OffCanvas($('.selector')); - Foundation.OffCanvas($('.selector'), {}); - - Foundation.Orbit($('.selector')); - Foundation.Orbit($('.selector'), {}); - - Foundation.Reveal($('.selector')); - Foundation.Reveal($('.selector'), {}); - - Foundation.Slider($('.selector')); - Foundation.Slider($('.selector'), {}); - - Foundation.Sticky($('.selector')); - Foundation.Sticky($('.selector'), {}); - - Foundation.Tabs($('.selector')); - Foundation.Tabs($('.selector'), {}); - - Foundation.Toggler($('.selector')); - Foundation.Toggler($('.selector'), {}); - - Foundation.Tooltip($('.selector')); - Foundation.Tooltip($('.selector'), {}); + pluginList().forEach((value:string) => { + Foundation[value]($('.selector')); + Foundation[value]($('.selector'), {}); + }); */ diff --git a/foundation-sites/foundation.d.ts b/foundation-sites/foundation.d.ts index dbdb56446..a6dd7682d 100644 --- a/foundation-sites/foundation.d.ts +++ b/foundation-sites/foundation.d.ts @@ -9,7 +9,7 @@ declare module FoundationSites { // http://foundation.zurb.com/sites/docs/abide.html#javascript-reference interface Abide { - requiredCheck(element:Object): boolean; + requiredChedck(element:Object): boolean; findLabel(element:Object): boolean; addErrorClasses(element:Object): void; removeErrorClasses(element:Object): void; diff --git a/foundation-sites/npm-debug.log b/foundation-sites/npm-debug.log deleted file mode 100644 index 5a8786ce4..000000000 --- a/foundation-sites/npm-debug.log +++ /dev/null @@ -1,45 +0,0 @@ -0 info it worked if it ends with ok -1 verbose cli [ '/usr/local/Cellar/node/4.2.1/bin/node', -1 verbose cli '/usr/local/bin/npm', -1 verbose cli 'run', -1 verbose cli 'test' ] -2 info using npm@3.3.9 -3 info using node@v4.2.1 -4 verbose run-script [ 'pretest', 'test', 'posttest' ] -5 info lifecycle DefinitelyTyped@0.0.1~pretest: DefinitelyTyped@0.0.1 -6 silly lifecycle DefinitelyTyped@0.0.1~pretest: no script for pretest, continuing -7 info lifecycle DefinitelyTyped@0.0.1~test: DefinitelyTyped@0.0.1 -8 verbose lifecycle DefinitelyTyped@0.0.1~test: unsafe-perm in lifecycle true -9 verbose lifecycle DefinitelyTyped@0.0.1~test: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Volumes/Data/Kwerri/playground/DefinitelyTyped/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin -10 verbose lifecycle DefinitelyTyped@0.0.1~test: CWD: /Volumes/Data/Kwerri/playground/DefinitelyTyped -11 silly lifecycle DefinitelyTyped@0.0.1~test: Args: [ '-c', 'dt --changes' ] -12 silly lifecycle DefinitelyTyped@0.0.1~test: Returned: code: 1 signal: null -13 info lifecycle DefinitelyTyped@0.0.1~test: Failed to exec test script -14 verbose stack Error: DefinitelyTyped@0.0.1 test: `dt --changes` -14 verbose stack Exit status 1 -14 verbose stack at EventEmitter. (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:233:16) -14 verbose stack at emitTwo (events.js:87:13) -14 verbose stack at EventEmitter.emit (events.js:172:7) -14 verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:24:14) -14 verbose stack at emitTwo (events.js:87:13) -14 verbose stack at ChildProcess.emit (events.js:172:7) -14 verbose stack at maybeClose (internal/child_process.js:818:16) -14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5) -15 verbose pkgid DefinitelyTyped@0.0.1 -16 verbose cwd /Volumes/Data/Kwerri/playground/DefinitelyTyped/foundation-sites -17 error Darwin 15.0.0 -18 error argv "/usr/local/Cellar/node/4.2.1/bin/node" "/usr/local/bin/npm" "run" "test" -19 error node v4.2.1 -20 error npm v3.3.9 -21 error code ELIFECYCLE -22 error DefinitelyTyped@0.0.1 test: `dt --changes` -22 error Exit status 1 -23 error Failed at the DefinitelyTyped@0.0.1 test script 'dt --changes'. -23 error This is most likely a problem with the DefinitelyTyped package, -23 error not with npm itself. -23 error Tell the author that this fails on your system: -23 error dt --changes -23 error You can get their info via: -23 error npm owner ls DefinitelyTyped -23 error There is likely additional logging output above. -24 verbose exit [ 1, true ] From f7874b963eb324a9ac52caf9dda620c515de936a Mon Sep 17 00:00:00 2001 From: Sam Vloeberghs Date: Fri, 4 Dec 2015 10:13:00 +0100 Subject: [PATCH 303/389] removed debug log --- npm-debug.log | 45 --------------------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 npm-debug.log diff --git a/npm-debug.log b/npm-debug.log deleted file mode 100644 index 19dc7e7fd..000000000 --- a/npm-debug.log +++ /dev/null @@ -1,45 +0,0 @@ -0 info it worked if it ends with ok -1 verbose cli [ '/usr/local/Cellar/node/4.2.1/bin/node', -1 verbose cli '/usr/local/bin/npm', -1 verbose cli 'run', -1 verbose cli 'test' ] -2 info using npm@3.3.9 -3 info using node@v4.2.1 -4 verbose run-script [ 'pretest', 'test', 'posttest' ] -5 info lifecycle DefinitelyTyped@0.0.1~pretest: DefinitelyTyped@0.0.1 -6 silly lifecycle DefinitelyTyped@0.0.1~pretest: no script for pretest, continuing -7 info lifecycle DefinitelyTyped@0.0.1~test: DefinitelyTyped@0.0.1 -8 verbose lifecycle DefinitelyTyped@0.0.1~test: unsafe-perm in lifecycle true -9 verbose lifecycle DefinitelyTyped@0.0.1~test: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Volumes/Data/Kwerri/playground/DefinitelyTyped/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin -10 verbose lifecycle DefinitelyTyped@0.0.1~test: CWD: /Volumes/Data/Kwerri/playground/DefinitelyTyped -11 silly lifecycle DefinitelyTyped@0.0.1~test: Args: [ '-c', 'dt --changes' ] -12 silly lifecycle DefinitelyTyped@0.0.1~test: Returned: code: 1 signal: null -13 info lifecycle DefinitelyTyped@0.0.1~test: Failed to exec test script -14 verbose stack Error: DefinitelyTyped@0.0.1 test: `dt --changes` -14 verbose stack Exit status 1 -14 verbose stack at EventEmitter. (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:233:16) -14 verbose stack at emitTwo (events.js:87:13) -14 verbose stack at EventEmitter.emit (events.js:172:7) -14 verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:24:14) -14 verbose stack at emitTwo (events.js:87:13) -14 verbose stack at ChildProcess.emit (events.js:172:7) -14 verbose stack at maybeClose (internal/child_process.js:818:16) -14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5) -15 verbose pkgid DefinitelyTyped@0.0.1 -16 verbose cwd /Volumes/Data/Kwerri/playground/DefinitelyTyped -17 error Darwin 15.0.0 -18 error argv "/usr/local/Cellar/node/4.2.1/bin/node" "/usr/local/bin/npm" "run" "test" -19 error node v4.2.1 -20 error npm v3.3.9 -21 error code ELIFECYCLE -22 error DefinitelyTyped@0.0.1 test: `dt --changes` -22 error Exit status 1 -23 error Failed at the DefinitelyTyped@0.0.1 test script 'dt --changes'. -23 error This is most likely a problem with the DefinitelyTyped package, -23 error not with npm itself. -23 error Tell the author that this fails on your system: -23 error dt --changes -23 error You can get their info via: -23 error npm owner ls DefinitelyTyped -23 error There is likely additional logging output above. -24 verbose exit [ 1, true ] From 380e701b39abbd48a435971bb7560974ad43b33e Mon Sep 17 00:00:00 2001 From: Valentyn Shybanov Date: Fri, 4 Dec 2015 13:31:52 +0100 Subject: [PATCH 304/389] Added missing updateParams method According to documentation, `updateParams` method existed even in 1.3 but it was missing in `IRouteService`. Added this missing method. --- angularjs/angular-route.d.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/angularjs/angular-route.d.ts b/angularjs/angular-route.d.ts index 662b2c11d..63bc75594 100644 --- a/angularjs/angular-route.d.ts +++ b/angularjs/angular-route.d.ts @@ -35,6 +35,16 @@ declare module angular.route { // May not always be available. For instance, current will not be available // to a controller that was not initialized as a result of a route maching. current?: ICurrentRoute; + + /** + * Causes $route service to update the current URL, replacing current route parameters with those specified in newParams. + * Provided property names that match the route's path segment definitions will be interpolated into the + * location's path, while remaining properties will be treated as query params. + * + * @param newParams Object. mapping of URL parameter names to values + */ + updateParams(newParams:{[key:string]:string}); + } From 7610dacad225bc62f0965b8e8af18eaecd69fda0 Mon Sep 17 00:00:00 2001 From: Valentyn Shybanov Date: Fri, 4 Dec 2015 13:36:19 +0100 Subject: [PATCH 305/389] Added return type of updateParams Added required return type of updateParams --- angularjs/angular-route.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angularjs/angular-route.d.ts b/angularjs/angular-route.d.ts index 63bc75594..5f426d51c 100644 --- a/angularjs/angular-route.d.ts +++ b/angularjs/angular-route.d.ts @@ -43,7 +43,7 @@ declare module angular.route { * * @param newParams Object. mapping of URL parameter names to values */ - updateParams(newParams:{[key:string]:string}); + updateParams(newParams:{[key:string]:string}): void; } From 320f9c0475d523016d8e3a10fa8705e229185897 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Fri, 4 Dec 2015 23:37:10 +0500 Subject: [PATCH 306/389] lodash: signatures of _.flow have been changed --- lodash/lodash-tests.ts | 32 ++++++++++++++++++++++++++++---- lodash/lodash.d.ts | 10 +++++++++- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 9cae2a872..9750fbd5e 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -4822,10 +4822,34 @@ module TestDelay { } // _.flow -var testFlowSquareFn = (n: number) => n * n; -var testFlowAddFn = (n: number, m: number) => n + m; -result = _.flow<(n: number, m: number) => number>(testFlowAddFn, testFlowSquareFn)(1, 2); -result = _(testFlowAddFn).flow<(n: number, m: number) => number>(testFlowSquareFn).value()(1, 2); +module TestFlow { + let Fn1: (n: number) => number; + let Fn2: (m: number, n: number) => number; + + { + let result: (m: number, n: number) => number; + + result = _.flow<(m: number, n: number) => number>(Fn1, Fn2); + result = _.flow<(m: number, n: number) => number>(Fn1, Fn1, Fn2); + result = _.flow<(m: number, n: number) => number>(Fn1, Fn1, Fn1, Fn2); + } + + { + let result: _.LoDashImplicitObjectWrapper<(m: number, n: number) => number>; + + result = _(Fn1).flow<(m: number, n: number) => number>(Fn2); + result = _(Fn1).flow<(m: number, n: number) => number>(Fn1, Fn2); + result = _(Fn1).flow<(m: number, n: number) => number>(Fn1, Fn1, Fn2); + } + + { + let result: _.LoDashExplicitObjectWrapper<(m: number, n: number) => number>; + + result = _(Fn1).chain().flow<(m: number, n: number) => number>(Fn2); + result = _(Fn1).chain().flow<(m: number, n: number) => number>(Fn1, Fn2); + result = _(Fn1).chain().flow<(m: number, n: number) => number>(Fn1, Fn1, Fn2); + } +} // _.flowRight module TestFlowRight { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index ed8d72443..3aaf4a68b 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -8340,6 +8340,7 @@ declare module _ { /** * Creates a function that returns the result of invoking the provided functions with the this binding of the * created function, where each successive invocation is supplied the return value of the previous. + * * @param funcs Functions to invoke. * @return Returns the new function. */ @@ -8349,10 +8350,17 @@ declare module _ { interface LoDashImplicitObjectWrapper { /** * @see _.flow - **/ + */ flow(...funcs: Function[]): LoDashImplicitObjectWrapper; } + interface LoDashExplicitObjectWrapper { + /** + * @see _.flow + */ + flow(...funcs: Function[]): LoDashExplicitObjectWrapper; + } + //_.flowRight interface LoDashStatic { /** From b545524610b8dffbe787b8d7e001ee2bcfa6b69f Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 4 Dec 2015 14:04:52 -0500 Subject: [PATCH 307/389] RequestPromise to extend Promise The current then/catch/finally in RequestPromise don't have proper definition. As a result `await` in Typescript 1.7 fails during compilation blaming that there's no proper `then` implementation. --- request-promise/request-promise.d.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/request-promise/request-promise.d.ts b/request-promise/request-promise.d.ts index d442e527f..b35856277 100644 --- a/request-promise/request-promise.d.ts +++ b/request-promise/request-promise.d.ts @@ -12,10 +12,7 @@ declare module 'request-promise' { import request = require('request'); import http = require('http'); - interface RequestPromise extends request.Request { - then(onFulfilled: Function, onRejected?: Function): Promise; - catch(onRejected: Function): Promise; - finally(onFinished: Function): Promise; + interface RequestPromise extends request.Request, Promise { promise(): Promise; } From 90d18f6f484c05bf0f80de42bcb25657401393e0 Mon Sep 17 00:00:00 2001 From: Leon Yu Date: Fri, 4 Dec 2015 07:30:48 -0500 Subject: [PATCH 308/389] simple-mock.d.ts Fix bug with uppercase --- simple-mock/simple-mock-tests.ts | 1024 ++++++++++++++++++++++++++++++ simple-mock/simple-mock.d.ts | 194 ++++++ 2 files changed, 1218 insertions(+) create mode 100644 simple-mock/simple-mock-tests.ts create mode 100644 simple-mock/simple-mock.d.ts diff --git a/simple-mock/simple-mock-tests.ts b/simple-mock/simple-mock-tests.ts new file mode 100644 index 000000000..e83b22aff --- /dev/null +++ b/simple-mock/simple-mock-tests.ts @@ -0,0 +1,1024 @@ +/// +/// +/// + +/// + +'use strict' + +import simple = require('simple-mock'); +import assert = require('assert'); + +import Bluebird = require('bluebird'); + +// Following code is a TypeScript convertion of the test suite bundled with simple-mock. +// Original test in MIT license + +describe('simple', function () { + describe('spy()', function () { + describe('for noop function', function () { + let spyFn: Simple.Spy; + + beforeEach(function () { + spyFn = simple.spy(function () {}) + }) + + it('can be queried without having been called', function () { + assert.equal(spyFn.callCount, 0) + assert.deepEqual(spyFn.calls, []) + assert(spyFn.lastCall) + assert.deepEqual(spyFn.lastCall.args, []) + }) + + it('can be queried for arguments on a single call', function () { + let context = { + spyFn: spyFn + } + + context.spyFn('with', 'args') + + assert(spyFn.called) + assert.equal(spyFn.callCount, 1) + assert(spyFn.calls) + assert(spyFn.firstCall) + assert.equal(spyFn.firstCall, spyFn.lastCall) + assert.equal(spyFn.firstCall, spyFn.calls[0]) + assert.deepEqual(spyFn.lastCall.args, ['with', 'args']) + assert.equal(spyFn.lastCall.context, context) + }) + + it('can be queried for arguments over multiple calls', function () { + let context = { + spyFn: spyFn + } + + spyFn('with', 'args') + spyFn('and') + context.spyFn('more', 'args') + + assert(spyFn.called) + assert.equal(spyFn.callCount, 3) + assert(spyFn.calls) + assert(spyFn.firstCall) + assert.equal(spyFn.firstCall, spyFn.calls[0]) + assert.deepEqual(spyFn.firstCall.args, ['with', 'args']) + assert(spyFn.calls[1]) + assert.deepEqual(spyFn.calls[1].args, ['and']) + assert(spyFn.lastCall) + assert.equal(spyFn.lastCall, spyFn.calls[2]) + assert.deepEqual(spyFn.lastCall.args, ['more', 'args']) + assert.equal(spyFn.lastCall.context, context) + }) + }) + + describe('for a throwing function', function () { + let originalFn: () => void; + let spyFn: Simple.Spy; + beforeEach(function () { + let i = 0 + + originalFn = function () { + throw new Error(`${i++}`) + } + + spyFn = simple.spy(originalFn) + }) + + it('can be queried without having been called', function () { + assert(!spyFn.called) + assert.equal(spyFn.callCount, 0) + assert.deepEqual(spyFn.calls, []) + assert(spyFn.lastCall) + assert.equal(spyFn.lastCall.threw, undefined) + }) + + it('can be queried for what it threw on a single call', function () { + let threw: Error; + try { + spyFn() + } catch (e) { + threw = e + } + + assert(threw) + assert(spyFn.called) + assert.equal(spyFn.callCount, 1) + assert(spyFn.firstCall) + assert.equal(spyFn.firstCall.threw, threw) + }) + + it('can be queried for what it threw over multiple calls', function () { + let threw: Error[] = [] + try { + spyFn() + } catch (e) { + threw.push(e) + } + try { + spyFn() + } catch (e) { + threw.push(e) + } + try { + spyFn() + } catch (e) { + threw.push(e) + } + + assert.equal(threw.length, 3) + assert(spyFn.called) + assert.equal(spyFn.callCount, 3) + assert(spyFn.firstCall) + assert.equal(spyFn.firstCall.threw, threw[0]) + assert.equal(spyFn.calls[1].threw, threw[1]) + assert.equal(spyFn.lastCall.threw, threw[2]) + }) + }) + + describe('for a returning function', function () { + let originalFn: () => number; + let spyFn: Simple.Spy; + beforeEach(function () { + let i = 1 + + originalFn = () => { + return i++ + } + + spyFn = simple.spy(originalFn) + }) + + it('can be queried without having been called', function () { + assert(!spyFn.called) + assert.equal(spyFn.callCount, 0) + assert.deepEqual(spyFn.calls, []) + assert(spyFn.lastCall) + assert.equal(spyFn.lastCall.returned, undefined) + }) + + it('can be queried for what it threw on a single call', function () { + let returned: number + + returned = spyFn() + + assert(returned) + assert.equal(spyFn.callCount, 1) + assert(spyFn.firstCall) + assert.equal(spyFn.firstCall.returned, returned) + }) + + it('can be queried for what it threw over multiple calls', function () { + let returned: number[] = [] + + returned.push(spyFn()) + returned.push(spyFn()) + returned.push(spyFn()) + + assert.equal(returned.length, 3) + assert(spyFn.called) + assert.equal(spyFn.callCount, 3) + assert(spyFn.firstCall) + assert.equal(spyFn.firstCall.returned, returned[0]) + assert.equal(spyFn.calls[1].returned, returned[1]) + assert.equal(spyFn.lastCall.returned, returned[2]) + }) + }) + + describe('calls of multiple spies', function () { + it('can be compared to determine the order they were called in', function () { + let spy1 = simple.spy(function () {}) + let spy2 = simple.spy(function () {}) + let spy3 = simple.spy(function () {}) + + spy1() + spy3() + spy2() + spy1() + + assert(spy1.lastCall.k > spy2.lastCall.k) + assert(spy1.lastCall.k > spy3.lastCall.k) + assert(spy2.lastCall.k > spy3.lastCall.k) + assert(spy3.lastCall.k > spy1.calls[0].k) + }) + }) + }) + + describe('stub()', function () { + describe('with no configuration', function () { + let stubFn: Simple.Stub; + it('is also a spy', function () { + stubFn = simple.stub() + + stubFn('etc') + assert(stubFn.called) + assert(stubFn.lastCall.args[0], 'etc') + }) + }) + + describe('for a single callback configuration', function () { + let stubFn: Simple.Stub; + describe('with default index', function () { + beforeEach(function () { + stubFn = simple.stub().callbackWith(1, 2, 3) + }) + + it('can call back with arguments', function () { + stubFn('a', function () { + assert(stubFn.called) + assert.equal(stubFn.callCount, 1) + assert.equal(stubFn.lastCall.args[0], 'a') + assert.equal(arguments.length, 3) + assert.equal(arguments[0], 1) + assert.equal(arguments[1], 2) + assert.equal(arguments[2], 3) + }) + }) + + it('can call back with arguments, over multiple calls', function () { + stubFn('a', function () {}) + stubFn('b', function () { + assert(stubFn.called) + assert.equal(stubFn.callCount, 2) + assert.equal(stubFn.lastCall.args[0], 'b') + assert.equal(arguments.length, 3) + assert.equal(arguments[0], 1) + assert.equal(arguments[1], 2) + assert.equal(arguments[2], 3) + }) + }) + }) + + describe('with specified index', function () { + beforeEach(function () { + stubFn = simple.stub().callbackArgWith(1, 2, 3) + }) + + it('can call back with arguments', function () { + stubFn('a', function () { + assert(stubFn.called) + assert.equal(stubFn.callCount, 1) + assert.equal(stubFn.lastCall.args[0], 'a') + assert.equal(arguments.length, 2) + assert.equal(arguments[0], 2) + assert.equal(arguments[1], 3) + }) + }) + + it('can call back with arguments, over multiple calls', function () { + stubFn('a', function () {}) + stubFn('b', function () { + assert(stubFn.called) + assert.equal(stubFn.callCount, 2) + assert.equal(stubFn.lastCall.args[0], 'b') + assert.equal(arguments.length, 2) + assert.equal(arguments[0], 2) + assert.equal(arguments[1], 3) + }) + }) + }) + + describe('with context specified', function () { + beforeEach(function () { + stubFn = simple.stub().callback().inThisContext({ a: 'a' }) + }) + + it('should do what...', function (done) { + stubFn(function () { + assert.equal(this.a, 'a') + done() + }) + }) + }) + }) + + describe('for a multiple callback configurations', function () { + let stubFn: Simple.Stub; + beforeEach(function () { + stubFn = simple.stub().callbackWith(1).callbackWith(2).callbackWith(3) + }) + + it('can call back once with arguments', function () { + stubFn('a', function () { + assert(stubFn.called) + assert.equal(stubFn.callCount, 1) + assert.equal(stubFn.lastCall.args[0], 'a') + assert.equal(arguments[0], 1) + }) + }) + + it('can call back with arguments, over multiple calls, looping per default', function () { + stubFn('a', function () {}) + stubFn('b', function () { + assert(stubFn.called) + assert.equal(stubFn.callCount, 2) + assert.equal(stubFn.lastCall.args[0], 'b') + assert.equal(arguments[0], 2) + }) + stubFn('c', function () { + assert(stubFn.called) + assert.equal(stubFn.callCount, 3) + assert.equal(stubFn.lastCall.args[0], 'c') + assert.equal(arguments[0], 3) + }) + stubFn('d', function () { + assert.equal(stubFn.callCount, 4) + assert.equal(stubFn.lastCall.args[0], 'd') + assert.equal(arguments[0], 1) + }) + }) + + it('can call back with arguments, over multiple calls, looping turned off', function () { + stubFn.loop = false + stubFn('a', function () {}) + stubFn('b', function () { + assert(stubFn.called) + assert.equal(stubFn.callCount, 2) + assert.equal(stubFn.lastCall.args[0], 'b') + assert.equal(arguments[0], 2) + }) + stubFn('c', function () { + assert(stubFn.called) + assert.equal(stubFn.callCount, 3) + assert.equal(stubFn.lastCall.args[0], 'c') + assert.equal(arguments[0], 3) + }) + let neverCalled = true + stubFn('d', function () { + neverCalled = false + }) + assert(neverCalled) + }) + }) + + describe('for a single throwing configuration', function () { + let stubFn: Simple.Stub; + beforeEach(function () { + stubFn = simple.stub().throwWith(new Error('example')) + }) + + it('can throw', function () { + let threw: Error + try { + stubFn() + } catch (e) { + threw = e + } + + assert(threw) + assert(stubFn.called) + assert.equal(stubFn.callCount, 1) + assert.equal(threw.message, 'example') + }) + + it('can throw over multiple calls, looping per default', function () { + let threw: Error[] = [] + try { + stubFn() + } catch (e) { + threw.push(e) + } + try { + stubFn() + } catch (e) { + threw.push(e) + } + + assert.equal(threw.length, 2) + assert(stubFn.called) + assert.equal(stubFn.callCount, 2) + assert.equal(threw[0], threw[1]) + assert.equal(threw[0].message, 'example') + }) + }) + + describe('for a multiple throwing configurations', function () { + let stubFn: Simple.Stub; + beforeEach(function () { + stubFn = simple.stub().throwWith(new Error('a')).throwWith(new Error('b')) + }) + + it('can throw', function () { + let threw: Error + try { + stubFn() + } catch (e) { + threw = e + } + + assert(threw) + assert(stubFn.called) + assert.equal(stubFn.callCount, 1) + assert.equal(threw.message, 'a') + }) + + it('can throw over multiple calls, looping per default', function () { + let threw: Error[] = [] + try { + stubFn() + } catch (e) { + threw.push(e) + } + try { + stubFn() + } catch (e) { + threw.push(e) + } + try { + stubFn() + } catch (e) { + threw.push(e) + } + + assert.equal(threw.length, 3) + assert(stubFn.called) + assert.equal(stubFn.callCount, 3) + assert.equal(threw[0].message, 'a') + assert.equal(threw[1].message, 'b') + assert.equal(threw[2].message, 'a') + }) + + it('can throw over multiple calls, looping turned off', function () { + stubFn.loop = false + + let threw: Error[] = [] + try { + stubFn() + } catch (e) { + threw.push(e) + } + try { + stubFn() + } catch (e) { + threw.push(e) + } + try { + stubFn() + } catch (e) { + threw.push(e) + } + + assert.equal(threw.length, 2) + assert(stubFn.called) + assert.equal(stubFn.callCount, 3) + assert.equal(threw[0].message, 'a') + assert.equal(threw[1].message, 'b') + }) + }) + + describe('for a single returning configuration', function () { + let stubFn: Simple.Stub; + beforeEach(function () { + stubFn = simple.stub() + }) + + it('can return', function () { + stubFn.returnWith('example') + + let returned: string + returned = stubFn() + + assert(returned) + assert.equal(stubFn.callCount, 1) + assert.equal(returned, 'example') + }) + + it('can return an empty string', function () { + stubFn.returnWith('') + + let returned: string + returned = stubFn() + + assert.equal(stubFn.callCount, 1) + assert.equal(returned, '') + }) + + it('can return over multiple calls, looping per default', function () { + stubFn.returnWith('example-a') + stubFn.returnWith('example-b') + + let returned: string[] = [] + returned.push(stubFn()) + returned.push(stubFn()) + returned.push(stubFn()) + returned.push(stubFn()) + + assert.equal(returned.length, 4) + assert(stubFn.called) + assert.equal(stubFn.callCount, 4) + assert.equal(returned[0], returned[2]) + assert.equal(returned[0], 'example-a') + assert.equal(returned[1], returned[3]) + assert.equal(returned[1], 'example-b') + }) + }) + + describe('for a multiple returning configurations', function () { + let stubFn: Simple.Stub; + beforeEach(function () { + stubFn = simple.stub().returnWith('a').returnWith('b') + }) + + it('can return', function () { + let returned: string + returned = stubFn() + + assert(returned) + assert.equal(stubFn.callCount, 1) + assert.equal(returned, 'a') + }) + + it('can return over multiple calls, looping per default', function () { + let returned: string[] = [] + returned.push(stubFn()) + returned.push(stubFn()) + returned.push(stubFn()) + + assert.equal(returned.length, 3) + assert(stubFn.called) + assert.equal(stubFn.callCount, 3) + assert.equal(returned[0], 'a') + assert.equal(returned[1], 'b') + assert.equal(returned[2], 'a') + }) + + it('can return over multiple calls, looping turned off', function () { + stubFn.loop = false + + let returned: string[] = [] + returned.push(stubFn()) + returned.push(stubFn()) + returned.push(stubFn()) + + assert.equal(returned.length, 3) + assert(stubFn.called) + assert.equal(stubFn.callCount, 3) + assert.equal(returned[0], 'a') + assert.equal(returned[1], 'b') + assert.equal(returned[2], undefined) + }) + }) + + describe('for a specified function to call', function () { + it('should be called with arguments and return', function () { + let stubFn = simple.stub().callFn(function () { + return arguments + }) + + let returned = stubFn('z', 'x') + + assert.equal(stubFn.callCount, 1) + assert.equal(returned[0], 'z') + assert.equal(returned[1], 'x') + }) + + it('should be able to throw', function () { + let stubFn = simple.stub().callFn(function () { + throw new Error('my message') + }) + + try { + stubFn() + } catch(e) { + assert(e instanceof Error) + assert.equal(e.message, 'my message') + } + }) + + it('should be called in context', function () { + let mockObj = { + stubFn: simple.stub().callFn(function () { + return this + }) + } + + let returned = mockObj.stubFn() + + assert.equal(returned, mockObj) + }) + + it('can be called in specified context', function () { + let anotherMockObj = {} + + let mockObj = { + stubFn: simple.stub().callFn(function () { + return this + }).inThisContext(anotherMockObj) + } + + let returned = mockObj.stubFn() + + assert.equal(returned, anotherMockObj) + }) + }) + + describe('for custom/when-conforming promises', function () { + let fulfilledStub: Simple.Stub + let rejectedStub: Simple.Stub + + beforeEach(function () { + fulfilledStub = simple.stub().returnWith(true) + rejectedStub = simple.stub().returnWith(true) + + interface MockPromise { + resolveValue: T, + rejectValue: T, + then(fulfilledFn: (value: any) => T, rejectedFn: (error: any) => T): void; + } + + let mockPromise: MockPromise = { + resolveValue: null as boolean, + rejectValue: null as boolean, + then: function (fulfilledFn: (value: any) => boolean, rejectedFn: (error: any) => boolean) { + let self = this + process.nextTick(function () { + if (self.resolveValue) return fulfilledFn(self.resolveValue) + if (self.rejectValue) return rejectedFn(self.rejectValue) + }) + } + } + + simple.mock(simple, 'Promise', { + when: function(value: T) { + let promise: MockPromise = Object.create(mockPromise) + promise.resolveValue = value + return promise + }, + reject: function(value: T) { + let promise: MockPromise = Object.create(mockPromise) + promise.rejectValue = value + return promise + } + }) + }) + + describe('with a single resolving configuration', function () { + let stubFn: Simple.Stub>; + beforeEach(function () { + stubFn = simple.stub().resolveWith('example') + }) + + it('can return a promise', function (done) { + let returned = stubFn() + + assert(returned) + + returned.then(fulfilledStub, rejectedStub) + + setTimeout(function () { + assert.equal(fulfilledStub.callCount, 1) + assert.equal(fulfilledStub.lastCall.arg, 'example') + assert.equal(rejectedStub.callCount, 0) + done() + }, 0) + }) + }) + + describe('with a multiple resolving configurations', function () { + let stubFn: Simple.Stub>; + beforeEach(function () { + stubFn = simple.stub().resolveWith('a').resolveWith('b') + }) + + it('can return a promise', function (done) { + let returned = stubFn() + + assert(returned) + + returned.then(fulfilledStub, rejectedStub) + + setTimeout(function () { + assert.equal(fulfilledStub.callCount, 1) + assert.equal(fulfilledStub.lastCall.arg, 'a') + assert.equal(rejectedStub.callCount, 0) + done() + }, 0) + }) + + it('can return over multiple calls, looping per default', function (done) { + stubFn().then(fulfilledStub, rejectedStub) + stubFn().then(fulfilledStub, rejectedStub) + stubFn().then(fulfilledStub, rejectedStub) + + setTimeout(function () { + assert.equal(fulfilledStub.callCount, 3) + assert.equal(fulfilledStub.calls[0].arg, 'a') + assert.equal(fulfilledStub.calls[1].arg, 'b') + assert.equal(fulfilledStub.calls[2].arg, 'a') + assert.equal(rejectedStub.callCount, 0) + done() + }, 0) + }) + }) + + describe('with a single rejecting configuration', function () { + let stubFn: Simple.Stub>; + beforeEach(function () { + stubFn = simple.stub().rejectWith('example') + }) + + it('can return a promise', function (done) { + let returned = stubFn() + + assert(returned) + + returned.then(fulfilledStub, rejectedStub) + + setTimeout(function () { + assert.equal(fulfilledStub.callCount, 0) + assert.equal(rejectedStub.callCount, 1) + assert.equal(rejectedStub.lastCall.arg, 'example') + done() + }, 0) + }) + }) + + describe('with a multiple rejecting configurations', function () { + let stubFn: Simple.Stub>; + beforeEach(function () { + stubFn = simple.stub().rejectWith('a').rejectWith('b') + }) + + it('can return a promise', function (done) { + let returned = stubFn() + + assert(returned) + + returned.then(fulfilledStub, rejectedStub) + + setTimeout(function () { + assert.equal(fulfilledStub.callCount, 0) + assert.equal(rejectedStub.callCount, 1) + assert.equal(rejectedStub.lastCall.arg, 'a') + done() + }, 0) + }) + + it('can return over multiple calls, looping per default', function (done) { + stubFn().then(fulfilledStub, rejectedStub) + stubFn().then(fulfilledStub, rejectedStub) + stubFn().then(fulfilledStub, rejectedStub) + + setTimeout(function () { + assert.equal(fulfilledStub.callCount, 0) + assert.equal(rejectedStub.callCount, 3) + assert.equal(rejectedStub.calls[0].arg, 'a') + assert.equal(rejectedStub.calls[1].arg, 'b') + assert.equal(rejectedStub.calls[2].arg, 'a') + done() + }, 0) + }) + }) + }) + + describe('for native/conforming promises', function () { + let fulfilledStub: Simple.Stub + let rejectedStub: Simple.Stub + + beforeEach(function () { + fulfilledStub = simple.stub().returnWith(true) + rejectedStub = simple.stub().returnWith(true) + }) + + describe('with a single resolving configuration', function () { + let stubFn: Simple.Stub>; + beforeEach(function () { + stubFn = simple.stub().resolveWith('example') + }) + + it('can return a promise', function (done) { + let returned = stubFn() + + assert(returned) + + returned.then(fulfilledStub, rejectedStub) + + setTimeout(function () { + assert.equal(fulfilledStub.callCount, 1) + assert.equal(fulfilledStub.lastCall.arg, 'example') + assert.equal(rejectedStub.callCount, 0) + done() + }, 0) + }) + }) + + describe('with a multiple resolving configurations', function () { + let stubFn: Simple.Stub>; + beforeEach(function () { + stubFn = simple.stub().resolveWith('a').resolveWith('b') + }) + + it('can return a promise', function (done) { + let returned = stubFn() + + assert(returned) + + returned.then(fulfilledStub, rejectedStub) + + setTimeout(function () { + assert.equal(fulfilledStub.callCount, 1) + assert.equal(fulfilledStub.lastCall.arg, 'a') + assert.equal(rejectedStub.callCount, 0) + done() + }, 0) + }) + + it('can return over multiple calls, looping per default', function (done) { + stubFn().then(fulfilledStub, rejectedStub) + stubFn().then(fulfilledStub, rejectedStub) + stubFn().then(fulfilledStub, rejectedStub) + + setTimeout(function () { + assert.equal(fulfilledStub.callCount, 3) + assert.equal(fulfilledStub.calls[0].arg, 'a') + assert.equal(fulfilledStub.calls[1].arg, 'b') + assert.equal(fulfilledStub.calls[2].arg, 'a') + assert.equal(rejectedStub.callCount, 0) + done() + }, 0) + }) + }) + + describe('with a single rejecting configuration', function () { + let stubFn: Simple.Stub>; + beforeEach(function () { + stubFn = simple.stub().rejectWith('example') + }) + + it('can return a promise', function (done) { + let returned = stubFn() + + assert(returned) + + returned.then(fulfilledStub, rejectedStub) + + setTimeout(function () { + assert.equal(fulfilledStub.callCount, 0) + assert.equal(rejectedStub.callCount, 1) + assert.equal(rejectedStub.lastCall.arg, 'example') + done() + }, 0) + }) + }) + + describe('with a multiple rejecting configurations', function () { + let stubFn: Simple.Stub>; + beforeEach(function () { + stubFn = simple.stub().rejectWith('a').rejectWith('b') + }) + + it('can return a promise', function (done) { + let returned = stubFn() + + assert(returned) + + returned.then(fulfilledStub, rejectedStub) + + setTimeout(function () { + assert.equal(fulfilledStub.callCount, 0) + assert.equal(rejectedStub.callCount, 1) + assert.equal(rejectedStub.lastCall.arg, 'a') + done() + }, 0) + }) + + it('can return over multiple calls, looping per default', function (done) { + stubFn().then(fulfilledStub, rejectedStub) + stubFn().then(fulfilledStub, rejectedStub) + stubFn().then(fulfilledStub, rejectedStub) + + setTimeout(function () { + assert.equal(fulfilledStub.callCount, 0) + assert.equal(rejectedStub.callCount, 3) + assert.equal(rejectedStub.calls[0].arg, 'a') + assert.equal(rejectedStub.calls[1].arg, 'b') + assert.equal(rejectedStub.calls[2].arg, 'a') + done() + }, 0) + }) + }) + }) + }) + + describe('mock()', function () { + describe('on a object with prototype', function () { + class ProtoKlass { + protoValue: string = 'x' + protoFn() { + return 'x' + } + } + + let obj: any + + before(function () { + }) + + beforeEach(function () { + obj = new ProtoKlass() + }) + + it('can mock instance values over its prototype\'s and restore', function () { + simple.mock(obj, 'protoValue', 'y') + assert.equal(obj.protoValue, 'y') + simple.restore() + assert.equal(obj.protoValue, 'x') + }) + + it('can mock with custom instance functions over its prototype\'s and restore', function () { + simple.mock(obj, 'protoFn', function () { + return 'y' + }) + assert.equal(obj.protoFn(), 'y') + assert(obj.protoFn.called) + simple.restore() + assert.equal(obj.protoFn(), 'x') + }) + + it('can mock with stubbed functions over its prototype\'s and restore', function () { + simple.mock(obj, 'protoFn').returnWith('y') + assert.equal(obj.protoFn(), 'y') + assert(obj.protoFn.called) + simple.restore() + assert.equal(obj.protoFn(), 'x') + }) + + it('can mock with stubbed functions and prototype\'s original over its prototype\'s and restore', function () { + simple.mock(obj, 'protoFn').returnWith('y').callOriginal().returnWith('z') + assert.equal(obj.protoFn(), 'y') + assert.equal(obj.protoFn(), 'x') + assert.equal(obj.protoFn(), 'z') + assert.equal(obj.protoFn.callCount, 3) + simple.restore() + assert.equal(obj.protoFn(), 'x') + }) + }) + + describe('on an anonymous object', function () { + let obj: any + beforeEach(function () { + obj = { + a: 'a', + b: 'b', + c: 'c', + fnD: function () { + return 'd' + } + } + }) + + it('can mock instance values and restore', function () { + let beforeKeys = Object.keys(obj) + simple.mock(obj, 'a', 'd') + simple.mock(obj, 'd', 'a') + assert.equal(obj.a, 'd') + assert.equal(obj.d, 'a') + simple.restore() + assert.equal(obj.a, 'a') + assert.equal(obj.d, undefined) + assert.deepEqual(Object.keys(obj), beforeKeys) + }) + + it('can mock with spy on pre-existing functions and restore', function () { + simple.mock(obj, 'fnD').returnWith('a') + assert.equal(obj.fnD(), 'a') + assert(obj.fnD.called) + simple.restore() + assert.equal(obj.fnD(), 'd') + }) + + it('can mock with newly stubbed functions and restore', function () { + simple.mock(obj, 'fnA').returnWith('a') + assert.equal(obj.fnA(), 'a') + assert(obj.fnA.called) + simple.restore() + assert.equal(obj.fnA, undefined) + }) + }) + + describe('with one argument', function () { + it('returns a spy', function () { + let called = 0 + + let spy = simple.mock(function () { + called++ + }) + + spy() + assert.equal(called, 1) + assert(spy.called) + }) + }) + + describe('with no arguments', function () { + it('returns a stub', function () { + let stub = simple.mock().returnWith('x') + + let x = stub() + assert(stub.called) + assert(x, 'x') + }) + }) + }) +}) + +simple.Promise = Bluebird; diff --git a/simple-mock/simple-mock.d.ts b/simple-mock/simple-mock.d.ts new file mode 100644 index 000000000..760ef67b4 --- /dev/null +++ b/simple-mock/simple-mock.d.ts @@ -0,0 +1,194 @@ +// Type definitions for simple-mock +// Project: https://github.com/jupiter/simple-mock +// Definitions by: Leon Yu +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare namespace Simple { + type Fn = { + (...args: any[]): T + } + + export interface Static { + /** + * Restores all current mocks. + */ + restore(): void; + + /** + * Wraps fn in a spy and sets this on the obj, restorable with all mocks. + */ + mock(obj: any, key: string, fn: Fn): Stub; + + /** + * Sets the value on this object. E.g. mock(config, 'title', 'test') is the same as config.title = 'test', but restorable with all mocks. + */ + mock(obj: any, key: string, mockValue: T): T; + + /** + * If obj has already has this function, it is wrapped in a spy. The resulting spy can be turned into a stub by further configuration. Restores with all mocks. + */ + mock(obj: any, key: string): Stub; + mock(obj: any, key: string): Stub; + + /** + * Wraps fn in a spy. + */ + spy(fn: Fn): Spy; + /** + * Wraps fn in a spy. + */ + mock(fn: Fn): Spy; + + /** + * Returns a stub function that is also a spy. + */ + stub(): Stub; + stub(): Stub; + + /** + * Returns a stub function that is also a spy. + */ + mock(): Stub; + mock(): Stub; + + Promise?: PromiseConstructorLike; + } + + interface Calls { + /** + * an array of arguments received on the call + */ + args: any[]; + /** + * first argument + */ + arg: any; + /** + * the context (this) of the call + */ + context: any; + /** + * the value returned by the wrapped function + */ + returned: T; + /** + * the error thrown by the wrapped function + */ + threw: Error; + /** + * autoincrementing number, can be compared to evaluate call order + */ + k: number; + } + + export interface Spy{ + (...args: any[]): T; + + called: boolean; + /** + * Number of times the function was called. + */ + callCount: number; + calls: Calls[]; + firstCall: Calls; + /** + * The last call object. (This is often also the first and only call.) + */ + lastCall: Calls; + /** + * Resets all counts and properties to the original state. + */ + reset(): void; + } + + interface Action { + /** + * arguments to call back with + */ + cbArgs: ArrayLike; + returnValue: T; + throwError: Error; + } + + export interface Stub extends Spy { + /** + * Configures this stub to call this function, returning its return value. + * Subsequent calls of this on the same stub (chainable) will queue up different behaviours for each subsequent call of the stub. + */ + callFn(fn: Fn): Stub; + + /** + * Configures this stub to call the original, unstubbed function, returning its return value. + * Subsequent calls of this on the same stub (chainable) will queue up different behaviours for each subsequent call of the stub. + */ + callOriginal(): Stub; + + /** + * Configures this stub to return with this value. + * Subsequent calls of this on the same stub (chainable) will queue up different behaviours for each subsequent call of the stub. + */ + returnWith(val: R): Stub; + + /** + * Configures this stub to throw this error. + * Subsequent calls of this on the same stub (chainable) will queue up different behaviours for each subsequent call of the stub. + */ + throwWith(err: Error): Stub; + + /** + * Configures this stub to call back with the arguments passed. It will use either the last argument as callback, or the argument at cbArgumentIndex. + * Subsequent calls of this on the same stub (chainable) will queue up different behaviours for each subsequent call of the stub. + */ + callback(...args: any[]): Stub; + /** + * Configures this stub to call back with the arguments passed. It will use either the last argument as callback, or the argument at cbArgumentIndex. + * Subsequent calls of this on the same stub (chainable) will queue up different behaviours for each subsequent call of the stub. + */ + callbackWith(...args: any[]): Stub; + + /** + * Configures this stub to call back with the arguments passed. It will use either the last argument as callback, or the argument at cbArgumentIndex. + * Subsequent calls of this on the same stub (chainable) will queue up different behaviours for each subsequent call of the stub. + */ + callbackAtIndex(cbArgumentIndex: number, ...args: any[]): Stub; + /** + * Configures this stub to call back with the arguments passed. It will use either the last argument as callback, or the argument at cbArgumentIndex. + * Subsequent calls of this on the same stub (chainable) will queue up different behaviours for each subsequent call of the stub. + */ + callbackArgWith(cbArgumentIndex: number, ...args: any[]): Stub; + + + /** + * Configures the last configured function or callback to be called in this context, i.e. this will be obj. + */ + inThisContext(obj: any): Stub; + + /** + * Configures the stub to return a Promise (where available] resolving to this value. Same as stub.returnWith(Promise.resolve(val)). + * You can use a custom Promise-conforming library, i.e. simple.Promise = require('bluebird') or simple.Promise = $q. + */ + resolveWith(val: V): Stub>; + + /** + * Configures the stub to return a Promise (where available) rejecting with this error. Same as stub.returnWith(Promise.reject(val)). + * You can use a custom Promise-conforming library, i.e. simple.Promise = require('bluebird') or simple.Promise = $q. + */ + rejectWith(val: V): Stub>; + + /** + * An array of behaviours, each having one of these properties: + */ + actions: Action[]; + + /** + * setting whether the queue of actions for this stub should repeat. + * @default true + */ + loop: boolean; + } +} + +declare module "simple-mock" { + var simple: Simple.Static; + export = simple; +} From 4b57196684aa30d44373ab385104cab303041ded Mon Sep 17 00:00:00 2001 From: tlein Date: Fri, 4 Dec 2015 21:40:29 -0600 Subject: [PATCH 309/389] Add setStrokeDash to easeljs --- easeljs/easeljs-tests.ts | 1 + easeljs/easeljs.d.ts | 2 ++ 2 files changed, 3 insertions(+) diff --git a/easeljs/easeljs-tests.ts b/easeljs/easeljs-tests.ts index b036ae570..c517dba2f 100644 --- a/easeljs/easeljs-tests.ts +++ b/easeljs/easeljs-tests.ts @@ -42,6 +42,7 @@ function test_animation() { function test_graphics() { var g = new createjs.Graphics(); g.setStrokeStyle(1); + g.setStrokeDash([20, 10], 20); g.beginStroke(createjs.Graphics.getRGB(0, 0, 0)); g.beginFill(createjs.Graphics.getRGB(255, 0, 0)); g.drawCircle(0, 0, 3); diff --git a/easeljs/easeljs.d.ts b/easeljs/easeljs.d.ts index 73b45b810..947c760e1 100644 --- a/easeljs/easeljs.d.ts +++ b/easeljs/easeljs.d.ts @@ -344,6 +344,7 @@ declare module createjs { quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): Graphics; rect(x: number, y: number, w: number, h: number): Graphics; setStrokeStyle(thickness: number, caps?: string | number, joints?: string | number, miterLimit?: number, ignoreScale?: boolean): Graphics; + setStrokeDash(segments?: number[], offset?: number): Graphics; store(): Graphics; toString(): string; unstore(): Graphics; @@ -377,6 +378,7 @@ declare module createjs { qt(cpx: number, cpy: number, x: number, y: number): Graphics; r(x: number, y: number, w: number, h: number): Graphics; ss(thickness: number, caps?: string | number, joints?: string | number, miterLimit?: number, ignoreScale?: boolean): Graphics; + sd(segments?: number[], offset?: number): Graphics; } From 2cecb066cea5029e3090f810d588e33fac5ca1dd Mon Sep 17 00:00:00 2001 From: Ian Ker-Seymer Date: Sat, 5 Dec 2015 00:05:30 -0500 Subject: [PATCH 310/389] Add react-bootstrap-daterangepicker definitions --- .../react-bootstrap-daterangepicker-tests.tsx | 7 +++++ .../react-bootstrap-daterangepicker.d.tsx | 29 +++++++++++++++++++ ...ct-bootstrap-daterangepicker.tsx.tscparams | 1 + 3 files changed, 37 insertions(+) create mode 100644 react-bootstrap-daterangepicker/react-bootstrap-daterangepicker-tests.tsx create mode 100644 react-bootstrap-daterangepicker/react-bootstrap-daterangepicker.d.tsx create mode 100644 react-bootstrap-daterangepicker/react-bootstrap-daterangepicker.tsx.tscparams diff --git a/react-bootstrap-daterangepicker/react-bootstrap-daterangepicker-tests.tsx b/react-bootstrap-daterangepicker/react-bootstrap-daterangepicker-tests.tsx new file mode 100644 index 000000000..a18e43013 --- /dev/null +++ b/react-bootstrap-daterangepicker/react-bootstrap-daterangepicker-tests.tsx @@ -0,0 +1,7 @@ +/// +/// + +import * as DateRangePicker from "react-bootstrap-daterangepicker"; +import * as React from "react"; + +let pickerCoponent = true} />; diff --git a/react-bootstrap-daterangepicker/react-bootstrap-daterangepicker.d.tsx b/react-bootstrap-daterangepicker/react-bootstrap-daterangepicker.d.tsx new file mode 100644 index 000000000..e80a258a4 --- /dev/null +++ b/react-bootstrap-daterangepicker/react-bootstrap-daterangepicker.d.tsx @@ -0,0 +1,29 @@ +// Type definitions for react-bootstrap-daterangepicker +// Project: https://github.com/skratchdot/react-bootstrap-daterangepicker +// Definitions by: Ian Ker-Seymer https://github.com/ianks +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// + +declare module ReactBootstrapDaterangepicker { + export interface EventHandler { (event?: any, picker?: any): any; } + + export interface Props extends DatepickerOptions { + onShow?: EventHandler; + onHide?: EventHandler; + onShowCalendar?: EventHandler; + onHideCalendar?: EventHandler; + onApply?: EventHandler; + onCancel?: EventHandler; + onEvent?: EventHandler; + } + + export class DateRangePicker extends __React.Component {} +} + +declare var DateRangePicker: typeof ReactBootstrapDaterangepicker.DateRangePicker; + +declare module "react-bootstrap-daterangepicker" { + export = DateRangePicker; +} diff --git a/react-bootstrap-daterangepicker/react-bootstrap-daterangepicker.tsx.tscparams b/react-bootstrap-daterangepicker/react-bootstrap-daterangepicker.tsx.tscparams new file mode 100644 index 000000000..36c3b9323 --- /dev/null +++ b/react-bootstrap-daterangepicker/react-bootstrap-daterangepicker.tsx.tscparams @@ -0,0 +1 @@ +--noImplicitAny --module commonjs --jsx react From d2e216ec4fd6725fed01b72bd30635340b92dd9a Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Sat, 5 Dec 2015 16:07:17 +0500 Subject: [PATCH 311/389] node: signatures of module "os" have been changed --- node/node-tests.ts | 47 ++++++++++++++++++++++++++++++++++++++++++++++ node/node.d.ts | 26 +++++++++++++++++++++++-- 2 files changed, 71 insertions(+), 2 deletions(-) diff --git a/node/node-tests.ts b/node/node-tests.ts index 930bd1a71..4ca651b33 100644 --- a/node/node-tests.ts +++ b/node/node-tests.ts @@ -14,6 +14,7 @@ import * as querystring from "querystring"; import * as path from "path"; import * as readline from "readline"; import * as childProcess from "child_process"; +import * as os from "os"; assert(1 + 1 - 2 === 0, "The universe isn't how it should."); @@ -411,3 +412,49 @@ rl.question("do you like typescript?", function(answer: string) { childProcess.exec("echo test"); childProcess.spawnSync("echo test"); + +//////////////////////////////////////////////////// +/// os tests : https://nodejs.org/api/os.html +//////////////////////////////////////////////////// + +module os_tests { + { + let result: string; + + result = os.tmpdir(); + result = os.homedir(); + result = os.endianness(); + result = os.hostname(); + result = os.type(); + result = os.platform(); + result = os.arch(); + result = os.release(); + result = os.EOL; + } + + { + let result: number; + + result = os.uptime(); + result = os.totalmem(); + result = os.freemem(); + } + + { + let result: number[]; + + result = os.loadavg(); + } + + { + let result: os.CpuInfo[]; + + result = os.cpus(); + } + + { + let result: {[index: string]: os.NetworkInterfaceInfo[]}; + + result = os.networkInterfaces(); + } +} diff --git a/node/node.d.ts b/node/node.d.ts index 017ca8e6b..39be040a4 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -698,7 +698,29 @@ declare module "zlib" { } declare module "os" { + export interface CpuInfo { + model: string; + speed: number; + times: { + user: number; + nice: number; + sys: number; + idle: number; + irq: number; + } + } + + export interface NetworkInterfaceInfo { + address: string; + netmask: string; + family: string; + mac: string; + internal: boolean; + } + export function tmpdir(): string; + export function homedir(): string; + export function endianness(): string; export function hostname(): string; export function type(): string; export function platform(): string; @@ -708,8 +730,8 @@ declare module "os" { export function loadavg(): number[]; export function totalmem(): number; export function freemem(): number; - export function cpus(): { model: string; speed: number; times: { user: number; nice: number; sys: number; idle: number; irq: number; }; }[]; - export function networkInterfaces(): any; + export function cpus(): CpuInfo[]; + export function networkInterfaces(): {[index: string]: NetworkInterfaceInfo[]}; export var EOL: string; } From 14cc56099a4c90926839e406a87d36596d093708 Mon Sep 17 00:00:00 2001 From: Max Date: Sat, 5 Dec 2015 07:16:13 -0500 Subject: [PATCH 312/389] Overload then, catch, finally definitions --- request-promise/request-promise.d.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/request-promise/request-promise.d.ts b/request-promise/request-promise.d.ts index b35856277..6b5f23fd4 100644 --- a/request-promise/request-promise.d.ts +++ b/request-promise/request-promise.d.ts @@ -12,7 +12,13 @@ declare module 'request-promise' { import request = require('request'); import http = require('http'); - interface RequestPromise extends request.Request, Promise { + interface RequestPromise extends request.Request { + then(onfulfilled?: (value: any) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; + then(onfulfilled?: (value: any) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; + catch(onrejected?: (reason: any) => any | PromiseLike): Promise; + catch(onrejected?: (reason: any) => void): Promise; + finally(handler: () => PromiseLike): Promise; + finally(handler: () => TResult): Promise; promise(): Promise; } From 31def508ff755427b854e5b59a739fbb19cd15ff Mon Sep 17 00:00:00 2001 From: Sam Herrmann Date: Sat, 27 Jun 2015 16:41:10 -0400 Subject: [PATCH 313/389] Add AngularStrap type definitions As documented on the AngularStrap website: http://mgcrea.github.io/angular-strap/ --- angular-strap/angular-strap-tests.ts | 378 +++++++++++++++++ angular-strap/angular-strap.d.ts | 600 +++++++++++++++++++++++++++ 2 files changed, 978 insertions(+) create mode 100644 angular-strap/angular-strap-tests.ts create mode 100644 angular-strap/angular-strap.d.ts diff --git a/angular-strap/angular-strap-tests.ts b/angular-strap/angular-strap-tests.ts new file mode 100644 index 000000000..90c7a2bde --- /dev/null +++ b/angular-strap/angular-strap-tests.ts @@ -0,0 +1,378 @@ +/// +/// + +module angularStrapTests { + + import ngStrap = mgcrea.ngStrap; + + /////////////////////////////////////////////////////////////////////////// + // Modal + /////////////////////////////////////////////////////////////////////////// + + module modalTests { + + interface IDemoCtrlScope extends ngStrap.modal.IModalScope { + showModal: () => void; + } + + angular.module('demoApp') + .config($modalConfig) + .controller('demoCtrl', demoCtrl); + + function demoCtrl($scope: IDemoCtrlScope, + $modal: ngStrap.modal.IModalService): void { + + var myModalOptions: ngStrap.modal.IModalOptions = {}; + myModalOptions.title = 'My Title'; + myModalOptions.content = 'Hello Modal
    This is a multiline message!'; + myModalOptions.show = true; + + var myModal = $modal(myModalOptions); + + var myOtherModalOptions: ngStrap.modal.IModalOptions = {}; + myOtherModalOptions.scope = $scope; + myOtherModalOptions.template = 'modal/docs/modal.demo.tpl.html'; + myOtherModalOptions.show = false; + + var myOtherModal = $modal(myOtherModalOptions); + + $scope.showModal = (): void => { + myOtherModal.$promise.then(myOtherModal.show); + }; + } + + function $modalConfig($modalProvider: ngStrap.modal.IModalProvider): void { + var defaults: ngStrap.modal.IModalOptions = { + animation: 'am-flip-x' + } + angular.extend($modalProvider.defaults, defaults); + } + } + + + /////////////////////////////////////////////////////////////////////////// + // Aside + /////////////////////////////////////////////////////////////////////////// + + module asideTests { + + angular.module('demoApp') + .config($asideConfig) + .controller('demoCtrl', demoCtrl); + + function demoCtrl($scope: ngStrap.aside.IAsideScope, + $aside: ngStrap.aside.IAsideService): void { + + var myAsideOptions: ngStrap.aside.IAsideOptions = {}; + myAsideOptions.title = 'My Title'; + myAsideOptions.content = 'My content'; + myAsideOptions.show = true; + + var myAside = $aside(myAsideOptions); + + var myOtherAsideOptions: ngStrap.aside.IAsideOptions = {}; + myOtherAsideOptions.scope = $scope; + myOtherAsideOptions.template = 'aside/docs/aside.demo.tpl.html'; + + var myOtherAside = $aside(); + + myOtherAside.$promise.then(() => { + myOtherAside.show(); + }); + } + + function $asideConfig($asideProvider: ngStrap.aside.IAsideProvider): void { + var defaults: ngStrap.aside.IAsideOptions = {}; + defaults.animation = 'am-fadeAndSlideLeft'; + defaults.placement = 'left'; + + angular.extend($asideProvider.defaults, defaults); + } + } + + + /////////////////////////////////////////////////////////////////////////// + // Alert + /////////////////////////////////////////////////////////////////////////// + + module alertTests { + + angular.module('demoApp') + .config($alertConfig) + .controller('demoCtrl', demoCtrl); + + function demoCtrl($scope: ngStrap.alert.IAlertScope, + $alert: ngStrap.alert.IAlertService): void { + + var options: ngStrap.alert.IAlertOptions = {}; + options.title = 'Holy guacamole!'; + options.content = 'Best check yo self, you\'re not looking too good.'; + options.placement = 'top'; + options.type = 'info'; + options.show = true; + + var myAlert = $alert(); + } + + function $alertConfig($alertProvider: ngStrap.alert.IAlertProvider): void { + var defaults: ngStrap.alert.IAlertOptions = {}; + defaults.animation = 'am-fade-and-slide-top'; + defaults.placement = 'top'; + + angular.extend($alertProvider.defaults, defaults); + }; + } + + + /////////////////////////////////////////////////////////////////////////// + // Tooltip + /////////////////////////////////////////////////////////////////////////// + + module tooltipTests { + + angular.module('demoApp') + .config($tooltipConfig) + .controller('demoDrct', demoDrct); + + function demoDrct($tooltip: ngStrap.tooltip.ITooltipService): ng.IDirective { + var drct: ng.IDirective = {}; + drct.restrict = 'EA'; + drct.link = link; + return drct; + + function link(scope: ng.IScope, elem: ng.IAugmentedJQuery, attrs: ng.IAttributes): void { + var options: ngStrap.tooltip.ITooltipOptions = {}; + options.title = 'My Title'; + $tooltip(elem, options); + } + } + + function $tooltipConfig($tooltipProvider: ngStrap.tooltip.ITooltipProvider): void { + var defaults: ngStrap.tooltip.ITooltipOptions = {}; + defaults.animation = 'am-flip-x'; + defaults.trigger = 'hover'; + + angular.extend($tooltipProvider.defaults, defaults); + }; + } + + + /////////////////////////////////////////////////////////////////////////// + // Popover + /////////////////////////////////////////////////////////////////////////// + + module popoverTests { + + angular.module('demoApp') + .config($popoverConfig) + .controller('demoDrct', demoDrct); + + function demoDrct($popover: ngStrap.popover.IPopoverService): ng.IDirective { + var drct: ng.IDirective = {}; + drct.restrict = 'EA'; + drct.link = link; + return drct; + + function link(scope: ng.IScope, elem: ng.IAugmentedJQuery, attrs: ng.IAttributes): void { + var options: ngStrap.tooltip.ITooltipOptions = {}; + options.title = 'My Title'; + + $popover(elem, options); + } + } + + function $popoverConfig($popoverProvider: ngStrap.popover.IPopoverProvider): void { + var defaults: ngStrap.tooltip.ITooltipOptions = {} + defaults.animation = 'am-flip-x'; + defaults.trigger = 'hover'; + + angular.extend($popoverProvider.defaults, defaults); + }; + } + + + /////////////////////////////////////////////////////////////////////////// + // Typeahead + /////////////////////////////////////////////////////////////////////////// + + module typeaheadTests { + + angular.module('myApp') + .config($typeaheadConfig); + + function $typeaheadConfig($typeaheadProvider: ngStrap.typeahead.ITypeaheadProvider) { + var defaults: ngStrap.typeahead.ITypeaheadOptions = {} + defaults.animation = 'am-flip-x'; + defaults.minLength = 2; + defaults.limit = 8; + + angular.extend($typeaheadProvider.defaults, defaults); + } + } + + + /////////////////////////////////////////////////////////////////////////// + // Datepicker + /////////////////////////////////////////////////////////////////////////// + + module datepickerTests { + + angular.module('myApp') + .config($datepickerConfig); + + function $datepickerConfig($datepickerProvider: ngStrap.datepicker.IDatepickerProvider): void { + var defaults: ngStrap.datepicker.IDatepickerOptions = {}; + defaults.dateFormat = 'dd/MM/yyyy'; + defaults.startWeek = 1; + + angular.extend($datepickerProvider.defaults, defaults); + }; + } + + + /////////////////////////////////////////////////////////////////////////// + // Timepicker + /////////////////////////////////////////////////////////////////////////// + + module timepickerTests { + + angular.module('myApp') + .config($timepickerConfig); + + function $timepickerConfig($timepickerProvider: ngStrap.timepicker.ITimepickerProvider): void { + var defaults: ngStrap.timepicker.ITimepickerOptions = {}; + defaults.timeFormat = 'HH:mm'; + defaults.length = 7; + + angular.extend($timepickerProvider.defaults, defaults); + }; + } + + + /////////////////////////////////////////////////////////////////////////// + // Select + /////////////////////////////////////////////////////////////////////////// + + module selectTests { + + angular.module('myApp') + .config($selectConfig); + + function $selectConfig($selectProvider: ngStrap.select.ISelectProvider): void { + var defaults: ngStrap.select.ISelectOptions = {}; + defaults.animation = 'am-flip-x'; + defaults.sort = false; + + angular.extend($selectProvider.defaults, defaults); + } + } + + + /////////////////////////////////////////////////////////////////////////// + // Tabs + /////////////////////////////////////////////////////////////////////////// + + module tabTests { + + angular.module('myApp') + .config($tabConfig); + + function $tabConfig($tabProvider: ngStrap.tab.ITabProvider) { + var defaults: ngStrap.tab.ITabOptions = {}; + defaults.animation = 'am-flip-x'; + + angular.extend($tabProvider.defaults, defaults); + } + } + + /////////////////////////////////////////////////////////////////////////// + // Collapse + /////////////////////////////////////////////////////////////////////////// + + module collapseTests { + + angular.module('myApp') + .config($collapseConfig); + + function $collapseConfig($collapseProvider: ngStrap.collapse.ICollapseProvider):void { + var defaults: ngStrap.collapse.ICollapseOptions = {}; + defaults.animation = 'am-flip-x'; + + angular.extend($collapseProvider.defaults, defaults); + } + } + + + /////////////////////////////////////////////////////////////////////////// + // Dropdown + /////////////////////////////////////////////////////////////////////////// + + module dropdownTests { + + angular.module('myApp') + .config($dropdownConfig); + + function $dropdownConfig($dropdownProvider: ngStrap.dropdown.IDropdownProvider):void { + var defaults: ngStrap.dropdown.IDropdownOptions = {}; + defaults.animation = 'am-flip-x'; + defaults.trigger = 'hover'; + + angular.extend($dropdownProvider.defaults, defaults); + } + } + + + /////////////////////////////////////////////////////////////////////////// + // Navbar + /////////////////////////////////////////////////////////////////////////// + + module navbarTests { + + angular.module('myApp') + .config($navbarConfig); + + function $navbarConfig($navbarProvider: ngStrap.navbar.INavbarProvider):void { + var defaults: ngStrap.navbar.INavbarOptions = {}; + defaults.activeClass = 'in'; + + angular.extend($navbarProvider.defaults, defaults); + } + } + + + /////////////////////////////////////////////////////////////////////////// + // Scrollspy + /////////////////////////////////////////////////////////////////////////// + + module scrollspyTests { + + angular.module('myApp') + .config($scrollspyConfig); + + function $scrollspyConfig($scrollspyProvider: ngStrap.scrollspy.IScrollspyProvider):void { + var defaults: ngStrap.scrollspy.IScrollspyOptions = {}; + defaults.offset = 0; + defaults.target = 'my-selector'; + + angular.extend($scrollspyProvider.defaults, defaults); + } + } + + + /////////////////////////////////////////////////////////////////////////// + // Affix + /////////////////////////////////////////////////////////////////////////// + + module affixTests { + + angular.module('myApp') + .config($affixConfig); + + function $affixConfig($affixProvider: ngStrap.affix.IAffixProvider):void { + var defaults: ngStrap.affix.IAffixOptions = {}; + defaults.offsetTop = 100; + + angular.extend($affixProvider.defaults, defaults); + } + } +} \ No newline at end of file diff --git a/angular-strap/angular-strap.d.ts b/angular-strap/angular-strap.d.ts new file mode 100644 index 000000000..10e46bc1c --- /dev/null +++ b/angular-strap/angular-strap.d.ts @@ -0,0 +1,600 @@ +// Type definitions for angular-strap v2.2.x +// Project: http://mgcrea.github.io/angular-strap/ +// Definitions by: Sam Herrmann +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +/// + +declare module mgcrea.ngStrap { + + /////////////////////////////////////////////////////////////////////////// + // Modal + // see http://mgcrea.github.io/angular-strap/#/modals + /////////////////////////////////////////////////////////////////////////// + + module modal { + + interface IModalService { + (config?: IModalOptions): IModal; + } + + interface IModalProvider { + defaults: IModalOptions; + } + + interface IModal { + $promise: ng.IPromise; + show: () => void; + hide: () => void; + toggle: () => void; + } + + interface IModalOptions { + animation?: string; + backdropAnimation?: string; + placement?: string; + title?: string; + content?: string; + html?: boolean; + backdrop?: boolean | string; + keyboard?: boolean; + show?: boolean; + container?: string | boolean; + template?: string; + contentTemplate?: string; + prefixEvent?: string; + id?: string; + scope?: ng.IScope; + } + + interface IModalScope extends ng.IScope { + $show: () => void; + $hide: () => void; + $toggle: () => void; + } + } + + + /////////////////////////////////////////////////////////////////////////// + // Aside + // see http://mgcrea.github.io/angular-strap/#/asides + /////////////////////////////////////////////////////////////////////////// + + module aside { + + interface IAsideService { + (config?: IAsideOptions): IAside; + } + + interface IAsideProvider { + defaults: IAsideOptions; + } + + interface IAside { + $promise: ng.IPromise; + show: () => void; + hide: () => void; + toggle: () => void; + } + + interface IAsideOptions { + animation?: string; + placement?: string; + title?: string; + content?: string; + html?: boolean; + backdrop?: boolean | string; + keyboard?: boolean; + show?: boolean; + container?: string | boolean; + template?: string; + contentTemplate?: string; + scope?: ng.IScope; + } + + interface IAsideScope extends ng.IScope { + $show: () => void; + $hide: () => void; + $toggle: () => void; + } + } + + + + /////////////////////////////////////////////////////////////////////////// + // Alert + // see http://mgcrea.github.io/angular-strap/#/alerts + /////////////////////////////////////////////////////////////////////////// + + module alert { + + interface IAlertService { + (config?: IAlertOptions): IAlert; + } + + interface IAlertProvider { + defaults: IAlertOptions; + } + + interface IAlert { + $promise: ng.IPromise; + show: () => void; + hide: () => void; + toggle: () => void; + } + + interface IAlertOptions { + animation?: string; + placement?: string; + title?: string; + content?: string; + type?: string; + keyboard?: boolean; + show?: boolean; + container?: string | boolean; + template?: string; + duration?: number | boolean; + dismissable?: boolean; + } + + interface IAlertScope extends ng.IScope { + $show: () => void; + $hide: () => void; + $toggle: () => void; + } + } + + + /////////////////////////////////////////////////////////////////////////// + // Tooltip + // see http://mgcrea.github.io/angular-strap/#/tooltips + /////////////////////////////////////////////////////////////////////////// + + module tooltip { + + interface ITooltipService { + (element: ng.IAugmentedJQuery, config?: ITooltipOptions): ITooltip; + } + + interface ITooltipProvider { + defaults: ITooltipOptions; + } + + interface ITooltip { + $promise: ng.IPromise; + show: () => void; + hide: () => void; + toggle: () => void; + } + + interface ITooltipOptions { + animation?: string; + placement?: string; + trigger?: string; + title?: string; + html?: boolean; + delay?: number | { show: number; hide: number}; + container?: string | boolean; + target?: string | ng.IAugmentedJQuery | boolean; + template?: string; + contentTemplate?: string; + prefixEvent?: string; + id?: string; + viewport?: string | { selector: string; padding: string | number }; + } + + interface ITooltipScope extends ng.IScope { + $show: () => void; + $hide: () => void; + $toggle: () => void; + $setEnabled: (isEnabled: boolean) => void; + } + } + + + /////////////////////////////////////////////////////////////////////////// + // Popover + // see http://mgcrea.github.io/angular-strap/#/popovers + /////////////////////////////////////////////////////////////////////////// + + module popover { + + interface IPopoverService { + (element: ng.IAugmentedJQuery, config?: IPopoverOptions): IPopover; + } + + interface IPopoverProvider { + defaults: IPopoverOptions; + } + + interface IPopover { + $promise: ng.IPromise; + show: () => void; + hide: () => void; + toggle: () => void; + } + + interface IPopoverOptions { + animation?: string; + placement?: string; + trigger?: string; + title?: string; + content?: string; + html?: boolean; + delay?: number | { show: number; hide: number }; + container?: string | boolean; + target?: string | ng.IAugmentedJQuery | boolean; + template?: string; + contentTemplate?: string; + autoClose?: boolean; + id?: string; + viewport?: string | { selector: string; padding: string | number }; + } + + interface IPopoverScope extends ng.IScope { + $show: () => void; + $hide: () => void; + $toggle: () => void; + } + } + + + + /////////////////////////////////////////////////////////////////////////// + // Typeahead + // see http://mgcrea.github.io/angular-strap/#/typeaheads + /////////////////////////////////////////////////////////////////////////// + + module typeahead { + + interface ITypeaheadService { + (element: ng.IAugmentedJQuery, controller: any, config?: ITypeaheadOptions): ITypeahead; + } + + interface ITypeaheadProvider { + defaults: ITypeaheadOptions; + } + + interface ITypeahead { + $promise: ng.IPromise; + show: () => void; + hide: () => void; + toggle: () => void; + } + + interface ITypeaheadOptions { + animation?: string; + placement?: string; + trigger?: string; + html?: boolean; + delay?: number | { show: number; hide: number }; + container?: string | boolean; + template?: string; + limit?: number; + minLength?: number; + autoSelect?: boolean; + comparator?: string; + id?: string; + watchOptions?: boolean; + } + } + + + /////////////////////////////////////////////////////////////////////////// + // Datepicker + // see http://mgcrea.github.io/angular-strap/#/datepickers + /////////////////////////////////////////////////////////////////////////// + + module datepicker { + + interface IDatepickerService { + (element: ng.IAugmentedJQuery, controller: any, config?: IDatepickerOptions): IDatepicker; + } + + interface IDatepickerProvider { + defaults: IDatepickerOptions; + } + + interface IDatepicker { + update: (date: Date) => void; + updateDisabledDates: (dateRanges: IDatepickerDateRange[]) => void; + select: (dateConstructorArg: string | number | number[], keep: boolean) => void; + setMode: (mode: any) => void; + int: () => void; + destroy: () => void; + show: () => void; + hide: () => void; + } + + interface IDatepickerDateRange { + start: Date; + end: Date; + } + + interface IDatepickerOptions { + animation?: string; + placement?: string; + trigger?: string; + html?: boolean; + delay?: number | { show: number; hide: number }; + container?: string | boolean; + template?: string; + dateFormat?: string; + modelDateFormat?: string; + dateType?: string; + timezone?: string; + autoclose?: boolean; + useNative?: boolean; + minDate?: Date; + maxDate?: Date; + startView?: number; + minView?: number; + startWeek?: number; + startDate?: Date; + iconLeft?: string; + iconRight?: string; + daysOfWeekDisabled?: string; + disabledDates?: IDatepickerDateRange[]; + } + } + + + /////////////////////////////////////////////////////////////////////////// + // Timepicker + // see http://mgcrea.github.io/angular-strap/#/timepickers + /////////////////////////////////////////////////////////////////////////// + + module timepicker { + + interface ITimepickerService { + (element: ng.IAugmentedJQuery, controller: any, config?: ITimepickerOptions): ITimepicker; + } + + interface ITimepickerProvider { + defaults: ITimepickerOptions; + } + + interface ITimepicker { + + } + + interface ITimepickerOptions { + animation?: string; + placement?: string; + trigger?: string; + html?: boolean; + delay?: number | { show: number; hide: number; }; + container?: string | boolean; + template?: string; + timeFormat?: string; + modelTimeFormat?: string; + timeType?: string; + autoclose?: boolean; + useNative?: boolean; + minTime?: Date; // TODO + maxTime?: Date; // TODO + length?: number; + hourStep?: number; + minuteStep?: number; + secondStep?: number; + roundDisplay?: boolean; + iconUp?: string; + iconDown?: string; + arrowBehaviour?: string; + } + } + + + /////////////////////////////////////////////////////////////////////////// + // Button + // see http://mgcrea.github.io/angular-strap/#/buttons + /////////////////////////////////////////////////////////////////////////// + + // No definitions for this module + + + /////////////////////////////////////////////////////////////////////////// + // Select + // see http://mgcrea.github.io/angular-strap/#/selects + /////////////////////////////////////////////////////////////////////////// + + module select { + + interface ISelectService { + (element: ng.IAugmentedJQuery, controller: any, config: ISelectOptions): ISelect; + } + + interface ISelectProvider { + defaults: ISelectOptions; + } + + interface ISelect { + update: (matches: any) => void; + active: (index: number) => number; + select: (index: number) => void; + show: () => void; + hide: () => void; + } + + interface ISelectOptions { + animation?: string; + placement?: string; + trigger?: string; + html?: boolean; + delay?: number | { show: number; hide: number; }; + container?: string | boolean; + template?: string; + multiple?: boolean; + allNoneButtons?: boolean; + allText?: string; + noneText?: string; + maxLength?: number; + maxLengthHtml?: string; + sort?: boolean; + placeholder?: string; + iconCheckmark?: string; + id?: string; + } + } + + /////////////////////////////////////////////////////////////////////////// + // Tabs + // see http://mgcrea.github.io/angular-strap/#/tabs + /////////////////////////////////////////////////////////////////////////// + + module tab { + + interface ITabProvider { + defaults: ITabOptions; + } + + interface ITabService { + defaults: ITabOptions; + controller: any; + } + + interface ITabOptions { + animation?: string; + template?: string; + navClass?: string; + activeClass?: string; + } + } + + + /////////////////////////////////////////////////////////////////////////// + // Collapses + // see http://mgcrea.github.io/angular-strap/#/collapses + /////////////////////////////////////////////////////////////////////////// + + module collapse { + + interface ICollapseProvider { + defaults: ICollapseOptions; + } + + interface ICollapseOptions { + animation?: string; + activeClass?: string; + disallowToggle?: boolean; + startCollapsed?: boolean; + allowMultiple?: boolean; + } + } + + + /////////////////////////////////////////////////////////////////////////// + // Dropdowsn + // see http://mgcrea.github.io/angular-strap/#/dropdowns + /////////////////////////////////////////////////////////////////////////// + + module dropdown { + + interface IDropdownProvider { + defaults: IDropdownOptions; + } + + interface IDropdownService { + (element: ng.IAugmentedJQuery, config: IDropdownOptions): IDropdown; + } + + interface IDropdown { + show: () => void; + hide: () => void; + destroy: () => void; + } + + interface IDropdownOptions { + animation?: string; + placement?: string; + trigger?: string; + html?: boolean; + delay?: number | { show: number; hide: number; }; + container?: string | boolean; + template?: string; + } + } + + + /////////////////////////////////////////////////////////////////////////// + // Navbar + // see http://mgcrea.github.io/angular-strap/#/navbars + /////////////////////////////////////////////////////////////////////////// + + module navbar { + + interface INavbarProvider { + defaults: INavbarOptions; + } + + interface INavbarOptions { + activeClass?: string; + routeAttr?: string; + } + + interface INavbarService { + defaults: INavbarOptions; + } + } + + + /////////////////////////////////////////////////////////////////////////// + // Scrollspy + // see http://mgcrea.github.io/angular-strap/#/scrollspy + /////////////////////////////////////////////////////////////////////////// + + module scrollspy { + + interface IScrollspyProvider { + defaults: IScrollspyOptions; + } + + interface IScrollspyService { + (element: ng.IAugmentedJQuery, options: IScrollspyOptions): IScrollspy; + } + + interface IScrollspy { + checkOffsets: () => void; + trackElement: (target: any, source: any) => void; + untrackElement: (target: any, source: any) => void; + activate: (index: number) => void; + } + + interface IScrollspyOptions { + target?: string; + offset?: number; + } + } + + + /////////////////////////////////////////////////////////////////////////// + // Affix + // see http://mgcrea.github.io/angular-strap/#/affix + /////////////////////////////////////////////////////////////////////////// + + module affix { + + interface IAffixProvider { + defaults: IAffixOptions; + } + + interface IAffixService { + (element: ng.IAugmentedJQuery, options: IAffixOptions): IAffix; + } + + interface IAffix { + init: () => void; + destroy: () => void; + checkPositionWithEventLoop: () => void; + checkPosition: () => void; + } + + interface IAffixOptions { + offsetTop?: number; + offsetBottom?: number; + offsetParent?: number; + offsetUnpin?: number; + } + } +} From f913f681ac646953c312343d8c0a2c76105fb409 Mon Sep 17 00:00:00 2001 From: Ahto Jussila Date: Sat, 5 Dec 2015 17:55:44 +0200 Subject: [PATCH 314/389] allow arbitrary key names when setting defaults --- nconf/nconf-tests.ts | 2 ++ nconf/nconf.d.ts | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/nconf/nconf-tests.ts b/nconf/nconf-tests.ts index 7037abfb6..673c05dca 100644 --- a/nconf/nconf-tests.ts +++ b/nconf/nconf-tests.ts @@ -48,6 +48,8 @@ p = nconf.use(str, opts); p = nconf.defaults(); p = nconf.defaults(opts); +p = nconf.defaults({foo: 'bar'}); + nconf.init(); nconf.init(opts); diff --git a/nconf/nconf.d.ts b/nconf/nconf.d.ts index ee59591fd..8453bfca8 100644 --- a/nconf/nconf.d.ts +++ b/nconf/nconf.d.ts @@ -48,11 +48,12 @@ declare module "nconf" { parse: (str: string) => any; } - export interface IOptions { - type?: string; + export interface IOptions { + [index: string]: any; } - export interface IFileOptions extends IOptions { + export interface IFileOptions { + type?: string; file?: string; dir?: string; search?: boolean; From d54b18e0ac3277376700b6026ef9e9e3f380df50 Mon Sep 17 00:00:00 2001 From: Peter Burns Date: Sat, 5 Dec 2015 10:39:59 -0800 Subject: [PATCH 315/389] ProgressBar should also be a module, for ES6 importing --- progress/progress.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/progress/progress.d.ts b/progress/progress.d.ts index 2c7e683ec..afb8ccf73 100644 --- a/progress/progress.d.ts +++ b/progress/progress.d.ts @@ -115,7 +115,7 @@ declare module "progress" */ terminate():void; } - + module ProgressBar { } export = ProgressBar; } From d4c62f32974272b0133a2b45fd1b1585a2531b71 Mon Sep 17 00:00:00 2001 From: Vinh Tran Date: Sat, 5 Dec 2015 15:15:10 -0500 Subject: [PATCH 316/389] Update interface DirectionRequest Added ```LatLngLiteral``` as an option type for ```origin``` and ```destination``` fields for DirectionRequest. Reference: [https://developers.google.com/maps/documentation/javascript/reference#Place](https://developers.google.com/maps/documentation/javascript/reference#Place) --- googlemaps/google.maps.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/googlemaps/google.maps.d.ts b/googlemaps/google.maps.d.ts index 770151f33..87b10991e 100644 --- a/googlemaps/google.maps.d.ts +++ b/googlemaps/google.maps.d.ts @@ -911,10 +911,10 @@ declare module google.maps { avoidFerries?: boolean; avoidHighways?: boolean; avoidTolls?: boolean; - destination?: LatLng|string; + destination?: LatLng|LatLngLiteral|string; durationInTraffic?: boolean; optimizeWaypoints?: boolean; - origin?: LatLng|string; + origin?: LatLng|LatLngLiteral|string; provideRouteAlternatives?: boolean; region?: string; transitOptions?: TransitOptions; From 4f1c2d48e09fb33d65c7b4241ba09453f1ce7820 Mon Sep 17 00:00:00 2001 From: Vinh Tran Date: Sat, 5 Dec 2015 15:52:10 -0500 Subject: [PATCH 317/389] Update DirectionsWaypoint's location field optional types --- googlemaps/google.maps.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/googlemaps/google.maps.d.ts b/googlemaps/google.maps.d.ts index 87b10991e..699115473 100644 --- a/googlemaps/google.maps.d.ts +++ b/googlemaps/google.maps.d.ts @@ -959,7 +959,7 @@ declare module google.maps { export interface TransitFare { } export interface DirectionsWaypoint { - location: LatLng|string; + location: LatLng|LatLngLiteral|string; stopover: boolean; } From f08f279bd095ac9a197fea3ce4767de3e5dce493 Mon Sep 17 00:00:00 2001 From: Tim Perry Date: Sun, 6 Dec 2015 01:25:08 +0100 Subject: [PATCH 318/389] Add more detailed types to Chrome storage callbacks --- chrome/chrome-tests.ts | 8 ++ chrome/chrome.d.ts | 255 +++++++++++++++++++++-------------------- 2 files changed, 136 insertions(+), 127 deletions(-) diff --git a/chrome/chrome-tests.ts b/chrome/chrome-tests.ts index 341738435..e184a8216 100644 --- a/chrome/chrome-tests.ts +++ b/chrome/chrome-tests.ts @@ -254,3 +254,11 @@ function testOptionsPage() { }); } +chrome.storage.sync.get("myKey", function (loadedData) { + var myValue: { x: number } = loadedData["myKey"]; +}); + +chrome.storage.onChanged.addListener(function (changes) { + var myNewValue: { x: number } = changes["myKey"].newValue; + var myOldValue: { x: number } = changes["myKey"].oldValue; +}); diff --git a/chrome/chrome.d.ts b/chrome/chrome.d.ts index b27891704..3d8039fc1 100755 --- a/chrome/chrome.d.ts +++ b/chrome/chrome.d.ts @@ -5866,139 +5866,140 @@ declare module chrome.sessions { * @since Chrome 20. */ declare module chrome.storage { - interface StorageArea { - /** - * Gets the amount of space (in bytes) being used by one or more items. - * @param callback Callback with the amount of space being used by storage, or on failure (in which case runtime.lastError will be set). - * Parameter bytesInUse: Amount of space being used in storage, in bytes. - */ - getBytesInUse(callback: (bytesInUse: number) => void): void; - /** - * Gets the amount of space (in bytes) being used by one or more items. - * @param key A single key to get the total usage for. Pass in null to get the total usage of all of storage. - * @param callback Callback with the amount of space being used by storage, or on failure (in which case runtime.lastError will be set). - * Parameter bytesInUse: Amount of space being used in storage, in bytes. - */ - getBytesInUse(key: string, callback: (bytesInUse: number) => void): void; - /** - * Gets the amount of space (in bytes) being used by one or more items. - * @param keys A list of keys to get the total usage for. An empty list will return 0. Pass in null to get the total usage of all of storage. - * @param callback Callback with the amount of space being used by storage, or on failure (in which case runtime.lastError will be set). - * Parameter bytesInUse: Amount of space being used in storage, in bytes. - */ - getBytesInUse(keys: string[], callback: (bytesInUse: number) => void): void; - /** - * Removes all items from storage. - * @param callback Optional. - * Callback on success, or on failure (in which case runtime.lastError will be set). - */ - clear(callback?: () => void): void; - /** - * Sets multiple items. - * @param items An object which gives each key/value pair to update storage with. Any other key/value pairs in storage will not be affected. - * Primitive values such as numbers will serialize as expected. Values with a typeof "object" and "function" will typically serialize to {}, with the exception of Array (serializes as expected), Date, and Regex (serialize using their String representation). - * @param callback Optional. - * Callback on success, or on failure (in which case runtime.lastError will be set). - */ - set(items: Object, callback?: () => void): void; - /** - * Removes one item from storage. - * @param key A single key for items to remove. - * @param callback Optional. - * Callback on success, or on failure (in which case runtime.lastError will be set). - */ - remove(key: string, callback?: () => void): void; - /** - * Removes items from storage. - * @param keys A list of keys for items to remove. - * @param callback Optional. - * Callback on success, or on failure (in which case runtime.lastError will be set). - */ - remove(keys: string[], callback?: () => void): void; - /** - * Gets one or more items from storage. - * @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set). - * Parameter items: Object with items in their key-value mappings. - */ - get(callback: (items: Object) => void): void; - /** - * Gets one or more items from storage. - * @param key A single key to get. Pass in null to get the entire contents of storage. - * @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set). - * Parameter items: Object with items in their key-value mappings. - */ - get(key: string, callback: (items: Object) => void): void; - /** - * Gets one or more items from storage. - * @param keys A list of keys to get. An empty list or object will return an empty result object. Pass in null to get the entire contents of storage. - * @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set). - * Parameter items: Object with items in their key-value mappings. - */ - get(keys: string[], callback: (items: Object) => void): void; - /** - * Gets one or more items from storage. - * @param keys A dictionary specifying default values. Pass in null to get the entire contents of storage. - * @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set). - * Parameter items: Object with items in their key-value mappings. - */ - get(keys: Object, callback: (items: Object) => void): void; - } + interface StorageArea { + /** + * Gets the amount of space (in bytes) being used by one or more items. + * @param callback Callback with the amount of space being used by storage, or on failure (in which case runtime.lastError will be set). + * Parameter bytesInUse: Amount of space being used in storage, in bytes. + */ + getBytesInUse(callback: (bytesInUse: number) => void): void; + /** + * Gets the amount of space (in bytes) being used by one or more items. + * @param key A single key to get the total usage for. Pass in null to get the total usage of all of storage. + * @param callback Callback with the amount of space being used by storage, or on failure (in which case runtime.lastError will be set). + * Parameter bytesInUse: Amount of space being used in storage, in bytes. + */ + getBytesInUse(key: string, callback: (bytesInUse: number) => void): void; + /** + * Gets the amount of space (in bytes) being used by one or more items. + * @param keys A list of keys to get the total usage for. An empty list will return 0. Pass in null to get the total usage of all of storage. + * @param callback Callback with the amount of space being used by storage, or on failure (in which case runtime.lastError will be set). + * Parameter bytesInUse: Amount of space being used in storage, in bytes. + */ + getBytesInUse(keys: string[], callback: (bytesInUse: number) => void): void; + /** + * Removes all items from storage. + * @param callback Optional. + * Callback on success, or on failure (in which case runtime.lastError will be set). + */ + clear(callback?: () => void): void; + /** + * Sets multiple items. + * @param items An object which gives each key/value pair to update storage with. Any other key/value pairs in storage will not be affected. + * Primitive values such as numbers will serialize as expected. Values with a typeof "object" and "function" will typically serialize to {}, with the exception of Array (serializes as expected), Date, and Regex (serialize using their String representation). + * @param callback Optional. + * Callback on success, or on failure (in which case runtime.lastError will be set). + */ + set(items: Object, callback?: () => void): void; + /** + * Removes one item from storage. + * @param key A single key for items to remove. + * @param callback Optional. + * Callback on success, or on failure (in which case runtime.lastError will be set). + */ + remove(key: string, callback?: () => void): void; + /** + * Removes items from storage. + * @param keys A list of keys for items to remove. + * @param callback Optional. + * Callback on success, or on failure (in which case runtime.lastError will be set). + */ + remove(keys: string[], callback?: () => void): void; + /** + * Gets one or more items from storage. + * @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set). + * Parameter items: Object with items in their key-value mappings. + */ + get(callback: (items: { [key: string]: any }) => void): void; + /** + * Gets one or more items from storage. + * @param key A single key to get. Pass in null to get the entire contents of storage. + * @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set). + * Parameter items: Object with items in their key-value mappings. + */ + get(key: string, callback: (items: { [key: string]: any }) => void): void; + /** + * Gets one or more items from storage. + * @param keys A list of keys to get. An empty list or object will return an empty result object. Pass in null to get the entire contents of storage. + * @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set). + * Parameter items: Object with items in their key-value mappings. + */ + get(keys: string[], callback: (items: { [key: string]: any }) => void): void; + /** + * Gets one or more items from storage. + * @param keys A dictionary specifying default values. Pass in null to get the entire contents of storage. + * @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set). + * Parameter items: Object with items in their key-value mappings. + */ + get(keys: Object, callback: (items: { [key: string]: any }) => void): void; + } - interface StorageChange { - /** Optional. The new value of the item, if there is a new value. */ - newValue?: any; - /** Optional. The old value of the item, if there was an old value. */ - oldValue?: any; - } + interface StorageChange { + /** Optional. The new value of the item, if there is a new value. */ + newValue?: any; + /** Optional. The old value of the item, if there was an old value. */ + oldValue?: any; + } - interface LocalStorageArea extends StorageArea { - /** The maximum amount (in bytes) of data that can be stored in local storage, as measured by the JSON stringification of every value plus every key's length. This value will be ignored if the extension has the unlimitedStorage permission. Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. */ - QUOTA_BYTES: number; - } + interface LocalStorageArea extends StorageArea { + /** The maximum amount (in bytes) of data that can be stored in local storage, as measured by the JSON stringification of every value plus every key's length. This value will be ignored if the extension has the unlimitedStorage permission. Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. */ + QUOTA_BYTES: number; + } - interface SyncStorageArea extends StorageArea { - /** @deprecated since Chrome 40. The storage.sync API no longer has a sustained write operation quota. */ - MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE: number; - /** The maximum total amount (in bytes) of data that can be stored in sync storage, as measured by the JSON stringification of every value plus every key's length. Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. */ - QUOTA_BYTES: number; - /** The maximum size (in bytes) of each individual item in sync storage, as measured by the JSON stringification of its value plus its key length. Updates containing items larger than this limit will fail immediately and set runtime.lastError. */ - QUOTA_BYTES_PER_ITEM: number; - /** The maximum number of items that can be stored in sync storage. Updates that would cause this limit to be exceeded will fail immediately and set runtime.lastError. */ - MAX_ITEMS: number; - /** - * The maximum number of set, remove, or clear operations that can be performed each hour. This is 1 every 2 seconds, a lower ceiling than the short term higher writes-per-minute limit. - * Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. - */ - MAX_WRITE_OPERATIONS_PER_HOUR: number; - /** - * The maximum number of set, remove, or clear operations that can be performed each minute. This is 2 per second, providing higher throughput than writes-per-hour over a shorter period of time. - * Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. - * @since Chrome 40. - */ - MAX_WRITE_OPERATIONS_PER_MINUTE: number; - } + interface SyncStorageArea extends StorageArea { + /** @deprecated since Chrome 40. The storage.sync API no longer has a sustained write operation quota. */ + MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE: number; + /** The maximum total amount (in bytes) of data that can be stored in sync storage, as measured by the JSON stringification of every value plus every key's length. Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. */ + QUOTA_BYTES: number; + /** The maximum size (in bytes) of each individual item in sync storage, as measured by the JSON stringification of its value plus its key length. Updates containing items larger than this limit will fail immediately and set runtime.lastError. */ + QUOTA_BYTES_PER_ITEM: number; + /** The maximum number of items that can be stored in sync storage. Updates that would cause this limit to be exceeded will fail immediately and set runtime.lastError. */ + MAX_ITEMS: number; + /** + * The maximum number of set, remove, or clear operations that can be performed each hour. This is 1 every 2 seconds, a lower ceiling than the short term higher writes-per-minute limit. + * Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. + */ + MAX_WRITE_OPERATIONS_PER_HOUR: number; + /** + * The maximum number of set, remove, or clear operations that can be performed each minute. This is 2 per second, providing higher throughput than writes-per-hour over a shorter period of time. + * Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. + * @since Chrome 40. + */ + MAX_WRITE_OPERATIONS_PER_MINUTE: number; + } - interface StorageChangedEvent extends chrome.events.Event { - /** - * @param callback - * Parameter changes: Object mapping each key that changed to its corresponding storage.StorageChange for that item. - * Parameter areaName: Since Chrome 22. The name of the storage area ("sync", "local" or "managed") the changes are for. - */ - addListener(callback: (changes: Object, areaName: string) => void): void; - } + interface StorageChangedEvent extends chrome.events.Event { + /** + * @param callback + * Parameter changes: Object mapping each key that changed to its corresponding storage.StorageChange for that item. + * Parameter areaName: Since Chrome 22. The name of the storage area ("sync", "local" or "managed") the changes are for. + */ + addListener(callback: (changes: { [key: string]: StorageChange }, areaName: string) => void): void; + } - /** Items in the local storage area are local to each machine. */ - var local: LocalStorageArea; - /** Items in the sync storage area are synced using Chrome Sync. */ - var sync: SyncStorageArea; - /** - * Items in the managed storage area are set by the domain administrator, and are read-only for the extension; trying to modify this namespace results in an error. - * @since Chrome 33. - */ - var managed: StorageArea; + /** Items in the local storage area are local to each machine. */ + var local: LocalStorageArea; + /** Items in the sync storage area are synced using Chrome Sync. */ + var sync: SyncStorageArea; - /** Fired when one or more items change. */ - var onChanged: StorageChangedEvent; + /** + * Items in the managed storage area are set by the domain administrator, and are read-only for the extension; trying to modify this namespace results in an error. + * @since Chrome 33. + */ + var managed: StorageArea; + + /** Fired when one or more items change. */ + var onChanged: StorageChangedEvent; } //////////////////// From efd7d6ca8a4da4a9c89d28dd0d95a2f2a9830be2 Mon Sep 17 00:00:00 2001 From: Tim Perry Date: Sun, 6 Dec 2015 01:34:49 +0100 Subject: [PATCH 319/389] Fix up chrome storage indentation properly while I'm here --- chrome/chrome.d.ts | 254 ++++++++++++++++++++++----------------------- 1 file changed, 127 insertions(+), 127 deletions(-) diff --git a/chrome/chrome.d.ts b/chrome/chrome.d.ts index 3d8039fc1..7db591be2 100755 --- a/chrome/chrome.d.ts +++ b/chrome/chrome.d.ts @@ -5866,140 +5866,140 @@ declare module chrome.sessions { * @since Chrome 20. */ declare module chrome.storage { - interface StorageArea { - /** - * Gets the amount of space (in bytes) being used by one or more items. - * @param callback Callback with the amount of space being used by storage, or on failure (in which case runtime.lastError will be set). - * Parameter bytesInUse: Amount of space being used in storage, in bytes. - */ - getBytesInUse(callback: (bytesInUse: number) => void): void; - /** - * Gets the amount of space (in bytes) being used by one or more items. - * @param key A single key to get the total usage for. Pass in null to get the total usage of all of storage. - * @param callback Callback with the amount of space being used by storage, or on failure (in which case runtime.lastError will be set). - * Parameter bytesInUse: Amount of space being used in storage, in bytes. - */ - getBytesInUse(key: string, callback: (bytesInUse: number) => void): void; - /** - * Gets the amount of space (in bytes) being used by one or more items. - * @param keys A list of keys to get the total usage for. An empty list will return 0. Pass in null to get the total usage of all of storage. - * @param callback Callback with the amount of space being used by storage, or on failure (in which case runtime.lastError will be set). - * Parameter bytesInUse: Amount of space being used in storage, in bytes. - */ - getBytesInUse(keys: string[], callback: (bytesInUse: number) => void): void; - /** - * Removes all items from storage. - * @param callback Optional. - * Callback on success, or on failure (in which case runtime.lastError will be set). - */ - clear(callback?: () => void): void; - /** - * Sets multiple items. - * @param items An object which gives each key/value pair to update storage with. Any other key/value pairs in storage will not be affected. - * Primitive values such as numbers will serialize as expected. Values with a typeof "object" and "function" will typically serialize to {}, with the exception of Array (serializes as expected), Date, and Regex (serialize using their String representation). - * @param callback Optional. - * Callback on success, or on failure (in which case runtime.lastError will be set). - */ - set(items: Object, callback?: () => void): void; - /** - * Removes one item from storage. - * @param key A single key for items to remove. - * @param callback Optional. - * Callback on success, or on failure (in which case runtime.lastError will be set). - */ - remove(key: string, callback?: () => void): void; - /** - * Removes items from storage. - * @param keys A list of keys for items to remove. - * @param callback Optional. - * Callback on success, or on failure (in which case runtime.lastError will be set). - */ - remove(keys: string[], callback?: () => void): void; - /** - * Gets one or more items from storage. - * @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set). - * Parameter items: Object with items in their key-value mappings. - */ - get(callback: (items: { [key: string]: any }) => void): void; - /** - * Gets one or more items from storage. - * @param key A single key to get. Pass in null to get the entire contents of storage. - * @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set). - * Parameter items: Object with items in their key-value mappings. - */ - get(key: string, callback: (items: { [key: string]: any }) => void): void; - /** - * Gets one or more items from storage. - * @param keys A list of keys to get. An empty list or object will return an empty result object. Pass in null to get the entire contents of storage. - * @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set). - * Parameter items: Object with items in their key-value mappings. - */ - get(keys: string[], callback: (items: { [key: string]: any }) => void): void; - /** - * Gets one or more items from storage. - * @param keys A dictionary specifying default values. Pass in null to get the entire contents of storage. - * @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set). - * Parameter items: Object with items in their key-value mappings. - */ - get(keys: Object, callback: (items: { [key: string]: any }) => void): void; - } + interface StorageArea { + /** + * Gets the amount of space (in bytes) being used by one or more items. + * @param callback Callback with the amount of space being used by storage, or on failure (in which case runtime.lastError will be set). + * Parameter bytesInUse: Amount of space being used in storage, in bytes. + */ + getBytesInUse(callback: (bytesInUse: number) => void): void; + /** + * Gets the amount of space (in bytes) being used by one or more items. + * @param key A single key to get the total usage for. Pass in null to get the total usage of all of storage. + * @param callback Callback with the amount of space being used by storage, or on failure (in which case runtime.lastError will be set). + * Parameter bytesInUse: Amount of space being used in storage, in bytes. + */ + getBytesInUse(key: string, callback: (bytesInUse: number) => void): void; + /** + * Gets the amount of space (in bytes) being used by one or more items. + * @param keys A list of keys to get the total usage for. An empty list will return 0. Pass in null to get the total usage of all of storage. + * @param callback Callback with the amount of space being used by storage, or on failure (in which case runtime.lastError will be set). + * Parameter bytesInUse: Amount of space being used in storage, in bytes. + */ + getBytesInUse(keys: string[], callback: (bytesInUse: number) => void): void; + /** + * Removes all items from storage. + * @param callback Optional. + * Callback on success, or on failure (in which case runtime.lastError will be set). + */ + clear(callback?: () => void): void; + /** + * Sets multiple items. + * @param items An object which gives each key/value pair to update storage with. Any other key/value pairs in storage will not be affected. + * Primitive values such as numbers will serialize as expected. Values with a typeof "object" and "function" will typically serialize to {}, with the exception of Array (serializes as expected), Date, and Regex (serialize using their String representation). + * @param callback Optional. + * Callback on success, or on failure (in which case runtime.lastError will be set). + */ + set(items: Object, callback?: () => void): void; + /** + * Removes one item from storage. + * @param key A single key for items to remove. + * @param callback Optional. + * Callback on success, or on failure (in which case runtime.lastError will be set). + */ + remove(key: string, callback?: () => void): void; + /** + * Removes items from storage. + * @param keys A list of keys for items to remove. + * @param callback Optional. + * Callback on success, or on failure (in which case runtime.lastError will be set). + */ + remove(keys: string[], callback?: () => void): void; + /** + * Gets one or more items from storage. + * @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set). + * Parameter items: Object with items in their key-value mappings. + */ + get(callback: (items: { [key: string]: any }) => void): void; + /** + * Gets one or more items from storage. + * @param key A single key to get. Pass in null to get the entire contents of storage. + * @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set). + * Parameter items: Object with items in their key-value mappings. + */ + get(key: string, callback: (items: { [key: string]: any }) => void): void; + /** + * Gets one or more items from storage. + * @param keys A list of keys to get. An empty list or object will return an empty result object. Pass in null to get the entire contents of storage. + * @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set). + * Parameter items: Object with items in their key-value mappings. + */ + get(keys: string[], callback: (items: { [key: string]: any }) => void): void; + /** + * Gets one or more items from storage. + * @param keys A dictionary specifying default values. Pass in null to get the entire contents of storage. + * @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set). + * Parameter items: Object with items in their key-value mappings. + */ + get(keys: Object, callback: (items: { [key: string]: any }) => void): void; + } - interface StorageChange { - /** Optional. The new value of the item, if there is a new value. */ - newValue?: any; - /** Optional. The old value of the item, if there was an old value. */ - oldValue?: any; - } + interface StorageChange { + /** Optional. The new value of the item, if there is a new value. */ + newValue?: any; + /** Optional. The old value of the item, if there was an old value. */ + oldValue?: any; + } - interface LocalStorageArea extends StorageArea { - /** The maximum amount (in bytes) of data that can be stored in local storage, as measured by the JSON stringification of every value plus every key's length. This value will be ignored if the extension has the unlimitedStorage permission. Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. */ - QUOTA_BYTES: number; - } + interface LocalStorageArea extends StorageArea { + /** The maximum amount (in bytes) of data that can be stored in local storage, as measured by the JSON stringification of every value plus every key's length. This value will be ignored if the extension has the unlimitedStorage permission. Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. */ + QUOTA_BYTES: number; + } - interface SyncStorageArea extends StorageArea { - /** @deprecated since Chrome 40. The storage.sync API no longer has a sustained write operation quota. */ - MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE: number; - /** The maximum total amount (in bytes) of data that can be stored in sync storage, as measured by the JSON stringification of every value plus every key's length. Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. */ - QUOTA_BYTES: number; - /** The maximum size (in bytes) of each individual item in sync storage, as measured by the JSON stringification of its value plus its key length. Updates containing items larger than this limit will fail immediately and set runtime.lastError. */ - QUOTA_BYTES_PER_ITEM: number; - /** The maximum number of items that can be stored in sync storage. Updates that would cause this limit to be exceeded will fail immediately and set runtime.lastError. */ - MAX_ITEMS: number; - /** - * The maximum number of set, remove, or clear operations that can be performed each hour. This is 1 every 2 seconds, a lower ceiling than the short term higher writes-per-minute limit. - * Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. - */ - MAX_WRITE_OPERATIONS_PER_HOUR: number; - /** - * The maximum number of set, remove, or clear operations that can be performed each minute. This is 2 per second, providing higher throughput than writes-per-hour over a shorter period of time. - * Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. - * @since Chrome 40. - */ - MAX_WRITE_OPERATIONS_PER_MINUTE: number; - } + interface SyncStorageArea extends StorageArea { + /** @deprecated since Chrome 40. The storage.sync API no longer has a sustained write operation quota. */ + MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE: number; + /** The maximum total amount (in bytes) of data that can be stored in sync storage, as measured by the JSON stringification of every value plus every key's length. Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. */ + QUOTA_BYTES: number; + /** The maximum size (in bytes) of each individual item in sync storage, as measured by the JSON stringification of its value plus its key length. Updates containing items larger than this limit will fail immediately and set runtime.lastError. */ + QUOTA_BYTES_PER_ITEM: number; + /** The maximum number of items that can be stored in sync storage. Updates that would cause this limit to be exceeded will fail immediately and set runtime.lastError. */ + MAX_ITEMS: number; + /** + * The maximum number of set, remove, or clear operations that can be performed each hour. This is 1 every 2 seconds, a lower ceiling than the short term higher writes-per-minute limit. + * Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. + */ + MAX_WRITE_OPERATIONS_PER_HOUR: number; + /** + * The maximum number of set, remove, or clear operations that can be performed each minute. This is 2 per second, providing higher throughput than writes-per-hour over a shorter period of time. + * Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. + * @since Chrome 40. + */ + MAX_WRITE_OPERATIONS_PER_MINUTE: number; + } - interface StorageChangedEvent extends chrome.events.Event { - /** - * @param callback - * Parameter changes: Object mapping each key that changed to its corresponding storage.StorageChange for that item. - * Parameter areaName: Since Chrome 22. The name of the storage area ("sync", "local" or "managed") the changes are for. - */ - addListener(callback: (changes: { [key: string]: StorageChange }, areaName: string) => void): void; - } + interface StorageChangedEvent extends chrome.events.Event { + /** + * @param callback + * Parameter changes: Object mapping each key that changed to its corresponding storage.StorageChange for that item. + * Parameter areaName: Since Chrome 22. The name of the storage area ("sync", "local" or "managed") the changes are for. + */ + addListener(callback: (changes: { [key: string]: StorageChange }, areaName: string) => void): void; + } - /** Items in the local storage area are local to each machine. */ - var local: LocalStorageArea; - /** Items in the sync storage area are synced using Chrome Sync. */ - var sync: SyncStorageArea; + /** Items in the local storage area are local to each machine. */ + var local: LocalStorageArea; + /** Items in the sync storage area are synced using Chrome Sync. */ + var sync: SyncStorageArea; - /** - * Items in the managed storage area are set by the domain administrator, and are read-only for the extension; trying to modify this namespace results in an error. - * @since Chrome 33. - */ - var managed: StorageArea; + /** + * Items in the managed storage area are set by the domain administrator, and are read-only for the extension; trying to modify this namespace results in an error. + * @since Chrome 33. + */ + var managed: StorageArea; - /** Fired when one or more items change. */ - var onChanged: StorageChangedEvent; + /** Fired when one or more items change. */ + var onChanged: StorageChangedEvent; } //////////////////// From 791ab3bf260e1626ff7fa4df5eb1bda93ae03faa Mon Sep 17 00:00:00 2001 From: Nina Chaubal Date: Sat, 5 Dec 2015 21:23:17 -0600 Subject: [PATCH 320/389] FirebaseQuery.equalTo can take boolean values. See https://www.firebase.com/docs/web/api/query/equalto.html --- firebase/firebase.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/firebase/firebase.d.ts b/firebase/firebase.d.ts index df792c713..744411ab2 100644 --- a/firebase/firebase.d.ts +++ b/firebase/firebase.d.ts @@ -143,6 +143,7 @@ interface FirebaseQuery { */ equalTo(value: string, key?: string): FirebaseQuery; equalTo(value: number, key?: string): FirebaseQuery; + equalTo(value: boolean, key?: string): FirebaseQuery; /** * Generates a new Query object limited to the first certain number of children. */ From 01efb63365676e6db39bdc7b3891121b172b6b45 Mon Sep 17 00:00:00 2001 From: sodatea Date: Sun, 29 Nov 2015 01:27:37 +0800 Subject: [PATCH 321/389] Update tape.d.ts for tape v4.2.2 --- tape/tape-tests.ts | 2 +- tape/tape.d.ts | 63 ++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 53 insertions(+), 12 deletions(-) diff --git a/tape/tape-tests.ts b/tape/tape-tests.ts index 85bb19a6e..919da3880 100644 --- a/tape/tape-tests.ts +++ b/tape/tape-tests.ts @@ -2,7 +2,7 @@ /// -import tape = require('tape'); +import tape = require("tape"); var name: string; var cb: tape.TestCase; diff --git a/tape/tape.d.ts b/tape/tape.d.ts index 4746e148a..39ab43176 100644 --- a/tape/tape.d.ts +++ b/tape/tape.d.ts @@ -1,6 +1,6 @@ -// Type definitions for tape v2.12.3 +// Type definitions for tape v4.2.2 // Project: https://github.com/substack/tape -// Definitions by: Bart van der Schoor +// Definitions by: Bart van der Schoor , Haoqun Jiang // Definitions: https://github.com/borisyankov/DefinitelyTyped /// @@ -9,22 +9,43 @@ declare module 'tape' { export = tape; /** - * Create a new test with an optional name string. cb(t) fires with the new test object t once all preceeding tests have finished. Tests execute serially. + * Create a new test with an optional name string and optional opts object. + * cb(t) fires with the new test object t once all preceeding tests have finished. + * Tests execute serially. */ function tape(name: string, cb: tape.TestCase): void; + function tape(name: string, opts: tape.TestOptions, cb: tape.TestCase): void; + function tape(cb: tape.TestCase): void; + function tape(opts: tape.TestOptions, cb: tape.TestCase): void; + module tape { interface TestCase { (test: Test): void; } + /** + * Available opts options for the tape function. + */ + interface TestOptions { + skip?: boolean; // See tape.skip. + timeout?: number; // Set a timeout for the test, after which it will fail. See tape.timeoutAfter. + } + + /** + * Options for the createStream function. + */ + interface StreamOptions { + objectMode?: boolean; + } + /** * Generate a new test that will be skipped over. */ export function skip(name: string, cb: tape.TestCase): void; /** - * Like test(name, cb) except if you use .only this is the only test case that will run for the entire process, all other test cases using tape will be ignored + * Like test(name, cb) except if you use .only this is the only test case that will run for the entire process, all other test cases using tape will be ignored. */ export function only(name: string, cb: tape.TestCase): void; @@ -34,24 +55,29 @@ declare module 'tape' { export function createHarness(): typeof tape; /** * Create a stream of output, bypassing the default output stream that writes messages to console.log(). + * By default stream will be a text stream of TAP output, but you can get an object stream instead by setting opts.objectMode to true. */ - export function createStream(opts?: any): NodeJS.ReadableStream; + export function createStream(opts?: tape.StreamOptions): NodeJS.ReadableStream; interface Test { /** - * Create a subtest with a new test handle st from cb(st) inside the current test cb(st) will only fire when t finishes. Additional tests queued up after t will not be run until all subtests finish. + * Create a subtest with a new test handle st from cb(st) inside the current test. + * cb(st) will only fire when t finishes. + * Additional tests queued up after t will not be run until all subtests finish. */ test(name: string, cb: tape.TestCase): void; /** - * Declare that n assertions should be run. end() will be called automatically after the nth assertion. If there are any more assertions after the nth, or after end() is called, they will generate errors. + * Declare that n assertions should be run. end() will be called automatically after the nth assertion. + * If there are any more assertions after the nth, or after end() is called, they will generate errors. */ plan(n: number): void; /** * Declare the end of a test explicitly. + * If err is passed in t.end will assert that it is falsey. */ - end(): void; + end(err?: any): void; /** * Generate a failing assertion with a message msg. @@ -63,6 +89,11 @@ declare module 'tape' { */ pass(msg?: string): void; + /** + * Automatically timeout the test after X ms. + */ + timeoutAfter(ms: number): void; + /** * Generate an assertion that will be skipped over. */ @@ -83,7 +114,8 @@ declare module 'tape' { notok(value: any, msg?: string): void; /** - * Assert that err is falsy. If err is non-falsy, use its err.message as the description message. + * Assert that err is falsy. + * If err is non-falsy, use its err.message as the description message. */ error(err: any, msg?: string): void; ifError(err: any, msg?: string): void; @@ -149,13 +181,22 @@ declare module 'tape' { /** * Assert that the function call fn() throws an exception. + * expected, if present, must be a RegExp or Function, which is used to test the exception object. */ - throws(fn: () => void, expected: any, msg?: string): void; + throws(fn: () => void, msg?: string): void; + throws(fn: () => void, exceptionExpected: RegExp | (() => void), msg?: string): void; /** * Assert that the function call fn() does not throw an exception. */ - doesNotThrow(fn: () => void, expected: any, msg?: string): void; + doesNotThrow(fn: () => void, msg?: string): void; + doesNotThrow(fn: () => void, exceptionExpected: RegExp | (() => void), msg?: string): void; + + /** + * Print a message without breaking the tap output. + * (Useful when using e.g. tap-colorize where output is buffered & console.log will print in incorrect order vis-a-vis tap output.) + */ + comment(msg: string): void; } } } From fad091f943a06f81f06c0d174d657fdf8c476657 Mon Sep 17 00:00:00 2001 From: Artem Berezin Date: Sun, 6 Dec 2015 17:45:33 +0900 Subject: [PATCH 322/389] Update angular-resource.d.ts fix IResourceArray. It is of array of IResource, not array of just T --- angularjs/angular-resource.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angularjs/angular-resource.d.ts b/angularjs/angular-resource.d.ts index 76930196b..442d8fa60 100644 --- a/angularjs/angular-resource.d.ts +++ b/angularjs/angular-resource.d.ts @@ -141,7 +141,7 @@ declare module angular.resource { /** * Really just a regular Array object with $promise and $resolve attached to it */ - interface IResourceArray extends Array { + interface IResourceArray extends Array> { /** the promise of the original server interaction that created this collection. **/ $promise : angular.IPromise>; $resolved : boolean; From 8d8abe471b822ec9d84fd3c8c221f3288ae2e773 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Sun, 6 Dec 2015 14:43:21 +0500 Subject: [PATCH 323/389] lodash: signatures of _.negate have been changed --- lodash/lodash-tests.ts | 41 +++++++++++++++++++++++++++++++---------- lodash/lodash.d.ts | 13 +++++++++++++ 2 files changed, 44 insertions(+), 10 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 9cae2a872..6cc720503 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -4925,17 +4925,38 @@ module TestModArgs { } // _.negate -interface TestNegatePredicate { - (a1: number, a2: number): boolean; +module TestNegate { + interface PredicateFn { + (a1: number, a2: number): boolean; + } + + interface ResultFn { + (a1: number, a2: number): boolean; + } + + var predicate = (a1: number, a2: number) => a1 > a2; + + { + let result: ResultFn; + + result = _.negate(predicate); + result = _.negate(predicate); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(predicate).negate(); + result = _(predicate).negate(); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(predicate).chain().negate(); + result = _(predicate).chain().negate(); + } } -interface TestNegateResult { - (a1: number, a2: number): boolean; -} -var testNegatePredicate = (a1: number, a2: number) => a1 > a2; -result = _.negate(testNegatePredicate); -result = _.negate(testNegatePredicate); -result = _(testNegatePredicate).negate().value(); -result = _(testNegatePredicate).negate().value(); // _.once module TestOnce { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index ed8d72443..66e49e5f5 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -8462,6 +8462,7 @@ declare module _ { /** * Creates a function that negates the result of the predicate func. The func predicate is invoked with * the this binding and arguments of the created function. + * * @param predicate The predicate to negate. * @return Returns the new function. */ @@ -8485,6 +8486,18 @@ declare module _ { negate(): LoDashImplicitObjectWrapper; } + interface LoDashExplicitObjectWrapper { + /** + * @see _.negate + */ + negate(): LoDashExplicitObjectWrapper<(...args: any[]) => boolean>; + + /** + * @see _.negate + */ + negate(): LoDashExplicitObjectWrapper; + } + //_.once interface LoDashStatic { /** From 8ca6bc3f619666c4a56bf1b5db54851ddcb24f9e Mon Sep 17 00:00:00 2001 From: rhysd Date: Sun, 6 Dec 2015 22:54:48 +0900 Subject: [PATCH 324/389] Add type definitions of shuffle-array package --- shuffle-array/shuffle-array-tests.ts | 20 +++++++++++++ shuffle-array/shuffle-array.d.ts | 42 ++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 shuffle-array/shuffle-array-tests.ts create mode 100644 shuffle-array/shuffle-array.d.ts diff --git a/shuffle-array/shuffle-array-tests.ts b/shuffle-array/shuffle-array-tests.ts new file mode 100644 index 000000000..9b799bb6e --- /dev/null +++ b/shuffle-array/shuffle-array-tests.ts @@ -0,0 +1,20 @@ +/// + +import shuffle = require('shuffle-array'); + +// shuffle() +var a = [1, 2, 3, 4, 5]; +var result: number[]; +result = shuffle(a); +result = shuffle(a, {}); +result = shuffle(a, {copy: true}); +result = shuffle(a, {rng: () => 0}); +result = shuffle(a, {copy: true, rng: () => 0}); + +var b = ['aaa', 'bbb', 'ccc'] +var result2: string[]; +result2 = shuffle.pick(b); +result2 = shuffle.pick(b, {}); +result2 = shuffle.pick(b, {picks: 3}); +result2 = shuffle.pick(b, {rng: () => 0}); +result2 = shuffle.pick(b, {picks: 3, rng: () => 0}); diff --git a/shuffle-array/shuffle-array.d.ts b/shuffle-array/shuffle-array.d.ts new file mode 100644 index 000000000..880396c4a --- /dev/null +++ b/shuffle-array/shuffle-array.d.ts @@ -0,0 +1,42 @@ +// Type definitions for shuffle-array +// Project: https://github.com/pazguille/shuffle-array +// Definitions by: rhysd +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module "shuffle-array" { + /** + * copy - Sets if should return a shuffled copy of the given array. By default it's a falsy value. + * rng - Specifies a custom random number generator. + */ + interface ShuffleOption { + copy?: boolean; + rng?: () => number; + } + /** + * picks - Specifies how many random elements you want to pick. By default it picks 1. + * rng - Specifies a custom random number generator. + */ + interface PickOption { + picks?: number; + rng?: () => number; + } + interface ShuffleArray { + /** + * Randomizes the order of the elements in a given array. + * + * arr - The given array. + * options - Optional configuration options. + */ + (arr: T[], options?: ShuffleOption): T[]; + /** + * Pick one or more random elements from the given array. + * + * arr - The given array. + * options - Optional configuration options. + */ + pick(arr: T[], options?: Object): T[]; + } + var shuffle: ShuffleArray; + export = shuffle; +} + From 19053aa84e473fab046938bf2648cf7ee5090111 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Mon, 7 Dec 2015 04:31:43 +0500 Subject: [PATCH 325/389] lodash: signatures of _.pick have been changed --- lodash/lodash-tests.ts | 47 +++++++++++++++++++++++++++++++----------- lodash/lodash.d.ts | 31 +++++++++++++++++++++------- 2 files changed, 59 insertions(+), 19 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 9cae2a872..3ad1c37e5 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -7047,18 +7047,41 @@ module TestPairs { } // _.pick -interface TestPickFn { - (element: any, key: string, collection: any): boolean; -} -{ - let testPickFn: TestPickFn; - let result: TResult; - result = _.pick({}, 0, '1', true, [2], ['3'], [true], [4, '5', true]); - result = _.pick({}, testPickFn); - result = _.pick({}, testPickFn, any); - result = _({}).pick(0, '1', true, [2], ['3'], [true], [4, '5', true]).value(); - result = _({}).pick(testPickFn).value(); - result = _({}).pick(testPickFn, any).value(); +module TestPick { + let predicate: (element: any, key: string, collection: any) => boolean; + + { + let result: TResult; + + result = _.pick({}, 'a'); + result = _.pick({}, 0, 'a'); + result = _.pick({}, true, 0, 'a'); + result = _.pick({}, ['b', 1, false], true, 0, 'a'); + result = _.pick({}, predicate); + result = _.pick({}, predicate, any); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _({}).pick('a'); + result = _({}).pick(0, 'a'); + result = _({}).pick(true, 0, 'a'); + result = _({}).pick(['b', 1, false], true, 0, 'a'); + result = _({}).pick(predicate); + result = _({}).pick(predicate, any); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _({}).chain().pick('a'); + result = _({}).chain().pick(0, 'a'); + result = _({}).chain().pick(true, 0, 'a'); + result = _({}).chain().pick(['b', 1, false], true, 0, 'a'); + result = _({}).chain().pick(predicate); + result = _({}).chain().pick(predicate, any); + } } // _.result diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index ed8d72443..9c11aedac 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -11771,9 +11771,9 @@ declare module _ { * @param predicate The function invoked per iteration or property names to pick, specified as individual * property names or arrays of property names. * @param thisArg The this binding of predicate. - * @return An object composed of the picked properties. + * @return Returns the new object. */ - pick( + pick( object: T, predicate: ObjectIterator, thisArg?: any @@ -11782,9 +11782,9 @@ declare module _ { /** * @see _.pick */ - pick( + pick( object: T, - ...predicate: Array> + ...predicate: (StringRepresentable|StringRepresentable[])[] ): TResult; } @@ -11792,7 +11792,7 @@ declare module _ { /** * @see _.pick */ - pick( + pick( predicate: ObjectIterator, thisArg?: any ): LoDashImplicitObjectWrapper; @@ -11800,11 +11800,28 @@ declare module _ { /** * @see _.pick */ - pick( - ...predicate: Array> + pick( + ...predicate: (StringRepresentable|StringRepresentable[])[] ): LoDashImplicitObjectWrapper; } + interface LoDashExplicitObjectWrapper { + /** + * @see _.pick + */ + pick( + predicate: ObjectIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.pick + */ + pick( + ...predicate: (StringRepresentable|StringRepresentable[])[] + ): LoDashExplicitObjectWrapper; + } + //_.result interface LoDashStatic { /** From eb48b34846b3f336e02afc6facf614c6ad6f70e1 Mon Sep 17 00:00:00 2001 From: Christopher Brown Date: Sun, 6 Dec 2015 20:08:00 -0600 Subject: [PATCH 326/389] Move //-comments above the corresponding line and use /** */ syntax so that TypeScript tooling will read it. Standardize formatting. --- imap/imap.d.ts | 313 +++++++++++++++++++++++++++---------------------- 1 file changed, 172 insertions(+), 141 deletions(-) diff --git a/imap/imap.d.ts b/imap/imap.d.ts index 128491955..ce9fd7223 100644 --- a/imap/imap.d.ts +++ b/imap/imap.d.ts @@ -5,32 +5,46 @@ /// - declare module IMAP { - + // The property names of these interfaces match the documentation (where type names were given). export interface Config { - user: string; // Username for plain-text authentication. - password: string; // Password for plain-text authentication. - xoauth?: string; // Base64-encoded OAuth token for OAuth authentication for servers that support it (See Andris Reinman's xoauth.js module to help generate this string). - xoauth2?: string; // Base64-encoded OAuth2 token for The SASL XOAUTH2 Mechanism for servers that support it (See Andris Reinman's xoauth2 module to help generate this string). - host?: string; // Hostname or IP address of the IMAP server. Default: "localhost" - port?: number; // Port number of the IMAP server. Default: 143 - tls?: boolean; // Perform implicit TLS connection? Default: false - tlsOptions?: Object; // Options object to pass to tls.connect() Default: (none) - autotls?: string; // Set to 'always' to always attempt connection upgrades via STARTTLS, 'required' only if upgrading is required, or 'never' to never attempt upgrading. Default: 'never' - connTimeout?: number; // Number of milliseconds to wait for a connection to be established. Default: 10000 - authTimeout?: number; // Number of milliseconds to wait to be authenticated after a connection has been established. Default: 5000 - keepalive?: any; /* boolean|KeepAlive */ // Configures the keepalive mechanism. Set to true to enable keepalive with defaults or set to object to enable and configure keepalive behavior: Default: true - debug?: Function; // If set, the function will be called with one argument, a string containing some debug info Default: (no debug output) + /** Username for plain-text authentication. */ + user: string; + /** Password for plain-text authentication. */ + password: string; + /** Base64-encoded OAuth token for OAuth authentication for servers that support it (See Andris Reinman's xoauth.js module to help generate this string). */ + xoauth?: string; + /** Base64-encoded OAuth2 token for The SASL XOAUTH2 Mechanism for servers that support it (See Andris Reinman's xoauth2 module to help generate this string). */ + xoauth2?: string; + /** Hostname or IP address of the IMAP server. Default: "localhost" */ + host?: string; + /** Port number of the IMAP server. Default: 143 */ + port?: number; + /** Perform implicit TLS connection? Default: false */ + tls?: boolean; + /** Options object to pass to tls.connect() Default: (none) */ + tlsOptions?: Object; + /** Set to 'always' to always attempt connection upgrades via STARTTLS, 'required' only if upgrading is required, or 'never' to never attempt upgrading. Default: 'never' */ + autotls?: string; + /** Number of milliseconds to wait for a connection to be established. Default: 10000 */ + connTimeout?: number; + /** Number of milliseconds to wait to be authenticated after a connection has been established. Default: 5000 */ + authTimeout?: number; + /** Configures the keepalive mechanism. Set to true to enable keepalive with defaults or set to object to enable and configure keepalive behavior: Default: true */ + keepalive?: any; /* boolean|KeepAlive */ + /** If set, the function will be called with one argument, a string containing some debug info Default: (no debug output) */ + debug?: Function; } - export interface KeepAlive { - interval?: number; // This is the interval (in milliseconds) at which NOOPs are sent and the interval at which idleInterval is checked. Default: 10000 - idleInterval?: number; // This is the interval (in milliseconds) at which an IDLE command (for servers that support IDLE) is re-sent. Default: 300000 (5 mins) - forceNoop?: boolean; // Set to true to force use of NOOP keepalive on servers also support IDLE. Default: false + /** This is the interval (in milliseconds) at which NOOPs are sent and the interval at which idleInterval is checked. Default: 10000 */ + interval?: number; + /** This is the interval (in milliseconds) at which an IDLE command (for servers that support IDLE) is re-sent. Default: 300000 (5 mins) */ + idleInterval?: number; + /** Set to true to force use of NOOP keepalive on servers also support IDLE. Default: false */ + forceNoop?: boolean; } // One of: @@ -41,63 +55,78 @@ declare module IMAP { // type MessageSource = string | string[] - - - export interface Box { - name: string; // The name of this mailbox. - readOnly?: boolean; // True if this mailbox was opened in read-only mode. (Only available with openBox() calls) - newKeywords: boolean; //True if new keywords can be added to messages in this mailbox. - uidvalidity: number; // A 32-bit number that can be used to determine if UIDs in this mailbox have changed since the last time this mailbox was opened. - uidnext: number; // The uid that will be assigned to the next message that arrives at this mailbox. - flags: string[]; // array - A list of system-defined flags applicable for this mailbox. Flags in this list but not in permFlags may be stored for the current session only. Additional server implementation-specific flags may also be available. - permFlags: string[]; // A list of flags that can be permanently added/removed to/from messages in this mailbox. - persistentUIDs: boolean; // Whether or not this mailbox has persistent UIDs. This should almost always be true for modern mailboxes and should only be false for legacy mail stores where supporting persistent UIDs was not technically feasible. - messages: { //Contains various message counts for this mailbox: - total: number; // Total number of messages in this mailbox. - new: number; // Number of messages in this mailbox having the Recent flag (this IMAP session is the first to see these messages). - unseen: number; // (Only available with status() calls) Number of messages in this mailbox not having the Seen flag (marked as not having been read). + /** The name of this mailbox. */ + name: string; + /** True if this mailbox was opened in read-only mode. (Only available with openBox() calls) */ + readOnly?: boolean; + /** True if new keywords can be added to messages in this mailbox. */ + newKeywords: boolean; + /** A 32-bit number that can be used to determine if UIDs in this mailbox have changed since the last time this mailbox was opened. */ + uidvalidity: number; + /** The uid that will be assigned to the next message that arrives at this mailbox. */ + uidnext: number; + /** array - A list of system-defined flags applicable for this mailbox. Flags in this list but not in permFlags may be stored for the current session only. Additional server implementation-specific flags may also be available. */ + flags: string[]; + /** A list of flags that can be permanently added/removed to/from messages in this mailbox. */ + permFlags: string[]; + /** Whether or not this mailbox has persistent UIDs. This should almost always be true for modern mailboxes and should only be false for legacy mail stores where supporting persistent UIDs was not technically feasible. */ + persistentUIDs: boolean; + /** Contains various message counts for this mailbox: */ + messages: { + /** Total number of messages in this mailbox. */ + total: number; + /** Number of messages in this mailbox having the Recent flag (this IMAP session is the first to see these messages). */ + new: number; + /** (Only available with status() calls) Number of messages in this mailbox not having the Seen flag (marked as not having been read). */ + unseen: number; }; } - // Given in a 'message' event from ImapFetch - export interface ImapMessage extends NodeJS.EventEmitter { - } - + /** Given in a 'message' event from ImapFetch */ + export interface ImapMessage extends NodeJS.EventEmitter { } export interface FetchOptions { - markSeen?: boolean; // Mark message(s) as read when fetched. Default: false - struct?: boolean; // Fetch the message structure. Default: false - envelope?: boolean; // Fetch the message envelope. Default: false - size?: boolean; // Fetch the RFC822 size. Default: false - modifiers?: Object; // Fetch modifiers defined by IMAP extensions. Default: (none) - bodies?: any; /* string|string[] */ // A string or Array of strings containing the body part section to fetch. Default: (none) Example sections: + /** Mark message(s) as read when fetched. Default: false */ + markSeen?: boolean; + /** Fetch the message structure. Default: false */ + struct?: boolean; + /** Fetch the message envelope. Default: false */ + envelope?: boolean; + /** Fetch the RFC822 size. Default: false */ + size?: boolean; + /** Fetch modifiers defined by IMAP extensions. Default: (none) */ + modifiers?: Object; + /** A string or Array of strings containing the body part section to fetch. Default: (none) Example sections: */ + bodies?: any; /* string|string[] */ } - // Returned from fetch() - export interface ImapFetch extends NodeJS.EventEmitter { - } - + /** Returned from fetch() */ + export interface ImapFetch extends NodeJS.EventEmitter { } + export interface Folder { - attribs: string[]; - delimiter: string; - children: Folder[]; - parent: Folder; + attribs: string[]; + delimiter: string; + children: Folder[]; + parent: Folder; } export interface MailBoxes { - [name: string] : Folder; + [name: string]: Folder; } export interface AppendOptions { - mailbox?: string; // The name of the mailbox to append the message to. Default: the currently open mailbox - flags?: any; /* string|string[] */ // A single flag (e.g. 'Seen') or an array of flags (e.g. ['Seen', 'Flagged']) to append to the message. Default: (no flags) - date?: Date; // What to use for message arrival date/time. Default: (current date/time) + /** The name of the mailbox to append the message to. Default: the currently open mailbox */ + mailbox?: string; + /** A single flag (e.g. 'Seen') or an array of flags (e.g. ['Seen', 'Flagged']) to append to the message. Default: (no flags) */ + flags?: any; /* string|string[] */ + /** What to use for message arrival date/time. Default: (current date/time) */ + date?: Date; } @@ -118,7 +147,7 @@ declare module IMAP { UNDRAFT: void; // Messages that do not have the Draft flag set. UNFLAGGED: void; // Messages that do not have the Flagged flag set. UNSEEN: void; // Messages that do not have the Seen flag set. - + // The following are valid types that require string value(s): BCC: any; // Messages that contain the specified string in the BCC field. @@ -146,28 +175,28 @@ declare module IMAP { export interface MessageFunctions { - // Searches the currently open mailbox for messages using given criteria. criteria is a list describing what you want to find. For criteria types that require arguments, use an array instead of just the string criteria type name (e.g. ['FROM', 'foo@bar.com']). Prefix criteria types with an "!" to negate. - search(criteria : any[], callback : (error : Error, uids : string[]) => void) : void; - // Fetches message(s) in the currently open mailbox. - fetch(source : any /* MessageSource */, options : FetchOptions) : ImapFetch; - // Copies message(s) in the currently open mailbox to another mailbox. - copy(source : any /* MessageSource */, mailboxName : string, callback : (error : Error) => void) : void; - // Moves message(s) in the currently open mailbox to another mailbox. Note: The message(s) in the destination mailbox will have a new message UID. - move(source : any /* MessageSource */, mailboxName : string, callback : (error : Error) => void) : void; - // Adds flag(s) to message(s). - addFlags(source : any /* MessageSource */, flags : any, callback : (error : Error) => void) : void; - // Removes flag(s) from message(s). - delFlags(source : any /* MessageSource */, flags : any, callback : (error : Error) => void) : void; - // Sets the flag(s) for message(s). - setFlags(source : any /* MessageSource */, flags : any, callback : (error : Error) => void) : void; - // Adds keyword(s) to message(s). keywords is either a single keyword or an array of keywords. - addKeywords(source : any /* MessageSource */, keywords : any /* string|string[] */, callback : (error : Error) => void) : void; - //Removes keyword(s) from message(s). keywords is either a single keyword or an array of keywords. - delKeywords(source : any /* MessageSource */, keywords : any /* string|string[] */, callback : (error : Error) => void) : void; - // Sets keyword(s) for message(s). keywords is either a single keyword or an array of keywords. - setKeywords(source : any /* MessageSource */, keywords : any /* string|string[] */, callback : (error : Error) => void) : void; - // Checks if the server supports the specified capability. - serverSupports(capability : string) : boolean; + /** Searches the currently open mailbox for messages using given criteria. criteria is a list describing what you want to find. For criteria types that require arguments, use an array instead of just the string criteria type name (e.g. ['FROM', 'foo@bar.com']). Prefix criteria types with an "!" to negate. */ + search(criteria: any[], callback: (error: Error, uids: string[]) => void): void; + /** Fetches message(s) in the currently open mailbox. */ + fetch(source: any /* MessageSource */, options: FetchOptions): ImapFetch; + /** Copies message(s) in the currently open mailbox to another mailbox. */ + copy(source: any /* MessageSource */, mailboxName: string, callback: (error: Error) => void): void; + /** Moves message(s) in the currently open mailbox to another mailbox. Note: The message(s) in the destination mailbox will have a new message UID. */ + move(source: any /* MessageSource */, mailboxName: string, callback: (error: Error) => void): void; + /** Adds flag(s) to message(s). */ + addFlags(source: any /* MessageSource */, flags: any, callback: (error: Error) => void): void; + /** Removes flag(s) from message(s). */ + delFlags(source: any /* MessageSource */, flags: any, callback: (error: Error) => void): void; + /** Sets the flag(s) for message(s). */ + setFlags(source: any /* MessageSource */, flags: any, callback: (error: Error) => void): void; + /** Adds keyword(s) to message(s). keywords is either a single keyword or an array of keywords. */ + addKeywords(source: any /* MessageSource */, keywords: any /* string|string[] */, callback: (error: Error) => void): void; + /** Removes keyword(s) from message(s). keywords is either a single keyword or an array of keywords. */ + delKeywords(source: any /* MessageSource */, keywords: any /* string|string[] */, callback: (error: Error) => void): void; + /** Sets keyword(s) for message(s). keywords is either a single keyword or an array of keywords. */ + setKeywords(source: any /* MessageSource */, keywords: any /* string|string[] */, callback: (error: Error) => void): void; + /** Checks if the server supports the specified capability. */ + serverSupports(capability: string): boolean; } @@ -175,8 +204,8 @@ declare module IMAP { export class Connection implements NodeJS.EventEmitter, MessageFunctions { /** @constructor */ - constructor(config : Config); - + constructor(config: Config); + // from NodeJS.EventEmitter addListener(event: string, listener: Function): NodeJS.EventEmitter; on(event: string, listener: Function): NodeJS.EventEmitter; @@ -186,87 +215,89 @@ declare module IMAP { setMaxListeners(n: number): void; listeners(event: string): Function[]; emit(event: string, ...args: any[]): boolean; - + // from MessageFunctions - // Searches the currently open mailbox for messages using given criteria. criteria is a list describing what you want to find. For criteria types that require arguments, use an array instead of just the string criteria type name (e.g. ['FROM', 'foo@bar.com']). Prefix criteria types with an "!" to negate. - search(criteria : any[], callback : (error : Error, uids : string[]) => void) : void; - // Fetches message(s) in the currently open mailbox. - fetch(source : any /* MessageSource */, options : FetchOptions) : ImapFetch; - // Copies message(s) in the currently open mailbox to another mailbox. - copy(source : any /* MessageSource */, mailboxName : string, callback : (error : Error) => void) : void; - // Moves message(s) in the currently open mailbox to another mailbox. Note: The message(s) in the destination mailbox will have a new message UID. - move(source : any /* MessageSource */, mailboxName : string, callback : (error : Error) => void) : void; - // Adds flag(s) to message(s). - addFlags(source : any /* MessageSource */, flags : any, callback : (error : Error) => void) : void; - // Removes flag(s) from message(s). - delFlags(source : any /* MessageSource */, flags : any, callback : (error : Error) => void) : void; - // Sets the flag(s) for message(s). - setFlags(source : any /* MessageSource */, flags : any, callback : (error : Error) => void) : void; - // Adds keyword(s) to message(s). keywords is either a single keyword or an array of keywords. - addKeywords(source : any /* MessageSource */, keywords : any /* string|string[] */, callback : (error : Error) => void) : void; - //Removes keyword(s) from message(s). keywords is either a single keyword or an array of keywords. - delKeywords(source : any /* MessageSource */, keywords : any /* string|string[] */, callback : (error : Error) => void) : void; - // Sets keyword(s) for message(s). keywords is either a single keyword or an array of keywords. - setKeywords(source : any /* MessageSource */, keywords : any /* string|string[] */, callback : (error : Error) => void) : void; - // Checks if the server supports the specified capability. - serverSupports(capability : string) : boolean; - - // Parses a raw header and returns an object keyed on header fields and the values are Arrays of header field values. Set disableAutoDecode to true to disable automatic decoding of MIME encoded-words that may exist in header field values. - static parseHeader(rawHeader: string, disableAutoDecode? : boolean) : any; - - state: string; // The current state of the connection (e.g. 'disconnected', 'connected', 'authenticated'). - delimiter: string; // The (top-level) mailbox hierarchy delimiter. If the server does not support mailbox hierarchies and only a flat list, this value will be falsey. - namespaces: { // Contains information about each namespace type (if supported by the server) with the following properties: - personal: any[]; // Mailboxes that belong to the logged in user. - other: any[]; // Mailboxes that belong to other users that the logged in user has access to. - shared: any[]; // Mailboxes that are accessible by any logged in user. + /** Searches the currently open mailbox for messages using given criteria. criteria is a list describing what you want to find. For criteria types that require arguments, use an array instead of just the string criteria type name (e.g. ['FROM', 'foo@bar.com']). Prefix criteria types with an "!" to negate. */ + search(criteria: any[], callback: (error: Error, uids: string[]) => void): void; + /** Fetches message(s) in the currently open mailbox. */ + fetch(source: any /* MessageSource */, options: FetchOptions): ImapFetch; + /** Copies message(s) in the currently open mailbox to another mailbox. */ + copy(source: any /* MessageSource */, mailboxName: string, callback: (error: Error) => void): void; + /** Moves message(s) in the currently open mailbox to another mailbox. Note: The message(s) in the destination mailbox will have a new message UID. */ + move(source: any /* MessageSource */, mailboxName: string, callback: (error: Error) => void): void; + /** Adds flag(s) to message(s). */ + addFlags(source: any /* MessageSource */, flags: any, callback: (error: Error) => void): void; + /** Removes flag(s) from message(s). */ + delFlags(source: any /* MessageSource */, flags: any, callback: (error: Error) => void): void; + /** Sets the flag(s) for message(s). */ + setFlags(source: any /* MessageSource */, flags: any, callback: (error: Error) => void): void; + /** Adds keyword(s) to message(s). keywords is either a single keyword or an array of keywords. */ + addKeywords(source: any /* MessageSource */, keywords: any /* string|string[] */, callback: (error: Error) => void): void; + /** Removes keyword(s) from message(s). keywords is either a single keyword or an array of keywords. */ + delKeywords(source: any /* MessageSource */, keywords: any /* string|string[] */, callback: (error: Error) => void): void; + /** Sets keyword(s) for message(s). keywords is either a single keyword or an array of keywords. */ + setKeywords(source: any /* MessageSource */, keywords: any /* string|string[] */, callback: (error: Error) => void): void; + /** Checks if the server supports the specified capability. */ + serverSupports(capability: string): boolean; + + /** Parses a raw header and returns an object keyed on header fields and the values are Arrays of header field values. Set disableAutoDecode to true to disable automatic decoding of MIME encoded-words that may exist in header field values. */ + static parseHeader(rawHeader: string, disableAutoDecode?: boolean): any; + + /** The current state of the connection (e.g. 'disconnected', 'connected', 'authenticated'). */ + state: string; + /** The (top-level) mailbox hierarchy delimiter. If the server does not support mailbox hierarchies and only a flat list, this value will be falsey. */ + delimiter: string; + /** Contains information about each namespace type (if supported by the server) with the following properties: */ + namespaces: { + /** Mailboxes that belong to the logged in user. */ + personal: any[]; + /** Mailboxes that belong to other users that the logged in user has access to. */ + other: any[]; + /** Mailboxes that are accessible by any logged in user. */ + shared: any[]; }; seq: MessageFunctions; /** Attempts to connect and authenticate with the IMAP server. */ - connect() : void; + connect(): void; /** Closes the connection to the server after all requests in the queue have been sent. */ - end() : void; + end(): void; /** Immediately destroys the connection to the server. */ - destroy() : void; + destroy(): void; /** Opens a specific mailbox that exists on the server. mailboxName should include any necessary prefix/path. modifiers is used by IMAP extensions. */ - openBox(mailboxName : string, callback : (error : Error, mailbox: Box) => void) : void; - openBox(mailboxName : string, openReadOnly : boolean, callback : (error : Error, mailbox: Box) => void) : void; - openBox(mailboxName : string, openReadOnly : boolean, modifiers : Object, callback : (error : Error, mailbox: Box) => void) : void; + openBox(mailboxName: string, callback: (error: Error, mailbox: Box) => void): void; + openBox(mailboxName: string, openReadOnly: boolean, callback: (error: Error, mailbox: Box) => void): void; + openBox(mailboxName: string, openReadOnly: boolean, modifiers: Object, callback: (error: Error, mailbox: Box) => void): void; /** Closes the currently open mailbox. If autoExpunge is true, any messages marked as Deleted in the currently open mailbox will be removed if the mailbox was NOT opened in read-only mode. If autoExpunge is false, you disconnect, or you open another mailbox, messages marked as Deleted will NOT be removed from the currently open mailbox. */ - closeBox(callback : (error : Error) => void) : void; - closeBox(autoExpunge : boolean, callback : (error : Error) => void) : void; + closeBox(callback: (error: Error) => void): void; + closeBox(autoExpunge: boolean, callback: (error: Error) => void): void; /** Creates a new mailbox on the server. mailboxName should include any necessary prefix/path. */ - addBox(mailboxName : string, callback : (error : Error) => void) : void; + addBox(mailboxName: string, callback: (error: Error) => void): void; /** Removes a specific mailbox that exists on the server. mailboxName should including any necessary prefix/path. */ - delBox(mailboxName : string, callback : (error : Error, uids : string[]) => void) : void; + delBox(mailboxName: string, callback: (error: Error, uids: string[]) => void): void; /** Renames a specific mailbox that exists on the server. Both oldMailboxName and newMailboxName should include any necessary prefix/path. Note: Renaming the 'INBOX' mailbox will instead cause all messages in 'INBOX' to be moved to the new mailbox. */ - renameBox(oldMailboxName : string, newMailboxName : string, callback : (error : Error, mailbox: Box) => void) : void; + renameBox(oldMailboxName: string, newMailboxName: string, callback: (error: Error, mailbox: Box) => void): void; /** Subscribes to a specific mailbox that exists on the server. mailboxName should include any necessary prefix/path. */ - subscribeBox(mailboxName : string, callback : (error : Error) => void) : void; + subscribeBox(mailboxName: string, callback: (error: Error) => void): void; /** Unsubscribes from a specific mailbox that exists on the server. mailboxName should include any necessary prefix/path. */ - unsubscribeBox(mailboxName : string, callback : (error : Error) => void) : void; + unsubscribeBox(mailboxName: string, callback: (error: Error) => void): void; /** Fetches information about a mailbox other than the one currently open. Note: There is no guarantee that this will be a fast operation on the server. Also, do not call this on the currently open mailbox. */ - status(mailboxName : string, callback : (error : Error, mailbox: Box) => void) : void; + status(mailboxName: string, callback: (error: Error, mailbox: Box) => void): void; /** Obtains the full list of mailboxes. If nsPrefix is not specified, the main personal namespace is used. */ - getBoxes(callback : (error : Error, mailboxes: MailBoxes) => void) : void; - getBoxes(nsPrefix : string, callback : (error : Error, mailboxes: MailBoxes) => void) : void; + getBoxes(callback: (error: Error, mailboxes: MailBoxes) => void): void; + getBoxes(nsPrefix: string, callback: (error: Error, mailboxes: MailBoxes) => void): void; /** Obtains the full list of subscribed mailboxes. If nsPrefix is not specified, the main personal namespace is used. */ - getSubscribedBoxes(callback : (error : Error, mailboxes: MailBoxes) => void) : void; - getSubscribedBoxes(nsPrefix : string, callback : (error : Error, mailboxes: MailBoxes) => void) : void; + getSubscribedBoxes(callback: (error: Error, mailboxes: MailBoxes) => void): void; + getSubscribedBoxes(nsPrefix: string, callback: (error: Error, mailboxes: MailBoxes) => void): void; /** Permanently removes all messages flagged as Deleted in the currently open mailbox. If the server supports the 'UIDPLUS' capability, uids can be supplied to only remove messages that both have their uid in uids and have the \Deleted flag set. Note: At least on Gmail, performing this operation with any currently open mailbox that is not the Spam or Trash mailbox will merely archive any messages marked as Deleted (by moving them to the 'All Mail' mailbox). */ - expunge(callback : (error : Error) => void) : void; - expunge(uids : any /* MessageSource */, callback : (error : Error) => void) : void; - // Appends a message to selected mailbox. msgData is a string or Buffer containing an RFC-822 compatible MIME message. Valid options properties are: - append(msgData : any, callback : (error : Error) => void) : void; - append(msgData : any, options : AppendOptions, callback : (error : Error) => void) : void; + expunge(callback: (error: Error) => void): void; + expunge(uids: any /* MessageSource */, callback: (error: Error) => void): void; + /** Appends a message to selected mailbox. msgData is a string or Buffer containing an RFC-822 compatible MIME message. Valid options properties are: */ + append(msgData: any, callback: (error: Error) => void): void; + append(msgData: any, options: AppendOptions, callback: (error: Error) => void): void; } - } - declare module "imap" { - var out: typeof IMAP.Connection; - export = out; } From ec0ee97259280fa893398c61688ad031c9de77a6 Mon Sep 17 00:00:00 2001 From: Jacob Eggers Date: Sun, 6 Dec 2015 21:58:46 -0800 Subject: [PATCH 327/389] Fixing rx-lite module name --- rx/rx.lite.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rx/rx.lite.d.ts b/rx/rx.lite.d.ts index 66ec67849..6192f13ca 100644 --- a/rx/rx.lite.d.ts +++ b/rx/rx.lite.d.ts @@ -10,6 +10,6 @@ /// /// -declare module "rx.lite" { +declare module "rx-lite" { export = Rx; } From 7f14ac023aee0836218cc32278882de14559372a Mon Sep 17 00:00:00 2001 From: Dave Keen Date: Mon, 7 Dec 2015 12:28:15 +0100 Subject: [PATCH 328/389] strokeMiterlimit was left out of the React 0.14 typings --- react/react.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/react/react.d.ts b/react/react.d.ts index fb04cf0f5..bd3581111 100644 --- a/react/react.d.ts +++ b/react/react.d.ts @@ -1864,6 +1864,7 @@ declare namespace __React { stroke?: string; strokeDasharray?: string; strokeLinecap?: string; + strokeMiterlimit?: string; strokeOpacity?: number | string; strokeWidth?: number | string; textAnchor?: string; From e120044c7b8821d0da3aba2e18c4494e99688cdb Mon Sep 17 00:00:00 2001 From: Tim Perry Date: Mon, 7 Dec 2015 14:57:49 +0100 Subject: [PATCH 329/389] Update README build status badge to correct URL --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 82833752d..7e1d60d87 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# DefinitelyTyped [![Build Status](https://travis-ci.org/borisyankov/DefinitelyTyped.png?branch=master)](https://travis-ci.org/borisyankov/DefinitelyTyped) +# DefinitelyTyped [![Build Status](https://travis-ci.org/DefinitelyTyped/DefinitelyTyped.png?branch=master)](https://travis-ci.org/DefinitelyTyped/DefinitelyTyped) [![Join the chat at https://gitter.im/borisyankov/DefinitelyTyped](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/borisyankov/DefinitelyTyped?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) From caa3cf3634551dfa745272e02dcdb78bce83a329 Mon Sep 17 00:00:00 2001 From: Lars Michaelis Date: Mon, 7 Dec 2015 16:21:26 +0100 Subject: [PATCH 330/389] rename folder from jsf to jee-jsf --- {jsf => jee-jsf}/jsf-tests.ts | 0 {jsf => jee-jsf}/jsf.d.ts | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename {jsf => jee-jsf}/jsf-tests.ts (100%) rename {jsf => jee-jsf}/jsf.d.ts (100%) diff --git a/jsf/jsf-tests.ts b/jee-jsf/jsf-tests.ts similarity index 100% rename from jsf/jsf-tests.ts rename to jee-jsf/jsf-tests.ts diff --git a/jsf/jsf.d.ts b/jee-jsf/jsf.d.ts similarity index 100% rename from jsf/jsf.d.ts rename to jee-jsf/jsf.d.ts From 1c3380ab16cd81b52c3ad8b50cf97da60ab26066 Mon Sep 17 00:00:00 2001 From: David Broder-Rodgers Date: Mon, 7 Dec 2015 15:11:58 +0000 Subject: [PATCH 331/389] Added typings for chai-things --- chai-things/chai-things-tests.ts | 59 ++++++++++++++++++++++++++++++++ chai-things/chai-things.d.ts | 55 +++++++++++++++++++++++++++++ 2 files changed, 114 insertions(+) create mode 100644 chai-things/chai-things-tests.ts create mode 100644 chai-things/chai-things.d.ts diff --git a/chai-things/chai-things-tests.ts b/chai-things/chai-things-tests.ts new file mode 100644 index 000000000..de6a4c3ff --- /dev/null +++ b/chai-things/chai-things-tests.ts @@ -0,0 +1,59 @@ +/// + +import chai = require('chai'); +import chaiThings = require('chai-things'); + +chai.use(chaiThings); + +function test_somethingSyntax() { + [].should.not.include.something(); + [].should.not.include.something.that.equals(1); + + var array = [{ a: 1 }, { b: 2 }]; + array.should.include.something(); + array.should.include.something.that.deep.equals({ b: 2 }); + array.should.include.something.that.not.deep.equals({ b: 2 }); + array.should.not.include.something.that.deep.equals({ c: 3 }); + array.should.include.something.that.not.deep.equals({ c: 3 }); + array.should.include.something.with.property('b', 2); + array.should.not.include.something.with.property('b', 3); + + var array2 = [{ a: 'b' }, { a: 'b' }]; + array2.should.include.something.that.have.property("a"); + array2.should.include.something.that.have.property("a").not.equal("d"); +} + +function test_somethingVariantsSyntax() { + [].should.not.include.any(); + [].should.not.include.any.that.deep.equal({ b: 2 }); + + var array = [{ a: 1 }, { b: 2 }]; + array.should.include.a.thing(); + array.should.include.a.thing.that.deep.equals({ b: 2 }); + array.should.include.an.item(); + array.should.include.an.item.that.deep.equals({ b: 2 }); + array.should.include.one.that.deep.equals({ b: 2 }); + array.should.include.some(); + array.should.include.some.that.deep.equal({ b: 2 }); +} + +function test_allSyntax() { + [].should.all.equal(1); + [].should.all.not.equal(1); + + var array = [1, 1]; + array.should.all.equal(1); + array.should.all.not.equal(2); + array.should.not.all.equal(2); + array.should.not.all.not.equal(1); + + var array2 = [1, 2]; + array2.should.not.all.equal(1); + array2.should.not.all.equal(2); + array2.should.not.all.not.equal(1); + array2.should.not.all.not.equal(2); + + var array3 = [{ a: 'b' }, { a: 'c' }]; + array3.should.all.have.property("a"); + array3.should.all.have.property("a").not.equal("d"); +} \ No newline at end of file diff --git a/chai-things/chai-things.d.ts b/chai-things/chai-things.d.ts new file mode 100644 index 000000000..bc2b89c46 --- /dev/null +++ b/chai-things/chai-things.d.ts @@ -0,0 +1,55 @@ +// Type definitions for chai-things +// Project: https://github.com/chaijs/chai-things +// Definitions by: David Broder-Rodgers +// Definitions: https://github.com/DavidBR-SW/DefinitelyTyped + +/// + +declare module Chai { + interface ArrayAssertion { + include: ArrayInclude; + contain: ArrayInclude; + not: ArrayAssertion; + all: Assertion; + } + + interface ArrayInclude { + (item: any): any; + a: Item; + an: Item; + one: Something; + some: Something; + something: Something; + any: Anything; + } + + interface Anything extends Assertion { + (): any; + that: Assertion + with: Assertion + } + + interface Something extends Assertion { + (): any; + that: Assertion + with: Assertion + } + + interface Item { + item: Something; + thing: Something; + } + + interface Deep { + equals: Equal; + } +} + +interface Array { + should: Chai.ArrayAssertion; +} + +declare module "chai-things" { + function chaiThings(chai: any, utils: any): void; + export = chaiThings; +} From f67852cbc81823e9d0178e9cdc89aea4a5e3c40c Mon Sep 17 00:00:00 2001 From: Cyril Schumacher Date: Mon, 7 Dec 2015 18:29:53 +0100 Subject: [PATCH 332/389] Update validator: add "isMACAddress" function. --- validator/validator-tests.ts | 2 ++ validator/validator.d.ts | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/validator/validator-tests.ts b/validator/validator-tests.ts index b7f45d427..c5a55f59c 100644 --- a/validator/validator-tests.ts +++ b/validator/validator-tests.ts @@ -19,6 +19,8 @@ validator.isURL("sample"); validator.isFQDN("sample"); +validator.isMACAddress("sample"); + validator.isIP("sample"); validator.isAlpha("sample"); diff --git a/validator/validator.d.ts b/validator/validator.d.ts index 05a391fa4..2b29efac0 100644 --- a/validator/validator.d.ts +++ b/validator/validator.d.ts @@ -22,7 +22,7 @@ interface IEmailoptions { lowercase?: boolean } -// callback type for #extend +// callback type for #extend interface IExtendCallback { (argv: string): any } @@ -54,6 +54,9 @@ interface IValidatorStatic { // check if the string is a fully qualified domain name (e.g. domain.com). isFQDN(str: string, options?: IFQDNoptions): boolean; + // check if the string is a MAC address. + isMACAddress(str: string): boolean; + // check if the string is an IP (version 4 or 6). isIP(str: string, version?: number): boolean; @@ -177,7 +180,7 @@ interface IValidatorStatic { // remove characters that do not appear in the whitelist. whitelist(input: string, chars: string): string; - // remove characters that appear in the blacklist. + // remove characters that appear in the blacklist. blacklist(input: string, chars: string): string; // canonicalize an email address. From c6a1eb87530f8bbe638b121f4099b33f00dd3bd2 Mon Sep 17 00:00:00 2001 From: Cyril Schumacher Date: Mon, 7 Dec 2015 18:46:54 +0100 Subject: [PATCH 333/389] Add definition "express-brute". --- express-brute/express-brute-tests.ts | 16 ++++ express-brute/express-brute.d.ts | 129 +++++++++++++++++++++++++++ 2 files changed, 145 insertions(+) create mode 100644 express-brute/express-brute-tests.ts create mode 100644 express-brute/express-brute.d.ts diff --git a/express-brute/express-brute-tests.ts b/express-brute/express-brute-tests.ts new file mode 100644 index 000000000..ea0f2f5b4 --- /dev/null +++ b/express-brute/express-brute-tests.ts @@ -0,0 +1,16 @@ +/// + +import express = require("express"); +import ExpressBrute = require("express-brute"); + +var store = new ExpressBrute.MemoryStore(); +store = new ExpressBrute.MemoryStore({ prefix: "prefix" }); +store.set("key", "value", 0, (error: any) => { }); +store.get("key", (error: any, data: Object) => { }); +store.reset("key", (error: any) => { }); + +var app = express(); +var bruteforce = new ExpressBrute(store); +app.post("/auth", bruteforce.prevent, (req, res, next) => { + res.send("Success!"); +}); diff --git a/express-brute/express-brute.d.ts b/express-brute/express-brute.d.ts new file mode 100644 index 000000000..377efcdce --- /dev/null +++ b/express-brute/express-brute.d.ts @@ -0,0 +1,129 @@ +// Type definitions for express-validator 2.9.0 +// Project: https://github.com/AdamPflug/express-brute +// Definitions by: Cyril Schumacher +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "express-brute" { + import express = require("express"); + + /** + * @summary Options for {@link MemoryStore} class. + * @interface + */ + interface MemoryStoreOptions { + /** + * @summary Key prefix. + * @type {string} + */ + prefix: string; + } + + /** + * @summary Options for {@link ExpressBrute#getMiddleware} class. + * @interface + */ + interface ExpressBruteMiddleware { + /** + * @summary Allows you to override the value of failCallback for this middleware. + * @type {Function} + */ + failCallback: Function; + + /** + * @summary Disregard IP address when matching requests if set to true. Defaults to false. + * @type {boolean} + */ + ignoreIP: boolean; + + /** + * @summary Key. + * @type {any} + */ + key: any; + } + + /** + * @summary Middleware. + * @class + */ + class ExpressBrute { + /** + * @summary Constructor. + * @constructor + * @param {any} store The store. + */ + constructor(store: any); + + /** + * @summary Generates middleware that will bounce requests with the same key and IP address that happen faster than the current wait time by calling failCallback. + * @param {Object} options The options. + */ + getMiddleware(options: ExpressBruteMiddleware): express.RequestHandler; + + /** + * @summary Uses the current proxy trust settings to get the current IP from a request object. + * @param {Request} request The HTTP request. + * @return {RequestHandler} The Request handler. + */ + getIPFromRequest(request: express.Request): express.RequestHandler; + + /** + * @summary Middleware that will bounce requests that happen faster than the current wait time by calling failCallback. + * @param {Request} request The HTTP request. + * @param {Response} response The HTTP response. + * @param {Function} next The next middleware. + * @return {RequestHandler} The Request handler. + */ + prevent(request: express.Request, response: express.Response, next: Function): express.RequestHandler; + + /** + * @summary Resets the wait time between requests back to its initial value. + * @param {string} ip The IP address. + * @param {string} key The key. response. + * @param {Function} next The next middleware. + * @return {RequestHandler} The Request handler. + */ + reset(ip: string, key: string, next: Function): express.RequestHandler; + } + + module ExpressBrute { + /** + * @summary In-memory store. + * @class + */ + export class MemoryStore { + /** + * @summary Constructor. + * @constructor + * @param {Object} options The options. + */ + constructor(options?: MemoryStoreOptions); + /** + * @summary Gets key value. + * @param {string} key The key name. + * @param {Function} callbck The callback. + */ + get(key: string, callback: (error: any, data: Object) => void): void; + + /** + * @summary Sets the key value. + * @param {string} key The name. + * @param {string} value The value. + * @param {number} lifetime The lifetime. + * @param {Function} callback The callback. + */ + set(key: string, value: any, lifetime: number, callback: (error: any) => void): void; + + /** + * @summary Deletes the key. + * @param {string} key The name. + * @param {Function} callback The callback. + */ + reset(key: string, callback: (error: any) => void): void; + } + } + + export = ExpressBrute; +} From 41ecb256fe6fe1c59c537d158721ba68d783e16b Mon Sep 17 00:00:00 2001 From: Cyril Schumacher Date: Mon, 7 Dec 2015 19:19:49 +0100 Subject: [PATCH 334/389] Add definition for "express-brute-mongo". --- .../express-brute-mongo-tests.ts | 27 +++++++++++++++++++ express-brute-mongo/express-brute-mongo.d.ts | 22 +++++++++++++++ express-brute/express-brute.d.ts | 2 +- 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 express-brute-mongo/express-brute-mongo-tests.ts create mode 100644 express-brute-mongo/express-brute-mongo.d.ts diff --git a/express-brute-mongo/express-brute-mongo-tests.ts b/express-brute-mongo/express-brute-mongo-tests.ts new file mode 100644 index 000000000..a4512782b --- /dev/null +++ b/express-brute-mongo/express-brute-mongo-tests.ts @@ -0,0 +1,27 @@ +/// +/// +/// + +import express = require("express"); +import ExpressBrute = require("express-brute"); +import MongoStore = require("express-brute-mongo"); +import mongodb = require("mongodb"); +var MongoClient = mongodb.MongoClient; + +var store = new MongoStore(ready => { + MongoClient.connect("mongodb://127.0.0.1:27017/test", (err, db) => { + if (err) { + throw err; + } + + var collection = db.collection("bruteforce-store"); + ready(collection); + }); +}); + +var app = express(); +var bruteforce = new ExpressBrute(store); + +app.post("/auth", bruteforce.prevent, (req, res, next) => { + res.send("Success!"); +}); diff --git a/express-brute-mongo/express-brute-mongo.d.ts b/express-brute-mongo/express-brute-mongo.d.ts new file mode 100644 index 000000000..bc4d5e43d --- /dev/null +++ b/express-brute-mongo/express-brute-mongo.d.ts @@ -0,0 +1,22 @@ +// Type definitions for express-brute-mongo +// Project: https://github.com/auth0/express-brute-mongo +// Definitions by: Cyril Schumacher +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "express-brute-mongo" { + /** + * @summary MongoDB store adapter. + * @class + */ + export = class MongoStore { + /** + * @summary Constructor. + * @constructor + * @param {Function} getCollection The collection. + * @param {Object} options The otpions. + */ + constructor(getCollection: (collection: any) => void, options?: Object); + } +} diff --git a/express-brute/express-brute.d.ts b/express-brute/express-brute.d.ts index 377efcdce..7242d44dc 100644 --- a/express-brute/express-brute.d.ts +++ b/express-brute/express-brute.d.ts @@ -1,4 +1,4 @@ -// Type definitions for express-validator 2.9.0 +// Type definitions for express-brute // Project: https://github.com/AdamPflug/express-brute // Definitions by: Cyril Schumacher // Definitions: https://github.com/borisyankov/DefinitelyTyped From a961bfca179fd8d16dcdc166bc4c026d11e3fec6 Mon Sep 17 00:00:00 2001 From: Cyril Schumacher Date: Mon, 7 Dec 2015 19:39:31 +0100 Subject: [PATCH 335/389] Update definition for "nodemailer". --- nodemailer/nodemailer-tests.ts | 16 ++++++++++++++-- nodemailer/nodemailer.d.ts | 6 +++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/nodemailer/nodemailer-tests.ts b/nodemailer/nodemailer-tests.ts index 1d99046c0..a991096d5 100644 --- a/nodemailer/nodemailer-tests.ts +++ b/nodemailer/nodemailer-tests.ts @@ -11,6 +11,20 @@ var transporter: nodemailer.Transporter = nodemailer.createTransport({ } }); +// create reusable transporter object using SMTP transport and set default values for mail options. +transporter = nodemailer.createTransport({ + service: 'Gmail', + auth: { + user: 'gmail.user@gmail.com', + pass: 'userpass' + } +}, { + from: 'sender@address', + headers: { + 'My-Awesome-Header': '123' + } +}); + // setup e-mail data with unicode symbols var mailOptions: nodemailer.SendMailOptions = { from: 'Fred Foo ✔ ', // sender address @@ -24,5 +38,3 @@ var mailOptions: nodemailer.SendMailOptions = { transporter.sendMail(mailOptions, (error: Error, info: nodemailer.SentMessageInfo): void => { // nothing }); - - diff --git a/nodemailer/nodemailer.d.ts b/nodemailer/nodemailer.d.ts index e0d1300b0..e7d09f54f 100644 --- a/nodemailer/nodemailer.d.ts +++ b/nodemailer/nodemailer.d.ts @@ -51,13 +51,13 @@ declare module "nodemailer" { /** * Create a direct transporter */ - export function createTransport(options?: directTransport.DirectOptions): Transporter; + export function createTransport(options?: directTransport.DirectOptions, defaults?: Object): Transporter; /** * Create an SMTP transporter */ - export function createTransport(options?: smtpTransport.SmtpOptions): Transporter; + export function createTransport(options?: smtpTransport.SmtpOptions, defaults?: Object): Transporter; /** * Create a transporter from a given implementation */ - export function createTransport(transport: Transport): Transporter; + export function createTransport(transport: Transport, defaults?: Object): Transporter; } From 7e4c025262a4af55afb8f41f6ad4451d17066cd5 Mon Sep 17 00:00:00 2001 From: Calvin Fernandez Date: Sat, 5 Dec 2015 14:25:01 -0500 Subject: [PATCH 336/389] Add typings to support angular ui tree callbacks --- angular-ui-tree/angular-ui-tree-tests.ts | 69 ++++++++++++++++++++++++ angular-ui-tree/angular-ui-tree.d.ts | 64 ++++++++++++++++++++++ 2 files changed, 133 insertions(+) diff --git a/angular-ui-tree/angular-ui-tree-tests.ts b/angular-ui-tree/angular-ui-tree-tests.ts index e66408814..4e5ef91b9 100644 --- a/angular-ui-tree/angular-ui-tree-tests.ts +++ b/angular-ui-tree/angular-ui-tree-tests.ts @@ -11,3 +11,72 @@ var treeNode2: AngularUITree.ITreeNode = { nodes: [treeNode], title: "test2" }; + +// fake jquery node here so that we can pull a pretend +// angular scope element out of it +var dummyJQueryNode: ng.IAugmentedJQuery; +var fakeScope: (ng.IScope | AngularUITree.IParentTreeNodeScope) = dummyJQueryNode.scope(); + +( fakeScope).node = treeNode; + +var treeNodeScope: AngularUITree.ITreeNodeScope = fakeScope; + +( fakeScope).isParent = (nodeScope: AngularUITree.ITreeNodeScope) => { + return true; +}; + +var parentTreeNodeScope: AngularUITree.IParentTreeNodeScope = fakeScope; + +var eventSourceInfo: AngularUITree.IEventSourceInfo = { + cloneModel: {}, + nodeScope: treeNodeScope, + index: 0, + nodesScope: parentTreeNodeScope +}; + +var position: AngularUITree.IPosition = { + dirAx: 0, + dirX: 0, + dirY: 0, + distAxX: 0, + distAxY: 0, + distX: 0, + distY: 0, + lastDirX: 0, + lastDirY: 0, + lastX: 0, + lastY: 0, + moving: true, + nowX: 0, + nowY: 0, + offsetX: 0, + offsetY: 0, + startX: 0, + startY: 0 + +}; + +var eventInfo: AngularUITree.IEventInfo = { + source: eventSourceInfo, + dest: { + index: 0, + nodesScope: parentTreeNodeScope + }, + elements: {}, + pos: position +}; + +var acceptCallback: AngularUITree.IAcceptCallback = (source: AngularUITree.ITreeNodeScope, + destination: AngularUITree.ITreeNodeScope, + destinationIndex: number) => { + return false; +}; + +var droppedCallback: AngularUITree.IDroppedCallback = (eventInfo: AngularUITree.IEventInfo) => { + return; +}; + +var callbacks: AngularUITree.ICallbacks = { + accept: acceptCallback, + dropped: droppedCallback +}; diff --git a/angular-ui-tree/angular-ui-tree.d.ts b/angular-ui-tree/angular-ui-tree.d.ts index 1017ac11c..62c8899fa 100644 --- a/angular-ui-tree/angular-ui-tree.d.ts +++ b/angular-ui-tree/angular-ui-tree.d.ts @@ -3,7 +3,71 @@ // Definitions by: Calvin Fernandez // Definitions: https://github.com/borisyankov/DefinitelyTyped +/// + declare module AngularUITree { + interface IEventSourceInfo { + cloneModel: any; + index: number; + nodeScope: ITreeNodeScope; + nodesScope: ITreeNodeScope; + } + + interface IPosition { + dirAx: number; + dirX: number; + dirY: number; + distAxX: number; + distAxY: number; + distX: number; + distY: number; + lastDirX: number; + lastDirY: number; + lastX: number; + lastY: number; + moving: boolean; + nowX: number; + nowY: number; + offsetX: number; + offsetY: number; + startX: number; + startY: number; + } + + interface IEventInfo { + dest: { + index: number; + nodesScope: IParentTreeNodeScope; + }; + elements: any; + pos: IPosition; + source: IEventSourceInfo; + } + + interface IAcceptCallback { + (source: ITreeNodeScope, destination: ITreeNodeScope, destinationIndex: number): boolean; + } + + interface IDroppedCallback { + (eventInfo: IEventInfo): void; + } + + interface ICallbacks { + accept: IAcceptCallback; + dropped: IDroppedCallback; + } + + /** + * Internal representation of node in the UI + */ + interface ITreeNodeScope extends ng.IScope { + node: ITreeNode; + } + + interface IParentTreeNodeScope extends ITreeNodeScope { + isParent(nodeScope: ITreeNodeScope): boolean; + } + /** * Node in list */ From 44dad1d2373ed5e4135267b38b158202806dfbea Mon Sep 17 00:00:00 2001 From: Ian Ker-Seymer Date: Mon, 7 Dec 2015 17:56:00 -0500 Subject: [PATCH 337/389] Add getClient() to auth0.lock --- auth0.lock/auth0.lock.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/auth0.lock/auth0.lock.d.ts b/auth0.lock/auth0.lock.d.ts index bef269dbc..3269103ab 100644 --- a/auth0.lock/auth0.lock.d.ts +++ b/auth0.lock/auth0.lock.d.ts @@ -72,6 +72,8 @@ interface Auth0LockStatic { hide(callback: () => void): void; logout(callback: () => void): void; + + getClient(): Auth0Static; } declare var Auth0Lock: Auth0LockStatic; From 0c717541d80116f51bc2d9c0a4a2d731b0a50edb Mon Sep 17 00:00:00 2001 From: "Dylan R. E. Moonfire" Date: Mon, 7 Dec 2015 13:00:05 -0600 Subject: [PATCH 338/389] Added an interface to tokenizers to make it easier to pass into functinos. --- natural/natural.d.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/natural/natural.d.ts b/natural/natural.d.ts index d559f3801..249caf901 100644 --- a/natural/natural.d.ts +++ b/natural/natural.d.ts @@ -8,24 +8,27 @@ declare module "natural" { import events = require("events"); - class WordTokenizer { + interface Tokenizer { tokenize(text: string): string[]; } - class AggressiveTokenizer { + class WordTokenizer implements Tokenizer { tokenize(text: string): string[]; } - class TreebankWordTokenizer { + class AggressiveTokenizer implements Tokenizer { + tokenize(text: string): string[]; + } + class TreebankWordTokenizer implements Tokenizer { tokenize(text: string): string[]; } interface RegexTokenizerOptions { pattern: RegExp; discardEmpty?: boolean; } - class RegexpTokenizer { + class RegexpTokenizer implements Tokenizer { constructor(options: RegexTokenizerOptions); tokenize(text: string): string[]; } - class WordPunctTokenizer { + class WordPunctTokenizer implements Tokenizer { tokenize(text: string): string[]; } @@ -74,6 +77,10 @@ declare module "natural" { static restore(classifier: any, stemmer?: Stemmer): BayesClassifier; } + interface Phonetic { + compare(stringA: string, stringB: string): boolean; + process(token: string, maxLength?: number): string; + } var Metaphone: { compare(stringA: string, stringB: string): boolean; process(token: string, maxLength?: number): string; From 412522a8d49a6d557d79ea4e5485a5c097afad52 Mon Sep 17 00:00:00 2001 From: "Dylan R. E. Moonfire" Date: Mon, 7 Dec 2015 13:00:19 -0600 Subject: [PATCH 339/389] Added missing LancasterStemmer. --- natural/natural.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/natural/natural.d.ts b/natural/natural.d.ts index 249caf901..aaf3305a0 100644 --- a/natural/natural.d.ts +++ b/natural/natural.d.ts @@ -63,6 +63,9 @@ declare module "natural" { var PorterStemmerPt: { stem(token: string): string; } + var LancasterStemmer: { + stem(token: string): string; + } interface BayesClassifierCallback { (err: any, classifier: any): void } class BayesClassifier { From 494baf6691ed8fd7cbd4a0cfeee4b14086bc5245 Mon Sep 17 00:00:00 2001 From: "Dylan R. E. Moonfire" Date: Mon, 7 Dec 2015 13:08:03 -0600 Subject: [PATCH 340/389] Added initial definition for strip-json-comments. --- strip-json-comments/strip-json-comments-tests.ts | 11 +++++++++++ strip-json-comments/strip-json-comments.d.ts | 13 +++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 strip-json-comments/strip-json-comments-tests.ts create mode 100644 strip-json-comments/strip-json-comments.d.ts diff --git a/strip-json-comments/strip-json-comments-tests.ts b/strip-json-comments/strip-json-comments-tests.ts new file mode 100644 index 000000000..3a9e91f3d --- /dev/null +++ b/strip-json-comments/strip-json-comments-tests.ts @@ -0,0 +1,11 @@ +// Type definitions for strip-json-comments +// Project: https://github.com/sindresorhus/strip-json-comments +// Definitions by: Dylan R. E. Moonfire +// Definitions: https://github.com/borisyankov/DefinitelyTyped +/// +import stripJsonComments = require("strip-json-comments"); + +const json = '{/*rainbows*/"unicorn":"cake"}'; + +JSON.parse(stripJsonComments(json)); +//=> {unicorn: 'cake'} diff --git a/strip-json-comments/strip-json-comments.d.ts b/strip-json-comments/strip-json-comments.d.ts new file mode 100644 index 000000000..721b83314 --- /dev/null +++ b/strip-json-comments/strip-json-comments.d.ts @@ -0,0 +1,13 @@ +// Type definitions for strip-json-comments +// Project: https://github.com/sindresorhus/strip-json-comments +// Definitions by: Dylan R. E. Moonfire +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "strip-json-comments" { + interface StripJsonOptions { + whitespace?: boolean; + } + + function stripJsonComments(input: string, opts?: StripJsonOptions): string; + export = stripJsonComments; +} From 7d58f574a7faf3caac3ccdfb10576199949b879c Mon Sep 17 00:00:00 2001 From: Steve Ognibene Date: Mon, 7 Dec 2015 18:53:12 -0600 Subject: [PATCH 341/389] Added module declaration so Typescript will emit require statement. --- big.js/big.js.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/big.js/big.js.d.ts b/big.js/big.js.d.ts index d4ca239e3..2ad360a56 100644 --- a/big.js/big.js.d.ts +++ b/big.js/big.js.d.ts @@ -200,4 +200,9 @@ declare module BigJsLibrary { } } +declare module "big.js" { + var bigjs : BigJsLibrary.BigJS; + export = bigjs; +} + declare var Big: BigJsLibrary.BigJS; From 5111e014788097f739548ef63025bc22371a5ae9 Mon Sep 17 00:00:00 2001 From: Cyril Schumacher Date: Tue, 8 Dec 2015 10:24:22 +0100 Subject: [PATCH 342/389] Add definition for "connect-timeout". --- connect-timeout/connect-timeout-tests.ts | 28 ++++++++++++++++++ connect-timeout/connect-timeout.d.ts | 36 ++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 connect-timeout/connect-timeout-tests.ts create mode 100644 connect-timeout/connect-timeout.d.ts diff --git a/connect-timeout/connect-timeout-tests.ts b/connect-timeout/connect-timeout-tests.ts new file mode 100644 index 000000000..283ee2679 --- /dev/null +++ b/connect-timeout/connect-timeout-tests.ts @@ -0,0 +1,28 @@ +/// +/// +/// +/// + +import express = require("express"); +import timeout = require("connect-timeout"); +import bodyParser = require("body-parser"); +import cookieParser = require("cookie-parser"); + +// example of using this top-level; note the use of haltOnTimedout +// after every middleware; it will stop the request flow on a timeout +var app = express(); +app.use(timeout("5s", { respond: false })); +app.use(bodyParser()); +app.use(haltOnTimedout); +app.use(cookieParser()); +app.use(haltOnTimedout); + +// Add your routes here, etc. + +function haltOnTimedout(req, res, next) { + if (!req.timedout) { + next(); + } +} + +app.listen(3000); diff --git a/connect-timeout/connect-timeout.d.ts b/connect-timeout/connect-timeout.d.ts new file mode 100644 index 000000000..8b7ff2879 --- /dev/null +++ b/connect-timeout/connect-timeout.d.ts @@ -0,0 +1,36 @@ +// Type definitions for connect-timeout +// Project: https://github.com/expressjs/timeout +// Definitions by: Cyril Schumacher +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module Express { + export interface Request { + /** + * @summary Clears the timeout on the request. + */ + clearTimeout(): void; + + /** + * + * @return {boolean} true if timeout fired; false otherwise. + */ + timedout(event: string, message: string): boolean; + } +} + +declare module "connect-timeout" { + import express = require("express"); + + interface TimeoutOptions extends Object { + /** + * @summary Controls if this module will "respond" in the form of forwarding an error. + * @type {boolean} + */ + respond: boolean; + } + + function timeout(timeout: string, options?: TimeoutOptions): express.RequestHandler; + export = timeout; +} From 93a277a4d4d624f5f3f9bcbde9f1543cb3f69c40 Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Tue, 8 Dec 2015 03:26:05 -0600 Subject: [PATCH 343/389] [chai] Correct type of AssertionError AssertionError on the global chai object is the constructor for AssertionErrors, but the definition was written as though it was an instance of an assertion error. --- chai/chai.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chai/chai.d.ts b/chai/chai.d.ts index 28aaf48c2..e68e6fa3b 100644 --- a/chai/chai.d.ts +++ b/chai/chai.d.ts @@ -19,7 +19,7 @@ declare module Chai { use(fn: (chai: any, utils: any) => void): any; assert: AssertStatic; config: Config; - AssertionError: AssertionError; + AssertionError: typeof AssertionError; } export interface ExpectStatic extends AssertionStatic { From 784857f638e949d67c80fcd7d7f5ab5de53fb808 Mon Sep 17 00:00:00 2001 From: Cyril Schumacher Date: Tue, 8 Dec 2015 10:26:56 +0100 Subject: [PATCH 344/389] Fix errors. --- connect-timeout/connect-timeout-tests.ts | 2 +- connect-timeout/connect-timeout.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/connect-timeout/connect-timeout-tests.ts b/connect-timeout/connect-timeout-tests.ts index 283ee2679..920c7fdc6 100644 --- a/connect-timeout/connect-timeout-tests.ts +++ b/connect-timeout/connect-timeout-tests.ts @@ -19,7 +19,7 @@ app.use(haltOnTimedout); // Add your routes here, etc. -function haltOnTimedout(req, res, next) { +function haltOnTimedout(req: express.Request, res: express.Response, next: Function) { if (!req.timedout) { next(); } diff --git a/connect-timeout/connect-timeout.d.ts b/connect-timeout/connect-timeout.d.ts index 8b7ff2879..8494a3afb 100644 --- a/connect-timeout/connect-timeout.d.ts +++ b/connect-timeout/connect-timeout.d.ts @@ -1,6 +1,6 @@ // Type definitions for connect-timeout // Project: https://github.com/expressjs/timeout -// Definitions by: Cyril Schumacher +// Definitions by: Cyril Schumacher // Definitions: https://github.com/borisyankov/DefinitelyTyped /// From b91489d6662a27ca5e57ff2e7b727e75d6dbbef7 Mon Sep 17 00:00:00 2001 From: nakakura Date: Tue, 8 Dec 2015 19:15:04 +0900 Subject: [PATCH 345/389] update webrtc/MediaStream.d.ts --- webrtc/MediaStream.d.ts | 66 ++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/webrtc/MediaStream.d.ts b/webrtc/MediaStream.d.ts index fc88469f0..37b605592 100644 --- a/webrtc/MediaStream.d.ts +++ b/webrtc/MediaStream.d.ts @@ -9,23 +9,23 @@ /// interface ConstrainBooleanParameters { - exact: boolean; - ideal: boolean; + exact?: boolean; + ideal?: boolean; } interface NumberRange { - max: number; - min: number; + max?: number; + min?: number; } interface ConstrainNumberRange extends NumberRange { - exact: number; - ideal: number; + exact?: number; + ideal?: number; } interface ConstrainStringParameters { - exact: string | string[]; - ideal: string | string[]; + exact?: string | string[]; + ideal?: string | string[]; } interface MediaStreamConstraints { @@ -63,38 +63,38 @@ interface MediaTrackConstraintSet { } interface MediaTrackSupportedConstraints { - width: boolean; - height: boolean; - aspectRatio: boolean; - frameRate: boolean; - facingMode: boolean; - volume: boolean; - sampleRate: boolean; - sampleSize: boolean; - echoCancellation: boolean; - latency: boolean; - deviceId: boolean; - groupId: boolean; + width?: boolean; + height?: boolean; + aspectRatio?: boolean; + frameRate?: boolean; + facingMode?: boolean; + volume?: boolean; + sampleRate?: boolean; + sampleSize?: boolean; + echoCancellation?: boolean; + latency?: boolean; + deviceId?: boolean; + groupId?: boolean; } interface MediaStream extends EventTarget { id: string; active: boolean; - + onactive: EventListener; oninactive: EventListener; onaddtrack: (event: MediaStreamTrackEvent) => any; onremovetrack: (event: MediaStreamTrackEvent) => any; - + clone(): MediaStream; stop(): void; - + getAudioTracks(): MediaStreamTrack[]; getVideoTracks(): MediaStreamTrack[]; getTracks(): MediaStreamTrack[]; - + getTrackById(trackId: string): MediaStreamTrack; - + addTrack(track: MediaStreamTrack): void; removeTrack(track: MediaStreamTrack): void; } @@ -116,16 +116,16 @@ interface MediaStreamTrack extends EventTarget { muted: boolean; remote: boolean; readyState: MediaStreamTrackState; - + onmute: EventListener; onunmute: EventListener; onended: EventListener; onoverconstrained: EventListener; - + clone(): MediaStreamTrack; - + stop(): void; - + getCapabilities(): MediaTrackCapabilities; getConstraints(): MediaTrackConstraints; getSettings(): MediaTrackSettings; @@ -176,13 +176,13 @@ interface NavigatorGetUserMedia { interface Navigator { getUserMedia: NavigatorGetUserMedia; - + webkitGetUserMedia: NavigatorGetUserMedia; - + mozGetUserMedia: NavigatorGetUserMedia; - + msGetUserMedia: NavigatorGetUserMedia; - + mediaDevices: MediaDevices; } From f6e34ebc7c2750941f0416f2614fbc4679c35f71 Mon Sep 17 00:00:00 2001 From: pragyandas Date: Tue, 8 Dec 2015 16:19:41 +0530 Subject: [PATCH 346/389] changed return type of node() to Node --- d3/d3.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/d3/d3.d.ts b/d3/d3.d.ts index 396d0307e..236b87d55 100644 --- a/d3/d3.d.ts +++ b/d3/d3.d.ts @@ -791,7 +791,7 @@ declare module d3 { /** * Returns the first non-null element in the selection, or null otherwise. */ - node(): EventTarget; + node(): Node; /** * Returns the total number of elements in the selection. @@ -854,7 +854,7 @@ declare module d3 { call(func: (transition: Transition, ...args: any[]) => any, ...args: any[]): Transition; empty(): boolean; - node(): EventTarget; + node(): Node; size(): number; } From 2be15f1fe4719cae3c69fd87b70a81a5d7dd98a6 Mon Sep 17 00:00:00 2001 From: Glen Date: Tue, 8 Dec 2015 13:56:38 +0200 Subject: [PATCH 347/389] gulp-typescript: Add TsConfig --- gulp-typescript/gulp-typescript-tests.ts | 4 ++++ gulp-typescript/gulp-typescript.d.ts | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/gulp-typescript/gulp-typescript-tests.ts b/gulp-typescript/gulp-typescript-tests.ts index 5abd5a152..ab40e478d 100644 --- a/gulp-typescript/gulp-typescript-tests.ts +++ b/gulp-typescript/gulp-typescript-tests.ts @@ -60,3 +60,7 @@ gulp.task('default', function () { .pipe(typescript()) .pipe(gulp.dest('built/local')); }); + +var compilerOptions = tsProject.config.compilerOptions; +var exclude = tsProject.config.exclude; +var files = tsProject.config.files; diff --git a/gulp-typescript/gulp-typescript.d.ts b/gulp-typescript/gulp-typescript.d.ts index 84d4b5d9c..5c7ab6b42 100644 --- a/gulp-typescript/gulp-typescript.d.ts +++ b/gulp-typescript/gulp-typescript.d.ts @@ -26,8 +26,15 @@ declare module "gulp-typescript" { typescript?: any; } + interface TsConfig { + files?: string[]; + exclude?: string[]; + compilerOptions?: any; + } + interface Project { - src(): NodeJS.ReadWriteStream + config: TsConfig; + src(): NodeJS.ReadWriteStream; } interface FilterSettings { From 3aa59c162f9ff98fd7ce5e94908397bbeee2a1c9 Mon Sep 17 00:00:00 2001 From: stephenjelfs Date: Tue, 8 Dec 2015 13:31:05 +0100 Subject: [PATCH 348/389] Updated fixed-data-table to version 0.6.0 --- .../fixed-data-table-0.4.7-tests.tsx | 39 + fixed-data-table/fixed-data-table-0.4.7.d.ts | 402 +++++++++ fixed-data-table/fixed-data-table-tests.tsx | 192 ++++- fixed-data-table/fixed-data-table.d.ts | 778 ++++++++++-------- 4 files changed, 1038 insertions(+), 373 deletions(-) create mode 100644 fixed-data-table/fixed-data-table-0.4.7-tests.tsx create mode 100644 fixed-data-table/fixed-data-table-0.4.7.d.ts diff --git a/fixed-data-table/fixed-data-table-0.4.7-tests.tsx b/fixed-data-table/fixed-data-table-0.4.7-tests.tsx new file mode 100644 index 000000000..28dae2890 --- /dev/null +++ b/fixed-data-table/fixed-data-table-0.4.7-tests.tsx @@ -0,0 +1,39 @@ +/// +/// +/// + +import * as React from "react"; +import * as ReactDOM from "react-dom"; +import * as FixedDataTable from "fixed-data-table"; + +var rows = [ + ['a1', 'b1', 'c1'], + ['a2', 'b2', 'c2'], + ['a3', 'b3', 'c3'], + // .... and more +]; + +function rowGetter(rowIndex: number) { + return rows[rowIndex]; +} + + var table = + + + + +ReactDOM.render(table, document.body); diff --git a/fixed-data-table/fixed-data-table-0.4.7.d.ts b/fixed-data-table/fixed-data-table-0.4.7.d.ts new file mode 100644 index 000000000..1dc22dc3d --- /dev/null +++ b/fixed-data-table/fixed-data-table-0.4.7.d.ts @@ -0,0 +1,402 @@ +// Type definitions for fixed-data-table 0.4.7 +// Project: https://github.com/facebook/fixed-data-table +// Definitions by: Petar Paar +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module FixedDataTable { + export var version: string; + + export interface TableProps extends __React.Props { + /** + * Pixel width of table. If all columns do not fit, + * a horizontal scrollbar will appear. + */ + width: number; + + /** + * Pixel height of table. If all rows do not fit, + * a vertical scrollbar will appear. + * + * Either `height` or `maxHeight` must be specified. + */ + height?: number; + + /** + * Maximum pixel height of table. If all rows do not fit, + * a vertical scrollbar will appear. + * + * Either `height` or `maxHeight` must be specified. + */ + maxHeight?: number; + + /** + * Pixel height of table's owner, this is used in a managed scrolling + * situation when you want to slide the table up from below the fold + * without having to constantly update the height on every scroll tick. + * Instead, vary this property on scroll. By using `ownerHeight`, we + * over-render the table while making sure the footer and horizontal + * scrollbar of the table are visible when the current space for the table + * in view is smaller than the final, over-flowing height of table. It + * allows us to avoid resizing and reflowing table when it is moving in the + * view. + * + * This is used if `ownerHeight < height` (or `maxHeight`). + */ + ownerHeight?: number; + + /** + * hidden or auto + */ + overflowX?: string; + overflowY?: string; + + /** + * Number of rows in the table. + */ + rowsCount: number; + + /** + * Pixel height of rows unless `rowHeightGetter` is specified and returns + * different value. + */ + rowHeight: number; + + /** + * If specified, `rowHeightGetter(index)` is called for each row and the + * returned value overrides `rowHeight` for particular row. + */ + rowHeightGetter?: Function; + + /** + * To get rows to display in table, `rowGetter(index)` + * is called. `rowGetter` should be smart enough to handle async + * fetching of data and return temporary objects + * while data is being fetched. + */ + rowGetter: Function; + + /** + * To get any additional CSS classes that should be added to a row, + * `rowClassNameGetter(index)` is called. + */ + rowClassNameGetter?: Function; + + /** + * Pixel height of the column group header. + */ + groupHeaderHeight?: number; + + /** + * Pixel height of header. + */ + headerHeight: number; + + /** + * Function that is called to get the data for the header row. + * If the function returns null, the header will be set to the + * Column's label property. + */ + headerDataGetter?: Function; + + /** + * Pixel height of footer. + */ + footerHeight?: number; + + /** + * DEPRECATED - use footerDataGetter instead. + * Data that will be passed to footer cell renderers. + */ + footerData?: any; + + /** + * Function that is called to get the data for the footer row. + */ + footerDataGetter?: Function; + + /** + * Value of horizontal scroll. + */ + scrollLeft?: number; + + /** + * Index of column to scroll to. + */ + scrollToColumn?: number; + + /** + * Value of vertical scroll. + */ + scrollTop?: number; + + /** + * Index of row to scroll to. + */ + scrollToRow?: number; + + /** + * Callback that is called when scrolling starts with current horizontal + * and vertical scroll values. + */ + onScrollStart?: Function; + + /** + * Callback that is called when scrolling ends or stops with new horizontal + * and vertical scroll values. + */ + onScrollEnd?: Function; + + /** + * Callback that is called when `rowHeightGetter` returns a different height + * for a row than the `rowHeight` prop. This is necessary because initially + * table estimates heights of some parts of the content. + */ + onContentHeightChange?: Function; + + /** + * Callback that is called when a row is clicked. + */ + onRowClick?: Function; + + /** + * Callback that is called when a row is double clicked. + */ + onRowDoubleClick?: Function; + + /** + * Callback that is called when a mouse-down event happens on a row. + */ + onRowMouseDown?: Function; + + /** + * Callback that is called when a mouse-enter event happens on a row. + */ + onRowMouseEnter?: Function; + + /** + * Callback that is called when a mouse-leave event happens on a row. + */ + onRowMouseLeave?: Function; + + /** + * Callback that is called when resizer has been released + * and column needs to be updated. + * + * Required if the isResizable property is true on any column. + * + * ``` + * function( + * newColumnWidth: number, + * dataKey: string, + * ) + * ``` + */ + onColumnResizeEndCallback?: Function; + + /** + * Whether a column is currently being resized. + */ + isColumnResizing?: boolean + } + + interface ColumnProps { + /** + * The horizontal alignment of the table cell content. + * 'left', 'center', 'right' + */ + align?: string; + + /** + * className for this column's header cell. + */ + headerClassName?: string; + + /** + * className for this column's footer cell. + */ + footerClassName?: string; + + /** + * className for each of this column's data cells. + */ + cellClassName?: string; + + /** + * The cell renderer that returns React-renderable content for table cell. + * ``` + * function( + * cellData: any, + * cellDataKey: string, + * rowData: object, + * rowIndex: number, + * columnData: any, + * width: number + * ): ?$jsx + * ``` + */ + cellRenderer?: Function; + + /** + * The getter `function(string_cellDataKey, object_rowData)` that returns + * the cell data for the `cellRenderer`. + * If not provided, the cell data will be collected from + * `rowData[cellDataKey]` instead. The value that `cellDataGetter` returns + * will be used to determine whether the cell should re-render. + */ + cellDataGetter?: Function; + + /** + * The key to retrieve the cell data from the data row. Provided key type + * must be either `string` or `number`. Since we use this + * for keys, it must be specified for each column. + */ + dataKey: string|number; + + /** + * Controls if the column is fixed when scrolling in the X axis. + */ + fixed?: boolean; + + /** + * The cell renderer that returns React-renderable content for table column + * header. + * ``` + * function( + * label: ?string, + * cellDataKey: string, + * columnData: any, + * rowData: array, + * width: number + * ): ?$jsx + * ``` + */ + headerRenderer?: Function; + + /** + * The cell renderer that returns React-renderable content for table column + * footer. + * ``` + * function( + * label: ?string, + * cellDataKey: string, + * columnData: any, + * rowData: array, + * width: number + * ): ?$jsx + * ``` + */ + footerRenderer?: Function; + + /** + * Bucket for any data to be passed into column renderer functions. + */ + columnData?: any; + + /** + * The column's header label. + */ + label: string; + + /** + * The pixel width of the column. + */ + width: number; + + /** + * If this is a resizable column this is its minimum pixel width. + */ + minWidth?: number; + + /** + * If this is a resizable column this is its maximum pixel width. + */ + maxWidth?: number; + + /** + * The grow factor relative to other columns. Same as the flex-grow API + * from http://www.w3.org/TR/css3-flexbox/. Basically, take any available + * extra width and distribute it proportionally according to all columns' + * flexGrow values. Defaults to zero (no-flexing). + */ + flexGrow?: number; + + /** + * Whether the column can be resized with the + * FixedDataTableColumnResizeHandle. Please note that if a column + * has a flex grow, once you resize the column this will be set to 0. + * + * This property only provides the UI for the column resizing. If this + * is set to true, you will need ot se the onColumnResizeEndCallback table + * property and render your columns appropriately. + */ + isResizable?: boolean; + + /** + * Experimental feature + * Whether cells in this column can be removed from document when outside + * of viewport as a result of horizontal scrolling. + * Setting this property to true allows the table to not render cells in + * particular column that are outside of viewport for visible rows. This + * allows to create table with many columns and not have vertical scrolling + * performance drop. + * Setting the property to false will keep previous behaviour and keep + * cell rendered if the row it belongs to is visible. + */ + allowCellsRecycling?: boolean; + } + + export interface ColumnGroupProps { + /** + * The horizontal alignment of the table cell content. + * 'left', 'center', 'right' + */ + align?: string; + + /** + * Controls if the column group is fixed when scrolling in the X axis. + */ + fixed?: boolean; + + /** + * Bucket for any data to be passed into column group renderer functions. + */ + columnGroupData?: any; + + /** + * The column group's header label. + */ + label?: string; + + /** + * The cell renderer that returns React-renderable content for a table + * column group header. If it's not specified, the label from props will + * be rendered as header content. + * ``` + * function( + * label: ?string, + * cellDataKey: string, + * columnGroupData: any, + * rowData: array, // array of labels of all columnGroups + * width: number + * ): ?$jsx + * ``` + */ + groupHeaderRenderer?: Function; + } + + export class Table extends __React.Component { + render(): __React.DOMElement + } + export class Column extends __React.Component { + render(): __React.DOMElement + } + export class ColumnGroup extends __React.Component { + render(): __React.DOMElement + } +} + +declare module "fixed-data-table" { + export = FixedDataTable; +} \ No newline at end of file diff --git a/fixed-data-table/fixed-data-table-tests.tsx b/fixed-data-table/fixed-data-table-tests.tsx index 28dae2890..f104ac5e4 100644 --- a/fixed-data-table/fixed-data-table-tests.tsx +++ b/fixed-data-table/fixed-data-table-tests.tsx @@ -1,39 +1,169 @@ -/// +/// /// -/// import * as React from "react"; -import * as ReactDOM from "react-dom"; -import * as FixedDataTable from "fixed-data-table"; +import {Table, Cell, Column} from "fixed-data-table"; -var rows = [ - ['a1', 'b1', 'c1'], - ['a2', 'b2', 'c2'], - ['a3', 'b3', 'c3'], - // .... and more -]; - -function rowGetter(rowIndex: number) { - return rows[rowIndex]; +// create your Table +class MyTable1 extends React.Component<{}, {}> { + render(): React.ReactElement { + return ( +
    + // add columns +
    + ); + } } - var table = { + render(): React.ReactElement { + return ( + - - - + width={1000} + height={500}> + Basic content} + width={200} + /> +
    + ); + } +} -ReactDOM.render(table, document.body); +// provide Custom Data +interface MyTable3State { + myTableData: [{name: string}]; +} + +class MyTable3 extends React.Component<{}, MyTable3State> { + + constructor(props: {}) { + super(props); + + this.state = { + myTableData: [ + {name: "Rylan"}, + {name: "Amelia"}, + {name: "Estevan"}, + {name: "Florence"}, + {name: "Tressa"}, + ] + }; + } + + render(): React.ReactElement { + return ( + + Name} + cell={(props: any) => ( + + {this.state.myTableData[props.rowIndex].name} + + )} + width={200} + /> +
    + ); + } +} + +// Create Reusable Cells +interface RowData { + [field: string]: string; +} + +interface MyCellProps { + rowIndex?: number; + field: string; + data: RowData[]; +} + +class MyTextCell extends React.Component { + render(): React.ReactElement { + const {rowIndex, field, data} = this.props; + + return ( + + {data[rowIndex][field]} + + ); + } +} + +class MyLinkCell extends React.Component { + render(): React.ReactElement { + const {rowIndex, field, data} = this.props; + const link: string = data[rowIndex][field]; + + return ( + + {link} + + ); + } +} + +interface MyTable4State { + tableData: RowData[]; +} + +class MyTable4 extends React.Component<{}, MyTable4State> { + + constructor(props: {}) { + super(props); + this.state = { + tableData: [ + {name: "Rylan", email: "Angelita_Weimann42@gmail.com"}, + {name: "Amelia", email: "Dexter.Trantow57@hotmail.com"}, + {name: "Estevan", email: "Aimee7@hotmail.com"}, + {name: "Florence", email: "Jarrod.Bernier13@yahoo.com"}, + {name: "Tressa", email: "Yadira1@hotmail.com"} + ] + }; + } + + render(): React.ReactElement { + return ( + + Name} + cell={ + + } + width={200}/> + + Email} + cell={ + + } + width={200} + /> +
    + ); + } +} diff --git a/fixed-data-table/fixed-data-table.d.ts b/fixed-data-table/fixed-data-table.d.ts index 1dc22dc3d..a1400502e 100644 --- a/fixed-data-table/fixed-data-table.d.ts +++ b/fixed-data-table/fixed-data-table.d.ts @@ -1,6 +1,6 @@ -// Type definitions for fixed-data-table 0.4.7 +// Type definitions for fixed-data-table 0.6.0 // Project: https://github.com/facebook/fixed-data-table -// Definitions by: Petar Paar +// Definitions by: Petar Paar , Stephen Jelfs // Definitions: https://github.com/borisyankov/DefinitelyTyped /// @@ -8,345 +8,396 @@ declare module FixedDataTable { export var version: string; + /** + * Data grid component with fixed or scrollable header and columns. + * + * The layout of the data table is as follows: + * + * + * +---------------------------------------------------+ + * | Fixed Column Group | Scrollable Column Group | + * | Header | Header | + * | | | + * +---------------------------------------------------+ + * | | | + * | Fixed Header Columns | Scrollable Header Columns | + * | | | + * +-----------------------+---------------------------+ + * | | | + * | Fixed Body Columns | Scrollable Body Columns | + * | | | + * +-----------------------+---------------------------+ + * | | | + * | Fixed Footer Columns | Scrollable Footer Columns | + * | | | + * +-----------------------+---------------------------+ + * + * Fixed Column Group Header: + * + * These are the headers for a group of columns if included in + * the table that do not scroll vertically or horizontally. + * + * Scrollable Column Group Header: + * + * The header for a group of columns that do not move while + * scrolling vertically, but move horizontally with the + * horizontal scrolling. + * + * Fixed Header Columns: + * + * The header columns that do not move while scrolling + * vertically or horizontally. + * + * Scrollable Header Columns: + * + * The header columns that do not move while scrolling + * vertically, but move horizontally with the horizontal scrolling. + * + * Fixed Body Columns: + * + * The body columns that do not move while scrolling + * horizontally, but move vertically with the vertical scrolling. + * + * Scrollable Body Columns: + * + * The body columns that move while scrolling vertically or + * horizontally. + * + */ export interface TableProps extends __React.Props { - /** - * Pixel width of table. If all columns do not fit, - * a horizontal scrollbar will appear. - */ - width: number; - - /** - * Pixel height of table. If all rows do not fit, - * a vertical scrollbar will appear. - * - * Either `height` or `maxHeight` must be specified. - */ - height?: number; - - /** - * Maximum pixel height of table. If all rows do not fit, - * a vertical scrollbar will appear. - * - * Either `height` or `maxHeight` must be specified. - */ - maxHeight?: number; - - /** - * Pixel height of table's owner, this is used in a managed scrolling - * situation when you want to slide the table up from below the fold - * without having to constantly update the height on every scroll tick. - * Instead, vary this property on scroll. By using `ownerHeight`, we - * over-render the table while making sure the footer and horizontal - * scrollbar of the table are visible when the current space for the table - * in view is smaller than the final, over-flowing height of table. It - * allows us to avoid resizing and reflowing table when it is moving in the - * view. - * - * This is used if `ownerHeight < height` (or `maxHeight`). - */ - ownerHeight?: number; + /** + * Pixel width of table. If all columns do not fit, a + * horizontal scrollbar will appear. + */ + width: number; + + /** + * Pixel height of table. If all rows do not fit, a + * vertical scrollbar will appear. + * + * Either height or maxHeight must be specified. + */ + height?: number; /** - * hidden or auto - */ - overflowX?: string; - overflowY?: string; + * Maximum pixel height of table. If all rows do not fit, + * a vertical scrollbar will appear. + * + * Either height or maxHeight must be specified. + */ + maxHeight?: number; + + /** + * Pixel height of table's owner, this is used in a managed + * scrolling situation when you want to slide the table up + * from below the fold without having to constantly update + * the height on every scroll tick. Instead, vary this + * property on scroll. By using ownerHeight, we over-render + * the table while making sure the footer and horizontal + * scrollbar of the table are visible when the current space + * for the table in view is smaller than the final, + * over-flowing height of table. It allows us to avoid + * resizing and reflowing table when it is moving in the + * view. + * + * This is used if ownerHeight < height (or maxHeight). + */ + ownerHeight?: number; - /** - * Number of rows in the table. - */ - rowsCount: number; + /** + * 'hidden'|'auto' + */ + overflowX?: string; + + /** + * 'hidden'|'auto' + */ + overflowY?: string; - /** - * Pixel height of rows unless `rowHeightGetter` is specified and returns - * different value. - */ - rowHeight: number; + /** + * Number of rows in the table. + */ + rowsCount: number; - /** - * If specified, `rowHeightGetter(index)` is called for each row and the - * returned value overrides `rowHeight` for particular row. - */ - rowHeightGetter?: Function; + /** + * Pixel height of rows unless rowHeightGetter is specified + * and returns different value. + */ + rowHeight: number; + + /** + * If specified, rowHeightGetter(index) is called for each + * row and the returned value overrides rowHeight for + * particular row. + */ + rowHeightGetter?: (index: number) => number; + + /** + * To get any additional CSS classes that should be added to + * a row, rowClassNameGetter(index) is called. + */ + rowClassNameGetter?: (index: number) => string; - /** - * To get rows to display in table, `rowGetter(index)` - * is called. `rowGetter` should be smart enough to handle async - * fetching of data and return temporary objects - * while data is being fetched. - */ - rowGetter: Function; + /** + * Pixel height of the column group header. + * + * defaultValue: 0 + */ + groupHeaderHeight?: number; - /** - * To get any additional CSS classes that should be added to a row, - * `rowClassNameGetter(index)` is called. - */ - rowClassNameGetter?: Function; + /** + * Pixel height of the header. + * + * defaultValue: 0 + */ + headerHeight?: number; - /** - * Pixel height of the column group header. - */ - groupHeaderHeight?: number; - - /** - * Pixel height of header. - */ - headerHeight: number; - - /** - * Function that is called to get the data for the header row. - * If the function returns null, the header will be set to the - * Column's label property. - */ - headerDataGetter?: Function; - - /** - * Pixel height of footer. - */ - footerHeight?: number; - - /** - * DEPRECATED - use footerDataGetter instead. - * Data that will be passed to footer cell renderers. - */ - footerData?: any; - - /** - * Function that is called to get the data for the footer row. - */ - footerDataGetter?: Function; - - /** - * Value of horizontal scroll. - */ - scrollLeft?: number; - - /** - * Index of column to scroll to. - */ - scrollToColumn?: number; - - /** - * Value of vertical scroll. - */ - scrollTop?: number; - - /** - * Index of row to scroll to. - */ - scrollToRow?: number; - - /** - * Callback that is called when scrolling starts with current horizontal - * and vertical scroll values. - */ - onScrollStart?: Function; - - /** - * Callback that is called when scrolling ends or stops with new horizontal - * and vertical scroll values. - */ - onScrollEnd?: Function; - - /** - * Callback that is called when `rowHeightGetter` returns a different height - * for a row than the `rowHeight` prop. This is necessary because initially - * table estimates heights of some parts of the content. - */ - onContentHeightChange?: Function; - - /** - * Callback that is called when a row is clicked. - */ - onRowClick?: Function; - - /** - * Callback that is called when a row is double clicked. - */ - onRowDoubleClick?: Function; - - /** - * Callback that is called when a mouse-down event happens on a row. - */ - onRowMouseDown?: Function; - - /** - * Callback that is called when a mouse-enter event happens on a row. - */ - onRowMouseEnter?: Function; - - /** - * Callback that is called when a mouse-leave event happens on a row. - */ - onRowMouseLeave?: Function; - - /** - * Callback that is called when resizer has been released - * and column needs to be updated. - * - * Required if the isResizable property is true on any column. - * - * ``` - * function( - * newColumnWidth: number, - * dataKey: string, - * ) - * ``` - */ - onColumnResizeEndCallback?: Function; - - /** - * Whether a column is currently being resized. - */ - isColumnResizing?: boolean + /** + * Pixel height of the footer. + * + * defaultValue: 0 + */ + footerHeight?: number; + + /** + * Value of horizontal scroll. + * + * defaultValue: 0 + */ + scrollLeft?: number; + + /** + * Index of column to scroll to. + */ + scrollToColumn?: number; + + /** + * Value of vertical scroll. + * + * defaultValue: 0 + */ + scrollTop?: number; + + /** + * Index of row to scroll to. + */ + scrollToRow?: number; + + /** + * Callback that is called when scrolling starts with + * current horizontal and vertical scroll values. + */ + onScrollStart?: (horizontalScroll: number, verticalScroll: number) => void; + + /** + * Callback that is called when scrolling ends or stops with + * new horizontal and vertical scroll values. + */ + onScrollEnd?: (horizontalScroll: number, verticalScroll: number) => void; + + /** + * Callback that is called when rowHeightGetter returns a + * different height for a row than the rowHeight prop. This + * is necessary because initially table estimates heights + * of some parts of the content. + */ + onContentHeightChange?: (height: number) => void; + + /** + * Callback that is called when a row is clicked. + */ + onRowClick?: (index: number) => void; + + /** + * Callback that is called when a row is double clicked. + */ + onRowDoubleClick?: (index: number) => void; + + /** + * Callback that is called when a mouse-down event happens + * on a row. + */ + onRowMouseDown?: (index: number) => void; + + /** + * Callback that is called when a mouse-enter event happens + * on a row. + */ + onRowMouseEnter?: (index: number) => void; + + /** + * Callback that is called when a mouse-leave event happens + * on a row. + */ + onRowMouseLeave?: (index: number) => void; + + /** + * Callback that is called when resizer has been released + * and column needs to be updated. + * + * Required if the isResizable property is true on any + * column. + */ + onColumnResizeEndCallback?: (newColumnWidth: number, columnKey: string) => void; + + /** + * Whether a column is currently being resized. + */ + isColumnResizing?: boolean; } + /** + * Component that defines the attributes of table column. + */ interface ColumnProps { /** - * The horizontal alignment of the table cell content. - * 'left', 'center', 'right' - */ - align?: string; + * The horizontal alignment of the table cell content. + * + * 'left'|'center'|'right' + */ + align?: string; - /** - * className for this column's header cell. - */ - headerClassName?: string; + /** + * Controls if the column is fixed when scrolling in the X + * axis. + * + * defaultValue: false + */ + fixed?: boolean; - /** - * className for this column's footer cell. - */ - footerClassName?: string; + /** + * The header cell for this column. This can either be a + * string. a React element, or a function that generates a + * React Element. Passing in a string will render a default + * header cell with that string. By default, the React + * element passed in can expect to receive the following + * props: + * + * props: { + * columnKey: string // (of the column, if given) + * height: number // (supplied from the Table or rowHeightGetter) + * width: number // (supplied from the Column) + * } + * + * Because you are passing in your own React element, you + * can feel free to pass in whatever props you may want or need. + * + * If you pass in a function, you will receive the same props object as the first argument. + */ + header?: any; + + /** + * This is the body cell that will be cloned for this + * column. This can either be a string a React element, + * or a function that generates a React Element. Passing + * in a string will render a default header cell with that + * string. By default, the React element passed in can + * expect to receive the following props: + * + * props: { + * rowIndex; number // (the row index of the cell) + * columnKey: string // (of the column, if given) + * height: number // (supplied from the Table or rowHeightGetter) + * width: number // (supplied from the Column) + * } + * + * Because you are passing in your own React element, you + * can feel free to pass in whatever props you may want or + * need. + * + * If you pass in a function, you will receive the same + * props object as the first argument. + */ + cell?: any; + + /** + * The footer cell for this column. This can either be a + * string. a React element, or a function that generates a + * React Element. Passing in a string will render a default + * header cell with that string. By default, the React + * element passed in can expect to receive the following + * props: + * + * props: { + * columnKey: string // (of the column, if given) + * height: number // (supplied from the Table or rowHeightGetter) + * width: number // (supplied from the Column) + * } + * + * Because you are passing in your own React element, you + * can feel free to pass in whatever props you may want or + * need. + * + * If you pass in a function, you will receive the same + * props object as the first argument. + */ + footer?: any; - /** - * className for each of this column's data cells. - */ - cellClassName?: string; + /** + * This is used to uniquely identify the column, and is not + * required unless you a resizing columns. This will be the + * key given in the onColumnResizeEndCallback on the Table. + */ + columnKey?: string | number; - /** - * The cell renderer that returns React-renderable content for table cell. - * ``` - * function( - * cellData: any, - * cellDataKey: string, - * rowData: object, - * rowIndex: number, - * columnData: any, - * width: number - * ): ?$jsx - * ``` - */ - cellRenderer?: Function; + /** + * The pixel width of the column. + */ + width: number; - /** - * The getter `function(string_cellDataKey, object_rowData)` that returns - * the cell data for the `cellRenderer`. - * If not provided, the cell data will be collected from - * `rowData[cellDataKey]` instead. The value that `cellDataGetter` returns - * will be used to determine whether the cell should re-render. - */ - cellDataGetter?: Function; + /** + * If this is a resizable column this is its minimum pixel + * width. + */ + minWidth?: number; - /** - * The key to retrieve the cell data from the data row. Provided key type - * must be either `string` or `number`. Since we use this - * for keys, it must be specified for each column. - */ - dataKey: string|number; + /** + * If this is a resizable column this is its maximum pixel + * width. + */ + maxWidth?: number; - /** - * Controls if the column is fixed when scrolling in the X axis. - */ - fixed?: boolean; + /** + * The grow factor relative to other columns. Same as the + * flex-grow API from http://www.w3.org/TR/css3-flexbox/. + * Basically, take any available extra width and distribute + * it proportionally according to all columns' flexGrow + * values. Defaults to zero (no-flexing). + */ + flexGrow?: number; - /** - * The cell renderer that returns React-renderable content for table column - * header. - * ``` - * function( - * label: ?string, - * cellDataKey: string, - * columnData: any, - * rowData: array, - * width: number - * ): ?$jsx - * ``` - */ - headerRenderer?: Function; + /** + * Whether the column can be resized with the + * FixedDataTableColumnResizeHandle. Please note that if a + * column has a flex grow, once you resize the column this + * will be set to 0. + * + * This property only provides the UI for the column + * resizing. If this is set to true, you will need to set the + * onColumnResizeEndCallback table property and render your + * columns appropriately. + */ + isResizable?: boolean; - /** - * The cell renderer that returns React-renderable content for table column - * footer. - * ``` - * function( - * label: ?string, - * cellDataKey: string, - * columnData: any, - * rowData: array, - * width: number - * ): ?$jsx - * ``` - */ - footerRenderer?: Function; - - /** - * Bucket for any data to be passed into column renderer functions. - */ - columnData?: any; - - /** - * The column's header label. - */ - label: string; - - /** - * The pixel width of the column. - */ - width: number; - - /** - * If this is a resizable column this is its minimum pixel width. - */ - minWidth?: number; - - /** - * If this is a resizable column this is its maximum pixel width. - */ - maxWidth?: number; - - /** - * The grow factor relative to other columns. Same as the flex-grow API - * from http://www.w3.org/TR/css3-flexbox/. Basically, take any available - * extra width and distribute it proportionally according to all columns' - * flexGrow values. Defaults to zero (no-flexing). - */ - flexGrow?: number; - - /** - * Whether the column can be resized with the - * FixedDataTableColumnResizeHandle. Please note that if a column - * has a flex grow, once you resize the column this will be set to 0. - * - * This property only provides the UI for the column resizing. If this - * is set to true, you will need ot se the onColumnResizeEndCallback table - * property and render your columns appropriately. - */ - isResizable?: boolean; - - /** - * Experimental feature - * Whether cells in this column can be removed from document when outside - * of viewport as a result of horizontal scrolling. - * Setting this property to true allows the table to not render cells in - * particular column that are outside of viewport for visible rows. This - * allows to create table with many columns and not have vertical scrolling - * performance drop. - * Setting the property to false will keep previous behaviour and keep - * cell rendered if the row it belongs to is visible. - */ - allowCellsRecycling?: boolean; + /** + * Whether cells in this column can be removed from document + * when outside of viewport as a result of horizontal + * scrolling. Setting this property to true allows the table + * to not render cells in particular column that are outside + * of viewport for visible rows. This allows to create table + * with many columns and not have vertical scrolling + * performance drop. Setting the property to false will keep + * previous behaviour and keep cell rendered if the row it + * belongs to is visible. + * + * defaultValue: false + */ + allowCellsRecycling?: boolean; } - + + /** + * Component that defines the attributes of a table column group. + */ export interface ColumnGroupProps { /** * The horizontal alignment of the table cell content. @@ -355,35 +406,75 @@ declare module FixedDataTable { align?: string; /** - * Controls if the column group is fixed when scrolling in the X axis. + * Controls if the column group is fixed when scrolling in the X + * axis. + * + * defaultValue: false */ fixed?: boolean; - /** - * Bucket for any data to be passed into column group renderer functions. - */ - columnGroupData?: any; + /** + * The header cell for this column group. This can either be + * a string. a React element, or a function that generates a + * React Element. Passing in a string will render a default + * header cell with that string. By default, the React + * element passed in can expect to receive the following + * props: + * + * props: { + * height: number // (supplied from the groupHeaderHeight) + * width: number // (supplied from the Column) + * } + * + * Because you are passing in your own React element, you + * can feel free to pass in whatever props you may want or + * need. + * + * If you pass in a function, you will receive the same props + * object as the first argument. + */ + header: any; + } + + /** + * Component that handles default cell layout and styling. + * + * All props unless specified below will be set onto the top + * level div rendered by the cell. + * + * Example usage via from a Column: + * + * const MyColumn = ( + * ( + * + * Cell number: {rowIndex} + * + * )} + * width={100} + * /> + * ); + */ + export interface CellProps { + /** + * Outer height of the cell. + */ + height?: number; - /** - * The column group's header label. - */ - label?: string; + /** + * Outer width of the cell. + */ + width?: number; - /** - * The cell renderer that returns React-renderable content for a table - * column group header. If it's not specified, the label from props will - * be rendered as header content. - * ``` - * function( - * label: ?string, - * cellDataKey: string, - * columnGroupData: any, - * rowData: array, // array of labels of all columnGroups - * width: number - * ): ?$jsx - * ``` - */ - groupHeaderRenderer?: Function; + /** + * Optional prop that if specified on the Column will be + * passed to the cell. It can be used to uniquely identify + * which column is the cell is in. + */ + columnKey?: string | number; } export class Table extends __React.Component { @@ -395,6 +486,9 @@ declare module FixedDataTable { export class ColumnGroup extends __React.Component { render(): __React.DOMElement } + export class Cell extends __React.Component { + render(): __React.DOMElement + } } declare module "fixed-data-table" { From 2572eb96ddfb139abfc4e1e6a6d0d90e81b52de8 Mon Sep 17 00:00:00 2001 From: stephenjelfs Date: Tue, 8 Dec 2015 13:51:38 +0100 Subject: [PATCH 349/389] Fixed-data-table 0.4.7 tests should use corresponding 0.4.7 definitions. --- fixed-data-table/fixed-data-table-0.4.7-tests.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fixed-data-table/fixed-data-table-0.4.7-tests.tsx b/fixed-data-table/fixed-data-table-0.4.7-tests.tsx index 28dae2890..641487ff6 100644 --- a/fixed-data-table/fixed-data-table-0.4.7-tests.tsx +++ b/fixed-data-table/fixed-data-table-0.4.7-tests.tsx @@ -1,4 +1,4 @@ -/// +/// /// /// From c34b1e67eee7862f1b3ec48e6c8b6878ae8b0500 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Tue, 8 Dec 2015 19:12:39 +0500 Subject: [PATCH 350/389] lodash: signatures of _.omit have been changed --- lodash/lodash-tests.ts | 48 ++++++++++++++++++------- lodash/lodash.d.ts | 80 +++++++++++++++++++++++------------------- 2 files changed, 80 insertions(+), 48 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index ce60da779..c409e2621 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -7073,19 +7073,43 @@ module TestFunctions { } } -interface HasName { - name: string; +// _.omit +module TestOmit { + let predicate: (element: any, key: string, collection: any) => boolean; + + { + let result: TResult; + + result = _.omit({}, 'a'); + result = _.omit({}, 0, 'a'); + result = _.omit({}, true, 0, 'a'); + result = _.omit({}, ['b', 1, false], true, 0, 'a'); + result = _.omit({}, predicate); + result = _.omit({}, predicate, any); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _({}).omit('a'); + result = _({}).omit(0, 'a'); + result = _({}).omit(true, 0, 'a'); + result = _({}).omit(['b', 1, false], true, 0, 'a'); + result = _({}).omit(predicate); + result = _({}).omit(predicate, any); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _({}).chain().omit('a'); + result = _({}).chain().omit(0, 'a'); + result = _({}).chain().omit(true, 0, 'a'); + result = _({}).chain().omit(['b', 1, false], true, 0, 'a'); + result = _({}).chain().omit(predicate); + result = _({}).chain().omit(predicate, any); + } } -result = _.omit({ 'name': 'moe', 'age': 40 }, 'age'); -result = _.omit({ 'name': 'moe', 'age': 40 }, ['age']); -result = _.omit({ 'name': 'moe', 'age': 40 }, function (value) { - return typeof value == 'number'; -}); -result = _({ 'name': 'moe', 'age': 40 }).omit('age').value(); -result = _({ 'name': 'moe', 'age': 40 }).omit(['age']).value(); -result = _({ 'name': 'moe', 'age': 40 }).omit(function (value) { - return typeof value == 'number'; -}).value(); // _.pairs module TestPairs { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 801b66be9..253107c7f 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -11842,54 +11842,62 @@ declare module _ { //_.omit interface LoDashStatic { /** - * Creates a shallow clone of object excluding the specified properties. Property names may be - * specified as individual arguments or as arrays of property names. If a callback is provided - * it will be executed for each property of object omitting the properties the callback returns - * truey for. The callback is bound to thisArg and invoked with three arguments; (value, key, - * object). - * @param object The source object. - * @param keys The properties to omit. - * @return An object without the omitted properties. - **/ - omit( + * The opposite of _.pick; this method creates an object composed of the own and inherited enumerable + * properties of object that are not omitted. + * + * @param object The source object. + * @param predicate The function invoked per iteration or property names to omit, specified as individual + * property names or arrays of property names. + * @param thisArg The this binding of predicate. + * @return Returns the new object. + */ + omit( object: T, - ...keys: string[]): Omitted; + predicate: ObjectIterator, + thisArg?: any + ): TResult; /** - * @see _.omit - **/ - omit( + * @see _.omit + */ + omit( object: T, - keys: string[]): Omitted; - - /** - * @see _.omit - **/ - omit( - object: T, - callback: ObjectIterator, - thisArg?: any): Omitted; + ...predicate: (StringRepresentable|StringRepresentable[])[] + ): TResult; } interface LoDashImplicitObjectWrapper { /** - * @see _.omit - **/ - omit( - ...keys: string[]): LoDashImplicitObjectWrapper; + * @see _.omit + */ + omit( + predicate: ObjectIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper; /** - * @see _.omit - **/ - omit( - keys: string[]): LoDashImplicitObjectWrapper; + * @see _.omit + */ + omit( + ...predicate: (StringRepresentable|StringRepresentable[])[] + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.omit + */ + omit( + predicate: ObjectIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper; /** - * @see _.omit - **/ - omit( - callback: ObjectIterator, - thisArg?: any): LoDashImplicitObjectWrapper; + * @see _.omit + */ + omit( + ...predicate: (StringRepresentable|StringRepresentable[])[] + ): LoDashExplicitObjectWrapper; } //_.pairs From 5088a85caf3c7df439042e79b9fc34bd55b4b19f Mon Sep 17 00:00:00 2001 From: stephenjelfs Date: Tue, 8 Dec 2015 16:37:24 +0100 Subject: [PATCH 351/389] Improve type safety of header/cell/footer fixed-data-table getters. --- fixed-data-table/fixed-data-table-tests.tsx | 6 +++--- fixed-data-table/fixed-data-table.d.ts | 17 +++++++++++------ 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/fixed-data-table/fixed-data-table-tests.tsx b/fixed-data-table/fixed-data-table-tests.tsx index f104ac5e4..916c0e64a 100644 --- a/fixed-data-table/fixed-data-table-tests.tsx +++ b/fixed-data-table/fixed-data-table-tests.tsx @@ -2,7 +2,7 @@ /// import * as React from "react"; -import {Table, Cell, Column} from "fixed-data-table"; +import {Table, Cell, Column, CellProps} from "fixed-data-table"; // create your Table class MyTable1 extends React.Component<{}, {}> { @@ -68,7 +68,7 @@ class MyTable3 extends React.Component<{}, MyTable3State> { height={500}> Name} - cell={(props: any) => ( + cell={(props: CellProps) => ( {this.state.myTableData[props.rowIndex].name} @@ -85,7 +85,7 @@ interface RowData { [field: string]: string; } -interface MyCellProps { +interface MyCellProps extends CellProps { rowIndex?: number; field: string; data: RowData[]; diff --git a/fixed-data-table/fixed-data-table.d.ts b/fixed-data-table/fixed-data-table.d.ts index a1400502e..5fb0438a0 100644 --- a/fixed-data-table/fixed-data-table.d.ts +++ b/fixed-data-table/fixed-data-table.d.ts @@ -284,13 +284,13 @@ declare module FixedDataTable { * * If you pass in a function, you will receive the same props object as the first argument. */ - header?: any; + header?: string | __React.ReactElement | ((props: CellProps) => (string | __React.ReactElement)); /** * This is the body cell that will be cloned for this * column. This can either be a string a React element, * or a function that generates a React Element. Passing - * in a string will render a default header cell with that + * in a string will render a default cell with that * string. By default, the React element passed in can * expect to receive the following props: * @@ -308,7 +308,7 @@ declare module FixedDataTable { * If you pass in a function, you will receive the same * props object as the first argument. */ - cell?: any; + cell?: string | __React.ReactElement | ((props: CellProps) => (string | __React.ReactElement)); /** * The footer cell for this column. This can either be a @@ -331,7 +331,7 @@ declare module FixedDataTable { * If you pass in a function, you will receive the same * props object as the first argument. */ - footer?: any; + footer?: string | __React.ReactElement | ((props: CellProps) => (string | __React.ReactElement)); /** * This is used to uniquely identify the column, and is not @@ -433,7 +433,7 @@ declare module FixedDataTable { * If you pass in a function, you will receive the same props * object as the first argument. */ - header: any; + header: string | __React.ReactElement | ((props: CellProps) => (string | __React.ReactElement)); } /** @@ -459,6 +459,11 @@ declare module FixedDataTable { * ); */ export interface CellProps { + /** + * The row index of the cell. + */ + rowIndex?: number + /** * Outer height of the cell. */ @@ -472,7 +477,7 @@ declare module FixedDataTable { /** * Optional prop that if specified on the Column will be * passed to the cell. It can be used to uniquely identify - * which column is the cell is in. + * which column is the cell is in. */ columnKey?: string | number; } From 4e8bcf2667a55bf807634e951ab081cc8717f338 Mon Sep 17 00:00:00 2001 From: paul cheung Date: Wed, 9 Dec 2015 00:25:53 +0800 Subject: [PATCH 352/389] add open event for dialog(as build failed in TypeScript 1.7) --- jqueryui/jqueryui.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jqueryui/jqueryui.d.ts b/jqueryui/jqueryui.d.ts index d9a33ed4f..9dd576e1a 100644 --- a/jqueryui/jqueryui.d.ts +++ b/jqueryui/jqueryui.d.ts @@ -362,7 +362,8 @@ declare module JQueryUI { title?: string; width?: any; // number or string zIndex?: number; - + + open?: DialogEvent; close?: DialogEvent; } From 59917025e03fac6bafdbcbfe5555c42ff8b3570e Mon Sep 17 00:00:00 2001 From: Sabeeh Ul Hussnain Date: Tue, 8 Dec 2015 22:33:30 +0500 Subject: [PATCH 353/389] file renamed --- lobibox/{lobibox.js-tests.ts => lobibox-tests.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename lobibox/{lobibox.js-tests.ts => lobibox-tests.ts} (100%) diff --git a/lobibox/lobibox.js-tests.ts b/lobibox/lobibox-tests.ts similarity index 100% rename from lobibox/lobibox.js-tests.ts rename to lobibox/lobibox-tests.ts From cf491bf776f23f5828ebd8f8ce476c9dc7c9e9bc Mon Sep 17 00:00:00 2001 From: Nick Malaguti Date: Tue, 8 Dec 2015 13:08:32 -0500 Subject: [PATCH 354/389] Add definitions for chai-string --- chai-string/chai-string-tests.ts | 128 +++++++++++++++++++++++++++++++ chai-string/chai-string.d.ts | 45 +++++++++++ 2 files changed, 173 insertions(+) create mode 100644 chai-string/chai-string-tests.ts create mode 100644 chai-string/chai-string.d.ts diff --git a/chai-string/chai-string-tests.ts b/chai-string/chai-string-tests.ts new file mode 100644 index 000000000..f5380b076 --- /dev/null +++ b/chai-string/chai-string-tests.ts @@ -0,0 +1,128 @@ +/// +/// +/// + +var should = chai.should(); +var assert = chai.assert; +var expect = chai.expect; + +var chai_string = require('chai-string'); +chai.use(chai_string); + +describe('chai-string', function() { + + describe('#startsWith', function() { + + it('check that', function() { + var obj = { foo: 'hello world' }; + expect(obj).to.have.property('foo').that.startsWith('hello'); + }); + + }); + + describe('#startWith', function() { + + it('should return true', function() { + var str = 'abcdef', + prefix = 'abc'; + str.should.startWith(prefix); + }); + + it('should return false', function() { + var str = 'abcdef', + prefix = 'cba'; + str.should.not.startWith(prefix); + }); + + }); + + describe('#endWith', function() { + + it('should return true', function() { + var str = 'abcdef', + suffix = 'def'; + str.should.endWith(suffix); + }); + + it('should return false', function() { + var str = 'abcdef', + suffix = 'fed'; + str.should.not.endWith(suffix); + }); + + }); + + describe('tdd alias', function() { + + beforeEach(function() { + this.str = 'abcdef'; + this.str2 = 'a\nb\tc\r d ef'; + }); + + it('.startsWith', function() { + assert.startsWith(this.str, 'abc'); + }); + + it('.notStartsWith', function() { + assert.notStartsWith(this.str, 'cba'); + }); + + it('.endsWith', function() { + assert.endsWith(this.str, 'def'); + }); + + it('.notEndsWith', function() { + assert.notEndsWith(this.str, 'fed'); + }); + + it('.equalIgnoreCase', function() { + assert.equalIgnoreCase(this.str, 'AbCdEf'); + }); + + it('.notEqualIgnoreCase', function() { + assert.notEqualIgnoreCase(this.str, 'abDDD'); + }); + + it('.equalIgnoreSpaces', function() { + assert.equalIgnoreSpaces(this.str, this.str2); + }); + + it('.notEqualIgnoreSpaces', function() { + assert.notEqualIgnoreSpaces(this.str, this.str2 + 'g'); + }); + + it('.singleLine', function() { + assert.singleLine(this.str); + }); + + it('.notSingleLine', function() { + assert.notSingleLine("abc\ndef"); + }); + + it('.reverseOf', function() { + assert.reverseOf(this.str, 'fedcba'); + }); + + it('.notReverseOf', function() { + assert.notReverseOf(this.str, 'aaaaa'); + }); + + it('.palindrome', function() { + assert.palindrome('abcba'); + assert.palindrome('abccba'); + assert.palindrome(''); + }); + + it('.notPalindrome', function() { + assert.notPalindrome(this.str); + }); + + it('.entriesCount', function() { + assert.entriesCount('abcabd', 'ab', 2); + assert.entriesCount('ababd', 'ab', 2); + assert.entriesCount('abab', 'ab', 2); + assert.entriesCount('', 'ab', 0); + }); + + }); +}); diff --git a/chai-string/chai-string.d.ts b/chai-string/chai-string.d.ts new file mode 100644 index 000000000..fd1766523 --- /dev/null +++ b/chai-string/chai-string.d.ts @@ -0,0 +1,45 @@ +// Type definitions for chai-string 1.1.4 +// Project: https://github.com/onechiporenko/chai-string +// Definitions by: Nick Malaguti +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module Chai { + interface Assertion extends LanguageChains, NumericComparison, TypeComparison { + startsWith(expected: string, message?: string): Assertion; + startWith(expected: string, message?: string): Assertion; + endsWith(expected: string, message?: string): Assertion; + endWith(expected: string, message?: string): Assertion; + equalIgnoreCase(expected: string, message?: string): Assertion; + equalIgnoreSpaces(expected: string, message?: string): Assertion; + singleLine(message?: string): Assertion; + reverseOf(message?: string): Assertion; + palindrome(message?: string): Assertion; + entriesCount(substr: string, expected: number, message?: string): Assertion; + } + + export interface Assert { + startsWith(val: string, exp: string, msg?: string): void; + notStartsWith(val: string, exp: string, msg?: string): void; + endsWith(val: string, exp: string, msg?: string): void; + notEndsWith(val: string, exp: string, msg?: string): void; + equalIgnoreCase(val: string, exp: string, msg?: string): void; + notEqualIgnoreCase(val: string, exp: string, msg?: string): void; + equalIgnoreSpaces(val: string, exp: string, msg?: string): void; + notEqualIgnoreSpaces(val: string, exp: string, msg?: string): void; + singleLine(val: string, msg?: string): void; + notSingleLine(val: string, msg?: string): void; + reverseOf(val: string, exp: string, msg?: string): void; + notReverseOf(val: string, exp: string, msg?: string): void; + palindrome(val: string, msg?: string): void; + notPalindrome(val: string, msg?: string): void; + entriesCount(str: string, substr: string, count: number, msg?: string): void; + } +} + +declare module 'chai-string' { + function chaiString(chai: any, utils: any): void; + namespace chaiString {} + export = chaiString; +} From aae1368c8ee377f6e9c59c2d6faf1acb3ece7e05 Mon Sep 17 00:00:00 2001 From: Joseph Dotson Date: Tue, 8 Dec 2015 14:47:30 -0500 Subject: [PATCH 355/389] passing a value to resolve should not be required in Q --- q/Q.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/q/Q.d.ts b/q/Q.d.ts index ba30b2745..2594df7f7 100644 --- a/q/Q.d.ts +++ b/q/Q.d.ts @@ -20,7 +20,7 @@ declare module Q { interface Deferred { promise: Promise; - resolve(value: T): void; + resolve(value?: T): void; reject(reason: any): void; notify(value: any): void; makeNodeResolver(): (reason: any, value: T) => void; From b8c618001c9769b653da68e2f8b7d279f12b0366 Mon Sep 17 00:00:00 2001 From: Cyril Schumacher Date: Wed, 9 Dec 2015 10:42:31 +0100 Subject: [PATCH 356/389] Update definition for "express-validator": add "isMACAddress" function. --- express-validator/express-validator.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/express-validator/express-validator.d.ts b/express-validator/express-validator.d.ts index 428c90afd..78073231b 100644 --- a/express-validator/express-validator.d.ts +++ b/express-validator/express-validator.d.ts @@ -66,12 +66,14 @@ declare module ExpressValidator { * Accepts http, https, ftp */ isUrl(): Validator; + /** * Combines isIPv4 and isIPv6 */ isIP(): Validator; isIPv4(): Validator; isIPv6(): Validator; + isMACAddress(): Validator; isAlpha(): Validator; isAlphanumeric(): Validator; isNumeric(): Validator; From abb55149183ccd505da474fca2837851fd0ef508 Mon Sep 17 00:00:00 2001 From: bgrieder Date: Wed, 9 Dec 2015 10:51:13 +0100 Subject: [PATCH 357/389] Type definitions for bull: https://github.com/OptimalBits/bull --- bull/bull-tests.ts.tscparams | 1 + bull/bull-tests.tsx | 102 ++++++++++++ bull/bull.d.ts | 311 +++++++++++++++++++++++++++++++++++ 3 files changed, 414 insertions(+) create mode 100644 bull/bull-tests.ts.tscparams create mode 100644 bull/bull-tests.tsx create mode 100644 bull/bull.d.ts diff --git a/bull/bull-tests.ts.tscparams b/bull/bull-tests.ts.tscparams new file mode 100644 index 000000000..6641df12d --- /dev/null +++ b/bull/bull-tests.ts.tscparams @@ -0,0 +1 @@ +--target es5 --noImplicitAny --module commonjs diff --git a/bull/bull-tests.tsx b/bull/bull-tests.tsx new file mode 100644 index 000000000..bd25efc0c --- /dev/null +++ b/bull/bull-tests.tsx @@ -0,0 +1,102 @@ +/** + * Created by Bruno Grieder + */ + +/// + + +import * as Queue from "bull" + +var videoQueue = Queue( 'video transcoding', 6379, '127.0.0.1' ); +var audioQueue = Queue( 'audio transcoding', 6379, '127.0.0.1' ); +var imageQueue = Queue( 'image transcoding', 6379, '127.0.0.1' ); + +videoQueue.process( ( job: Queue.Job, done: Queue.DoneCallback ) => { + + // job.data contains the custom data passed when the job was created + // job.jobId contains id of this job. + + // transcode video asynchronously and report progress + job.progress( 42 ); + + // call done when finished + done(); + + // or give a error if error + done( Error( 'error transcoding' ) ); + + // or pass it a result + done( null, { framerate: 29.5 /* etc... */ } ); + + // If the job throws an unhandled exception it is also handled correctly + throw (Error( 'some unexpected error' )); +} ); + +audioQueue.process( ( job: Queue.Job, done: Queue.DoneCallback ) => { + // transcode audio asynchronously and report progress + job.progress( 42 ); + + // call done when finished + done(); + + // or give a error if error + done( Error( 'error transcoding' ) ); + + // or pass it a result + done( null, { samplerate: 48000 /* etc... */ } ); + + // If the job throws an unhandled exception it is also handled correctly + throw (Error( 'some unexpected error' )); +} ); + +imageQueue.process( ( job: Queue.Job, done: Queue.DoneCallback ) => { + // transcode image asynchronously and report progress + job.progress( 42 ); + + // call done when finished + done(); + + // or give a error if error + done( Error( 'error transcoding' ) ); + + // or pass it a result + done( null, { width: 1280, height: 720 /* etc... */ } ); + + // If the job throws an unhandled exception it is also handled correctly + throw (Error( 'some unexpected error' )); +} ); + +videoQueue.add( { video: 'http://example.com/video1.mov' } ); +audioQueue.add( { audio: 'http://example.com/audio1.mp3' } ); +imageQueue.add( { image: 'http://example.com/image1.tiff' } ); + + +////////////////////////////////////////////////////////////////////////////////// +// +// Using Promises +// +////////////////////////////////////////////////////////////////////////////////// + +const fetchVideo = ( url: string ): Promise => { return null } +const transcodeVideo = ( data: any ): Promise => { return null } + +interface VideoJob extends Queue.Job { + data: {url: string} +} + + +videoQueue.process( ( job: VideoJob ) => { // don't forget to remove the done callback! + // Simply return a promise + return fetchVideo( job.data.url ).then( transcodeVideo ); + + // Handles promise rejection + return Promise.reject( new Error( 'error transcoding' ) ); + + // Passes the value the promise is resolved with to the "completed" event + return Promise.resolve( { framerate: 29.5 /* etc... */ } ); + + // If the job throws an unhandled exception it is also handled correctly + throw new Error( 'some unexpected error' ); + // same as + return Promise.reject( new Error( 'some unexpected error' ) ); +} ); diff --git a/bull/bull.d.ts b/bull/bull.d.ts new file mode 100644 index 000000000..b867c1123 --- /dev/null +++ b/bull/bull.d.ts @@ -0,0 +1,311 @@ +// Type definitions for bull 0.7.0 +// Project: https://github.com/OptimalBits/bull +// Definitions by: Bruno Grieder +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + + +declare module "bull" { + + import * as Redis from "redis"; + + /** + * This is the Queue constructor. + * It creates a new Queue that is persisted in Redis. + * Everytime the same queue is instantiated it tries to process all the old jobs that may exist from a previous unfinished session. + */ + function Bull(queueName: string, redisPort: number, redisHost: string, redisOpt?: Redis.ClientOpts): Bull.Queue; + + module Bull { + + export interface DoneCallback { + (error?: Error, value?: any): void + } + + export interface Job { + + id: string + + /** + * The custom data passed when the job was created + */ + data: Object; + + /** + * Report progress on a job + */ + progress(value: any): Promise; + + /** + * Removes a Job from the queue from all the lists where it may be included. + * @returns {Promise} A promise that resolves when the job is removed. + */ + remove(): Promise; + + /** + * Rerun a Job that has failed. + * @returns {Promise} A promise that resolves when the job is scheduled for retry. + */ + retry(): Promise; + } + + export interface Backoff { + + /** + * Backoff type, which can be either `fixed` or `exponential` + */ + type: string + + /** + * Backoff delay, in milliseconds + */ + delay: number; + } + + export interface AddOptions { + /** + * An amount of miliseconds to wait until this job can be processed. + * Note that for accurate delays, both server and clients should have their clocks synchronized + */ + delay?: number; + + /** + * A number of attempts to retry if the job fails [optional] + */ + attempts?: number; + + /** + * Backoff setting for automatic retries if the job fails + */ + backoff?: number | Backoff + + /** + * A boolean which, if true, adds the job to the right + * of the queue instead of the left (default false) + */ + lifo?: boolean; + + /** + * The number of milliseconds after which the job should be fail with a timeout error + */ + timeout?: number; + } + + export interface Queue { + + /** + * Defines a processing function for the jobs placed into a given Queue. + * + * The callback is called everytime a job is placed in the queue. + * It is passed an instance of the job as first argument. + * + * The done callback can be called with an Error instance, to signal that the job did not complete successfully, + * or with a result as second argument as second argument (e.g.: done(null, result);) when the job is successful. + * Errors will be passed as a second argument to the "failed" event; + * results, as a second argument to the "completed" event. + * + * concurrency: Bull will then call you handler in parallel respecting this max number. + */ + process(concurrency: number, callback: (job: Job, done: DoneCallback) => void): void; + + /** + * Defines a processing function for the jobs placed into a given Queue. + * + * The callback is called everytime a job is placed in the queue. + * It is passed an instance of the job as first argument. + * + * The done callback can be called with an Error instance, to signal that the job did not complete successfully, + * or with a result as second argument as second argument (e.g.: done(null, result);) when the job is successful. + * Errors will be passed as a second argument to the "failed" event; + * results, as a second argument to the "completed" event. + */ + process(callback: (job: Job, done: DoneCallback) => void): void; + + /** + * Defines a processing function for the jobs placed into a given Queue. + * + * The callback is called everytime a job is placed in the queue. + * It is passed an instance of the job as first argument. + * + * A promise must be returned to signal job completion. + * If the promise is rejected, the error will be passed as a second argument to the "failed" event. + * If it is resolved, its value will be the "completed" event's second argument. + * + * concurrency: Bull will then call you handler in parallel respecting this max number. + */ + process(concurrency: number, callback: (job: Job) => void): Promise; + + /** + * Defines a processing function for the jobs placed into a given Queue. + * + * The callback is called everytime a job is placed in the queue. + * It is passed an instance of the job as first argument. + * + * A promise must be returned to signal job completion. + * If the promise is rejected, the error will be passed as a second argument to the "failed" event. + * If it is resolved, its value will be the "completed" event's second argument. + */ + process(callback: (job: Job) => void): Promise; + + // process(callback: (job: Job, done?: DoneCallback) => void): Promise; + + /** + * Creates a new job and adds it to the queue. + * If the queue is empty the job will be executed directly, + * otherwise it will be placed in the queue and executed as soon as possible. + */ + add(data: Object, opts?: AddOptions): Promise; + + /** + * Returns a promise that resolves when the queue is paused. + * The pause is global, meaning that all workers in all queue instances for a given queue will be paused. + * A paused queue will not process new jobs until resumed, + * but current jobs being processed will continue until they are finalized. + * + * Pausing a queue that is already paused does nothing. + */ + pause(): Promise; + + /** + * Returns a promise that resolves when the queue is resumed after being paused. + * The resume is global, meaning that all workers in all queue instances for a given queue will be resumed. + * + * Resuming a queue that is not paused does nothing. + */ + resume(): Promise; + + /** + * Returns a promise that returns the number of jobs in the queue, waiting or paused. + * Since there may be other processes adding or processing jobs, this value may be true only for a very small amount of time. + */ + count(): Promise; + + /** + * Empties a queue deleting all the input lists and associated jobs. + */ + empty(): Promise; + + /** + * Closes the underlying redis client. Use this to perform a graceful shutdown. + * + * `close` can be called from anywhere, with one caveat: + * if called from within a job handler the queue won't close until after the job has been processed + */ + close(): Promise; + + /** + * Returns a promise that will return the job instance associated with the jobId parameter. + * If the specified job cannot be located, the promise callback parameter will be set to null. + */ + getJob(jobId: string): Promise; + + /** + * Tells the queue remove all jobs created outside of a grace period in milliseconds. + * You can clean the jobs with the following states: completed, waiting, active, delayed, and failed. + */ + clean(gracePeriod: number, jobsState?: string): Promise; + + /** + * Listens to queue events + * 'ready', 'error', 'activ', 'progress', 'completed', 'failed', 'paused', 'resumed', 'cleaned' + */ + on(eventName: string, callback: EventCallback): void; + } + + interface EventCallback { + (...args: any[]): void + } + + interface ReadyEventCallback extends EventCallback { + (): void; + } + + interface ErrorEventCallback extends EventCallback { + (error: Error): void; + } + + interface JobPromise { + /** + * Abort this job + */ + cancel(): void + } + + interface ActiveEventCallback extends EventCallback { + (job: Job, jobPromise: JobPromise): void; + } + + interface ProgressEventCallback extends EventCallback { + (job: Job, progress: any): void; + } + + interface CompletedEventCallback extends EventCallback { + (job: Job, result: Object): void; + } + + interface FailedEventCallback extends EventCallback { + (job: Job, error: Error): void; + } + + interface PausedEventCallback extends EventCallback { + (): void; + } + + interface ResumedEventCallback extends EventCallback { + (job?: Job): void; + } + + /** + * @see clean() for details + */ + interface CleanedEventCallback extends EventCallback { + (jobs: Job[], type: string): void; + } + } + + export = Bull; +} + +declare module "bull/lib/priority-queue" { + + import * as Bull from "bull"; + import * as Redis from "redis"; + + /** + * This is the Queue constructor of priority queue. + * + * It works same a normal queue, with same function and parameters. + * The only difference is that the Queue#add() allow an options opts.priority + * that could take ["low", "normal", "medium", "hight", "critical"]. If no options provider, "normal" will be taken. + * + * The priority queue will process more often highter priority jobs than lower. + */ + function PQueue(queueName: string, redisPort: number, redisHost: string, redisOpt?: Redis.ClientOpts): PQueue.PriorityQueue; + + module PQueue { + + export interface AddOptions extends Bull.AddOptions { + + /** + * "low", "normal", "medium", "high", "critical" + */ + priority?: string; + } + + + export interface PriorityQueue extends Bull.Queue { + + /** + * Creates a new job and adds it to the queue. + * If the queue is empty the job will be executed directly, + * otherwise it will be placed in the queue and executed as soon as possible. + */ + add(data: Object, opts?: PQueue.AddOptions): Promise; + + } + } + + export = PQueue; +} From f9944e023e7f1bcb13b080060dd253ed072dcd41 Mon Sep 17 00:00:00 2001 From: Roland Zwaga Date: Wed, 9 Dec 2015 11:56:35 +0100 Subject: [PATCH 358/389] Added IFontoMessageEventData interface (is currently undocumented publicly, so I can't post a link to any documentation) --- fontoxml/fontoxml-tests.ts | 7 +++++++ fontoxml/fontoxml.d.ts | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/fontoxml/fontoxml-tests.ts b/fontoxml/fontoxml-tests.ts index 7821806cf..11d47db89 100644 --- a/fontoxml/fontoxml-tests.ts +++ b/fontoxml/fontoxml-tests.ts @@ -25,4 +25,11 @@ var simpleinit:com.fontoxml.IInvocator = { documentIds: ["11-22-33","44-55-66"], cmsBaseUrl: "/test/", editSessionToken: "aa-bb-cc-dd-ee" +} + +var eventData:com.fontoxml.IFontoMessageEventData = { + command: "test-command", + type: "test-type", + scope: init, + metadata: {} } \ No newline at end of file diff --git a/fontoxml/fontoxml.d.ts b/fontoxml/fontoxml.d.ts index 4d621c234..8e6a0a2c7 100644 --- a/fontoxml/fontoxml.d.ts +++ b/fontoxml/fontoxml.d.ts @@ -37,4 +37,13 @@ declare module com.fontoxml roleId:string; } + //This is describes the object that is assigned to the MessageEvent.data + //property after the FontoXML editor posts a message + export interface IFontoMessageEventData { + command: string; + type: string; + scope: com.fontoxml.IInvocator; + metadata: any; + } + } \ No newline at end of file From e974403847dcd1d1464c5765668142920c41a447 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Wed, 9 Dec 2015 16:59:52 +0500 Subject: [PATCH 359/389] lodash: signatures of _.before have been changed --- lodash/lodash-tests.ts | 41 +++++++++++++++++++++++++---------------- lodash/lodash.d.ts | 21 ++++++++++++++++----- 2 files changed, 41 insertions(+), 21 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index c409e2621..7674eaf6f 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -4658,22 +4658,31 @@ module TestBackflow { } // _.before -var testBeforeFn = ((n: number) => () => ++n)(0); -var testBeforeResultFn = <() => number>_.before<() => number>(3, testBeforeFn); -result = testBeforeResultFn(); -// → 1 -result = testBeforeResultFn(); -// → 2 -result = testBeforeResultFn(); -// → 2 -var testBeforeFn = ((n: number) => () => ++n)(0); -var testBeforeResultFn = <() => number>_(3).before<() => number>(testBeforeFn); -result = testBeforeResultFn(); -// → 1 -result = testBeforeResultFn(); -// → 2 -result = testBeforeResultFn(); -// → 2 +module TestBefore { + interface Func { + (a: string, b: number): boolean; + } + + let func: Func; + + { + let result: Func; + + _.before(42, func); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + _(42).before(func); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + _(42).chain().before(func); + } +} var funcBind = function(greeting: string, punctuation: string) { return greeting + ' ' + this.user + punctuation; }; var funcBound1: (punctuation: string) => any = _.bind(funcBind, { 'name': 'moe' }, 'hi'); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 253107c7f..f7a9a5694 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -8048,20 +8048,31 @@ declare module _ { interface LoDashStatic { /** * Creates a function that invokes func, with the this binding and arguments of the created function, while - * it is called less than n times. Subsequent calls to the created function return the result of the last func + * it’s called less than n times. Subsequent calls to the created function return the result of the last func * invocation. + * * @param n The number of calls at which func is no longer invoked. * @param func The function to restrict. * @return Returns the new restricted function. */ - before(n: number, func: TFunc): TFunc; + before( + n: number, + func: TFunc + ): TFunc; } interface LoDashImplicitWrapper { /** - * @sed _.before - */ - before(func: TFunc): TFunc; + * @see _.before + **/ + before(func: TFunc): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.before + **/ + before(func: TFunc): LoDashExplicitObjectWrapper; } //_.bind From 0f91841e0e2079d0d00603d30a5ccb30de5c86f4 Mon Sep 17 00:00:00 2001 From: Bart van den Burg Date: Wed, 9 Dec 2015 14:06:34 +0100 Subject: [PATCH 360/389] add definition for the angular translate filter --- angular-translate/angular-translate-tests.ts | 5 +++++ angular-translate/angular-translate.d.ts | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/angular-translate/angular-translate-tests.ts b/angular-translate/angular-translate-tests.ts index c60247f42..a19d27ade 100644 --- a/angular-translate/angular-translate-tests.ts +++ b/angular-translate/angular-translate-tests.ts @@ -36,4 +36,9 @@ app.controller('Ctrl', ($scope: Scope, $translate: angular.translate.ITranslateS $scope['changeLanguage'] = function (key: any) { $translate.use(key); }; +}).run(($filter: ng.IFilterService) => { + var x: string; + x = $filter('translate')('something'); + x = $filter('translate')('something', {}); + x = $filter('translate')('something', {}, ''); }); diff --git a/angular-translate/angular-translate.d.ts b/angular-translate/angular-translate.d.ts index e4f69c688..ee855af3d 100644 --- a/angular-translate/angular-translate.d.ts +++ b/angular-translate/angular-translate.d.ts @@ -108,3 +108,11 @@ declare module angular.translate { useLoaderCache(cache?: any): ITranslateProvider; } } + +declare module angular { + interface IFilterService { + (name:'translate'): { + (translationId: string, interpolateParams?: any, interpolation?: string): string; + }; + } +} From 1c5eb0244461d7dee0cf331cebb9830da29183bd Mon Sep 17 00:00:00 2001 From: Jacob Poul Richardt Date: Wed, 9 Dec 2015 14:09:09 +0100 Subject: [PATCH 361/389] Added missing viewModel property to ComponentConfig. --- knockout/knockout.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/knockout/knockout.d.ts b/knockout/knockout.d.ts index 8f5d6fef4..087e94588 100644 --- a/knockout/knockout.d.ts +++ b/knockout/knockout.d.ts @@ -562,6 +562,7 @@ declare module KnockoutComponentTypes { } interface ComponentConfig { + viewModel?: ViewModelFunction | ViewModelSharedInstance | ViewModelFactoryFunction | AMDModule; template: any; createViewModel?: any; } From 6c8a227ec4be73b5bc5027baf1422ed62293b3ac Mon Sep 17 00:00:00 2001 From: Tim Perry Date: Wed, 9 Dec 2015 14:31:53 +0100 Subject: [PATCH 362/389] Fill out the full hopscotch API --- hopscotch/hopscotch-tests.ts | 2 +- hopscotch/hopscotch.d.ts | 79 +++++++++++++++++++++++++++++++----- 2 files changed, 70 insertions(+), 11 deletions(-) diff --git a/hopscotch/hopscotch-tests.ts b/hopscotch/hopscotch-tests.ts index 52d021395..fb1d1c68a 100644 --- a/hopscotch/hopscotch-tests.ts +++ b/hopscotch/hopscotch-tests.ts @@ -1,6 +1,6 @@ /// -var tourDefinition = { +var tourDefinition: TourDefinition = { id: 'intro-tour', steps: [ { diff --git a/hopscotch/hopscotch.d.ts b/hopscotch/hopscotch.d.ts index e7f7be6e9..1baac775b 100644 --- a/hopscotch/hopscotch.d.ts +++ b/hopscotch/hopscotch.d.ts @@ -3,14 +3,44 @@ // Definitions by: Tim Perry // Definitions: https://github.com/borisyankov/DefinitelyTyped -interface TourDefinition { +declare type CallbackNameNamesOrDefinition = string | string[] | (() => void); + +interface HopscotchConfiguration { + bubbleWidth?: number; + buddleHeight?: number; + + smoothScroll?: boolean; + scrollDuration?: number; + scrollTopMargin?: number; + + showCloseButton?: boolean; + showNextButton?: boolean; + showPrevButton?: boolean; + + arrowWidth?: number; + skipIfNoElement?: boolean; + nextOnTargetClick?: boolean; + + onNext?: CallbackNameNamesOrDefinition; + onPrev?: CallbackNameNamesOrDefinition; + onStart?: CallbackNameNamesOrDefinition; + onEnd?: CallbackNameNamesOrDefinition; + onClose?: CallbackNameNamesOrDefinition; + onError?: CallbackNameNamesOrDefinition; + + i18n?: { + nextBtn?: string; + prevBtn?: string; + doneBtn?: string; + skipBtn?: string; + closeTooltip?: string; + stepNums?: string[]; + } +} + +interface TourDefinition extends HopscotchConfiguration { id: string; steps: StepDefinition[]; - - skipIfNoElement: boolean; - - onEnd: () => void; - onClose: () => void; } interface StepDefinition { @@ -20,22 +50,51 @@ interface StepDefinition { title?: string; content?: string; + width?: number; + padding?: number; + xOffset?: number; yOffset?: number; arrowOffset?: number; - height?: number; - width?: number; + delay?: number; + zIndex?: number; - multipage?: boolean; showNextButton?: boolean; + showPrevButton?: boolean; + showCTAButton?: boolean; + + ctaLabel?: string; + multipage?: boolean; + showSkip?: boolean; + fixedElement?: boolean; nextOnTargetClick?: boolean; - onShow?: () => void; + onPrev?: CallbackNameNamesOrDefinition; + onNext?: CallbackNameNamesOrDefinition; + onShow?: CallbackNameNamesOrDefinition; + onCTA?: CallbackNameNamesOrDefinition; } interface HopscotchStatic { startTour(tour: TourDefinition, stepNum?: number): void; + showStep(id: number): void; + prevStep(): void; + nextStep(): void; + endTour(clearCookie: boolean): void; + configure(options: HopscotchConfiguration): void; + getCurrTour(): TourDefinition; + getCurrStepNum(): number; + getState(): string; + + listen(eventName: string, callback: () => void): void; + unlisten(eventName: string, callback: () => void): void; + removeCallbacks(eventName?: string, tourOnly?: boolean): void; + + registerHelper(id: string, helper: (...args: any[]) => void): void; + + resetDefaultI18N(): void; + resetDefaultOptions(): void; } declare var hopscotch: HopscotchStatic; From 957c41c644b150a1ecba4377aa2c6f7f6442eef0 Mon Sep 17 00:00:00 2001 From: John Reilly Date: Wed, 9 Dec 2015 14:41:05 +0000 Subject: [PATCH 363/389] Update flux.d.ts Replaced dependency upon `react-global.d.ts` in favour of the more targeted `react.d.ts` --- flux/flux.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/flux/flux.d.ts b/flux/flux.d.ts index c65892321..13d716311 100644 --- a/flux/flux.d.ts +++ b/flux/flux.d.ts @@ -3,7 +3,7 @@ // Definitions by: Steve Baker , Giedrius Grabauskas // Definitions: https://github.com/borisyankov/DefinitelyTyped -/// +/// declare module Flux { @@ -70,6 +70,7 @@ declare module "flux" { declare module FluxUtils { + import React = __React; export class Container { constructor(); /** From f2afd9c258c5f6daebc6254ec08aab72e5794b94 Mon Sep 17 00:00:00 2001 From: jmercha Date: Thu, 10 Dec 2015 01:26:07 +1030 Subject: [PATCH 364/389] support es6 import syntax for gulp-babel --- gulp-babel/gulp-babel.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gulp-babel/gulp-babel.d.ts b/gulp-babel/gulp-babel.d.ts index 98d33881c..632cb86f9 100644 --- a/gulp-babel/gulp-babel.d.ts +++ b/gulp-babel/gulp-babel.d.ts @@ -36,5 +36,7 @@ declare module 'gulp-babel' { retainLines?: boolean }): NodeJS.ReadWriteStream; + module babel { } + export = babel; } From d5eca5e9a3305939212e0479492dd09979345408 Mon Sep 17 00:00:00 2001 From: rhysd Date: Thu, 10 Dec 2015 00:08:18 +0900 Subject: [PATCH 365/389] github-electron: Add 'electron' module for main process --- github-electron/github-electron-main-tests.ts | 88 ++++++++++--------- github-electron/github-electron-main.d.ts | 15 ++++ github-electron/github-electron.d.ts | 12 ++- 3 files changed, 70 insertions(+), 45 deletions(-) diff --git a/github-electron/github-electron-main-tests.ts b/github-electron/github-electron-main-tests.ts index bafbaa49f..30f6bee22 100644 --- a/github-electron/github-electron-main-tests.ts +++ b/github-electron/github-electron-main-tests.ts @@ -1,21 +1,23 @@ /// -import app = require('app'); -import AutoUpdater = require('auto-updater'); -import BrowserWindow = require('browser-window'); -import ContentTracing = require('content-tracing'); -import Dialog = require('dialog'); -import GlobalShortcut = require('global-shortcut'); -import ipc = require('ipc'); -import Menu = require('menu'); -import MenuItem = require('menu-item'); -import PowerMonitor = require('power-monitor'); -import Protocol = require('protocol'); -import Tray = require('tray'); -import Clipboard = require('clipboard'); -import CrashReporter = require('crash-reporter'); -import NativeImage = require('native-image'); -import Screen = require('screen'); -import Shell = require('shell'); +import { + app, + autoUpdater, + BrowserWindow, + contentTracing, + dialog, + globalShortcut, + ipcMain, + Menu, + MenuItem, + powerMonitor, + protocol, + Tray, + clipboard, + crashReporter, + nativeImage, + screen, + shell +} from 'electron'; import path = require('path'); @@ -39,8 +41,8 @@ app.on('window-all-closed', () => { var shouldQuit = app.makeSingleInstance(function(commandLine, workingDirectory) { // Someone tried to run a second instance, we should focus our window if (mainWindow) { - if (mainWindow.isMinimized()) mainWindow.restore(); - mainWindow.focus(); + if (mainWindow.isMinimized()) mainWindow.restore(); + mainWindow.focus(); } return true; }); @@ -156,7 +158,7 @@ app.on('ready', () => { onlineStatusWindow.loadURL(`file://${__dirname}/online-status.html`); }); -ipc.on('online-status-changed', (event: any, status: any) => { +ipcMain.on('online-status-changed', (event: any, status: any) => { console.log(status); }); @@ -183,7 +185,7 @@ app.commandLine.appendSwitch('vmodule', 'console=0'); // auto-updater // https://github.com/atom/electron/blob/master/docs/api/auto-updater.md -AutoUpdater.setFeedURL('http://mycompany.com/myapp/latest?version=' + app.getVersion()); +autoUpdater.setFeedURL('http://mycompany.com/myapp/latest?version=' + app.getVersion()); // browser-window // https://github.com/atom/electron/blob/master/docs/api/browser-window.md @@ -199,11 +201,11 @@ win.show(); // content-tracing // https://github.com/atom/electron/blob/master/docs/api/content-tracing.md -ContentTracing.startRecording('*', ContentTracing.DEFAULT_OPTIONS, () => { +contentTracing.startRecording('*', contentTracing.DEFAULT_OPTIONS, () => { console.log('Tracing started'); setTimeout(() => { - ContentTracing.stopRecording('', path => { + contentTracing.stopRecording('', path => { console.log('Tracing data recorded to ' + path); }); }, 5000); @@ -212,7 +214,7 @@ ContentTracing.startRecording('*', ContentTracing.DEFAULT_OPTIONS, () => { // dialog // https://github.com/atom/electron/blob/master/docs/api/dialog.md -console.log(Dialog.showOpenDialog({ +console.log(dialog.showOpenDialog({ properties: ['openFile', 'openDirectory', 'multiSelections'] })); @@ -220,30 +222,30 @@ console.log(Dialog.showOpenDialog({ // https://github.com/atom/electron/blob/master/docs/api/global-shortcut.md // Register a 'ctrl+x' shortcut listener. -var ret = GlobalShortcut.register('ctrl+x', () => { +var ret = globalShortcut.register('ctrl+x', () => { console.log('ctrl+x is pressed'); }); if (!ret) console.log('registerion fails'); // Check whether a shortcut is registered. -console.log(GlobalShortcut.isRegistered('ctrl+x')); +console.log(globalShortcut.isRegistered('ctrl+x')); // Unregister a shortcut. -GlobalShortcut.unregister('ctrl+x'); +globalShortcut.unregister('ctrl+x'); // Unregister all shortcuts. -GlobalShortcut.unregisterAll(); +globalShortcut.unregisterAll(); -// ipc +// ipcMain // https://github.com/atom/electron/blob/master/docs/api/ipc-main-process.md -ipc.on('asynchronous-message', (event: any, arg: any) => { +ipcMain.on('asynchronous-message', (event: any, arg: any) => { console.log(arg); // prints "ping" event.sender.send('asynchronous-reply', 'pong'); }); -ipc.on('synchronous-message', (event: any, arg: any) => { +ipcMain.on('synchronous-message', (event: any, arg: any) => { console.log(arg); // prints "ping" event.returnValue = 'pong'; }); @@ -405,7 +407,7 @@ Menu.buildFromTemplate([ // https://github.com/atom/electron/blob/master/docs/api/power-monitor.md app.on('ready', () => { - PowerMonitor.on('suspend', () => { + powerMonitor.on('suspend', () => { console.log('The system is going to sleep'); }); }); @@ -414,9 +416,9 @@ app.on('ready', () => { // https://github.com/atom/electron/blob/master/docs/api/protocol.md app.on('ready', () => { - Protocol.registerProtocol('atom', (request: any) => { + protocol.registerProtocol('atom', (request: any) => { var url = request.url.substr(7); - return new Protocol.RequestFileJob(path.normalize(`${__dirname}/${url}`)); + return new protocol.RequestFileJob(path.normalize(`${__dirname}/${url}`)); }); }); @@ -440,26 +442,26 @@ app.on('ready', () => { // clipboard // https://github.com/atom/electron/blob/master/docs/api/clipboard.md -Clipboard.writeText('Example String'); -Clipboard.writeText('Example String', 'selection'); -console.log(Clipboard.readText('selection')); +clipboard.writeText('Example String'); +clipboard.writeText('Example String', 'selection'); +console.log(clipboard.readText('selection')); // crash-reporter // https://github.com/atom/electron/blob/master/docs/api/crash-reporter.md -CrashReporter.start({ +crashReporter.start({ productName: 'YourName', companyName: 'YourCompany', submitURL: 'https://your-domain.com/url-to-submit', autoSubmit: true }); -// NativeImage +// nativeImage // https://github.com/atom/electron/blob/master/docs/api/native-image.md var appIcon2 = new Tray('/Users/somebody/images/icon.png'); var window2 = new BrowserWindow({ icon: '/Users/somebody/images/window.png' }); -var image = Clipboard.readImage(); +var image = clipboard.readImage(); var appIcon3 = new Tray(image); var appIcon4 = new Tray('/Users/somebody/images/icon.png'); @@ -467,12 +469,12 @@ var appIcon4 = new Tray('/Users/somebody/images/icon.png'); // https://github.com/atom/electron/blob/master/docs/api/screen.md app.on('ready', () => { - var size = Screen.getPrimaryDisplay().workAreaSize; + var size = screen.getPrimaryDisplay().workAreaSize; mainWindow = new BrowserWindow({ width: size.width, height: size.height }); }); app.on('ready', () => { - var displays = Screen.getAllDisplays(); + var displays = screen.getAllDisplays(); var externalDisplay: any = null; for (var i in displays) { if (displays[i].bounds.x > 0 || displays[i].bounds.y > 0) { @@ -492,4 +494,4 @@ app.on('ready', () => { // shell // https://github.com/atom/electron/blob/master/docs/api/shell.md -Shell.openExternal('https://github.com'); +shell.openExternal('https://github.com'); diff --git a/github-electron/github-electron-main.d.ts b/github-electron/github-electron-main.d.ts index a133155a9..eb74ee446 100644 --- a/github-electron/github-electron-main.d.ts +++ b/github-electron/github-electron-main.d.ts @@ -254,6 +254,21 @@ declare module 'tray' { export = Tray; } +declare module 'electron' { + export var app: GitHubElectron.App; + export var autoUpdater: GitHubElectron.AutoUpdater; + export var BrowserWindow: typeof GitHubElectron.BrowserWindow; + export var contentTracing: GitHubElectron.ContentTracing; + export var dialog: GitHubElectron.Dialog; + export var globalShortcut: GitHubElectron.GlobalShortcut; + export var ipcMain: NodeJS.EventEmitter; + export var Menu: typeof GitHubElectron.Menu; + export var MenuItem: typeof GitHubElectron.MenuItem; + export var powerMonitor: NodeJS.EventEmitter; + export var protocol: GitHubElectron.Protocol; + export var Tray: typeof GitHubElectron.Tray; +} + interface NodeRequireFunction { (id: 'app'): GitHubElectron.App (id: 'auto-updater'): GitHubElectron.AutoUpdater diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts index d4ab0099f..d2909c1a4 100644 --- a/github-electron/github-electron.d.ts +++ b/github-electron/github-electron.d.ts @@ -1407,12 +1407,12 @@ declare module GitHubElectron { } declare module 'clipboard' { - var clipboard: GitHubElectron.Clipboard + var clipboard: GitHubElectron.Clipboard; export = clipboard; } declare module 'crash-reporter' { - var crashReporter: GitHubElectron.CrashReporter + var crashReporter: GitHubElectron.CrashReporter; export = crashReporter; } @@ -1431,6 +1431,14 @@ declare module 'shell' { export = shell; } +declare module 'electron' { + export var clipboard: GitHubElectron.Clipboard; + export var crashReporter: GitHubElectron.CrashReporter; + export var nativeImage: GitHubElectron.NativeImage; + export var screen: GitHubElectron.Screen; + export var shell: GitHubElectron.Shell; +} + interface Window { /** * Creates a new window. From cfa613956a5acac7df4bcfc2918973d6ea22cd5c Mon Sep 17 00:00:00 2001 From: rhysd Date: Thu, 10 Dec 2015 00:09:42 +0900 Subject: [PATCH 366/389] github-electron: Remove all deprecated modules from definitions for main process https://github.com/atom/electron/commit/c5913c31493dd36b1455c5f1c9a28d65f67c5c72 --- github-electron/github-electron-main.d.ts | 100 ++++------------------ github-electron/github-electron.d.ts | 39 ++------- 2 files changed, 24 insertions(+), 115 deletions(-) diff --git a/github-electron/github-electron-main.d.ts b/github-electron/github-electron-main.d.ts index eb74ee446..aa83e8801 100644 --- a/github-electron/github-electron-main.d.ts +++ b/github-electron/github-electron-main.d.ts @@ -192,94 +192,28 @@ declare module GitHubElectron { RequestStringJob: typeof RequestStringJob; RequestBufferJob: typeof RequestBufferJob; } -} -declare module 'app' { - var _app: GitHubElectron.App; - export = _app; -} - -declare module 'auto-updater' { - var _autoUpdater: GitHubElectron.AutoUpdater; - export = _autoUpdater; -} - -declare module 'browser-window' { - var BrowserWindow: typeof GitHubElectron.BrowserWindow; - export = BrowserWindow; -} - -declare module 'content-tracing' { - var contentTracing: GitHubElectron.ContentTracing - export = contentTracing; -} - -declare module 'dialog' { - var dialog: GitHubElectron.Dialog - export = dialog; -} - -declare module 'global-shortcut' { - var globalShortcut: GitHubElectron.GlobalShortcut; - export = globalShortcut; -} - -declare module 'ipc' { - var ipc: NodeJS.EventEmitter; - export = ipc; -} - -declare module 'menu' { - var Menu: typeof GitHubElectron.Menu; - export = Menu; -} - -declare module 'menu-item' { - var MenuItem: typeof GitHubElectron.MenuItem; - export = MenuItem; -} - -declare module 'power-monitor' { - var powerMonitor: NodeJS.EventEmitter; - export = powerMonitor; -} - -declare module 'protocol' { - var protocol: GitHubElectron.Protocol; - export = protocol; -} - -declare module 'tray' { - var Tray: typeof GitHubElectron.Tray; - export = Tray; + interface Electron { + app: GitHubElectron.App; + autoUpdater: GitHubElectron.AutoUpdater; + BrowserWindow: typeof GitHubElectron.BrowserWindow; + contentTracing: GitHubElectron.ContentTracing; + dialog: GitHubElectron.Dialog; + globalShortcut: GitHubElectron.GlobalShortcut; + ipcMain: NodeJS.EventEmitter; + Menu: typeof GitHubElectron.Menu; + MenuItem: typeof GitHubElectron.MenuItem; + powerMonitor: NodeJS.EventEmitter; + protocol: GitHubElectron.Protocol; + Tray: typeof GitHubElectron.Tray; + } } declare module 'electron' { - export var app: GitHubElectron.App; - export var autoUpdater: GitHubElectron.AutoUpdater; - export var BrowserWindow: typeof GitHubElectron.BrowserWindow; - export var contentTracing: GitHubElectron.ContentTracing; - export var dialog: GitHubElectron.Dialog; - export var globalShortcut: GitHubElectron.GlobalShortcut; - export var ipcMain: NodeJS.EventEmitter; - export var Menu: typeof GitHubElectron.Menu; - export var MenuItem: typeof GitHubElectron.MenuItem; - export var powerMonitor: NodeJS.EventEmitter; - export var protocol: GitHubElectron.Protocol; - export var Tray: typeof GitHubElectron.Tray; + var electron: GitHubElectron.Electron; + export = electron; } interface NodeRequireFunction { - (id: 'app'): GitHubElectron.App - (id: 'auto-updater'): GitHubElectron.AutoUpdater - (id: 'browser-window'): typeof GitHubElectron.BrowserWindow - (id: 'content-tracing'): GitHubElectron.ContentTracing - (id: 'dialog'): GitHubElectron.Dialog - (id: 'global-shortcut'): GitHubElectron.GlobalShortcut - (id: 'ipc'): NodeJS.EventEmitter - (id: 'menu'): typeof GitHubElectron.Menu - (id: 'menu-item'): typeof GitHubElectron.MenuItem - (id: 'power-monitor'): NodeJS.EventEmitter - (id: 'protocol'): GitHubElectron.Protocol - (id: 'tray'): typeof GitHubElectron.Tray + (id: 'electron'): GitHubElectron.Electron; } diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts index d2909c1a4..05a4a6571 100644 --- a/github-electron/github-electron.d.ts +++ b/github-electron/github-electron.d.ts @@ -1404,39 +1404,14 @@ declare module GitHubElectron { */ beep(): void; } -} -declare module 'clipboard' { - var clipboard: GitHubElectron.Clipboard; - export = clipboard; -} - -declare module 'crash-reporter' { - var crashReporter: GitHubElectron.CrashReporter; - export = crashReporter; -} - -declare module 'native-image' { - var nativeImage: typeof GitHubElectron.NativeImage; - export = nativeImage; -} - -declare module 'screen' { - var screen: GitHubElectron.Screen; - export = screen; -} - -declare module 'shell' { - var shell: GitHubElectron.Shell; - export = shell; -} - -declare module 'electron' { - export var clipboard: GitHubElectron.Clipboard; - export var crashReporter: GitHubElectron.CrashReporter; - export var nativeImage: GitHubElectron.NativeImage; - export var screen: GitHubElectron.Screen; - export var shell: GitHubElectron.Shell; + interface Electron { + clipboard: GitHubElectron.Clipboard; + crashReporter: GitHubElectron.CrashReporter; + nativeImage: GitHubElectron.NativeImage; + screen: GitHubElectron.Screen; + shell: GitHubElectron.Shell; + } } interface Window { From c073d5b052c3c8179ae4f45233112346a74e0a1a Mon Sep 17 00:00:00 2001 From: rhysd Date: Thu, 10 Dec 2015 00:14:18 +0900 Subject: [PATCH 367/389] github-electron: Add 'electron' module for renderer process --- .../github-electron-renderer-tests.ts | 46 ++++++++++--------- github-electron/github-electron-renderer.d.ts | 6 +++ 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/github-electron/github-electron-renderer-tests.ts b/github-electron/github-electron-renderer-tests.ts index 86680600f..88fa4fcd5 100644 --- a/github-electron/github-electron-renderer-tests.ts +++ b/github-electron/github-electron-renderer-tests.ts @@ -1,23 +1,25 @@ /// -import ipc = require('ipc'); -import remote = require('remote'); -import WebFrame = require('web-frame'); -import Clipboard = require('clipboard'); -import CrashReporter = require('crash-reporter'); -import NativeImage = require('native-image'); -import Screen = require('screen'); -import Shell = require('shell'); +import { + ipcRenderer, + remote, + webFrame, + clipboard, + crashReporter, + nativeImage, + screen, + shell +} from 'electron'; import fs = require('fs'); // In renderer process (web page). // https://github.com/atom/electron/blob/master/docs/api/ipc-renderer.md -console.log(ipc.sendSync('synchronous-message', 'ping')); // prints "pong" +console.log(ipcRenderer.sendSync('synchronous-message', 'ping')); // prints "pong" -ipc.on('asynchronous-reply', (arg: any) => { +ipcRenderer.on('asynchronous-reply', (arg: any) => { console.log(arg); // prints "pong" }); -ipc.send('asynchronous-message', 'ping'); +ipcRenderer.send('asynchronous-message', 'ping'); // remote // https://github.com/atom/electron/blob/master/docs/api/remote.md @@ -45,9 +47,9 @@ remote.getCurrentWindow().capturePage(buf => { // web-frame // https://github.com/atom/electron/blob/master/docs/api/web-frame.md -WebFrame.setZoomFactor(2); +webFrame.setZoomFactor(2); -WebFrame.setSpellCheckProvider('en-US', true, { +webFrame.setSpellCheckProvider('en-US', true, { spellCheck: text => { return !(require('spellchecker').isMisspelled(text)); } @@ -56,27 +58,27 @@ WebFrame.setSpellCheckProvider('en-US', true, { // clipboard // https://github.com/atom/electron/blob/master/docs/api/clipboard.md -Clipboard.writeText('Example String'); -Clipboard.writeText('Example String', 'selection'); -console.log(Clipboard.readText('selection')); +clipboard.writeText('Example String'); +clipboard.writeText('Example String', 'selection'); +console.log(clipboard.readText('selection')); // crash-reporter // https://github.com/atom/electron/blob/master/docs/api/crash-reporter.md -CrashReporter.start({ +crashReporter.start({ productName: 'YourName', companyName: 'YourCompany', submitURL: 'https://your-domain.com/url-to-submit', autoSubmit: true }); -// NativeImage +// nativeImage // https://github.com/atom/electron/blob/master/docs/api/native-image.md var Tray: typeof GitHubElectron.Tray = remote.require('Tray'); var appIcon2 = new Tray('/Users/somebody/images/icon.png'); var window2 = new BrowserWindow({ icon: '/Users/somebody/images/window.png' }); -var image = Clipboard.readImage(); +var image = clipboard.readImage(); var appIcon3 = new Tray(image); var appIcon4 = new Tray('/Users/somebody/images/icon.png'); @@ -88,12 +90,12 @@ var app: GitHubElectron.App = remote.require('app'); var mainWindow: GitHubElectron.BrowserWindow = null; app.on('ready', () => { - var size = Screen.getPrimaryDisplay().workAreaSize; + var size = screen.getPrimaryDisplay().workAreaSize; mainWindow = new BrowserWindow({ width: size.width, height: size.height }); }); app.on('ready', () => { - var displays = Screen.getAllDisplays(); + var displays = screen.getAllDisplays(); var externalDisplay: any = null; for (var i in displays) { if (displays[i].bounds.x > 0 || displays[i].bounds.y > 0) { @@ -113,4 +115,4 @@ app.on('ready', () => { // shell // https://github.com/atom/electron/blob/master/docs/api/shell.md -Shell.openExternal('https://github.com'); +shell.openExternal('https://github.com'); diff --git a/github-electron/github-electron-renderer.d.ts b/github-electron/github-electron-renderer.d.ts index 62b29d9cd..2ef31d967 100644 --- a/github-electron/github-electron-renderer.d.ts +++ b/github-electron/github-electron-renderer.d.ts @@ -109,6 +109,12 @@ declare module 'web-frame' { export = webframe; } +declare module 'electron' { + var remote: GitHubElectron.Remote; + var ipcRenderer: GitHubElectron.InProcess; + var webFrame: GitHubElectron.WebFrame; +} + interface NodeRequireFunction { (id: 'ipc'): GitHubElectron.InProcess (id: 'remote'): GitHubElectron.Remote From 9e2e3b7b9c59bd4c6f9eff9423444f80117a360f Mon Sep 17 00:00:00 2001 From: rhysd Date: Thu, 10 Dec 2015 00:15:06 +0900 Subject: [PATCH 368/389] github-electron: Remove deprecated modules from definitions for renderer process https://github.com/atom/electron/commit/c5913c31493dd36b1455c5f1c9a28d65f67c5c72 --- github-electron/github-electron-renderer.d.ts | 28 ++++++------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/github-electron/github-electron-renderer.d.ts b/github-electron/github-electron-renderer.d.ts index 2ef31d967..7cfdca5a0 100644 --- a/github-electron/github-electron-renderer.d.ts +++ b/github-electron/github-electron-renderer.d.ts @@ -92,31 +92,19 @@ declare module GitHubElectron { */ registerURLSchemeAsSecure(scheme: string): void; } -} -declare module 'ipc' { - var inProcess: GitHubElectron.InProcess; - export = inProcess; -} - -declare module 'remote' { - var remote: GitHubElectron.Remote; - export = remote; -} - -declare module 'web-frame' { - var webframe: GitHubElectron.WebFrame; - export = webframe; + export interface Electron { + remote: GitHubElectron.Remote; + ipcRenderer: GitHubElectron.InProcess; + webFrame: GitHubElectron.WebFrame; + } } declare module 'electron' { - var remote: GitHubElectron.Remote; - var ipcRenderer: GitHubElectron.InProcess; - var webFrame: GitHubElectron.WebFrame; + var electron: GitHubElectron.Electron; + export = electron; } interface NodeRequireFunction { - (id: 'ipc'): GitHubElectron.InProcess - (id: 'remote'): GitHubElectron.Remote - (id: 'web-frame'): GitHubElectron.WebFrame + (id: 'electron'): GitHubElectron.Electron; } From b10b59fe42978878f23b6bbae44c1c98a76ec492 Mon Sep 17 00:00:00 2001 From: rhysd Date: Thu, 10 Dec 2015 00:44:14 +0900 Subject: [PATCH 369/389] github-electron: Unite main process definitions and renderer process definitions because currently github-electron-renderer.d.ts and github-electron-main.d.ts can't be used with tsd.d.ts at the same time. tsd.d.ts includes both definition files. So I unite them to resolve it. --- github-electron/github-electron-main-tests.ts | 2 +- github-electron/github-electron-main.d.ts | 219 ------------- .../github-electron-renderer-tests.ts | 2 +- github-electron/github-electron-renderer.d.ts | 110 ------- github-electron/github-electron.d.ts | 305 +++++++++++++++++- 5 files changed, 302 insertions(+), 336 deletions(-) delete mode 100644 github-electron/github-electron-main.d.ts delete mode 100644 github-electron/github-electron-renderer.d.ts diff --git a/github-electron/github-electron-main-tests.ts b/github-electron/github-electron-main-tests.ts index 30f6bee22..84f1ca89c 100644 --- a/github-electron/github-electron-main-tests.ts +++ b/github-electron/github-electron-main-tests.ts @@ -1,4 +1,4 @@ -/// +/// import { app, autoUpdater, diff --git a/github-electron/github-electron-main.d.ts b/github-electron/github-electron-main.d.ts deleted file mode 100644 index aa83e8801..000000000 --- a/github-electron/github-electron-main.d.ts +++ /dev/null @@ -1,219 +0,0 @@ -// Type definitions for the Electron 0.25.2 main process -// Project: http://electron.atom.io/ -// Definitions by: jedmao -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/// - -declare module GitHubElectron { - interface ContentTracing { - /** - * Get a set of category groups. The category groups can change as new code paths are reached. - * @param callback Called once all child processes have acked to the getCategories request. - */ - getCategories(callback: (categoryGroups: any[]) => void): void; - /** - * Start recording on all processes. Recording begins immediately locally, and asynchronously - * on child processes as soon as they receive the EnableRecording request. - * @param categoryFilter A filter to control what category groups should be traced. - * A filter can have an optional "-" prefix to exclude category groups that contain - * a matching category. Having both included and excluded category patterns in the - * same list would not be supported. - * @param options controls what kind of tracing is enabled, it could be a OR-ed - * combination of tracing.DEFAULT_OPTIONS, tracing.ENABLE_SYSTRACE, tracing.ENABLE_SAMPLING - * and tracing.RECORD_CONTINUOUSLY. - * @param callback Called once all child processes have acked to the startRecording request. - */ - startRecording(categoryFilter: string, options: number, callback: Function): void; - /** - * Stop recording on all processes. Child processes typically are caching trace data and - * only rarely flush and send trace data back to the main process. That is because it may - * be an expensive operation to send the trace data over IPC, and we would like to avoid - * much runtime overhead of tracing. So, to end tracing, we must asynchronously ask all - * child processes to flush any pending trace data. - * @param resultFilePath Trace data will be written into this file if it is not empty, - * or into a temporary file. - * @param callback Called once all child processes have acked to the stopRecording request. - */ - stopRecording(resultFilePath: string, callback: - /** - * @param filePath A file that contains the traced data. - */ - (filePath: string) => void - ): void; - /** - * Start monitoring on all processes. Monitoring begins immediately locally, and asynchronously - * on child processes as soon as they receive the startMonitoring request. - * @param callback Called once all child processes have acked to the startMonitoring request. - */ - startMonitoring(categoryFilter: string, options: number, callback: Function): void; - /** - * Stop monitoring on all processes. - * @param callback Called once all child processes have acked to the stopMonitoring request. - */ - stopMonitoring(callback: Function): void; - /** - * Get the current monitoring traced data. Child processes typically are caching trace data - * and only rarely flush and send trace data back to the main process. That is because it may - * be an expensive operation to send the trace data over IPC, and we would like to avoid much - * runtime overhead of tracing. So, to end tracing, we must asynchronously ask all child - * processes to flush any pending trace data. - * @param callback Called once all child processes have acked to the captureMonitoringSnapshot request. - */ - captureMonitoringSnapshot(resultFilePath: string, callback: - /** - * @param filePath A file that contains the traced data - * @returns {} - */ - (filePath: string) => void - ): void; - /** - * Get the maximum across processes of trace buffer percent full state. - * @param callback Called when the TraceBufferUsage value is determined. - */ - getTraceBufferUsage(callback: Function): void; - /** - * @param callback Called every time the given event occurs on any process. - */ - setWatchEvent(categoryName: string, eventName: string, callback: Function): void; - /** - * Cancel the watch event. If tracing is enabled, this may race with the watch event callback. - */ - cancelWatchEvent(): void; - DEFAULT_OPTIONS: number; - ENABLE_SYSTRACE: number; - ENABLE_SAMPLING: number; - RECORD_CONTINUOUSLY: number; - } - - interface Dialog { - /** - * @param callback If supplied, the API call will be asynchronous. - * @returns On success, returns an array of file paths chosen by the user, - * otherwise returns undefined. - */ - showOpenDialog: typeof GitHubElectron.Dialog.showOpenDialog; - /** - * @param callback If supplied, the API call will be asynchronous. - * @returns On success, returns the path of file chosen by the user, otherwise - * returns undefined. - */ - showSaveDialog: typeof GitHubElectron.Dialog.showSaveDialog; - /** - * Shows a message box. It will block until the message box is closed. It returns . - * @param callback If supplied, the API call will be asynchronous. - * @returns The index of the clicked button. - */ - showMessageBox: typeof GitHubElectron.Dialog.showMessageBox; - - /** - * Runs a modal dialog that shows an error message. This API can be called safely - * before the ready event of app module emits, it is usually used to report errors - * in early stage of startup. - */ - showErrorBox(title: string, content: string): void; - } - - interface GlobalShortcut { - /** - * Registers a global shortcut of accelerator. - * @param accelerator Represents a keyboard shortcut. It can contain modifiers - * and key codes, combined by the "+" character. - * @param callback Called when the registered shortcut is pressed by the user. - * @returns {} - */ - register(accelerator: string, callback: Function): void; - /** - * @param accelerator Represents a keyboard shortcut. It can contain modifiers - * and key codes, combined by the "+" character. - * @returns Whether the accelerator is registered. - */ - isRegistered(accelerator: string): boolean; - /** - * Unregisters the global shortcut of keycode. - * @param accelerator Represents a keyboard shortcut. It can contain modifiers - * and key codes, combined by the "+" character. - */ - unregister(accelerator: string): void; - /** - * Unregisters all the global shortcuts. - */ - unregisterAll(): void; - } - - class RequestFileJob { - /** - * Create a request job which would query a file of path and set corresponding mime types. - */ - constructor(path: string); - } - - class RequestStringJob { - /** - * Create a request job which sends a string as response. - */ - constructor(options?: { - /** - * Default is "text/plain". - */ - mimeType?: string; - /** - * Default is "UTF-8". - */ - charset?: string; - data?: string; - }); - } - - class RequestBufferJob { - /** - * Create a request job which accepts a buffer and sends a string as response. - */ - constructor(options?: { - /** - * Default is "application/octet-stream". - */ - mimeType?: string; - /** - * Default is "UTF-8". - */ - encoding?: string; - data?: Buffer; - }); - } - - interface Protocol { - registerProtocol(scheme: string, handler: (request: any) => void): void; - unregisterProtocol(scheme: string): void; - isHandledProtocol(scheme: string): boolean; - interceptProtocol(scheme: string, handler: (request: any) => void): void; - uninterceptProtocol(scheme: string): void; - RequestFileJob: typeof RequestFileJob; - RequestStringJob: typeof RequestStringJob; - RequestBufferJob: typeof RequestBufferJob; - } - - interface Electron { - app: GitHubElectron.App; - autoUpdater: GitHubElectron.AutoUpdater; - BrowserWindow: typeof GitHubElectron.BrowserWindow; - contentTracing: GitHubElectron.ContentTracing; - dialog: GitHubElectron.Dialog; - globalShortcut: GitHubElectron.GlobalShortcut; - ipcMain: NodeJS.EventEmitter; - Menu: typeof GitHubElectron.Menu; - MenuItem: typeof GitHubElectron.MenuItem; - powerMonitor: NodeJS.EventEmitter; - protocol: GitHubElectron.Protocol; - Tray: typeof GitHubElectron.Tray; - } -} - -declare module 'electron' { - var electron: GitHubElectron.Electron; - export = electron; -} - -interface NodeRequireFunction { - (id: 'electron'): GitHubElectron.Electron; -} diff --git a/github-electron/github-electron-renderer-tests.ts b/github-electron/github-electron-renderer-tests.ts index 88fa4fcd5..cf610718c 100644 --- a/github-electron/github-electron-renderer-tests.ts +++ b/github-electron/github-electron-renderer-tests.ts @@ -1,4 +1,4 @@ -/// +/// import { ipcRenderer, remote, diff --git a/github-electron/github-electron-renderer.d.ts b/github-electron/github-electron-renderer.d.ts deleted file mode 100644 index 7cfdca5a0..000000000 --- a/github-electron/github-electron-renderer.d.ts +++ /dev/null @@ -1,110 +0,0 @@ -// Type definitions for the Electron 0.25.2 renderer process (web page) -// Project: http://electron.atom.io/ -// Definitions by: jedmao -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/// - -declare module GitHubElectron { - export class InProcess implements NodeJS.EventEmitter { - addListener(event: string, listener: Function): InProcess; - on(event: string, listener: Function): InProcess; - once(event: string, listener: Function): InProcess; - removeListener(event: string, listener: Function): InProcess; - removeAllListeners(event?: string): InProcess; - setMaxListeners(n: number): void; - listeners(event: string): Function[]; - emit(event: string, ...args: any[]): boolean; - /** - * Send ...args to the renderer via channel in asynchronous message, the main - * process can handle it by listening to the channel event of ipc module. - */ - send(channel: string, ...args: any[]): void; - /** - * Send ...args to the renderer via channel in synchronous message, and returns - * the result sent from main process. The main process can handle it by listening - * to the channel event of ipc module, and returns by setting event.returnValue. - * Note: Usually developers should never use this API, since sending synchronous - * message would block the whole renderer process. - * @returns The result sent from the main process. - */ - sendSync(channel: string, ...args: any[]): string; - /** - * Like ipc.send but the message will be sent to the host page instead of the main process. - * This is mainly used by the page in to communicate with host page. - */ - sendToHost(channel: string, ...args: any[]): void; - } - - interface Remote { - /** - * @returns The object returned by require(module) in the main process. - */ - require(module: string): any; - /** - * @returns The BrowserWindow object which this web page belongs to. - */ - getCurrentWindow(): BrowserWindow - /** - * @returns The global variable of name (e.g. global[name]) in the main process. - */ - getGlobal(name: string): any; - /** - * Returns the process object in the main process. This is the same as - * remote.getGlobal('process'), but gets cached. - */ - process: any; - } - - interface WebFrame { - /** - * Changes the zoom factor to the specified factor, zoom factor is - * zoom percent / 100, so 300% = 3.0. - */ - setZoomFactor(factor: number): void; - /** - * @returns The current zoom factor. - */ - getZoomFactor(): number; - /** - * Changes the zoom level to the specified level, 0 is "original size", and each - * increment above or below represents zooming 20% larger or smaller to default - * limits of 300% and 50% of original size, respectively. - */ - setZoomLevel(level: number): void; - /** - * @returns The current zoom level. - */ - getZoomLevel(): number; - /** - * Sets a provider for spell checking in input fields and text areas. - */ - setSpellCheckProvider(language: string, autoCorrectWord: boolean, provider: { - /** - * @returns Whether the word passed is correctly spelled. - */ - spellCheck: (text: string) => boolean; - }): void; - /** - * Sets the scheme as secure scheme. Secure schemes do not trigger mixed content - * warnings. For example, https and data are secure schemes because they cannot be - * corrupted by active network attackers. - */ - registerURLSchemeAsSecure(scheme: string): void; - } - - export interface Electron { - remote: GitHubElectron.Remote; - ipcRenderer: GitHubElectron.InProcess; - webFrame: GitHubElectron.WebFrame; - } -} - -declare module 'electron' { - var electron: GitHubElectron.Electron; - export = electron; -} - -interface NodeRequireFunction { - (id: 'electron'): GitHubElectron.Electron; -} diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts index 05a4a6571..10c3a43f2 100644 --- a/github-electron/github-electron.d.ts +++ b/github-electron/github-electron.d.ts @@ -1405,12 +1405,306 @@ declare module GitHubElectron { beep(): void; } + // Type definitions for renderer process + + export class IpcRenderer implements NodeJS.EventEmitter { + addListener(event: string, listener: Function): IpcRenderer; + on(event: string, listener: Function): IpcRenderer; + once(event: string, listener: Function): IpcRenderer; + removeListener(event: string, listener: Function): IpcRenderer; + removeAllListeners(event?: string): IpcRenderer; + setMaxListeners(n: number): void; + listeners(event: string): Function[]; + emit(event: string, ...args: any[]): boolean; + /** + * Send ...args to the renderer via channel in asynchronous message, the main + * process can handle it by listening to the channel event of ipc module. + */ + send(channel: string, ...args: any[]): void; + /** + * Send ...args to the renderer via channel in synchronous message, and returns + * the result sent from main process. The main process can handle it by listening + * to the channel event of ipc module, and returns by setting event.returnValue. + * Note: Usually developers should never use this API, since sending synchronous + * message would block the whole renderer process. + * @returns The result sent from the main process. + */ + sendSync(channel: string, ...args: any[]): string; + /** + * Like ipc.send but the message will be sent to the host page instead of the main process. + * This is mainly used by the page in to communicate with host page. + */ + sendToHost(channel: string, ...args: any[]): void; + } + + interface Remote { + /** + * @returns The object returned by require(module) in the main process. + */ + require(module: string): any; + /** + * @returns The BrowserWindow object which this web page belongs to. + */ + getCurrentWindow(): BrowserWindow + /** + * @returns The global variable of name (e.g. global[name]) in the main process. + */ + getGlobal(name: string): any; + /** + * Returns the process object in the main process. This is the same as + * remote.getGlobal('process'), but gets cached. + */ + process: any; + } + + interface WebFrame { + /** + * Changes the zoom factor to the specified factor, zoom factor is + * zoom percent / 100, so 300% = 3.0. + */ + setZoomFactor(factor: number): void; + /** + * @returns The current zoom factor. + */ + getZoomFactor(): number; + /** + * Changes the zoom level to the specified level, 0 is "original size", and each + * increment above or below represents zooming 20% larger or smaller to default + * limits of 300% and 50% of original size, respectively. + */ + setZoomLevel(level: number): void; + /** + * @returns The current zoom level. + */ + getZoomLevel(): number; + /** + * Sets a provider for spell checking in input fields and text areas. + */ + setSpellCheckProvider(language: string, autoCorrectWord: boolean, provider: { + /** + * @returns Whether the word passed is correctly spelled. + */ + spellCheck: (text: string) => boolean; + }): void; + /** + * Sets the scheme as secure scheme. Secure schemes do not trigger mixed content + * warnings. For example, https and data are secure schemes because they cannot be + * corrupted by active network attackers. + */ + registerURLSchemeAsSecure(scheme: string): void; + } + + // Type definitions for main process + + interface ContentTracing { + /** + * Get a set of category groups. The category groups can change as new code paths are reached. + * @param callback Called once all child processes have acked to the getCategories request. + */ + getCategories(callback: (categoryGroups: any[]) => void): void; + /** + * Start recording on all processes. Recording begins immediately locally, and asynchronously + * on child processes as soon as they receive the EnableRecording request. + * @param categoryFilter A filter to control what category groups should be traced. + * A filter can have an optional "-" prefix to exclude category groups that contain + * a matching category. Having both included and excluded category patterns in the + * same list would not be supported. + * @param options controls what kind of tracing is enabled, it could be a OR-ed + * combination of tracing.DEFAULT_OPTIONS, tracing.ENABLE_SYSTRACE, tracing.ENABLE_SAMPLING + * and tracing.RECORD_CONTINUOUSLY. + * @param callback Called once all child processes have acked to the startRecording request. + */ + startRecording(categoryFilter: string, options: number, callback: Function): void; + /** + * Stop recording on all processes. Child processes typically are caching trace data and + * only rarely flush and send trace data back to the main process. That is because it may + * be an expensive operation to send the trace data over IPC, and we would like to avoid + * much runtime overhead of tracing. So, to end tracing, we must asynchronously ask all + * child processes to flush any pending trace data. + * @param resultFilePath Trace data will be written into this file if it is not empty, + * or into a temporary file. + * @param callback Called once all child processes have acked to the stopRecording request. + */ + stopRecording(resultFilePath: string, callback: + /** + * @param filePath A file that contains the traced data. + */ + (filePath: string) => void + ): void; + /** + * Start monitoring on all processes. Monitoring begins immediately locally, and asynchronously + * on child processes as soon as they receive the startMonitoring request. + * @param callback Called once all child processes have acked to the startMonitoring request. + */ + startMonitoring(categoryFilter: string, options: number, callback: Function): void; + /** + * Stop monitoring on all processes. + * @param callback Called once all child processes have acked to the stopMonitoring request. + */ + stopMonitoring(callback: Function): void; + /** + * Get the current monitoring traced data. Child processes typically are caching trace data + * and only rarely flush and send trace data back to the main process. That is because it may + * be an expensive operation to send the trace data over IPC, and we would like to avoid much + * runtime overhead of tracing. So, to end tracing, we must asynchronously ask all child + * processes to flush any pending trace data. + * @param callback Called once all child processes have acked to the captureMonitoringSnapshot request. + */ + captureMonitoringSnapshot(resultFilePath: string, callback: + /** + * @param filePath A file that contains the traced data + * @returns {} + */ + (filePath: string) => void + ): void; + /** + * Get the maximum across processes of trace buffer percent full state. + * @param callback Called when the TraceBufferUsage value is determined. + */ + getTraceBufferUsage(callback: Function): void; + /** + * @param callback Called every time the given event occurs on any process. + */ + setWatchEvent(categoryName: string, eventName: string, callback: Function): void; + /** + * Cancel the watch event. If tracing is enabled, this may race with the watch event callback. + */ + cancelWatchEvent(): void; + DEFAULT_OPTIONS: number; + ENABLE_SYSTRACE: number; + ENABLE_SAMPLING: number; + RECORD_CONTINUOUSLY: number; + } + + interface Dialog { + /** + * @param callback If supplied, the API call will be asynchronous. + * @returns On success, returns an array of file paths chosen by the user, + * otherwise returns undefined. + */ + showOpenDialog: typeof GitHubElectron.Dialog.showOpenDialog; + /** + * @param callback If supplied, the API call will be asynchronous. + * @returns On success, returns the path of file chosen by the user, otherwise + * returns undefined. + */ + showSaveDialog: typeof GitHubElectron.Dialog.showSaveDialog; + /** + * Shows a message box. It will block until the message box is closed. It returns . + * @param callback If supplied, the API call will be asynchronous. + * @returns The index of the clicked button. + */ + showMessageBox: typeof GitHubElectron.Dialog.showMessageBox; + + /** + * Runs a modal dialog that shows an error message. This API can be called safely + * before the ready event of app module emits, it is usually used to report errors + * in early stage of startup. + */ + showErrorBox(title: string, content: string): void; + } + + interface GlobalShortcut { + /** + * Registers a global shortcut of accelerator. + * @param accelerator Represents a keyboard shortcut. It can contain modifiers + * and key codes, combined by the "+" character. + * @param callback Called when the registered shortcut is pressed by the user. + * @returns {} + */ + register(accelerator: string, callback: Function): void; + /** + * @param accelerator Represents a keyboard shortcut. It can contain modifiers + * and key codes, combined by the "+" character. + * @returns Whether the accelerator is registered. + */ + isRegistered(accelerator: string): boolean; + /** + * Unregisters the global shortcut of keycode. + * @param accelerator Represents a keyboard shortcut. It can contain modifiers + * and key codes, combined by the "+" character. + */ + unregister(accelerator: string): void; + /** + * Unregisters all the global shortcuts. + */ + unregisterAll(): void; + } + + class RequestFileJob { + /** + * Create a request job which would query a file of path and set corresponding mime types. + */ + constructor(path: string); + } + + class RequestStringJob { + /** + * Create a request job which sends a string as response. + */ + constructor(options?: { + /** + * Default is "text/plain". + */ + mimeType?: string; + /** + * Default is "UTF-8". + */ + charset?: string; + data?: string; + }); + } + + class RequestBufferJob { + /** + * Create a request job which accepts a buffer and sends a string as response. + */ + constructor(options?: { + /** + * Default is "application/octet-stream". + */ + mimeType?: string; + /** + * Default is "UTF-8". + */ + encoding?: string; + data?: Buffer; + }); + } + + interface Protocol { + registerProtocol(scheme: string, handler: (request: any) => void): void; + unregisterProtocol(scheme: string): void; + isHandledProtocol(scheme: string): boolean; + interceptProtocol(scheme: string, handler: (request: any) => void): void; + uninterceptProtocol(scheme: string): void; + RequestFileJob: typeof RequestFileJob; + RequestStringJob: typeof RequestStringJob; + RequestBufferJob: typeof RequestBufferJob; + } + + interface Electron { clipboard: GitHubElectron.Clipboard; crashReporter: GitHubElectron.CrashReporter; nativeImage: GitHubElectron.NativeImage; screen: GitHubElectron.Screen; shell: GitHubElectron.Shell; + remote: GitHubElectron.Remote; + ipcRenderer: GitHubElectron.IpcRenderer; + webFrame: GitHubElectron.WebFrame; + app: GitHubElectron.App; + autoUpdater: GitHubElectron.AutoUpdater; + BrowserWindow: typeof GitHubElectron.BrowserWindow; + contentTracing: GitHubElectron.ContentTracing; + dialog: GitHubElectron.Dialog; + globalShortcut: GitHubElectron.GlobalShortcut; + ipcMain: NodeJS.EventEmitter; + Menu: typeof GitHubElectron.Menu; + MenuItem: typeof GitHubElectron.MenuItem; + powerMonitor: NodeJS.EventEmitter; + protocol: GitHubElectron.Protocol; + Tray: typeof GitHubElectron.Tray; } } @@ -1429,10 +1723,11 @@ interface File { path: string; } +declare module 'electron' { + var electron: GitHubElectron.Electron; + export = electron; +} + interface NodeRequireFunction { - (id: 'clipboard'): GitHubElectron.Clipboard - (id: 'crash-reporter'): GitHubElectron.CrashReporter - (id: 'native-image'): typeof GitHubElectron.NativeImage - (id: 'screen'): GitHubElectron.Screen - (id: 'shell'): GitHubElectron.Shell + (id: 'electron'): GitHubElectron.Electron; } From 1386ebca373368ddc149a389fe1973ceefe5c625 Mon Sep 17 00:00:00 2001 From: Igor Sidorov Date: Wed, 9 Dec 2015 18:52:15 +0300 Subject: [PATCH 370/389] mdDialog.hide should return Promise instead of void --- angular-material/angular-material-0.8.3.d.ts | 2 +- angular-material/angular-material-0.9.0.d.ts | 2 +- angular-material/angular-material.d.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/angular-material/angular-material-0.8.3.d.ts b/angular-material/angular-material-0.8.3.d.ts index 1e3eda18a..10724b812 100644 --- a/angular-material/angular-material-0.8.3.d.ts +++ b/angular-material/angular-material-0.8.3.d.ts @@ -59,7 +59,7 @@ declare module angular.material { show(dialog: MDDialogOptions|MDPresetDialog): angular.IPromise; confirm(): MDConfirmDialog; alert(): MDAlertDialog; - hide(response?: any): void; + hide(response?: any): angular.IPromise; cancel(response?: any): void; } diff --git a/angular-material/angular-material-0.9.0.d.ts b/angular-material/angular-material-0.9.0.d.ts index 1383b0beb..96134f114 100644 --- a/angular-material/angular-material-0.9.0.d.ts +++ b/angular-material/angular-material-0.9.0.d.ts @@ -64,7 +64,7 @@ declare module angular.material { show(dialog: MDDialogOptions|MDAlertDialog|MDConfirmDialog): angular.IPromise; confirm(): MDConfirmDialog; alert(): MDAlertDialog; - hide(response?: any): void; + hide(response?: any): angular.IPromise; cancel(response?: any): void; } diff --git a/angular-material/angular-material.d.ts b/angular-material/angular-material.d.ts index 43e0b9f53..7d29e7492 100644 --- a/angular-material/angular-material.d.ts +++ b/angular-material/angular-material.d.ts @@ -83,7 +83,7 @@ declare module angular.material { show(dialog: IDialogOptions|IAlertDialog|IConfirmDialog): angular.IPromise; confirm(): IConfirmDialog; alert(): IAlertDialog; - hide(response?: any): void; + hide(response?: any): angular.IPromise; cancel(response?: any): void; } From 8f6135b6a0b9484b7fb4e43d8549ff868c8043c1 Mon Sep 17 00:00:00 2001 From: rhysd Date: Thu, 10 Dec 2015 00:52:07 +0900 Subject: [PATCH 371/389] github-electron: Fix min-width style properties of BrowserWindowOptions to minWidth style They were renamed at Electron v0.35 and previous names were deprecated. https://github.com/atom/electron/blob/master/docs/api/browser-window.md#new-browserwindowoptions --- github-electron/github-electron-main-tests.ts | 2 +- github-electron/github-electron.d.ts | 56 +++++++++---------- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/github-electron/github-electron-main-tests.ts b/github-electron/github-electron-main-tests.ts index 84f1ca89c..74a307710 100644 --- a/github-electron/github-electron-main-tests.ts +++ b/github-electron/github-electron-main-tests.ts @@ -169,7 +169,7 @@ app.on('ready', () => { window = new BrowserWindow({ width: 800, height: 600, - 'title-bar-style': 'hidden-inset', + titleBarStyle: 'hidden-inset', }); window.loadURL('https://github.com'); }); diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts index 10c3a43f2..e9d5aa099 100644 --- a/github-electron/github-electron.d.ts +++ b/github-electron/github-electron.d.ts @@ -451,50 +451,50 @@ declare module GitHubElectron { // http://electron.atom.io/docs/v0.29.0/api/browser-window/ interface BrowserWindowOptions extends Rectangle { show?: boolean; - 'use-content-size'?: boolean; + useContentSize?: boolean; center?: boolean; - 'min-width'?: number; - 'min-height'?: number; - 'max-width'?: number; - 'max-height'?: number; + minWidth?: number; + minHeight?: number; + maxWidth?: number; + maxHeight?: number; resizable?: boolean; - 'always-on-top'?: boolean; + alwaysOnTop?: boolean; fullscreen?: boolean; - 'skip-taskbar'?: boolean; - 'zoom-factor'?: number; + skipTaskbar?: boolean; + zoomFactor?: number; kiosk?: boolean; title?: string; icon?: NativeImage|string; frame?: boolean; - 'node-integration'?: boolean; - 'accept-first-mouse'?: boolean; - 'disable-auto-hide-cursor'?: boolean; - 'auto-hide-menu-bar'?: boolean; - 'enable-larger-than-screen'?: boolean; - 'dark-theme'?: boolean; + nodeIntegration?: boolean; + acceptFirstMouse?: boolean; + disableAutoHideCursor?: boolean; + autoHideMenuBar?: boolean; + enableLargerThanScreen?: boolean; + darkTheme?: boolean; preload?: string; transparent?: boolean; type?: string; - 'standard-window'?: boolean; - 'web-preferences'?: any; // Object + standardWindow?: boolean; + webPreferences?: any; // Object javascript?: boolean; - 'web-security'?: boolean; + webSecurity?: boolean; images?: boolean; java?: boolean; - 'text-areas-are-resizable'?: boolean; + textAreasAreResizable?: boolean; webgl?: boolean; webaudio?: boolean; plugins?: boolean; - 'extra-plugin-dirs'?: string[]; - 'experimental-features'?: boolean; - 'experimental-canvas-features'?: boolean; - 'subpixel-font-scaling'?: boolean; - 'overlay-scrollbars'?: boolean; - 'overlay-fullscreen-video'?: boolean; - 'shared-worker'?: boolean; - 'direct-write'?: boolean; - 'page-visibility'?: boolean; - 'title-bar-style'?: string; + extraPluginDirs?: string[]; + experimentalFeatures?: boolean; + experimentalCanvasFeatures?: boolean; + subpixelFontScaling?: boolean; + overlayScrollbars?: boolean; + overlayFullscreenVideo?: boolean; + sharedWorker?: boolean; + directWrite?: boolean; + pageVisibility?: boolean; + titleBarStyle?: string; } interface Rectangle { From 9fbacecc6ad974a16f9867e9662da1c73a1bad61 Mon Sep 17 00:00:00 2001 From: rhysd Date: Thu, 10 Dec 2015 00:59:39 +0900 Subject: [PATCH 372/389] github-electron: Define type of webPreferences property of BrowserWindowOptions https://github.com/atom/electron/blob/master/docs/api/browser-window.md#new-browserwindowoptions --- github-electron/github-electron.d.ts | 37 +++++++++++++++++----------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts index e9d5aa099..2d2363ccc 100644 --- a/github-electron/github-electron.d.ts +++ b/github-electron/github-electron.d.ts @@ -447,6 +447,28 @@ declare module GitHubElectron { isVisibleOnAllWorkspaces(): boolean; } + interface WebPreferences { + nodeIntegration?: boolean; + preload?: string; + partition: string; + zoomFactor: number; + javascript: boolean; + webSecurity: boolean; + allowDisplayingInsecureContent: boolean; + allowRunningInsecureContent: boolean; + images: boolean; + textAreasAreResizable: boolean; + webgl?: boolean; + webaudio?: boolean; + plugins?: boolean; + experimentalFeatures?: boolean; + experimentalCanvasFeatures?: boolean; + overlayScrollbars?: boolean; + sharedWorker?: boolean; + directWrite?: boolean; + pageVisibility?: boolean; + } + // Includes all options BrowserWindow can take as of this writing // http://electron.atom.io/docs/v0.29.0/api/browser-window/ interface BrowserWindowOptions extends Rectangle { @@ -466,7 +488,6 @@ declare module GitHubElectron { title?: string; icon?: NativeImage|string; frame?: boolean; - nodeIntegration?: boolean; acceptFirstMouse?: boolean; disableAutoHideCursor?: boolean; autoHideMenuBar?: boolean; @@ -476,24 +497,12 @@ declare module GitHubElectron { transparent?: boolean; type?: string; standardWindow?: boolean; - webPreferences?: any; // Object - javascript?: boolean; - webSecurity?: boolean; - images?: boolean; + webPreferences?: WebPreferences; java?: boolean; textAreasAreResizable?: boolean; - webgl?: boolean; - webaudio?: boolean; - plugins?: boolean; extraPluginDirs?: string[]; - experimentalFeatures?: boolean; - experimentalCanvasFeatures?: boolean; subpixelFontScaling?: boolean; - overlayScrollbars?: boolean; overlayFullscreenVideo?: boolean; - sharedWorker?: boolean; - directWrite?: boolean; - pageVisibility?: boolean; titleBarStyle?: string; } From 41b42c1609ce6f0b48af2952de352d0525e828e7 Mon Sep 17 00:00:00 2001 From: James O'Cull Date: Wed, 9 Dec 2015 17:08:36 -0500 Subject: [PATCH 373/389] QueryInterface should have `sequelize` property --- sequelize/sequelize.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sequelize/sequelize.d.ts b/sequelize/sequelize.d.ts index 46a0ba41a..3f1e2c86f 100644 --- a/sequelize/sequelize.d.ts +++ b/sequelize/sequelize.d.ts @@ -3949,6 +3949,11 @@ declare module "sequelize" { * We don't have a definition for the QueryGenerator, because I doubt it is commonly in use separately. */ QueryGenerator: any; + + /** + * Returns the current sequelize instance. + */ + sequelize: Sequelize; /** * Queries the schema (table list). From 47bf640e91b6ef48d7ad56a34fe9c91f84b81799 Mon Sep 17 00:00:00 2001 From: Quentin Jones Date: Wed, 9 Dec 2015 19:22:17 -0600 Subject: [PATCH 374/389] Added a couple options missing from interface --- bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker.d.ts b/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker.d.ts index fb0b1b389..bd8a3ff54 100644 --- a/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker.d.ts +++ b/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker.d.ts @@ -54,6 +54,8 @@ declare module BootstrapV3DatetimePicker { showTodayButton?: boolean; viewMode?: string; inline?: boolean; + toolbarPlacement?: string; + showClear?: boolean; } interface Datetimepicker { From 9cb7452abb970f4df7548b97587187b3b5b05123 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Thu, 10 Dec 2015 06:20:45 +0500 Subject: [PATCH 375/389] lodash: signatures of _.isBoolean have been changed --- lodash/lodash-tests.ts | 41 +++++++++++++++++++++++++++-------------- lodash/lodash.d.ts | 10 +++++++++- 2 files changed, 36 insertions(+), 15 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index c409e2621..e45f03a09 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -5337,20 +5337,33 @@ result = _({}).isArray(); } // _.isBoolean -result = _.isBoolean(any); -result = _(1).isBoolean(); -result = _([]).isBoolean(); -result = _({}).isBoolean(); -{ - let value: number[]|boolean = [1, 3, 5]; - if (_.isBoolean(value)) { - let b: boolean = value; - // compile error - // let length: number = value.length; - } else { - let length: number = value.length; - // compile error - // let b: boolean = value; +module TestIsBoolean { + { + let value: number|boolean; + + if (_.isBoolean(value)) { + let result: boolean = value; + } + else { + let result: number = value; + } + } + + { + let result: boolean; + + result = _.isBoolean(any); + result = _(1).isBoolean(); + result = _([]).isBoolean(); + result = _({}).isBoolean(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isBoolean(); + result = _([]).chain().isBoolean(); + result = _({}).chain().isBoolean(); } } diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 253107c7f..04abeb490 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -9212,9 +9212,10 @@ declare module _ { interface LoDashStatic { /** * Checks if value is classified as a boolean primitive or object. + * * @param value The value to check. * @return Returns true if value is correctly classified, else false. - **/ + */ isBoolean(value?: any): value is boolean; } @@ -9225,6 +9226,13 @@ declare module _ { isBoolean(): boolean; } + interface LoDashExplicitWrapperBase { + /** + * @see _.isBoolean + */ + isBoolean(): LoDashExplicitWrapper; + } + //_.isDate interface LoDashStatic { /** From 0ef797c1356c5ed73483e164213f4d938fbbc6fd Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Wed, 9 Dec 2015 20:35:57 -0600 Subject: [PATCH 376/389] [node] export Stream as class, not interface require('stream').Stream in Node.js is a constructor. --- node/node.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/node.d.ts b/node/node.d.ts index 017ca8e6b..d1650174c 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -1675,7 +1675,7 @@ declare module "crypto" { declare module "stream" { import * as events from "events"; - export interface Stream extends events.EventEmitter { + export class Stream extends events.EventEmitter { pipe(destination: T, options?: { end?: boolean; }): T; } From 249633b2150e89025ae836d52b32583ec8be75ac Mon Sep 17 00:00:00 2001 From: vvakame Date: Thu, 10 Dec 2015 21:38:55 +0900 Subject: [PATCH 377/389] fix chrome.d.ts type header --- chrome/chrome.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/chrome.d.ts b/chrome/chrome.d.ts index 7db591be2..77d2898fd 100755 --- a/chrome/chrome.d.ts +++ b/chrome/chrome.d.ts @@ -1,6 +1,6 @@ // Type definitions for Chrome extension development // Project: http://developer.chrome.com/extensions/ -// Definitions by: Matthew Kimber , otiai10 , couven92 +// Definitions by: Matthew Kimber , otiai10 , couven92 // Definitions: https://github.com/borisyankov/DefinitelyTyped /// From 0eef583c76ec45f52808b60fe4be2bf835c859a4 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Mon, 7 Dec 2015 05:31:07 +0500 Subject: [PATCH 378/389] node: signatures of module "querystring" have been changed --- node/node-tests.ts | 47 ++++++++++++++++++++++++++++++++++++++-------- node/node.d.ts | 14 ++++++++++++-- 2 files changed, 51 insertions(+), 10 deletions(-) diff --git a/node/node-tests.ts b/node/node-tests.ts index 4ca651b33..aa0f55bb6 100644 --- a/node/node-tests.ts +++ b/node/node-tests.ts @@ -239,16 +239,47 @@ ds.send(new Buffer("hello"), 0, 5, 5000, "127.0.0.1", (error: Error, bytes: numb }); //////////////////////////////////////////////////// -///Querystring tests : https://gist.github.com/musubu/2202583 +///Querystring tests : https://nodejs.org/api/querystring.html //////////////////////////////////////////////////// -var original: string = 'http://example.com/product/abcde.html'; -var escaped: string = querystring.escape(original); -console.log(escaped); -// http%3A%2F%2Fexample.com%2Fproduct%2Fabcde.html -var unescaped: string = querystring.unescape(escaped); -console.log(unescaped); -// http://example.com/product/abcde.html +module querystring_tests { + type SampleObject = {a: string; b: number;} + + { + let obj: SampleObject; + let sep: string; + let eq: string; + let options: querystring.StringifyOptions; + let result: string; + + result = querystring.stringify(obj); + result = querystring.stringify(obj, sep); + result = querystring.stringify(obj, sep, eq); + result = querystring.stringify(obj, sep, eq); + result = querystring.stringify(obj, sep, eq, options); + } + + { + let str: string; + let sep: string; + let eq: string; + let options: querystring.ParseOptions; + let result: SampleObject; + + result = querystring.parse(str); + result = querystring.parse(str, sep); + result = querystring.parse(str, sep, eq); + result = querystring.parse(str, sep, eq, options); + } + + { + let str: string; + let result: string; + + result = querystring.escape(str); + result = querystring.unescape(str); + } +} //////////////////////////////////////////////////// /// path tests : http://nodejs.org/api/path.html diff --git a/node/node.d.ts b/node/node.d.ts index 39be040a4..34e6ffedc 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -405,8 +405,18 @@ declare module "buffer" { } declare module "querystring" { - export function stringify(obj: any, sep?: string, eq?: string): string; - export function parse(str: string, sep?: string, eq?: string, options?: { maxKeys?: number; }): any; + export interface StringifyOptions { + encodeURIComponent?: Function; + } + + export interface ParseOptions { + maxKeys?: number; + decodeURIComponent?: Function; + } + + export function stringify(obj: T, sep?: string, eq?: string, options?: StringifyOptions): string; + export function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): any; + export function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): T; export function escape(str: string): string; export function unescape(str: string): string; } From a0d89370306da9dd4643242b4b4c0ba9934511c4 Mon Sep 17 00:00:00 2001 From: Graham Mendick Date: Thu, 10 Dec 2015 13:44:18 +0000 Subject: [PATCH 379/389] Updated typings and tests for Navigation 1.2.0 --- navigation/navigation-tests.ts | 21 ++++-- navigation/navigation.d.ts | 127 +++++++++++++++++++++++++++++++-- 2 files changed, 138 insertions(+), 10 deletions(-) diff --git a/navigation/navigation-tests.ts b/navigation/navigation-tests.ts index 758e0e53f..d3676e82e 100644 --- a/navigation/navigation-tests.ts +++ b/navigation/navigation-tests.ts @@ -38,8 +38,8 @@ module NavigationTests { // Configuration Navigation.StateInfoConfig.build([ - { key: 'home', initial: 'page', states: [ - { key: 'page', route: '' } + { key: 'home', initial: 'page', help: 'home.htm', states: [ + { key: 'page', route: '', help: 'page.htm' } ]}, { key: 'person', initial: 'list', states: [ { key: 'list', route: ['people/{page}', 'people/{page}/sort/{sort}'], transitions: [ @@ -97,24 +97,28 @@ module NavigationTests { // Navigation Navigation.start('home'); Navigation.StateController.navigate('person'); + Navigation.StateController.navigate('person', null, Navigation.HistoryAction.Add); Navigation.StateController.refresh(); - Navigation.StateController.refresh({ page: 2 }); + Navigation.StateController.refresh({ page: 3 }); + Navigation.StateController.refresh({ page: 2 }, Navigation.HistoryAction.Replace); Navigation.StateController.navigate('select', { id: 10 }); var canGoBack: boolean = Navigation.StateController.canNavigateBack(1); Navigation.StateController.navigateBack(1); + Navigation.StateController.clearStateContext(); // Navigation Link var link = Navigation.StateController.getNavigationLink('person'); link = Navigation.StateController.getRefreshLink(); link = Navigation.StateController.getRefreshLink({ page: 2 }); + Navigation.StateController.navigateLink(link); link = Navigation.StateController.getNavigationLink('select', { id: 10 }); var nextDialog = Navigation.StateController.getNextState('select').parent; person = nextDialog; - Navigation.StateController.navigateLink(link); + Navigation.StateController.navigateLink(link, false); link = Navigation.StateController.getNavigationBackLink(1); var crumb = Navigation.StateController.crumbs[0]; link = crumb.navigationLink; - Navigation.StateController.navigateLink(link, true); + Navigation.StateController.navigateLink(link, true, Navigation.HistoryAction.None); // StateContext Navigation.StateController.navigate('home'); @@ -124,10 +128,15 @@ module NavigationTests { person === Navigation.StateContext.dialog; personList === Navigation.StateContext.state; var url: string = Navigation.StateContext.url; + var title: string = Navigation.StateContext.title; var page: number = Navigation.StateContext.data.page; + Navigation.StateController.refresh({ page: 2 }); + person = Navigation.StateContext.oldDialog; + personList = Navigation.StateContext.oldState; + page = Navigation.StateContext.oldData.page; + page = Navigation.StateContext.previousData.page; // Navigation Data - Navigation.StateController.refresh({ page: 2 }); var data = Navigation.StateContext.includeCurrentData({ sort: 'name' }, ['page']); Navigation.StateController.refresh(data); Navigation.StateContext.clear('sort'); diff --git a/navigation/navigation.d.ts b/navigation/navigation.d.ts index 59af79ca2..418cec8a4 100644 --- a/navigation/navigation.d.ts +++ b/navigation/navigation.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Navigation 1.1.0 +// Type definitions for Navigation 1.2.0 // Project: http://grahammendick.github.io/navigation/ // Definitions by: Graham Mendick // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -31,6 +31,10 @@ declare module Navigation { * Gets the textual description of the dialog */ title?: string; + /** + * Gets the additional dialog attributes + */ + [extras: string]: any; } /** @@ -75,6 +79,10 @@ declare module Navigation { * preserved when navigating */ trackTypes?: boolean; + /** + * Gets the additional state attributes + */ + [extras: string]: any; } /** @@ -278,6 +286,24 @@ declare module Navigation { */ static build(dialogs: IDialog[]>[]>[]): void; } + + /** + * Determines the effect on browser history after a successful navigation + */ + enum HistoryAction { + /** + * Creates a new browser history entry + */ + Add = 0, + /** + * Changes the current browser history entry + */ + Replace = 1, + /** + * Leaves browser history unchanged + */ + None = 2, + } /** * Defines a contract a class must implement in order to manage the browser @@ -295,9 +321,17 @@ declare module Navigation { /** * Adds browser history * @param state The State navigated to - * @param url The current url + * @param url The current url */ addHistory(state: State, url: string): void; + /** + * Adds browser history + * @param state The State navigated to + * @param url The current url + * @param replace A value indicating whether to replace the current + * browser history entry + */ + addHistory(state: State, url: string, replace: boolean): void; /** * Gets the current location */ @@ -339,6 +373,14 @@ declare module Navigation { * @param url The current url */ addHistory(state: State, url: string): void; + /** + * Sets the browser Url's hash to the url + * @param state The State navigated to + * @param url The current url + * @param replace A value indicating whether to replace the current + * browser history entry + */ + addHistory(state: State, url: string, replace: boolean): void; /** * Gets the current location */ @@ -375,6 +417,14 @@ declare module Navigation { * @param url The current url */ addHistory(state: State, url: string): void; + /** + * Sets the browser Url to the url using pushState + * @param state The State navigated to + * @param url The current url + * @param replace A value indicating whether to replace the current + * browser history entry + */ + addHistory(state: State, url: string, replace: boolean): void; /** * Gets the current location */ @@ -587,6 +637,11 @@ declare module Navigation { * ReturnData should be part of the CrumbTrail */ combineCrumbTrail: boolean; + /** + * Gets or sets a value indicating whether to track PreviousData when + * navigating back or refreshing and combineCrumbTrail is false + */ + trackAllPreviousData: boolean; } /** @@ -595,6 +650,18 @@ declare module Navigation { * previous State (this is not the same as the previous Crumb) */ class StateContext { + /** + * Gets the last State displayed before the current State + */ + static oldState: State; + /** + * Gets the parent of the OldState property + */ + static oldDialog: Dialog; + /** + * Gets the NavigationData for the last displayed State + */ + static oldData: any; /** * Gets the State navigated away from to reach the current State */ @@ -603,6 +670,10 @@ declare module Navigation { * Gets the parent of the PreviousState property */ static previousDialog: Dialog; + /** + * Gets the NavigationData for the navigated away from State + */ + static previousData: any; /** * Gets the current State */ @@ -612,14 +683,17 @@ declare module Navigation { */ static dialog: Dialog; /** - * Gets the NavigationData for the current State. It can be accessed. - * Will become the data stored in a Crumb when part of a crumb trail + * Gets the NavigationData for the current State */ static data: any; /** * Gets the current Url */ static url: string; + /** + * Gets or sets the current title + */ + static title: string; /** * Combines the data with all the current NavigationData * @param The data to add to the current NavigationData @@ -660,6 +734,10 @@ declare module Navigation { * @param url The current Url */ static setStateContext(state: State, url: string): void; + /** + * Clears the Context Data + */ + static clearStateContext(): void; /** * Registers a navigate event listener * @param handler The navigate event listener @@ -694,6 +772,20 @@ declare module Navigation { * @throws A mandatory route parameter has not been supplied a value */ static navigate(action: string, toData: any): void; + /** + * Navigates to a State. Depending on the action will either navigate + * to the 'to' State of a Transition or the 'initial' State of a + * Dialog + * @param action The key of a child Transition or the key of a Dialog + * @param toData The NavigationData to be passed to the next State and + * stored in the StateContext + * @param A value determining the effect on browser history + * @throws action does not match the key of a child Transition or the + * key of a Dialog; or there is NavigationData that cannot be converted + * to a String + * @throws A mandatory route parameter has not been supplied a value + */ + static navigate(action: string, toData: any, historyAction: HistoryAction): void; /** * Gets a Url to navigate to a State. Depending on the action will * either navigate to the 'to' State of a Transition or the 'initial' @@ -733,6 +825,17 @@ declare module Navigation { * @throws A mandatory route parameter has not been supplied a value */ static navigateBack(distance: number): void; + /** + * Navigates back to the Crumb contained in the crumb trail, + * represented by the Crumbs collection, as specified by the distance. + * In the crumb trail no two crumbs can have the same State but all + * must have the same Dialog + * @param distance Starting at 1, the number of Crumb steps to go back + * @param A value determining the effect on browser history + * @throws canNavigateBack returns false for this distance + * @throws A mandatory route parameter has not been supplied a value + */ + static navigateBack(distance: number, historyAction: HistoryAction): void; /** * Gets a Url to navigate to a Crumb contained in the crumb trail, * represented by the Crumbs collection, as specified by the distance. @@ -755,6 +858,15 @@ declare module Navigation { * @throws A mandatory route parameter has not been supplied a value */ static refresh(toData: any): void; + /** + * Navigates to the current State + * @param toData The NavigationData to be passed to the current State + * and stored in the StateContext + * @param A value determining the effect on browser history + * @throws There is NavigationData that cannot be converted to a String + * @throws A mandatory route parameter has not been supplied a value + */ + static refresh(toData: any, historyAction: HistoryAction): void; /** * Gets a Url to navigate to the current State passing no * NavigationData @@ -779,6 +891,13 @@ declare module Navigation { * @param history A value indicating whether browser history was used */ static navigateLink(url: string, history: boolean): void; + /** + * Navigates to the url + * @param url The target location + * @param history A value indicating whether browser history was used + * @param A value determining the effect on browser history + */ + static navigateLink(url: string, history: boolean, historyAction: HistoryAction): void; /** * Gets the next State. Depending on the action will either return the * 'to' State of a Transition or the 'initial' State of a Dialog From 6d32913dc56b916ef69f916350ff9a04133466ed Mon Sep 17 00:00:00 2001 From: rhysd Date: Thu, 10 Dec 2015 01:01:28 +0900 Subject: [PATCH 380/389] github-electron: Update header --- github-electron/github-electron.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts index 2d2363ccc..5bd8a4489 100644 --- a/github-electron/github-electron.d.ts +++ b/github-electron/github-electron.d.ts @@ -1,7 +1,7 @@ -// Type definitions for Electron 0.25.2 (shared between main and rederer processes) +// Type definitions for Electron v0.35.0 // Project: http://electron.atom.io/ -// Definitions by: jedmao -// Definitions: https://github.com/borisyankov/DefinitelyTyped +// Definitions by: jedmao , rhysd +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// From 624237a55346531ec0b6e9194895d36993eab051 Mon Sep 17 00:00:00 2001 From: Adam Babcock Date: Thu, 10 Dec 2015 09:34:27 -0600 Subject: [PATCH 381/389] Add containDeepOrdered --- should/should-tests.ts | 7 +++++++ should/should.d.ts | 1 + 2 files changed, 8 insertions(+) diff --git a/should/should-tests.ts b/should/should-tests.ts index c940f7c13..43b21d0ef 100644 --- a/should/should-tests.ts +++ b/should/should-tests.ts @@ -172,3 +172,10 @@ obj.should.have.keys('foo', 'bar'); obj.should.have.keys(['foo', 'bar']); (1).should.eql(0, 'some useful description'); + +[ 1, 2, 3].should.containDeepOrdered([1, 2]); +[ 1, 2, [ 1, 2, 3 ]].should.containDeepOrdered([ 1, [ 2, 3 ]]); + +({ a: 10, b: { c: 10, d: [1, 2, 3] }}).should.containDeepOrdered({a: 10}); +({ a: 10, b: { c: 10, d: [1, 2, 3] }}).should.containDeepOrdered({b: {c: 10}}); +({ a: 10, b: { c: 10, d: [1, 2, 3] }}).should.containDeepOrdered({b: {d: [1, 3]}}); diff --git a/should/should.d.ts b/should/should.d.ts index ba32f571b..26a42d7ed 100644 --- a/should/should.d.ts +++ b/should/should.d.ts @@ -64,6 +64,7 @@ interface ShouldAssertion { contain(obj: any): ShouldAssertion; containEql(obj: any): ShouldAssertion; containDeep(obj: any): ShouldAssertion; + containDeepOrdered(obj: any): ShouldAssertion; keys(...allKeys: string[]): ShouldAssertion; keys(allKeys: string[]): ShouldAssertion; header(field: string, val?: string): ShouldAssertion; From 9d54d10a8847504e6009c15aba5244942941b6d8 Mon Sep 17 00:00:00 2001 From: Alexander <4nonym0us@xakep.ru> Date: Thu, 10 Dec 2015 21:09:58 +0200 Subject: [PATCH 382/389] Raact to Ionic 1.2 release https://github.com/driftyco/ionic/pull/4613/files --- ionic/ionic.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/ionic/ionic.d.ts b/ionic/ionic.d.ts index bb009df51..ce097a226 100644 --- a/ionic/ionic.d.ts +++ b/ionic/ionic.d.ts @@ -343,6 +343,7 @@ declare module ionic { select(index: number): void; selectedIndex(): number; $getByHandle(handle: string): IonicTabsDelegate; + showBar(show?: boolean): boolean; } } module utility { From 4a61f4eccd1f334ac07c24f68e8668b7e7913f37 Mon Sep 17 00:00:00 2001 From: Nax Date: Thu, 10 Dec 2015 20:18:16 +0100 Subject: [PATCH 383/389] Added socketty v0.2.2 --- socketty/socketty.d.ts | 57 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 socketty/socketty.d.ts diff --git a/socketty/socketty.d.ts b/socketty/socketty.d.ts new file mode 100644 index 000000000..9cbbeeef9 --- /dev/null +++ b/socketty/socketty.d.ts @@ -0,0 +1,57 @@ +// Type definitions for Socketty v0.2.2 +// Project: https://www.npmjs.com/package/socketty +// Definitions by: Nax +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare var socketty: Socketty; + +declare module 'socketty' { + export = socketty; +} + +interface Socketty { + /** + * Connect to a socketty server. + * @param url The server url + * @param callback The callback to be run when the connection is open + * @return A Socket + */ + connect(url: string, callback: (SockettySocket) => void): SockettySocket; + + /** + * Create a socketty server. + * @param httpServer The HTTP server to use + * @return A socketty server + */ + createServer(httpServer: any): void; +} + +interface SockettySocket { + /** + * Listen for an action. + * @param action The action to listen to + * @param callback A callback to be run when the action is fired + */ + on(action: string, callback: (any?) => void): void; + + /** + * Send an action, as well as an optional message. + * @param action The action to send + * @param message The message to send + */ + send(action: string, message?: any): void; + + /** + * Specify a callback to be run when the socket is disconnected. + * @param callback The disconnect callback + */ + disconnect(callback: () => void): void; +} + +interface SockettyServer { + /** + * Specify a callback to be run when a new socket connects to the server. + * @param callback The callback + */ + connection(callback: (SockettySocket) => void): void; +} From 6f04aca222d233a4c610b5020a09c760140d33f5 Mon Sep 17 00:00:00 2001 From: Nax Date: Thu, 10 Dec 2015 20:39:16 +0100 Subject: [PATCH 384/389] Fixed typescript errors and added tests --- socketty/socketty-tests.ts | 24 ++++++++++++++++++++++++ socketty/socketty.d.ts | 8 ++++---- 2 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 socketty/socketty-tests.ts diff --git a/socketty/socketty-tests.ts b/socketty/socketty-tests.ts new file mode 100644 index 000000000..22809a6b0 --- /dev/null +++ b/socketty/socketty-tests.ts @@ -0,0 +1,24 @@ +/// + +/* Server */ + +var httpServer = {}; // Assume it's a real HTTP server object + +var webSocketServer = socketty.createServer(httpServer); + +webSocketServer.connection((socket: SockettySocket) => { + console.log('Client connected'); + socket.on('msg', (message?: any) => { + console.log('Client said' + message); + }); + socket.disconnect(() => { + console.log('Goodbye, client!'); + }); +}); + +/* Client */ + +socketty.connect('ws://localhost:8080', (socket: SockettySocket) => { + console.log('Connected !'); + socket.send('msg', 'Hello server!'); +}); diff --git a/socketty/socketty.d.ts b/socketty/socketty.d.ts index 9cbbeeef9..da7f82507 100644 --- a/socketty/socketty.d.ts +++ b/socketty/socketty.d.ts @@ -16,14 +16,14 @@ interface Socketty { * @param callback The callback to be run when the connection is open * @return A Socket */ - connect(url: string, callback: (SockettySocket) => void): SockettySocket; + connect(url: string, callback: (socket: SockettySocket) => void): SockettySocket; /** * Create a socketty server. * @param httpServer The HTTP server to use * @return A socketty server */ - createServer(httpServer: any): void; + createServer(httpServer: any): SockettyServer; } interface SockettySocket { @@ -32,7 +32,7 @@ interface SockettySocket { * @param action The action to listen to * @param callback A callback to be run when the action is fired */ - on(action: string, callback: (any?) => void): void; + on(action: string, callback: (message?: any) => void): void; /** * Send an action, as well as an optional message. @@ -53,5 +53,5 @@ interface SockettyServer { * Specify a callback to be run when a new socket connects to the server. * @param callback The callback */ - connection(callback: (SockettySocket) => void): void; + connection(callback: (socket: SockettySocket) => void): void; } From c48c6ff985ad6c2dc12976c86fc959bf56bad48c Mon Sep 17 00:00:00 2001 From: Samuel Reed Date: Thu, 10 Dec 2015 13:42:29 -0600 Subject: [PATCH 385/389] Fix Bluebird nodeify() when not passed callback .nodeify() will return the Promise it was called on, not void, when no callback is passed. --- bluebird/bluebird.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bluebird/bluebird.d.ts b/bluebird/bluebird.d.ts index da3b9902a..f3420957a 100644 --- a/bluebird/bluebird.d.ts +++ b/bluebird/bluebird.d.ts @@ -117,7 +117,7 @@ declare class Promise implements Promise.Thenable, Promise.Inspection { * Returns back this promise instead of creating a new one. If the `callback` argument is not a function, this method does not do anything. */ nodeify(callback: (err: any, value?: R) => void, options?: Promise.SpreadOption): Promise; - nodeify(...sink: any[]): void; + nodeify(...sink: any[]): Promise; /** * Marks this promise as cancellable. Promises by default are not cancellable after v0.11 and must be marked as such for `.cancel()` to have any effect. Marking a promise as cancellable is infectious and you don't need to remark any descendant promise. From be2e3466d4007b38209664d0508ab23181886e56 Mon Sep 17 00:00:00 2001 From: Alexander <4nonym0us@xakep.ru> Date: Thu, 10 Dec 2015 22:55:08 +0200 Subject: [PATCH 386/389] Adding tests for $ionicTabsDelegate.showBar() --- ionic/ionic-tests.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ionic/ionic-tests.ts b/ionic/ionic-tests.ts index c68846715..9c5cfdad0 100644 --- a/ionic/ionic-tests.ts +++ b/ionic/ionic-tests.ts @@ -360,6 +360,8 @@ class IonicTestController { this.$ionicTabsDelegate.select(1); var selectedIndex: number = this.$ionicTabsDelegate.selectedIndex(); var ionicTabsDelegate: ionic.tabs.IonicTabsDelegate = this.$ionicTabsDelegate.$getByHandle("handle"); + this.$ionicTabsDelegate.showBar(true); + var isBarShown: boolean = this.$ionicTabsDelegate.showBar(); } private testUtility(): void { var {top: number, left: number, width: number, height: number} = this.$ionicPositionService.position(angular.element("body")); From 79e875c9566e3da496fe68292d11700f2bc9a6af Mon Sep 17 00:00:00 2001 From: Artem Berezin Date: Fri, 11 Dec 2015 11:13:32 +0900 Subject: [PATCH 387/389] Update angular-resource.d.ts --- angularjs/angular-resource.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angularjs/angular-resource.d.ts b/angularjs/angular-resource.d.ts index 442d8fa60..fca03678f 100644 --- a/angularjs/angular-resource.d.ts +++ b/angularjs/angular-resource.d.ts @@ -141,7 +141,7 @@ declare module angular.resource { /** * Really just a regular Array object with $promise and $resolve attached to it */ - interface IResourceArray extends Array> { + interface IResourceArray extends Array> { /** the promise of the original server interaction that created this collection. **/ $promise : angular.IPromise>; $resolved : boolean; From 7238dde0a51c96f6c3d0fbde772d9f510a59050c Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Fri, 11 Dec 2015 09:43:45 +0500 Subject: [PATCH 388/389] lodash: signatures of _.debounce have been changed --- lodash/lodash-tests.ts | 56 ++++++++++++++++++--------- lodash/lodash.d.ts | 87 +++++++++++++++++++++++++----------------- 2 files changed, 90 insertions(+), 53 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index b4528be6d..2d244b16e 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -4811,28 +4811,50 @@ curryResult7 = _.curryRight(testCurry2)(true)(2); curryResult8 = _.curryRight(testCurry2)(true); curryResult9 = _.curryRight(testCurry2); -declare var source: any; -result = _.debounce(function () { }, 150); +// _.debounce +module TestDebounce { + interface SampleFunc { + (n: number, s: string): boolean; + } -jQuery('#postbox').on('click', _.debounce(function () { }, 300, { - 'leading': true, - 'trailing': false -})); + interface Options { + leading?: boolean; + maxWait?: number; + trailing?: boolean; + } -source.addEventListener('message', _.debounce(function () { }, 250, { - 'maxWait': 1000 -}), false); + interface ResultFunc { + (n: number, s: string): boolean; + cancel(): void; + } -result = <_.LoDashImplicitObjectWrapper>_(function () { }).debounce(150); + let func: SampleFunc; + let options: Options; -jQuery('#postbox').on('click', <_.LoDashImplicitObjectWrapper>_(function () { }).debounce(300, { - 'leading': true, - 'trailing': false -})); + { + let result: ResultFunc; -source.addEventListener('message', <_.LoDashImplicitObjectWrapper>_(function () { }).debounce(250, { - 'maxWait': 1000 -}), false); + result = _.debounce(func); + result = _.debounce(func, 42); + result = _.debounce(func, 42, options); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(func).debounce(); + result = _(func).debounce(42); + result = _(func).debounce(42, options); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(func).chain().debounce(); + result = _(func).chain().debounce(42); + result = _(func).chain().debounce(42, options); + } +} // _.defer module TestDefer { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index f44d3f63f..8425f1d82 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -8380,54 +8380,69 @@ declare module _ { } //_.debounce + interface DebounceSettings { + /** + * Specify invoking on the leading edge of the timeout. + */ + leading?: boolean; + + /** + * The maximum time func is allowed to be delayed before it’s invoked. + */ + maxWait?: number; + + /** + * Specify invoking on the trailing edge of the timeout. + */ + trailing?: boolean; + } + interface LoDashStatic { /** - * Creates a function that will delay the execution of func until after wait milliseconds have - * elapsed since the last time it was invoked. Provide an options object to indicate that func - * should be invoked on the leading and/or trailing edge of the wait timeout. Subsequent calls - * to the debounced function will return the result of the last func call. - * - * Note: If leading and trailing options are true func will be called on the trailing edge of - * the timeout only if the the debounced function is invoked more than once during the wait - * timeout. - * @param func The function to debounce. - * @param wait The number of milliseconds to delay. - * @param options The options object. - * @param options.leading Specify execution on the leading edge of the timeout. - * @param options.maxWait The maximum time func is allowed to be delayed before it's called. - * @param options.trailing Specify execution on the trailing edge of the timeout. - * @return The new debounced function. - **/ + * Creates a debounced function that delays invoking func until after wait milliseconds have elapsed since + * the last time the debounced function was invoked. The debounced function comes with a cancel method to + * cancel delayed invocations. Provide an options object to indicate that func should be invoked on the + * leading and/or trailing edge of the wait timeout. Subsequent calls to the debounced function return the + * result of the last func invocation. + * + * Note: If leading and trailing options are true, func is invoked on the trailing edge of the timeout only + * if the the debounced function is invoked more than once during the wait timeout. + * + * See David Corbacho’s article for details over the differences between _.debounce and _.throttle. + * + * @param func The function to debounce. + * @param wait The number of milliseconds to delay. + * @param options The options object. + * @param options.leading Specify invoking on the leading edge of the timeout. + * @param options.maxWait The maximum time func is allowed to be delayed before it’s invoked. + * @param options.trailing Specify invoking on the trailing edge of the timeout. + * @return Returns the new debounced function. + */ debounce( func: T, - wait: number, - options?: DebounceSettings): T; + wait?: number, + options?: DebounceSettings + ): T & Cancelable; } interface LoDashImplicitObjectWrapper { /** - * @see _.debounce - **/ + * @see _.debounce + */ debounce( - wait: number, - options?: DebounceSettings): LoDashImplicitObjectWrapper; + wait?: number, + options?: DebounceSettings + ): LoDashImplicitObjectWrapper; } - interface DebounceSettings { + interface LoDashExplicitObjectWrapper { /** - * Specify execution on the leading edge of the timeout. - **/ - leading?: boolean; - - /** - * The maximum time func is allowed to be delayed before it's called. - **/ - maxWait?: number; - - /** - * Specify execution on the trailing edge of the timeout. - **/ - trailing?: boolean; + * @see _.debounce + */ + debounce( + wait?: number, + options?: DebounceSettings + ): LoDashExplicitObjectWrapper; } //_.defer From e1fa07aaf86dbf299bf4999d613ea76a8fa63540 Mon Sep 17 00:00:00 2001 From: hadriandeoliveira Date: Fri, 11 Dec 2015 03:48:23 -0200 Subject: [PATCH 389/389] added LeState type definitions --- lestate/lestate-tests.ts | 20 ++++++++++++++++++++ lestate/lestate.d.ts | 27 +++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 lestate/lestate-tests.ts create mode 100644 lestate/lestate.d.ts diff --git a/lestate/lestate-tests.ts b/lestate/lestate-tests.ts new file mode 100644 index 000000000..9a007c68d --- /dev/null +++ b/lestate/lestate-tests.ts @@ -0,0 +1,20 @@ +/// + +let State = LeState.createState() + +State.set({ + test : {} +}) + +let currentState = State.get() + +State.insert({ + test : {} +}) + +let currentDescription = State.getDescription() + +State.createListener({ + id : 0, + selector : state => ({ test : state.test }) +}) diff --git a/lestate/lestate.d.ts b/lestate/lestate.d.ts new file mode 100644 index 000000000..d36a137eb --- /dev/null +++ b/lestate/lestate.d.ts @@ -0,0 +1,27 @@ +// Type definitions for LeState v0.1.3 +// Project: https://github.com/LeTools/LeState +// Definitions by: Hadrian Oliveira +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare let LeState : { + createState: (props?: { + initialState: {}; + }) => { + set(newValue: {}): [{ + id: number; + state: {}; + }]; + get(): any; + insert(newValue: {}): void; + getDescription(): {}; + createListener({ id, selector, force }: { + id: number; + selector: (state :any) => {}; + force?: boolean; + }): void; + }; +}; + +declare module "lestate" { + export default LeState; +}