From f5fd8fb18064d6a4e17a673b61e0f0f42d1115f0 Mon Sep 17 00:00:00 2001 From: sqwk Date: Thu, 18 Aug 2016 11:48:34 +0200 Subject: [PATCH 001/246] Add Paper.js Type Definitions --- paper/paper.d.ts | 4008 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 4008 insertions(+) create mode 100644 paper/paper.d.ts diff --git a/paper/paper.d.ts b/paper/paper.d.ts new file mode 100644 index 0000000000..9fc0c154a1 --- /dev/null +++ b/paper/paper.d.ts @@ -0,0 +1,4008 @@ +// Type definitions for Paper.js v0.9.22 +// Project: http://paperjs.org/ +// Definitions by: Clark Stevenson +// forked from https://github.com/clark-stevenson/paper.d.ts + +declare module 'paper' { + + /** + * The version of Paper.js, as a string. + */ + export var version: string; + + /** + * Gives access to paper's configurable settings. + */ + export var settings: { + + applyMatrix: boolean; + handleSize: number; + hitTolerance: number; + + }; + + /** + * The currently active project. + */ + export var project: Project; + + /** + * The list of all open projects within the current Paper.js context. + */ + export var projects: Project[]; + + /** + * The reference to the active project's view. + * Read Only. + */ + export var view: View; + + /** + * The reference to the active tool. + */ + export var tool: Tool; + + /** + * The list of available tools. + */ + export var tools: Tool[]; + + /** + * Injects the paper scope into any other given scope. Can be used for examle to inject the currently active PaperScope into the window's global scope, to emulate PaperScript-style globally accessible Paper classes and objects + * Please note: Using this method may override native constructors (e.g. Path, RGBColor). This may cause problems when using Paper.js in conjunction with other libraries that rely on these constructors. Keep the library scoped if you encounter issues caused by this. + * @param scope - + */ + export function install(scope: any): void; + + /** + * Sets up an empty project for us. If a canvas is provided, it also creates a View for it, both linked to this scope. + * @param element - the HTML canvas element this scope should be associated with, or an ID string by which to find the element. + */ + export function setup(canvas: HTMLCanvasElement | string): void; + + /** + * Activates this PaperScope, so all newly created items will be placed in its active project. + */ + export function activate(): void; + + /** + * An affine transform performs a linear mapping from 2D coordinates to other 2D coordinates that preserves the "straightness" and "parallelness" of lines. + * Such a coordinate transformation can be represented by a 3 row by 3 column matrix with an implied last row of [ 0 0 1 ]. This matrix transforms source coordinates (x,y) into destination coordinates (x',y') by considering them to be a column vector and multiplying the coordinate vector by the matrix according to the following process: + * This class is optimized for speed and minimizes calculations based on its knowledge of the underlying matrix (as opposed to say simply performing matrix multiplication). + */ + export class Matrix { + + /** + * Creates a 2D affine transform. + * @param a - the a property of the transform + * @param c - the c property of the transform + * @param b - the b property of the transform + * @param d - the d property of the transform + * @param tx - the tx property of the transform + * @param ty - the ty property of the transform + */ + constructor(a: number, c: number, b: number, d: number, tx: number, ty: number); + + /** + * The value that affects the transformation along the x axis when scaling or rotating, positioned at (0, 0) in the transformation matrix. + */ + a: number; + + /** + * The value that affects the transformation along the y axis when rotating or skewing, positioned at (1, 0) in the transformation matrix. + */ + c: number; + + /** + * The value that affects the transformation along the x axis when rotating or skewing, positioned at (0, 1) in the transformation matrix. + */ + b: number; + + /** + * The value that affects the transformation along the y axis when scaling or rotating, positioned at (1, 1) in the transformation matrix. + */ + d: number; + + /** + * The distance by which to translate along the x axis, positioned at (2, 0) in the transformation matrix. + */ + tx: number; + + /** + * The distance by which to translate along the y axis, positioned at (2, 1) in the transformation matrix. + */ + ty: number; + + /** + * The transform values as an array, in the same sequence as they are passed to initialize(a, c,b,d,tx,ty). + * Read only. + */ + values: number; + + /** + * The translation of the matrix as a vector. + * Read only. + */ + translation: Point; + + /** + * The scaling values of the matrix, if it can be decomposed. + * Read only. + */ + scaling: Point; + + /** + * The rotation angle of the matrix, if it can be decomposed. + * Read only. + */ + rotation: number; + + /** + * Sets this transform to the matrix specified by the 6 values. + * @param a - the a property of the transform + * @param c - the c property of the transform + * @param b - the b property of the transform + * @param d - the d property of the transform + * @param tx - the tx property of the transform + * @param ty - the ty property of the transform + */ + set(a: number, c: number, b: number, d: number, tx: number, ty: number): Matrix; + + /** + * Returns a copy of this transform + */ + clone(): Matrix; + + /** + * Checks whether the two matrices describe the same transformation. + * @param matrix - the matrix to compare this matrix to + */ + equals(matrix: Matrix): boolean; + + /** + * returns a string representation of this transform + */ + toString(): string; + + /** + * Resets the matrix by setting its values to the ones of the identity matrix that results in no transformation. + */ + reset(): void; + + /** + * Attempts to apply the matrix to the content of item that it belongs to, meaning its transformation is baked into the item's content or children. + * @param recursively - controls whether to apply transformations recursively on children + */ + apply(): boolean; + + /** + * Concatenates this transform with a translate transformation. + * @param point - the vector to translate by + */ + translate(point: Point): Matrix; + + /** + * Concatenates this transform with a translate transformation. + * @param dx - the distance to translate in the x direction + * @param dy - the distance to translate in the y direction + */ + translate(dx: number, dy: number): Matrix; + + /** + * Concatenates this transform with a scaling transformation. + * @param scale - the scaling factor + * @param center [optional] - the center for the scaling transformation + */ + scale(scale: number, center?: Point): Matrix; + + /** + * Concatenates this transform with a scaling transformation. + * @param hor - the horizontal scaling factor + * @param ver - the vertical scaling factor + * @param center [optional] - the center for the scaling transformation + */ + scale(hor: number, ver: number, center?: Point): Matrix; + + /** + * Concatenates this transform with a rotation transformation around an anchor point. + * @param angle - the angle of rotation measured in degrees + * @param center - the anchor point to rotate around + */ + rotate(angle: number, center: Point): Matrix; + + /** + * Concatenates this transform with a rotation transformation around an anchor point. + * @param angle - the angle of rotation measured in degrees + * @param x - the x coordinate of the anchor point + * @param y - the y coordinate of the anchor point + */ + rotate(angle: number, x: number, y: number): Matrix; + + /** + * Concatenates this transform with a shear transformation. + * @param shear - the shear factor in x and y direction + * @param center [optional] - the center for the shear transformation + */ + shear(shear: Point, center?: Point): Matrix; + + /** + * Concatenates this transform with a shear transformation. + * @param hor - the horizontal shear factor + * @param ver - the vertical shear factor + * @param center [optional] - the center for the shear transformation + */ + shear(hor: number, ver: number, center?: Point): Matrix; + + /** + * Concatenates this transform with a skew transformation. + * @param skew - the skew angles in x and y direction in degrees + * @param center [optional] - the center for the skew transformation + */ + skew(skew: Point, center?: Point): Matrix; + + /** + * Concatenates this transform with a skew transformation. + * @param hor - the horizontal skew angle in degrees + * @param ver - the vertical skew angle in degrees + * @param center [optional] - the center for the skew transformation + */ + skew(hor: number, ver: number, center?: Point): Matrix; + + /** + * Concatenates the given affine transform to this transform. + * @param mx - the transform to concatenate + */ + concatenate(mx: Matrix): Matrix; + + /** + * Pre-concatenates the given affine transform to this transform. + * @param mx - the transform to preconcatenate + */ + preConcatenate(mx: Matrix): Matrix; + + /** + * Returns a new instance of the result of the concatenation of the given affine transform with this transform. + * @param mx - the transform to concatenate + */ + chain(mx: Matrix): Matrix; + + /** + * Returns whether this transform is the identity transform + */ + isIdentity(): boolean; + + /** + * Returns whether the transform is invertible. A transform is not invertible if the determinant is 0 or any value is non-finite or NaN. + */ + isInvertible(): boolean; + + /** + * Checks whether the matrix is singular or not. Singular matrices cannot be inverted. + */ + isSingular(): boolean; + + /** + * Transforms a point and returns the result. + * @param point - the point to be transformed + */ + transform(point: Point): Matrix; + + /** + * Transforms an array of coordinates by this matrix and stores the results into the destination array, which is also returned. + * @param src - the array containing the source points as x, y value pairs + * @param dst - the array into which to store the transformed point pairs + * @param count - the number of points to transform + */ + transform(src: number[], dst: number[], count: number): number[]; + + /** + * Inverse transforms a point and returns the result. + * @param point - the point to be transformed + */ + inverseTransform(point: Point): Matrix; + + /** + * Attempts to decompose the affine transformation described by this matrix into scaling, rotation and shearing, and returns an object with these properties if it succeeded, null otherwise. + */ + decompose(): any; + + /** + * Creates the inversion of the transformation of the matrix and returns it as a new insteance. If the matrix is not invertible (in which case isSingular() returns true), null is returned. + */ + inverted(): Matrix; + + /** + * Applies this matrix to the specified Canvas Context. + * @param ctx - + */ + applyToContext(ctx: CanvasRenderingContext2D): void; + + } + /** + * The Point object represents a point in the two dimensional space of the Paper.js project. It is also used to represent two dimensional vector objects. + */ + export class Point { + + /** + * Returns a new point object with the smallest x and y of the supplied points. + * @param point1 - + * @param point2 - + */ + static min(point1: Point, point2: Point): Point; + + /** + * Returns a new point object with the largest x and y of the supplied points. + * @param point1 - + * @param point2 - + */ + static max(point1: Point, point2: Point): Point; + + /** + * Returns a point object with random x and y values between 0 and 1. + */ + static random(): Point; + + /** + * Creates a Point object with the given x and y coordinates. + * @param x - the x coordinate + * @param y - the y coordinate + */ + constructor(x: number, y: number); + + /** + * Creates a Point object using the numbers in the given array as coordinates. + * @param array - an array of numbers to use as coordinates + */ + constructor(values: number[]); + + /** + * Creates a Point object using the properties in the given object. + * @param object - the object describing the point's properties + */ + constructor(object: any); + + /** + * Creates a Point object using the width and height values of the given Size object. + * @param size - the size width and height to use + */ + constructor(size: Size); + + /** + * Creates a Point object using the coordinates of the given Point object. + * @param point - the point to copy + */ + constructor(point: Point); + + /** + * The x coordinate of the point + */ + x: number; + + /** + * The y coordinate of the point + */ + y: number; + + /** + * The length of the vector that is represented by this point's coordinates. + * Each point can be interpreted as a vector that points from the origin (x = 0, y = 0) to the point's location. + * Setting the length changes the location but keeps the vector's angle. + */ + length: number; + + /** + * The vector's angle in degrees, measured from the x-axis to the vector. + */ + angle: number; + + /** + * The vector's angle in radians, measured from the x-axis to the vector. + */ + angleInRadians: number; + + /** + * The quadrant of the angle of the point. + * Angles between 0 and 90 degrees are in quadrant 1. Angles between 90 and 180 degrees are in quadrant 2, angles between 180 and 270 degrees are in quadrant 3 and angles between 270 and 360 degrees are in quadrant 4. + * Read only. + */ + quadrant: number; + + /** + * This property is only present if the point is an anchor or control point of a Segment or a Curve. In this case, it returns true it is selected, false otherwise + */ + selected: boolean; + + /** + * Checks whether the coordinates of the point are equal to that of the supplied point. + * @param point - the point to check against + */ + equals(point: Point): boolean; + + /** + * Returns a copy of the point. + */ + clone(): Point; + + /** + * a string representation of the point + */ + toString(): string; + + /** + * Returns the smaller angle between two vectors. The angle is unsigned, no information about rotational direction is given. + * @param point - + */ + getAngle(Point: Point): number; + + /** + * Returns the smaller angle between two vectors in radians. The angle is unsigned, no information about rotational direction is given. + * @param point: Point + */ + getAngleInRadians(point: Point): number; + + /** + * Returns the angle between two vectors. The angle is directional and signed, giving information about the rotational direction. + * Read more about angle units and orientation in the description of the angle property. + * @param point - + */ + getDirectedAngle(point: Point): number; + + /** + * Returns the distance between the point and another point. + * @param point - + * @param squared [optional] - Controls whether the distance should remain squared, or its square root should be calculated. default: false + */ + getDistance(point: Point, squared?: boolean): number; + + /** + * Normalize modifies the length of the vector to 1 without changing its angle and returns it as a new point. The optional length parameter defines the length to normalize to. + * The object itself is not modified! + * @param length [optional] - The length of the normalized vector, default: 1 + */ + normalize(length?: number): Point; + + /** + * Rotates the point by the given angle around an optional center point. + * The object itself is not modified. + * Read more about angle units and orientation in the description of the angle property. + * @param angle - the rotation angle + * @param center - the center point of the rotation + */ + rotate(angle: number, center: Point): Point; + + /** + * Transforms the point by the matrix as a new point. The object itself is not modified! + * @param matrix - + */ + transform(matrix: Matrix): Point; + + /** + * Checks whether the point is inside the boundaries of the rectangle. + * @param rect - the rectangle to check against + */ + isInside(rect: Rectangle): boolean; + + /** + * Checks if the point is within a given distance of another point. + * @param point - the point to check against + * @param tolerance - the maximum distance allowed + */ + isClose(point: Point, tolerance: number): boolean; + + /** + * Checks if the vector represented by this point is colinear (parallel) to another vector. + * @param point - the vector to check against + */ + isColinear(point: Point): boolean; + + /** + * Checks if the vector represented by this point is orthogonal (perpendicular) to another vector. + * @param point - the vector to check against + */ + isOrthogonal(point: Point): boolean; + + /** + * Checks if this point has both the x and y coordinate set to 0. + */ + isZero(): boolean; + + /** + * Checks if this point has an undefined value for at least one of its coordinates. + */ + isNan(): boolean; + + /** + * Returns the dot product of the point and another point. + * @param point - + */ + dot(point: Point): number; + + /** + * Returns the cross product of the point and another point. + * @param point - + */ + cross(point: Point): number; + + /** + * Returns the projection of the point on another point. + * Both points are interpreted as vectors. + * @param point - + */ + project(point: Point): Point; + + /** + * Returns a new point with rounded x and y values. The object itself is not modified! + */ + round(): Point; + + /** + * Returns a new point with the nearest greater non-fractional values to the specified x and y values. The object itself is not modified! + */ + ceil(): Point; + + /** + * Returns a new point with the nearest smaller non-fractional values to the specified x and y values. The object itself is not modified! + */ + floor(): Point; + + /** + * Returns a new point with the absolute values of the specified x and y values. The object itself is not modified! + */ + abs(): Point; + + } + /** + * A Rectangle specifies an area that is enclosed by it's top-left point (x, y), its width, and its height. It should not be confused with a rectangular path, it is not an item. + */ + export class Rectangle { + + /** + * Creates a Rectangle object. + * @param point - the top-left point of the rectangle + * @param size - the size of the rectangle + */ + constructor(point: Point, size: Size); + + /** + * Creates a rectangle object. + * @param x - the left coordinate + * @param y - the top coordinate + * @param width - the width + * @param height - the height + */ + constructor(x: number, y: number, width: number, height: number); + + /** + * Creates a Rectangle object. + * @param object - an object containing properties to be set on the rectangle. + */ + constructor(object: any); + + /** + * Creates a rectangle object from the passed points. These do not necessarily need to be the top left and bottom right corners, the constructor figures out how to fit a rectangle between them. + * @param from - The first point defining the rectangle + * @param to - The second point defining the rectangle + */ + constructor(from: Point, to: Point); + + /** + * Creates a new rectangle object from the passed rectangle object. + * @param rt - the rectangle to copy from + */ + constructor(rt: Rectangle); + + /** + * The x position of the rectangle. + */ + x: number; + + /** + * The y position of the rectangle. + */ + y: number; + + /** + * The width of the rectangle. + */ + width: number; + + /** + * The height of the rectangle. + */ + height: number; + + /** + * The top-left point of the rectangle + */ + point: Point; + + /** + * The size of the rectangle + */ + size: Size; + + /** + * The position of the left hand side of the rectangle. Note that this doesn't move the whole rectangle; the right hand side stays where it was. + */ + left: number; + + /** + * The top coordinate of the rectangle. Note that this doesn't move the whole rectangle: the bottom won't move. + */ + top: number; + + /** + * The position of the right hand side of the rectangle. Note that this doesn't move the whole rectangle; the left hand side stays where it was. + */ + right: number; + + /** + * The bottom coordinate of the rectangle. Note that this doesn't move the whole rectangle: the top won't move. + */ + bottom: number; + + /** + * The center point of the rectangle. + */ + center: Point; + + /** + * The top-left point of the rectangle. + */ + topLeft: Point; + + /** + * The top-right point of the rectangle. + */ + topRight: Point; + + /** + * The bottom-left point of the rectangle. + */ + bottomLeft: Point; + + /** + * The bottom-right point of the rectangle. + */ + bottomRight: Point; + + /** + * The left-center point of the rectangle. + */ + leftCenter: Point; + + /** + * The top-center point of the rectangle. + */ + topCenter: Point; + + /** + * The right-center point of the rectangle. + */ + rightCenter: Point; + + /** + * The bottom-center point of the rectangle. + */ + bottomCenter: Point; + + /** + * The area of the rectangle in square points. + * Read only. + */ + area: number; + + /** + * Specifies whether an item's bounds are selected and will also mark the item as selected. + * Paper.js draws the visual bounds of selected items on top of your project. This can be useful for debugging. + */ + selected: boolean; + + /** + * Returns a copy of the rectangle. + */ + clone(): Rectangle; + + /** + * Checks whether the coordinates and size of the rectangle are equal to that of the supplied rectangle. + * @param rect - the rectangle to check against + */ + equals(rect: Rectangle): boolean; + + /** + * a string representation of this rectangle + */ + toString(): string; + + /** + * Returns true if the rectangle is empty, false otherwise + */ + isEmpty(): boolean; + + /** + * Tests if the specified point is inside the boundary of the rectangle. + * @param point - the specified point + */ + contains(point: Point): boolean; + + /** + * Tests if the interior of the rectangle entirely contains the specified rectangle. + * @param rect - The specified rectangle + */ + contains(rect: Rectangle): boolean; + + /** + * Tests if the interior of this rectangle intersects the interior of another rectangle. Rectangles just touching each other are considered as non-intersecting. + * @param rect - the specified rectangle + */ + intersects(rect: Rectangle): boolean; + + /** + * Returns a new rectangle representing the intersection of this rectangle with the specified rectangle. + * @param rect - The rectangle to be intersected with this rectangle + */ + intersect(rect: Rectangle): Rectangle; + + /** + * Returns a new rectangle representing the union of this rectangle with the specified rectangle. + * @param rect - the rectangle to be combined with this rectangle + */ + unite(rect: Rectangle): Rectangle; + + /** + * Adds a point to this rectangle. The resulting rectangle is the smallest rectangle that contains both the original rectangle and the specified point. + * After adding a point, a call to contains(point) with the added point as an argument does not necessarily return true. + * The rectangle.contains(point) method does not return true for points on the right or bottom edges of a rectangle. Therefore, if the added point falls on the left or bottom edge of the enlarged rectangle, rectangle.contains(point) returns false for that point. + * @param point - the point to add to the rectangle + */ + include(point: Point): Point; + + /** + * Expands the rectangle by the specified amount in horizontal and vertical directions. + * @param amount - the amount to expand the rectangle in both directions + */ + expand(amount: number | Size | Point): void; + + /** + * Expands the rectangle by the specified amounts in horizontal and vertical directions. + * @param hor - the amount to expand the rectangle in horizontal direction + * @param ver - the amount to expand the rectangle in vertical direction + */ + expand(hor: number, ver: number): void; + + /** + * Scales the rectangle by the specified amount from its center. + * @param amount - the amount to scale by + */ + scale(amount: number): void; + + /** + * Scales the rectangle in horizontal direction by the specified hor amount and in vertical direction by the specified ver amount from its center. + * @param hor - the amount to scale the rectangle in horizontal direction + * @param ver - the amount to scale the rectangle in vertical direction + */ + scale(hor: number, ver: number): void; + + } + /** + * The Size object is used to describe the size or dimensions of something, through its width and height properties. + */ + export class Size { + + /** + * Returns a new size object with the smallest width and height of the supplied sizes. + * @param size1 - the first size + * @param size2 - the second size + */ + static min(size1: Size, size2: Size): Size; + + /** + * Returns a new size object with the largest width and height of the supplied sizes. + * @param size1 - the first size + * @param size2 - the second size + */ + static max(size1: Size, size2: Size): Size; + + /** + * Returns a size object with random width and height values between 0 and 1. + */ + static random(): Size; + + /** + * Creates a Size object with the given width and height values. + * @param width - the width + * @param height - the height + */ + constructor(width: number, height: number); + + /** + * Creates a Size object using the numbers in the given array as dimensions. + * @param array - an array of numbers + */ + constructor(array: number[]); + + /** + * Creates a Size object using the properties in the given object. + * @param object - the object literal containing properies (width:10, height:10 etc) + */ + constructor(object: any); + + /** + * Creates a Size object using the coordinates of the given Size object. + * @param size - the size to duplicate from + */ + constructor(size: Size); + + /** + * Creates a Size object using the point.x and point.y values of the given Point object. + * @param point - the point from which to create a size + */ + constructor(point: Point); + + /** + * The width of the size + */ + width: number; + + /** + * The height of the size + */ + height: number; + + /** + * WARNING - This seems undocumented/incorrect + */ + equals(): boolean; + + /** + * Returns a copy of the size. + */ + clone(): Size; + + /** + * a string representation of the size + */ + toString(): string; + + /** + * Checks if this size has both the width and height set to 0. + */ + isZero(): boolean; + + /** + * Checks if the width or the height of the size are NaN. + */ + isNan(): boolean; + + /** + * Returns a new size with rounded width and height values. The object itself is not modified! + */ + round(): Size; + + /** + * Returns a new size with the nearest greater non-fractional values to the specified width and height values. The object itself is not modified! + */ + ceil(): Size; + + /** + * Returns a new size with the nearest smaller non-fractional values to the specified width and height values. The object itself is not modified! + */ + floor(): Size; + + /** + * Returns a new size with the absolute values of the specified width and height values. The object itself is not modified! + */ + abs(): Size; + + } + export interface IFrameEvent { + + /** + * the number of times the frame event was fired. + */ + count: number; + + /** + * the total amount of time passed since the first + */ + time: number; + + /** + * + */ + delta: number; + + } + /** + * The PaperScope class represents the scope associated with a Paper context. When working with PaperScript, these scopes are automatically created for us, and through clever scoping the properties and methods of the active scope seem to become part of the global scope. + * When working with normal JavaScript code, PaperScope objects need to be manually created and handled. + * Paper classes can only be accessed through PaperScope objects. Thus in PaperScript they are global, while in JavaScript, they are available on the global paper object. For JavaScript you can use paperScope.install(scope) to install the Paper classes and objects on the global scope. Note that when working with more than one scope, this still works for classes, but not for objects like paperScope.project, since they are not updated in the injected scope if scopes are switched. + * The global paper object is simply a reference to the currently active PaperScope. + */ + export class PaperScope { + + /** + * The version of Paper.js, as a string. + */ + version: string; + + /** + * Gives access to paper's configurable settings. + */ + settings: { + + applyMatrix: boolean; + handleSize: number; + hitTolerance: number; + + }; + + /** + * The currently active project. + */ + project: Project; + + /** + * The list of all open projects within the current Paper.js context. + */ + projects: Project[]; + + /** + * The reference to the active project's view. + * Read Only. + */ + view: View; + + /** + * The reference to the active tool. + */ + tool: Tool; + + /** + * The list of available tools. + */ + tools: Tool[]; + + /** + * Injects the paper scope into any other given scope. Can be used for examle to inject the currently active PaperScope into the window's global scope, to emulate PaperScript-style globally accessible Paper classes and objects + * Please note: Using this method may override native constructors (e.g. Path, RGBColor). This may cause problems when using Paper.js in conjunction with other libraries that rely on these constructors. Keep the library scoped if you encounter issues caused by this. + * @param scope - + */ + install(scope: any): void; + + /** + * Sets up an empty project for us. If a canvas is provided, it also creates a View for it, both linked to this scope. + * @param element - the HTML canvas element this scope should be associated with, or an ID string by which to find the element. + */ + setup(canvas: HTMLCanvasElement | string): void; + + /** + * Activates this PaperScope, so all newly created items will be placed in its active project. + */ + activate(): void; + + /** + * Retrieves a PaperScope object with the given scope id. + * @param id - + */ + static get(id: string): PaperScope; + + } + /** + * The Item type allows you to access and modify the items in Paper.js projects. Its functionality is inherited by different project item types such as Path, CompoundPath, Group, Layer and Raster. They each add a layer of functionality that is unique to their type, but share the underlying properties and functions that they inherit from Item. + */ + export class Item { + + /** + * The tangential vector to the #curve at the given location. + */ + tangent: Point; + + /** + * The normal vector to the #curve at the given location. + */ + normal: Point; + + /** + * The curvature of the #curve at the given location. + */ + curvature: number; + + /** + * The unique id of the item. + * Read Only. + */ + id: number; + + /** + * The class name of the item as a string. + * String('Group', 'Layer', 'Path', 'CompoundPath', 'Shape', 'Raster', 'PlacedSymbol', 'PointText') + */ + className: string; + + /** + * The name of the item. If the item has a name, it can be accessed by name through its parent's children list. + */ + name: string; + + /** + * The path style of the item. + */ + style: Style; + + /** + * Specifies whether the item is visible. When set to false, the item won't be drawn. + */ + visible: boolean; + + /** + * The blend mode with which the item is composited onto the canvas. Both the standard canvas compositing modes, as well as the new CSS blend modes are supported. If blend-modes cannot be rendered natively, they are emulated. Be aware that emulation can have an impact on performance. + * String('normal', 'multiply', 'screen', 'overlay', 'soft-light', 'hard-light', 'color-dodge', 'color-burn', 'darken', 'lighten', 'difference', 'exclusion', 'hue', 'saturation', 'luminosity', 'color', 'add', 'subtract', 'average', 'pin-light', 'negation', 'source-over', 'source-in', 'source-out', 'source-atop', 'destination-over', 'destination-in', 'destination-out', 'destination-atop', 'lighter', 'darker', 'copy', 'xor') + */ + blendMode: string; + + /** + * The opacity of the item as a value between 0 and 1. + */ + opacity: number; + + /** + * Specifies whether the item is selected. This will also return true for Group items if they are partially selected, e.g. groups containing selected or partially selected paths. + * Paper.js draws the visual outlines of selected items on top of your project. This can be useful for debugging, as it allows you to see the construction of paths, position of path curves, individual segment points and bounding boxes of symbol and raster items. + */ + selected: boolean; + + /** + * Specifies whether the item defines a clip mask. This can only be set on paths, compound paths, and text frame objects, and only if the item is already contained within a clipping group. + */ + clipMask: boolean; + + /** + * A plain javascript object which can be used to store arbitrary data on the item. + */ + data: any; + + /** + * The item's position within the parent item's coordinate system. By default, this is the rectangle.center of the item's bounds rectangle. + */ + position: Point; + + /** + * The item's pivot point specified in the item coordinate system, defining the point around which all transformations are hinging. This is also the reference point for position. By default, it is set to null, meaning the rectangle.center of the item's bounds rectangle is used as pivot. + */ + pivot: Point; + + /** + * The bounding rectangle of the item excluding stroke width. + */ + bounds: Rectangle; + + /** + * The bounding rectangle of the item including stroke width. + */ + strokeBounds: Rectangle; + + /** + * The bounding rectangle of the item including handles. + */ + handleBounds: Rectangle; + + /** + * The current rotation angle of the item, as described by its matrix. + */ + rotation: number; + + /** + * The current scale factor of the item, as described by its matrix. + */ + scaling: Point; + + /** + * The item's transformation matrix, defining position and dimensions in relation to its parent item in which it is contained. + */ + matrix: Matrix; + + /** + * The item's global transformation matrix in relation to the global project coordinate space. Note that the view's transformations resulting from zooming and panning are not factored in. + * Read Only. + */ + globalMatrix: Matrix; + + /** + * Controls whether the transformations applied to the item (e.g. through transform(matrix), rotate(angle), scale(scale), etc.) are stored in its matrix property, or whether they are directly applied to its contents or children (passed on to the segments in Path items, the children of Group items, etc.). + */ + applyMatrix: boolean; + + /** + * The project that this item belongs to. + * Read only. + */ + project: Project; + + /** + * The view that this item belongs to. + * Read Only. + */ + view: View; + + /** + * The layer that this item is contained within. + * Read Only. + */ + layer: Layer; + + /** + * The item that this item is contained within. + */ + parent: Item; + + /** + * The children items contained within this item. Items that define a name can also be accessed by name. + * Please note: The children array should not be modified directly using array functions. To remove single items from the children list, use item.remove(), to remove all items from the children list, use item.removeChildren(). To add items to the children list, use item.addChild(item) or item.insertChild(index, item). + */ + children: Item[]; + + /** + * The first item contained within this item. This is a shortcut for accessing item.children[0]. + */ + firstChild: Item; + + /** + * The last item contained within this item.This is a shortcut for accessing item.children[item.children.length - 1]. + */ + lastChild: Item; + + /** + * The next item on the same level as this item. + * Read Only. + */ + nextSibling: Item; + + /** + * The previous item on the same level as this item. + * Read Only. + */ + previousSibling: Item; + + /** + * The index of this item within the list of its parent's children. + * Read only. + */ + index: number; + + /** + * The color of the stroke. + */ + strokeColor: Color | string; + + /** + * The width of the stroke. + */ + strokeWidth: number; + + /** + * The shape to be used at the beginning and end of open Path items, when they have a stroke. + * String('round', 'square', 'butt') + */ + strokeCap: string; + + /** + * The shape to be used at the segments and corners of Path items when they have a stroke. + * String('miter', 'round', 'bevel') + */ + strokeJoin: string; + + /** + * The dash offset of the stroke. + */ + dashOffset: number; + + /** + * Specifies whether the stroke is to be drawn taking the current affine transformation into account (the default behavior), or whether it should appear as a non-scaling stroke. + */ + strokeScaling: boolean; + + /** + * Specifies an array containing the dash and gap lengths of the stroke. + */ + dashArray: number[]; + + /** + * When two line segments meet at a sharp angle and miter joins have been specified for item.strokeJoin, it is possible for the miter to extend far beyond the item.strokeWidth of the path. The miterLimit imposes a limit on the ratio of the miter length to the item.strokeWidth. + */ + miterLimit: number; + + /** + * The winding-rule with which the shape gets filled. Please note that only modern browsers support winding-rules other than 'nonzero'. + * String('nonzero', 'evenodd') + */ + windingRule: string; + + /** + * The fill color of the item. + */ + fillColor: Color | string; + + /** + * The color the item is highlighted with when selected. If the item does not specify its own color, the color defined by its layer is used instead. + */ + selectedColor: Color | string; + + /** + * Item level handler function to be called on each frame of an animation. + * The function receives an event object which contains information about the frame event: + */ + onFrame: (event: IFrameEvent) => void; + + /** + * The function to be called when the mouse button is pushed down on the item. The function receives a MouseEvent object which contains information about the mouse event. + */ + onMouseDown: (event: MouseEvent) => void; + + /** + * The function to be called when the mouse button is released over the item. + * The function receives a MouseEvent object which contains information about the mouse event. + */ + onMouseUp: (event: MouseEvent) => void; + + /** + * The function to be called when the mouse clicks on the item. The function receives a MouseEvent object which contains information about the mouse event. + */ + onClick: (event: MouseEvent) => void; + + /** + * The function to be called when the mouse double clicks on the item. The function receives a MouseEvent object which contains information about the mouse event. + */ + onDoubleClick: (event: MouseEvent) => void; + + /** + * The function to be called repeatedly when the mouse moves on top of the item. The function receives a MouseEvent object which contains information about the mouse event. + */ + onMouseMove: (event: MouseEvent) => void; + + /** + * The function to be called when the mouse moves over the item. This function will only be called again, once the mouse moved outside of the item first. The function receives a MouseEvent object which contains information about the mouse event. + */ + onMouseEnter: (event: MouseEvent) => void; + + /** + * The function to be called when the mouse moves out of the item. + * The function receives a MouseEvent object which contains information about the mouse event. + */ + onMouseLeave: (event: MouseEvent) => void; + + /** + * Sets those properties of the passed object literal on this item to the values defined in the object literal, if the item has property of the given name (or a setter defined for it). + */ + set(props: any): Item; + + /** + * Clones the item within the same project and places the copy above the item. + * @param insert [optional] - specifies whether the copy should be inserted into the DOM. When set to true, it is inserted above the original. default: true + */ + clone(insert?: boolean): Item; + + /** + * When passed a project, copies the item to the project, or duplicates it within the same project. When passed an item, copies the item into the specified item. + * @param item - the item or project to copy the item to + */ + copyTo(item: Item): Item; + + /** + * Rasterizes the item into a newly created Raster object. The item itself is not removed after rasterization. + * @param resolution [optional] - the resolution of the raster in pixels per inch (DPI). If not specified, the value of view.resolution is used. default: view.resolution + */ + rasterize(resolution: number): Raster; + + /** + * Checks whether the item's geometry contains the given point. + * @param point - The point to check for. + */ + contains(point: Point): boolean; + + /** + * + * @param rect - the rectangle to check against + */ + isInside(rect: Rectangle): boolean; + + /** + * + * @param item - the item to check against + */ + intersects(item: Item): boolean; + + /** + * Perform a hit-test on the items contained within the project at the location of the specified point. + * The options object allows you to control the specifics of the hit-test and may contain a combination of the following values: + * @param point - the point where the hit-test should be performed + * @param options.tolerance -the tolerance of the hit-test in points. Can also be controlled through paperScope.settings.hitTolerance + * @param options.class - only hit-test again a certain item class and its sub-classes: Group, Layer, Path, CompoundPath, Shape, Raster, PlacedSymbol, PointText, etc. + * @param options.fill - hit-test the fill of items. + * @param options.stroke - hit-test the stroke of path items, taking into account the setting of stroke color and width. + * @param options.segments - hit-test for segment.point of Path items. + * @param options.curves - hit-test the curves of path items, without taking the stroke color or width into account. + * @param options.handles - hit-test for the handles. (segment.handleIn / segment.handleOut) of path segments. + * @param options.ends - only hit-test for the first or last segment points of open path items. + * @param options.bounds - hit-test the corners and side-centers of the bounding rectangle of items (item.bounds). + * @param options.center - hit-test the rectangle.center of the bounding rectangle of items (item.bounds). + * @param options.guides - hit-test items that have Item#guide set to true. + * @param options.selected - only hit selected items. + */ + hitTest(point: Point, options?: { tolerance?: number; class?: string; fill?: boolean; stroke?: boolean; segments?: boolean; curves?: boolean; handles?: boolean; ends?: boolean; bounds?: boolean; center?: boolean; guides?: boolean; selected?: boolean; }): HitResult; + + /** + * Checks whether the item matches the criteria described by the given object, by iterating over all of its properties and matching against their values through matches(name, compare). + * See project.getItems(match) for a selection of illustrated examples. + * @param match - the criteria to match against. + */ + matches(match: any): boolean; + + /** + * Checks whether the item matches the given criteria. Extended matching is possible by providing a compare function or a regular expression. + * Matching points, colors only work as a comparison of the full object, not partial matching (e.g. only providing the x-coordinate to match all points with that x-value). Partial matching does work for item.data. + * @param name - the name of the state to match against. + * @param compare - the value, function or regular expression to compare against. + */ + matches(name: string, compare: any): boolean; + + /** + * Fetch the descendants (children or children of children) of this item that match the properties in the specified object. + * Extended matching is possible by providing a compare function or regular expression. Matching points, colors only work as a comparison of the full object, not partial matching (e.g. only providing the x- coordinate to match all points with that x-value). Partial matching does work for item.data. + * Matching items against a rectangular area is also possible, by setting either match.inside or match.overlapping to a rectangle describing the area in which the items either have to be fully or partly contained. + * @param match.inside - the rectangle in which the items need to be fully contained. + * @param match.overlapping - the rectangle with which the items need to at least partly overlap. + */ + getItems(match: any): Item[]; + + /** + * Fetch the first descendant (child or child of child) of this item that matches the properties in the specified object. + * Extended matching is possible by providing a compare function or regular expression. Matching points, colors only work as a comparison of the full object, not partial matching (e.g. only providing the x- coordinate to match all points with that x-value). Partial matching does work for item.data. + * @param match - the criteria to match against + */ + getItem(match: any): Item; + + /** + * Exports (serializes) the project with all its layers and child items to a JSON data string. + * @param options [optional] - default {asString: true, precision: 5} + * @param options.asString - whether the JSON is returned as a Object or a String. + * @param options.precision - the amount of fractional digits in numbers used in JSON data. + */ + exportJSON(options?: { asString?: boolean; precision?: number }): string; + + /** + * Imports (deserializes) the stored JSON data into the project. + * Note that the project is not cleared first. You can call project.clear() to do so. + */ + importJSON(json: string): void; + + /** + * Exports the project with all its layers and child items as an SVG DOM, all contained in one top level SVG group node. + * @param options [optional] the export options, default: { asString: false, precision: 5, matchShapes: false } + * @param options.asString - whether a SVG node or a String is to be returned. + * @param options.precision - the amount of fractional digits in numbers used in SVG data. + * @param options.matchShapes - whether path items should tried to be converted to shape items, if their geometries can be made to match + */ + exportSVG(options?: { asString?: boolean; precision?: number; matchShapes?: boolean }): SVGElement; + + /** + * Converts the provided SVG content into Paper.js items and adds them to the active layer of this project. + * Note that the project is not cleared first. You can call project.clear() to do so. + * @param svg - the SVG content to import + * @param options [optional] - the import options, default: { expandShapes: false } + * @param options.expandShapes - whether imported shape items should be expanded to path items. + */ + importSVG(svg: SVGElement | string, options?: any): Item; + + /** + * Adds the specified item as a child of this item at the end of the its children list. You can use this function for groups, compound paths and layers. + * @param item - the item to add as a child + */ + addChild(item: Item): Item; + + /** + * Inserts the specified item as a child of this item at the specified index in its children list. You can use this function for groups, compound paths and layers. + * @param index - the index + * @param item - the item to be inserted as a child + */ + insertChild(index: number, item: Item): Item; + + /** + * Adds the specified items as children of this item at the end of the its children list. You can use this function for groups, compound paths and layers. + * @param items - The items to be added as children + */ + addChildren(items: Item[]): Item[]; + + /** + * Inserts the specified items as children of this item at the specified index in its children list. You can use this function for groups, compound paths and layers. + * @param index - + * @param items - The items to be appended as children + */ + insertChildren(index: number, items: Item[]): Item[]; + + /** + * Inserts this item above the specified item. + * @param item - the item above which it should be inserted + */ + insertAbove(item: Item): Item; + + /** + * Inserts this item below the specified item. + * @param item - the item below which it should be inserted + */ + insertBelow(item: Item): Item; + + /** + * Sends this item to the back of all other items within the same parent. + */ + sendToBack(): void; + + /** + * Brings this item to the front of all other items within the same parent. + */ + bringToFront(): void; + + /** + * If this is a group, layer or compound-path with only one child-item, the child-item is moved outside and the parent is erased. Otherwise, the item itself is returned unmodified. + */ + reduce(): Item; + + /** + * Removes the item and all its children from the project. The item is not destroyed and can be inserted again after removal. + */ + remove(): boolean; + + /** + * Replaces this item with the provided new item which will takes its place in the project hierarchy instead. + * @param item - the item to replace this one with + */ + replaceWith(item: Item): boolean; + + /** + * Removes all of the item's children (if any). + */ + removeChildren(): Item[]; + + /** + * Removes the children from the specified from index to the to index from the parent's children array. + * @param from - the beginning index, inclusive + * @param to [optional] - the ending index, exclusive, default: children.length + */ + removeChildren(from: number, to?: number): Item[]; + + /** + * Reverses the order of the item's children + */ + reverseChildren(): void; + + /** + * Specifies whether the item has any content or not. The meaning of what content is differs from type to type. For example, a Group with no children, a TextItem with no text content and a Path with no segments all are considered empty. + */ + isEmpty(): boolean; + + /** + * Checks whether the item has a fill. + */ + hasFill(): boolean; + + /** + * Checks whether the item has a stroke. + */ + hasStroke(): boolean; + + /** + * Checks whether the item has a shadow. + */ + hasShadow(): boolean; + + /** + * Checks if the item contains any children items. + */ + hasChildren(): boolean; + + /** + * Checks whether the item and all its parents are inserted into the DOM or not. + */ + isInserted(): boolean; + + /** + * Checks if this item is above the specified item in the stacking order of the project. + * @param item - The item to check against + */ + isAbove(item: Item): boolean; + + /** + * Checks if the item is below the specified item in the stacking order of the project. + * @param item - The item to check against + */ + isBelow(item: Item): boolean; + + /** + * Checks whether the specified item is the parent of the item. + * @param item - The item to check against + */ + isParent(item: Item): boolean; + + /** + * Checks whether the specified item is a child of the item. + * @param item - The item to check against + */ + isChild(item: Item): boolean; + + /** + * Checks if the item is contained within the specified item. + * @param item - The item to check against + */ + isDescendant(item: Item): boolean; + + /** + * Checks if the item is an ancestor of the specified item. + * @param item - the item to check against + */ + isAncestor(item: Item): boolean; + + /** + * Checks whether the item is grouped with the specified item. + * @param item - + */ + isGroupedWith(item: Item): boolean; + + /** + * Translates (moves) the item by the given offset point. + * @param delta - the offset to translate the item by + */ + translate(delta: number): Point; + + /** + * Rotates the item by a given angle around the given point. + * Angles are oriented clockwise and measured in degrees. + * @param angle - the rotation angle + * @param center [optional] - default: item.position + */ + rotate(angle: number, center?: Point): void; + + /** + * Scales the item by the given value from its center point, or optionally from a supplied point. + * @param scale - the scale factor + * @param center [optional] - default: item.position + */ + scale(scale: number, center?: Point): void; + + /** + * Scales the item by the given values from its center point, or optionally from a supplied point. + * @param hor - the horizontal scale factor + * @param ver - the vertical scale factor + * @param center [optional] - default: item.position + */ + scale(hor: number, ver: number, center?: Point): void; + + /** + * Shears the item by the given value from its center point, or optionally by a supplied point. + * @param shear - the horziontal and vertical shear factors as a point + * @param center [optional] - default: item.position + */ + shear(shear: number, center?: Point): void; + + /** + * Shears the item by the given values from its center point, or optionally by a supplied point. + * @param hor - the horizontal shear factor + * @param ver - the vertical shear factor + * @param center [optional] - default: item.position + */ + shear(hor: number, ver: number, center?: Point): void; + + /** + * Skews the item by the given angles from its center point, or optionally by a supplied point. + * @param skew - the horziontal and vertical skew angles in degrees + * @param center [optional] - default: item.position + */ + skew(skew: Point, center?: Point): void; + + /** + * Skews the item by the given angles from its center point, or optionally by a supplied point. + * @param hor - the horizontal skew angle in degrees + * @param ver - the vertical sskew angle in degrees + * @param center [optional] - default: item.position + */ + skew(hor: number, ver: number, center?: Point): void; + + /** + * Transform the item. + * @param matrix - the matrix by which the item shall be transformed. + */ + transform(matrix: Matrix): void; + + /** + * Converts the specified point from global project coordinate space to the item's own local coordinate space. + * @param point - the point to be transformed + */ + globalToLocal(point: Point): Point; + + /** + * Converts the specified point from the item's own local coordinate space to the global project coordinate space. + * @param point - the point to be transformed + */ + localToGlobal(point: Point): Point; + + /** + * Converts the specified point from the parent's coordinate space to item's own local coordinate space. + * @param point - the point to be transformed + */ + parentToLocal(point: Point): Point; + + /** + * Converts the specified point from the item's own local coordinate space to the parent's coordinate space. + * @param point - the point to be transformed + */ + localToParent(point: Point): Point; + + /** + * Transform the item so that its bounds fit within the specified rectangle, without changing its aspect ratio. + * @param rectangle - + * @param fill [optiona;] - default = false + */ + fitBounds(rectangle: Rectangle, fill?: boolean): void; + + //I cannot use function: Function as it is a reserved keyword + + /** + * Attach an event handler to the tool. + * @param type - String('mousedown'|'mouseup'|'mousedrag'|'mousemove'|'keydown'|'keyup') the event type + * @param function - The function to be called when the event occurs + */ + on(type: string, callback: (event: ToolEvent) => void): Tool; + + /** + * Attach one or more event handlers to the tool. + * @param param - an object literal containing one or more of the following properties: mousedown, mouseup, mousedrag, mousemove, keydown, keyup + */ + on(param: any): Tool; + + /** + * Detach an event handler from the tool. + * @param type - String('mousedown'|'mouseup'|'mousedrag'|'mousemove'|'keydown'|'keyup') the event type + * @param function - The function to be detached + */ + off(type: string, callback: (event: ToolEvent) => void): Tool; + + /** + * Detach one or more event handlers from the tool. + * @param param - an object literal containing one or more of the following properties: mousedown, mouseup, mousedrag, mousemove, keydown, keyup + */ + off(param: any): Tool; + + /** + * Emit an event on the tool. + * @param type - String('mousedown'|'mouseup'|'mousedrag'|'mousemove'|'keydown'|'keyup') the event type + * @param event - an object literal containing properties describing the event. + */ + emit(type: string, event: any): boolean; + + /** + * Check if the tool has one or more event handlers of the specified type. + * @param type - String('mousedown'|'mouseup'|'mousedrag'|'mousemove'|'keydown'|'keyup') the event type + */ + responds(type: string): boolean;//I cannot use function: Function as it is a reserved keyword + + /** + * Attaches an event handler to the item. + * @param type - String('mousedown'|'mouseup'|'mousedrag'|'mousemove'|'keydown'|'keyup') the event type + * @param function - The function to be called when the event occurs + */ + on(type: string, callback: () => void): Item; + + /** + * Attaches one or more event handlers to the item. + * @param param - an object literal containing one or more of the following properties: mousedown, mouseup, mousedrag, mousemove, keydown, keyup + */ + on(param: any): Item; + + /** + * Detach an event handler from the item. + * @param type - String('mousedown'|'mouseup'|'mousedrag'|'mousemove'|'keydown'|'keyup') the event type + * @param function - The function to be detached + */ + off(type: string, callback: (event: ToolEvent) => void): Item; + + /** + * Detach one or more event handlers to the item. + * @param param - an object literal containing one or more of the following properties: mousedown, mouseup, mousedrag, mousemove, keydown, keyup + */ + off(param: any): Item; + + /** + * Emit an event on the item. + * @param type - String('mousedown'|'mouseup'|'mousedrag'|'mousemove'|'keydown'|'keyup') the event type + * @param event - an object literal containing properties describing the event. + */ + emit(type: string, event: any): boolean; + + /** + * Check if the item has one or more event handlers of the specified type.. + * @param type - String('mousedown'|'mouseup'|'mousedrag'|'mousemove'|'keydown'|'keyup') the event type + */ + responds(type: string): boolean; + + /** + * Removes the item when the events specified in the passed object literal occur. + * @param object - The object literal can contain the following values + * @param object.move - Remove the item when the next tool.onMouseMove event is fired + * @param object.drag - Remove the item when the next tool.onMouseDrag event is fired + * @param object.down - Remove the item when the next tool.onMouseDown event is fired + * @param object.up - Remove the item when the next tool.onMouseUp event is fired + */ + removeOn(object: { move?: boolean; drag?: boolean; down?: boolean; up?: boolean; }): void; + + /** + * Removes the item when the next tool.onMouseMove event is fired. + */ + removeOnMove(): void; + + /** + * Removes the item when the next tool.onMouseDown event is fired. + */ + removeOnDown(): void; + + /** + * Removes the item when the next tool.onMouseDrag event is fired. + */ + removeOnDrag(): void; + + /** + * Removes the item when the next tool.onMouseUp event is fired. + */ + removeOnUp(): void; + + } + /** + * A Group is a collection of items. When you transform a Group, its children are treated as a single unit without changing their relative positions. + */ + export class Group extends Item { + + /** + * Creates a new Group item and places it at the top of the active layer. + * @param children [optional] - An array of Item Objects children that will be added to the newly created group. + */ + constructor(children?: Item[]); + + /** + * Creates a new Group item and places it at the top of the active layer. + * @param object [optional] - an object literal containing the properties to be set on the group. + */ + constructor(object?: any); + + /** + * Specifies whether the group item is to be clipped. + * When setting to true, the first child in the group is automatically defined as the clipping mask. + */ + clipped: boolean; + + } + /** + * The Layer item represents a layer in a Paper.js project. + * The layer which is currently active can be accessed through project.activeLayer. + * An array of all layers in a project can be accessed through project.layers. + */ + export class Layer extends Group { + + /** + * Creates a new Layer item and places it at the end of the project.layers array. The newly created layer will be activated, so all newly created items will be placed within it. + * @param children [optional] - An array of Items that will be added to the newly created layer. + */ + constructor(children?: Item[]); + /** + * Creates a new Layer item and places it at the end of the project.layers array. The newly created layer will be activated, so all newly created items will be placed within it. + * @param object [optional] - an object literal containing the properties to be set on the layer. + */ + constructor(object?: any); + + /** + * Activates the layer. + */ + activate(): void; + + } + export class Shape extends Item { + + /** + * Creates a circular shape item. + * @param center - the center point of the circle + * @param radius - the radius of the circle + */ + static Circle(center: Point, radius: number): Shape; + + /** + * Creates a circular shape item from the properties described by an object literal. + * @param object - an object literal containing properties descriving the shapes attributes + */ + static Circle(object: any): Shape; + + /** + * Creates a rectangular shape item, with optionally rounded corners. + * @param rectangle - the rectangle object describing the geometry of the rectangular shape to be created. + * @param radius [optional] - the size of the rounded corners, default: null + */ + static Rectangle(rectangle: Rectangle, radius?: number): Shape; + + /** + * Creates a rectangular shape item from a point and a size object. + * @param point - the rectangle's top-left corner + * @param size - the rectangle's size. + */ + static Rectangle(point: Point, size: Size): Shape; + + /** + * Creates a rectangular shape item from the passed points. These do not necessarily need to be the top left and bottom right corners, the constructor figures out how to fit a rectangle between them. + * @param from - the first point defining the rectangle + * @param to - the second point defining the rectangle + */ + static Rectangle(from: Point, to: Point): Shape; + + /** + * Creates a rectangular shape item from the properties described by an object literal. + * @param object - an object literal containing properties describing the shape's attributes + */ + static Rectangle(object: any): Shape; + + /** + * Creates an elliptical shape item. + * @param rectangle - the rectangle circumscribing the ellipse + */ + static Ellipse(rectangle: Rectangle): Shape; + + /** + * Creates an elliptical shape item from the properties described by an object literal. + * @param object - an object literal containing properties describing the shape's attributes + */ + static Ellipse(object: any): Shape; + + /** + * The type of shape of the item as a string. + */ + type: string; + + /** + * The size of the shape. + */ + size: Size; + + /** + * The radius of the shape, as a number if it is a circle, or a size object for ellipses and rounded rectangles. + */ + radius: number | Size; + + } + /** + * The Raster item represents an image in a Paper.js project. + */ + export class Raster extends Item { + + /** + * Creates a new raster item from the passed argument, and places it in the active layer. object can either be a DOM Image, a Canvas, or a string describing the URL to load the image from, or the ID of a DOM element to get the image from (either a DOM Image or a Canvas). + * @param source [optional] - the source of the raster + * @param position [optional] - the center position at which the raster item is placed + */ + constructor(source?: HTMLImageElement | HTMLCanvasElement | string, position?: Point); + + /** + * The size of the raster in pixels. + */ + size: Size; + + /** + * The width of the raster in pixels. + */ + width: number; + + /** + * The height of the raster in pixels. + */ + height: number; + + /** + * The resolution of the raster at its current size, in PPI (pixels per inch). + * Read Only. + */ + resolution: Size; + + /** + * The HTMLImageElement of the raster, if one is associated. + */ + image: HTMLImageElement | HTMLCanvasElement; + + /** + * The Canvas object of the raster. If the raster was created from an image, accessing its canvas causes the raster to try and create one and draw the image into it. Depending on security policies, this might fail, in which case null is returned instead. + */ + canvas: HTMLCanvasElement; + + /** + * The Canvas 2D drawing context of the raster. + */ + context: CanvasRenderingContext2D; + + /** + * The source of the raster, which can be set using a DOM Image, a Canvas, a data url, a string describing the URL to load the image from, or the ID of a DOM element to get the image from (either a DOM Image or a Canvas). Reading this property will return the url of the source image or a data-url. + */ + source: HTMLImageElement | HTMLCanvasElement | string; + + /** + * Extracts a part of the Raster's content as a sub image, and returns it as a Canvas object. + * @param rect - the boundaries of the sub image in pixel coordinates + */ + getSubCanvas(rect: Rectangle): HTMLCanvasElement; + + /** + * Extracts a part of the raster item's content as a new raster item, placed in exactly the same place as the original content. + * @param rect - the boundaries of the sub raster in pixel coordinates + */ + getSubRaster(rect: Rectangle): Raster; + + /** + * Returns a Base 64 encoded data: URL representation of the raster. + */ + toDataURL(): string; + + /** + * Draws an image on the raster. + * @param image - the image to draw + * @param point - the offset of the image as a point in pixel coordinates + */ + drawImage(image: HTMLImageElement | HTMLCanvasElement, point: Point): void; + + /** + * Calculates the average color of the image within the given path, rectangle or point. This can be used for creating raster image effects. + * @param object - the path, rectangle or point to get the average image color from + */ + getAverageColor(object: Path | Rectangle | Point): Color; + + /** + * Gets the color of a pixel in the raster. + * @param x - the x offset of the pixel in pixel coordinates + * @param y - the y offset of the pixel in pixel coordinates + */ + getPixel(x: number, y: number): Color; + + /** + * Gets the color of a pixel in the raster. + * @param point - the offset of the pixel as a point in pixel coordinates + */ + getPixel(point: Point): Color; + + /** + * Sets the color of the specified pixel to the specified color + * @param x - the x offset of the pixel in pixel coordinates + * @param y - the y offset of the pixel in pixel coordinates + * @param color - the color that the pixel will be set to + */ + setPixel(x: number, y: number, color: Color): void; + + /** + * Sets the color of the specified pixel to the specified color. + * @param point - the offset of the pixel as a point in pixel coordinates + * @param color - the color that the pixel will be set to + */ + setPixel(point: Point, color: Color): void; + + /** + * + * @param size + */ + createImageData(size: Size): ImageData; + + /** + * + * @param rect + */ + getImageData(rect: Rectangle): ImageData; + + /** + * + * + * @param data + * @param point + */ + getImageData(data: ImageData, point: Point): void; + + } + /** + * A PlacedSymbol represents an instance of a symbol which has been placed in a Paper.js project. + */ + export class PlacedSymbol extends Item { + + /** + * Creates a new PlacedSymbol Item. + * @param symbol - the symbol to place + * @param point [optional] - the center point of the placed symbol + */ + constructor(symbol: Symbol, point?: Point); + + /** + * The symbol that the placed symbol refers to. + */ + symbol: Symbol; + + } + /** + * A HitResult object contains information about the results of a hit test. It is returned by item.hitTest(point) and project.hitTest(point). + */ + export class HitResult { + + /** + * Describes the type of the hit result. For example, if you hit a segment point, the type would be 'segment'. + * type String('segment', 'handle-in', 'handle-out', 'curve', 'stroke', 'fill', 'bounds', 'center', 'pixel') + */ + type: string; + + /** + * If the HitResult has a hitResult.type of 'bounds', this property describes which corner of the bounding rectangle was hit. + * type String('top-left', 'top-right', 'bottom-left', 'bottom-right', 'left-center', 'top-center', 'right-center', 'bottom-center') + */ + name: string; + + /** + * The item that was hit. + */ + item: Item; + + /** + * If the HitResult has a type of 'curve' or 'stroke', this property gives more information about the exact position that was hit on the path. + */ + location: CurveLocation; + + /** + * If the HitResult has a type of 'pixel', this property refers to the color of the pixel on the Raster that was hit. + */ + color: Color; + + /** + * If the HitResult has a type of 'stroke', 'segment', 'handle-in' or 'handle-out', this property refers to the segment that was hit or that is closest to the hitResult.location on the curve. + */ + segment: Segment; + + /** + * Describes the actual coordinates of the segment, handle or bounding box corner that was hit + */ + point: Point; + + } + /** + * The PathItem class is the base for any items that describe paths and offer standardised methods for drawing and path manipulation, such as Path and CompoundPath. + */ + export class PathItem extends Item { + + /** + * The path's geometry, formatted as SVG style path data. + */ + pathData: string; + + /** + * Returns all intersections between two PathItem items as an array of CurveLocation objects. CompoundPath items are also supported. + * @param path - the other item to find the intersections with + * @param sorted [optional] - specifies whether the returned CurveLocation objects should be sorted by path and offset, default: false + */ + getIntersections(path: PathItem, sorted?: boolean): CurveLocation[]; + + /** + * Smooth bezier curves without changing the amount of segments or their points, by only smoothing and adjusting their handle points, for both open ended and closed paths. + */ + smooth(): void; + + /** + * On a normal empty Path, the point is simply added as the path's first segment. If called on a CompoundPath, a new Path is created as a child and the point is added as its first segment. + * @param point - the path's first segment + */ + moveTo(point: Point): void; + + /** + * Draw a line from the current point to the given point + * @param point - the end point of the line + */ + lineTo(point: Point): void; + + /** + * Adds a cubic bezier curve to the path, defined by two handles and a to point. + * @param handle1 - The first control point handle for the curve + * @param handle2 - The second control point handle for the curve + * @param to - The end control point of the curve + */ + cublicCurveTo(handle1: Point, handle2: Point, to: Point): void; + + /** + * Adds a quadratic bezier curve to the path, defined by a handle and a to point. + * @param handle - The control point for the curve + * @param to - The end control point of the curve + */ + quadraticCurveTo(handle: Point, to: Point): void; + + /** + * Draws a curve from the position of the last segment point in the path that goes through the specified through point, to the specified to point by adding one segment to the path. + * @param through - the point through which the curve should go + * @param to - the point where the curve should end + * @param parameter [optional] - default: 0.5 + */ + curveTo(through: Point, to: Point, parameter?: number): void; + + /** + * Draws an arc from the position of the last segment point in the path that goes through the specified through point, to the specified to point by adding one or more segments to the path. + * @param through - the point where the arc should pass through + * @param to - the point where the arc should end + */ + arcTo(through: Point, to: Point): void; + + /** + * Draws an arc from the position of the last segment point in the path to the specified point by adding one or more segments to the path. + * @param to - the point where the arc should end + * @param closewise [optional] - specifies whether the arc should be drawn in clockwise direction. optional, default: true + */ + arcTo(to: Point, clockwise?: boolean): void; + + /** + * Closes the path. When closed, Paper.js connects the first and last segment of the path with an additional curve. + * @param join - controls whether the method should attempt to merge the first segment with the last if they lie in the same location. + */ + closePath(join: boolean): void; + + /** + * If called on a CompoundPath, a new Path is created as a child and a point is added as its first segment relative to the position of the last segment of the current path. + * @param to - + */ + moveBy(to: Point): void; + + /** + * Adds a segment relative to the last segment point of the path. + * @param to - the vector which is added to the position of the last segment of the path, to get to the position of the new segment. + */ + lineBy(to: Point): void; + + /** + * + * @param through - + * @param to - + * @param parameter [optional] - default 0.5 + */ + curveBy(through: Point, to: Point, parameter?: number): void; + + /** + * + * @param handle1 - + * @param handle2 - + * @param to - + */ + cublicCurveBy(handle1: Point, handle2: Point, to: Point): void; + + /** + * + * @param handle - + * @param to - + */ + quadraticCurveBy(handle: Point, to: Point): void; + + /** + * + * @param through - + * @param to - + */ + arcBy(through: Point, to: Point): void; + + /** + * + * @param to - + * @param clockwise [optional] - default: true + */ + arcBy(to: Point, clockwise?: boolean): void; + + /** + * Merges the geometry of the specified path from this path's geometry and returns the result as a new path item. + * @param path - the path to unite with + */ + unite(path: PathItem): PathItem; + + /** + * Intersects the geometry of the specified path with this path's geometry and returns the result as a new path item. + * @param path - the path to intersect with + */ + intersect(path: PathItem): PathItem; + + /** + * Subtracts the geometry of the specified path from this path's geometry and returns the result as a new path item. + * @param - the path to subtract + */ + subtract(path: PathItem): PathItem; + + /** + * Excludes the intersection of the geometry of the specified path with this path's geometry and returns the result as a new group item. + * @param - the path to exclude the intersection of + */ + exclude(path: PathItem): PathItem; + + /** + * Splits the geometry of this path along the geometry of the specified path returns the result as a new group item. + * @param - the path to divide by + */ + divide(path: PathItem): PathItem; + + } + /** + * The path item represents a path in a Paper.js project. + */ + export class Path extends PathItem { + + /** + * Creates a linear path item from two points describing a line. + * @param from - the line's starting point + * @param to - the line's ending point + */ + static Line(from: Point, to: Point): Path; + + /** + * Creates a linear path item from the properties described by an object literal. + * @param object - an object literal containing properties describing the path's attributes + */ + static Line(object: any): Path; + + /** + * Creates a circular path item. + * @param center - the center point of the circle + * @param radius - the radius of the circle + */ + static Circle(center: Point, radius: number): Path; + + /** + * Creates a circular path item from the properties described by an object literal. + * @param object - an object literal containing properties describing the path's attributes + */ + static Circle(object: any): Path; + + /** + * Creates a rectangular path item, with optionally rounded corners. + * @param rectangle - the rectangle object describing the geometry of the rectangular path to be created. + * @param radius [optional] - the size of the rounded corners default: null + */ + static Rectangle(rectangle: Rectangle, radius?: number): Path; + + /** + * Creates a rectangular path item from a point and a size object. + * @param point - the rectangle's top-left corner. + * @param size - the rectangle's size. + */ + static Rectangle(point: Point, size: Size): Path; + + /** + * Creates a rectangular path item from the passed points. These do not necessarily need to be the top left and bottom right corners, the constructor figures out how to fit a rectangle between them. + * @param from - the first point defining the rectangle + * @param to - the second point defining the rectangle + */ + static Rectangle(from: Point, to: Point): Path; + + /** + * Creates a rectangular path item from the properties described by an object literal. + * @param object - an object literal containing properties describing the path's attributes + */ + static Rectangle(object: any): Path; + + /** + * Creates an elliptical path item. + * @param rectangle - the rectangle circumscribing the ellipse + */ + static Ellipse(rectangle: Rectangle): Path; + + /** + * Creates an elliptical path item from the properties described by an object literal. + * @param object - an object literal containing properties describing the path's attributes + */ + static Ellipse(object: any): Path; + /** + * Creates a circular arc path item + * @param from - the starting point of the circular arc + * @param through - the point the arc passes through + * @param to - the end point of the arc + */ + static Arc(from: Point, through: Point, to: Point): Path; + + /** + * Creates an circular arc path item from the properties described by an object literal. + * @param object - an object literal containing properties describing the path's attributes + */ + static Arc(object: any): Path; + + /** + * Creates a regular polygon shaped path item. + * @param center - the center point of the polygon + * @param sides - the number of sides of the polygon + * @param radius - the radius of the polygon + */ + static RegularPolygon(center: Point, sides: number, radius: number): Path; + + /** + * Creates a regular polygon shaped path item from the properties described by an object literal. + * @param object - an object literal containing properties describing the path's attributes + */ + static RegularPolygon(object: any): Path; + + /** + * Creates a star shaped path item. The largest of radius1 and radius2 will be the outer radius of the star. The smallest of radius1 and radius2 will be the inner radius. + * @param center - the center point of the star + * @param points - the number of points of the star + * @param radius1 + * @param radius2 + */ + static Star(center: Point, points: number, radius1: number, radius2: number): Path; + + /** + * Creates a star shaped path item from the properties described by an object literal. + * @param object - an object literal containing properties describing the path's attributes + */ + static Star(object: any): Path; + + /** + * Creates a new path item and places it at the top of the active layer. + * @param segments [optional] - An array of segments (or points to be converted to segments) that will be added to the path + */ + constructor(segments?: Segment[]| Point[]); + + /** + * Creates a new path item from an object description and places it at the top of the active layer. + * @param object - an object literal containing properties describing the path's attributes + */ + constructor(object?: any); + + /** + * Creates a new path item from SVG path-data and places it at the top of the active layer. + * @param pathData - the SVG path-data that describes the geometry of this path. + */ + constructor(pathData?: string); + + /** + * The segments contained within the path. + * Array of Segment objects + */ + segments: Segment[]; + + /** + * The first Segment contained within the path. + * Read only. + */ + firstSegment: Segment; + + /** + * The last Segment contained within the path + * Read only. + */ + lastSegment: Segment; + + /** + * The curves contained within the path. + * Array of Curve objects + */ + curves: Curve[]; + + /** + * The first Curve contained within the path. + * Read only. + */ + firstCurve: Curve; + + /** + * The last Curve contained within the path. + * Read only. + */ + lastCurve: Curve; + + /** + * Specifies whether the path is closed. If it is closed, Paper.js connects the first and last segments. + */ + closed: boolean; + + /** + * The approximate length of the path in points. + * Read only. + */ + length: number; + + /** + * The area of the path in square points. Self-intersecting paths can contain sub-areas that cancel each other out. + * Read only. + */ + area: number; + + /** + * Specifies whether the path and all its segments are selected. Cannot be true on an empty path. + */ + fullySelected: boolean; + + /** + * Specifies whether the path is oriented clock-wise. + */ + clockwise: boolean; + + /** + * Returns a point that is guaranteed to be inside the path. + * Read only. + */ + interiorPoint: Point; + + /** + * Adds one or more segments to the end of the segments array of this path. + * @param segment - the segment or point to be added. + * Returns the added segment. This is not necessarily the same object, e.g. if the segment to be added already belongs to another path. + */ + add(segment: Segment | Point): Segment; + + /** + * Inserts one or more segments at a given index in the list of this path's segments. + * @param index - the index at which to insert the segment. + * @param segment - the segment or point to be inserted. + * Returns the added segment. This is not necessarily the same object, e.g. if the segment to be added already belongs to another path. + */ + insert(index: number, segment: Segment | Point): Segment; + + /** + * Adds an array of segments (or types that can be converted to segments) to the end of the segments array. + * @param segments - Array of Segment objects + * Returns an array of the added segments. These segments are not necessarily the same objects, e.g. if the segment to be added already belongs to another path. + */ + addSegments(segments: Segment[]): Segment[]; + + /** + * Inserts an array of segments at a given index in the path's segments array. + * @param index - the index at which to insert the segments. + * @param segments - the segments to be inserted. + * Returns an array of the added segments. These segments are not necessarily the same objects, e.g. if the segment to be added already belongs to another path. + */ + insertSegments(index: number, segments: Segment[]): Segment[]; + + /** + * Removes the segment at the specified index of the path's segments array. + * @param index - the index of the segment to be removed + * Returns the removed segment + */ + removeSegment(index: number): Segment; + + /** + * Removes all segments from the path's segments array. + * Returns an array containing the removed segments + */ + removeSegments(): Segment[]; + + /** + * Removes the segments from the specified from index to the to index from the path's segments array. + * @param from - the beginning index, inclusive + * @param to [optional = segments.length] - the ending index + * Returns an array containing the removed segments + */ + removeSegments(from: number, to?: number): Segment[]; + + /** + * Converts the curves in a path to straight lines with an even distribution of points. The distance between the produced segments is as close as possible to the value specified by the maxDistance parameter. + * @param maxDistance - the maximum distance between the points + */ + flatten(maxDistance: number): void; + + /** + * Smooths a path by simplifying it. The path.segments array is analyzed and replaced by a more optimal set of segments, reducing memory usage and speeding up drawing. + * @param tolerance [optional = 2.5] - + */ + simplify(tolerance?: number): void; + + /** + * Splits the path at the given offset. After splitting, the path will be open. If the path was open already, splitting will result in two paths. + * @param offset - the offset at which to split the path as a number between 0 and path.length + * Returns the newly created path after splitting, if any + */ + split(offset: number): Path; + + /** + * Splits the path at the given curve location. After splitting, the path will be open. If the path was open already, splitting will result in two paths. + * @param location - the curve location at which to split the path + * Returns the newly created path after splitting, if any + */ + split(location: CurveLocation): Path; + + /** + * Splits the path at the given curve index and parameter. After splitting, the path will be open. If the path was open already, splitting will result in two paths. + * @param index - the index of the curve in the path.curves array at which to split + * @param parameter - the parameter at which the curve will be split + * Returns the newly created path after splitting, if any + */ + split(index: number, parameter: number): Path; + + /** + * Reverses the orientation of the path, by reversing all its segments. + */ + reverse(): void; + + /** + * Joins the path with the specified path, which will be removed in the process. + * @param path - the path to join this path with + * Returns the joined path + */ + join(path: Path): Path; + + /** + * Returns the curve location of the specified point if it lies on the path, null otherwise. + * @param point - the point on the path. + */ + getLocationOf(point: Point): CurveLocation; + + /** + * Returns the length of the path from its beginning up to up to the specified point if it lies on the path, null otherwise. + * @param point - the point on the path. + */ + getOffsetOf(point: Point): number; + + /** + * Returns the curve location of the specified offset on the path. + * @param offset - the offset on the path, where 0 is at the beginning of the path and path.length at the end. + * @param isParameter [optional=false] - + */ + getLocationAt(offset: number, isParameter?: boolean): CurveLocation; + + /** + * Calculates the point on the path at the given offset. Returns the point at the given offset + * @param offset - the offset on the path, where 0 is at the beginning of the path and path.length at the end. + * @param isParameter [optional=false] - + */ + getPointAt(offset: number, isPatameter?: boolean): Point; + + /** + * Calculates the tangent vector of the path at the given offset. Returns the tangent vector at the given offset + * @param offset - the offset on the path, where 0 is at the beginning of the path and path.length at the end. + * @param isParameter [optional=false] - + */ + getTangentAt(offset: number, isPatameter?: boolean): Point; + + /** + * Calculates the normal vector of the path at the given offset. Returns the normal vector at the given offset + * @param offset - the offset on the path, where 0 is at the beginning of the path and path.length at the end. + * @param isParameter [optional=false] - + */ + getNormalAt(offset: number, isParameter?: boolean): Point; + + /** + * Calculates the curvature of the path at the given offset. Curvatures indicate how sharply a path changes direction. A straight line has zero curvature, where as a circle has a constant curvature. The path's radius at the given offset is the reciprocal value of its curvature. + * @param offset - the offset on the path, where 0 is at the beginning of the path and path.length at the end. + * @param isParameter [optional=false] - + * @param point - the point for which we search the nearest location + */ + getCurvatureAt(offset: number, isParameter?: boolean, point?: Point): number; + + /** + * Returns the nearest point on the path to the specified point. + * @param point - the point for which we search the nearest point + */ + getNearestPoint(point: Point): Point; + + + } + /** + * A compound path contains two or more paths, holes are drawn where the paths overlap. All the paths in a compound path take on the style of the backmost path and can be accessed through its item.children list. + */ + export class CompoundPath extends PathItem { + + /** + * Creates a new compound path item from an object description and places it at the top of the active layer. + * @param object - an object literal containing properties to be set on the path + */ + constructor(object: any); + + /** + * Creates a new compound path item from SVG path-data and places it at the top of the active layer. + * @param pathData - the SVG path-data that describes the geometry of this path. + */ + constructor(pathData: string); + + /** + * Specifies whether the compound path is oriented clock-wise. + */ + clockwise: boolean; + + /** + * The first Segment contained within the path. + * Read Only + */ + firstSegment: Segment; + + /** + * The last Segment contained within the path. + * Read Only + */ + lastSegment: Segment; + + /** + * All the curves contained within the compound-path, from all its child Path items. + * Read Only + */ + curves: Curve[]; + + /** + * The first Curve contained within the path. + * Read Only + */ + firstCurve: Curve; + + /** + * The last Curve contained within the path. + * Read only. + */ + lastCurve: Curve; + + /** + * The area of the path in square points. Self-intersecting paths can contain sub-areas that cancel each other out. + * Read Only. + */ + area: number; + + /** + * Reverses the orientation of all nested paths. + */ + reverse(): void; + + } + /** + * The Segment object represents the points of a path through which its Curve objects pass. The segments of a path can be accessed through its path.segments array. + * Each segment consists of an anchor point (segment.point) and optionaly an incoming and an outgoing handle (segment.handleIn and segment.handleOut), describing the tangents of the two Curve objects that are connected by this segment. + */ + export class Segment { + + /** + * Creates a new Segment object. + * @param point [optional] - the anchor point of the segment default: {x: 0, y: 0} + * @param handleIn [optional] - the handle point relative to the anchor point of the segment that describes the in tangent of the segment default: {x: 0, y: 0} + * @param handleOut [optional] - the handle point relative to the anchor point of the segment that describes the out tangent of the segment default: {x: 0, y: 0} + */ + constructor(point?: Point, handleIn?: Point, handleOut?: Point); + + /** + * Creates a new Segment object. + * @param object - an object literal containing properties to be set on the segment. + */ + constructor(object?: any); + + /** + * The anchor point of the segment. + */ + point: Point; + + /** + * The handle point relative to the anchor point of the segment that describes the in tangent of the segment. + */ + handleIn: Point; + + /** + * The handle point relative to the anchor point of the segment that describes the out tangent of the segment. + */ + handleOut: Point; + + /** + * Specifies whether the segment has no handles defined, meaning it connects two straight lines. + */ + linear: boolean; + + /** + * Specifies whether the point of the segment is selected. + */ + selected: boolean; + + /** + * The index of the segment in the path.segments array that the segment belongs to. + * Read Only + */ + index: number; + + /** + * The path that the segment belongs to. + * Read Only + */ + path: Path; + + /** + * The curve that the segment belongs to. For the last segment of an open path, the previous segment is returned. + * Read only. + */ + curve: Curve; + + /** + * The curve location that describes this segment's position ont the path. + * Read Only. + */ + location: CurveLocation; + + /** + * The next segment in the path.segments array that the segment belongs to. If the segments belongs to a closed path, the first segment is returned for the last segment of the path. + * Read Only. + */ + next: Segment; + + /** + * The previous segment in the path.segments array that the segment belongs to. If the segments belongs to a closed path, the last segment is returned for the first segment of the path. + * Read Only. + */ + previous: Segment; + + /** + * Returns true if the the two segments are the beginning of two lines and if these two lines are running parallel. + * @param segment + */ + isColinear(segment: Segment): boolean; + + /** + * Returns true if the segment at the given index is the beginning of an orthogonal arc segment. The code looks at the length of the handles and their relation to the distance to the imaginary corner point. If the relation is kappa, then it's an arc. + */ + isArc(): boolean; + + /** + * Returns the reversed the segment, without modifying the segment itself. + */ + reverse(): Segment; + + /** + * Removes the segment from the path that it belongs to. + */ + remove(): boolean; + + /** + * A string representation of the segment + */ + toString(): string; + + /** + * Transform the segment by the specified matrix. + * @param matrix - the matrix to transform the segment by + */ + transform(matrix: Matrix): void; + + } + /** + * The Curve object represents the parts of a path that are connected by two following Segment objects. The curves of a path can be accessed through its path.curves array. + * While a segment describe the anchor point and its incoming and outgoing handles, a Curve object describes the curve passing between two such segments. Curves and segments represent two different ways of looking at the same thing, but focusing on different aspects. Curves for example offer many convenient ways to work with parts of the path, finding lengths, positions or tangents at given offsets. + */ + export class Curve { + + /** + * Creates a new curve object. + * @param segment1 - + * @param segment2 - + */ + constructor(segment1: Segment, segment2: Segment); + + /** + * Creates a new curve object. + * @param point1: Point + * @param handle1: Point + * @param handle2: Point + * @param point2: Point + */ + constructor(point1: Point, handle1: Point, handle2: Point, point2: Point); + + /** + * The first anchor point of the curve. + */ + point1: Point; + + /** + * The second anchor point of the curve. + */ + point2: Point; + + /** + * The handle point that describes the tangent in the first anchor point. + */ + handle1: Point; + + /** + * The handle point that describes the tangent in the second anchor point. + */ + handle2: Point; + + /** + * The first segment of the curve. + * Read Only. + */ + segment1: Segment; + + /** + * The second segment of the curve. + * Read only. + */ + segment2: Segment; + + /** + * The path that the curve belongs to. + * Read only. + */ + path: Path; + + /** + * The index of the curve in the path.curves array. + * Read Only. + */ + index: number; + + /** + * The next curve in the path.curves array that the curve belongs to. + * Read Only + */ + next: Curve; + + /** + * The previous curve in the path.curves array that the curve belongs to. + * Read Only. + */ + previous: Curve; + + /** + * Specifies whether the points and handles of the curve are selected. + */ + selected: boolean; + + /** + * The approximated length of the curve in points. + * Read Only. + */ + length: number; + + /** + * The bounding rectangle of the curve excluding stroke width. + */ + bounds: Rectangle; + + /** + * The bounding rectangle of the curve including stroke width. + */ + strokeBounds: Rectangle; + + /** + * The bounding rectangle of the curve including handles. + */ + handleBounds: Rectangle; + + /** + * Checks if this curve is linear, meaning it does not define any curve handle. + */ + isLinear(): boolean; + + /** + * TODO? + */ + //isHorizontal(): boolean; + + /** + * Divides the curve into two curves at the given offset. The curve itself is modified and becomes the first part, the second part is returned as a new curve. If the modified curve belongs to a path item, the second part is also added to the path. + * @param offset [optional] - the offset on the curve at which to split, or the curve time parameter if isParameter is true default: 0.5 + * @param isParameter [optional] - pass true if offset is a curve time parameter. default: false + */ + divide(offset?: number, isParameter?: boolean): Curve; + + /** + * Splits the path this curve belongs to at the given offset. After splitting, the path will be open. If the path was open already, splitting will result in two paths. + * @param offset [optional] - the offset on the curve at which to split, or the curve time parameter if isParameter is true default: 0.5 + * @param isParameter [optional] - pass true if offset is a curve time parameter. default: false + */ + split(offset?: number, isParameter?: boolean): Path; + + /** + * Returns a reversed version of the curve, without modifying the curve itself. + */ + reverse(): Curve; + + /** + * Removes the curve from the path that it belongs to, by merging its two path segments. + * returns true if the curve was removed, false otherwise + */ + remove(): boolean; + + /** + * Returns a copy of the curve. + */ + clone(): Curve; + + /** + * returns a string representation of the curve + */ + toString(): string; + + /** + * Calculates the curve time parameter of the specified offset on the path, relative to the provided start parameter. If offset is a negative value, the parameter is searched to the left of the start parameter. If no start parameter is provided, a default of 0 for positive values of offset and 1 for negative values of offset. + * @param offset - + * @param start [optional] - + */ + getParameterAt(offset: Point, start?: number): number; + + /** + * Returns the curve time parameter of the specified point if it lies on the curve, null otherwise. + * @param point - the point on the curve. + */ + getParameterOf(point: Point): number; + + /** + * Calculates the curve location at the specified offset or curve time parameter. + * @param offset - the offset on the curve, or the curve time parameter if isParameter is true + * @param isParameter [optional] - pass true if offset is a curve time parameter. default: false + */ + getLocationAt(offset: Point, isParameter?: boolean): CurveLocation; + + /** + * Returns the curve location of the specified point if it lies on the curve, null otherwise. + * @param point - the point on the curve + */ + getLocationOf(point: Point): CurveLocation; + + /** + * Returns the length of the path from its beginning up to up to the specified point if it lies on the path, null otherwise. + * @param point - the point on the path. + */ + getOffsetOf(point: Point): number; + + /** + * Calculates the point on the curve at the given offset. + * @param offset - the offset on the curve, or the curve time parameter if isParameter is true + * @param isParameter [optional] - pass true if offset is a curve time parameter. default: false + */ + getPointAt(offset: number, isParameter?: boolean): Point; + + /** + * Calculates the tangent vector of the curve at the given offset. + * @param offset - the offset on the curve, or the curve time parameter if isParameter is true + * @param isParameter [optional] - pass true if offset is a curve time parameter. default: false + */ + getTangentAt(offset: number, isParameter?: boolean): Point; + + /** + * Calculates the normal vector of the curve at the given offset. + * @param offset - the offset on the curve, or the curve time parameter if isParameter is true + * @param isParameter [optional] - pass true if offset is a curve time parameter. default: false + */ + getNormalAt(offset: number, isParameter?: boolean): Point; + + /** + * Calculates the curvature of the curve at the given offset. Curvatures indicate how sharply a curve changes direction. A straight line has zero curvature, where as a circle has a constant curvature. The curve's radius at the given offset is the reciprocal value of its curvature. + * @param offset - the offset on the curve, or the curve time parameter if isParameter is true + * @param isParameter - pass true if offset is a curve time parameter. default: false + */ + getCurvatureAt(offset: number, isParameter?: boolean): Point; + + } + /** + * CurveLocation objects describe a location on Curve objects, as defined by the curve parameter, a value between 0 (beginning of the curve) and 1 (end of the curve). If the curve is part of a Path item, its index inside the path.curves array is also provided. + * The class is in use in many places, such as path.getLocationAt(offset, isParameter), path.getLocationOf(point), Path#getNearestLocation(point),{@linkPathItem#getIntersections(path), etc. + */ + export class CurveLocation { + + /** + * Creates a new CurveLocation object. + * @param curve - + * @param parameter - + * @param point - + */ + constructor(curve: Curve, parameter: number, point: Point); + + /** + * The segment of the curve which is closer to the described location. + * Read Only + */ + segment: Segment; + + /** + * The curve that this location belongs to. + * Read Only + */ + curve: Curve; + + /** + * The curve location on the intersecting curve, if this location is the result of a call to pathItem.getIntersections(path) / Curve#getIntersections(curve). + * Read Only + */ + intersection: CurveLocation; + + /** + * The path this curve belongs to, if any. + * Read Only + */ + path: Path; + + /** + * The index of the curve within the path.curves list, if the curve is part of a Path item. + * Read Only. + */ + index: number; + + /** + * The length of the path from its beginning up to the location described by this object. If the curve is not part of a path, then the length within the curve is returned instead. + * Read only. + */ + offset: number; + + /** + * The length of the curve from its beginning up to the location described by this object. + * Read Only. + */ + curveOffset: number; + + /** + * The curve parameter, as used by various bezier curve calculations. It is value between 0 (beginning of the curve) and 1 (end of the curve). + * Read only. + */ + parameter: number; + + /** + * The point which is defined by the curve and parameter. + * Read only. + */ + point: Point; + + /** + * The distance from the queried point to the returned location. + * Read Only. + */ + distance: number; + + /** + * Checks whether tow CurveLocation objects are describing the same location on a path, by applying the same tolerances as elsewhere when dealing with curve time parameters. + * @param location CurveLocation + */ + equals(location: CurveLocation): boolean; + + /** + * Returns a string representation of the curve location + */ + toString(): string; + + } + /** + * A Project object in Paper.js is what usually is referred to as the document: The top level object that holds all the items contained in the scene graph. As the term document is already taken in the browser context, it is called Project. + * Projects allow the manipulation of the styles that are applied to all newly created items, give access to the selected items, and will in future versions offer ways to query for items in the scene graph defining specific requirements, and means to persist and load from different formats, such as SVG and PDF. + * The currently active project can be accessed through the paperScope.project variable. + * An array of all open projects is accessible through the paperScope.projects variable. + */ + export class Project { + + /** + * Creates a Paper.js project containing one empty Layer, referenced by project.activeLayer. + * @param element - the HTML canvas element that should be used as the element for the view, or an ID string by which to find the element. + */ + constructor(element: HTMLCanvasElement | string); + + /** + * The reference to the project's view. + * Read only. + */ + view: View; + + /** + * The currently active path style. All selected items and newly created items will be styled with this style. + */ + currentStyle: Style; + + /** + * The index of the project in the paperScope.projects list. + * Read Only + */ + index: number; + + /** + * The layers contained within the project. + */ + layers: Layer[]; + + /** + * The layer which is currently active. New items will be created on this layer by default. + * Read Only. + */ + activeLayer: Layer; + + /** + * The symbols contained within the project. + */ + symbols: Symbol[]; + + /** + * Activates this project, so all newly created items will be placed in it. + */ + activate(): void; + + /** + * Clears the project by removing all project.layers and project.symbols. + */ + clear(): void; + + /** + * Checks whether the project has any content or not. + */ + isEmpty(): boolean; + + /** + * Removes this project from the paperScope.projects list, and also removes its view, if one was defined. + */ + remove(): void; + + /** + * Selects all items in the project. + */ + selectAll(): void; + + /** + * Deselects all selected items in the project. + */ + deselectAll(): void; + + /** + * Perform a hit-test on the items contained within the project at the location of the specified point. + * The options object allows you to control the specifics of the hit-test and may contain a combination of the following values: + * @param point - the point where the hit-test should be performed + * @param options.tolerance -the tolerance of the hit-test in points. Can also be controlled through paperScope.settings.hitTolerance + * @param options.class - only hit-test again a certain item class and its sub-classes: Group, Layer, Path, CompoundPath, Shape, Raster, PlacedSymbol, PointText, etc. + * @param options.fill - hit-test the fill of items. + * @param options.stroke - hit-test the stroke of path items, taking into account the setting of stroke color and width. + * @param options.segments - hit-test for segment.point of Path items. + * @param options.curves - hit-test the curves of path items, without taking the stroke color or width into account. + * @param options.handles - hit-test for the handles. (segment.handleIn / segment.handleOut) of path segments. + * @param options.ends - only hit-test for the first or last segment points of open path items. + * @param options.bounds - hit-test the corners and side-centers of the bounding rectangle of items (item.bounds). + * @param options.center - hit-test the rectangle.center of the bounding rectangle of items (item.bounds). + * @param options.guides - hit-test items that have Item#guide set to true. + * @param options.selected - only hit selected items. + */ + hitTest(point: Point, options?: { tolerance?: number; class?: string; fill?: boolean; stroke?: boolean; segments?: boolean; curves?: boolean; handles?: boolean; ends?: boolean; bounds?: boolean; center?: boolean; guides?: boolean; selected?: boolean; }): HitResult; + + /** + * Fetch items contained within the project whose properties match the criteria in the specified object. + * Extended matching is possible by providing a compare function or regular expression. Matching points, colors only work as a comparison of the full object, not partial matching (e.g. only providing the x- coordinate to match all points with that x-value). Partial matching does work for item.data. + * Matching items against a rectangular area is also possible, by setting either match.inside or match.overlapping to a rectangle describing the area in which the items either have to be fully or partly contained. + */ + getItems(match: any): Item[]; + + /** + * Fetch the first item contained within the project whose properties match the criteria in the specified object. + * Extended matching is possible by providing a compare function or regular expression. Matching points, colors only work as a comparison of the full object, not partial matching (e.g. only providing the x- coordinate to match all points with that x-value). Partial matching does work for item.data. + */ + getItem(match: any): Item; + + /** + * Exports (serializes) the project with all its layers and child items to a JSON data string. + * @param options [optional] - default {asString: true, precision: 5} + * @param options.asString - whether the JSON is returned as a Object or a String. + * @param options.precision - the amount of fractional digits in numbers used in JSON data. + */ + exportJSON(options?: { asString?: boolean; precision?: number }): string; + + /** + * Imports (deserializes) the stored JSON data into the project. + * Note that the project is not cleared first. You can call project.clear() to do so. + */ + importJSON(json: string): void; + + /** + * Exports the project with all its layers and child items as an SVG DOM, all contained in one top level SVG group node. + * @param options [optional] the export options, default: { asString: false, precision: 5, matchShapes: false } + * @param options.asString - whether a SVG node or a String is to be returned. + * @param options.precision - the amount of fractional digits in numbers used in SVG data. + * @param options.matchShapes - whether path items should tried to be converted to shape items, if their geometries can be made to match + */ + exportSVG(options?: { asString?: boolean; precision?: number; matchShapes?: boolean }): SVGElement; + + /** + * Converts the provided SVG content into Paper.js items and adds them to the active layer of this project. + * Note that the project is not cleared first. You can call project.clear() to do so. + * @param svg - the SVG content to import + * @param options [optional] - the import options, default: { expandShapes: false } + * @param options.expandShapes - whether imported shape items should be expanded to path items. + */ + importSVG(svg: SVGElement | string, options?: any): Item; + + } + /** + * Symbols allow you to place multiple instances of an item in your project. This can save memory, since all instances of a symbol simply refer to the original item and it can speed up moving around complex objects, since internal properties such as segment lists and gradient positions don't need to be updated with every transformation. + */ + export class Symbol { + + /** + * Creates a Symbol item. + * @param item - the source item which is copied as the definition of the symbol + * @param dontCenter [optional] - default: false + */ + constructor(item: Item, dontCenter?: boolean); + + /** + * The project that this symbol belongs to. + * Read Only. + */ + project: Project; + + /** + * The symbol definition. + */ + definition: Item; + + /** + * Places in instance of the symbol in the project. + * @param position [optional] - The position of the placed symbol. + */ + place(position?: Point): PlacedSymbol; + + /** + * Returns a copy of the symbol. + */ + clone(): Symbol; + + } + /** + * Style is used for changing the visual styles of items contained within a Paper.js project and is returned by item.style and project.currentStyle. + * All properties of Style are also reflected directly in Item, i.e.: item.fillColor. + * To set multiple style properties in one go, you can pass an object to item.style. This is a convenient way to define a style once and apply it to a series of items: + */ + export class Style { + + /** + * The view that this style belongs to. + * Read only. + */ + view: View; + + /** + * The color of the stroke. + */ + strokeColor: Color | string; + + /** + * The width of the stroke. + */ + strokeWidth: number; + + /** + * The shape to be used at the beginning and end of open Path items, when they have a stroke. + * String('round', 'square', 'butt' + */ + strokeCap: string; + + /** + * The shape to be used at the segments and corners of Path items when they have a stroke. + * String('miter', 'round', 'bevel') + */ + strokeJoin: string; + + /** + * Specifies whether the stroke is to be drawn taking the current affine transformation into account (the default behavior), or whether it should appear as a non-scaling stroke. + */ + strokeScaling: boolean; + + /** + * The dash offset of the stroke. + */ + dashOffset: number; + + /** + * Specifies an array containing the dash and gap lengths of the stroke. + */ + dashArray: number[]; + + /** + * The miter limit of the stroke. When two line segments meet at a sharp angle and miter joins have been specified for strokeJoin, it is possible for the miter to extend far beyond the strokeWidth of the path. The miterLimit imposes a limit on the ratio of the miter length to the strokeWidth. + */ + miterLimit: number; + + /** + * The fill color. + */ + fillColor: Color | string; + + /** + * The shadow color. + */ + shadowColor: Color | string; + + /** + * The shadow's blur radius. + */ + shadowBlur: number; + + /** + * The shadow's offset. + */ + shadowOffset: Point; + + /** + * The color the item is highlighted with when selected. If the item does not specify its own color, the color defined by its layer is used instead. + */ + selectedColor: Color | string; + + /** + * The font-family to be used in text content. default 'sans-serif' + */ + fontFamily: string; + + /** + * The font-weight to be used in text content. + */ + fontWeight: string | number; + + /** + * The font size of text content, as {@Number} in pixels, or as {@String} with optional units 'px', 'pt' and 'em'. + */ + fontSize: string | number; + + /** + * The text leading of text content. + */ + leading: number | string; + + /** + * The justification of text paragraphs. default "left" + */ + justification: string; + + } + export interface IHSBColor { + + /** + * the hue of the color as a value in degrees between 0 and 360 + */ + hue?: number; + /** + * the saturation of the color as a value between 0 and 1 + */ + saturation?: number; + /** + * the brightness of the color as a value between 0 and 1 + */ + brightness?: number; + /** + * the alpha of the color as a value between 0 and 1 + */ + alpha?: number; + + } + export interface IHSLColor { + + /** + * the hue of the color as a value in degrees between 0 and 360 + */ + hue?: number; + /** + * the saturation of the color as a value between 0 and 1 + */ + saturation?: number; + /** + * the brightness of the color as a value between 0 and 1 + */ + lightness?: number; + /** + * the alpha of the color as a value between 0 and 1 + */ + alpha?: number; + + } + export interface IGradientColor { + /** + * the gradient object that describes the color stops and type of gradient to be used. + */ + gradient?: Gradient; + /** + * the origin point of the gradient + */ + origin?: Point; + /** + * the destination point of the gradient stops: Array of GradientStop - the gradient stops describing the gradient, as an alternative to providing a gradient object + */ + destination?: Point; + /** + * controls whether the gradient is radial, as an alternative to providing a gradient object + */ + radial?: boolean; + } + /** + * All properties and functions that expect color values in the form of instances of Color objects, also accept named colors and hex values as strings which are then converted to instances of Color internally. + */ + export class Color { + + /** + * Creates a RGB Color object. + * @param red - the amount of red in the color as a value between 0 and 1 + * @param green - the amount of green in the color as a value between 0 and 1 + * @param blue - the amount of blue in the color as a value between 0 and 1 + * @param alpha [optional] - the alpha of the color as a value between 0 and 1 + */ + constructor(red: number, green: number, blue: number, alpha?: number); + + /** + * Creates a gray Color object. + * @param gray - the amount of gray in the color as a value between 0 and 1 + * @param alpha [optional] - the alpha of the color as a value between 0 and 1 + */ + constructor(gray: number, alpha?: number); + + /** + * Creates a HSB, HSL or gradient Color object from the properties of the provided object: + * @param object - an object describing the components and properties of the color. + */ + constructor(object: IHSBColor | IHSLColor | IGradientColor); + + /** + * Creates a gradient Color object. + * @param gradient - + * @param origin - + * @param destination - + * @param highlight [optional] - + */ + constructor(color: Gradient, origin: Point, destination: Point, highlight?: Point); + + /** + * The type of the color as a string. + * String('rgb', 'gray', 'hsb', 'hsl') + */ + type: string; + + /** + * The color components that define the color, including the alpha value if defined. + * Read Only. + */ + components: number; + + /** + * The color's alpha value as a number between 0 and 1. + * All colors of the different subclasses support alpha values. + */ + alpha: number; + + /** + * The amount of red in the color as a value between 0 and 1. + */ + red: number; + + /** + * The amount of green in the color as a value between 0 and 1. + */ + green: number; + + /** + * The amount of blue in the color as a value between 0 and 1. + */ + blue: number; + + /** + * The amount of gray in the color as a value between 0 and 1. + */ + gray: number; + + /** + * The hue of the color as a value in degrees between 0 and 360. + */ + hue: number; + + /** + * The saturation of the color as a value between 0 and 1. + */ + saturation: number; + + /** + * The brightness of the color as a value between 0 and 1. + */ + brightness: number; + + /** + * The lightness of the color as a value between 0 and 1. + * Note that all other components are shared with HSB. + */ + lightness: number; + + /** + * The gradient object describing the type of gradient and the stops. + */ + gradient: Gradient; + + /** + * The highlight point of the gradient. + */ + highlight: Point; + + /** + * Converts the color another type. + * @param type - String('rgb'|'gray'|'hsb'|'hsl') the color type to convert to. + */ + convert(type: string): Color; + + /** + * Checks if the color has an alpha value. + */ + hasAlpha(): boolean; + + /** + * Checks if the component color values of the color are the same as those of the supplied one. + * @param color - the color to compare with + */ + equals(color: Color): boolean; + + /** + * a copy of the color object + */ + clone(): Color; + + /** + * a string representation of the color + */ + toString(): string; + + /** + * Returns the color as a CSS string. + * @param hex - whether to return the color in hexadecial representation or as a CSS RGB / RGBA string. + */ + toCSS(hex: boolean): string; + + /** + * Transform the gradient color by the specified matrix. + * @param matrix - the matrix to transform the gradient color by + */ + transform(matrix: Matrix): void; + + } + /** + * The Gradient object. + */ + export class Gradient { + + /** + * The gradient stops on the gradient ramp. + */ + stops: GradientStop[]; + + /** + * Specifies whether the gradient is radial or linear. + */ + radial: boolean; + + /** + * a copy of the gradient + */ + clone(): Gradient; + + /** + * Checks whether the gradient is equal to the supplied gradient. + * @param gradient - the gradient to check against + */ + equals(gradient: Gradient): boolean; + + } + /** + * The GradientStop object. + */ + export class GradientStop { + + /** + * Creates a GradientStop object. + * @param color [optional] - the color of the stop, default: new Color(0, 0, 0) + * @param rampPoint [optional] - the position of the stop on the gradient ramp as a value between 0 and 1, default: 0 + */ + constructor(color?: Color, rampPoint?: number); + + /** + * The ramp-point of the gradient stop as a value between 0 and 1. + */ + rampPoint: number; + + /** + * The color of the gradient stop. + */ + color: Color; + + /** + * Returns a copy of the gradient-stop + */ + clone(): GradientStop; + + } + /** + * The View object wraps an HTML element and handles drawing and user interaction through mouse and keyboard for it. It offer means to scroll the view, find the currently visible bounds in project coordinates, or the center, both useful for constructing artwork that should appear centered on screen. + */ + export class View { + + /** + * The underlying native element. + * Read Only. + */ + element: HTMLCanvasElement; + + /** + * The ratio between physical pixels and device-independent pixels (DIPs) of the underlying canvas / device. + * It is 1 for normal displays, and 2 or more for high-resolution displays. + * Read only. + */ + pixelRatio: number; + + /** + * The resoltuion of the underlying canvas / device in pixel per inch (DPI). + * It is 72 for normal displays, and 144 for high-resolution displays with a pixel-ratio of 2. + * Read only. + */ + resolution: number; + + /** + * The size of the view. Changing the view's size will resize it's underlying element. + */ + viewSize: Size; + + /** + * The bounds of the currently visible area in project coordinates. + * Read only. + */ + bounds: Rectangle; + + /** + * The size of the visible area in project coordinates. + * Read only. + */ + size: Size; + + /** + * The center of the visible area in project coordinates. + */ + center: Point; + + /** + * The zoom factor by which the project coordinates are magnified. + */ + zoom: number; + + /** + * Handler function to be called on each frame of an animation. + * The function receives an event object which contains information about the frame event: + */ + onFrame: (event: IFrameEvent) => void; + + /** + * Handler function that is called whenever a view is resized. + */ + onResize: (event: Event) => void; + + /** + * Removes this view from the project and frees the associated element. + */ + remove(): void; + + /** + * Checks whether the view is currently visible within the current browser viewport. + */ + isVisible(): boolean; + + /** + * Scrolls the view by the given vector. + * @param point - the vector to scroll by + */ + scrollBy(point: Point): void; + + /** + * Makes all animation play by adding the view to the request animation loop. + */ + play(): void; + + /** + * Makes all animation pause by removing the view to the request animation loop. + */ + pause(): void; + + /** + * Updates the view if there are changes. Note that when using built-in event hanlders for interaction, animation and load events, this method is invoked for you automatically at the end. + */ + update(): void; + + /** + * + * @param point - + */ + projectToView(point: Point): Point; + + /** + * + * @param point - + */ + viewToProject(point: Point): Point; + + //I cannot use function: Function as it is a reserved keyword + + /** + * Attach an event handler to the view. + * @param type - String('frame'|'resize') the event type + * @param function - The function to be called when the event occurs + */ + on(type: string, callback: (event: Event) => void): Item; + + /** + * Attach one or more event handlers to the view. + */ + on(param: any): Item; + + /** + * Detach an event handler from the view. + * @param type - String('frame'|'resize') the event type + * @param function - The function to be detached + */ + off(type: string, callback: (event: Event) => void): Item; + + /** + * Detach one or more event handlers from the view. + * @param param - an object literal containing one or more of the following properties: frame, resize + */ + off(param: any): Item; + + /** + * Emit an event on the view. + * @param type - String('frame'|'resize') the event type + * @param event - an object literal containing properties describing the event. + */ + emit(type: string, event: any): boolean; + + /** + * Check if the view has one or more event handlers of the specified type. + * @param type - String('frame'|'resize') the event type + */ + responds(type: string): boolean; + + /** + * Draws the view when using paper.js directly in JavaScript + */ + draw(): void; + + } + /** + * The Tool object refers to a script that the user can interact with by using the mouse and keyboard and can be accessed through the global tool variable. All its properties are also available in the paper scope. + * The global tool variable only exists in scripts that contain mouse handler functions (onMouseMove, onMouseDown, onMouseDrag, onMouseUp) or a keyboard handler function (onKeyDown, onKeyUp). + */ + export class Tool { + + /** + * The minimum distance the mouse has to drag before firing the onMouseDrag event, since the last onMouseDrag event. + */ + minDistance: number; + + /** + * The maximum distance the mouse has to drag before firing the onMouseDrag event, since the last onMouseDrag event. + */ + maxDistance: number; + + /** + * + */ + fixedDistance: number; + + /** + * The function to be called when the mouse button is pushed down. The function receives a ToolEvent object which contains information about the mouse event. + */ + onMouseDown: (event: ToolEvent) => void; + + /** + * The function to be called when the mouse position changes while the mouse is being dragged. The function receives a ToolEvent object which contains information about the mouse event. + */ + onMouseDrag: (event: ToolEvent) => void; + + /** + * The function to be called the mouse moves within the project view. The function receives a ToolEvent object which contains information about the mouse event. + */ + onMouseMove: (event: ToolEvent) => void; + + /** + * The function to be called when the mouse button is released. The function receives a ToolEvent object which contains information about the mouse event. + */ + onMouseUp: (event: ToolEvent) => void; + + /** + * The function to be called when the user presses a key on the keyboard. + * The function receives a KeyEvent object which contains information about the keyboard event. + * If the function returns false, the keyboard event will be prevented from bubbling up. This can be used for example to stop the window from scrolling, when you need the user to interact with arrow keys. + */ + onKeyDown: (event: KeyEvent) => void; + + /** + * The function to be called when the user releases a key on the keyboard. + * The function receives a KeyEvent object which contains information about the keyboard event. + * If the function returns false, the keyboard event will be prevented from bubbling up. This can be used for example to stop the window from scrolling, when you need the user to interact with arrow keys. + */ + onKeyUp: (event: KeyEvent) => void; + + /** + * Activates this tool, meaning paperScope.tool will point to it and it will be the one that recieves mouse events. + */ + activate(): void; + + /** + * Removes this tool from the paperScope.tools list. + */ + remove(): void; + + //I cannot use function: Function as it is a reserved keyword + + /** + * Attach an event handler to the tool. + * @param type - String('mousedown'|'mouseup'|'mousedrag'|'mousemove'|'keydown'|'keyup') the event type + * @param function - The function to be called when the event occurs + */ + on(type: string, callback: (event: ToolEvent) => void): Tool; + + /** + * Attach one or more event handlers to the tool. + * @param param - an object literal containing one or more of the following properties: mousedown, mouseup, mousedrag, mousemove, keydown, keyup + */ + on(param: any): Tool; + + /** + * Detach an event handler from the tool. + * @param type - String('mousedown'|'mouseup'|'mousedrag'|'mousemove'|'keydown'|'keyup') the event type + * @param function - The function to be detached + */ + off(type: string, callback: (event: ToolEvent) => void): Tool; + + /** + * Detach one or more event handlers from the tool. + * @param param - an object literal containing one or more of the following properties: mousedown, mouseup, mousedrag, mousemove, keydown, keyup + */ + off(param: any): Tool; + + /** + * Emit an event on the tool. + * @param type - String('mousedown'|'mouseup'|'mousedrag'|'mousemove'|'keydown'|'keyup') the event type + * @param event - an object literal containing properties describing the event. + */ + emit(type: string, event: any): boolean; + + /** + * Check if the tool has one or more event handlers of the specified type. + * @param type - String('mousedown'|'mouseup'|'mousedrag'|'mousemove'|'keydown'|'keyup') the event type + */ + responds(type: string): boolean; + + } + export class Event { + + /** + * Read Only + */ + modifiers: any; + + } + /** + * ToolEvent The ToolEvent object is received by the Tool's mouse event handlers tool.onMouseDown, tool.onMouseDrag, tool.onMouseMove and tool.onMouseUp. The ToolEvent object is the only parameter passed to these functions and contains information about the mouse event. + */ + export class ToolEvent extends Event { + + /** + * The type of tool event. + * String('mousedown', 'mouseup', 'mousemove', 'mousedrag') + */ + type: string; + + /** + * The position of the mouse in project coordinates when the event was fired. + */ + point: Point; + + /** + * The position of the mouse in project coordinates when the previous event was fired. + */ + lastPoint: Point; + + /** + * The position of the mouse in project coordinates when the mouse button was last clicked. + */ + downPoint: Point; + + /** + * The point in the middle between lastPoint and point. This is a useful position to use when creating artwork based on the moving direction of the mouse, as returned by delta. + */ + middlePoint: Point; + + /** + * The difference between the current position and the last position of the mouse when the event was fired. In case of the mouseup event, the difference to the mousedown position is returned. + */ + delta: Point; + + /** + * The number of times the mouse event was fired. + */ + count: number; + + /** + * The item at the position of the mouse (if any). If the item is contained within one or more Group or CompoundPath items, the most top level group or compound path that it is contained within is returned. + */ + item: Item; + + /** + * a string representation of the tool event + */ + toString(): string; + + } + export class Key { + + /** + * Checks whether the specified key is pressed. + * @param key - One of: 'backspace', 'enter', 'shift', 'control', 'option', 'pause', 'caps-lock', 'escape', 'space', 'end', 'home', 'left', 'up', 'right', 'down', 'delete', 'command' + */ + static isDown(key: string): boolean; + + } + /** + * The KeyEvent object is received by the Tool's keyboard handlers tool.onKeyDown, tool.onKeyUp. The KeyEvent object is the only parameter passed to these functions and contains information about the keyboard event. + */ + export class KeyEvent extends Event { + + /** + * The type of key event. + * String('keydown', 'keyup') + */ + type: string; + + /** + * The string character of the key that caused this key event. + */ + character: string; + + /** + * The key that caused this key event. + */ + key: string; + + /** + * a string representation of the key event + */ + toString(): string; + + } + /** + * The TextItem type allows you to create typography. Its functionality is inherited by different text item types such as PointText, and AreaText (coming soon). They each add a layer of functionality that is unique to their type, but share the underlying properties and functions that they inherit from TextItem. + */ + export class TextItem extends Item { + + /** + * The text contents of the text item. + */ + content: string; + + /** + * The font-family to be used in text content. + */ + fontFamily: string; + + /** + * The font-weight to be used in text content. + */ + fontWeight: string | number; + + /** + * The font size of text content, as {@Number} in pixels, or as {@String} with optional units 'px', 'pt' and 'em'. + */ + fontSize: string | number; + + /** + * The text leading of text content. + */ + leading: string | number; + + /** + * The justification of text paragraphs. + * String('left', 'right', 'center') + */ + justification: string; + + } + /** + * A PointText item represents a piece of typography in your Paper.js project which starts from a certain point and extends by the amount of characters contained in it. + */ + export class PointText extends TextItem { + + /** + * Creates a point text item + * @param point - the position where the text will start + */ + constructor(point: Point); + + /** + * Creates a point text item from the properties described by an object literal. + * @param object - an object literal containing properties describing the path's attributes + */ + constructor(object: any); + + /** + * The PointText's anchor point + */ + point: Point; + + } + +} From fee5da4cdccf6fc0abbbd0859be3c1713cbd9053 Mon Sep 17 00:00:00 2001 From: sqwk Date: Thu, 18 Aug 2016 11:52:56 +0200 Subject: [PATCH 002/246] Fix Header --- paper/paper.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/paper/paper.d.ts b/paper/paper.d.ts index 9fc0c154a1..daf7e56827 100644 --- a/paper/paper.d.ts +++ b/paper/paper.d.ts @@ -1,7 +1,7 @@ // Type definitions for Paper.js v0.9.22 // Project: http://paperjs.org/ // Definitions by: Clark Stevenson -// forked from https://github.com/clark-stevenson/paper.d.ts +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module 'paper' { From 044bac98a20880c27be9dba1eff863a1b5fde482 Mon Sep 17 00:00:00 2001 From: sqwk Date: Thu, 18 Aug 2016 11:53:09 +0200 Subject: [PATCH 003/246] Add Provisional Tests File --- paper/paper-tests.ts | 1 + 1 file changed, 1 insertion(+) create mode 100644 paper/paper-tests.ts diff --git a/paper/paper-tests.ts b/paper/paper-tests.ts new file mode 100644 index 0000000000..8e011255a2 --- /dev/null +++ b/paper/paper-tests.ts @@ -0,0 +1 @@ +/// From b09a00f0229752958811e43cceeab60721aaabc6 Mon Sep 17 00:00:00 2001 From: sqwk Date: Thu, 18 Aug 2016 11:58:03 +0200 Subject: [PATCH 004/246] Remove Space --- paper/paper.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/paper/paper.d.ts b/paper/paper.d.ts index daf7e56827..e463d730c0 100644 --- a/paper/paper.d.ts +++ b/paper/paper.d.ts @@ -1,6 +1,6 @@ // Type definitions for Paper.js v0.9.22 // Project: http://paperjs.org/ -// Definitions by: Clark Stevenson +// Definitions by: Clark Stevenson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module 'paper' { From bef3b8072e56bc74e4619336e0a5f9a99a399844 Mon Sep 17 00:00:00 2001 From: Boriss Nazarovs Date: Sat, 27 Aug 2016 19:00:50 +0300 Subject: [PATCH 005/246] Added type definition for eventemitter3-1.2.0 --- eventemitter3/eventemitter3-1.2.0-tests.ts | 113 ++++++++++++++++++ .../eventemitter3-1.2.0-tests.ts.tscparams | 1 + eventemitter3/eventemitter3-1.2.0.d.ts | 107 +++++++++++++++++ 3 files changed, 221 insertions(+) create mode 100644 eventemitter3/eventemitter3-1.2.0-tests.ts create mode 100644 eventemitter3/eventemitter3-1.2.0-tests.ts.tscparams create mode 100644 eventemitter3/eventemitter3-1.2.0.d.ts diff --git a/eventemitter3/eventemitter3-1.2.0-tests.ts b/eventemitter3/eventemitter3-1.2.0-tests.ts new file mode 100644 index 0000000000..517b8afd72 --- /dev/null +++ b/eventemitter3/eventemitter3-1.2.0-tests.ts @@ -0,0 +1,113 @@ +/// +'use strict'; + +import EventEmitter from 'eventemitter3'; + +const eventName = 'test'; +const eventSymbol: symbol = Symbol('test'); +const fn = () => console.log(1); + +// Extending EventEmitter +class TestEmitter extends EventEmitter { + constructor() { + super(); + } +} + +const ee: TestEmitter = new TestEmitter(); + +// EventEmitter.prefixed +// should be boolean or string static property +const prefix = EventEmitter.prefixed; +if (typeof prefix === 'boolean') { + console.log(prefix.valueOf()); +} else { + console.log(prefix.length); +} + +// EventEmitter.eventNames() +// should return array of strings or symbols +ee.eventNames().every((event) => { + if (typeof event === 'symbol') { + return false; + } else { + return event.length > 0; + } +}); + +// EventEmitter.listeners() +// should return array of functions +ee.listeners(eventName).map((listener) => { + return listener.bind(this); +}); +// should accept symbol as event name +ee.listeners(eventSymbol).map((listener) => { + return listener.bind(this); +}); +// should return boolean with 'exists' flag +const hasListeners: boolean = ee.listeners(eventName, true); + +// EventEmitter.emit() +// should support any number of arguments +ee.emit(eventName, 1, true, {}, [], 'test', Symbol(), null); +// should accept symbol as event name +ee.emit(eventSymbol); + +// EventEmitter.addListener() and EventEmitter.on() +// should accept function +ee.on(eventName, fn); +ee.addListener(eventName, fn); +// should accept optional context argument +ee.on(eventName, fn, this); +ee.addListener(eventName, fn, this); +// should accept symbol as event name +ee.on(eventSymbol, fn); +ee.addListener(eventSymbol, fn); +// should support fluent interface +ee.on(eventSymbol, fn).on(eventName, fn); +ee.addListener(eventSymbol, fn).addListener(eventName, fn); + +// EventEmitter.once() +// should accept event name and function +ee.once(eventName, fn); +// should accept optional context argument +ee.once(eventName, fn, this); +ee.once(eventName, fn, {}); +// should accept symbol as event name +ee.once(eventSymbol, fn); +// should support fluent interface +ee.once(eventSymbol, fn).once(eventName, fn); + +// EventEmitter.removeListener() and EventEmitter.off() +// should accept event name +ee.removeListener(eventName); +ee.off(eventName); +// should accept optional function +ee.removeListener(eventName, fn); +ee.off(eventName, fn); +// should accept optional context argument +ee.removeListener(eventName, fn, {}); +ee.off(eventName, fn, {}); +// should accept optional boolean flag for removing listeners added with `EventEmitter.once()` +ee.removeListener(eventName, fn, null, true); +ee.off(eventName, fn, null, true); +// should accept symbol as event name +ee.removeListener(eventSymbol); +ee.off(eventSymbol); +// should support fluent interface +ee.removeListener(eventName).removeListener(eventSymbol); +ee.off(eventName).off(eventSymbol); + +// EventEmitter.removeAllListeners() +// should not require any arguments +ee.removeAllListeners(); +// should accept optional event name +ee.removeAllListeners(eventName); +// should accept symbol as event name +ee.removeAllListeners(eventSymbol); +// should support fluent interface +ee.removeAllListeners(eventName).removeAllListeners(eventSymbol); + +// EventEmitter.setMaxListeners() +// should support fluent interface +ee.setMaxListeners().setMaxListeners(); diff --git a/eventemitter3/eventemitter3-1.2.0-tests.ts.tscparams b/eventemitter3/eventemitter3-1.2.0-tests.ts.tscparams new file mode 100644 index 0000000000..a0aefcf79a --- /dev/null +++ b/eventemitter3/eventemitter3-1.2.0-tests.ts.tscparams @@ -0,0 +1 @@ +--target es6 --allowSyntheticDefaultImports --noImplicitAny diff --git a/eventemitter3/eventemitter3-1.2.0.d.ts b/eventemitter3/eventemitter3-1.2.0.d.ts new file mode 100644 index 0000000000..ca43aa6c95 --- /dev/null +++ b/eventemitter3/eventemitter3-1.2.0.d.ts @@ -0,0 +1,107 @@ +// Type definitions for EventEmitter3 1.2.0 +// Project: https://github.com/primus/eventemitter3 +// Definitions by: Boriss Nazarovs +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module 'eventemitter3' { + /** + * Minimal EventEmitter interface that is molded against the Node.js + * EventEmitter interface. + */ + class EventEmitter { + constructor(); + + /** + * Return an array listing the events for which the emitter has registered listeners. + * + * @returns {(string|symbol)[]} + */ + eventNames(): (string|symbol)[]; + + /** + * Return the listeners registered for a given event. + * + * @param {(string|symbol)} event The event name. + * @returns {Function[]} + */ + listeners(event: string|symbol): Function[]; + + /** + * Check if there listeners for a given event. + * If `exists` argument is not `true` lists listeners. + * + * @param {(string|symbol)} event The event name. + * @param {boolean} exists Only check if there are listeners. + * @returns {boolean} + */ + listeners(event: string|symbol, exists: boolean): boolean; + + /** + * Calls each of the listeners registered for a given event. + * + * @param {(string|symbol)} event The event name. + * @param {...*} args Arguments that are passed to registered listeners + * @returns {boolean} `true` if the event had listeners, else `false`. + */ + emit(event: string|symbol, ...args: any[]): boolean; + + /** + * Add a listener for a given event. + * + * @param {(string|symbol)} event The event name. + * @param {Function} fn The listener function. + * @param {*} [context=this] The context to invoke the listener with. + * @returns {EventEmitter} `this`. + */ + on(event: string|symbol, fn: Function, context?: any): EventEmitter; + + /** + * Add a one-time listener for a given event. + * + * @param {(string|symbol)} event The event name. + * @param {Function} fn The listener function. + * @param {*} [context=this] The context to invoke the listener with. + * @returns {EventEmitter} `this`. + */ + once(event: string|symbol, fn: Function, context?: any): EventEmitter; + + /** + * Remove the listeners of a given event. + * + * @param {(string|symbol)} event The event name. + * @param {Function} fn Only remove the listeners that match this function. + * @param {*} context Only remove the listeners that have this context. + * @param {boolean} once Only remove one-time listeners. + * @returns {EventEmitter} `this`. + */ + removeListener(event: string|symbol, fn?: Function, context?: any, once?: boolean): EventEmitter; + + /** + * Remove all listeners, or those of the specified event. + * + * @param {(string|symbol)} event The event name. + * @returns {EventEmitter} `this`. + */ + removeAllListeners(event?: string|symbol): EventEmitter; + + /** + * Alias method for `removeListener` + */ + off(event: string|symbol, fn?: Function, context?: any, once?: boolean): EventEmitter; + + /** + * Alias method for `on` + */ + addListener(event: string|symbol, fn: Function, context?: any): EventEmitter; + + /** + * This function doesn't apply anymore. + * @deprecated + */ + setMaxListeners(): EventEmitter; + + static prefixed: string|boolean; + } + + export = EventEmitter; +} From 6ed248d516f1c83b05806be67ece4853b69be792 Mon Sep 17 00:00:00 2001 From: Boriss Nazarovs Date: Thu, 1 Sep 2016 23:52:01 +0300 Subject: [PATCH 006/246] Merged eventemitter3-1.2.0 typings with main typing file --- eventemitter3/eventemitter3-1.2.0-tests.ts | 113 --- eventemitter3/eventemitter3-1.2.0.d.ts | 107 --- eventemitter3/eventemitter3-tests.ts | 673 +++--------------- ...arams => eventemitter3-tests.ts.tscparams} | 0 eventemitter3/eventemitter3.d.ts | 128 ++-- 5 files changed, 157 insertions(+), 864 deletions(-) delete mode 100644 eventemitter3/eventemitter3-1.2.0-tests.ts delete mode 100644 eventemitter3/eventemitter3-1.2.0.d.ts rename eventemitter3/{eventemitter3-1.2.0-tests.ts.tscparams => eventemitter3-tests.ts.tscparams} (100%) diff --git a/eventemitter3/eventemitter3-1.2.0-tests.ts b/eventemitter3/eventemitter3-1.2.0-tests.ts deleted file mode 100644 index 517b8afd72..0000000000 --- a/eventemitter3/eventemitter3-1.2.0-tests.ts +++ /dev/null @@ -1,113 +0,0 @@ -/// -'use strict'; - -import EventEmitter from 'eventemitter3'; - -const eventName = 'test'; -const eventSymbol: symbol = Symbol('test'); -const fn = () => console.log(1); - -// Extending EventEmitter -class TestEmitter extends EventEmitter { - constructor() { - super(); - } -} - -const ee: TestEmitter = new TestEmitter(); - -// EventEmitter.prefixed -// should be boolean or string static property -const prefix = EventEmitter.prefixed; -if (typeof prefix === 'boolean') { - console.log(prefix.valueOf()); -} else { - console.log(prefix.length); -} - -// EventEmitter.eventNames() -// should return array of strings or symbols -ee.eventNames().every((event) => { - if (typeof event === 'symbol') { - return false; - } else { - return event.length > 0; - } -}); - -// EventEmitter.listeners() -// should return array of functions -ee.listeners(eventName).map((listener) => { - return listener.bind(this); -}); -// should accept symbol as event name -ee.listeners(eventSymbol).map((listener) => { - return listener.bind(this); -}); -// should return boolean with 'exists' flag -const hasListeners: boolean = ee.listeners(eventName, true); - -// EventEmitter.emit() -// should support any number of arguments -ee.emit(eventName, 1, true, {}, [], 'test', Symbol(), null); -// should accept symbol as event name -ee.emit(eventSymbol); - -// EventEmitter.addListener() and EventEmitter.on() -// should accept function -ee.on(eventName, fn); -ee.addListener(eventName, fn); -// should accept optional context argument -ee.on(eventName, fn, this); -ee.addListener(eventName, fn, this); -// should accept symbol as event name -ee.on(eventSymbol, fn); -ee.addListener(eventSymbol, fn); -// should support fluent interface -ee.on(eventSymbol, fn).on(eventName, fn); -ee.addListener(eventSymbol, fn).addListener(eventName, fn); - -// EventEmitter.once() -// should accept event name and function -ee.once(eventName, fn); -// should accept optional context argument -ee.once(eventName, fn, this); -ee.once(eventName, fn, {}); -// should accept symbol as event name -ee.once(eventSymbol, fn); -// should support fluent interface -ee.once(eventSymbol, fn).once(eventName, fn); - -// EventEmitter.removeListener() and EventEmitter.off() -// should accept event name -ee.removeListener(eventName); -ee.off(eventName); -// should accept optional function -ee.removeListener(eventName, fn); -ee.off(eventName, fn); -// should accept optional context argument -ee.removeListener(eventName, fn, {}); -ee.off(eventName, fn, {}); -// should accept optional boolean flag for removing listeners added with `EventEmitter.once()` -ee.removeListener(eventName, fn, null, true); -ee.off(eventName, fn, null, true); -// should accept symbol as event name -ee.removeListener(eventSymbol); -ee.off(eventSymbol); -// should support fluent interface -ee.removeListener(eventName).removeListener(eventSymbol); -ee.off(eventName).off(eventSymbol); - -// EventEmitter.removeAllListeners() -// should not require any arguments -ee.removeAllListeners(); -// should accept optional event name -ee.removeAllListeners(eventName); -// should accept symbol as event name -ee.removeAllListeners(eventSymbol); -// should support fluent interface -ee.removeAllListeners(eventName).removeAllListeners(eventSymbol); - -// EventEmitter.setMaxListeners() -// should support fluent interface -ee.setMaxListeners().setMaxListeners(); diff --git a/eventemitter3/eventemitter3-1.2.0.d.ts b/eventemitter3/eventemitter3-1.2.0.d.ts deleted file mode 100644 index ca43aa6c95..0000000000 --- a/eventemitter3/eventemitter3-1.2.0.d.ts +++ /dev/null @@ -1,107 +0,0 @@ -// Type definitions for EventEmitter3 1.2.0 -// Project: https://github.com/primus/eventemitter3 -// Definitions by: Boriss Nazarovs -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare module 'eventemitter3' { - /** - * Minimal EventEmitter interface that is molded against the Node.js - * EventEmitter interface. - */ - class EventEmitter { - constructor(); - - /** - * Return an array listing the events for which the emitter has registered listeners. - * - * @returns {(string|symbol)[]} - */ - eventNames(): (string|symbol)[]; - - /** - * Return the listeners registered for a given event. - * - * @param {(string|symbol)} event The event name. - * @returns {Function[]} - */ - listeners(event: string|symbol): Function[]; - - /** - * Check if there listeners for a given event. - * If `exists` argument is not `true` lists listeners. - * - * @param {(string|symbol)} event The event name. - * @param {boolean} exists Only check if there are listeners. - * @returns {boolean} - */ - listeners(event: string|symbol, exists: boolean): boolean; - - /** - * Calls each of the listeners registered for a given event. - * - * @param {(string|symbol)} event The event name. - * @param {...*} args Arguments that are passed to registered listeners - * @returns {boolean} `true` if the event had listeners, else `false`. - */ - emit(event: string|symbol, ...args: any[]): boolean; - - /** - * Add a listener for a given event. - * - * @param {(string|symbol)} event The event name. - * @param {Function} fn The listener function. - * @param {*} [context=this] The context to invoke the listener with. - * @returns {EventEmitter} `this`. - */ - on(event: string|symbol, fn: Function, context?: any): EventEmitter; - - /** - * Add a one-time listener for a given event. - * - * @param {(string|symbol)} event The event name. - * @param {Function} fn The listener function. - * @param {*} [context=this] The context to invoke the listener with. - * @returns {EventEmitter} `this`. - */ - once(event: string|symbol, fn: Function, context?: any): EventEmitter; - - /** - * Remove the listeners of a given event. - * - * @param {(string|symbol)} event The event name. - * @param {Function} fn Only remove the listeners that match this function. - * @param {*} context Only remove the listeners that have this context. - * @param {boolean} once Only remove one-time listeners. - * @returns {EventEmitter} `this`. - */ - removeListener(event: string|symbol, fn?: Function, context?: any, once?: boolean): EventEmitter; - - /** - * Remove all listeners, or those of the specified event. - * - * @param {(string|symbol)} event The event name. - * @returns {EventEmitter} `this`. - */ - removeAllListeners(event?: string|symbol): EventEmitter; - - /** - * Alias method for `removeListener` - */ - off(event: string|symbol, fn?: Function, context?: any, once?: boolean): EventEmitter; - - /** - * Alias method for `on` - */ - addListener(event: string|symbol, fn: Function, context?: any): EventEmitter; - - /** - * This function doesn't apply anymore. - * @deprecated - */ - setMaxListeners(): EventEmitter; - - static prefixed: string|boolean; - } - - export = EventEmitter; -} diff --git a/eventemitter3/eventemitter3-tests.ts b/eventemitter3/eventemitter3-tests.ts index 6c5733bec7..895dc7f54b 100644 --- a/eventemitter3/eventemitter3-tests.ts +++ b/eventemitter3/eventemitter3-tests.ts @@ -1,586 +1,113 @@ /// -/// -/// 'use strict'; -import EventEmitter = require('eventemitter3'); -import util = require('util'); -import * as EventEmitter3ImportedAsES6Module from 'eventemitter3'; +import EventEmitter from 'eventemitter3'; -declare namespace Assume { - interface Class { - new(...args: any[]): T; - } - - interface Assume { - equals(compare: T): Assume; - equal(compare: T): Assume; - eqls(compare: T): Assume; - is: Assume; - deep: Assume; - to: Assume; - either(arr: T[]): Assume; - instanceOf(clazz: Class): Assume; - a(typeofString: string): Assume; - } - - export function assume(input: T): Assume; -} - -let assume = Assume.assume; - -class EventEmitterTest { - v: EventEmitter3.EventEmitter; +const eventName = 'test'; +const eventSymbol: symbol = Symbol('test'); +const fn = () => console.log(1); +// Extending EventEmitter +class TestEmitter extends EventEmitter { constructor() { - this.v = new EventEmitter(); - this.v = new EventEmitter3ImportedAsES6Module(); - - // Some methods are missing or incompatible with current implementation (v4.2.x) of NodeJS.EventEmitter - // (e.g. getMaxListenters or listeners) - // var n: NodeJS.EventEmitter = this.v; - } - - listeners() { - var v1: Function[] = this.v.listeners('click'); - } - - emit() { - var v1: boolean = this.v.emit('click'); - var v2: boolean = this.v.emit('click', 1); - var v3: boolean = this.v.emit('click', 1, '1'); - var v4: boolean = this.v.emit('click', 1, '1', true); - var v5: boolean = this.v.emit('click', 1, '1', true, new Date()); - } - - on() { - var fn = () => console.log(1); - var v1: EventEmitter3.EventEmitter = this.v.on('click', fn); - var v2: EventEmitter3.EventEmitter = this.v.on('click', fn, this); - } - - once() { - var fn = () => console.log(1); - var v1: EventEmitter3.EventEmitter = this.v.once('click', fn); - var v2: EventEmitter3.EventEmitter = this.v.once('click', fn, this); - } - - removeListener() { - var fn = () => console.log(1); - var v1: EventEmitter3.EventEmitter = this.v.removeListener('click', fn); - var v2: EventEmitter3.EventEmitter = this.v.removeListener('click', fn, true); - } - - removeAllListeners() { - var v1: EventEmitter3.EventEmitter = this.v.removeAllListeners('click'); - } - - off() { - var fn = () => console.log(1); - var v1: EventEmitter3.EventEmitter = this.v.off('click', fn); - var v2: EventEmitter3.EventEmitter = this.v.off('click', fn, true); - } - - addListener() { - var fn = () => console.log(1); - var v1: EventEmitter3.EventEmitter = this.v.addListener('click', fn); - var v2: EventEmitter3.EventEmitter = this.v.addListener('click', fn, this); - } - - setMaxListeners() { - var v1: EventEmitter3.EventEmitter = this.v.setMaxListeners(); + super(); } } +const ee: TestEmitter = new TestEmitter(); -describe('EventEmitter', function tests() { - 'use strict'; +// EventEmitter.prefixed +// should be boolean or string static property +const prefix = EventEmitter.prefixed; +if (typeof prefix === 'boolean') { + console.log(prefix.valueOf()); +} else { + console.log(prefix.length); +} - it('exposes a `prefixed` property', function () { - assume(EventEmitter.prefixed).is.either([false, '~']); - }); - - it('inherits when used with require(util).inherits', function () { - class Beast extends EventEmitter { - /* rawr, i'm a beast */ +// EventEmitter.eventNames() +// should return array of strings or symbols +ee.eventNames().every((event) => { + if (typeof event === 'symbol') { + return false; + } else { + return event.length > 0; } - - class BeastES6 extends EventEmitter3ImportedAsES6Module { - /* rawr, i'm a beast */ - } - - util.inherits(Beast, EventEmitter); - - var moop = new Beast() - , meap = new Beast(); - - assume(moop).is.instanceOf(Beast); - assume(moop).is.instanceOf(EventEmitter); - - moop.listeners(); - meap.listeners(); - - moop.on('data', function () { - throw new Error('I should not emit'); - }); - - meap.emit('data', 'rawr'); - meap.removeListener('foo'); - meap.removeAllListeners(); - }); - - describe('EventEmitter#emit', function () { - it('should return false when there are not events to emit', function () { - var e = new EventEmitter(); - - assume(e.emit('foo')).equals(false); - assume(e.emit('bar')).equals(false); - }); - - it('emits with context', function (done) { - var context = { bar: 'baz' } - , e = new EventEmitter(); - - e.on('foo', function (bar: string) { - assume(bar).equals('bar'); - assume(this).equals(context); - - done(); - }, context).emit('foo', 'bar'); - }); - - it('emits with context, multiple arguments (force apply)', function (done) { - var context = { bar: 'baz' } - , e = new EventEmitter(); - - e.on('foo', function (bar: string) { - assume(bar).equals('bar'); - assume(this).equals(context); - - done(); - }, context).emit('foo', 'bar', 1,2,3,4,5,6,7,8,9,0); - }); - - it('can emit the function with multiple arguments', function () { - var e = new EventEmitter(); - - for(var i = 0; i < 100; i++) { - (function (j: number) { - for (var i = 0, args: number[] = []; i < j; i++) { - args.push(j); - } - - e.once('args', function () { - assume(arguments.length).equals(args.length); - }); - - e.emit.apply(e, (['args'] as any[]).concat(args)); - })(i); - } - }); - - it('can emit the function with multiple arguments, multiple listeners', function () { - var e = new EventEmitter(); - - for(var i = 0; i < 100; i++) { - (function (j: number) { - for (var i = 0, args: number[] = []; i < j; i++) { - args.push(j); - } - - e.once('args', function () { - assume(arguments.length).equals(args.length); - }); - - e.once('args', function () { - assume(arguments.length).equals(args.length); - }); - - e.once('args', function () { - assume(arguments.length).equals(args.length); - }); - - e.once('args', function () { - assume(arguments.length).equals(args.length); - }); - - e.emit.apply(e, (['args'] as any[]).concat(args)); - })(i); - } - }); - - it('emits with context, multiple listeners (force loop)', function () { - var e = new EventEmitter(); - - e.on('foo', function (bar: string) { - assume(this).eqls({ foo: 'bar' }); - assume(bar).equals('bar'); - }, { foo: 'bar' }); - - e.on('foo', function (bar: string) { - assume(this).eqls({ bar: 'baz' }); - assume(bar).equals('bar'); - }, { bar: 'baz' }); - - e.emit('foo', 'bar'); - }); - - it('emits with different contexts', function () { - var e = new EventEmitter() - , pattern = ''; - - function writer() { - pattern += this; - } - - e.on('write', writer, 'foo'); - e.on('write', writer, 'baz'); - e.once('write', writer, 'bar'); - e.once('write', writer, 'banana'); - - e.emit('write'); - assume(pattern).equals('foobazbarbanana'); - }); - - it('should return true when there are events to emit', function (done) { - var e = new EventEmitter(); - - e.on('foo', function () { - process.nextTick(done); - }); - - assume(e.emit('foo')).equals(true); - assume(e.emit('foob')).equals(false); - }); - - it('receives the emitted events', function (done) { - var e = new EventEmitter(); - - e.on('data', function (a: string, b: EventEmitter3.EventEmitter, c: Date, d: void, undef: void) { - assume(a).equals('foo'); - assume(b).equals(e); - assume(c).is.instanceOf(Date); - assume(undef).equals(undefined); - assume(arguments.length).equals(3); - - done(); - }); - - e.emit('data', 'foo', e, new Date()); - }); - - it('emits to all event listeners', function () { - var e = new EventEmitter() - , pattern: string[] = []; - - e.on('foo', function () { - pattern.push('foo1'); - }); - - e.on('foo', function () { - pattern.push('foo2'); - }); - - e.emit('foo'); - - assume(pattern.join(';')).equals('foo1;foo2'); - }); - - (function each(keys: string[]) { - var key = keys.shift(); - - if (!key) return; - - it('can store event which is a known property: '+ key, function (next) { - var e = new EventEmitter(); - - e.on(key, function (key: string) { - assume(key).equals(key); - next(); - }).emit(key, key); - }); - - each(keys); - })([ - 'hasOwnProperty', - 'constructor', - '__proto__', - 'toString', - 'toValue', - 'unwatch', - 'watch' - ]); - }); - - describe('EventEmitter#listeners', function () { - it('returns an empty array if no listeners are specified', function () { - var e = new EventEmitter(); - - assume(e.listeners('foo')).is.a('array'); - assume(e.listeners('foo').length).equals(0); - }); - - it('returns an array of function', function () { - var e = new EventEmitter(); - - function foo() {} - - e.on('foo', foo); - assume(e.listeners('foo')).is.a('array'); - assume(e.listeners('foo').length).equals(1); - assume(e.listeners('foo')).deep.equals([foo]); - }); - - it('is not vulnerable to modifications', function () { - var e = new EventEmitter(); - - function foo() {} - - e.on('foo', foo); - - assume(e.listeners('foo')).deep.equals([foo]); - - e.listeners('foo').length = 0; - assume(e.listeners('foo')).deep.equals([foo]); - }); - - it('can return a boolean as indication if listeners exist', function () { - var e = new EventEmitter(); - - function foo() {} - - e.once('once', foo); - e.once('multiple', foo); - e.once('multiple', foo); - e.on('on', foo); - e.on('multi', foo); - e.on('multi', foo); - - assume(e.listeners('foo', true)).equals(false); - assume(e.listeners('multiple', true)).equals(true); - assume(e.listeners('on', true)).equals(true); - assume(e.listeners('multi', true)).equals(true); - - e.removeAllListeners(); - - assume(e.listeners('multiple', true)).equals(false); - assume(e.listeners('on', true)).equals(false); - assume(e.listeners('multi', true)).equals(false); - }); - }); - - describe('EventEmitter#once', function () { - it('only emits it once', function () { - var e = new EventEmitter() - , calls = 0; - - e.once('foo', function () { - calls++; - }); - - e.emit('foo'); - e.emit('foo'); - e.emit('foo'); - e.emit('foo'); - e.emit('foo'); - - assume(e.listeners('foo').length).equals(0); - assume(calls).equals(1); - }); - - it('only emits once if emits are nested inside the listener', function () { - var e = new EventEmitter() - , calls = 0; - - e.once('foo', function () { - calls++; - e.emit('foo'); - }); - - e.emit('foo'); - assume(e.listeners('foo').length).equals(0); - assume(calls).equals(1); - }); - - it('only emits once for multiple events', function () { - var e = new EventEmitter() - , multi = 0 - , foo = 0 - , bar = 0; - - e.once('foo', function () { - foo++; - }); - - e.once('foo', function () { - bar++; - }); - - e.on('foo', function () { - multi++; - }); - - e.emit('foo'); - e.emit('foo'); - e.emit('foo'); - e.emit('foo'); - e.emit('foo'); - - assume(e.listeners('foo').length).equals(1); - assume(multi).equals(5); - assume(foo).equals(1); - assume(bar).equals(1); - }); - - it('only emits once with context', function (done) { - var context = { foo: 'bar' } - , e = new EventEmitter(); - - e.once('foo', function (bar: string) { - assume(this).equals(context); - assume(bar).equals('bar'); - - done(); - }, context).emit('foo', 'bar'); - }); - }); - - describe('EventEmitter#removeListener', function () { - it('should only remove the event with the specified function', function () { - var e = new EventEmitter(); - - function bar() {} - e.on('foo', function () {}); - e.on('bar', function () {}); - e.on('bar', bar); - - assume(e.removeListener('foo', bar)).equals(e); - assume(e.listeners('foo').length).equals(1); - assume(e.listeners('bar').length).equals(2); - - assume(e.removeListener('foo')).equals(e); - assume(e.listeners('foo').length).equals(0); - assume(e.listeners('bar').length).equals(2); - - assume(e.removeListener('bar', bar)).equals(e); - assume(e.listeners('bar').length).equals(1); - assume(e.removeListener('bar')).equals(e); - assume(e.listeners('bar').length).equals(0); - }); - - it('should only remove once events when using the once flag', function () { - var e = new EventEmitter(); - - function foo() {} - e.on('foo', foo); - - assume(e.removeListener('foo', function () {}, undefined, true)).equals(e); - assume(e.listeners('foo').length).equals(1); - assume(e.removeListener('foo', foo, undefined, true)).equals(e); - assume(e.listeners('foo').length).equals(1); - assume(e.removeListener('foo', foo)).equals(e); - assume(e.listeners('foo').length).equals(0); - - e.on('foo', foo); - e.once('foo', foo); - - assume(e.removeListener('foo', function () {}, undefined, true)).equals(e); - assume(e.listeners('foo').length).equals(2); - assume(e.removeListener('foo', foo, undefined, true)).equals(e); - assume(e.listeners('foo').length).equals(1); - - e.once('foo', foo); - - assume(e.removeListener('foo', foo)).equals(e); - assume(e.listeners('foo').length).equals(0); - }); - - it('should only remove listeners matching the correct context', function () { - var e = new EventEmitter() - , context = { foo: 'bar' }; - - function foo() {} - function bar() {} - e.on('foo', foo, context); - - assume(e.listeners('foo').length).equals(1); - assume(e.removeListener('foo', function () {}, context)).equals(e); - assume(e.listeners('foo').length).equals(1); - assume(e.removeListener('foo', foo, { baz: 'quux' })).equals(e); - assume(e.listeners('foo').length).equals(1); - assume(e.removeListener('foo', foo, context)).equals(e); - assume(e.listeners('foo').length).equals(0); - - e.on('foo', foo, context); - e.on('foo', bar); - - assume(e.listeners('foo').length).equals(2); - assume(e.removeListener('foo', foo, { baz: 'quux' })).equals(e); - assume(e.listeners('foo').length).equals(2); - assume(e.removeListener('foo', foo, context)).equals(e); - assume(e.listeners('foo').length).equals(1); - assume(e.listeners('foo')[0]).equals(bar); - - e.on('foo', foo, context); - - assume(e.listeners('foo').length).equals(2); - assume(e.removeAllListeners('foo')).equals(e); - assume(e.listeners('foo').length).equals(0); - }); - }); - - describe('EventEmitter#removeAllListeners', function () { - it('removes all events for the specified events', function () { - var e = new EventEmitter(); - - e.on('foo', function () { throw new Error('oops'); }); - e.on('foo', function () { throw new Error('oops'); }); - e.on('bar', function () { throw new Error('oops'); }); - e.on('aaa', function () { throw new Error('oops'); }); - - assume(e.removeAllListeners('foo')).equals(e); - assume(e.listeners('foo').length).equals(0); - assume(e.listeners('bar').length).equals(1); - assume(e.listeners('aaa').length).equals(1); - - assume(e.removeAllListeners('bar')).equals(e); - assume(e.removeAllListeners('aaa')).equals(e); - - assume(e.emit('foo')).equals(false); - assume(e.emit('bar')).equals(false); - assume(e.emit('aaa')).equals(false); - }); - - it('just nukes the fuck out of everything', function () { - var e = new EventEmitter(); - - e.on('foo', function () { throw new Error('oops'); }); - e.on('foo', function () { throw new Error('oops'); }); - e.on('bar', function () { throw new Error('oops'); }); - e.on('aaa', function () { throw new Error('oops'); }); - - assume(e.removeAllListeners()).equals(e); - assume(e.listeners('foo').length).equals(0); - assume(e.listeners('bar').length).equals(0); - assume(e.listeners('aaa').length).equals(0); - - assume(e.emit('foo')).equals(false); - assume(e.emit('bar')).equals(false); - assume(e.emit('aaa')).equals(false); - }); - }); - - describe('#setMaxListeners', function () { - it('is a function', function () { - var e = new EventEmitter(); - - assume(e.setMaxListeners).is.a('function'); - }); - - it('returns self when called', function () { - var e = new EventEmitter(); - - assume(e.setMaxListeners()).to.equal(e); - }); - }); }); + +// EventEmitter.listeners() +// should return array of functions +ee.listeners(eventName).map((listener) => { + return listener.bind(this); +}); +// should accept symbol as event name +ee.listeners(eventSymbol).map((listener) => { + return listener.bind(this); +}); +// should return boolean with 'exists' flag +const hasListeners: boolean = ee.listeners(eventName, true); + +// EventEmitter.emit() +// should support any number of arguments +ee.emit(eventName, 1, true, {}, [], 'test', Symbol(), null); +// should accept symbol as event name +ee.emit(eventSymbol); + +// EventEmitter.addListener() and EventEmitter.on() +// should accept function +ee.on(eventName, fn); +ee.addListener(eventName, fn); +// should accept optional context argument +ee.on(eventName, fn, this); +ee.addListener(eventName, fn, this); +// should accept symbol as event name +ee.on(eventSymbol, fn); +ee.addListener(eventSymbol, fn); +// should support fluent interface +ee.on(eventSymbol, fn).on(eventName, fn); +ee.addListener(eventSymbol, fn).addListener(eventName, fn); + +// EventEmitter.once() +// should accept event name and function +ee.once(eventName, fn); +// should accept optional context argument +ee.once(eventName, fn, this); +ee.once(eventName, fn, {}); +// should accept symbol as event name +ee.once(eventSymbol, fn); +// should support fluent interface +ee.once(eventSymbol, fn).once(eventName, fn); + +// EventEmitter.removeListener() and EventEmitter.off() +// should accept event name +ee.removeListener(eventName); +ee.off(eventName); +// should accept optional function +ee.removeListener(eventName, fn); +ee.off(eventName, fn); +// should accept optional context argument +ee.removeListener(eventName, fn, {}); +ee.off(eventName, fn, {}); +// should accept optional boolean flag for removing listeners added with `EventEmitter.once()` +ee.removeListener(eventName, fn, null, true); +ee.off(eventName, fn, null, true); +// should accept symbol as event name +ee.removeListener(eventSymbol); +ee.off(eventSymbol); +// should support fluent interface +ee.removeListener(eventName).removeListener(eventSymbol); +ee.off(eventName).off(eventSymbol); + +// EventEmitter.removeAllListeners() +// should not require any arguments +ee.removeAllListeners(); +// should accept optional event name +ee.removeAllListeners(eventName); +// should accept symbol as event name +ee.removeAllListeners(eventSymbol); +// should support fluent interface +ee.removeAllListeners(eventName).removeAllListeners(eventSymbol); + +// EventEmitter.setMaxListeners() +// should support fluent interface +ee.setMaxListeners().setMaxListeners(); diff --git a/eventemitter3/eventemitter3-1.2.0-tests.ts.tscparams b/eventemitter3/eventemitter3-tests.ts.tscparams similarity index 100% rename from eventemitter3/eventemitter3-1.2.0-tests.ts.tscparams rename to eventemitter3/eventemitter3-tests.ts.tscparams diff --git a/eventemitter3/eventemitter3.d.ts b/eventemitter3/eventemitter3.d.ts index 0d692b8247..ad71b1d49b 100644 --- a/eventemitter3/eventemitter3.d.ts +++ b/eventemitter3/eventemitter3.d.ts @@ -1,123 +1,109 @@ -// Type definitions for EventEmitter3 1.1.1 +// Type definitions for EventEmitter3 1.2.0 // Project: https://github.com/primus/eventemitter3 -// Definitions by: Yuichi Murata , Leon Yu +// Definitions by: Yuichi Murata , Leon Yu , Boriss Nazarovs // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace EventEmitter3 { - interface EventEmitter3Static { - new (): EventEmitter; - prefixed: string | boolean; - } + /** + * Minimal EventEmitter interface that is molded against the Node.js + * EventEmitter interface. + */ class EventEmitter { - /** - * Minimal EventEmitter interface that is molded against the Node.js - * EventEmitter interface. - * - * @constructor - * @api public - */ constructor(); /** - * Return a list of assigned event listeners. + * Return an array listing the events for which the emitter has registered listeners. * - * @param {String} event The events that should be listed. - * @returns {Array} - * @api public + * @returns {(string|symbol)[]} */ - listeners(event?: string): Function[]; + eventNames(): (string|symbol)[]; /** - * Return a list of assigned event listeners. + * Return the listeners registered for a given event. * - * @param {String} event The events that should be listed. - * @param {Boolean} exists We only need to know if there are listeners. - * @returns {Boolean} - * @api public + * @param {(string|symbol)} event The event name. + * @returns {Function[]} */ - listeners(event: string, param: boolean): boolean; + listeners(event: string|symbol): Function[]; /** - * Emit an event to all registered event listeners. + * Check if there listeners for a given event. + * If `exists` argument is not `true` lists listeners. * - * @param {String} event The name of the event. - * @returns {Boolean} Indication if we've emitted an event. - * @api public + * @param {(string|symbol)} event The event name. + * @param {boolean} exists Only check if there are listeners. + * @returns {boolean} */ - emit(event: string, ...args: any[]): boolean; + listeners(event: string|symbol, exists: boolean): boolean; /** - * Register a new EventListener for the given event. + * Calls each of the listeners registered for a given event. * - * @param {String} event Name of the event. - * @param {Function} fn Callback function. - * @param {Mixed} [context=this] The context of the function. - * @api public + * @param {(string|symbol)} event The event name. + * @param {...*} args Arguments that are passed to registered listeners + * @returns {boolean} `true` if the event had listeners, else `false`. */ - on(event: string, fn: Function, context?: any): EventEmitter; + emit(event: string|symbol, ...args: any[]): boolean; /** - * Add an EventListener that's only called once. + * Add a listener for a given event. * - * @param {String} event Name of the event. - * @param {Function} fn Callback function. - * @param {Mixed} [context=this] The context of the function. - * @api public + * @param {(string|symbol)} event The event name. + * @param {Function} fn The listener function. + * @param {*} [context=this] The context to invoke the listener with. + * @returns {EventEmitter} `this`. */ - once(event: string, fn: Function, context?: any): EventEmitter; + on(event: string|symbol, fn: Function, context?: any): EventEmitter; /** - * Remove event listeners. + * Add a one-time listener for a given event. * - * @param {String} event The event we want to remove. - * @param {Function} fn The listener that we need to find. - * @param {Mixed} context Only remove listeners matching this context. - * @param {Boolean} once Only remove once listeners. - * @api public + * @param {(string|symbol)} event The event name. + * @param {Function} fn The listener function. + * @param {*} [context=this] The context to invoke the listener with. + * @returns {EventEmitter} `this`. */ - removeListener(event: string, fn?: Function, context?: any, once?: boolean): EventEmitter; + once(event: string|symbol, fn: Function, context?: any): EventEmitter; /** - * Remove all listeners or only the listeners for the specified event. + * Remove the listeners of a given event. * - * @param {String} event The event want to remove all listeners for. - * @api public + * @param {(string|symbol)} event The event name. + * @param {Function} fn Only remove the listeners that match this function. + * @param {*} context Only remove the listeners that have this context. + * @param {boolean} once Only remove one-time listeners. + * @returns {EventEmitter} `this`. */ - removeAllListeners(event?: string): EventEmitter; + removeListener(event: string|symbol, fn?: Function, context?: any, once?: boolean): EventEmitter; /** - * Remove event listeners. + * Remove all listeners, or those of the specified event. * - * @param {String} event The event we want to remove. - * @param {Function} fn The listener that we need to find. - * @param {Mixed} context Only remove listeners matching this context. - * @param {Boolean} once Only remove once listeners. - * @api public + * @param {(string|symbol)} event The event name. + * @returns {EventEmitter} `this`. */ - off(event: string, fn?: Function, context?: any, once?: boolean): EventEmitter; + removeAllListeners(event?: string|symbol): EventEmitter; /** - * Register a new EventListener for the given event. - * - * @param {String} event Name of the event. - * @param {Function} fn Callback function. - * @param {Mixed} [context=this] The context of the function. - * @api public + * Alias method for `removeListener` */ - addListener(event: string, fn: Function, context?: any): EventEmitter; + off(event: string|symbol, fn?: Function, context?: any, once?: boolean): EventEmitter; + + /** + * Alias method for `on` + */ + addListener(event: string|symbol, fn: Function, context?: any): EventEmitter; /** * This function doesn't apply anymore. * @deprecated */ setMaxListeners(): EventEmitter; + + static prefixed: string|boolean; } } declare module 'eventemitter3' { - // - // Expose the module. - // - var EventEmitter3: EventEmitter3.EventEmitter3Static; - export = EventEmitter3; + export = EventEmitter3.EventEmitter; } From d240f0ad0289e58d73701b8b5667cd973b60a69f Mon Sep 17 00:00:00 2001 From: Boriss Nazarovs Date: Fri, 2 Sep 2016 00:01:37 +0300 Subject: [PATCH 007/246] Added support for fluent interface in classes extending EventEmitter --- eventemitter3/eventemitter3-tests.ts | 18 +++++++++++------- eventemitter3/eventemitter3.d.ts | 14 +++++++------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/eventemitter3/eventemitter3-tests.ts b/eventemitter3/eventemitter3-tests.ts index 895dc7f54b..8af197a80c 100644 --- a/eventemitter3/eventemitter3-tests.ts +++ b/eventemitter3/eventemitter3-tests.ts @@ -12,6 +12,10 @@ class TestEmitter extends EventEmitter { constructor() { super(); } + + test() { + return this; + } } const ee: TestEmitter = new TestEmitter(); @@ -64,8 +68,8 @@ ee.addListener(eventName, fn, this); ee.on(eventSymbol, fn); ee.addListener(eventSymbol, fn); // should support fluent interface -ee.on(eventSymbol, fn).on(eventName, fn); -ee.addListener(eventSymbol, fn).addListener(eventName, fn); +ee.on(eventSymbol, fn).test(); +ee.addListener(eventSymbol, fn).test(); // EventEmitter.once() // should accept event name and function @@ -76,7 +80,7 @@ ee.once(eventName, fn, {}); // should accept symbol as event name ee.once(eventSymbol, fn); // should support fluent interface -ee.once(eventSymbol, fn).once(eventName, fn); +ee.once(eventSymbol, fn).test(); // EventEmitter.removeListener() and EventEmitter.off() // should accept event name @@ -95,8 +99,8 @@ ee.off(eventName, fn, null, true); ee.removeListener(eventSymbol); ee.off(eventSymbol); // should support fluent interface -ee.removeListener(eventName).removeListener(eventSymbol); -ee.off(eventName).off(eventSymbol); +ee.removeListener(eventName).test(); +ee.off(eventName).test(); // EventEmitter.removeAllListeners() // should not require any arguments @@ -106,8 +110,8 @@ ee.removeAllListeners(eventName); // should accept symbol as event name ee.removeAllListeners(eventSymbol); // should support fluent interface -ee.removeAllListeners(eventName).removeAllListeners(eventSymbol); +ee.removeAllListeners(eventName).test(); // EventEmitter.setMaxListeners() // should support fluent interface -ee.setMaxListeners().setMaxListeners(); +ee.setMaxListeners().test(); diff --git a/eventemitter3/eventemitter3.d.ts b/eventemitter3/eventemitter3.d.ts index ad71b1d49b..96af62c94b 100644 --- a/eventemitter3/eventemitter3.d.ts +++ b/eventemitter3/eventemitter3.d.ts @@ -53,7 +53,7 @@ declare namespace EventEmitter3 { * @param {*} [context=this] The context to invoke the listener with. * @returns {EventEmitter} `this`. */ - on(event: string|symbol, fn: Function, context?: any): EventEmitter; + on(event: string|symbol, fn: Function, context?: any): this; /** * Add a one-time listener for a given event. @@ -63,7 +63,7 @@ declare namespace EventEmitter3 { * @param {*} [context=this] The context to invoke the listener with. * @returns {EventEmitter} `this`. */ - once(event: string|symbol, fn: Function, context?: any): EventEmitter; + once(event: string|symbol, fn: Function, context?: any): this; /** * Remove the listeners of a given event. @@ -74,7 +74,7 @@ declare namespace EventEmitter3 { * @param {boolean} once Only remove one-time listeners. * @returns {EventEmitter} `this`. */ - removeListener(event: string|symbol, fn?: Function, context?: any, once?: boolean): EventEmitter; + removeListener(event: string|symbol, fn?: Function, context?: any, once?: boolean): this; /** * Remove all listeners, or those of the specified event. @@ -82,23 +82,23 @@ declare namespace EventEmitter3 { * @param {(string|symbol)} event The event name. * @returns {EventEmitter} `this`. */ - removeAllListeners(event?: string|symbol): EventEmitter; + removeAllListeners(event?: string|symbol): this; /** * Alias method for `removeListener` */ - off(event: string|symbol, fn?: Function, context?: any, once?: boolean): EventEmitter; + off(event: string|symbol, fn?: Function, context?: any, once?: boolean): this; /** * Alias method for `on` */ - addListener(event: string|symbol, fn: Function, context?: any): EventEmitter; + addListener(event: string|symbol, fn: Function, context?: any): this; /** * This function doesn't apply anymore. * @deprecated */ - setMaxListeners(): EventEmitter; + setMaxListeners(): this; static prefixed: string|boolean; } From 6151d69fadae62c9a4636a0736b0820b53f44e44 Mon Sep 17 00:00:00 2001 From: Boriss Nazarovs Date: Sat, 24 Sep 2016 14:37:30 +0300 Subject: [PATCH 008/246] Updated import in tests to use standard TypeScript import syntax --- eventemitter3/eventemitter3-tests.ts | 4 ++-- eventemitter3/eventemitter3-tests.ts.tscparams | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eventemitter3/eventemitter3-tests.ts b/eventemitter3/eventemitter3-tests.ts index 8af197a80c..77d84093cf 100644 --- a/eventemitter3/eventemitter3-tests.ts +++ b/eventemitter3/eventemitter3-tests.ts @@ -1,10 +1,10 @@ /// 'use strict'; -import EventEmitter from 'eventemitter3'; +import EventEmitter = require('eventemitter3'); const eventName = 'test'; -const eventSymbol: symbol = Symbol('test'); +const eventSymbol = Symbol('test'); const fn = () => console.log(1); // Extending EventEmitter diff --git a/eventemitter3/eventemitter3-tests.ts.tscparams b/eventemitter3/eventemitter3-tests.ts.tscparams index a0aefcf79a..30c9419a57 100644 --- a/eventemitter3/eventemitter3-tests.ts.tscparams +++ b/eventemitter3/eventemitter3-tests.ts.tscparams @@ -1 +1 @@ ---target es6 --allowSyntheticDefaultImports --noImplicitAny +-m commonjs From e79245412e9faeb362cac8e46beb1a8767e2f88d Mon Sep 17 00:00:00 2001 From: gatsbimantico Date: Wed, 28 Sep 2016 21:21:30 +0200 Subject: [PATCH 009/246] gapi.analytics --- gapi.analytics/gapi.analytics.d.ts | 124 +++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 gapi.analytics/gapi.analytics.d.ts diff --git a/gapi.analytics/gapi.analytics.d.ts b/gapi.analytics/gapi.analytics.d.ts new file mode 100644 index 0000000000..36cca1263c --- /dev/null +++ b/gapi.analytics/gapi.analytics.d.ts @@ -0,0 +1,124 @@ +// Type definitions for Google Analytics API + +/// + +declare namespace gapi.client.analytics {} +declare namespace gapi.client.analytics.provisioning { + export function createAccountTicket() : Promise; +} + +interface DataQuery { + "ids" ?: string; + "start-date" ?: string; + "30daysAgo" ?: string; + "end-date" ?: string; + "yesterday" ?: string; + "metrics" ?: string; + "dimensions" ?: string; + "sort" ?: string; + "filters" ?: string; + "segment" ?: string; + "samplingLevel" ?: string; + "include-empty-rows" ?: string; + "start-index" ?: string; + "max-results" ?: string; +} +declare namespace gapi.client.analytics.data {} +declare namespace gapi.client.analytics.data.ga { + export function get(data ?: DataQuery) : Promise; +} +declare namespace gapi.client.analytics.data.mcf { + export function get(data ?: DataQuery) : Promise; +} +declare namespace gapi.client.analytics.data.realtime { + export function get(data ?: DataQuery) : Promise; +} + +interface AnalyticsParameter { + "type" ?: string; + "description" ?: string; + "default" ?: string; + "enum" ?: string[]; + "enumDescriptions" ?: string[]; + "location" ?: string; +} +declare namespace gapi.client.analytics.kB { + export class parameters { + alt: AnalyticsParameter; + fields: AnalyticsParameter; + key: AnalyticsParameter; + oauth_token: AnalyticsParameter; + prettyPrint: AnalyticsParameter; + quotaUser: AnalyticsParameter; + userIP: AnalyticsParameter; + } +} + +interface View { + accountId ?: string; + webPropertyId ?: string; + webViewId ?: string; +} +declare namespace gapi.client.analytics.management {} +declare namespace gapi.client.analytics.managementaccountSummaries { + export function list(view ?: View) : Promise; +} +declare namespace gapi.client.analytics.managementaccountUserLinks { + export function list(view ?: View) : Promise; +} +declare namespace gapi.client.analytics.management.accounts { + export function list(view ?: View) : Promise; +} +declare namespace gapi.client.analytics.management.customDataSources { + export function list(view ?: View) : Promise; +} +declare namespace gapi.client.analytics.management.customDimensions { + export function list(view ?: View) : Promise; +} +declare namespace gapi.client.analytics.management.customMetrics { + export function list(view ?: View) : Promise; +} +declare namespace gapi.client.analytics.management.experiments { + export function list(view ?: View) : Promise; +} +declare namespace gapi.client.analytics.management.filters { + export function list(view ?: View) : Promise; +} +declare namespace gapi.client.analytics.management.goals { + export function list(view ?: View) : Promise; +} +declare namespace gapi.client.analytics.management.profileFilterLinks { + export function list(view ?: View) : Promise; +} +declare namespace gapi.client.analytics.management.profileUserLinks { + export function list(view ?: View) : Promise; +} +declare namespace gapi.client.analytics.management.profiles { + export function list(view ?: View) : Promise; +} +declare namespace gapi.client.analytics.management.remarketingAudience { + export function list(view ?: View) : Promise; +} +declare namespace gapi.client.analytics.management.segments { + export function list(view ?: View) : Promise; +} +declare namespace gapi.client.analytics.management.unsampledReports { + export function list(view ?: View) : Promise; +} +declare namespace gapi.client.analytics.management.uploads { + export function list(view ?: View) : Promise; +} +declare namespace gapi.client.analytics.management.webPropertyAdWordsLinks { + export function list(view ?: View) : Promise; +} +declare namespace gapi.client.analytics.management.webproperties { + export function list(view ?: View) : Promise; +} +declare namespace gapi.client.analytics.management.webpropertyUserLinks { + export function list(view ?: View) : Promise; +} + +declare namespace gapi.client.analytics.metadata {} +declare namespace gapi.client.analytics.metadata.column { + export function list() : Promise; +} From 93a4381634e2d4d50e925b5218f63455ce4d9022 Mon Sep 17 00:00:00 2001 From: gatsbimantico Date: Thu, 29 Sep 2016 14:09:42 +0200 Subject: [PATCH 010/246] added gapi.analytics-tests and a few corrections --- gapi.analytics/gapi.analytics-tests.ts | 67 ++++++++++++++++++++++++++ gapi.analytics/gapi.analytics.d.ts | 40 +++++++-------- 2 files changed, 87 insertions(+), 20 deletions(-) create mode 100644 gapi.analytics/gapi.analytics-tests.ts diff --git a/gapi.analytics/gapi.analytics-tests.ts b/gapi.analytics/gapi.analytics-tests.ts new file mode 100644 index 0000000000..711fffeca9 --- /dev/null +++ b/gapi.analytics/gapi.analytics-tests.ts @@ -0,0 +1,67 @@ +// Type definitions for Google Analytics API + +/// +/// +/// + +function test_namespace() { + var analytics : boolean = gapi.client.analytics instanceof Object; + + var provisioning : boolean = gapi.client.analytics.provisioning.createAccountTicket instanceof Function; + analytics = analytics && provisioning; + + var data : boolean = gapi.client.analytics.data.ga.get instanceof Function; + data = data && gapi.client.analytics.data.mcf.get instanceof Function; + data = data && gapi.client.analytics.data.realtime.get instanceof Function; + analytics = analytics && data; + + interface AnalyticsParameter { + "type" ?: string; + "description" ?: string; + "default" ?: string; + "enum" ?: string[]; + "enumDescriptions" ?: string[]; + "location" ?: string; + } + var kBI : AnalyticsParameter = gapi.client.analytics.kB.parameters.alt; + var kB = !!kBI; + kBI = gapi.client.analytics.kB.parameters.fields; + kB = kB && !!kBI; + kBI = gapi.client.analytics.kB.parameters.key; + kB = kB && !!kBI; + kBI = gapi.client.analytics.kB.parameters.oauth_token; + kB = kB && !!kBI; + kBI = gapi.client.analytics.kB.parameters.prettyPrint; + kB = kB && !!kBI; + kBI = gapi.client.analytics.kB.parameters.quotaUser; + kB = kB && !!kBI; + kBI = gapi.client.analytics.kB.parameters.userIP; + kB = kB && !!kBI; + analytics = analytics && kB; + + var management : boolean = gapi.client.analytics.management.accountSummaries.list instanceof Function; + management = management && gapi.client.analytics.management.accountUserLinks.list instanceof Function; + management = management && gapi.client.analytics.management.accounts.list instanceof Function; + management = management && gapi.client.analytics.management.customDataSources.list instanceof Function; + management = management && gapi.client.analytics.management.customDimensions.list instanceof Function; + management = management && gapi.client.analytics.management.customMetrics.list instanceof Function; + management = management && gapi.client.analytics.management.experiments.list instanceof Function; + management = management && gapi.client.analytics.management.filters.list instanceof Function; + management = management && gapi.client.analytics.management.goals.list instanceof Function; + management = management && gapi.client.analytics.management.profileFilterLinks.list instanceof Function; + management = management && gapi.client.analytics.management.profileUserLinks.list instanceof Function; + management = management && gapi.client.analytics.management.profiles.list instanceof Function; + management = management && gapi.client.analytics.management.remarketingAudience.list instanceof Function; + management = management && gapi.client.analytics.management.segments.list instanceof Function; + management = management && gapi.client.analytics.management.unsampledReports.list instanceof Function; + management = management && gapi.client.analytics.management.uploads.list instanceof Function; + management = management && gapi.client.analytics.management.webPropertyAdWordsLinks.list instanceof Function; + management = management && gapi.client.analytics.management.webproperties.list instanceof Function; + management = management && gapi.client.analytics.management.webpropertyUserLinks.list instanceof Function; + analytics = analytics && management; + + var metadata : boolean = gapi.client.analytics.metadata.column.list instanceof Function; + analytics = analytics && metadata; + + return analytics; +} diff --git a/gapi.analytics/gapi.analytics.d.ts b/gapi.analytics/gapi.analytics.d.ts index 36cca1263c..f89e015de8 100644 --- a/gapi.analytics/gapi.analytics.d.ts +++ b/gapi.analytics/gapi.analytics.d.ts @@ -1,5 +1,6 @@ // Type definitions for Google Analytics API +/// /// declare namespace gapi.client.analytics {} @@ -34,24 +35,23 @@ declare namespace gapi.client.analytics.data.realtime { export function get(data ?: DataQuery) : Promise; } -interface AnalyticsParameter { - "type" ?: string; - "description" ?: string; - "default" ?: string; - "enum" ?: string[]; - "enumDescriptions" ?: string[]; - "location" ?: string; -} -declare namespace gapi.client.analytics.kB { - export class parameters { - alt: AnalyticsParameter; - fields: AnalyticsParameter; - key: AnalyticsParameter; - oauth_token: AnalyticsParameter; - prettyPrint: AnalyticsParameter; - quotaUser: AnalyticsParameter; - userIP: AnalyticsParameter; - } +declare namespace gapi.client.analytics.kB {} +declare namespace gapi.client.analytics.kB.parameters { + export interface AnalyticsParameter { + "type" ?: string; + "description" ?: string; + "default" ?: string; + "enum" ?: string[]; + "enumDescriptions" ?: string[]; + "location" ?: string; + } + export class alt implements AnalyticsParameter {} + export class fields implements AnalyticsParameter {} + export class key implements AnalyticsParameter {} + export class oauth_token implements AnalyticsParameter {} + export class prettyPrint implements AnalyticsParameter {} + export class quotaUser implements AnalyticsParameter {} + export class userIP implements AnalyticsParameter {} } interface View { @@ -60,10 +60,10 @@ interface View { webViewId ?: string; } declare namespace gapi.client.analytics.management {} -declare namespace gapi.client.analytics.managementaccountSummaries { +declare namespace gapi.client.analytics.management.accountSummaries { export function list(view ?: View) : Promise; } -declare namespace gapi.client.analytics.managementaccountUserLinks { +declare namespace gapi.client.analytics.management.accountUserLinks { export function list(view ?: View) : Promise; } declare namespace gapi.client.analytics.management.accounts { From 00272360284225ccf9fae6b2b32846114862c1c4 Mon Sep 17 00:00:00 2001 From: gatsbimantico Date: Thu, 29 Sep 2016 14:12:24 +0200 Subject: [PATCH 011/246] Tested with --target es6 --- gapi.analytics/gapi.analytics-tests.ts | 1 - gapi.analytics/gapi.analytics.d.ts | 1 - 2 files changed, 2 deletions(-) diff --git a/gapi.analytics/gapi.analytics-tests.ts b/gapi.analytics/gapi.analytics-tests.ts index 711fffeca9..a6aea00796 100644 --- a/gapi.analytics/gapi.analytics-tests.ts +++ b/gapi.analytics/gapi.analytics-tests.ts @@ -1,6 +1,5 @@ // Type definitions for Google Analytics API -/// /// /// diff --git a/gapi.analytics/gapi.analytics.d.ts b/gapi.analytics/gapi.analytics.d.ts index f89e015de8..da9b81cb68 100644 --- a/gapi.analytics/gapi.analytics.d.ts +++ b/gapi.analytics/gapi.analytics.d.ts @@ -1,6 +1,5 @@ // Type definitions for Google Analytics API -/// /// declare namespace gapi.client.analytics {} From d7fb4e38081924e1a92acdb1fa6f196581467da5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20S=C3=A4nger?= Date: Thu, 29 Sep 2016 15:23:23 +0200 Subject: [PATCH 012/246] use correct richselect.getList() return type --- webix/webix.d.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/webix/webix.d.ts b/webix/webix.d.ts index 7931ef83d9..1936102a6d 100644 --- a/webix/webix.d.ts +++ b/webix/webix.d.ts @@ -5941,7 +5941,10 @@ interface richselect extends webix.ui.baseview{ getChildViews():any[]; getFormView():webix.ui.baseview; getInputNode():HTMLElement; - getList():webix.ui.baseview; + /** + * returns list view of the control + */ + getList():webix.ui.list; getNode():any; getParentView():any; getPopup():webix.ui.baseview; From 724ceafbde3450d4afb3797c6c73141e862e75e0 Mon Sep 17 00:00:00 2001 From: Ian Ker-Seymer Date: Fri, 30 Sep 2016 15:45:41 -0400 Subject: [PATCH 013/246] react-ga: add set method definition --- react-ga/react-ga-tests.tsx | 27 ++++++++++++++++++++------- react-ga/react-ga.d.ts | 5 +++++ 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/react-ga/react-ga-tests.tsx b/react-ga/react-ga-tests.tsx index 2248665dd9..1dd6e04bd7 100644 --- a/react-ga/react-ga-tests.tsx +++ b/react-ga/react-ga-tests.tsx @@ -8,11 +8,11 @@ describe("Testing react-ga initialize object", () => { }); it("Able to initailize react-ga object", () => { let ga = __reactGA; - + let options: __reactGA.InitializeOptions = { debug: true, } - + ga.initialize("UA-65432-1", options); }); }); @@ -21,7 +21,7 @@ describe("Testing react-ga pageview calls", () => { it("Able to make pageview calls", () => { let ga = __reactGA; ga.initialize("UA-65432-1"); - + ga.pageview("http://telshin.com"); }); }); @@ -30,7 +30,7 @@ describe("Testing react-ga modal calls", () => { it("Able to make modal calls", () => { let ga = __reactGA; ga.initialize("UA-65432-1"); - + ga.modalview("Test modal"); }); }); @@ -39,7 +39,7 @@ describe("Testing react-ga event calls", () => { it("Able to make event calls", () => { let ga = __reactGA; ga.initialize("UA-65432-1"); - + let options: __reactGA.EventArgs = { category: "Test", action: "CI", @@ -47,7 +47,20 @@ describe("Testing react-ga event calls", () => { value: 4, nonInteraction: true, } - + ga.event(options); }); -}); \ No newline at end of file +}); + +describe("Testing react-ga set calls", () => { + it("Able to make set calls", () => { + let ga = __reactGA; + ga.initialize("UA-65432-1"); + + let fieldObject: __reactGA.FieldsObject = { + page: '/users' + }; + + ga.set(fieldObject); + }); +}); diff --git a/react-ga/react-ga.d.ts b/react-ga/react-ga.d.ts index 3a80651dc1..0a0973113b 100644 --- a/react-ga/react-ga.d.ts +++ b/react-ga/react-ga.d.ts @@ -16,10 +16,15 @@ declare namespace __reactGA { debug?: boolean; } + export interface FieldsObject { + [i: string]: any; + } + export function initialize(trackingCode: string, options?: InitializeOptions): void; export function pageview(path: string): void; export function modalview(name: string): void; export function event(args: EventArgs): void; + export function set(fieldsObject: FieldsObject): void; } declare module 'react-ga' { From bd0de57f3c3ace8d08f5ccc5b89ef5ae1966922c Mon Sep 17 00:00:00 2001 From: Ron Zeidman Date: Mon, 10 Oct 2016 16:02:41 +0300 Subject: [PATCH 014/246] Error object fix Source: https://github.com/hapijs/joi/blob/master/API.md#errors ## Errors Joi throws classical javascript `Error`s containing : - `name` - `'ValidationError'`. - `isJoi` - `true`. - `details` - an array of errors : - `message` - string with a description of the error. - `path` - dotted path to the key where the error happened. - `type` - type of the error. - `context` - object providing context of the error. - `annotate` - function that returns a string with an annotated version of the object pointing at the places where errors occured. - `_object` - the original object to validate. --- joi/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/joi/index.d.ts b/joi/index.d.ts index ece6bb6d62..0b2cf1e8cb 100644 --- a/joi/index.d.ts +++ b/joi/index.d.ts @@ -121,17 +121,17 @@ export interface IPOptions { } export interface ValidationError extends Error { - message: string; + isJoi: boolean; details: ValidationErrorItem[]; - simple(): string; - annotated(): string; + annotate(): string; + _object: any; } export interface ValidationErrorItem { message: string; type: string; path: string; - options?: ValidationOptions; + context?: any; } export interface ValidationResult { From db86a7a621d9fe465f433ab6cf89e91952ff1d32 Mon Sep 17 00:00:00 2001 From: Ron Zeidman Date: Mon, 10 Oct 2016 16:05:26 +0300 Subject: [PATCH 015/246] Update joi-tests.ts --- joi/joi-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/joi/joi-tests.ts b/joi/joi-tests.ts index eb0f147f78..557146cabc 100644 --- a/joi/joi-tests.ts +++ b/joi/joi-tests.ts @@ -125,7 +125,7 @@ validErrItem = { message: str, type: str, path: str, - options: validOpts + context: obj }; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- From f116c1260178815885ad43ff7497f91abfb1fbc8 Mon Sep 17 00:00:00 2001 From: Ron Zeidman Date: Tue, 11 Oct 2016 09:47:42 +0300 Subject: [PATCH 016/246] Update index.d.ts Options does exist --- joi/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/joi/index.d.ts b/joi/index.d.ts index 0b2cf1e8cb..c192f49dd1 100644 --- a/joi/index.d.ts +++ b/joi/index.d.ts @@ -131,6 +131,7 @@ export interface ValidationErrorItem { message: string; type: string; path: string; + options?: ValidationOptions; context?: any; } From a388c6c5f9de3a3ba8afdf866a69e35e6ff44de2 Mon Sep 17 00:00:00 2001 From: Ron Zeidman Date: Tue, 11 Oct 2016 09:50:15 +0300 Subject: [PATCH 017/246] Update joi-tests.ts options does exist --- joi/joi-tests.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/joi/joi-tests.ts b/joi/joi-tests.ts index 557146cabc..759be529ad 100644 --- a/joi/joi-tests.ts +++ b/joi/joi-tests.ts @@ -125,6 +125,7 @@ validErrItem = { message: str, type: str, path: str, + options: validOpts, context: obj }; From 76d8d5f439ea7ad02e5980950c0efc004bc9034e Mon Sep 17 00:00:00 2001 From: Joakim Gunst Date: Thu, 13 Oct 2016 12:26:36 +0300 Subject: [PATCH 018/246] Fixed bugs in angular-permission 2.3.6 type defintions. --- angular-permission/index.d.ts | 45 +++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/angular-permission/index.d.ts b/angular-permission/index.d.ts index 0b8d06f32a..8c03a79642 100644 --- a/angular-permission/index.d.ts +++ b/angular-permission/index.d.ts @@ -30,8 +30,8 @@ declare module 'angular' { * @param validationFunction {Function} Function used to validate if permission is valid */ definePermission( - name: string, - validationFunction: (permission?: string, transitionProperties?: TransitionProperties) => boolean | angular.IPromise + permissionName: string, + validationFunction: PermissionValidationFunction ): void; /** @@ -43,10 +43,14 @@ declare module 'angular' { * @param validationFunction {Function} Function used to validate if permission is valid */ defineManyPermissions( - permissions: string[], - validationFunction: (permission?: string, transitionProperties?: TransitionProperties) => boolean | angular.IPromise + permissionNames: string[], + validationFunction: PermissionValidationFunction ): void; + /** + * Removes all permissions + * @method + */ clearStore(): void; /** @@ -55,7 +59,7 @@ declare module 'angular' { * * @param permissionName {String} Name of defined permission */ - removePermissionDefinition(permission: string): void; + removePermissionDefinition(permissionName: string): void; /** * Checks if permission exists @@ -66,13 +70,21 @@ declare module 'angular' { */ hasPermissionDefinition(permissionName: string): boolean; + /** + * Returns permission by it's name + * @method + * + * @returns {permission.Permission} Permissions definition object + */ + getPermissionDefinition(permissionName: string): Permission; + /** * Returns all permissions * @method * * @returns {Object} Permissions collection */ - getStore(): Permission[]; + getStore(): {[permissionName: string]: Permission}; } export interface RoleStore { @@ -85,8 +97,8 @@ declare module 'angular' { * @param [validationFunction] {Function} Function used to validate if permissions in role are valid */ defineRole( - role: string, - permissions: Array, + roleName: string, + permissions: string[], validationFunction: RoleValidationFunction ): void; @@ -97,7 +109,10 @@ declare module 'angular' { * @param roleName {String} Name of defined role * @param permissions {Array} Set of permission names */ - defineRole(role: string, permissions: Array): void; + defineRole( + roleName: string, + permissions: string[] + ): void; /** * Checks if role is defined in store @@ -106,7 +121,7 @@ declare module 'angular' { * @param roleName {String} Name of role * @returns {Boolean} */ - hasRoleDefinition(role: string): boolean; + hasRoleDefinition(roleName: string): boolean; /** * Returns role definition object by it's name @@ -136,7 +151,7 @@ declare module 'angular' { * * @returns {Object} Defined roles collection */ - getStore(): Role[]; + getStore(): {[roleName: string]: Role}; } export interface Role { @@ -150,12 +165,12 @@ declare module 'angular' { validationFunction?: PermissionValidationFunction; } - interface RoleValidationFunction { - (permission?: string, transitionProperties?: TransitionProperties): boolean | angular.IPromise; + export interface RoleValidationFunction { + (roleName?: string, transitionProperties?: TransitionProperties): boolean | angular.IPromise; } - interface PermissionValidationFunction { - (permission?: string, transitionProperties?: TransitionProperties): boolean | angular.IPromise; + export interface PermissionValidationFunction { + (permissionName?: string, transitionProperties?: TransitionProperties): boolean | angular.IPromise; } export interface IPermissionState extends angular.ui.IState { From 5cd9600ed26230241d177b557bf558e232c1112b Mon Sep 17 00:00:00 2001 From: Joakim Gunst Date: Thu, 13 Oct 2016 14:28:41 +0300 Subject: [PATCH 019/246] Updated tests. --- angular-permission/angular-permission-tests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/angular-permission/angular-permission-tests.ts b/angular-permission/angular-permission-tests.ts index 4f3a35f5df..051ace69b8 100644 --- a/angular-permission/angular-permission-tests.ts +++ b/angular-permission/angular-permission-tests.ts @@ -66,7 +66,7 @@ angular PermissionStore.removePermissionDefinition('user'); - let permissions: Array = PermissionStore.getStore(); + let permissions = PermissionStore.getStore(); }); @@ -90,5 +90,5 @@ angular RoleStore.removeRoleDefinition('user'); - let roles: Array = RoleStore.getStore(); + let roles = RoleStore.getStore(); }); From 76c4a34b96dbf795207dc132b1725cc95463c1ee Mon Sep 17 00:00:00 2001 From: Joakim Gunst Date: Thu, 13 Oct 2016 17:12:14 +0300 Subject: [PATCH 020/246] Removed redeclared 'cache' variable in 'ejs' that caused tests to fail. --- ejs/index.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/ejs/index.d.ts b/ejs/index.d.ts index b0f4bfeaa3..9f617287b7 100644 --- a/ejs/index.d.ts +++ b/ejs/index.d.ts @@ -62,7 +62,6 @@ declare namespace Ejs { set(key: string, val: any): any; get(key: string): any; } - var cache: Cache; function resolve(from1: string, to: string): string; function resolve(from1: string, from2: string, to: string): string; function resolve(from1: string, from2: string, from3: string, to: string): string; From 9b10e5ccd7aa30d89ed56a19d7c0d41893e6e13a Mon Sep 17 00:00:00 2001 From: Joakim Gunst Date: Fri, 14 Oct 2016 08:21:44 +0300 Subject: [PATCH 021/246] Fixes and improvements to angular-permission. --- angular-permission/index.d.ts | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/angular-permission/index.d.ts b/angular-permission/index.d.ts index 8c03a79642..5d4b7f74c8 100644 --- a/angular-permission/index.d.ts +++ b/angular-permission/index.d.ts @@ -84,7 +84,7 @@ declare module 'angular' { * * @returns {Object} Permissions collection */ - getStore(): {[permissionName: string]: Permission}; + getStore(): { [permissionName: string]: Permission }; } export interface RoleStore { @@ -110,7 +110,7 @@ declare module 'angular' { * @param permissions {Array} Set of permission names */ defineRole( - roleName: string, + roleName: string, permissions: string[] ): void; @@ -151,7 +151,7 @@ declare module 'angular' { * * @returns {Object} Defined roles collection */ - getStore(): {[roleName: string]: Role}; + getStore(): { [roleName: string]: Role }; } export interface Role { @@ -165,13 +165,15 @@ declare module 'angular' { validationFunction?: PermissionValidationFunction; } - export interface RoleValidationFunction { - (roleName?: string, transitionProperties?: TransitionProperties): boolean | angular.IPromise; - } + export type RoleValidationFunction = ( + roleName?: string, + transitionProperties?: TransitionProperties + ) => boolean | angular.IPromise; - export interface PermissionValidationFunction { - (permissionName?: string, transitionProperties?: TransitionProperties): boolean | angular.IPromise; - } + export type PermissionValidationFunction = ( + permissionName?: string, + transitionProperties?: TransitionProperties + ) => boolean | angular.IPromise; export interface IPermissionState extends angular.ui.IState { data?: any | DataWithPermissions; @@ -179,8 +181,8 @@ declare module 'angular' { export interface DataWithPermissions { permissions?: { - only?: (() => void) | Array | angular.IPromise; - except?: (() => void) | Array | angular.IPromise; + only?: (() => void) | string | string[] | angular.IPromise; + except?: (() => void) | string | string[] | angular.IPromise; redirectTo: string | (() => string) | (() => PermissionRedirectConfigation) | { [index: string]: PermissionRedirectConfigation } }; } From 12f1b0a5571004f91b79a0d9c0aeb51957db92b4 Mon Sep 17 00:00:00 2001 From: Joakim Gunst Date: Fri, 14 Oct 2016 11:07:18 +0300 Subject: [PATCH 022/246] Added validate methods to Role and Permission in angular-permission. --- angular-permission/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/angular-permission/index.d.ts b/angular-permission/index.d.ts index 5d4b7f74c8..28781cb5df 100644 --- a/angular-permission/index.d.ts +++ b/angular-permission/index.d.ts @@ -158,11 +158,13 @@ declare module 'angular' { roleName: string; permissionNames: string[]; validationFunction?: RoleValidationFunction; + validateRole: () => angular.IPromise; } export interface Permission { permissionName: string; validationFunction?: PermissionValidationFunction; + validatePermission: () => angular.IPromise; } export type RoleValidationFunction = ( From 9f9210d7af2ebe1356fee4f16b8807af364a00e1 Mon Sep 17 00:00:00 2001 From: Christian Rackerseder Date: Wed, 19 Oct 2016 16:04:00 +0200 Subject: [PATCH 023/246] Fixed types for ora v0.3.0 --- ora/index.d.ts | 52 +++++++++++++++++++++++++++++------------------- ora/ora-tests.ts | 3 +-- 2 files changed, 33 insertions(+), 22 deletions(-) diff --git a/ora/index.d.ts b/ora/index.d.ts index e58b5575c7..f5db7383e7 100644 --- a/ora/index.d.ts +++ b/ora/index.d.ts @@ -1,25 +1,37 @@ -// Type definitions for ora +// Type definitions for ora v0.3.0 // Project: https://github.com/sindresorhus/ora -// Definitions by: Basarat Ali Syed +// Definitions by: Christian Rackerseder // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/// -type Color = 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'gray'; -type Text = string; -interface Options { - text?: Text; - spinner?: string | { interval?: number; frames: string[]; } - color?: Color; - stream?: any; +declare module "ora" { + type Color = 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'gray'; + type Text = string; + interface Options { + text?: Text; + spinner?: string | Spinner; + color?: Color; + interval?: number; + stream?: NodeJS.WritableStream; + enabled?: boolean; + } + interface Spinner { + interval?: number; + frames: string[]; + } + interface Instance { + start(): Instance; + stop(): Instance; + succeed(): Instance; + fail(): Instance; + stopAndPersist(symbol?: string): Instance; + clear(): Instance; + render(): Instance; + frame(): Instance; + text: string; + color: Color; + } + function ora(options: Options | Text): Instance; + export = ora; } -interface Instance { - start(): void; - stop(): void; - clear(): void; - frame(): void; - render(): void; - text: Text; - color: Color; -} -declare function ora(options: Options | Text): Instance; -export = ora; diff --git a/ora/ora-tests.ts b/ora/ora-tests.ts index 7116db78ce..32e39aa753 100644 --- a/ora/ora-tests.ts +++ b/ora/ora-tests.ts @@ -1,8 +1,7 @@ import ora = require('ora'); -const spinner = ora('Loading unicorns'); -spinner.start(); +const spinner = ora('Loading unicorns').start(); setTimeout(() => { spinner.color = 'yellow'; From a661b359b5255a7993507db32d9febb6d0d07b93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Jeancolas?= Date: Wed, 19 Oct 2016 13:46:53 -0400 Subject: [PATCH 024/246] [material-ui] Add onKeyDown event on TextFieldProps interface --- 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 c096cfd6ae..475b719bea 100644 --- a/material-ui/material-ui.d.ts +++ b/material-ui/material-ui.d.ts @@ -1663,6 +1663,7 @@ declare namespace __MaterialUI { onBlur?: React.FocusEventHandler; onChange?: React.FormEventHandler; onFocus?: React.FocusEventHandler; + onKeyDown?: React.KeyboardEventHandler; rows?: number, rowsMax?: number, style?: React.CSSProperties; From f572efa5593cb23f4f0003ec811b62a0d36a240c Mon Sep 17 00:00:00 2001 From: Christian Rackerseder Date: Thu, 20 Oct 2016 06:48:41 +0200 Subject: [PATCH 025/246] Fixed names in // Definitions --- ora/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ora/index.d.ts b/ora/index.d.ts index f5db7383e7..6e06bd35ec 100644 --- a/ora/index.d.ts +++ b/ora/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for ora v0.3.0 // Project: https://github.com/sindresorhus/ora -// Definitions by: Christian Rackerseder +// Definitions by: Basarat Ali Syed , Christian Rackerseder // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// From 38960a30f9516850dc78b3c1abbe33662ea72f79 Mon Sep 17 00:00:00 2001 From: feng zhi hao Date: Fri, 21 Oct 2016 16:43:35 +0800 Subject: [PATCH 026/246] add @types/history dependency --- react-router/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/react-router/index.d.ts b/react-router/index.d.ts index 8dfc205478..f3984853cd 100644 --- a/react-router/index.d.ts +++ b/react-router/index.d.ts @@ -3,6 +3,8 @@ // Definitions by: Sergey Buturlakin , Yuichi Murata , Václav Ostrožlík , Nathan Brown , Alex Wendland // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/// + export as namespace ReactRouter; import * as React from 'react'; From 5a85550382751d3d28c70f56f8acb14940cd3996 Mon Sep 17 00:00:00 2001 From: shivarajkv Date: Fri, 21 Oct 2016 20:35:01 +0530 Subject: [PATCH 027/246] Initial commit on fushionchart typings --- fusioncharts/fusioncharts-tests.ts | 30 +++++ fusioncharts/fusioncharts.d.ts | 196 +++++++++++++++++++++++++++++ 2 files changed, 226 insertions(+) create mode 100644 fusioncharts/fusioncharts-tests.ts create mode 100644 fusioncharts/fusioncharts.d.ts diff --git a/fusioncharts/fusioncharts-tests.ts b/fusioncharts/fusioncharts-tests.ts new file mode 100644 index 0000000000..32ae533705 --- /dev/null +++ b/fusioncharts/fusioncharts-tests.ts @@ -0,0 +1,30 @@ +/// + +FusionCharts.addEventListener('ready',(eventObject)=>{ + eventObject.stopPropagation(); +}); + + +let chart = new FusionCharts({ + type: 'column2d', + renderAt: 'chart-container', + width: '450', + height: '200', + dataFormat: 'json', + dataSource: { + "chart": { + "caption": "Monthly revenue for last year", + "subCaption": "Harry's SuperMart", + }, + "data": [{ + "label": "Jan", + "value": "420000" + }, { + "label": "Feb", + "value": "810000" + } + ] + } +}); + +chart.isActive(); \ No newline at end of file diff --git a/fusioncharts/fusioncharts.d.ts b/fusioncharts/fusioncharts.d.ts new file mode 100644 index 0000000000..d0e0a58e99 --- /dev/null +++ b/fusioncharts/fusioncharts.d.ts @@ -0,0 +1,196 @@ + +declare namespace FusionCharts { + + type ChartDataFormats = 'json' | 'jsonurl' | 'csv' | 'xml' | 'xmlurl'; + + type ImageHAlign = 'left' | 'right' | 'middle'; + + type ImageVAlign = 'top' | 'bottom' | 'middle'; + + interface EventObject { + type: string; + + eventId: number; + + sender: FusionCharts; + + cancelled: boolean; + + stopPropagation: () => void; + + prevented: boolean; + + preventDefault: () => void; + + detached: boolean; + + detachHandler: () => void; + } + + interface ChartObject { + + type?: string; + + id?: string; + + width?: number | string; + + height?: number | string; + + renderAt?: string; + + dataFormat?: ChartDataFormats; + + dataSource?: string | Object; + + events?: Object; + + link?: Object; + + showDataLoadingMessage?: boolean; + + showChartLoadingMessage?: boolean; + + baseChartMessageFont?: string; + + baseChartMessageFontSize?: string; + + baseChartMessageColor?: string; + + dataLoadStartMessage?: string; + + dataLoadErrorMessage?: string; + + dataInvalidMessage?: string; + + dataEmptyMessage?: string; + + typeNotSupportedMessage?: string; + + loadMessage?: string; + + renderErrorMessage?: string; + + containerBackgroundColor?: string; + + containerBackgroundOpacity?: number; + + containerClassName?: string; + + baseChartMessageImageHAlign?: ImageHAlign; + + dataLoadErrorMessageImageVAlign?: ImageVAlign; + + dataLoadErrorMessageImageAlpha?: number; + + dataLoadErrorMessageImageScale?: number; + + dataLoadStartMessageImageHAlign?: ImageHAlign; + + dataLoadStartMessageImageVAlign?: ImageVAlign; + + dataLoadStartMessageImageAlpha?: number; + + dataLoadStartMessageImageScale?: number; + + dataInvalidMessageImageHAlign?: ImageHAlign; + + dataInvalidMessageImageVAlign?: ImageVAlign; + + dataInvalidMessageImageAlpha?: number; + + dataInvalidMessageImageScale?: number; + + dataEmptyMessageImageHAlign?: ImageHAlign; + + dataEmptyMessageImageVAlign?: ImageVAlign; + + dataEmptyMessageImageAlpha?: number; + + dataEmptyMessageImageScale?: number; + + renderErrorMessageImageHAlign?: ImageHAlign; + + renderErrorMessageImageVAlign?: ImageVAlign; + + renderErrorMessageImageAlpha?: number; + + renderErrorMessageImageScale?: number; + + loadMessageImageHAlign?: ImageHAlign; + + loadMessageImageVAlign?: ImageVAlign; + + loadMessageImageAlpha?: number; + + loadMessageImageScale?: number; + } + + interface FusionCharts { + clone(overrides?: Object, argsOnly?: boolean): any; + + isActive(): boolean; + + chartType(value: string, options?: any): string; + + addEventListener(type: string | string[], listener: (eventObject?: EventObject, eventArgs?: Object) => void): void; + + removeEventListener(type: string | string[], listener: (eventObject?: EventObject, eventArgs?: Object) => void): void; + + configureLink(param: Object | any[], level?: number): void; + + setChartAttribute(attributes: ChartObject | String, value?: string): void; + + getChartAttribute(attribute?: string | string[]): ChartObject; + + getXMLData(): any; + + setXMLData(data: string | Object): void; + + setXMLUrl(url: string): void; + + setChartDataUrl(url: string, format: ChartDataFormats): void; + + setChartData(data: string | Object, format: ChartDataFormats): void; + + getChartData(format: ChartDataFormats): any; + + dataReady(available?: boolean): boolean; + + feedData(stream: string): void; + + getData(): any; + + getDataWithId(): any; + + setData(value: number, label: string): void; + + } + + interface FusionChartStatic { + new (chartObject: ChartObject): FusionCharts; + + getObjectReference(elementId: string): Element; + + addEventListener(type: string | string[], listener: (eventObject?: EventObject, eventArgs?: Object) => void): void; + + removeEventListener(type: string | string[], listener: (eventObject?: EventObject, eventArgs?: Object) => void): void; + + ready(callback: (fusionChartStatic?: FusionChartStatic) => any, context: any): FusionChartStatic; + + transcodeData(data: string | Object, source: ChartDataFormats, target: ChartDataFormats, advanced: boolean): any; + + + + } + +} + +declare module 'FusionCharts' { + var FusionCharts: FusionCharts.FusionChartStatic; + export = FusionCharts; +} + +declare var FusionCharts: FusionCharts.FusionChartStatic; + + From ff763f9cfbacd3574a5babb40e2d91de59dff698 Mon Sep 17 00:00:00 2001 From: Shivaraj kv Date: Sat, 22 Oct 2016 17:59:50 +0530 Subject: [PATCH 028/246] Added all possible methods and static variables. --- fusioncharts/fusioncharts-tests.ts | 27 ++++++- fusioncharts/fusioncharts.d.ts | 112 ++++++++++++++++++++++++++++- 2 files changed, 133 insertions(+), 6 deletions(-) diff --git a/fusioncharts/fusioncharts-tests.ts b/fusioncharts/fusioncharts-tests.ts index 32ae533705..d50bff87c9 100644 --- a/fusioncharts/fusioncharts-tests.ts +++ b/fusioncharts/fusioncharts-tests.ts @@ -4,8 +4,17 @@ FusionCharts.addEventListener('ready',(eventObject)=>{ eventObject.stopPropagation(); }); +FusionCharts.ready((fusioncharts)=>{ -let chart = new FusionCharts({ +}); + +FusionCharts.version; + +FusionCharts('chartId').render();; + +FusionCharts["debugger"].enable(true); + +let chartData ={ type: 'column2d', renderAt: 'chart-container', width: '450', @@ -25,6 +34,18 @@ let chart = new FusionCharts({ } ] } -}); +}; -chart.isActive(); \ No newline at end of file +let chart = new FusionCharts(chartData); +chart.render(); +chart.isActive(); +chart.addEventListener('ready',function(eventObject){ + eventObject.type; +}); +chart.chartType(); +chart.addVariable(); +chart.clone(); +chart.zoomTo(0,3); +chart.zoomOut(); +chart.setJSONData(chartData); +chart.ref; \ No newline at end of file diff --git a/fusioncharts/fusioncharts.d.ts b/fusioncharts/fusioncharts.d.ts index d0e0a58e99..5e68eab97f 100644 --- a/fusioncharts/fusioncharts.d.ts +++ b/fusioncharts/fusioncharts.d.ts @@ -1,3 +1,8 @@ +// Type definitions for FusionCharts 3.11.2 +// Project: http://www.fusioncharts.com +// Definitions by: Shivaraj KV +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + declare namespace FusionCharts { @@ -126,12 +131,22 @@ declare namespace FusionCharts { loadMessageImageScale?: number; } + interface Debugger { + outputFormat(format: any): void; + + outputTo(callback: (message: any) => any): void; + + enable(state:any,outputTo?:(message: any) =>any,outputFormat?:any):void + + enableFirebugLite():any; + } + interface FusionCharts { clone(overrides?: Object, argsOnly?: boolean): any; isActive(): boolean; - chartType(value: string, options?: any): string; + chartType(value?: string, options?: any): string; addEventListener(type: string | string[], listener: (eventObject?: EventObject, eventArgs?: Object) => void): void; @@ -165,10 +180,84 @@ declare namespace FusionCharts { setData(value: number, label: string): void; + stopUpdate(): void; + + restartUpdate(): void; + + isUpdateActive(): boolean; + + clearChart(): void; + + getSWFHTML(): any; + + addVariable(): void; + + getXML(): any; + + setDataXML(data: string | Object): void; + + setDataURL(url: string): void; + + hasRendered(): boolean; + + setTransparent(transparency?: boolean): void; + + isPlotItemSliced(index: number): boolean; + + slicePlotItem(index: number, slice: boolean): void; + + centerLabel(labelText: string, options?: Object): void; + + startingAngle(angle?: number, relative?: boolean): void; + + zoomOut(): void; + + zoomTo(startIndex: number, endIndex: number): void; + + resetChart(): void; + + setZoomMode(yes: boolean): void; + + getViewStartIndex(): number; + + getViewEndIndex(): number; + + print(options?: Object): void; + + exportChart(options?: Object): void; + + getSVGString(): string; + + lockResize(state: boolean): boolean; + + showChartMessage(text: string, modal?: boolean, cancelable?: boolean): void; + + getJSONData(): JSON; + + setJSONData(data: string | Object): void; + + setJSONUrl(url: string): void; + + getCSVData(): any; + + getDataAsCSV(): any; + + render(containerElement?: string | Element, insertMode?: string, callback?: () => any): FusionCharts; + + resizeTo(width: number | string, height: number | string): any; + + dispose(): void; + + configure(options: Object): void; + + ref: Object; + } interface FusionChartStatic { - new (chartObject: ChartObject): FusionCharts; + new (chartObject: ChartObject|Object): FusionCharts; + + (chartId: string): FusionCharts; getObjectReference(elementId: string): Element; @@ -176,10 +265,27 @@ declare namespace FusionCharts { removeEventListener(type: string | string[], listener: (eventObject?: EventObject, eventArgs?: Object) => void): void; - ready(callback: (fusionChartStatic?: FusionChartStatic) => any, context: any): FusionChartStatic; + ready(callback: (fusionChartStatic?: FusionChartStatic) => any, context?: any): FusionChartStatic; transcodeData(data: string | Object, source: ChartDataFormats, target: ChartDataFormats, advanced: boolean): any; + batchExport(options: Object): void; + + formatNumber(num: number, type?: string, config?: Object): Element; + + setCurrentRenderer(name: string): void + + getCurrentRenderer(): string; + + render(options?: ChartObject, callback?: () => any): FusionCharts; + + version: string[]; + + items: Object; + + options: Object; + + debugger:Debugger; } From 8bdaf9418da10a6fe35ca94e5a6bde558c62f77c Mon Sep 17 00:00:00 2001 From: jupl Date: Sun, 23 Oct 2016 19:06:15 -0500 Subject: [PATCH 029/246] Export action interfaces Exporting the actions helps with casting/signatures when crafting reducers. --- redux-actions/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/redux-actions/index.d.ts b/redux-actions/index.d.ts index de7cb4f026..a770c3006b 100644 --- a/redux-actions/index.d.ts +++ b/redux-actions/index.d.ts @@ -12,13 +12,13 @@ declare namespace ReduxActions { type: string } - interface Action extends BaseAction { + export interface Action extends BaseAction { payload?: Payload error?: boolean meta?: any } - interface ActionMeta extends Action { + export interface ActionMeta extends Action { meta: Meta } From dff0f0f29c6485d98d3a9e1e75030e553832dce6 Mon Sep 17 00:00:00 2001 From: Hendrik Liebau Date: Mon, 24 Oct 2016 12:08:37 +0200 Subject: [PATCH 030/246] export ReactHelmet namespace --- react-helmet/index.d.ts | 11 +++++------ react-helmet/react-helmet-tests.tsx | 6 ++++++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/react-helmet/index.d.ts b/react-helmet/index.d.ts index c44639e0d0..3ddfd1ebb5 100644 --- a/react-helmet/index.d.ts +++ b/react-helmet/index.d.ts @@ -7,14 +7,11 @@ import * as React from "react"; -declare var Helmet: { - (): ReactHelmet.HelmetComponent - rewind(): ReactHelmet.HelmetData - } - -export = Helmet; +declare function ReactHelmet(): ReactHelmet.HelmetComponent; declare namespace ReactHelmet { + function rewind(): ReactHelmet.HelmetData; + interface HelmetProps { base?: any; defaultTitle?: string; @@ -43,3 +40,5 @@ declare namespace ReactHelmet { class HelmetComponent extends React.Component {} } + +export = ReactHelmet; diff --git a/react-helmet/react-helmet-tests.tsx b/react-helmet/react-helmet-tests.tsx index 2db79eb547..3a4a3f09d7 100644 --- a/react-helmet/react-helmet-tests.tsx +++ b/react-helmet/react-helmet-tests.tsx @@ -39,3 +39,9 @@ function HTML() { ); } + +function log(datum: Helmet.HelmetDatum) { + return console.log('logging a helmet datum:', datum.toString()); +} + +log(head.title); From ae7666402d056042e89e605db23c715c0aba07a4 Mon Sep 17 00:00:00 2001 From: Tomas Trescak Date: Tue, 25 Oct 2016 09:34:16 +1100 Subject: [PATCH 031/246] Update react.d.ts Having context as {} did not allow me access context members via .notation. --- react/react.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react/react.d.ts b/react/react.d.ts index fd7aec5045..5cba332275 100644 --- a/react/react.d.ts +++ b/react/react.d.ts @@ -173,7 +173,7 @@ declare namespace __React { // on the existence of `children` in `P`, then we should remove this. props: P & { children?: ReactNode }; state: S; - context: {}; + context: any; refs: { [key: string]: ReactInstance }; From 7392a1acd09920470abe4ef1710d11bd893f08d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=8E=E6=89=AC?= Date: Tue, 25 Oct 2016 18:18:53 +0800 Subject: [PATCH 032/246] koa ```listen``` allow empty arguments (#12084) https://github.com/koajs/koa/blob/a293cc2d5e714281260111b6729929fcf379a93f/test/context/state.js#L16 and the ```server.listen([port][, hostname][, backlog][, callback])``` all parameters is options https://nodejs.org/api/net.html#net_server_listen_port_hostname_backlog_callback --- koa/koa-tests.ts | 2 ++ koa/koa.d.ts | 1 + 2 files changed, 3 insertions(+) diff --git a/koa/koa-tests.ts b/koa/koa-tests.ts index 71814fe4fc..ac42c1f1de 100644 --- a/koa/koa-tests.ts +++ b/koa/koa-tests.ts @@ -19,3 +19,5 @@ app.use(ctx => { }); app.listen(3000); + +const server = app.listen(); diff --git a/koa/koa.d.ts b/koa/koa.d.ts index 1356ffdb0e..1e45997f9f 100644 --- a/koa/koa.d.ts +++ b/koa/koa.d.ts @@ -159,6 +159,7 @@ declare module "koa" { constructor(); // From node.d.ts + listen(): http.Server; listen(port: number, hostname?: string, backlog?: number, listeningListener?: Function): http.Server; listen(port: number, hostname?: string, listeningListener?: Function): http.Server; listen(port: number, backlog?: number, listeningListener?: Function): http.Server; From 4a17fd3ae7356868aa84d0cd1a8b1162240cd6b5 Mon Sep 17 00:00:00 2001 From: Chris Manning Date: Tue, 25 Oct 2016 23:19:31 +1300 Subject: [PATCH 033/246] Added methods from Joi.any() to the root exports, as the root clones Joi.any() (see line 31 of https://github.com/hapijs/joi/blob/1ea86e6ad16c218714b39209bac3be99a0c598dd/lib/index.js) and a number of the any methods (such as Joi.required()) are necessary for use with the .when method. (#12025) --- joi/joi-tests.ts | 53 ++++++++++++++++++++++ joi/joi.d.ts | 114 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 167 insertions(+) diff --git a/joi/joi-tests.ts b/joi/joi-tests.ts index c75309b45e..8d5463a7c0 100644 --- a/joi/joi-tests.ts +++ b/joi/joi-tests.ts @@ -801,3 +801,56 @@ Joi.isRef(ref); schema = Joi.reach(schema, ''); const Joi2 = Joi.extend({ name: '', base: schema }); + +// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- + +schema = Joi.allow(x, x); +schema = Joi.allow([x, x, x]); +schema = Joi.valid(x); +schema = Joi.valid(x, x); +schema = Joi.valid([x, x, x]); +schema = Joi.only(x); +schema = Joi.only(x, x); +schema = Joi.only([x, x, x]); +schema = Joi.equal(x); +schema = Joi.equal(x, x); +schema = Joi.equal([x, x, x]); +schema = Joi.invalid(x); +schema = Joi.invalid(x, x); +schema = Joi.invalid([x, x, x]); +schema = Joi.disallow(x); +schema = Joi.disallow(x, x); +schema = Joi.disallow([x, x, x]); +schema = Joi.not(x); +schema = Joi.not(x, x); +schema = Joi.not([x, x, x]); + +schema = Joi.required(); +schema = Joi.optional(); +schema = Joi.forbidden(); +schema = Joi.strip(); + +schema = Joi.description(str); +schema = Joi.notes(str); +schema = Joi.notes(strArr); +schema = Joi.tags(str); +schema = Joi.tags(strArr); + +schema = Joi.meta(obj); +schema = Joi.example(obj); +schema = Joi.unit(str); + +schema = Joi.options(validOpts); +schema = Joi.strict(); +schema = Joi.strict(bool); +schema = Joi.concat(x); + +schema = Joi.when(str, whenOpts); +schema = Joi.when(ref, whenOpts); + +schema = Joi.label(str); +schema = Joi.raw(); +schema = Joi.raw(bool); +schema = Joi.empty(); +schema = Joi.empty(str); +schema = Joi.empty(anySchema); \ No newline at end of file diff --git a/joi/joi.d.ts b/joi/joi.d.ts index b827903f9b..206c5778ca 100644 --- a/joi/joi.d.ts +++ b/joi/joi.d.ts @@ -879,4 +879,118 @@ declare module 'joi' { */ export function extend(extention: Extension): any; + /** + * Whitelists a value + */ + export function allow(value: any, ...values: any[]): Schema; + export function allow(values: any[]): Schema; + + /** + * Adds the provided values into the allowed whitelist and marks them as the only valid values allowed. + */ + export function valid(value: any, ...values: any[]): Schema; + export function valid(values: any[]): Schema; + export function only(value: any, ...values : any[]): Schema; + export function only(values: any[]): Schema; + export function equal(value: any, ...values : any[]): Schema; + export function equal(values: any[]): Schema; + + /** + * Blacklists a value + */ + export function invalid(value: any, ...values: any[]): Schema; + export function invalid(values: any[]): Schema; + export function disallow(value: any, ...values : any[]): Schema; + export function disallow(values: any[]): Schema; + export function not(value: any, ...values : any[]): Schema; + export function not(values: any[]): Schema; + + /** + * Marks a key as required which will not allow undefined as value. All keys are optional by default. + */ + export function required(): Schema; + + /** + * Marks a key as optional which will allow undefined as values. Used to annotate the schema for readability as all keys are optional by default. + */ + export function optional(): Schema; + + /** + * Marks a key as forbidden which will not allow any value except undefined. Used to explicitly forbid keys. + */ + export function forbidden(): Schema; + + /** + * Marks a key to be removed from a resulting object or array after validation. Used to sanitize output. + */ + export function strip(): Schema; + + /** + * Annotates the key + */ + export function description(desc: string): Schema; + + /** + * Annotates the key + */ + export function notes(notes: string): Schema; + export function notes(notes: string[]): Schema; + + /** + * Annotates the key + */ + export function tags(notes: string): Schema; + export function tags(notes: string[]): Schema; + + /** + * Attaches metadata to the key. + */ + export function meta(meta: Object): Schema; + + /** + * Annotates the key with an example value, must be valid. + */ + export function example(value: any): Schema; + + /** + * Annotates the key with an unit name. + */ + export function unit(name: string): Schema; + + /** + * Overrides the global validate() options for the current key and any sub-key. + */ + export function options(options: ValidationOptions): Schema; + + /** + * Sets the options.convert options to false which prevent type casting for the current key and any child keys. + */ + export function strict(isStrict?: boolean): Schema; + + /** + * Returns a new type that is the result of adding the rules of one type to another. + */ + export function concat(schema: T): T; + + /** + * Converts the type into an alternatives type where the conditions are merged into the type definition where: + */ + export function when(ref: string, options: WhenOptions): AlternativesSchema; + export function when(ref: Reference, options: WhenOptions): AlternativesSchema; + + /** + * Overrides the key name in error messages. + */ + export function label(name: string): Schema; + + /** + * Outputs the original untouched value instead of the casted value. + */ + export function raw(isRaw?: boolean): Schema; + + /** + * Considers anything that matches the schema to be empty (undefined). + * @param schema - any object or joi schema to match. An undefined schema unsets that rule. + */ + export function empty(schema?: any) : Schema; } From 988270f5f4aae5a1b3d7faf04fafd271580cbfd9 Mon Sep 17 00:00:00 2001 From: clementdevos Date: Tue, 25 Oct 2016 12:23:30 +0200 Subject: [PATCH 034/246] feat(react-redux-i18n): definitions (#12052) * feat(react-redux-i18n): definitions Added definitions for react-redux-i18n https://github.com/zoover/react-redux-i18n * Renamed test file to react-redux-i18n-tests.tsx --- react-redux-i18n/react-redux-i18n-tests.tsx | 52 +++++++++++++++++ react-redux-i18n/react-redux-i18n.d.ts | 65 +++++++++++++++++++++ 2 files changed, 117 insertions(+) create mode 100644 react-redux-i18n/react-redux-i18n-tests.tsx create mode 100644 react-redux-i18n/react-redux-i18n.d.ts diff --git a/react-redux-i18n/react-redux-i18n-tests.tsx b/react-redux-i18n/react-redux-i18n-tests.tsx new file mode 100644 index 0000000000..37230b3b1a --- /dev/null +++ b/react-redux-i18n/react-redux-i18n-tests.tsx @@ -0,0 +1,52 @@ +/// + +import * as React from "react"; +import * as I18n from "react-redux-i18n"; + +class ReactReduxI18nTests_Translate1 extends React.Component, {}>{ + + render() { + return ( + + ) + } +} + + + +class ReactReduxI18nTests_Translate2 extends React.Component, {}>{ + + render() { + return ( + + ) + } +} + + +class ReactReduxI18nTests_Translate3 extends React.Component, {}>{ + + render() { + return ( + + ) + } +} + + +class ReactReduxI18nTests_Translate4 extends React.Component, {}>{ + + render() { + return ( + + ) + } +} + +function testI18Helper() { + I18n.I18n.t('application.title'); // => returns 'Toffe app met i18n!' + I18n.I18n.t('application.name', { name: 'Aad' }); // => returns 'Hallo, Aad!' + + I18n.I18n.l(1385856000000, { dateFormat: 'date.long' }); // => returns '1 december 2013' + I18n.I18n.l(Math.PI, { maximumFractionDigits: 2 }); // => returns '3,14' +} diff --git a/react-redux-i18n/react-redux-i18n.d.ts b/react-redux-i18n/react-redux-i18n.d.ts new file mode 100644 index 0000000000..537955af37 --- /dev/null +++ b/react-redux-i18n/react-redux-i18n.d.ts @@ -0,0 +1,65 @@ +// Type definitions for react-redux-i18n +// Project: https://github.com/zoover/react-redux-i18n +// Definitions by: Clément Devos +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// + +declare module 'react-redux-i18n' { + import R = __React; + import _Redux = Redux; + + /** + * Helper methods + */ + interface I18n { + t(code: string, options?: any): string; + l(timestamp: number, options?: any): string; + } + export var I18n : I18n; + + type SubTranslationObject = string | { [key: string]: SubTranslationObject }; + + type TranslationObjects = { [lang: string]: SubTranslationObject }; + + type I18nState = { + translations: TranslationObjects; + locale: string; + } + + type TranslateProps = { + value: string; + [prop: string]: string; + + } + type LocalizeProps = { + value: string | number; + dateFormat?: string; + options?: Object; + } + + /** + * React components + */ + export class Translate extends R.Component{ } + export class Localize extends R.Component{ } + + /** + * Reducer + */ + export function i18nReducer(state?: any, options?: any): _Redux.Reducer; + + /** + * Reducer init + */ + export function syncTranslationWithStore(store: _Redux.Store): void; + + /** + * Redux Actions + */ + export function loadTranslations(translationsObject: TranslationObjects): void; + + export function setLocale(locale: string): void; + +} From fc856815903ac3d981274f261ece6561044c407a Mon Sep 17 00:00:00 2001 From: rinzeb Date: Tue, 25 Oct 2016 12:24:38 +0200 Subject: [PATCH 035/246] Update kafka-node.d.ts (#12057) --- kafka-node/kafka-node.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/kafka-node/kafka-node.d.ts b/kafka-node/kafka-node.d.ts index 19d9bc3010..1275f80834 100644 --- a/kafka-node/kafka-node.d.ts +++ b/kafka-node/kafka-node.d.ts @@ -9,6 +9,7 @@ declare module 'kafka-node' { export class Client { constructor(connectionString: string, clientId: string, options?: ZKOptions); close(callback?: Function): void; + topicExists(topics: Array, callback: Function): void; } export class Producer { From 3c223cbfb1240951ad92fdfb38638c483d2c03e5 Mon Sep 17 00:00:00 2001 From: Haoliang Yu Date: Tue, 25 Oct 2016 06:25:57 -0400 Subject: [PATCH 036/246] Update definition for leaflet 1.0 (#12016) * add initial definition of DomEvent for leaflet 1.0 * fix wrong type definition * complete type definition of L.DomEvent * remove unclear definition * adjust definition according to the leaflet API doc --- leaflet/leaflet-tests.ts | 8 ++++++++ leaflet/leaflet.d.ts | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/leaflet/leaflet-tests.ts b/leaflet/leaflet-tests.ts index 539ec2d8a3..a6f07eaefe 100644 --- a/leaflet/leaflet-tests.ts +++ b/leaflet/leaflet-tests.ts @@ -207,6 +207,14 @@ tileLayer = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png'); tileLayer = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', tileLayerOptions); tileLayer = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png?{foo}&{bar}&{abc}', {foo: 'bar', bar: (data: any) => 'foo', abc: () => ''}); +let eventHandler = () => {}; +L.DomEvent.on(htmlElement, 'click', eventHandler); +L.DomEvent.off(htmlElement, 'click', eventHandler); +L.DomEvent.on(htmlElement, { 'click': eventHandler }); +L.DomEvent.off(htmlElement, { 'click': eventHandler }, eventHandler); +L.DomEvent.disableScrollPropagation(htmlElement); +L.DomEvent.disableClickPropagation(htmlElement); + map = map // addControl // removeControl diff --git a/leaflet/leaflet.d.ts b/leaflet/leaflet.d.ts index c67c02e29b..38872edcb1 100644 --- a/leaflet/leaflet.d.ts +++ b/leaflet/leaflet.d.ts @@ -1185,6 +1185,15 @@ declare namespace L { distance: number; } + export namespace DomEvent { + export function on(el: HTMLElement, types: string, fn: Function, context?: Object): typeof DomEvent; + export function on(el: HTMLElement, eventMap: {[eventName: string]: Function}, context?: Object): typeof DomEvent; + export function off(el: HTMLElement, types: string, fn: Function, context?: Object): typeof DomEvent; + export function off(el: HTMLElement, eventMap: {[eventName: string]: Function}, context?: Object): typeof DomEvent; + export function disableScrollPropagation(el: HTMLElement): typeof DomEvent; + export function disableClickPropagation(el: HTMLElement): typeof DomEvent; + } + interface DefaultMapPanes { mapPane: HTMLElement; tilePane: HTMLElement; From 9e778b38c214e52ef1718cc024c008cae2db605c Mon Sep 17 00:00:00 2001 From: Foxeye-Rinx Date: Tue, 25 Oct 2016 17:26:49 +0700 Subject: [PATCH 037/246] Add support for custom reporter (#11938) * Add support for custom reporter * Update CustomReporter and add more test: - jasmineDone() shoud return type "any" instead of "void". - CustomReporter should has optional method. * Fix error: Duplicate identifier 'Promise'. --- jasmine/jasmine-tests.ts | 56 ++++++++++++++++++++++++++++++++++++++++ jasmine/jasmine.d.ts | 40 ++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+) diff --git a/jasmine/jasmine-tests.ts b/jasmine/jasmine-tests.ts index 96ac307ca0..6c5bf855e1 100644 --- a/jasmine/jasmine-tests.ts +++ b/jasmine/jasmine-tests.ts @@ -904,6 +904,62 @@ describe("Custom matcher: 'toBeGoofy'", function () { }); }); +// test based on http://jasmine.github.io/2.5/custom_reporter.html +var myReporter: jasmine.CustomReporter = { + jasmineStarted: function (suiteInfo: jasmine.SuiteInfo ) { + console.log("Running suite with " + suiteInfo.totalSpecsDefined); + }, + + suiteStarted: function (result: jasmine.CustomReporterResult) { + console.log("Suite started: " + result.description + " whose full description is: " + result.fullName); + }, + + specStarted: function (result: jasmine.CustomReporterResult) { + console.log("Spec started: " + result.description + " whose full description is: " + result.fullName); + }, + + specDone: function (result: jasmine.CustomReporterResult) { + console.log("Spec: " + result.description + " was " + result.status); + for (var i = 0; i < result.failedExpectations.length; i++) { + console.log("Failure: " + result.failedExpectations[i].message); + console.log("Actual: " + result.failedExpectations[i].actual); + console.log("Expected: " + result.failedExpectations[i].expected); + console.log(result.failedExpectations[i].stack); + } + console.log(result.passedExpectations.length); + }, + + suiteDone: function (result: jasmine.CustomReporterResult) { + console.log('Suite: ' + result.description + ' was ' + result.status); + for (var i = 0; i < result.failedExpectations.length; i++) { + console.log('AfterAll ' + result.failedExpectations[i].message); + console.log(result.failedExpectations[i].stack); + } + }, + + jasmineDone: function() { + console.log('Finished suite'); + } +}; + +jasmine.getEnv().addReporter(myReporter); + +// test for custom reporter which return ES6 Promise in jasmineDone(): +var myShortReporter: jasmine.CustomReporter = { + jasmineDone: function() { + return new Promise(function(resolve, reject) { + setTimeout(() => resolve(), 10000); + }); + } +} + +var jasmineDoneResolved: Promise = myShortReporter.jasmineDone(); +jasmineDoneResolved.then(() => { + console.log("[ShortReporter] : jasmineDone Resolved"); +}); + +jasmine.getEnv().addReporter(myShortReporter); + describe("Randomize Tests", function() { it("should allow randomization of the order of tests", function() { expect(function() { diff --git a/jasmine/jasmine.d.ts b/jasmine/jasmine.d.ts index c4151995a7..79436134ff 100644 --- a/jasmine/jasmine.d.ts +++ b/jasmine/jasmine.d.ts @@ -162,6 +162,7 @@ declare namespace jasmine { versionString(): string; nextSpecId(): number; addReporter(reporter: Reporter): void; + addReporter(reporter: CustomReporter): void; execute(): void; describe(description: string, specDefinitions: () => void): Suite; // ddescribe(description: string, specDefinitions: () => void): Suite; Not a part of jasmine. Angular team adds these @@ -354,6 +355,45 @@ declare namespace jasmine { addReporter(reporter: Reporter): void; } + interface SuiteInfo { + totalSpecsDefined: number; + } + + interface CustomReportExpectation { + matcherName: string; + message: string; + passed: boolean; + stack: string; + } + + interface FailedExpectation extends CustomReportExpectation { + actual: string; + expected: string; + } + + interface PassedExpectation extends CustomReportExpectation { + + } + + interface CustomReporterResult { + description: string, + failedExpectations?: FailedExpectation[], + fullName: string, + id: string; + passedExpectations?: PassedExpectation[], + pendingReason?: string; + status?: string; + } + + interface CustomReporter { + jasmineStarted?(suiteInfo: SuiteInfo): void; + suiteStarted?(result: CustomReporterResult): void; + specStarted?(result: CustomReporterResult): void; + specDone?(result: CustomReporterResult): void; + suiteDone?(result: CustomReporterResult): void; + jasmineDone?(): any; + } + interface Runner { new (env: Env): any; From 57a716701e78bf1958c86c1726bd028b12fc6a95 Mon Sep 17 00:00:00 2001 From: Michael Sivolobov Date: Tue, 25 Oct 2016 17:29:33 +0700 Subject: [PATCH 038/246] Added typings for `react-native-sortable-list` component (#12105) --- .../react-native-sortable-list-tests.tsx | 208 ++++++++++++++++++ .../react-native-sortable-list.d.ts | 99 +++++++++ react-native-sortable-list/tsconfig.json | 6 + 3 files changed, 313 insertions(+) create mode 100644 react-native-sortable-list/react-native-sortable-list-tests.tsx create mode 100644 react-native-sortable-list/react-native-sortable-list.d.ts create mode 100644 react-native-sortable-list/tsconfig.json diff --git a/react-native-sortable-list/react-native-sortable-list-tests.tsx b/react-native-sortable-list/react-native-sortable-list-tests.tsx new file mode 100644 index 0000000000..fb72ce2e2f --- /dev/null +++ b/react-native-sortable-list/react-native-sortable-list-tests.tsx @@ -0,0 +1,208 @@ +/// +/// +/// + +import * as React from 'react'; +import { + Animated, + Easing, + AppRegistry, + StyleSheet, + Text, + Image, + View, + Dimensions, + FlexJustifyType, + FlexAlignType +} from 'react-native'; +import SortableList, {RowProps} from 'react-native-sortable-list'; + + +const window = Dimensions.get('window'); + +const data = { + 0: { + image: 'https://placekitten.com/200/200', + text: 'Chloe', + }, + 1: { + image: 'https://placekitten.com/200/201', + text: 'Jasper', + }, + 2: { + image: 'https://placekitten.com/200/202', + text: 'Pepper', + }, + 3: { + image: 'https://placekitten.com/200/203', + text: 'Oscar', + }, + 4: { + image: 'https://placekitten.com/200/204', + text: 'Dusty', + }, + 5: { + image: 'https://placekitten.com/200/205', + text: 'Spooky', + }, + 6: { + image: 'https://placekitten.com/200/210', + text: 'Kiki', + }, + 7: { + image: 'https://placekitten.com/200/215', + text: 'Smokey', + }, + 8: { + image: 'https://placekitten.com/200/220', + text: 'Gizmo', + }, + 9: { + image: 'https://placekitten.com/220/239', + text: 'Kitty', + }, +}; + +const styles = StyleSheet.create({ + container: { + flex: 1, + justifyContent: "center" as FlexJustifyType, + alignItems: "center" as FlexAlignType, + backgroundColor: '#eee', + paddingTop: 60, + }, + + list: { + flex: 1, + }, + + contentContainer: { + width: window.width, + paddingHorizontal: 30, + }, + + row: { + flexDirection: 'row', + alignItems: 'center', + backgroundColor: 'white', + padding: 16, + marginVertical: 5, + height: 90, + width: window.width - 30 * 2, + borderRadius: 4, + shadowColor: 'rgba(0,0,0,0.2)', + shadowOpacity: 1, + shadowOffset: {height: 2, width: 2}, + shadowRadius: 2, + }, + + image: { + width: 60, + height: 60, + marginRight: 30, + borderRadius: 30, + }, + + text: { + fontSize: 24, + }, + +}); + +class Basic extends React.Component { + render() { + return ( + + + + ); + } + + _renderRow = ({data, active}: RowProps) => { + return + } +} + +interface RowState { + style: { + shadowRadius: Animated.Value + transform: {scale: Animated.Value}[] + } +} + +class Row extends React.Component { + + state = { + style: { + shadowRadius: new Animated.Value(2), + transform: [{scale: new Animated.Value(1)}], + } + }; + + componentWillReceiveProps(nextProps: RowProps) { + if (this.props.active !== nextProps.active) { + if (this.props.active !== nextProps.active) { + if (nextProps.active) { + this.startActivationAnimation(); + } else { + this.startDeactivationAnimation(); + } + } + } + } + + startActivationAnimation = () => { + const {style} = this.state; + + Animated.parallel([ + Animated.timing(style.transform[0].scale, { + duration: 100, + easing: Easing.out(Easing.quad), + toValue: 1.1 + }), + Animated.timing(style.shadowRadius, { + duration: 100, + easing: Easing.out(Easing.quad), + toValue: 10 + }), + ]).start(); + }; + + startDeactivationAnimation = () => { + const {style} = this.state; + + Animated.parallel([ + Animated.timing(style.transform[0].scale, { + duration: 100, + easing: Easing.out(Easing.quad), + toValue: 1 + }), + Animated.timing(style.shadowRadius, { + duration: 100, + easing: Easing.out(Easing.quad), + toValue: 2 + }), + ]).start(); + }; + + render() { + const {data} = this.props; + + return ( + + + {data.text} + + ); + } +} + + +AppRegistry.registerComponent('Basic', () => Basic); diff --git a/react-native-sortable-list/react-native-sortable-list.d.ts b/react-native-sortable-list/react-native-sortable-list.d.ts new file mode 100644 index 0000000000..38a078c689 --- /dev/null +++ b/react-native-sortable-list/react-native-sortable-list.d.ts @@ -0,0 +1,99 @@ +// Type definitions for react-native-sortable-list +// Project: https://github.com/gitim/react-native-sortable-list +// Definitions by: Michael Sivolobov +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// + +declare namespace __SortableList { + + type DataKey = string | number; + + export type DataValue = any + + type DataByNumber = { + [key: number]: DataValue + } + + type DataByString = { + [key: string]: DataValue + } + + export type Data = DataByNumber | DataByString; + + export interface RowProps { + active: boolean + data: DataValue + key?: DataKey + index?: number + disabled?: boolean + } + + interface SortableListProps { + + /** + * data source + */ + data: Data + + /** + * an array of keys from data, the order of keys from the array will be used to initial rows order + */ + order?: DataKey[] + + /** + * style of HOC + */ + style?: React.ViewStyle + + /** + * these styles will be applied to the inner scroll view content container + */ + contentContainerStyle?: React.ViewStyle + + /** + * when false, rows are not sortable. The default value is true. + */ + sortingEnabled?: boolean + + /** + * when false, the content does not scrollable. The default value is true. + */ + scrollEnabled?: boolean + + /** + * Takes a row key, row index, data entry from the data source and its statuses disabled, + * active and should return a renderable component to be rendered as the row. + */ + renderRow: (props: RowProps) => JSX.Element + + /** + * Called when rows were reordered, takes an array of rows keys of the next rows order. + */ + onChangeOrder?: (nextOrder: DataKey[]) => void + + /** + * Called when a row was activated (user long tapped). + */ + onActivateRow?: (key: DataKey) => void + + /** + * Called when the active row was released. + */ + onReleaseRow?: (key: DataKey) => void + } + + export interface SortableListStatic extends React.ClassicComponentClass {} + + export var SortableList: SortableListStatic; + export type SortableList = SortableListStatic; +} + +declare module 'react-native-sortable-list' { + import SortableList = __SortableList; + + export interface RowProps extends SortableList.RowProps {} + + export default SortableList.SortableList; +} diff --git a/react-native-sortable-list/tsconfig.json b/react-native-sortable-list/tsconfig.json new file mode 100644 index 0000000000..b666373644 --- /dev/null +++ b/react-native-sortable-list/tsconfig.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "target": "es6", + "noImplicitAny": true + } +} From bf5d81c29f9ef26ca950ebe4d23e31902cd3726c Mon Sep 17 00:00:00 2001 From: Karol Janyst Date: Tue, 25 Oct 2016 19:37:44 +0900 Subject: [PATCH 039/246] Add definitions for bootstrap-select (#12113) --- bootstrap-select/bootstrap-select-tests.ts | 43 +++++++++++++++++++++ bootstrap-select/bootstrap-select.d.ts | 44 ++++++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 bootstrap-select/bootstrap-select-tests.ts create mode 100644 bootstrap-select/bootstrap-select.d.ts diff --git a/bootstrap-select/bootstrap-select-tests.ts b/bootstrap-select/bootstrap-select-tests.ts new file mode 100644 index 0000000000..9758b1c9ed --- /dev/null +++ b/bootstrap-select/bootstrap-select-tests.ts @@ -0,0 +1,43 @@ +// Bootstrap Select Test +// ================================================================================ +/// +/// + +$(".selectpicker").selectpicker({ + actionsBox: true, + container: "body", + countSelectedText: "counts > #", + deselectAllText: "test", + dropdownAlignRight: true, + dropupAuto: true, + header: "test", + hideDisabled: true, + iconBase: "fa", + liveSearch: true, + liveSearchNormalize: true, + liveSearchPlaceholder: "test", + liveSearchStyle: "contains", + maxOptions: 10, + maxOptionsText: "test", + mobile: true, + multipleSeparator: ", ", + noneSelectedText: "test", + selectAllText: "test", + selectedTextFormat: "values", + selectOnTab: true, + showContent: true, + showIcon: true, + showSubtext: true, + showTick: true, + size: "auto", + style: "test", + tickIcon: "test", + title: "test", + width: "auto" +}) + +$(".selectpicker").selectpicker("val", "foo") +$(".selectpicker").selectpicker("val", ["foo", "bar"]) +$(".selectpicker").selectpicker("selectAll") +$(".selectpicker").selectpicker("setStyle", "btn-large", "add") + diff --git a/bootstrap-select/bootstrap-select.d.ts b/bootstrap-select/bootstrap-select.d.ts new file mode 100644 index 0000000000..9f1436a624 --- /dev/null +++ b/bootstrap-select/bootstrap-select.d.ts @@ -0,0 +1,44 @@ +// Type definitions for bootstrap-select v1.11.2 +// Project: https://silviomoreto.github.io/bootstrap-select/ +// Definitions by: Karol Janyst +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +interface BootstrapSelectOptions { + actionsBox?: boolean + container?: string | boolean + countSelectedText?: string | Function + deselectAllText?: string + dropdownAlignRight?: string | boolean + dropupAuto?: boolean + header?: string + hideDisabled?: boolean + iconBase?: string + liveSearch?: boolean + liveSearchNormalize?: boolean + liveSearchPlaceholder?: string + liveSearchStyle?: string + maxOptions?: number | boolean + maxOptionsText?: string | Array | Function + mobile?: boolean + multipleSeparator?: string + noneSelectedText?: string + selectAllText?: string + selectedTextFormat?: string + selectOnTab?: boolean + showContent?: boolean + showIcon?: boolean + showSubtext?: boolean + showTick?: boolean + size?: string | number | boolean + style?: string + tickIcon?: string + title?: string + width?: string | boolean +} + +interface JQuery { + selectpicker(opts?: BootstrapSelectOptions): void + selectpicker(method: string, ...args: Array>): void +} From cdcbb561a9a2d9168c67c3bc338581c13c961b6e Mon Sep 17 00:00:00 2001 From: Karol Janyst Date: Tue, 25 Oct 2016 19:38:07 +0900 Subject: [PATCH 040/246] Add definitions for credit-card-type (#12115) --- credit-card-type/credit-card-type-tests.ts | 11 ++++++++ credit-card-type/credit-card-type.d.ts | 32 ++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 credit-card-type/credit-card-type-tests.ts create mode 100644 credit-card-type/credit-card-type.d.ts diff --git a/credit-card-type/credit-card-type-tests.ts b/credit-card-type/credit-card-type-tests.ts new file mode 100644 index 0000000000..11519a14ab --- /dev/null +++ b/credit-card-type/credit-card-type-tests.ts @@ -0,0 +1,11 @@ +// Credit Card Type Test +// ================================================================================ +/// + +// Imports +// -------------------------------------------------------------------------------- +import * as creditCardType from "credit-card-type" + +var cardTypes: Array = creditCardType("") +var cardInfo: CreditCardType.CreditCardTypeInfo = creditCardType.getTypeInfo("") +var types: { [type: string]: string } = creditCardType.types diff --git a/credit-card-type/credit-card-type.d.ts b/credit-card-type/credit-card-type.d.ts new file mode 100644 index 0000000000..159de50be6 --- /dev/null +++ b/credit-card-type/credit-card-type.d.ts @@ -0,0 +1,32 @@ +// Type definitions for Credit Card Type v5.0.0 +// Project: https://github.com/braintree/credit-card-type +// Definitions by: Karol Janyst +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace CreditCardType { + + type CardBrand = "american-express" | "diners-club" | "discover" | "jcb" | "maestro" | "master-card" | "unionpay" | "visa" + + interface CreditCardTypeInfo { + niceType?: string + type?: CardBrand + pattern?: RegExp + gaps?: Array + lengths?: Array + code?: { + name?: string + size?: number + } + } + + interface CreditCardType { + (number: string): Array + getTypeInfo (type: string): CreditCardTypeInfo + types: { [type: string]: string } + } +} + +declare module "credit-card-type" { + const creditCardType: CreditCardType.CreditCardType + export = creditCardType +} From 52410f6f389586942d6427bbf66ac2bf4a9cf04b Mon Sep 17 00:00:00 2001 From: Karol Janyst Date: Tue, 25 Oct 2016 19:38:44 +0900 Subject: [PATCH 041/246] Add definitions for es6-error (#12116) --- es6-error/es6-error-tests.ts | 15 +++++++++++++++ es6-error/es6-error.d.ts | 8 ++++++++ 2 files changed, 23 insertions(+) create mode 100644 es6-error/es6-error-tests.ts create mode 100644 es6-error/es6-error.d.ts diff --git a/es6-error/es6-error-tests.ts b/es6-error/es6-error-tests.ts new file mode 100644 index 0000000000..a7f8ac6e25 --- /dev/null +++ b/es6-error/es6-error-tests.ts @@ -0,0 +1,15 @@ +// ES6 Error Test +// ================================================================================ +/// + +// Imports +// -------------------------------------------------------------------------------- +import * as ExtendableError from "es6-error" + +class TestError extends ExtendableError { + constructor (message: string = "TestError") { + super(message) + } +} + +throw new TestError("Test Message") diff --git a/es6-error/es6-error.d.ts b/es6-error/es6-error.d.ts new file mode 100644 index 0000000000..ce987f1a2f --- /dev/null +++ b/es6-error/es6-error.d.ts @@ -0,0 +1,8 @@ +// Type definitions for es6-error v4.0.0 +// Project: https://github.com/bjyoungblood/es6-error +// Definitions by: Karol Janyst +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module "es6-error" { + export = Error +} From 57d9667b2d0e483399ccf97eb3c44cf48c82f07f Mon Sep 17 00:00:00 2001 From: Karol Janyst Date: Tue, 25 Oct 2016 19:39:31 +0900 Subject: [PATCH 042/246] Add definitions for react-color (#12117) --- react-color/react-color-tests.tsx | 54 +++++++ react-color/react-color.d.ts | 250 ++++++++++++++++++++++++++++++ 2 files changed, 304 insertions(+) create mode 100644 react-color/react-color-tests.tsx create mode 100644 react-color/react-color.d.ts diff --git a/react-color/react-color-tests.tsx b/react-color/react-color-tests.tsx new file mode 100644 index 0000000000..5cc201c4f7 --- /dev/null +++ b/react-color/react-color-tests.tsx @@ -0,0 +1,54 @@ +// React Color Test +// ================================================================================ +/// +/// +/// + +// Imports +// -------------------------------------------------------------------------------- +import * as React from "react" +import { StatelessComponent } from "react" +import { render } from "react-dom" +import { + AlphaPicker, BlockPicker, ChromePicker, CirclePicker, + CompactPicker, GithubPicker, HuePicker, MaterialPicker, + PhotoshopPicker, SketchPicker, SliderPicker, SwatchesPicker, + TwitterPicker, CustomPicker +} from "react-color" +import { Alpha, Checkboard, EditableInput, Hue, Saturation } from "react-color/lib/components/common" + +interface CustomProps extends ReactColor.InjectedColorProps { + color?: ReactColor.Color +} + +var CustomComponent: StatelessComponent = (props: CustomProps) => { + function onChange (color: ReactColor.ColorResult) {} + + return ( +
+ + + + + +
+ ) +} +var Custom = CustomPicker(CustomComponent) + +var colors: Array = ["#000", "#333"] + +render(, document.getElementById("main")) +render(, document.getElementById("main")) +render(, document.getElementById("main")) +render(, document.getElementById("main")) +render(, document.getElementById("main")) +render(, document.getElementById("main")) +render(, document.getElementById("main")) +render(, document.getElementById("main")) +render(, document.getElementById("main")) +render(, document.getElementById("main")) +render(, document.getElementById("main")) +render(, document.getElementById("main")) +render(, document.getElementById("main")) +render(, document.getElementById("main")) diff --git a/react-color/react-color.d.ts b/react-color/react-color.d.ts new file mode 100644 index 0000000000..a771ca445f --- /dev/null +++ b/react-color/react-color.d.ts @@ -0,0 +1,250 @@ +// Type definitions for react-color v2.3.4 +// Project: https://casesandberg.github.io/react-color/ +// Definitions by: Karol Janyst +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace ReactColor { + import React = __React + + interface HSLColor { + a?: number + h: number + l: number + s: number + } + + interface RGBColor { + a?: number + b: number + g: number + r: number + } + + type Color = string | HSLColor | RGBColor + + interface ColorResult { + hex: string + hsl: HSLColor + rgb: RGBColor + } + + type ColorChangeHandler = (color: ColorResult) => void + + interface ColorPickerProps extends React.ClassAttributes { + color?: Color + onChange?: ColorChangeHandler + onChangeComplete?: ColorChangeHandler + } + + /* Predefined pickers */ + interface AlphaPickerProps extends ColorPickerProps { + height?: string + width?: string + } + interface AlphaPicker extends React.ComponentClass {} + const AlphaPicker: AlphaPicker + + interface BlockPickerProps extends ColorPickerProps { + colors?: Array + width?: string + } + interface BlockPicker extends React.ComponentClass {} + const BlockPicker: BlockPicker + + interface ChromePickerProps extends ColorPickerProps { + disableAlpha?: boolean + } + interface ChromePicker extends React.ComponentClass {} + const ChromePicker: ChromePicker + + interface CirclePickerProps extends ColorPickerProps { + colors?: Array + width?: string + } + interface CirclePicker extends React.ComponentClass {} + const CirclePicker: CirclePicker + + interface CompactPickerProps extends ColorPickerProps { + colors?: Array + } + interface CompactPicker extends React.ComponentClass {} + const CompactPicker: CompactPicker + + interface GithubPickerProps extends ColorPickerProps { + colors?: Array + width?: string + } + interface GithubPicker extends React.ComponentClass {} + const GithubPicker: GithubPicker + + interface HuePickerProps extends ColorPickerProps { + height?: string + width?: string + } + interface HuePicker extends React.ComponentClass {} + const HuePicker: HuePicker + + interface MaterialPickerProps extends ColorPickerProps {} + interface MaterialPicker extends React.ComponentClass {} + const MaterialPicker: MaterialPicker + + interface PhotoshopPickerProps extends ColorPickerProps { + header?: string + onAccept?: ColorChangeHandler + onCancel?: ColorChangeHandler + } + interface PhotoshopPicker extends React.ComponentClass {} + const PhotoshopPicker: PhotoshopPicker + + interface SketchPickerProps extends ColorPickerProps { + disableAlpha?: boolean + presetColors?: Array + width?: string + } + interface SketchPicker extends React.ComponentClass {} + const SketchPicker: SketchPicker + + interface SliderPickerProps extends ColorPickerProps {} + interface SliderPicker extends React.ComponentClass {} + const SliderPicker: SliderPicker + + interface SwatchesPickerProps extends ColorPickerProps { + colors?: Array> + height?: number + width?: number + } + interface SwatchesPicker extends React.ComponentClass {} + const SwatchesPicker: SwatchesPicker + + interface TwitterPickerProps extends ColorPickerProps {} + interface TwitterPicker extends React.ComponentClass {} + const TwitterPicker: TwitterPicker + + /* For custom picker */ + interface InjectedColorProps { + hex?: string + hsl?: HSLColor + rgb?: RGBColor + onChange?: ColorChangeHandler + } + + function CustomPicker(component: React.ComponentClass | React.StatelessComponent): React.ComponentClass + + interface CustomPickerProps extends React.ClassAttributes { + color?: Color + pointer?: React.ReactNode + onChange?: ColorChangeHandler + } + + interface AlphaProps extends CustomPickerProps {} + interface Alpha extends React.ComponentClass {} + const Alpha: Alpha + + interface EditableInputStyles { + input?: React.CSSProperties + label?: React.CSSProperties + wrap?: React.CSSProperties + } + interface EditableInputProps extends React.ClassAttributes { + color?: Color + label?: string + onChange?: ColorChangeHandler + styles?: EditableInputStyles + value?: any + } + interface EditableInput extends React.ComponentClass {} + const EditableInput: EditableInput + + interface HueProps extends CustomPickerProps { + direction?: "horizontal" | "vertical" + } + interface Hue extends React.ComponentClass {} + const Hue: Hue + + interface SaturationProps extends CustomPickerProps {} + interface Saturation extends React.ComponentClass {} + const Saturation: Saturation + + interface CheckboardProps extends React.ClassAttributes { + grey?: string + size?: number + white?: string + } + interface Checkboard extends React.ComponentClass {} + const Checkboard: Checkboard +} + +declare module "react-color/lib/components/common/Alpha" { export default ReactColor.Alpha } +declare module "react-color/lib/components/common/Checkboard" { export default ReactColor.Checkboard } +declare module "react-color/lib/components/common/EditableInput" { export default ReactColor.EditableInput } +declare module "react-color/lib/components/common/Hue" { export default ReactColor.Hue } +declare module "react-color/lib/components/common/Saturation" { export default ReactColor.Saturation } +declare module "react-color/lib/components/common/ColorWrap" { export default ReactColor.CustomPicker } + +declare module "react-color/lib/components/common" { + import Alpha from "react-color/lib/components/common/Alpha" + import Checkboard from "react-color/lib/components/common/Checkboard" + import EditableInput from "react-color/lib/components/common/EditableInput" + import Hue from "react-color/lib/components/common/Hue" + import Saturation from "react-color/lib/components/common/Saturation" + + export { + Alpha, + Checkboard, + EditableInput, + Hue, + Saturation + } +} + +declare module "react-color/lib/components/alpha/Alpha" { export default ReactColor.AlphaPicker } +declare module "react-color/lib/components/block/Block" { export default ReactColor.BlockPicker } +declare module "react-color/lib/components/chrome/Chrome" { export default ReactColor.ChromePicker } +declare module "react-color/lib/components/circle/Circle" { export default ReactColor.CirclePicker } +declare module "react-color/lib/components/compact/Compact" { export default ReactColor.CompactPicker } +declare module "react-color/lib/components/github/Github" { export default ReactColor.GithubPicker } +declare module "react-color/lib/components/hue/Hue" { export default ReactColor.HuePicker } +declare module "react-color/lib/components/meterial/Material" { export default ReactColor.MaterialPicker } +declare module "react-color/lib/components/photoshop/Photoshop" { export default ReactColor.PhotoshopPicker } +declare module "react-color/lib/components/sketch/Sketch" { export default ReactColor.SketchPicker } +declare module "react-color/lib/components/slider/Slider" { export default ReactColor.SliderPicker } +declare module "react-color/lib/components/swatches/Swatches" { export default ReactColor.SwatchesPicker } +declare module "react-color/lib/components/twitter/Twitter" { export default ReactColor.TwitterPicker } + +declare module "react-color" { + import AlphaPicker from "react-color/lib/components/alpha/Alpha" + import BlockPicker from "react-color/lib/components/block/Block" + import ChromePicker from "react-color/lib/components/chrome/Chrome" + import CirclePicker from "react-color/lib/components/circle/Circle" + import CompactPicker from "react-color/lib/components/compact/Compact" + import GithubPicker from "react-color/lib/components/github/Github" + import HuePicker from "react-color/lib/components/hue/Hue" + import MaterialPicker from "react-color/lib/components/meterial/Material" + import PhotoshopPicker from "react-color/lib/components/photoshop/Photoshop" + import SketchPicker from "react-color/lib/components/sketch/Sketch" + import SliderPicker from "react-color/lib/components/slider/Slider" + import SwatchesPicker from "react-color/lib/components/swatches/Swatches" + import TwitterPicker from "react-color/lib/components/twitter/Twitter" + import CustomPicker from "react-color/lib/components/common/ColorWrap" + + export type CustomPickerProps = ReactColor.CustomPickerProps + + export { + AlphaPicker, + BlockPicker, + ChromePicker, + CirclePicker, + CompactPicker, + GithubPicker, + HuePicker, + MaterialPicker, + PhotoshopPicker, + SketchPicker, + SliderPicker, + SwatchesPicker, + TwitterPicker, + CustomPicker + } +} From c080846200eecc80ba9e19fb0b8389f3104a361e Mon Sep 17 00:00:00 2001 From: Karol Janyst Date: Tue, 25 Oct 2016 19:39:56 +0900 Subject: [PATCH 043/246] Add definitions for react-css-transition-replace (#12118) --- .gitignore | 1 + .../react-css-transition-replace-tests.tsx | 18 +++++++++++++++ .../react-css-transition-replace.d.ts | 23 +++++++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 react-css-transition-replace/react-css-transition-replace-tests.tsx create mode 100644 react-css-transition-replace/react-css-transition-replace.d.ts diff --git a/.gitignore b/.gitignore index 35dd5a667e..a79d28de0c 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,4 @@ node_modules .sublimets .settings/launch.json +yarn.lock diff --git a/react-css-transition-replace/react-css-transition-replace-tests.tsx b/react-css-transition-replace/react-css-transition-replace-tests.tsx new file mode 100644 index 0000000000..7b51aee946 --- /dev/null +++ b/react-css-transition-replace/react-css-transition-replace-tests.tsx @@ -0,0 +1,18 @@ +// React CSS Transition Replace Test +// ================================================================================ +/// +/// +/// + +// Imports +// -------------------------------------------------------------------------------- +import * as React from "react" +import { render } from 'react-dom'; +import * as CSSTransitionReplace from "react-css-transition-replace" + +render( + +
Test
+
, + document.getElementById("main") +) diff --git a/react-css-transition-replace/react-css-transition-replace.d.ts b/react-css-transition-replace/react-css-transition-replace.d.ts new file mode 100644 index 0000000000..34d067904e --- /dev/null +++ b/react-css-transition-replace/react-css-transition-replace.d.ts @@ -0,0 +1,23 @@ +// Type definitions for react-css-transition-replace 2.0.1 +// Project: http://marnusw.github.io/react-css-transition-replace/ +// Definitions by: Karol Janyst +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// + +declare namespace TransitionReplace { + import React = __React + + interface CSSTransitionReplaceProps extends React.CSSTransitionGroupProps { + overflowHidden?: boolean + } + + type CSSTransitionReplace = React.ComponentClass +} + +declare module "react-css-transition-replace" { + var CSSTransitionReplace: TransitionReplace.CSSTransitionReplace + type CSSTransitionReplace = TransitionReplace.CSSTransitionReplace + export = CSSTransitionReplace +} From bd58de638896c437a35e27bfd9c1f2474d1ecc90 Mon Sep 17 00:00:00 2001 From: Karol Janyst Date: Tue, 25 Oct 2016 19:41:28 +0900 Subject: [PATCH 044/246] Add definitions for react-intl-redux (#12120) * Add definitions for react-intl-redux * Change credits --- react-intl-redux/react-intl-redux-tests.tsx | 28 +++++++++++++++++++++ react-intl-redux/react-intl-redux.d.ts | 28 +++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 react-intl-redux/react-intl-redux-tests.tsx create mode 100644 react-intl-redux/react-intl-redux.d.ts diff --git a/react-intl-redux/react-intl-redux-tests.tsx b/react-intl-redux/react-intl-redux-tests.tsx new file mode 100644 index 0000000000..d38abbcf0c --- /dev/null +++ b/react-intl-redux/react-intl-redux-tests.tsx @@ -0,0 +1,28 @@ +// React Intl Redux Test +// ================================================================================ +/// +/// +/// + +// Imports +// -------------------------------------------------------------------------------- +import * as React from "react" +import { render } from "react-dom" +import { Provider, IntlProvider, IntlState, IntlAction, intlReducer, updateIntl } from "react-intl-redux" + +var action: IntlAction = updateIntl({ locale : "en", messages : {} }) +var state: IntlState = intlReducer({ locale : "en", messages : {} }, action) + +render( + +
Test
+
, + document.getElementById("main") +) + +render( + +
Test
+
, + document.getElementById("main") +) diff --git a/react-intl-redux/react-intl-redux.d.ts b/react-intl-redux/react-intl-redux.d.ts new file mode 100644 index 0000000000..ac6e77d5cb --- /dev/null +++ b/react-intl-redux/react-intl-redux.d.ts @@ -0,0 +1,28 @@ +// Type definitions for react-intl-redux v0.1.0 +// Project: https://github.com/ratson/react-intl-redux +// Definitions by: Karol Janyst +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// +/// + +declare module "react-intl-redux" { + import { Action } from "redux" + import { Provider as ReduxProvider } from "react-redux" + import { IntlProvider as ReactIntlProvider } from "react-intl" + + interface IntlState { + locale: string + messages: any + } + + interface IntlAction extends Action { + payload?: IntlState + } + + export function intlReducer(state: IntlState, action: IntlAction): IntlState + export function updateIntl (opts: IntlState): IntlAction + export class IntlProvider extends ReactIntlProvider {} + export class Provider extends ReduxProvider {} +} From 62c6882723381197b638445d6035e19c1945dfa3 Mon Sep 17 00:00:00 2001 From: Karol Janyst Date: Tue, 25 Oct 2016 19:41:57 +0900 Subject: [PATCH 045/246] Add definitions for react-onclickoutside (#12121) --- .../react-onclickoutside-tests.tsx | 46 +++++++++++++++++++ .../react-onclickoutside.d.ts | 32 +++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 react-onclickoutside/react-onclickoutside-tests.tsx create mode 100644 react-onclickoutside/react-onclickoutside.d.ts diff --git a/react-onclickoutside/react-onclickoutside-tests.tsx b/react-onclickoutside/react-onclickoutside-tests.tsx new file mode 100644 index 0000000000..a39cef1f3f --- /dev/null +++ b/react-onclickoutside/react-onclickoutside-tests.tsx @@ -0,0 +1,46 @@ +// React onClickOutside Test +// ================================================================================ +/// +/// +/// + +// Imports +// -------------------------------------------------------------------------------- +import * as React from "react" +import { Component, StatelessComponent, MouseEvent } from "react" +import { render } from "react-dom" +import * as onClickOutside from "react-onclickoutside" + +interface TestProps extends ReactOnClickOutside.OnClickOutsideProps {} + +var TestStateless: StatelessComponent = (props: TestProps) => { + return (
Test
) +} +var TestStatelessWrapped = onClickOutside(TestStateless) + +class Test extends Component implements ReactOnClickOutside.OnClickOutsideComponent { + handleClickOutside (e: MouseEvent) {} + + render () { + return (
Test
) + } +} +var TestWrapped = onClickOutside(Test) + +render( + , + document.getElementById("main") +) + +render( + , + document.getElementById("main") +) diff --git a/react-onclickoutside/react-onclickoutside.d.ts b/react-onclickoutside/react-onclickoutside.d.ts new file mode 100644 index 0000000000..ca807da848 --- /dev/null +++ b/react-onclickoutside/react-onclickoutside.d.ts @@ -0,0 +1,32 @@ +// Type definitions for react-onclickoutside v5.7.0 +// Project: https://github.com/Pomax/react-onclickoutside +// Definitions by: Karol Janyst +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace ReactOnClickOutside { + import React = __React + + interface OnClickOutsideComponent { + handleClickOutside(e: React.MouseEvent): void + } + + interface OnClickOutsideProps { + disableOnClickOutside?: boolean | Function + enableOnClickOutside?: Function + eventTypes?: string | Array + outsideClickIgnoreClass?: string + preventDefault?: boolean + stopPropagation?: boolean + } + + interface onClickOutside { +
(component: React.ComponentClass | React.StatelessComponent): React.ComponentClass + } +} + +declare module "react-onclickoutside" { + const onClickOutside: ReactOnClickOutside.onClickOutside + export = onClickOutside +} From 19490da3d7a39a1edfb6f22660d2254eaf632dd9 Mon Sep 17 00:00:00 2001 From: Karol Janyst Date: Tue, 25 Oct 2016 19:42:14 +0900 Subject: [PATCH 046/246] Add definitions for validatorjs (#12123) --- validatorjs/validatorjs-tests.ts | 40 ++++++++++++++++++ validatorjs/validatorjs.d.ts | 72 ++++++++++++++++++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 validatorjs/validatorjs-tests.ts create mode 100644 validatorjs/validatorjs.d.ts diff --git a/validatorjs/validatorjs-tests.ts b/validatorjs/validatorjs-tests.ts new file mode 100644 index 0000000000..1c2096c03b --- /dev/null +++ b/validatorjs/validatorjs-tests.ts @@ -0,0 +1,40 @@ +// ValidatorJS Test +// ================================================================================ +/// + +// Imports +// -------------------------------------------------------------------------------- +import * as Validator from "validatorjs" + +var rules: any = { + foo: "required" +} + +var data: any = { + foo: "bar" +} + +var validator: ValidatorJS.Validator = new Validator(data, rules) + +var passes: boolean = validator.passes() as boolean +validator.passes(() => {}) + +var fails: boolean = validator.fails() as boolean +validator.fails(() => {}) + +var check: boolean = validator.check() + +var errors: ValidatorJS.Errors = validator.errors +var all: ValidatorJS.ValidationErrors = errors.all() +var error: Array = errors.get("foo") +var first: string | boolean = errors.first("foo") +var has: boolean = errors.has("foo") + +Validator.setMessages("en", {}) +var messages: ValidatorJS.ErrorMessages = Validator.getMessages("en") +Validator.useLang("en") +var lang: string = Validator.getDefaultLang() +Validator.setAttributeFormatter((attributes: any) => ({})) +Validator.stopOnError(true) +Validator.register("custom", () => {}, "error.custom") +Validator.registerAsync("custom", () => {}, "error.custom") diff --git a/validatorjs/validatorjs.d.ts b/validatorjs/validatorjs.d.ts new file mode 100644 index 0000000000..50df271a94 --- /dev/null +++ b/validatorjs/validatorjs.d.ts @@ -0,0 +1,72 @@ +// Type definitions for validatorjs v3.7.0 +// Project: https://github.com/skaterdav85/validatorjs +// Definitions by: Karol Janyst +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace ValidatorJS { + + interface ParsedRule { + attribute: Array<{ name: string, value: any }> + } + + interface ValidationErrors { + [field: string]: string + } + + interface ErrorMessages { + [key: string]: string + } + + interface AttributeNames { + [attribute: string]: string + } + + type AttributeFormatter = (attribute: any) => any + + interface Errors { + errors : ValidationErrors + add (attribute: string, message: string): void + get (attribute: string): Array + first (attribute: string): string | boolean + all (): ValidationErrors + has (attribute: string): boolean + } + + interface ValidatorStatic { + new (data: A, rules: any, customMessages?: ErrorMessages): Validator + setMessages (lang: string, messages: ErrorMessages): any + getMessages (lang: string): ErrorMessages + useLang (lang: string): void + getDefaultLang (): string + setAttributeFormatter (func: AttributeFormatter): void + stopOnError (attributes: boolean | Array): void + register (name: string, fn: Function, message: string): void + registerAsync (name: string, fn: Function, message: string): void + } + + interface Validator { + lang: string + input: A + messages: ErrorMessages + errors: Errors + errorCount: number + hasAsync: boolean + rules: any + numericRules: Array + attributeFormatter: AttributeFormatter + check (): boolean + checkAsync (passes?: Function, fails?: Function): void + setAttributeNames (attributes: AttributeNames): void + setAttributeFormatter (func: AttributeFormatter): void + getRule (name: string): Function + stopOnError (passes?: Function): boolean | void + passes (passes?: Function): boolean | void + fails (fails?: Function): boolean | void + } + +} + +declare module "validatorjs" { + const Validator: ValidatorJS.ValidatorStatic + export = Validator +} From 9ebe39be08d0805e5d9c5449a363343a7d9443c1 Mon Sep 17 00:00:00 2001 From: Karol Janyst Date: Tue, 25 Oct 2016 19:43:11 +0900 Subject: [PATCH 047/246] Add definitions for color (#12114) * Add definitions for color * Rename color-test.ts to color-tests.ts --- color/color-tests.ts | 85 +++++++++++++++++++++++ color/color.d.ts | 162 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 247 insertions(+) create mode 100644 color/color-tests.ts create mode 100644 color/color.d.ts diff --git a/color/color-tests.ts b/color/color-tests.ts new file mode 100644 index 0000000000..9bfc656206 --- /dev/null +++ b/color/color-tests.ts @@ -0,0 +1,85 @@ +// Color Test +// ================================================================================ +/// + +// Imports +// -------------------------------------------------------------------------------- +import * as Color from "color" + +var color: Color.Color = Color("white") +var colorOther: Color.Color = Color("black") + +var colorRGB: Color.Color = color.rgb(0, 0, 0) +var colorRGB: Color.Color = color.rgb([0, 0, 0]) +var rgb: Color.RGBColor = color.rgb() + +var colorHSL: Color.Color = color.hsl([0, 0, 0]) +var hsl: Color.HSLColor = color.hsl() + +var colorHSV: Color.Color = color.hsv([0, 0, 0]) +var hsv: Color.HSVColor = color.hsv() + +var colorHBW: Color.Color = color.hbw([0, 0, 0]) +var hbw: Color.HBWColor = color.hbw() + +var colorCMYK: Color.Color = color.cmyk([0, 0, 0, 0]) +var cmyk: Color.CMYKColor = color.cmyk() + +var hex: string = color.hexString() +var percent: string = color.percentString() +var keyword: string | void = color.keyword() +var alpha: number = color.alpha() +var red: number = color.red() +var green: number = color.green() +var blue: number = color.blue() +var hue: number = color.hue() +var saturation: number = color.saturation() +var lightness: number = color.lightness() +var saturationv: number = color.saturationv() +var value: number = color.value() +var whiteness: number = color.whiteness() +var blackness: number = color.blackness() +var cyan: number = color.cyan() +var magenta: number = color.magenta() +var yellow: number = color.yellow() +var black: number = color.black() +var luminosity: number = color.luminosity() +var contrast: number = color.contrast(colorOther) +var dark: boolean = color.dark() +var light: boolean = color.light() +var level: string = color.level(colorOther) + +var chain: Color.Color = color + .rgb(0, 0, 0) + .hsl([0, 0, 0]) + .hsv([0, 0, 0]) + .hbw([0, 0, 0]) + .cmyk([0, 0, 0 ,0]) + .alpha(0) + .red(0) + .green(0) + .blue(0) + .hue(0) + .saturation(0) + .lightness(0) + .saturationv(0) + .value(0) + .whiteness(0) + .blackness(0) + .cyan(0) + .magenta(0) + .yellow(0) + .black(0) + .negate() + .lighten(0) + .darken(0) + .saturate(0) + .desaturate(0) + .greyscale() + .whiten(0) + .blacken(0) + .clearer(0) + .opaquer(0) + .rotate(0) + .mix(colorOther, 0) + .clone() diff --git a/color/color.d.ts b/color/color.d.ts new file mode 100644 index 0000000000..7c697004e7 --- /dev/null +++ b/color/color.d.ts @@ -0,0 +1,162 @@ +// Type definitions for color v0.12.0 +// Project: https://github.com/qix-/color +// Definitions by: Karol Janyst +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace Color { + + interface RGBColor { + r: number + g: number + b: number + a?: number + } + + interface FullRGBColor { + red: number + green: number + blue: number + alpha?: number + } + + interface HSLColor { + h: number + s: number + l: number + a?: number + } + + interface FullHSLColor { + hue: number + saturation: number + lightness: number + alpha?: number + } + + interface HSVColor { + h: number + s: number + v: number + } + + interface FullHSVColor { + hue: number + saturation: number + value: number + } + + interface HBWColor { + h: number + b: number + w: number + } + + interface FullHBWColor { + hue: number + whiteness: number + blackness: number + } + + interface CMYKColor { + c: number + m: number + y: number + k: number + } + + interface FullCMYKColor { + cyan: number + magenta: number + yellow: number + black: number + } + + type ColorParam = string | RGBColor | FullRGBColor | HSLColor | FullHSLColor | HSVColor + | FullHSVColor | HBWColor | FullHBWColor | CMYKColor | FullCMYKColor + + interface Color { + (color: ColorParam | Color) : Color + rgb(values: Array): Color + rgb(r: number, g: number, b: number, a?: number): Color + rgb(values: RGBColor): Color + rgb(values: FullRGBColor): Color + rgb(): RGBColor + rgbArray(): Array + rgbString(): string + rgbaString(): string + rgbNumber(): number + hsl(values: Array): Color + hsl(): HSLColor + hslArray(): Array + hslString(): string + hslaString(): string + hsv(values: Array): Color + hsv(): HSVColor + hsvArray(): Array + hsvString(): string + hbw(values: Array): Color + hbw(): HBWColor + hbwArray(): Array + hbwString(): string + cmyk(values: Array): Color + cmyk(): CMYKColor + cmykArray(): Array + cmykString(): string + hexString(): string + percentString(): string + keyword(): string | void + alpha(alpha: number): Color + alpha(): number + red(red: number): Color + red(): number + green(green: number): Color + green(): number + blue(blue: number): Color + blue(): number + hue(hue: number): Color + hue(): number + saturation(saturation: number): Color + saturation(): number + lightness(lightness: number): Color + lightness(): number + saturationv(saturationv: number): Color + saturationv(): number + value(value: number): Color + value(): number + whiteness(whiteness: number): Color + whiteness(): number + blackness(blackness: number): Color + blackness(): number + cyan(cyan: number): Color + cyan(): number + magenta(magenta: number): Color + magenta(): number + yellow(yellow: number): Color + yellow(): number + black(black: number): Color + black(): number + luminosity(): number + contrast(color: Color): number + dark(): boolean + light(): boolean + negate(): Color + lighten(value: number): Color + darken(value: number): Color + saturate(value: number): Color + desaturate(value: number): Color + greyscale(): Color + whiten(value: number): Color + blacken(value: number): Color + clearer(value: number): Color + opaquer(value: number): Color + rotate(value: number): Color + mix(color: Color, value?: number): Color + level(color: Color): string + clone(): Color + } +} + +declare module "color" { + const Color: Color.Color + export = Color +} From 6f617176460d27db7c78fd8ca9650e84f146b6db Mon Sep 17 00:00:00 2001 From: Shantanu Bhadoria Date: Tue, 25 Oct 2016 19:15:38 +0800 Subject: [PATCH 048/246] Added missing attributes for noble Peripheral class (#12124) * Added missing attributes for noble peripheral * Added new contributor name for reference * Updated contributors --- CONTRIBUTORS.md | 3 ++- noble/noble.d.ts | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 44f0d8e9a0..8b263f19ae 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -401,6 +401,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](egg.js/egg.js.d.ts) [Egg.js](https://github.com/mikeflynn/egg.js) by [Markus Peloso](https://github.com/ToastHawaii) * [:link:](ejs-locals/ejs-locals.d.ts) [ejs-locals](https://github.com/randometc/ejs-locals) by [jt000](https://github.com/jt000) * [:link:](ejs/ejs.d.ts) [ejs.js](http://ejs.co) by [Ben Liddicott](https://github.com/benliddicott/DefinitelyTyped) +* [:link:](ejson/ejson.d.ts) [ejson](https://www.npmjs.com/package/ejson) by [Shantanu Bhadoria](https://github.com/shantanubhadoria) * [:link:](elasticsearch/elasticsearch.d.ts) [elasticsearch](https://www.elastic.co) by [Casper Skydt](https://github.com/CasperSkydt/DefinitelyTyped), [Blake Smith](https://github.com/bfsmith/DefinitelyTyped) * [:link:](jquery.elang/jquery.elang.d.ts) [eLang](https://github.com/sumegizoltan/ELang) by [Zoltan Sumegi](https://github.com/sumegizoltan) * [:link:](github-electron/github-electron.d.ts) [Electron](http://electron.atom.io) by [jedmao](https://github.com/jedmao), [rhysd](https://rhysd.github.io), [Milan Burda](https://github.com/miniak) @@ -1189,7 +1190,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](ng-stomp/ng-stomp.d.ts) [ngStomp](https://github.com/beevelop/ng-stomp) by [Lukasz Potapczuk](https://github.com/lpotapczuk) * [:link:](ngstorage/ngstorage.d.ts) [ngstorage](https://github.com/gsklee/ngStorage) by [Jakub Pistek](https://github.com/kubiq) * [:link:](nightmare/nightmare.d.ts) [Nightmare](https://github.com/segmentio/nightmare) by [horiuchi](https://github.com/horiuchi) -* [:link:](noble/noble.d.ts) [noble](https://github.com/sandeepmistry/noble) by [Seon-Wook Park](https://github.com/swook), [Hans Bakker](https://github.com/wind-rider) +* [:link:](noble/noble.d.ts) [noble](https://github.com/sandeepmistry/noble) by [Seon-Wook Park](https://github.com/swook), [Hans Bakker](https://github.com/wind-rider), [Shantanu Bhadoria](https://github.com/shantanubhadoria) * [:link:](nock/nock.d.ts) [nock](https://github.com/pgte/nock) by [bonnici](https://github.com/bonnici) * [:link:](node-imap/imap.d.ts) [node imap](https://github.com/mscdex/node-imap) by [Steve Fenton](https://github.com/Steve-Fenton) * [:link:](oauth2-server/oauth2-server.d.ts) [Node OAuth2 Server](https://github.com/thomseddon/node-oauth2-server) by [Robbie Van Gorkom](https://github.com/vangorra) diff --git a/noble/noble.d.ts b/noble/noble.d.ts index 8003bdbc68..584d3f792a 100644 --- a/noble/noble.d.ts +++ b/noble/noble.d.ts @@ -1,6 +1,6 @@ // Type definitions for noble // Project: https://github.com/sandeepmistry/noble -// Definitions by: Seon-Wook Park , Hans Bakker +// Definitions by: Seon-Wook Park , Hans Bakker , Shantanu Bhadoria // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -20,7 +20,11 @@ declare module "noble" { export function on(event: "discover", listener: (peripheral: Peripheral) => void): events.EventEmitter; export class Peripheral extends events.EventEmitter { + id: string; uuid: string; + address: string; + addressType: string; + connectable: boolean; advertisement: Advertisement; rssi: number; services: Service[]; From c94d21a5e09c194bd1189b90cdb9787f12c6a964 Mon Sep 17 00:00:00 2001 From: Niels Kristian Hansen Skovmand Date: Tue, 25 Oct 2016 15:07:49 +0200 Subject: [PATCH 049/246] Improvement to Spotify API Typings (#12130) * Improvement to Spotify API Typings - Improve references to endpoints in tests-file - Add a few missing endpoint tests - Add Recommendations Object for options to send to the API for Recommendations * Fix Header * Fix Header * Update comment in test file --- spotify-api/spotify-api-tests.ts | 502 +++++++++++++++++++++++++++---- spotify-api/spotify-api.d.ts | 219 +++++++++++++- 2 files changed, 649 insertions(+), 72 deletions(-) diff --git a/spotify-api/spotify-api-tests.ts b/spotify-api/spotify-api-tests.ts index d9864b2d9a..0ec4c7e123 100644 --- a/spotify-api/spotify-api-tests.ts +++ b/spotify-api/spotify-api-tests.ts @@ -1,22 +1,24 @@ +// Tests for the type definitions for The Spotify Web API (including changes March 29th 2016) +// Project: https://developer.spotify.com/web-api/ +// Definitions by: Niels Kristian Hansen Skovmand +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + /* * This test file contains the sample output from The Spotify Web Api obtained from [The Web API Console](https://developer.spotify.com/web-api/console/) - * The standard suggested values for input were used. * - * Updated for the March 29th, 2016 changes to the Spotify Web Api. - * - * Combined with the typings it should compile without errors. + * Run the tests (they should always compile without any errors): + * tsc spotify-api-tests.ts --target es6 --noImplicitAny * * The order of tests is the same as on [The Spotify Web Api](https://developer.spotify.com/web-api/endpoint-reference/) - * To find tests, search for "* Tests" instead of scrolling to keep sane. */ /// - - - /** - * Tests the response of https://developer.spotify.com/web-api/get-album/ + * Get an Album + * + * GET /v1/albums/{id} + * https://developer.spotify.com/web-api/get-album/ */ const getSingleAlbum : SpotifyApi.SingleAlbumResponse = { "album_type" : "album", @@ -401,9 +403,11 @@ const getSingleAlbum : SpotifyApi.SingleAlbumResponse = { - /** - * Tests https://developer.spotify.com/web-api/get-several-albums/ + * Get Several Albums + * + * GET /v1/albums?ids={ids} + * https://developer.spotify.com/web-api/get-several-albums/ */ const getMultipleAlbumsResponse : SpotifyApi.MultipleAlbumsResponse = { "albums" : [ { @@ -2236,7 +2240,10 @@ const getMultipleAlbumsResponse : SpotifyApi.MultipleAlbumsResponse = { /** - * Tests https://developer.spotify.com/web-api/get-albums-tracks/ + * Get an Album’s Tracks + * + * GET /v1/albums/{id}/tracks + * https://developer.spotify.com/web-api/get-albums-tracks/ */ const getAlbumTracks : SpotifyApi.AlbumTracksResponse = { "href" : "https://api.spotify.com/v1/albums/6akEvsycLGftJxYudPjmqK/tracks?offset=0&limit=2", @@ -2302,7 +2309,10 @@ const getAlbumTracks : SpotifyApi.AlbumTracksResponse = { /** - * Tests https://developer.spotify.com/web-api/get-artist/ + * Get an Artist + * + * GET /v1/artists/{id} + * https://developer.spotify.com/web-api/get-artist/ */ const getAnArtist : SpotifyApi.SingleArtistResponse = { "external_urls" : { @@ -2341,7 +2351,10 @@ const getAnArtist : SpotifyApi.SingleArtistResponse = { /** - * Tests https://developer.spotify.com/web-api/get-several-artists/ + * Get Several Artists + * + * GET /v1/artists + * https://developer.spotify.com/web-api/get-several-artists/ */ const getSeveralArtists : SpotifyApi.MultipleArtistsResponse = { "artists" : [ { @@ -2415,7 +2428,10 @@ const getSeveralArtists : SpotifyApi.MultipleArtistsResponse = { /** - * Tests https://developer.spotify.com/web-api/get-artists-albums/ + * Get an Artist’s Albums + * + * GET /v1/artists/{id}/albums + * https://developer.spotify.com/web-api/get-artists-albums/ */ const getArtistsAlbums : SpotifyApi.ArtistsAlbumsResponse = { "href" : "https://api.spotify.com/v1/artists/1vCWHaC5f2uS3yhpwWbIA6/albums?offset=0&limit=2&album_type=single", @@ -2477,6 +2493,12 @@ const getArtistsAlbums : SpotifyApi.ArtistsAlbumsResponse = { +/** + * Get an Artist’s Top Tracks + * + * GET /v1/artists/{id}/top-tracks + * https://developer.spotify.com/web-api/get-artists-top-tracks/ + */ const getArtistsTopTracks : SpotifyApi.ArtistsTopTracksResponse = { "tracks" : [ { "album" : { @@ -3042,6 +3064,12 @@ const getArtistsTopTracks : SpotifyApi.ArtistsTopTracksResponse = { +/** + * Get an Artist’s Related Artists + * + * GET /v1/artists/{id}/related-artists + * https://developer.spotify.com/web-api/get-related-artists/ + */ const getArtistRelatedArtists : SpotifyApi.ArtistsRelatedArtistsResponse = { "artists" : [ { "external_urls" : { @@ -3687,7 +3715,10 @@ const getArtistRelatedArtists : SpotifyApi.ArtistsRelatedArtistsResponse = { /** - * Tests https://developer.spotify.com/get-audio-features/ + * Get audio features for a track + * + * GET /v1/audio-features/{id} + * https://developer.spotify.com/web-api/get-audio-features/ */ const singleAudioFeaturesResponse : SpotifyApi.AudioFeaturesResponse = { "danceability": 0.281, @@ -3715,7 +3746,10 @@ const singleAudioFeaturesResponse : SpotifyApi.AudioFeaturesResponse = { /** - * Tests https://developer.spotify.com/web-api/get-several-audio-features/ + * Get audio features for several tracks + * + * GET /v1/audio-features?ids={ids} + * https://developer.spotify.com/get-several-audio-features/ */ const severalAudioFeaturesResponse : SpotifyApi.MultipleAudioFeaturesResponse = { audio_features: [ { "danceability": 0.808, @@ -3782,7 +3816,10 @@ const severalAudioFeaturesResponse : SpotifyApi.MultipleAudioFeaturesResponse = /** - * Tests https://developer.spotify.com/web-api/get-list-featured-playlists/ + * Get a list of featured playlists + * + * GET /v1/browse/featured-playlists + * https://developer.spotify.com/web-api/get-list-featured-playlists/ */ const featuredPlaylists : SpotifyApi.ListOfFeaturedPlaylistsResponse = { "message" : "Enjoy a mellow afternoon.", @@ -3861,7 +3898,10 @@ const featuredPlaylists : SpotifyApi.ListOfFeaturedPlaylistsResponse = { /** - * Tests https://developer.spotify.com/web-api/get-list-new-releases/ + * Get a list of new releases + * + * GET /v1/browse/new-releases + * https://developer.spotify.com/web-api/get-list-new-releases/ */ const newReleases : SpotifyApi.ListOfNewReleasesResponse = { "albums" : { @@ -4359,7 +4399,10 @@ const newReleases : SpotifyApi.ListOfNewReleasesResponse = { /** - * Tests https://developer.spotify.com/web-api/get-list-categories/ + * Get a list of categories + * + * GET /v1/browse/categories + * https://developer.spotify.com/web-api/get-list-categories/ */ const listOfCategories : SpotifyApi.MultipleCategoriesResponse = { "categories" : { @@ -4557,7 +4600,10 @@ const listOfCategories : SpotifyApi.MultipleCategoriesResponse = { /** - * Tests https://developer.spotify.com/web-api/get-category/ + * Get a category + * + * GET /v1/browse/categories/{category_id} + * https://developer.spotify.com/web-api/get-category/ */ const category : SpotifyApi.SingleCategoryResponse = { "href" : "https://api.spotify.com/v1/browse/categories/rock", @@ -4574,7 +4620,10 @@ const category : SpotifyApi.SingleCategoryResponse = { /** - * Tests https://developer.spotify.com/web-api/get-categorys-playlists/ + * Get a categorys playlists + * + * GET /v1/browse/categories/{id}/playlists + * https://developer.spotify.com/web-api/get-categorys-playlists/ */ const categoryPlaylists : SpotifyApi.CategoryPlaylistsReponse = { "playlists" : { @@ -4651,8 +4700,12 @@ const categoryPlaylists : SpotifyApi.CategoryPlaylistsReponse = { + /** - * Tests https://developer.spotify.com/web-api/get-current-users-profile/ + * Get Current User’s Profile + * + * GET /v1/me + * https://developer.spotify.com/web-api/get-current-users-profile/ */ const userProfilePrivate : SpotifyApi.CurrentUsersProfileResponse = { "birthdate" : "1982-06-29", @@ -4678,7 +4731,10 @@ const userProfilePrivate : SpotifyApi.CurrentUsersProfileResponse = { /** - * Tests https://developer.spotify.com/web-api/get-followed-artists/ + * Get User’s Followed Artists + * + * GET /v1/me/following?type=artist + * https://developer.spotify.com/web-api/get-followed-artists/ */ const followedArtists : SpotifyApi.UsersFollowedArtistsResponse = { "artists" : { @@ -4757,7 +4813,10 @@ const followedArtists : SpotifyApi.UsersFollowedArtistsResponse = { /** - * Tests https://developer.spotify.com/web-api/follow-artists-users/ + * Follow artists or users + * + * PUT /v1/me/following + * https://developer.spotify.com/web-api/follow-artists-users/ */ const followArtistsOrUsers : SpotifyApi.FollowArtistsOrUsersResponse = {} @@ -4765,7 +4824,10 @@ const followArtistsOrUsers : SpotifyApi.FollowArtistsOrUsersResponse = {} /** - * Tests https://developer.spotify.com/web-api/unfollow-artists-users/ + * Unfollow artists or users + * + * DELETE /v1/me/following + * https://developer.spotify.com/web-api/unfollow-artists-users/ */ const unfollowArtistsOrUsers : SpotifyApi.UnfollowArtistsOrUsersResponse = {} @@ -4773,7 +4835,10 @@ const unfollowArtistsOrUsers : SpotifyApi.UnfollowArtistsOrUsersResponse = {} /** - * Tests https://developer.spotify.com/web-api/check-current-user-follows/ + * Check if User Follows Users or Artists + * + * GET /v1/me/following/contains + * https://developer.spotify.com/web-api/check-current-user-follows/ */ const checkCurrentUserFollows : SpotifyApi.UserFollowsUsersOrArtistsResponse = [ true, true, false ]; @@ -4781,7 +4846,10 @@ const checkCurrentUserFollows : SpotifyApi.UserFollowsUsersOrArtistsResponse = [ /** - * Tests https://developer.spotify.com/web-api/follow-playlist/ + * Follow a Playlist + * + * PUT /v1/users/{owner_id}/playlists/{playlist_id}/followers + * https://developer.spotify.com/web-api/follow-playlist/ */ const followPlaylist : SpotifyApi.FollowPlaylistReponse = {}; @@ -4789,7 +4857,10 @@ const followPlaylist : SpotifyApi.FollowPlaylistReponse = {}; /** - * Tests https://developer.spotify.com/web-api/unfollow-playlist/ + * Unfollow a Playlist + * + * DELETE /v1/users/{owner_id}/playlists/{playlist_id}/followers + * https://developer.spotify.com/web-api/unfollow-playlist/ */ const unfollowPlaylist : SpotifyApi.UnfollowPlaylistReponse = {}; @@ -4797,7 +4868,10 @@ const unfollowPlaylist : SpotifyApi.UnfollowPlaylistReponse = {}; /** - * Tests https://developer.spotify.com/web-api/save-tracks-user/ + * Save tracks for user + * + * PUT /v1/me/tracks?ids={ids} + * https://developer.spotify.com/web-api/save-tracks-user/ */ const saveTracksForUser : SpotifyApi.SaveTracksForUserResponse = {}; @@ -4805,7 +4879,10 @@ const saveTracksForUser : SpotifyApi.SaveTracksForUserResponse = {}; /** - * Tests https://developer.spotify.com/web-api/console/get-current-user-saved-tracks + * Get user's saved tracks + * + * GET /v1/me/tracks + * https://developer.spotify.com/web-api/get-users-saved-tracks/ */ const getSavedTracks : SpotifyApi.UsersSavedTracksResponse = { "href" : "https://api.spotify.com/v1/me/tracks?offset=0&limit=5&market=DK", @@ -5101,7 +5178,10 @@ const getSavedTracks : SpotifyApi.UsersSavedTracksResponse = { /** - * Tests https://developer.spotify.com/web-api/remove-tracks-user/ + * Remove User’s Saved Tracks + * + * DELETE /v1/me/tracks?ids={ids} + * https://developer.spotify.com/web-api/remove-tracks-user/ */ const removeUsersTracks : SpotifyApi.RemoveUsersSavedTracksResponse = {}; @@ -5109,7 +5189,10 @@ const removeUsersTracks : SpotifyApi.RemoveUsersSavedTracksResponse = {}; /** - * Tests https://developer.spotify.com/web-api/check-users-saved-tracks/ + * Check User’s Saved Tracks + * + * GET /v1/me/tracks/contains?ids={ids} + * https://developer.spotify.com/web-api/check-users-saved-tracks/ */ const checkUsersTracks : SpotifyApi.CheckUserSavedAlbumsResponse = [ false, false, true ]; @@ -5117,15 +5200,167 @@ const checkUsersTracks : SpotifyApi.CheckUserSavedAlbumsResponse = [ false, fals /** - * Tests https://developer.spotify.com/web-api/save-albums-user/ + * Save albums for user + * + * PUT /v1/me/albums?ids={ids} + * https://developer.spotify.com/web-api/save-albums-user/ */ const saveAlbumForUser : SpotifyApi.SaveAlbumsForUserResponse = {}; +/** + * Get user's saved albums + * + * GET /v1/me/albums + * https://developer.spotify.com/web-api/get-users-saved-albums/ + */ +const usersSavedAlbums : SpotifyApi.UsersSavedAlbumsResponse = { + "href" : "https://api.spotify.com/v1/me/albums?offset=0&limit=1", + "items" : [ { + "added_at" : "2015-11-26T19:13:31Z", + "album" : { + "album_type" : "album", + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/58RMTlPJKbmpmVk1AmRK3h" + }, + "href" : "https://api.spotify.com/v1/artists/58RMTlPJKbmpmVk1AmRK3h", + "id" : "58RMTlPJKbmpmVk1AmRK3h", + "name" : "Abidaz", + "type" : "artist", + "uri" : "spotify:artist:58RMTlPJKbmpmVk1AmRK3h" + } ], + "available_markets" : [ "AR", "AT", "AU", "BE", "BR", "CL", "CO", "CY", "CZ", "DE" ], + "copyrights" : [ { + "text" : "(C) 2013 Soblue Music Group AB, Under exclusive license to Universal Music AB", + "type" : "C" + }, { + "text" : "(P) 2013 Soblue Music Group AB, Under exclusive license to Universal Music AB", + "type" : "P" + } ], + "external_ids" : { + "upc" : "00602537623730" + }, + "external_urls" : { + "spotify" : "https://open.spotify.com/album/5m4VYOPoIpkV0XgOiRKkWC" + }, + "genres" : [ ], + "href" : "https://api.spotify.com/v1/albums/5m4VYOPoIpkV0XgOiRKkWC", + "id" : "5m4VYOPoIpkV0XgOiRKkWC", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/ccbb1e3bea2461e69783895e880965b171e29f4c", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/2210b7d23f320a2cab2736bd3b3b948415dd21d8", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/609153aca7f4760136d97fbaccdb4ec0757e4c9e", + "width" : 64 + } ], + "name" : "In & ut", + "popularity" : 49, + "release_date" : "2013-01-01", + "release_date_precision" : "day", + "tracks" : { + "href" : "https://api.spotify.com/v1/albums/5m4VYOPoIpkV0XgOiRKkWC/tracks?offset=0&limit=50", + "items" : [ { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/58RMTlPJKbmpmVk1AmRK3h" + }, + "href" : "https://api.spotify.com/v1/artists/58RMTlPJKbmpmVk1AmRK3h", + "id" : "58RMTlPJKbmpmVk1AmRK3h", + "name" : "Abidaz", + "type" : "artist", + "uri" : "spotify:artist:58RMTlPJKbmpmVk1AmRK3h" + }, { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/1l63szZeUpN1m87MOD1u7K" + }, + "href" : "https://api.spotify.com/v1/artists/1l63szZeUpN1m87MOD1u7K", + "id" : "1l63szZeUpN1m87MOD1u7K", + "name" : "Chapee", + "type" : "artist", + "uri" : "spotify:artist:1l63szZeUpN1m87MOD1u7K" + }, { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/1VLf7Ncxb5Jga6eyd3jh6K" + }, + "href" : "https://api.spotify.com/v1/artists/1VLf7Ncxb5Jga6eyd3jh6K", + "id" : "1VLf7Ncxb5Jga6eyd3jh6K", + "name" : "C.U.P", + "type" : "artist", + "uri" : "spotify:artist:1VLf7Ncxb5Jga6eyd3jh6K" + } ], + "available_markets" : [ "AR", "AT", "AU", "BE", "BR", "CL", "CO", "CY", "CZ", "DE" ], + "disc_number" : 1, + "duration_ms" : 170920, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/3VNWq8rTnQG6fM1eldSpZ0" + }, + "href" : "https://api.spotify.com/v1/tracks/3VNWq8rTnQG6fM1eldSpZ0", + "id" : "3VNWq8rTnQG6fM1eldSpZ0", + "name" : "E.C.", + "preview_url" : "https://p.scdn.co/mp3-preview/f95e0dba1a76b44fa2b52da2bc273d4f1c4126a5", + "track_number" : 1, + "type" : "track", + "uri" : "spotify:track:3VNWq8rTnQG6fM1eldSpZ0" + }, + { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/58RMTlPJKbmpmVk1AmRK3h" + }, + "href" : "https://api.spotify.com/v1/artists/58RMTlPJKbmpmVk1AmRK3h", + "id" : "58RMTlPJKbmpmVk1AmRK3h", + "name" : "Abidaz", + "type" : "artist", + "uri" : "spotify:artist:58RMTlPJKbmpmVk1AmRK3h" + } ], + "available_markets" : [ "AR", "AT", "AU", "BE", "BR", "CL", "CO", "CY", "CZ", "DE", "DK", "EE" ], + "disc_number" : 1, + "duration_ms" : 165946, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/6ZrVKylVlxkaXHj42O0q2r" + }, + "href" : "https://api.spotify.com/v1/tracks/6ZrVKylVlxkaXHj42O0q2r", + "id" : "6ZrVKylVlxkaXHj42O0q2r", + "name" : "Råknas - Radio Edit", + "preview_url" : "https://p.scdn.co/mp3-preview/a7c9a4bfa9e346e3733e9d88076ad1ae409136fb", + "track_number" : 13, + "type" : "track", + "uri" : "spotify:track:6ZrVKylVlxkaXHj42O0q2r" + } ], + "limit" : 50, + "next" : null, + "offset" : 0, + "previous" : null, + "total" : 13 + }, + "type" : "album", + "uri" : "spotify:album:5m4VYOPoIpkV0XgOiRKkWC" + } + } ], + "limit" : 1, + "next" : "https://api.spotify.com/v1/me/albums?offset=1&limit=1", + "offset" : 0, + "previous" : null, + "total" : 19 +} + + /** - * Tests https://developer.spotify.com/web-api/remove-albums-user/ + * Remove Albums for Current User + * + * DELETE /v1/me/albums?ids={ids} + * https://developer.spotify.com/web-api/remove-albums-user/ */ const removeAlbumForUser : SpotifyApi.RemoveAlbumsForUserResponse = {}; @@ -5134,14 +5369,20 @@ const removeAlbumForUser : SpotifyApi.RemoveAlbumsForUserResponse = {}; /** - * Tests https://developer.spotify.com/web-api/check-users-saved-albums/ + * Check user's saved albums + * + * DELETE /v1/me/albums/contains?ids={ids} + * https://developer.spotify.com/web-api/check-users-saved-albums/ */ const checkUsersSavedAlbums : SpotifyApi.CheckUserSavedAlbumsResponse = [ true, false, false, true ]; /** - * Tests https://developer.spotify.com/web-api/get-users-top-artists-and-tracks/ + * Get a User’s Top Artists and Tracks (Note: This is only Artists) + * + * GET /v1/me/top/{type} + * https://developer.spotify.com/web-api/get-users-top-artists-and-tracks/ */ const usersTopArtists : SpotifyApi.UsersTopArtistsResponse = { "items" : [ @@ -5219,8 +5460,12 @@ const usersTopArtists : SpotifyApi.UsersTopArtistsResponse = { + /** - * Tests https://developer.spotify.com/web-api/get-users-top-artists-and-tracks/ + * Get a User’s Top Artists and Tracks (Note: This is only Tracks) + * + * GET /v1/me/top/{type} + * https://developer.spotify.com/web-api/get-users-top-artists-and-tracks/ */ const usersTopTracks : SpotifyApi.UsersTopTracksResponse = { "items" : [ @@ -5362,7 +5607,10 @@ const usersTopTracks : SpotifyApi.UsersTopTracksResponse = { /** - * Tests + * Get recommendations based on seeds + * + * GET /v1/recommendations + * https://developer.spotify.com/get-recommendations/ */ const recommendationsBasedOnSeeds: SpotifyApi.RecommendationsFromSeedsResponse = { "tracks": [ @@ -5449,7 +5697,21 @@ const recommendationsBasedOnSeeds: SpotifyApi.RecommendationsFromSeedsResponse = /** - * Tests https://developer.spotify.com/web-api/search-item/?type=album + * Get available genre seeds + * + * GET /v1/recommendations/available-genre-seeds + * https://developer.spotify.com/web-api/get-recommendations/#available-genre-seeds + */ +const availableGenreSeeds : SpotifyApi.AvailableGenreSeedsResponse = { + "genres" : [ "acoustic", "afrobeat", "alt-rock", "alternative", "ambient", "anime", "black-metal", "bluegrass", "blues", "bossanova", "brazil", "breakbeat", "british", "cantopop", "chicago-house", "children", "chill", "classical", "club", "comedy", "country", "dance", "dancehall", "death-metal", "deep-house", "detroit-techno", "disco", "disney", "drum-and-bass", "dub", "dubstep", "edm", "electro", "electronic", "emo", "folk", "forro", "french", "funk", "garage", "german", "gospel", "goth", "grindcore", "groove", "grunge", "guitar", "happy", "hard-rock", "hardcore", "hardstyle", "heavy-metal", "hip-hop", "holidays", "honky-tonk", "house", "idm", "indian", "indie", "indie-pop", "industrial", "iranian", "j-dance", "j-idol", "j-pop", "j-rock", "jazz", "k-pop", "kids", "latin", "latino", "malay", "mandopop", "metal", "metal-misc", "metalcore", "minimal-techno", "movies", "mpb", "new-age", "new-release", "opera", "pagode", "party", "philippines-opm", "piano", "pop", "pop-film", "post-dubstep", "power-pop", "progressive-house", "psych-rock", "punk", "punk-rock", "r-n-b", "rainy-day", "reggae", "reggaeton", "road-trip", "rock", "rock-n-roll", "rockabilly", "romance", "sad", "salsa", "samba", "sertanejo", "show-tunes", "singer-songwriter", "ska", "sleep", "songwriter", "soul", "soundtracks", "spanish", "study", "summer", "swedish", "synth-pop", "tango", "techno", "trance", "trip-hop", "turkish", "work-out", "world-music" ] +} + + +/** + * Search for an album + * + * GET /v1/search?type=album + * https://developer.spotify.com/web-api/search-item/ */ const searchAlbums : SpotifyApi.AlbumSearchResponse = { "albums" : { @@ -5515,7 +5777,10 @@ const searchAlbums : SpotifyApi.AlbumSearchResponse = { /** - * Tests https://developer.spotify.com/web-api/search-item/?type=artist + * Search for an artist + * + * GET /v1/search?type=artist + * https://developer.spotify.com/web-api/search-item/ */ const searchArtists : SpotifyApi.ArtistSearchResponse = { "artists" : { @@ -5561,7 +5826,10 @@ const searchArtists : SpotifyApi.ArtistSearchResponse = { /** - * Tests https://developer.spotify.com/web-api/search-item/?type=playlist + * Search for a playlist + * + * GET /v1/search?type=playlist + * https://developer.spotify.com/web-api/search-item/ */ const searchPlaylists : SpotifyApi.PlaylistSearchResponse = { "playlists" : { @@ -5655,7 +5923,10 @@ const searchPlaylists : SpotifyApi.PlaylistSearchResponse = { /** - * Tests https://developer.spotify.com/web-api/search-item/?type=track + * Search for a track + * + * GET /v1/search?type=track + * https://developer.spotify.com/web-api/search-item/ */ const searchTracks : SpotifyApi.TrackSearchResponse = { "tracks" : { @@ -5799,7 +6070,10 @@ const searchTracks : SpotifyApi.TrackSearchResponse = { /** - * Tests https://developer.spotify.com/web-api/get-track/ + * Get a track + * + * GET /v1/tracks/{id} + * https://developer.spotify.com/web-api/get-track/ */ const track : SpotifyApi.SingleTrackResponse = { "album" : { @@ -5861,7 +6135,10 @@ const track : SpotifyApi.SingleTrackResponse = { /** - * Tests https://developer.spotify.com/web-api/get-several-tracks/ + * Get multiple tracks + * + * GET /v1/tracks?ids={ids} + * https://developer.spotify.com/web-api/get-several-tracks/ */ const tracks : SpotifyApi.MultipleTracksResponse = { "tracks" : [ { @@ -5977,9 +6254,11 @@ const tracks : SpotifyApi.MultipleTracksResponse = { - /** - * Tests https://developer.spotify.com/web-api/get-users-profile/ + * Get user profile + * + * GET /v1/users/{user_id} + * https://developer.spotify.com/web-api/get-users-profile/ */ const userProfile : SpotifyApi.UserProfileResponse = { "display_name" : "Ronald Pompa", @@ -6005,7 +6284,10 @@ const userProfile : SpotifyApi.UserProfileResponse = { /** - * Tests https://developer.spotify.com/web-api/get-list-users-playlists/ + * Get a list of a user's playlists + * + * GET /v1/users/{user_id}/playlists + * https://developer.spotify.com/web-api/get-list-users-playlists/ */ const usersPlaylists : SpotifyApi.ListOfUsersPlaylistsResponse = { "href" : "https://api.spotify.com/v1/users/wizzler/playlists?offset=0&limit=2", @@ -6081,7 +6363,89 @@ const usersPlaylists : SpotifyApi.ListOfUsersPlaylistsResponse = { /** - * Tests https://developer.spotify.com/web-api/get-playlist/ + * Get a list of the current user's playlists + * + * GET /v1/users/{user_id}/playlists + * https://developer.spotify.com/web-api/get-list-users-playlists/ + */ +const currentUsersPlaylists : SpotifyApi.ListOfUsersPlaylistsResponse = { + "href" : "https://api.spotify.com/v1/users/wizzler/playlists?offset=0&limit=2", + "items" : [ { + "collaborative" : false, + "external_urls" : { + "spotify" : "http://open.spotify.com/user/wizzler/playlist/6yRf9SJ1YiAhNAu7UCwgXQ" + }, + "href" : "https://api.spotify.com/v1/users/wizzler/playlists/6yRf9SJ1YiAhNAu7UCwgXQ", + "id" : "6yRf9SJ1YiAhNAu7UCwgXQ", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/5c383056e25a3e3ec858151afb70afe763c00f9b", + "width" : 640 + } ], + "name" : "My Shazam Tracks", + "owner" : { + "external_urls" : { + "spotify" : "http://open.spotify.com/user/wizzler" + }, + "href" : "https://api.spotify.com/v1/users/wizzler", + "id" : "wizzler", + "type" : "user", + "uri" : "spotify:user:wizzler" + }, + "public" : true, + "snapshot_id" : "WlQppvajE5kH/Xt5cHfHxJ6mSsFckwYixA06q7y1asdUz+m5v7pq6xb1f0FiFa7I", + "tracks" : { + "href" : "https://api.spotify.com/v1/users/wizzler/playlists/6yRf9SJ1YiAhNAu7UCwgXQ/tracks", + "total" : 1 + }, + "type" : "playlist", + "uri" : "spotify:user:wizzler:playlist:6yRf9SJ1YiAhNAu7UCwgXQ" + }, { + "collaborative" : false, + "external_urls" : { + "spotify" : "http://open.spotify.com/user/wizzler/playlist/3FJd21jWvCjGCLx7eKrext" + }, + "href" : "https://api.spotify.com/v1/users/wizzler/playlists/3FJd21jWvCjGCLx7eKrext", + "id" : "3FJd21jWvCjGCLx7eKrext", + "images" : [ { + "height" : 300, + "url" : "https://i.scdn.co/image/15858d38fdac4af890dcc634f4946c5bf83c0915", + "width" : 300 + } ], + "name" : "Video Game Masterpieces", + "owner" : { + "external_urls" : { + "spotify" : "http://open.spotify.com/user/wizzler" + }, + "href" : "https://api.spotify.com/v1/users/wizzler", + "id" : "wizzler", + "type" : "user", + "uri" : "spotify:user:wizzler" + }, + "public" : true, + "snapshot_id" : "LO0O/RGsDLEgeDC3xVR4HisMNsDqoPLE8QBRqllyvevTJ09tFWIUbjrYoEJbUhCa", + "tracks" : { + "href" : "https://api.spotify.com/v1/users/wizzler/playlists/3FJd21jWvCjGCLx7eKrext/tracks", + "total" : 33 + }, + "type" : "playlist", + "uri" : "spotify:user:wizzler:playlist:3FJd21jWvCjGCLx7eKrext" + } ], + "limit" : 2, + "next" : "https://api.spotify.com/v1/users/wizzler/playlists?offset=2&limit=2", + "offset" : 0, + "previous" : null, + "total" : 7 +}; + + + + +/** + * Get a playlist + * + * GET /v1/users/{user_id}/playlists/{playlist_id} + * https://developer.spotify.com/web-api/get-playlist/ */ const playlist : SpotifyApi.SinglePlaylistResponse = { "collaborative" : false, @@ -6339,7 +6703,10 @@ const playlist : SpotifyApi.SinglePlaylistResponse = { /** - * Tests + * Get a playlist's tracks + * + * GET /v1/users/{user_id}/playlists/{playlist_id}/tracks + * https://developer.spotify.com/web-api/get-playlists-tracks/ */ const playlistTracks : SpotifyApi.PlaylistTrackResponse = { "href" : "https://api.spotify.com/v1/users/spotify_espa%C3%B1a/playlists/21THa8j9TaSGuXYNBU5tsC/tracks?offset=0&limit=3", @@ -6583,7 +6950,10 @@ const playlistTracks : SpotifyApi.PlaylistTrackResponse = { /** - * Tests https://developer.spotify.com/web-api/create-playlist/ + * Create a Playlist + * + * POST /v1/users/{user_id}/playlists + * https://developer.spotify.com/web-api/create-playlist/ */ const newPlaylist : SpotifyApi.CreatePlaylistResponse = { "collaborative" : false, @@ -6627,7 +6997,10 @@ const newPlaylist : SpotifyApi.CreatePlaylistResponse = { /** - * Tests https://developer.spotify.com/web-api/change-playlist-details/ + * Change a Playlist’s Details + * + * PUT /v1/users/{user_id}/playlists/{playlist_id} + * https://developer.spotify.com/web-api/change-playlist-details/ */ const changePlaylistDetails : SpotifyApi.ChangePlaylistDetailsReponse = {}; @@ -6635,7 +7008,10 @@ const changePlaylistDetails : SpotifyApi.ChangePlaylistDetailsReponse = {}; /** - * Tests https://developer.spotify.com/web-api/add-tracks-to-playlist/ + * Add Tracks to a Playlist + * + * POST /v1/users/{user_id}/playlists/{playlist_id}/tracks + * https://developer.spotify.com/web-api/add-tracks-to-playlist/ */ const addTracksToPlaylist : SpotifyApi.AddTracksToPlaylistResponse = { "snapshot_id" : "4qQeMTnHV5LCL9w/lI9Mlu5shi2pk+iiIm6VEpmKdMPCE6adhRNTG9SXflxh8DTt" @@ -6645,7 +7021,10 @@ const addTracksToPlaylist : SpotifyApi.AddTracksToPlaylistResponse = { /** - * Tests https://developer.spotify.com/web-api/remove-tracks-playlist/ + * Remove Tracks from a Playlist + * + * DELETE /v1/users/{user_id}/playlists/{playlist_id}/tracks + * https://developer.spotify.com/web-api/remove-tracks-playlist/ */ const removeTracksFromPlaylist : SpotifyApi.RemoveTracksFromPlaylistResponse = { "snapshot_id" : "t3+4ZWOqedj+bmcHHu1HKNqYfIyYAfXKlSHHykvS4KAm7hoVhDoCpn+KIuFZebZp" @@ -6655,7 +7034,10 @@ const removeTracksFromPlaylist : SpotifyApi.RemoveTracksFromPlaylistResponse = { /** - * Tests https://developer.spotify.com/web-api/reorder-playlists-tracks/ + * Reorder a Playlist’s Tracks + * + * PUT /v1/users/{user_id}/playlists/{playlist_id}/tracks + * https://developer.spotify.com/web-api/reorder-playlists-tracks/ */ const reorderTracksInPlaylist : SpotifyApi.ReorderPlaylistTracksResponse = { "snapshot_id" : "t3+4ZWOqedj+bmcHHu1HKNqYfIyYAfXKlSHHykvS4KAm7hoVhDoCpn+KIuFZebZp" @@ -6665,7 +7047,10 @@ const reorderTracksInPlaylist : SpotifyApi.ReorderPlaylistTracksResponse = { /** - * Tests https://developer.spotify.com/web-api/replace-playlists-tracks/ + * Replace a Playlist’s Tracks + * + * PUT /v1/users/{user_id}/playlists/{playlist_id}/tracks + * https://developer.spotify.com/web-api/replace-playlists-tracks/ */ const replacePlaylistTracks : SpotifyApi.ReplacePlaylistTracksResponse = {}; @@ -6673,6 +7058,9 @@ const replacePlaylistTracks : SpotifyApi.ReplacePlaylistTracksResponse = {}; /** - * Tests https://developer.spotify.com/web-api/check-user-following-playlist/ + * Check if Users Follow a Playlist + * + * GET /v1/users/{user_id}/playlists/{playlist_id}/followers/contains + * https://developer.spotify.com/web-api/check-user-following-playlist/ */ const checkUserFollowsPlaylist : SpotifyApi.UsersFollowPlaylistReponse = [true, false, true]; \ No newline at end of file diff --git a/spotify-api/spotify-api.d.ts b/spotify-api/spotify-api.d.ts index b175080ac8..d0f655358a 100644 --- a/spotify-api/spotify-api.d.ts +++ b/spotify-api/spotify-api.d.ts @@ -5,6 +5,9 @@ // Release comments: // ----------------- + +// The audio analysis object is not yet in the Object Model at Spotify, therefore it is typed as any in this file. + // TrackObjects and AlbumObjects is specified in the docs as always having the available_markets property, // but when it is sent in https://developer.spotify.com/web-api/console/get-current-user-saved-tracks // the available_markets are missing. Therefore it is marked as optional in this source code. @@ -37,6 +40,69 @@ declare namespace SpotifyApi { offset?: number; } + /** + * Object for use in Recommendations Based on Seeds. + * See: [Recommendations Based on Seeds](https://developer.spotify.com/web-api/get-recommendations/) + * + * @limit q Optional. The target size of the list of recommended tracks. For seeds with unusually small pools or when highly restrictive filtering is applied, it may be impossible to generate the requested number of recommended tracks. Debugging information for such cases is available in the response. Default: 20. Minimum: 1. Maximum: 100. + * @market q Optional. An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking. Because min_*, max_* and target_* are applied to pools before relinking, the generated results may not precisely match the filters applied. Original, non-relinked tracks are available via the linked_from attribute of the relinked track response. + * @max_ q Optional. Multiple values. For each tunable track attribute, a hard ceiling on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, max_instrumentalness=0.35 would filter out most tracks that are likely to be instrumental. + * @min_ q Optional. Multiple values. For each tunable track attribute, a hard floor on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, min_tempo=140 would restrict results to only those tracks with a tempo of greater than 140 beats per minute. + * @seed_artists q A comma separated list of Spotify IDs for seed artists. Up to 5 seed values may be provided in any combination of seed_artists, seed_tracks and seed_genres. + * @seed_genres q A comma separated list of any genres in the set of available genre seeds. Up to 5 seed values may be provided in any combination of seed_artists, seed_tracks and seed_genres. + * @seed_tracks q A comma separated list of Spotify IDs for a seed track. Up to 5 seed values may be provided in any combination of seed_artists, seed_tracks and seed_genres. + * @target_ q Optional. Multiple values. For each of the tunable track attributes (below) a target value may be provided. Tracks with the attribute values nearest to the target values will be preferred. For example, you might request target_energy=0.6 and target_danceability=0.8. All target values will be weighed equally in ranking results. + */ + interface RecommendationsOptionsObject { + limit?: number, + market?: string, + max_acousticness?: number, + max_danceability?: number, + max_duration_ms?: number, + max_energy?: number, + max_instrumentalness?: number, + max_key?: number, + max_liveness?: number, + max_loudness?: number, + max_mode?: number, + max_popularity?: number, + max_speechiness?: number, + max_tempo?: number, + max_time_signature?: number, + max_valence?: number, + min_acousticness?: number, + min_danceability?: number, + min_duration_ms?: number, + min_energy?: number, + min_instrumentalness?: number, + min_key?: number, + min_liveness?: number, + min_loudness?: number, + min_mode?: number, + min_popularity?: number, + min_speechiness?: number, + min_tempo?: number, + min_time_signature?: number, + min_valence?: number, + seed_artists?: string, // Comma separated string + seed_genres?: string, // Comma separated string + seed_tracks?: string, // Comma separated string + target_acousticness?: number + target_danceability?: number + target_duration_ms?: number + target_energy?: number + target_instrumentalness?: number + target_key?: number + target_liveness?: number + target_loudness?: number + target_mode?: number + target_popularity?: number + target_speechiness?: number + target_tempo?: number + target_time_signature?: number + target_valence?: number + } + // // Responses from the Spotify Web API in the same order as in the API endpoint docs seen here: @@ -62,13 +128,17 @@ declare namespace SpotifyApi { /** * Get an Album + * * GET /v1/albums/{id} + * https://developer.spotify.com/web-api/get-album/ */ interface SingleAlbumResponse extends AlbumObjectFull {} /** * Get Several Albums - * GET /v1/albums + * + * GET /v1/albums?ids={ids} + * https://developer.spotify.com/web-api/get-several-albums/ */ interface MultipleAlbumsResponse { albums: AlbumObjectFull[] @@ -76,19 +146,25 @@ declare namespace SpotifyApi { /** * Get an Album’s Tracks + * * GET /v1/albums/{id}/tracks + * https://developer.spotify.com/web-api/get-albums-tracks/ */ interface AlbumTracksResponse extends PagingObject {} /** * Get an Artist + * * GET /v1/artists/{id} + * https://developer.spotify.com/web-api/get-artist/ */ interface SingleArtistResponse extends ArtistObjectFull {} /** * Get Several Artists - * GET /v1/artists + * + * /v1/artists?ids={ids} + * https://developer.spotify.com/web-api/get-several-artists/ */ interface MultipleArtistsResponse { artists: ArtistObjectFull[] @@ -96,13 +172,17 @@ declare namespace SpotifyApi { /** * Get an Artist’s Albums + * * GET /v1/artists/{id}/albums + * https://developer.spotify.com/web-api/get-artists-albums/ */ interface ArtistsAlbumsResponse extends PagingObject {} /** * Get an Artist’s Top Tracks + * * GET /v1/artists/{id}/top-tracks + * https://developer.spotify.com/web-api/get-artists-top-tracks/ */ interface ArtistsTopTracksResponse { tracks: TrackObjectFull[] @@ -110,21 +190,38 @@ declare namespace SpotifyApi { /** * Get an Artist’s Related Artists + * * GET /v1/artists/{id}/related-artists + * https://developer.spotify.com/web-api/get-related-artists/ */ interface ArtistsRelatedArtistsResponse { artists: ArtistObjectFull[] } + /** + * Get Audio Analysis for a Track + * + * GET /v1/audio-analysis/{id} + * https://developer.spotify.com/web-api/get-audio-analysis/ + * + * At the time of typing, the Audio Analysis Object is absent from the Object Model, so it is typed as any. + * Object Model: https://developer.spotify.com/web-api/object-model/ + */ + interface AudioAnalysisResponse extends Object {} + /** * Get audio features for a track + * * GET /v1/audio-features/{id} + * https://developer.spotify.com/web-api/get-audio-features/ */ interface AudioFeaturesResponse extends AudioFeaturesObject {} /** * Get audio features for several tracks - * GET /v1/audio-features + * + * GET /v1/audio-features?ids={ids} + * https://developer.spotify.com/get-several-audio-features/ */ interface MultipleAudioFeaturesResponse { "audio_features": AudioFeaturesObject[] @@ -132,7 +229,9 @@ declare namespace SpotifyApi { /** * Get a list of featured playlists + * * GET /v1/browse/featured-playlists + * https://developer.spotify.com/web-api/get-list-featured-playlists/ */ interface ListOfFeaturedPlaylistsResponse { message?: string, @@ -141,7 +240,9 @@ declare namespace SpotifyApi { /** * Get a list of new releases + * * GET /v1/browse/new-releases + * https://developer.spotify.com/web-api/get-list-new-releases/ */ interface ListOfNewReleasesResponse { message?: string, @@ -150,7 +251,9 @@ declare namespace SpotifyApi { /** * Get a list of categories + * * GET /v1/browse/categories + * https://developer.spotify.com/web-api/get-list-categories/ */ interface MultipleCategoriesResponse { categories: PagingObject @@ -158,13 +261,17 @@ declare namespace SpotifyApi { /** * Get a category - * GET /v1/browse/categories/{category_id} + * + * GET /v1/browse/categories/{id} + * https://developer.spotify.com/web-api/get-category/ */ interface SingleCategoryResponse extends CategoryObject {} /** * Get a categorys playlists + * * GET /v1/browse/categories/{id}/playlists + * https://developer.spotify.com/web-api/get-categorys-playlists/ */ interface CategoryPlaylistsReponse { playlists: PagingObject @@ -172,13 +279,17 @@ declare namespace SpotifyApi { /** * Get Current User’s Profile + * * GET /v1/me + * https://developer.spotify.com/web-api/get-current-users-profile/ */ interface CurrentUsersProfileResponse extends UserObjectPrivate {} /** * Get User’s Followed Artists - * GET /v1/me/following?type=artist + * + * GET /v1/me/following + * https://developer.spotify.com/web-api/get-followed-artists/ */ interface UsersFollowedArtistsResponse { artists: CursorBasedPagingObject @@ -186,103 +297,147 @@ declare namespace SpotifyApi { /** * Follow artists or users + * * PUT /v1/me/following + * https://developer.spotify.com/web-api/follow-artists-users/ */ interface FollowArtistsOrUsersResponse extends VoidResponse {} /** * Unfollow artists or users + * * DELETE /v1/me/following + * https://developer.spotify.com/web-api/unfollow-artists-users/ */ interface UnfollowArtistsOrUsersResponse extends VoidResponse {} /** * Check if User Follows Users or Artists + * * GET /v1/me/following/contains + * https://developer.spotify.com/web-api/check-current-user-follows/ */ interface UserFollowsUsersOrArtistsResponse extends Array {} /** * Follow a Playlist + * * PUT /v1/users/{owner_id}/playlists/{playlist_id}/followers + * https://developer.spotify.com/web-api/follow-playlist/ */ interface FollowPlaylistReponse extends VoidResponse {} /** * Unfollow a Playlist + * * DELETE /v1/users/{owner_id}/playlists/{playlist_id}/followers + * https://developer.spotify.com/web-api/unfollow-playlist/ */ interface UnfollowPlaylistReponse extends VoidResponse {} /** * Save tracks for user + * * PUT /v1/me/tracks?ids={ids} + * https://developer.spotify.com/web-api/save-tracks-user/ */ interface SaveTracksForUserResponse extends VoidResponse {} /** * Get user's saved tracks + * * GET /v1/me/tracks + * https://developer.spotify.com/web-api/get-users-saved-tracks/ */ interface UsersSavedTracksResponse extends PagingObject {} /** * Remove User’s Saved Tracks + * * DELETE /v1/me/tracks?ids={ids} + * https://developer.spotify.com/web-api/remove-tracks-user/ */ interface RemoveUsersSavedTracksResponse extends VoidResponse {} /** * Check User’s Saved Tracks - * GET /v1/me/tracks/contains + * + * GET /v1/me/tracks/contains?ids={ids} + * https://developer.spotify.com/web-api/check-users-saved-tracks/ */ interface CheckUsersSavedTracksResponse extends Array {} /** * Save albums for user + * * PUT /v1/me/albums?ids={ids} + * https://developer.spotify.com/web-api/save-albums-user/ */ interface SaveAlbumsForUserResponse extends VoidResponse {} /** * Get user's saved albums + * * GET /v1/me/albums + * https://developer.spotify.com/web-api/get-users-saved-albums/ */ - interface UsersSavedAlbumsResponse extends PagingObject {} + interface UsersSavedAlbumsResponse extends PagingObject {} /** * Remove Albums for Current User + * * DELETE /v1/me/albums?ids={ids} + * https://developer.spotify.com/web-api/remove-albums-user/ */ interface RemoveAlbumsForUserResponse extends VoidResponse {} /** * Check user's saved albums - * DELETE /v1/me/albums/contains?ids={ids} + * + * GET /v1/me/albums/contains?ids={ids} + * https://developer.spotify.com/web-api/check-users-saved-albums/ */ interface CheckUserSavedAlbumsResponse extends Array {} /** - * Get a User’s Top Artists and Tracks - * GET /v1/me/top/{type} - */ - interface UsersTopTracksResponse extends PagingObject {} - - /** - * Get a User’s Top Artists and Tracks + * Get a User’s Top Artists and Tracks (Note: This is only Artists) + * * GET /v1/me/top/{type} + * https://developer.spotify.com/web-api/get-users-top-artists-and-tracks/ */ interface UsersTopArtistsResponse extends PagingObject {} + /** + * Get a User’s Top Artists and Tracks (Note: This is only Tracks) + * + * GET /v1/me/top/{type} + * https://developer.spotify.com/web-api/get-users-top-artists-and-tracks/ + */ + interface UsersTopTracksResponse extends PagingObject {} + /** * Get recommendations based on seeds + * * GET /v1/recommendations + * https://developer.spotify.com/get-recommendations/ */ interface RecommendationsFromSeedsResponse extends RecommendationsObject {} + /** + * Get available genre seeds + * + * GET /v1/recommendations/available-genre-seeds + * https://developer.spotify.com/web-api/get-recommendations/#available-genre-seeds + */ + interface AvailableGenreSeedsResponse { + "genres": string[] + } + /** * Search for an album + * * GET /v1/search?type=album + * https://developer.spotify.com/web-api/search-item/ */ interface AlbumSearchResponse { albums: PagingObject @@ -290,7 +445,9 @@ declare namespace SpotifyApi { /** * Search for an artist + * * GET /v1/search?type=artist + * https://developer.spotify.com/web-api/search-item/ */ interface ArtistSearchResponse { artists: PagingObject @@ -298,7 +455,9 @@ declare namespace SpotifyApi { /** * Search for a playlist + * * GET /v1/search?type=playlist + * https://developer.spotify.com/web-api/search-item/ */ interface PlaylistSearchResponse { playlists: PagingObject @@ -306,7 +465,9 @@ declare namespace SpotifyApi { /** * Search for a track + * * GET /v1/search?type=track + * https://developer.spotify.com/web-api/search-item/ */ interface TrackSearchResponse { tracks: PagingObject @@ -314,13 +475,17 @@ declare namespace SpotifyApi { /** * Get a track + * * GET /v1/tracks/{id} + * https://developer.spotify.com/web-api/get-track/ */ interface SingleTrackResponse extends TrackObjectFull {} /** * Get multiple tracks + * * GET /v1/tracks?ids={ids} + * https://developer.spotify.com/web-api/get-several-tracks/ */ interface MultipleTracksResponse { tracks: TrackObjectFull[] @@ -328,73 +493,97 @@ declare namespace SpotifyApi { /** * Get user profile + * * GET /v1/users/{user_id} + * https://developer.spotify.com/web-api/get-users-profile/ */ interface UserProfileResponse extends UserObjectPublic {} /** * Get a list of a user's playlists + * * GET /v1/users/{user_id}/playlists + * https://developer.spotify.com/web-api/get-list-users-playlists/ */ interface ListOfUsersPlaylistsResponse extends PagingObject {} /** * Get a list of the current user's playlists + * * GET /v1/me/playlists + * https://developer.spotify.com/web-api/get-list-users-playlists/ */ interface ListOfCurrentUsersPlaylistsResponse extends PagingObject {} /** * Get a playlist + * * GET /v1/users/{user_id}/playlists/{playlist_id} + * https://developer.spotify.com/web-api/get-playlist/ */ interface SinglePlaylistResponse extends PlaylistObjectFull {} /** * Get a playlist's tracks + * * GET /v1/users/{user_id}/playlists/{playlist_id}/tracks + * https://developer.spotify.com/web-api/get-playlists-tracks/ */ interface PlaylistTrackResponse extends PagingObject {} /** * Create a Playlist + * * POST /v1/users/{user_id}/playlists + * https://developer.spotify.com/web-api/create-playlist/ */ interface CreatePlaylistResponse extends PlaylistObjectFull {} /** * Change a Playlist’s Details + * * PUT /v1/users/{user_id}/playlists/{playlist_id} + * https://developer.spotify.com/web-api/change-playlist-details/ */ interface ChangePlaylistDetailsReponse extends VoidResponse {} /** * Add Tracks to a Playlist + * * POST /v1/users/{user_id}/playlists/{playlist_id}/tracks + * https://developer.spotify.com/web-api/add-tracks-to-playlist/ */ interface AddTracksToPlaylistResponse extends PlaylistSnapshotResponse {} /** * Remove Tracks from a Playlist + * * DELETE /v1/users/{user_id}/playlists/{playlist_id}/tracks + * https://developer.spotify.com/web-api/remove-tracks-playlist/ */ interface RemoveTracksFromPlaylistResponse extends PlaylistSnapshotResponse {} /** * Reorder a Playlist’s Tracks + * * PUT /v1/users/{user_id}/playlists/{playlist_id}/tracks + * https://developer.spotify.com/web-api/reorder-playlists-tracks/ */ interface ReorderPlaylistTracksResponse extends PlaylistSnapshotResponse {} /** * Replace a Playlist’s Tracks + * * PUT /v1/users/{user_id}/playlists/{playlist_id}/tracks + * https://developer.spotify.com/web-api/replace-playlists-tracks/ */ interface ReplacePlaylistTracksResponse extends VoidResponse {} /** * Check if Users Follow a Playlist + * * GET /v1/users/{user_id}/playlists/{playlist_id}/followers/contains + * https://developer.spotify.com/web-api/check-user-following-playlist/ */ interface UsersFollowPlaylistReponse extends Array {} From 5e10a26cea0224db26c41641eb15494f3bced54e Mon Sep 17 00:00:00 2001 From: Sergei Basharov Date: Tue, 25 Oct 2016 16:08:00 +0300 Subject: [PATCH 050/246] Typos fixes (#12111) --- nes/nes.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/nes/nes.d.ts b/nes/nes.d.ts index c86627db47..736b4382c8 100644 --- a/nes/nes.d.ts +++ b/nes/nes.d.ts @@ -61,7 +61,7 @@ declare module 'nes' { user?: any; } - export interface ServerEachSokcetOptions { + export interface ServerEachSocketOptions { subscription?: string; user?: any; } @@ -70,7 +70,7 @@ declare module 'nes' { broadcast(message: any, options?: ServerBroadcastOptions): void; subscription(path: string, options?: ServerSubscriptionOptions): void; publish(path: string, message: any, options?: ServerPublishOptions): void; - eachSocket(each: (socket: Socket) => void, options?: ServerEachSokcetOptions): void; + eachSocket(each: (socket: Socket) => void, options?: ServerEachSocketOptions): void; } export class Request extends Hapi.Request { @@ -82,7 +82,7 @@ declare module 'nes' { timeout?: number | boolean; } - export interface ClientConnnectOptions { + export interface ClientConnectOptions { auth?: any; delay?: number; maxDelay?: number; @@ -107,7 +107,7 @@ declare module 'nes' { onConnect: () => void; onDisconnect: () => void; onUpdate: (message: any) => void; - connect(options: ClientConnnectOptions, callback: (err?: any) => void): void; + connect(options: ClientConnectOptions, callback: (err?: any) => void): void; connect(callback: (err?: any) => void): void; disconnect(): void; id: any; @@ -123,7 +123,7 @@ declare module 'nes' { declare module 'nes/client' { export { Client, - ClientConnnectOptions, + ClientConnectOptions, ClientRequestOptions, ClientSubscribeFlags } from 'nes'; From e6413e382de7bad614897c3417e029b0d1804f5b Mon Sep 17 00:00:00 2001 From: Ivo Stratev Date: Tue, 25 Oct 2016 16:10:17 +0300 Subject: [PATCH 051/246] updating jest to 16.0.0 (#12066) --- jest/jest-tests.ts | 13 +++++++++--- jest/jest.d.ts | 49 ++++++++++++++++++++++++++-------------------- 2 files changed, 38 insertions(+), 24 deletions(-) diff --git a/jest/jest-tests.ts b/jest/jest-tests.ts index b547bd40ad..bb28a77b26 100644 --- a/jest/jest-tests.ts +++ b/jest/jest-tests.ts @@ -209,6 +209,8 @@ describe('missing tests', function () { expect(getFruits()).toContain('Orange'); mock.mockReturnValueOnce(['Apple', 'Plum']); expect(mock()).not.toContain('Orange'); + const myBeverage: any = {delicious: true, sour: false}; + expect(myBeverage).toContainEqual({delicious: true, sour: false}); mock.mockReturnValue([]); //Deprecated: Use jest.fn(() => value) instead. mock.mockClear(); let thisMock: jest.Mock = jest.fn().mockReturnThis(); @@ -216,8 +218,7 @@ describe('missing tests', function () { }); it('creates snapshoter', function () { - jest.disableAutomock(); - jest.mock('./render', () => jest.fn((): string => "{Link to: \"facebook\"}"), { virtual: true }); + jest.disableAutomock().mock('./render', () => jest.fn((): string => "{Link to: \"facebook\"}"), { virtual: true }); const render: () => string = require('./render'); expect(render()).toMatch(/Link/); jest.enableAutomock(); @@ -226,7 +227,7 @@ describe('missing tests', function () { it('runs only pending timers', function () { jest.useRealTimers(); setTimeout(() => expect(1).not.toEqual(0), 3000); - jest.runOnlyPendingTimers(); + jest.runOnlyPendingTimers().runTimersToTime(300); }); it('runs all timers', function () { @@ -250,6 +251,12 @@ describe('toMatchSnapshot', function () { }); }); +describe('toThrowErrorMatchingSnapshot', function () { + it('compares snapshots', function () { + expect(() => { throw new Error('descriptiton') }).toThrowErrorMatchingSnapshot(); + }); +}); + function testInstances() { var mockFn = jest.fn(); var a = new mockFn(); diff --git a/jest/jest.d.ts b/jest/jest.d.ts index d0660193f6..dc0260cebb 100644 --- a/jest/jest.d.ts +++ b/jest/jest.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Jest 15.1.1 +// Type definitions for Jest 16.0.0 // Project: http://facebook.github.io/jest/ // Definitions by: Asana , Ivo Stratev , jwbay // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -26,23 +26,25 @@ interface NodeRequire { } declare namespace jest { - function addMatchers(matchers: jasmine.CustomMatcherFactories): void; + function addMatchers(matchers: jasmine.CustomMatcherFactories): typeof jest; /** Disables automatic mocking in the module loader. */ - function autoMockOff(): void; + function autoMockOff(): typeof jest; /** Enables automatic mocking in the module loader. */ - function autoMockOn(): void; + function autoMockOn(): typeof jest; + /** Clears the mock.calls and mock.instances properties of all mocks. Equivalent to calling .mockClear() on every mocked function. */ + function clearAllMocks(): typeof jest; /** Removes any pending timers from the timer system. If any timers have been scheduled, they will be cleared and will never have the opportunity to execute in the future. */ - function clearAllTimers(): void; + function clearAllTimers(): typeof jest; /** Indicates that the module system should never return a mocked version of the specified module, including all of the specificied module's dependencies. */ - function deepUnmock(moduleName: string): void; + function deepUnmock(moduleName: string): typeof jest; /** Disables automatic mocking in the module loader. */ - function disableAutomock(): void; + function disableAutomock(): typeof jest; /** Mocks a module with an auto-mocked version when it is being required. */ - function doMock(moduleName: string): void; + function doMock(moduleName: string): typeof jest; /** Indicates that the module system should never return a mocked version of the specified module from require() (e.g. that it should always return the real module). */ - function dontMock(moduleName: string): void; + function dontMock(moduleName: string): typeof jest; /** Enables automatic mocking in the module loader. */ - function enableAutomock(): void; + function enableAutomock(): typeof jest; /** Creates a mock function. Optionally takes a mock implementation. */ function fn(implementation?: Function): Mock; /** Use the automatic mocking system to generate a mocked version of the given module. */ @@ -50,28 +52,30 @@ declare namespace jest { /** Returns whether the given function is a mock function. */ function isMockFunction(fn: any): fn is Mock; /** Mocks a module with an auto-mocked version when it is being required. */ - function mock(moduleName: string, factory?: any, options?: MockOptions): void; + function mock(moduleName: string, factory?: any, options?: MockOptions): typeof jest; /** Resets the module registry - the cache of all required modules. This is useful to isolate modules where local state might conflict between tests. */ - function resetModuleRegistry(): void; + function resetModuleRegistry(): typeof jest; /** Resets the module registry - the cache of all required modules. This is useful to isolate modules where local state might conflict between tests. */ - function resetModules(): void; + function resetModules(): typeof jest; /** Exhausts tasks queued by setImmediate(). */ - function runAllImmediates(): void; + function runAllImmediates(): typeof jest; /** Exhausts the micro-task queue (usually interfaced in node via process.nextTick). */ - function runAllTicks(): void; + function runAllTicks(): typeof jest; /** Exhausts the macro-task queue (i.e., all tasks queued by setTimeout() and setInterval()). */ - function runAllTimers(): void; + function runAllTimers(): typeof jest; /** Executes only the macro-tasks that are currently pending (i.e., only the tasks that have been queued by setTimeout() or setInterval() up to this point). * If any of the currently pending macro-tasks schedule new macro-tasks, those new tasks will not be executed by this call. */ - function runOnlyPendingTimers(): void; + function runOnlyPendingTimers(): typeof jest; + /** Executes only the macro task queue (i.e. all tasks queued by setTimeout() or setInterval() and setImmediate()). */ + function runTimersToTime(msToRun: number): typeof jest; /** Explicitly supplies the mock object that the module system should return for the specified module. */ - function setMock(moduleName: string, moduleExports: T): void; + function setMock(moduleName: string, moduleExports: T): typeof jest; /** Indicates that the module system should never return a mocked version of the specified module from require() (e.g. that it should always return the real module). */ - function unmock(moduleName: string): void; + function unmock(moduleName: string): typeof jest; /** Instructs Jest to use fake versions of the standard timer functions. */ - function useFakeTimers(): void; + function useFakeTimers(): typeof jest; /** Instructs Jest to use the real versions of the standard timer functions. */ - function useRealTimers(): void; + function useRealTimers(): typeof jest; interface MockOptions { virtual?: boolean; @@ -98,6 +102,7 @@ declare namespace jest { (name: string, fn: ProvidesCallback): void; only: It; skip: It; + concurrent: It; } interface Describe { @@ -124,6 +129,7 @@ declare namespace jest { toBeTruthy(): void; toBeUndefined(): void; toContain(expected: any): void; + toContainEqual(expected: any): void; toEqual(expected: any): void; toHaveBeenCalled(): boolean; toHaveBeenCalledTimes(expected: number): boolean; @@ -132,6 +138,7 @@ declare namespace jest { toMatchSnapshot(): void; toThrow(): void; toThrowError(error?: string | Constructable | RegExp): void; + toThrowErrorMatchingSnapshot(): void; } interface Constructable { From 0e2d4e9680d7cf91f36dd7348d8a4ca9f560bd6d Mon Sep 17 00:00:00 2001 From: bryanjjohnson Date: Tue, 25 Oct 2016 07:12:08 -0600 Subject: [PATCH 052/246] update mapbox-gl definitions to 0.26.0 (#11992) --- mapbox-gl/mapbox-gl-0.25.1.d.ts | 936 ++++++++++++++++++++++++++++++++ mapbox-gl/mapbox-gl.d.ts | 24 +- 2 files changed, 954 insertions(+), 6 deletions(-) create mode 100644 mapbox-gl/mapbox-gl-0.25.1.d.ts diff --git a/mapbox-gl/mapbox-gl-0.25.1.d.ts b/mapbox-gl/mapbox-gl-0.25.1.d.ts new file mode 100644 index 0000000000..2ee8d30949 --- /dev/null +++ b/mapbox-gl/mapbox-gl-0.25.1.d.ts @@ -0,0 +1,936 @@ +// Type definitions for Mapbox GL JS v0.24.0 +// Project: https://github.com/mapbox/mapbox-gl-js +// Definitions by: Dominik Bruderer +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace mapboxgl { + let accessToken: string; + let version: string; + export function supported(options?: {failIfMajorPerformanceCaveat?: boolean}): boolean; + + /** + * Map + */ + export class Map extends Evented { + constructor(options?: MapboxOptions); + + addControl(control: Control): this; + + addClass(klass: string, options?: mapboxgl.StyleOptions): this; + + removeClass(klass: string, options?: mapboxgl.StyleOptions): this; + + setClasses(klasses: string[], options?: mapboxgl.StyleOptions): this; + + hasClass(klass: string): boolean; + + getClasses(): string[]; + + resize(): this; + + getBounds(): mapboxgl.LngLatBounds; + + setMaxBounds(lnglatbounds?: mapboxgl.LngLatBounds | number[][]): this; + + setMinZoom(minZoom?: number): this; + + setMaxZoom(maxZoom?: number): this; + + project(lnglat: mapboxgl.LngLat | number[]): mapboxgl.Point; + + unproject(point: mapboxgl.Point | number[]): mapboxgl.LngLat; + + queryRenderedFeatures(pointOrBox?: mapboxgl.Point|number[]|mapboxgl.Point[]|number[][], parameters?: {layers?: string[], filter?: any[]}): GeoJSON.Feature[]; + + querySourceFeatures(sourceID: string, parameters: {sourceLayer?: string, filter?: any[]}): GeoJSON.Feature[]; + + setStyle(style: mapboxgl.Style | string): this; + + getStyle(): mapboxgl.Style; + + addSource(id: string, source: VectorSource | RasterSource | GeoJSONSource | ImageSource | VideoSource | GeoJSONSourceRaw): this; + + removeSource(id: string): this; + + getSource(id: string): VectorSource | RasterSource | GeoJSONSource | ImageSource | VideoSource; + + addLayer(layer: mapboxgl.Layer, before?: string): this; + + removeLayer(id: string): this; + + getLayer(id: string): mapboxgl.Layer; + + setFilter(layer: string, filter: any[]): this; + + setLayerZoomRange(layerId: string, minzoom: number, maxzoom: number): this; + + getFilter(layer: string): any[]; + + setPaintProperty(layer: string, name: string, value: any, klass?: string): this; + + getPaintProperty(layer: string, name: string, klass?: string): any; + + setLayoutProperty(layer: string, name: string, value: any): this; + + getLayoutProperty(layer: string, name: string, klass?: string): any; + + getContainer(): HTMLElement; + + getCanvasContainer(): HTMLElement; + + getCanvas(): HTMLCanvasElement; + + loaded(): boolean; + + remove(): void; + + onError(): void; + + showTileBoundaries: boolean; + + showCollisionBoxes: boolean; + + repaint: boolean; + + getCenter(): mapboxgl.LngLat; + + setCenter(center: LngLat|number[], eventData?: mapboxgl.EventData): this; + + panBy(offset: number[], options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this; + + panTo(lnglat: mapboxgl.LngLat, options?: mapboxgl.AnimationOptions, eventdata?: mapboxgl.EventData): this; + + getZoom(): number; + + setZoom(zoom: number, eventData?: mapboxgl.EventData): this; + + zoomTo(zoom: number, options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this; + + zoomIn(options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this; + + zoomOut(options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this; + + getBearing(): number; + + setBearing(bearing: number, eventData?: mapboxgl.EventData): this; + + rotateTo(bearing: number, options?: mapboxgl.AnimationOptions, eventData?: EventData): this; + + resetNorth(options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this; + + snapToNorth(options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this; + + getPitch(): number; + + setPitch(pitch: number, eventData?: EventData): this; + + fitBounds(bounds: mapboxgl.LngLatBounds | number[][], options?: { linear?: boolean, easing?: Function, padding?: number, offset?: Point|number[],maxZoom?: number }): this; + + jumpTo(options: mapboxgl.CameraOptions, eventData?: mapboxgl.EventData): this; + + easeTo(options: mapboxgl.CameraOptions | mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this; + + flyTo(options: mapboxgl.FlyToOptions, eventData?: mapboxgl.EventData): this; + + stop(): this; + + scrollZoom: ScrollZoomHandler; + + boxZoom: BoxZoomHandler; + + dragRotate: DragRotateHandler; + + dragPan: DragPanHandler; + + keyboard: KeyboardHandler; + + doublClickZoom: DoubleClickZoomHandler; + + touchZoomRotate: TouchZoomRotateHandler; + } + + export interface MapboxOptions { + /** If true, an attribution control will be added to the map. */ + attributionControl?: boolean; + + bearing?: number; + + /** Snap to north threshold in degrees. */ + bearingSnap?: number; + + /** If true, enable the "box zoom" interaction (see BoxZoomHandler) */ + boxZoom?: boolean; + + /** initial map center */ + center?: mapboxgl.LngLat | number[]; + + /** Style class names with which to initialize the map */ + classes?: string[]; + + /** ID of the container element */ + container?: string | Element; + + /** If true, enable the "drag to pan" interaction (see DragPanHandler). */ + dragPan?: boolean; + + /** If true, enable the "drag to rotate" interaction (see DragRotateHandler). */ + dragRotate?: boolean; + + /** If true, enable the "double click to zoom" interaction (see DoubleClickZoomHandler). */ + doubleClickZoom?: boolean; + + /** If true, the map will track and update the page URL according to map position */ + hash?: boolean; + + /** If true, map creation will fail if the implementation determines that the performance of the created WebGL context would be dramatically lower than expected. */ + failIfMayorPerformanceCaveat?: boolean; + + /** If false, no mouse, touch, or keyboard listeners are attached to the map, so it will not respond to input */ + interactive?: boolean; + + /** If true, enable keyboard shortcuts (see KeyboardHandler). */ + keyboard?: boolean; + + /** If set, the map is constrained to the given bounds. */ + maxBounds?: mapboxgl.LngLatBounds | number[][]; + + /** Maximum zoom of the map */ + maxZoom?: number; + + /** Minimum zoom of the map */ + minZoom?: number; + + /** If true, The maps canvas can be exported to a PNG using map.getCanvas().toDataURL();. This is false by default as a performance optimization. */ + preserveDrawingBuffer?: boolean; + + pitch?: number; + + /** If true, enable the "scroll to zoom" interaction */ + scrollZoom?: boolean; + + /** stylesheet location */ + style?: mapboxgl.Style | string; + + /** If true, the map will automatically resize when the browser window resizes */ + trackResize?: boolean; + + /** If true, enable the "pinch to rotate and zoom" interaction (see TouchZoomRotateHandler). */ + touchZoomRotate?: boolean; + + /** Initial zoom level */ + zoom?: number; + } + + /** + * BoxZoomHandler + */ + export class BoxZoomHandler { + constructor(map: mapboxgl.Map); + + isEnabled(): boolean; + + isActive(): boolean; + + enable(): void; + + disable(): void; + } + + /** + * ScrollZoomHandler + */ + export class ScrollZoomHandler { + constructor(map: mapboxgl.Map); + + isEnabled(): boolean; + + enable(): void; + + disable(): void; + } + + /** + * DragPenHandler + */ + export class DragPanHandler { + constructor(map: mapboxgl.Map); + + isEnabled(): boolean; + + isActive(): boolean; + + enable(): void; + + disable(): void; + } + + /** + * DragRotateHandler + */ + export class DragRotateHandler { + constructor(map: mapboxgl.Map, options?: {bearingSnap?: number, pitchWithRotate?: boolean}); + + isEnabled(): boolean; + + isActive(): boolean; + + enable(): void; + + disable(): void; + } + + /** + * KeyboardHandler + */ + export class KeyboardHandler { + constructor(map: mapboxgl.Map); + + isEnabled(): boolean; + + enable(): void; + + disable(): void; + } + + /** + * DoubleClickZoomHandler + */ + export class DoubleClickZoomHandler { + constructor(map: mapboxgl.Map); + + isEnabled(): boolean; + + enable(): void; + + disable(): void; + } + + /** + * TouchZoomRotateHandler + */ + export class TouchZoomRotateHandler { + constructor(map: mapboxgl.Map); + + isEnabled(): boolean; + + enable(): void; + + disable(): void; + + disableRotation(): void; + + enableRotation(): void; + } + + /** + * Control + */ + export class Control extends Evented { + addTo(map: mapboxgl.Map): this; + + remove(): this; + } + + /** + * ControlOptions + */ + export interface ControlOptions { + position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left'; + } + + /** + * Navigation + */ + export class Navigation extends Control { + constructor(options?: mapboxgl.ControlOptions); + } + + /** + * Geolocate + */ + export class Geolocate extends Control { + constructor(options?: mapboxgl.ControlOptions); + } + + /** + * Attribution + */ + export class Attribution extends Control { + constructor(options?: mapboxgl.ControlOptions); + } + + /** + * Scale + */ + export class Scale extends Control { + constructor(options?: {position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left', maxWidth?: number, unit?: string}) + } + + /** + * Popup + */ + export class Popup extends Evented { + constructor(options?: mapboxgl.PopupOptions); + + addTo(map: mapboxgl.Map): this; + + isOpen(): boolean; + + remove(): this; + + getLngLat(): mapboxgl.LngLat; + + setLngLat(lnglat: mapboxgl.LngLat | number[]): this; + + setText(text: string): this; + + setHTML(html: string): this; + + setDOMContent(htmlNode: Node): this; + } + + export interface PopupOptions { + closeButton?: boolean; + + closeOnClick?: boolean; + + anchor?: 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'; + + offset?: number | Point | number[] | { [key:string]: Point | number[];}; + } + + export interface Style { + bearing?: number; + center?: number[]; + glyphs?: string; + layers?: Layer[]; + metadata?: any; + name?: string; + pitch?: number; + sources?: any; + sprite?: string; + transition?: Transition; + version: number; + zoom?: number; + } + + export interface Transition { + delay?: number; + duration?: number; + } + + export interface Source { + type: "vector" | "raster" | "geojson" | "image" | "video"; + } + + /** + * GeoJSONSource + */ + + export interface GeoJSONSourceRaw extends Source, GeoJSONSourceOptions { + type: "geojson"; + } + + export class GeoJSONSource implements GeoJSONSourceRaw { + type: "geojson"; + + constructor(options?: mapboxgl.GeoJSONSourceOptions); + + setData(data: GeoJSON.Feature | GeoJSON.FeatureCollection | String): this; + } + + export interface GeoJSONSourceOptions { + data?: GeoJSON.Feature | GeoJSON.FeatureCollection | string; + + maxzoom?: number; + + buffer?: number; + + tolerance?: number; + + cluster?: number | boolean; + + clusterRadius?: number; + + clusterMaxZoom?: number; + } + + /** + * VideoSource + */ + export class VideoSource implements Source, VideoSourceOptions { + type: "video"; + + constructor(options?: mapboxgl.VideoSourceOptions); + + getVideo(): HTMLVideoElement; + + setCoordinates(coordinates: number[][]): this; + } + + export interface VideoSourceOptions { + urls?: string[]; + + coordinates?: number[][]; + } + + /** + * ImageSource + */ + export class ImageSource implements Source, ImageSourceOptions { + type: "image"; + + constructor(options?: mapboxgl.ImageSourceOptions); + + setCoordinates(coordinates: number[][]): this; + } + + export interface ImageSourceOptions { + url?: string; + + coordinates?: number[][]; + } + + interface VectorSource extends Source { + type: "vector"; + url?: string; + tiles?: string[]; + minzoom?: number; + maxzoom?: number; + } + + interface RasterSource extends Source { + type: "raster"; + url: string; + tiles?: string[]; + minzoom?: number; + maxzoom?: number; + tileSize?: number; + } + + /** + * LngLat + */ + export class LngLat { + lng: number; + lat: number; + + constructor(lng: number, lat: number); + + /** Return a new LngLat object whose longitude is wrapped to the range (-180, 180). */ + wrap(): mapboxgl.LngLat; + + /** Return a LngLat as an array */ + toArray(): number[]; + + /** Return a LngLat as a string */ + toString(): string; + + static convert(input: number[]|mapboxgl.LngLat): mapboxgl.LngLat; + } + + /** + * LngLatBounds + */ + export class LngLatBounds { + sw: LngLat | number[]; + ne: LngLat | number[]; + constructor(sw?: LngLat, ne?: LngLat); + + /** Extend the bounds to include a given LngLat or LngLatBounds. */ + extend(obj: mapboxgl.LngLat | mapboxgl.LngLatBounds): this; + + /** Get the point equidistant from this box's corners */ + getCenter(): mapboxgl.LngLat; + + /** Get southwest corner */ + getSouthWest(): mapboxgl.LngLat; + + /** Get northeast corner */ + getNorthEast(): mapboxgl.LngLat; + + /** Get northwest corner */ + getNorthWest(): mapboxgl.LngLat; + + /** Get southeast corner */ + getSouthEast(): mapboxgl.LngLat; + + /** Get west edge longitude */ + getWest(): number; + + /** Get south edge latitude */ + getSouth(): number; + + /** Get east edge longitude */ + getEast(): number; + + /** Get north edge latitude */ + getNorth(): number; + + /** Returns a LngLatBounds as an array */ + toArray(): number[][]; + + /** Return a LngLatBounds as a string */ + toString(): string; + + /** Convert an array to a LngLatBounds object, or return an existing LngLatBounds object unchanged. */ + static convert(input: mapboxgl.LngLatBounds | number[] | number[][]): mapboxgl.LngLatBounds; + } + + /** + * Point + */ + // Todo: Pull out class to seperate definition for Module "point-geometry" + export class Point { + constructor(options?: Object); + + clone(): Point; + + add(p: number): Point; + + sub(p: number): Point; + + mult(k: number): Point; + + div(k: number): Point; + + rotate(a: number): Point; + + matMult(m: number): Point; + + unit(): Point; + + perp(): Point; + + round(): Point; + + mag(): number; + + equals(): boolean; + + dist(): number; + + distSqr(): number; + + angle(): number; + + angleTo(): number; + + angleWidth(): number; + + angleWidthSep(): number; + } + + export class Marker { + constructor(element?: HTMLElement, options?: { offset?: Point | number[] }); + + addTo(map: Map): this; + + remove(): this; + + getLngLat(): LngLat; + + setLngLat(lngLat: LngLat | number[]): this; + + setPopup(popup?: Popup): this; + + getPopup(): Popup; + + togglePopup(): this; + } + + /** + * Evented + */ + export class Evented { + on(type: string, listener: Function): this; + + off(type?: string | any, listener?: Function): this; + + once(type: string, listener: Function): this; + + fire(type: string, data?: mapboxgl.EventData | Object): this; + + listens(type: string): boolean; + } + + /** + * StyleOptions + */ + export interface StyleOptions { + transition?: boolean; + } + + /** + * EventData + */ + export class EventData { + type: string; + target: Map; + originalEvent: Event; + point: mapboxgl.Point; + lngLat: mapboxgl.LngLat; + } + + export class MapMouseEvent { + type: string; + target: Map; + originalEvent: MouseEvent; + point: mapboxgl.Point; + lngLat: mapboxgl.LngLat; + } + + export class MapTouchEvent { + type: string; + target: Map; + originalEvent: TouchEvent; + point: mapboxgl.Point; + lngLat: mapboxgl.LngLat; + points: Point[]; + lngLats: LngLat[]; + } + + export class MapBoxZoomEvent { + originalEvent: MouseEvent; + boxZoomBounds: LngLatBounds; + } + + /** + * AnimationOptions + */ + export interface AnimationOptions { + /** Number in milliseconds */ + duration?: number; + easing?: Function; + /** point, origin of movement relative to map center */ + offset?: Point | number[]; + /** When set to false, no animation happens */ + animate?: boolean; + } + + /** + * CameraOptions + */ + export interface CameraOptions { + /** Map center */ + center?: mapboxgl.LngLat | number[]; + /** Map zoom level */ + zoom?: number; + /** Map rotation bearing in degrees counter-clockwise from north */ + bearing?: number; + /** Map angle in degrees at which the camera is looking at the ground */ + pitch?: number; + /** If zooming, the zoom center (defaults to map center) */ + around?: mapboxgl.LngLat | number[]; + } + + /** + * FlyToOptions + */ + export interface FlyToOptions extends AnimationOptions, CameraOptions { + curve?: number; + minZoom?: number; + speed?: number; + screenSpeed?: number; + easing?: Function; + } + + /** + * MapEvent + */ + export interface MapEvent { + webglcontextlost?: {originalEvent: WebGLContextEvent}; + webglcontextrestored?: {originalEvent: WebGLContextEvent}; + render?: void; + contextmenu?: {data: mapboxgl.MapMouseEvent}; + dblclick?: {data: mapboxgl.MapMouseEvent}; + click?: {data: mapboxgl.MapMouseEvent}; + touchcancel?: {data: mapboxgl.MapTouchEvent}; + touchmove?: {data: mapboxgl.MapTouchEvent}; + touchend?: {data: mapboxgl.MapTouchEvent}; + touchstart?: {data: mapboxgl.MapTouchEvent}; + mousemove?: {data: mapboxgl.MapMouseEvent}; + mouseup?: {data: mapboxgl.MapMouseEvent}; + mousedown?: {data: mapboxgl.MapMouseEvent}; + moveend?: {data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent}; + move?: {data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent}; + movestart?: {data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent}; + mouseout?:{data: mapboxgl.MapMouseEvent}; + load?: void; + zoomend?: {data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent}; + zoom?: {data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent}; + zoomstart?: {data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent}; + boxzoomcancel?: {data: mapboxgl.MapBoxZoomEvent}; + boxzoomstart?: {data: mapboxgl.MapBoxZoomEvent}; + boxzoomend?: {data: mapboxgl.MapBoxZoomEvent}; + rotate?: {data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent}; + rotatestart?: {data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent}; + rotateend?: {data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent}; + drag?: {data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent}; + dragend?: {data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent}; + pitch?: {data: mapboxgl.EventData}; + } + + export interface Layer { + id: string; + type?: "fill" | "line" | "symbol" | "circle" | "raster" | "background" | string; //TODO: Ideally we wouldn't accept string here, just these specific strings + + metadata?: any; + ref?: string; + + source?: string; + + "source-layer"?: string; + + minzoom?: number; + maxzoom?: number; + + interactive?: boolean; + + filter?: any[]; + layout?: BackgroundLayout | FillLayout | LineLayout | SymbolLayout | RasterLayout | CircleLayout; + paint?: BackgroundPaint | FillPaint | LinePaint | SymbolPaint | RasterPaint | CirclePaint; + } + + export interface StyleFunction { + stops: any[][]; + property?: string; + base?: number; + type?: "continuous" | "interval" | "categorical"; + } + + export interface BackgroundLayout { + visibility?: "visible" | "none"; + } + export interface BackgroundPaint { + "background-color"?: string; + "background-pattern"?: string; + "background-opacity"?: number; + } + + export interface FillLayout { + visibility?: "visible" | "none"; + } + export interface FillPaint { + "fill-antialias"?: boolean; + "fill-opacity"?: number | StyleFunction; + "fill-color"?: string | StyleFunction; + "fill-outline-color": string | StyleFunction; + "fill-translate"?: number[]; + "fill-translate-anchor"?: "map" | "viewport"; + "fill-pattern"?: "string"; + } + + export interface LineLayout { + visibility?: "visible" | "none"; + + "line-cap"?: "butt" | "round" | "square"; + "line-join"?: "bevel" | "round" | "miter"; + "line-miter-limit"?: number; + "line-round-limit"?: number; + } + export interface LinePaint { + "line-opacity"?: number; + "line-color"?: string| StyleFunction; + "line-translate"?: number[]; + "line-translate-anchor"?: "map" | "viewport"; + "line-width"?: number; + "line-gap-width"?: number; + "line-offset"?: number; + "line-blur"?: number; + "line-dasharray"?: number[]; + "line-dasharray-transition"?: Transition; + "line-pattern"?: string; + } + + export interface SymbolLayout { + visibility?: "visible" | "none"; + + "symbol-placement"?: "point" | "line"; + "symbol-spacing"?: number; + "symbol-avoid-edges"?: boolean; + "icon-allow-overlap"?: boolean; + "icon-ignore-placement"?: boolean; + "icon-optional"?: boolean; + "icon-rotation-alignment"?: "map" | "viewport" | "auto"; + "icon-size"?: number; + "icon-text-fit"?: "none" | "both" | "width" | "height"; + "icon-text-fit-padding"?: number[]; + "icon-image"?: string; + "icon-rotate"?: number | StyleFunction; + "icon-padding"?: number; + "icon-keep-upright"?: boolean; + "icon-offset"?: number[]; + "text-pitch-alignment"?: "map" | "viewport" | "auto"; + "text-rotation-alignment"?: "map" | "viewport" | "auto"; + "text-field"?: string; + "text-font"?: string | string[]; + "text-size"?: number; + "text-max-width"?: number; + "text-line-height"?: number; + "text-letter-spacing"?: number; + "text-justify"?: "left" | "center" | "right"; + "text-anchor"?: "center" | "left" | "right" | "top" | "bottom" | "top-left" | "top-right" | "bottom-left" | "bottom-right"; + "text-max-angle"?: number; + "text-rotate"?: number; + "text-padding"?: number; + "text-keep-upright"?: boolean; + "text-transform"?: "none" | "uppercase" | "lowercase"; + "text-offset"?: number[]; + "text-allow-overlap"?: boolean; + "text-ignore-placement"?: boolean; + "text-optional"?: boolean; + + } + export interface SymbolPaint { + "icon-opacity"?: number; + "icon-color"?: string; + "icon-halo-color"?: string; + "icon-halo-width"?: number; + "icon-halo-blur"?: number; + "icon-translate"?: number[]; + "icon-translate-anchor"?: "map" | "viewport"; + "text-opacity"?: number; + "text-color"?: "string"; + "text-halo-color"?: "string"; + "text-halo-width"?: number; + "text-halo-blur"?: number; + "text-translate"?: number[]; + "text-translate-anchor"?: "map" | "viewport"; + } + + export interface RasterLayout { + visibility?: "visible" | "none"; + } + + export interface RasterPaint { + "raster-opacity"?: number; + "raster-hue-rotate"?: number; + "raster-brightness-min"?: number; + "raster-brightness-max"?: number; + "raster-saturation"?: number; + "raster-contrast"?: number; + "raster-fade-duration"?: number; + } + + export interface CircleLayout { + visibility?: "visible" | "none"; + } + + export interface CirclePaint { + "circle-radius"?: number | StyleFunction; + "circle-radius-transition"?: Transition; + "circle-color"?: number | StyleFunction; + "circle-blur"?: number | StyleFunction; + "circle-opacity"?: number | StyleFunction; + "circle-translate"?: number[]; + "circle-translate-anchor"?: "map" | "viewport"; + "circle-pitch-scale"?: "map" | "viewport"; + } +} + +declare module 'mapbox-gl' { + export = mapboxgl; +} diff --git a/mapbox-gl/mapbox-gl.d.ts b/mapbox-gl/mapbox-gl.d.ts index 2ee8d30949..ddb6344cbd 100644 --- a/mapbox-gl/mapbox-gl.d.ts +++ b/mapbox-gl/mapbox-gl.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Mapbox GL JS v0.24.0 +// Type definitions for Mapbox GL JS v0.26.0 // Project: https://github.com/mapbox/mapbox-gl-js // Definitions by: Dominik Bruderer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -343,28 +343,28 @@ declare namespace mapboxgl { /** * Navigation */ - export class Navigation extends Control { + export class NavigationControl extends Control { constructor(options?: mapboxgl.ControlOptions); } /** * Geolocate */ - export class Geolocate extends Control { + export class GeolocateControl extends Control { constructor(options?: mapboxgl.ControlOptions); } /** * Attribution */ - export class Attribution extends Control { + export class AttributionControl extends Control { constructor(options?: mapboxgl.ControlOptions); } /** * Scale */ - export class Scale extends Control { + export class ScaleControl extends Control { constructor(options?: {position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left', maxWidth?: number, unit?: string}) } @@ -697,6 +697,11 @@ declare namespace mapboxgl { boxZoomBounds: LngLatBounds; } + export class MapDataEvent { + type: string; + dataType: "source" | "style" | "tile"; + } + /** * AnimationOptions */ @@ -741,8 +746,12 @@ declare namespace mapboxgl { * MapEvent */ export interface MapEvent { + resize?: void; webglcontextlost?: {originalEvent: WebGLContextEvent}; webglcontextrestored?: {originalEvent: WebGLContextEvent}; + remove?: void; + dataloading?: {data: mapboxgl.MapDataEvent}; + data?: {data: mapboxgl.MapDataEvent}; render?: void; contextmenu?: {data: mapboxgl.MapMouseEvent}; dblclick?: {data: mapboxgl.MapMouseEvent}; @@ -798,7 +807,8 @@ declare namespace mapboxgl { stops: any[][]; property?: string; base?: number; - type?: "continuous" | "interval" | "categorical"; + type?: "identity" | "exponential" | "interval" | "categorical"; + "colorSpace"?: "rgb" | "lab" | "interval"; } export interface BackgroundLayout { @@ -821,6 +831,8 @@ declare namespace mapboxgl { "fill-translate"?: number[]; "fill-translate-anchor"?: "map" | "viewport"; "fill-pattern"?: "string"; + "fill-extrude-height"?: number; + "fill-extrude-base"?: number; } export interface LineLayout { From 8557bb8cbeabf189d982fa04b9ee719e49d99c13 Mon Sep 17 00:00:00 2001 From: Dave Alden Date: Tue, 25 Oct 2016 14:14:33 +0100 Subject: [PATCH 053/246] Add definitions and tests for cordova.plugins.diagnostic (#12139) --- .../cordova.plugins.diagnostic-tests.ts | 510 +++++++++++++ .../cordova.plugins.diagnostic.d.ts | 693 ++++++++++++++++++ 2 files changed, 1203 insertions(+) create mode 100644 cordova.plugins.diagnostic/cordova.plugins.diagnostic-tests.ts create mode 100644 cordova.plugins.diagnostic/cordova.plugins.diagnostic.d.ts diff --git a/cordova.plugins.diagnostic/cordova.plugins.diagnostic-tests.ts b/cordova.plugins.diagnostic/cordova.plugins.diagnostic-tests.ts new file mode 100644 index 0000000000..e95c973171 --- /dev/null +++ b/cordova.plugins.diagnostic/cordova.plugins.diagnostic-tests.ts @@ -0,0 +1,510 @@ +/// +/// + + +cordova.plugins.diagnostic.isLocationAvailable(function(available){ + console.log("Location is " + (available ? "available" : "not available")); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.isWifiAvailable(function(available){ + console.log("WiFi is " + (available ? "available" : "not available")); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.isCameraAvailable(function(available){ + console.log("Camera is " + (available ? "available" : "not available")); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.isBluetoothAvailable(function(available){ + console.log("Bluetooth is " + (available ? "available" : "not available")); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.switchToLocationSettings(); +cordova.plugins.diagnostic.switchToMobileDataSettings(); +cordova.plugins.diagnostic.switchToBluetoothSettings(); +cordova.plugins.diagnostic.switchToWifiSettings(); + +cordova.plugins.diagnostic.isWifiEnabled(function(enabled){ + console.log("WiFi is " + (enabled ? "enabled" : "disabled")); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.setWifiState(function(){ + console.log("Wifi was enabled"); + }, function(error){ + console.error("The following error occurred: "+error); + }, true +); + +cordova.plugins.diagnostic.setBluetoothState(function(){ + console.log("Bluetooth was enabled"); + }, function(error){ + console.error("The following error occurred: "+error); + }, true +); + +cordova.plugins.diagnostic.isLocationEnabled(function(enabled){ + console.log("Location setting is " + (enabled ? "enabled" : "disabled")); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.isLocationAuthorized(function(enabled){ + console.log("Location authorization is " + (enabled ? "enabled" : "disabled")); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.getLocationAuthorizationStatus(function(status){ + switch(status){ + case cordova.plugins.diagnostic.permissionStatus.NOT_REQUESTED: + console.log("Permission not requested"); + break; + case cordova.plugins.diagnostic.permissionStatus.DENIED: + console.log("Permission denied"); + break; + case cordova.plugins.diagnostic.permissionStatus.GRANTED: + console.log("Permission granted always"); + break; + case cordova.plugins.diagnostic.permissionStatus.GRANTED_WHEN_IN_USE: + console.log("Permission granted only when in use"); + break; + } +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.requestLocationAuthorization(function(status){ + switch(status){ + case cordova.plugins.diagnostic.permissionStatus.NOT_REQUESTED: + console.log("Permission not requested"); + break; + case cordova.plugins.diagnostic.permissionStatus.DENIED: + console.log("Permission denied"); + break; + case cordova.plugins.diagnostic.permissionStatus.GRANTED: + console.log("Permission granted always"); + break; + case cordova.plugins.diagnostic.permissionStatus.GRANTED_WHEN_IN_USE: + console.log("Permission granted only when in use"); + break; + } +}, function(error){ + console.error(error); +}, cordova.plugins.diagnostic.locationAuthorizationMode.ALWAYS); + +cordova.plugins.diagnostic.isCameraPresent(function(present){ + console.log("Camera is " + (present ? "present" : "absent")); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.isCameraAuthorized(function(authorized){ + console.log("App is " + (authorized ? "authorized" : "denied") + " access to the camera"); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.getCameraAuthorizationStatus(function(status){ + if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){ + console.log("Camera use is authorized"); + } +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.requestCameraAuthorization(function(status){ + console.log("Authorization request for camera use was " + (status == cordova.plugins.diagnostic.permissionStatus.GRANTED ? "granted" : "denied")); +}, function(error){ + console.error(error); +}); + +cordova.plugins.diagnostic.isMicrophoneAuthorized(function(authorized){ + console.log("App is " + (authorized ? "authorized" : "denied") + " access to the microphone"); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.getMicrophoneAuthorizationStatus(function(status){ + if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){ + console.log("Microphone use is authorized"); + } +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.requestMicrophoneAuthorization(function(status){ + if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){ + console.log("Microphone use is authorized"); + } +}, function(error){ + console.error(error); +}); + +cordova.plugins.diagnostic.isContactsAuthorized(function(authorized){ + console.log("App is " + (authorized ? "authorized" : "denied") + " access to contacts"); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.getContactsAuthorizationStatus(function(status){ + if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){ + console.log("Contacts use is authorized"); + } +}, function(error){ + console.error(error); +}); + +cordova.plugins.diagnostic.requestContactsAuthorization(function(status){ + if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){ + console.log("Contacts use is authorized"); + } +}, function(error){ + console.error(error); +}); + +cordova.plugins.diagnostic.isCalendarAuthorized(function(authorized){ + console.log("App is " + (authorized ? "authorized" : "denied") + " access to calendar"); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.getCalendarAuthorizationStatus(function(status){ + if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){ + console.log("Calendar use is authorized"); + } +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.requestCalendarAuthorization(function(status){ + if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){ + console.log("Calendar use is authorized"); + } +}, function(error){ + console.error(error); +}); + +cordova.plugins.diagnostic.switchToSettings(function(){ + console.log("Successfully switched to Settings app"); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.getBluetoothState(function(state){ + if(state === cordova.plugins.diagnostic.bluetoothState.POWERED_ON){ + console.log("Bluetooth is able to connect"); + } +}, function(error){ + console.error(error); +}); + +cordova.plugins.diagnostic.registerBluetoothStateChangeHandler(function(state){ + if(state === cordova.plugins.diagnostic.bluetoothState.POWERED_ON){ + console.log("Bluetooth is able to connect"); + } +}); + +cordova.plugins.diagnostic.registerLocationStateChangeHandler(function(state){ + if((device.platform === "Android" && state !== cordova.plugins.diagnostic.locationMode.LOCATION_OFF) + || (device.platform === "iOS") && ( state === cordova.plugins.diagnostic.permissionStatus.GRANTED + || state === cordova.plugins.diagnostic.permissionStatus.GRANTED_WHEN_IN_USE + )){ + console.log("Location is available"); + } +}); + +cordova.plugins.diagnostic.getLocationMode(function(locationMode){ + switch(locationMode){ + case cordova.plugins.diagnostic.locationMode.HIGH_ACCURACY: + console.log("High accuracy"); + break; + case cordova.plugins.diagnostic.locationMode.BATTERY_SAVING: + console.log("Battery saving"); + break; + case cordova.plugins.diagnostic.locationMode.DEVICE_ONLY: + console.log("Device only"); + break; + case cordova.plugins.diagnostic.locationMode.LOCATION_OFF: + console.log("Location off"); + break; + } +},function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.isGpsLocationAvailable(function(available){ + console.log("GPS location is " + (available ? "available" : "not available")); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.isGpsLocationEnabled(function(enabled){ + console.log("GPS location is " + (enabled ? "enabled" : "disabled")); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.isNetworkLocationAvailable(function(available){ + console.log("Network location is " + (available ? "available" : "not available")); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.isNetworkLocationEnabled(function(enabled){ + console.log("Network location is " + (enabled ? "enabled" : "disabled")); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.getLocationMode(function(locationMode){ + switch(locationMode){ + case cordova.plugins.diagnostic.locationMode.HIGH_ACCURACY: + console.log("High accuracy"); + break; + case cordova.plugins.diagnostic.locationMode.BATTERY_SAVING: + console.log("Battery saving"); + break; + case cordova.plugins.diagnostic.locationMode.DEVICE_ONLY: + console.log("Device only"); + break; + case cordova.plugins.diagnostic.locationMode.LOCATION_OFF: + console.log("Location off"); + break; + } +},function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.getPermissionAuthorizationStatus(function(status){ + switch(status){ + case cordova.plugins.diagnostic.permissionStatus.GRANTED: + console.log("Permission granted to use the camera"); + break; + case cordova.plugins.diagnostic.permissionStatus.NOT_REQUESTED: + console.log("Permission to use the camera has not been requested yet"); + break; + case cordova.plugins.diagnostic.permissionStatus.DENIED: + console.log("Permission denied to use the camera - ask again?"); + break; + case cordova.plugins.diagnostic.permissionStatus.DENIED_ALWAYS: + console.log("Permission permanently denied to use the camera - guess we won't be using it then!"); + break; + } +}, function(error){ + console.error("The following error occurred: "+error); +}, cordova.plugins.diagnostic.permission.CAMERA); + +cordova.plugins.diagnostic.getPermissionsAuthorizationStatus(function(statuses){ + for (var permission in statuses){ + switch(statuses[permission]){ + case cordova.plugins.diagnostic.permissionStatus.GRANTED: + console.log("Permission granted to use "+permission); + break; + case cordova.plugins.diagnostic.permissionStatus.NOT_REQUESTED: + console.log("Permission to use "+permission+" has not been requested yet"); + break; + case cordova.plugins.diagnostic.permissionStatus.DENIED: + console.log("Permission denied to use "+permission+" - ask again?"); + break; + case cordova.plugins.diagnostic.permissionStatus.DENIED_ALWAYS: + console.log("Permission permanently denied to use "+permission+" - guess we won't be using it then!"); + break; + } + } +}, function(error){ + console.error("The following error occurred: "+error); +},[ + cordova.plugins.diagnostic.permission.ACCESS_FINE_LOCATION, + cordova.plugins.diagnostic.permission.ACCESS_COARSE_LOCATION +]); + +cordova.plugins.diagnostic.requestRuntimePermission(function(status){ + switch(status){ + case cordova.plugins.diagnostic.permissionStatus.GRANTED: + console.log("Permission granted to use the camera"); + break; + case cordova.plugins.diagnostic.permissionStatus.NOT_REQUESTED: + console.log("Permission to use the camera has not been requested yet"); + break; + case cordova.plugins.diagnostic.permissionStatus.DENIED: + console.log("Permission denied to use the camera - ask again?"); + break; + case cordova.plugins.diagnostic.permissionStatus.DENIED_ALWAYS: + console.log("Permission permanently denied to use the camera - guess we won't be using it then!"); + break; + } +}, function(error){ + console.error("The following error occurred: "+error); +}, cordova.plugins.diagnostic.permission.CAMERA); + +cordova.plugins.diagnostic.requestRuntimePermissions(function(statuses){ + for (var permission in statuses){ + switch(statuses[permission]){ + case cordova.plugins.diagnostic.permissionStatus.GRANTED: + console.log("Permission granted to use "+permission); + break; + case cordova.plugins.diagnostic.permissionStatus.NOT_REQUESTED: + console.log("Permission to use "+permission+" has not been requested yet"); + break; + case cordova.plugins.diagnostic.permissionStatus.DENIED: + console.log("Permission denied to use "+permission+" - ask again?"); + break; + case cordova.plugins.diagnostic.permissionStatus.DENIED_ALWAYS: + console.log("Permission permanently denied to use "+permission+" - guess we won't be using it then!"); + break; + } + } +}, function(error){ + console.error("The following error occurred: "+error); +},[ + cordova.plugins.diagnostic.permission.ACCESS_FINE_LOCATION, + cordova.plugins.diagnostic.permission.ACCESS_COARSE_LOCATION +]); + +if(!cordova.plugins.diagnostic.isRequestingPermission()){ + console.log("Request some permissions"); +}else{ + cordova.plugins.diagnostic.registerPermissionRequestCompleteHandler(function(statuses){ + cordova.plugins.diagnostic.registerPermissionRequestCompleteHandler(null); // de-register handler after single call + console.log("Request some permissions"); + }); +} + +function onPermissionRequestComplete(statuses:any){ + console.info("Permission request complete"); + for (var permission in statuses){ + switch(statuses[permission]){ + case cordova.plugins.diagnostic.permissionStatus.GRANTED: + console.log("Permission granted to use "+permission); + break; + case cordova.plugins.diagnostic.permissionStatus.NOT_REQUESTED: + console.log("Permission to use "+permission+" has not been requested yet"); + break; + case cordova.plugins.diagnostic.permissionStatus.DENIED: + console.log("Permission denied to use "+permission); + break; + case cordova.plugins.diagnostic.permissionStatus.DENIED_ALWAYS: + console.log("Permission permanently denied to use "+permission); + break; + } + } + cordova.plugins.diagnostic.registerPermissionRequestCompleteHandler(null); // de-register handler +} +cordova.plugins.diagnostic.registerPermissionRequestCompleteHandler(onPermissionRequestComplete) + +cordova.plugins.diagnostic.isBluetoothEnabled(function(enabled){ + console.log("Bluetooth is " + (enabled ? "enabled" : "disabled")); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.hasBluetoothSupport(function(supported){ + console.log("Bluetooth is " + (supported ? "supported" : "unsupported")); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.hasBluetoothLESupport(function(supported){ + console.log("Bluetooth LE is " + (supported ? "supported" : "unsupported")); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.hasBluetoothLEPeripheralSupport(function(supported){ + console.log("Bluetooth LE Peripheral Mode is " + (supported ? "supported" : "unsupported")); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.isCameraRollAuthorized(function(authorized){ + console.log("App is " + (authorized ? "authorized" : "denied") + " access to the camera roll"); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.getCameraRollAuthorizationStatus(function(status){ + switch(status){ + case cordova.plugins.diagnostic.permissionStatus.NOT_REQUESTED: + console.log("Permission not requested"); + break; + case cordova.plugins.diagnostic.permissionStatus.DENIED: + console.log("Permission denied"); + break; + case cordova.plugins.diagnostic.permissionStatus.GRANTED: + console.log("Permission granted"); + break; + } +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.requestCameraRollAuthorization(function(status){ + console.log("Authorization request for camera roll was " + (status == cordova.plugins.diagnostic.permissionStatus.GRANTED ? "granted" : "denied")); +}, function(error){ + console.error(error); +}); + +cordova.plugins.diagnostic.isRemoteNotificationsEnabled(function(enabled){ + console.log("Remote notifications are " + (enabled ? "enabled" : "disabled")); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.isRegisteredForRemoteNotifications(function(registered){ + console.log("Device " + (registered ? "is" : "isn't") + " registered for remote notifications"); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.getRemoteNotificationTypes(function(types){ + for(var type in types){ + console.log(type + " is " + (types[type] ? "enabled" : "disabled")); + } +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.isRemindersAuthorized(function(authorized){ + console.log("App is " + (authorized ? "authorized" : "denied") + " access to reminders"); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.getRemindersAuthorizationStatus(function(status){ + if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){ + console.log("Reminders authorization allowed"); + } +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.requestRemindersAuthorization(function(status){ + if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){ + console.log("Reminders authorization allowed"); + } +}, function(error){ + console.error(error); +}); + +cordova.plugins.diagnostic.isBackgroundRefreshAuthorized(function(authorized){ + console.log("App is " + (authorized ? "authorized" : "not authorized") + " to perform background refresh"); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.getBackgroundRefreshStatus(function(status){ + if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){ + console.log("Background refresh is allowed"); + } +}, function(error){ + console.error("The following error occurred: "+error); +}); \ No newline at end of file diff --git a/cordova.plugins.diagnostic/cordova.plugins.diagnostic.d.ts b/cordova.plugins.diagnostic/cordova.plugins.diagnostic.d.ts new file mode 100644 index 0000000000..0fcca3b1ca --- /dev/null +++ b/cordova.plugins.diagnostic/cordova.plugins.diagnostic.d.ts @@ -0,0 +1,693 @@ +// Type definitions for cordova.plugins.diagnostic v3.2.2 +// Project: https://github.com/dpa99c/cordova-diagnostic-plugin +// Definitions by: Dave Alden +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + + +/** + * Checks whether device hardware features are enabled or available to the app, e.g. camera, GPS, wifi + */ +interface Diagnostic { + + /** + * ANDROID ONLY + * "Dangerous" permissions that need to be requested at run-time (Android 6.0/API 23 and above) + * See http://developer.android.com/guide/topics/security/permissions.html#perm-groups + * @type {Object} + */ + permission?: any; + + /** + * ANDROID ONLY + * Permission groups indicate which associated permissions will also be requested if a given permission is requested. + * See http://developer.android.com/guide/topics/security/permissions.html#perm-groups + * @type {Object} + */ + permissionGroups?: any; + + /** + * ANDROID and iOS ONLY + * Constants for requesting and reporting the various permission states. + * @type {Object} + */ + permissionStatus?: any; + + /** + * iOS ONLY + * Location authorization mode + * @type {Object} + */ + locationAuthorizationMode?: any; + + + /** + * ANDROID ONLY + * Constants for the various location modes on Android. + * @type {Object} + */ + locationMode?: any; + + /** + * ANDROID and iOS ONLY + * Constants for the various Bluetooth hardware states. + * @type {Object} + */ + bluetoothState?: any; + + + /** + * Checks if app is able to access device location. + * @param successCallback + * @param errorCallback + */ + isLocationAvailable: ( + successCallback: (available: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * Checks if Wifi is available. + * On iOS this returns true if the device is connected to a network by WiFi. + * On Android and Windows 10 Mobile this returns true if the WiFi setting is set to enabled, and is the same as isWifiEnabled() + * @param successCallback + * @param errorCallback + */ + isWifiAvailable: ( + successCallback: (available: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * Checks if camera is available. + * On Android & iOS this returns true if the device has a camera AND the application is authorized to use it. + * On Windows 10 Mobile this returns true if the device has a rear-facing camera. + * @param successCallback + * @param errorCallback + */ + isCameraAvailable: ( + successCallback: (available: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * Checks if Bluetooth is available to the app. + * Returns true if the device has Bluetooth capabilities AND if Bluetooth setting is switched on (same on Android, iOS and Windows 10 Mobile) + * @param successCallback + * @param errorCallback + */ + isBluetoothAvailable: ( + successCallback: (available: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID and WINDOWS ONLY + * Displays the device location settings to allow user to enable location services/change location mode. + */ + switchToLocationSettings?: () => void; + + /** + * ANDROID and WINDOWS ONLY + * Displays mobile settings to allow user to enable mobile data. + */ + switchToMobileDataSettings?: () => void; + + /** + * ANDROID and WINDOWS ONLY + * Displays Bluetooth settings to allow user to enable Bluetooth. + */ + switchToBluetoothSettings?: () => void; + + /** + * ANDROID and WINDOWS ONLY + * Displays WiFi settings to allow user to enable WiFi. + */ + switchToWifiSettings?: () => void; + + /** + * ANDROID and WINDOWS ONLY + * Returns true if the WiFi setting is set to enabled, and is the same as isWifiAvailable() + * @param successCallback + * @param errorCallback + */ + isWifiEnabled?: ( + successCallback: (enabled: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID and WINDOWS ONLY + * Enables/disables WiFi on the device. + * @param successCallback + * @param errorCallback + * @param state + */ + setWifiState?: ( + successCallback: (enabled: boolean) => void, + errorCallback: (error: string) => void, + state: boolean + ) => void; + + /** + * ANDROID and WINDOWS ONLY + * Enables/disables Bluetooth on the device. + * @param successCallback + * @param errorCallback + * @param state + */ + setBluetoothState?: ( + successCallback: (enabled: boolean) => void, + errorCallback: (error: string) => void, + state: boolean + ) => void; + + /** + * ANDROID and iOS ONLY + * Returns true if the device setting for location is on. + * On Android this returns true if Location Mode is switched on. + * On iOS this returns true if Location Services is switched on. + * @param successCallback + * @param errorCallback + */ + isLocationEnabled?: ( + successCallback: (enabled: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID and iOS ONLY + * Checks if the application is authorized to use location. + * @param successCallback + * @param errorCallback + */ + isLocationAuthorized?: ( + successCallback: (authorized: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID and iOS ONLY + * Returns the location authorization status for the application. + * @param successCallback + * @param errorCallback + */ + getLocationAuthorizationStatus?: ( + successCallback: (status: string) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID and iOS ONLY + * Requests location authorization for the application. + * @param successCallback + * @param errorCallback + * @param mode - (iOS-only / optional) location authorization mode specified as a locationAuthorizationMode constant. If not specified, defaults to WHEN_IN_USE. + */ + requestLocationAuthorization?: ( + successCallback: (status: string) => void, + errorCallback: (error: string) => void, + mode?: string + ) => void; + + + /** + * ANDROID and iOS ONLY + * Checks if camera hardware is present on device. + * @param successCallback + * @param errorCallback + */ + isCameraPresent?: ( + successCallback: (present: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID and iOS ONLY + * Checks if the application is authorized to use the camera. + * @param successCallback + * @param errorCallback + */ + isCameraAuthorized?: ( + successCallback: (authorized: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID and iOS ONLY + * Returns the camera authorization status for the application. + * @param successCallback + * @param errorCallback + */ + getCameraAuthorizationStatus?: ( + successCallback: (status: string) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID and iOS ONLY + * Requests camera authorization for the application. + * @param successCallback + * @param errorCallback + */ + requestCameraAuthorization?: ( + successCallback: (status: string) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID and iOS ONLY + * Checks if the application is authorized to use the microphone. + * @param successCallback + * @param errorCallback + */ + isMicrophoneAuthorized?: ( + successCallback: (authorized: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID and iOS ONLY + * Returns the microphone authorization status for the application. + * @param successCallback + * @param errorCallback + */ + getMicrophoneAuthorizationStatus?: ( + successCallback: (status: string) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID and iOS ONLY + * Requests microphone authorization for the application. + * @param successCallback + * @param errorCallback + */ + requestMicrophoneAuthorization?: ( + successCallback: (status: string) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID and iOS ONLY + * Checks if the application is authorized to use contacts (address book). + * @param successCallback + * @param errorCallback + */ + isContactsAuthorized?: ( + successCallback: (authorized: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID and iOS ONLY + * Returns the contacts authorization status for the application. + * @param successCallback + * @param errorCallback + */ + getContactsAuthorizationStatus?: ( + successCallback: (status: string) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID and iOS ONLY + * Requests contacts authorization for the application. + * @param successCallback + * @param errorCallback + */ + requestContactsAuthorization?: ( + successCallback: (status: string) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID and iOS ONLY + * Checks if the application is authorized to use the calendar. + * @param successCallback + * @param errorCallback + */ + isCalendarAuthorized?: ( + successCallback: (authorized: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID and iOS ONLY + * Returns the calendar authorization status for the application. + * @param successCallback + * @param errorCallback + */ + getCalendarAuthorizationStatus?: ( + successCallback: (status: string) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID and iOS ONLY + * Requests calendar authorization for the application. + * @param successCallback + * @param errorCallback + */ + requestCalendarAuthorization?: ( + successCallback: (status: string) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID and iOS ONLY + * Opens settings page for this app. + * On Android, this opens the "App Info" page in the Settings app. + * On iOS, this opens the app settings page in the Settings app. This works only on iOS 8+ - iOS 7 and below will invoke the errorCallback. + */ + switchToSettings?: ( + successCallback: () => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID and iOS ONLY + * Returns the state of Bluetooth on the device. + * @param successCallback + * @param errorCallback + */ + getBluetoothState?: ( + successCallback: (state: string) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID and iOS ONLY + * Registers a function to be called when a change in Bluetooth state occurs. Pass in a falsey value to de-register the currently registered function. + * @param successCallback + */ + registerBluetoothStateChangeHandler?: ( + successCallback: (state: string) => void + ) => void; + + /** + * ANDROID and iOS ONLY + * Registers a function to be called when a change in Location state occurs. Pass in a falsey value to de-register the currently registered function. + * On Android, this occurs when the Location Mode is changed. + * On iOS, this occurs when location authorization status is changed. This can be triggered either by the user's response to a location permission authorization dialog, by the user turning on/off Location Services, or by the user changing the Location authorization state specifically for your app. + * @param successCallback + */ + registerLocationStateChangeHandler?: ( + successCallback: (state: string) => void + ) => void; + + + /** + * ANDROID ONLY + * Checks if high-accuracy locations are available to the app from GPS hardware. + * Returns true if Location mode is enabled and is set to "Device only" or "High accuracy" AND if the app is authorised to use location. + * @param successCallback + * @param errorCallback + */ + isGpsLocationAvailable?: ( + successCallback: (available: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID ONLY + * Checks if the device location setting is set to return high-accuracy locations from GPS hardware. + * Returns true if Location mode is enabled and is set to either Device only or High accuracy + * @param successCallback + * @param errorCallback + */ + isGpsLocationEnabled?: ( + successCallback: (enabled: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID ONLY + * Checks if low-accuracy locations are available to the app from network triangulation/WiFi access points. + * Returns true if Location mode is enabled and is set to "Battery saving" or "High accuracy" AND if the app is authorised to use location. + * @param successCallback + * @param errorCallback + */ + isNetworkLocationAvailable?: ( + successCallback: (available: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID ONLY + * Checks if the device location setting is set to return high-accuracy locations from GPS hardware. + * Returns true if Location mode is enabled and is set to either Battery saving or High accuracy + * @param successCallback + * @param errorCallback + */ + isNetworkLocationEnabled?: ( + successCallback: (enabled: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID ONLY + * Returns the current location mode setting for the device. + * @param successCallback + * @param errorCallback + */ + getLocationMode?: ( + successCallback: (mode: string) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID ONLY + * Returns the current authorisation status for a given permission. + * @param successCallback + * @param errorCallback + * @param permission + */ + getPermissionAuthorizationStatus?: ( + successCallback: (status: string) => void, + errorCallback: (error: string) => void, + permission: string + ) => void; + + /** + * ANDROID ONLY + * Returns the current authorisation status for multiple permissions. + * @param successCallback + * @param errorCallback + * @param permissions + */ + getPermissionsAuthorizationStatus?: ( + successCallback: (status: string[]) => void, + errorCallback: (error: string) => void, + permissions: string[] + ) => void; + + /** + * ANDROID ONLY + * Requests app to be granted authorisation for a runtime permission. + * @param successCallback + * @param errorCallback + * @param permission + */ + requestRuntimePermission?: ( + successCallback: (status: string) => void, + errorCallback: (error: string) => void, + permission: string + ) => void; + + /** + * ANDROID ONLY + * Requests app to be granted authorisation for multiple runtime permissions. + * @param successCallback + * @param errorCallback + * @param permissions + */ + requestRuntimePermissions?: ( + successCallback: (status: string[]) => void, + errorCallback: (error: string) => void, + permissions: string[] + ) => void; + + /** + * ANDROID ONLY + * Indicates if the plugin is currently requesting a runtime permission via the native API. + */ + isRequestingPermission?: () => boolean; + + /** + * ANDROID ONLY + * Registers a function to be called when a runtime permission request has completed. Pass in a falsey value to de-register the currently registered function. + * @param successCallback + */ + registerPermissionRequestCompleteHandler?: ( + successCallback: (statuses: any) => void + ) => void; + + /** + * ANDROID ONLY + * Checks if the device setting for Bluetooth is switched on. + * @param successCallback + * @param errorCallback + */ + isBluetoothEnabled?: ( + successCallback: (enabled: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID ONLY + * Checks if the device has Bluetooth capabilities. + * @param successCallback + * @param errorCallback + */ + hasBluetoothSupport?: ( + successCallback: (supported: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID ONLY + * Checks if the device has Bluetooth Low Energy (LE) capabilities. + * @param successCallback + * @param errorCallback + */ + hasBluetoothLESupport?: ( + successCallback: (supported: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID ONLY + * Checks if the device supports Bluetooth Low Energy (LE) Peripheral mode. + * @param successCallback + * @param errorCallback + */ + hasBluetoothLEPeripheralSupport?: ( + successCallback: (supported: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * iOS ONLY + * Checks if the application is authorized to use the Camera Roll in Photos app. + * @param successCallback + * @param errorCallback + */ + isCameraRollAuthorized?: ( + successCallback: (authorized: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * iOS ONLY + * Returns the authorization status for the application to use the Camera Roll in Photos app. + * @param successCallback + * @param errorCallback + */ + getCameraRollAuthorizationStatus?: ( + successCallback: (status: string) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * iOS ONLY + * Requests camera roll authorization for the application. + * @param successCallback + * @param errorCallback + */ + requestCameraRollAuthorization?: ( + successCallback: (status: string) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * iOS ONLY + * Checks if remote (push) notifications are enabled. + * @param successCallback + * @param errorCallback + */ + isRemoteNotificationsEnabled?: ( + successCallback: (enabled: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * iOS ONLY + * Indicates if the app is registered for remote (push) notifications on the device. + * @param successCallback + * @param errorCallback + */ + isRegisteredForRemoteNotifications?: ( + successCallback: (registered: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * iOS ONLY + * Indicates the current setting of notification types for the app in the Settings app. + * @param successCallback + * @param errorCallback + */ + getRemoteNotificationTypes?: ( + successCallback: (types: any) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * iOS ONLY + * Checks if the application is authorized to use reminders. + * @param successCallback + * @param errorCallback + */ + isRemindersAuthorized?: ( + successCallback: (authorized: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * iOS ONLY + * Returns the reminders authorization status for the application. + * @param successCallback + * @param errorCallback + */ + getRemindersAuthorizationStatus?: ( + successCallback: (status: string) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * iOS ONLY + * Requests reminders authorization for the application. + * @param successCallback + * @param errorCallback + */ + requestRemindersAuthorization?: ( + successCallback: (status: string) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * iOS ONLY + * Checks if the application is authorized for background refresh. + * @param successCallback + * @param errorCallback + */ + isBackgroundRefreshAuthorized?: ( + successCallback: (authorized: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * iOS ONLY + * Returns the background refresh authorization status for the application. + * @param successCallback + * @param errorCallback + */ + getBackgroundRefreshStatus?: ( + successCallback: (status: string) => void, + errorCallback: (error: string) => void + ) => void; +} + +interface CordovaPlugins { + diagnostic: Diagnostic +} \ No newline at end of file From 68f63a6482c1bbdc4a55fe0750f9faf1b6852c51 Mon Sep 17 00:00:00 2001 From: Gidon Date: Tue, 25 Oct 2016 16:21:48 +0300 Subject: [PATCH 054/246] Add cordova-plugin-ble-central and jquery.rateit (#12127) * Add cordova-plugin-ble-central * Added jquery.rateit definitions --- .../cordova-plugin-ble-central-tests.ts | 121 ++++++++++++++++++ .../cordova-plugin-ble-central.d.ts | 108 ++++++++++++++++ jquery.rateit/jquery.rateit-tests.ts | 48 +++++++ jquery.rateit/jquery.rateit.d.ts | 45 +++++++ 4 files changed, 322 insertions(+) create mode 100644 cordova-plugin-ble-central/cordova-plugin-ble-central-tests.ts create mode 100644 cordova-plugin-ble-central/cordova-plugin-ble-central.d.ts create mode 100644 jquery.rateit/jquery.rateit-tests.ts create mode 100644 jquery.rateit/jquery.rateit.d.ts diff --git a/cordova-plugin-ble-central/cordova-plugin-ble-central-tests.ts b/cordova-plugin-ble-central/cordova-plugin-ble-central-tests.ts new file mode 100644 index 0000000000..1fb9037604 --- /dev/null +++ b/cordova-plugin-ble-central/cordova-plugin-ble-central-tests.ts @@ -0,0 +1,121 @@ +/// + +var log = (msg : string) => {}; +var devices: BLECentralPlugin.PeripheralData[] = []; +var demoDevice :BLECentralPlugin.PeripheralData = { + "name": "Battery Demo", + "id": "20:FF:D0:FF:D1:C0", + "advertising": [2,1,6,3,3,15,24,8,9,66,97,116,116,101,114,121], + "rssi": -55 +}; + +devices.push(demoDevice); +var demoExtendedData : BLECentralPlugin.PeripheralDataExtended = { + "name": "Battery Demo", + "id": "20:FF:D0:FF:D1:C0", + "advertising": [2,1,6,3,3,15,24,8,9,66,97,116,116,101,114,121], + "rssi": -55, + "services": [ + "1800", + "1801", + "180f" + ], + "characteristics": [ + { + "service": "1800", + "characteristic": "2a00", + "properties": [ + "Read" + ] + }, + { + "service": "1800", + "characteristic": "2a01", + "properties": [ + "Read" + ] + }, + { + "service": "1801", + "characteristic": "2a05", + "properties": [ + "Read" + ] + }, + { + "service": "180f", + "characteristic": "2a19", + "properties": [ + "Read" + ], + "descriptors": [ + { + "uuid": "2901" + }, + { + "uuid": "2904" + } + ] + } + ] +}; + + +//get updates about the bluethooth states +ble.startStateNotifications((state) => log(`BLE state ${state}`)); + +ble.isEnabled(()=> log(`bluetooth is enabled`), ()=>log(`bluetooth is not enabled`)); + +//here we try to enable bluetooth +ble.enable(() => log(`yes it worked, or it was already enabled `), () => log(`nope it didn't work, the user pressed cancel, or we are in iOS`)); + +ble.showBluetoothSettings(() => log(`yes it worked`), () => log(`nope it didn't work`)) + +//stop getting updates about the bluethooth states +ble.stopStateNotifications() + +//scan 5 seconds +ble.scan([], 5000, (data) => { devices.push(data); }, ()=> log('couldn\'t connect') ); + +//scan continously +ble.startScan([], (data) => { devices.push(data); }, ()=> log('couldn\'t connect') ) + +////scan continously +ble.startScanWithOptions([], {reportDuplicates:false }, (data) => { devices.push(data); }, ()=> log('couldn\'t connect') ) + +//stop scanning +ble.stopScan(()=> log('all good'), ()=> log('couldn\'t stop scanning')); + +//are we conenected to that device? +ble.isConnected(demoDevice.id, () => log(`already connected to this device`), ()=> log(`not yet connected to that device`)); + +//connect to a specific device +var extendedData : BLECentralPlugin.PeripheralDataExtended; +ble.connect(demoDevice.id, (data)=> extendedData = data, () => log(`couldn't connect to the device`) ); + +//read some data from a characteristic +var charsOfOneOfItsServices = demoExtendedData.characteristics.filter((value) => value.service == demoExtendedData.services[0]); +ble.read(demoDevice.id, charsOfOneOfItsServices[0].service, charsOfOneOfItsServices[0].characteristic, (data) => log(`we've received some data`), ()=> log(`couldn't read any data`)); + +//read the rssi +ble.readRSSI(demoDevice.id, (rssi)=>log(`Device ${demoDevice.name} has an RSSI of ${rssi}`)); + +var notificationsReceived : number = 0; +//get notified of changes for that characteristic +ble.startNotification(demoDevice.id, charsOfOneOfItsServices[0].service, charsOfOneOfItsServices[0].characteristic, (data)=> notificationsReceived++, ()=> log(`darn`)); + +//write some data +ble.write(demoDevice.id, charsOfOneOfItsServices[0].service, charsOfOneOfItsServices[0].characteristic, new ArrayBuffer(40), ()=> log(`all good`), ()=> log(`could't write`)); +//write some data without getting notified +ble.writeWithoutResponse(demoDevice.id, charsOfOneOfItsServices[0].service, charsOfOneOfItsServices[0].characteristic, new ArrayBuffer(40), ()=> log(`all good`), ()=> log(`could't write`)); + +//stop getting notified of changes. +ble.stopNotification(demoDevice.id, charsOfOneOfItsServices[0].service, charsOfOneOfItsServices[0].characteristic); + +//notificationsReceived == 1 + +//just disconnect +ble.disconnect(demoDevice.id); + + + diff --git a/cordova-plugin-ble-central/cordova-plugin-ble-central.d.ts b/cordova-plugin-ble-central/cordova-plugin-ble-central.d.ts new file mode 100644 index 0000000000..ccf2396833 --- /dev/null +++ b/cordova-plugin-ble-central/cordova-plugin-ble-central.d.ts @@ -0,0 +1,108 @@ +// Type definitions for cordova-plugin-ble-central 1.1.2 +// Project: https://github.com/don/cordova-plugin-ble-central +// Definitions by: Gidon Junge +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + + +declare namespace BLECentralPlugin { + + interface PeripheralCharacteristic { + service: string; + characteristic: string; + properties: string[]; + descriptors?: any[]; + } + + interface PeripheralData { + name: string; + id: string; + rssi: number + advertising: ArrayBuffer|any; + } + + + interface PeripheralDataExtended extends PeripheralData{ + services: string[]; + characteristics: PeripheralCharacteristic[] + } + + + + + interface StartScanOptions { + reportDuplicates?: boolean; + } + + export interface BLECentralPluginStatic { + scan(services: string[], seconds: number, success : (data: PeripheralData) => any): void; + scan(services: string[], seconds: number, success : (data: PeripheralData) => any, failure : () => any): void; + + startScan(services: string[], success: (data: PeripheralData) => any): void; + startScan(services: string[], success: (data: PeripheralData) => any, failure: () => any): void; + + startScanWithOptions(services: string[], options: StartScanOptions, success: (data: PeripheralData) => any): void; + startScanWithOptions(services: string[], options: StartScanOptions, success: (data: PeripheralData) => any, failure: () => any): void; + + stopScan(): void; + stopScan(success: () => any): void; + stopScan(success: () => any, failure: () => any): void; + + connect(device_id:string, success: (data: PeripheralDataExtended) => any, failure: () => any): void; + + disconnect(device_id:string): void; + disconnect(device_id:string, success: () => any): void; + disconnect(device_id:string, success: () => any, failure: () => any): void; + + read(device_id: string, service_uuid:string, characteristic_uuid:string): void; + read(device_id: string, service_uuid:string, characteristic_uuid:string, success: (rawData: ArrayBuffer) => any): void; + read(device_id: string, service_uuid:string, characteristic_uuid:string, success: (rawData: ArrayBuffer) => any, failure: () => any): void; + + write(device_id: string, service_uuid:string, characteristic_uuid:string, data: ArrayBuffer): void; + write(device_id: string, service_uuid:string, characteristic_uuid:string, data: ArrayBuffer, success : () => any): void; + write(device_id: string, service_uuid:string, characteristic_uuid:string, data: ArrayBuffer, success : () => any, failure: () => any): void; + + /* Writes data to a characteristic without a response from the peripheral. You are not notified if the write fails in the BLE stack. + The success callback is be called when the characteristic is written.*/ + writeWithoutResponse(device_id: string, service_uuid:string, characteristic_uuid:string, data: ArrayBuffer): void; + writeWithoutResponse(device_id: string, service_uuid:string, characteristic_uuid:string, data: ArrayBuffer, success : () => any): void; + writeWithoutResponse(device_id: string, service_uuid:string, characteristic_uuid:string, data: ArrayBuffer, success : () => any, failure: () => any): void; + + /* Register to be notified when the value of a characteristic changes. */ + startNotification(device_id: string, service_uuid:string, characteristic_uuid:string, success: (rawData: ArrayBuffer) => any): void; + startNotification(device_id: string, service_uuid:string, characteristic_uuid:string, success: (rawData: ArrayBuffer) => any, failure: () => any): void; + + stopNotification(device_id: string, service_uuid:string, characteristic_uuid:string): void; + stopNotification(device_id: string, service_uuid:string, characteristic_uuid:string, success: () => any): void; + stopNotification(device_id: string, service_uuid:string, characteristic_uuid:string, success: () => any, failure: () => any): void; + + /* Reports if bluetooth is enabled. */ + isEnabled(success: () => any , failure: () => any): void; + + /* Calls the success callback when the peripheral is connected and the failure callback when not connected. */ + isConnected(device_id: string, success: () => any): void; + isConnected(device_id: string, success: () => any, failure: () => any): void; + + startStateNotifications(success: (state: string) => any): void; + startStateNotifications(success: (state: string) => any, failure: () => any): void; + + stopStateNotifications(): void; + stopStateNotifications(success: () => any): void; + stopStateNotifications(success: () => any, failure: () => any): void; + + /* Opens the Bluetooth settings for the operating systems. + [iOS] showBluetoothSettings is not supported on iOS. */ + showBluetoothSettings(): void; + showBluetoothSettings(success: () => any): void; + showBluetoothSettings(success: () => any, failure: () => any): void; + + /* Enable Bluetooth on the device. + [iOS] enable is not supported on iOS. */ + enable(success: () => any, failure: () => any): void; + + + readRSSI(device_id:string, success: (rssi: number) => any): void; + readRSSI(device_id:string, success: (rssi: number) => any, failure: () => any): void; + } +} + +declare var ble: BLECentralPlugin.BLECentralPluginStatic; \ No newline at end of file diff --git a/jquery.rateit/jquery.rateit-tests.ts b/jquery.rateit/jquery.rateit-tests.ts new file mode 100644 index 0000000000..989d5c5565 --- /dev/null +++ b/jquery.rateit/jquery.rateit-tests.ts @@ -0,0 +1,48 @@ +/// + +var rateit_simple = $('.rateit').rateit(); + +var rateit_properties_font = $('.rateit').rateit({ + backingfld: '#backingfield', + icon: '@', + mode: 'font', + ispreset: false, + max: 5, + min: 0, + readonly: false, + resetable: false, + step: 0.5, + value: 2 +}); + +var rateit_properties_bg = $('.rateit').rateit({ + backingfld: '#backingfield', + mode: 'bg', + ispreset: false, + max: 5, + min: 0, + readonly: false, + resetable: false, + step: 0.5, + value: 2, + starheight: 16, + starwidth: 16 +}); + +//getters +var val : number = rateit_properties_bg.rateit('value'); +var min : number = rateit_properties_bg.rateit('min'); +var max : number = rateit_properties_bg.rateit('max'); +var readonly :boolean = rateit_properties_bg.rateit('readonly'); +var ispreset :boolean = rateit_properties_bg.rateit('ispreset'); + + +//setters +rateit_properties_bg.rateit('value',4); +rateit_properties_bg.rateit('min',0); +rateit_properties_bg.rateit('max',6); +rateit_properties_bg.rateit('readonly',true); +rateit_properties_bg.rateit('ispreset',false); + +//reset it +rateit_properties_bg.rateit('reset'); \ No newline at end of file diff --git a/jquery.rateit/jquery.rateit.d.ts b/jquery.rateit/jquery.rateit.d.ts new file mode 100644 index 0000000000..d5540792b5 --- /dev/null +++ b/jquery.rateit/jquery.rateit.d.ts @@ -0,0 +1,45 @@ +// Type definitions for jquery.rateit.js 1.1.1 +// Project: https://github.com/gjunge/rateit.js +// Definitions by: Gidon Junge +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +type RateItMode = "bg" | "font"; +interface RateItOptions { + value? : number; + min?: number; + max?: number; + step?:number; + backingfld?:string; + readonly?:boolean; + ispreset? : boolean; + resetable? : boolean; + starwidth?: number; + starheight?: number; + mode?: RateItMode; + icon?: string; +} + +interface JQuery { + rateit() : JQuery; + rateit(options: RateItOptions) : JQuery; + + rateit(method: 'value') : number; + rateit(method: 'value', param: number) : JQuery; + + rateit(method: 'max') : number; + rateit(method: 'max', param: number) : JQuery; + + rateit(method: 'min') : number; + rateit(method: 'min', param: number) : JQuery; + + rateit(method: 'readonly') : boolean; + rateit(method: 'readonly', param: boolean) : JQuery; + + rateit(method: 'ispreset') : boolean; + rateit(method: 'ispreset', param: boolean) : JQuery; + + rateit(method: 'reset') : JQuery; + + rateit(method: string, param: any) : any; +} From 912bbfc70d42455492cad784e92f3764972bcebc Mon Sep 17 00:00:00 2001 From: Craig Boland Date: Tue, 25 Oct 2016 08:22:35 -0500 Subject: [PATCH 055/246] Updated jquery.dataTables for 1.10.8 (#11718) Release Notes: https://cdn.datatables.net/1.10.8/ * Expanded .draw() parameter data type to allow string. * Added "serverSide" parameter to page.Info() return type. * $.fn.dataTable.tables() can now return instance of DataTables API. * Added rowId option. * Added row().id() method. * Added rows().ids() method. * Added count() method. * Added 'numbers' paging option. * Resolved implicit 'any' instances in test file. * Attempt to clarify use of $.fn.dataTable.tables() method in test file. Note: rows().every(), columns().every(), cells().every() parameter list was incorrectly updated in the 1.10.6 version of this file. The parameters listed apply to 1.10.8. Note: the added 'postfix' option to 'number' renderer appears to be used internally. --- jquery.dataTables/jquery.dataTables-tests.ts | 44 +++++++++++---- jquery.dataTables/jquery.dataTables.d.ts | 58 +++++++++++++++++--- 2 files changed, 83 insertions(+), 19 deletions(-) diff --git a/jquery.dataTables/jquery.dataTables-tests.ts b/jquery.dataTables/jquery.dataTables-tests.ts index 21599fdbdf..b8234b69fa 100644 --- a/jquery.dataTables/jquery.dataTables-tests.ts +++ b/jquery.dataTables/jquery.dataTables-tests.ts @@ -219,6 +219,7 @@ $(document).ready(function () { pagingType: "simple", retrieve: true, renderer: "bootstrap", + rowId: "custId", scrollCollapse: true, search: true, searchCols: [{ "search": "", "smart": true, "regex": false, "caseInsensitive": true }], @@ -261,7 +262,7 @@ $(document).ready(function () { { ajax: { data: ajaxDataFunc, - dataSrc: function (data) { }, + dataSrc: function (data: any) { }, }, }; @@ -305,8 +306,9 @@ $(document).ready(function () { destroy = dt.destroy(true); destroy.$(""); - var draw = dt.draw(); + var draw: DataTables.DataTable = dt.draw(); draw = dt.draw(true); + draw = dt.draw("page"); draw.$(""); var initSettings = dt.init(); @@ -343,7 +345,8 @@ $(document).ready(function () { "end": 20, "length": 10, "recordsTotal": 57, - "recordsDisplay": 57 + "recordsDisplay": 57, + "serverSide": false }; var page_len_get = dt.page.len(); @@ -401,7 +404,7 @@ $(document).ready(function () { .cache('search') .sort() .unique() - .each(function (d) { + .each(function (d: any) { select.append($('')); }); @@ -520,7 +523,7 @@ $(document).ready(function () { columns = dt.columns("selector", modifier); var columns_cache = columns.cache("order"); - dt.columns('.select-filter').eq(0).each(function (colIdx) { + dt.columns('.select-filter').eq(0).each(function (colIdx: any) { // Create the select list and search operation var select = $('') .appendTo( @@ -707,7 +710,7 @@ $(document).ready(function () { .cache('search') .sort() .unique() - .each(function (d) { + .each(function (d: any) { select.append($('')); }); }); @@ -751,6 +754,8 @@ $(document).ready(function () { var row_19 = dt.row("selector").index(); var row_20 = dt.row("selector").node(); var row_21 = dt.row("selector").remove(); + var row_22: string = dt.row("selector").id(); + var row_23: string = dt.row("selector").id(false); var rows_1 = dt.rows(); var rows_2 = dt.rows().remove(); @@ -767,6 +772,8 @@ $(document).ready(function () { var rows_13 = dt.rows.add([{}, {}]); dt.rows().every(function () { }); dt.rows().every(function (rowIdx, tableLoop, rowLoop) { }); + var rows_14: DataTables.DataTable = dt.rows("selector").ids(); + var rows_15: DataTables.DataTable = dt.rows("selector").ids(false); var table3 = $('#example').DataTable(); table3.row.add({ @@ -831,7 +838,7 @@ $(document).ready(function () { ]) .show(); - dt.rows().eq(0).each(function (rowIdx) { + dt.rows().eq(0).each(function (rowIdx: any) { dt .row(rowIdx) .child( @@ -881,6 +888,20 @@ $(document).ready(function () { //#endregion "Methods-Row" + //#region "Methods-Static" + + // Variable is a stand-in for $.fn.dataTable. See extension of JQueryStatic at the top of jquery.dataTables.d.ts. + var staticFn: DataTables.StaticFunctions; + + // With boolean parameter type, always returns DataTables.DataTable[]. + var static_1: DataTables.DataTable[] = staticFn.tables(true); + // With object parameter type, returns DataTables.DataTable[] when "api" property is false. + static_1 = staticFn.tables({ "visible": true, "api": false }); + // With object parameter type, returns DataTables.DataTable when "api" property is true. + var static_2: DataTables.DataTable = staticFn.tables({ "visible": true, "api": true }); + + //#endregion "Methods-Static" + //#region "Methods-Table" var tables = dt.tables(); @@ -905,6 +926,7 @@ $(document).ready(function () { //#region "Methods-Util" var util_1: boolean = dt.any(); + var util_2: number = dt.count(); //#endregion "Methods-Util" }); diff --git a/jquery.dataTables/jquery.dataTables.d.ts b/jquery.dataTables/jquery.dataTables.d.ts index 84938e01cf..13d14bd64b 100644 --- a/jquery.dataTables/jquery.dataTables.d.ts +++ b/jquery.dataTables/jquery.dataTables.d.ts @@ -1,4 +1,4 @@ -// Type definitions for JQuery DataTables 1.10.7 +// Type definitions for JQuery DataTables 1.10.8 // Project: http://www.datatables.net // Definitions by: Kiarash Ghiaseddin , Omid Rad , Armin Sander // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -182,11 +182,11 @@ declare namespace DataTables { destroy(remove?: boolean): DataTable; /** - * Redraw the table. + * Redraw the DataTables in the current context, optionally updating ordering, searching and paging as required. * - * @param reset Reset (default) or hold the current paging position. A full re-sort and re-filter is performed when this method is called, which is why the pagination reset is the default action. + * @param paging This parameter is used to determine what kind of draw DataTables will perform. */ - draw(reset?: boolean): DataTable; + draw(paging?: boolean | string): DataTable; /* * Look up a language token that was defined in the DataTables' language initialisation object. @@ -374,6 +374,7 @@ declare namespace DataTables { length: number; recordsTotal: number; recordsDisplay: number; + serverSide: boolean } //#endregion "page-methods" @@ -436,6 +437,11 @@ declare namespace DataTables { */ concat(a: Object, ...b: Object[]): DataTable; + /** + * Get the number of entries in an API instance's result set, regardless of multi-table grouping (e.g. any data, selected rows, etc). Since: 1.10.8 + */ + count(): number; + /** * Iterate over the contents of the API result set. * @@ -910,6 +916,15 @@ declare namespace DataTables { */ id(hash?: boolean): string; + /** + * Get the id of the selected row. Since: 1.10.8 + * + * @param hash true - Append a hash (#) to the start of the row id. This can be useful for then using the id as a selector + * false - Do not modify the id value. + * @returns Row id. If the row does not have an id available 'undefined' will be returned. + */ + id(hash?: boolean): string; + /** * Get the row index of the row column. */ @@ -970,6 +985,15 @@ declare namespace DataTables { */ every(fn: (rowIdx: number, tableLoop: number, rowLoop: number) => void): DataTable; + /** + * Get the ids of the selected rows. Since: 1.10.8 + * + * @param hash true - Append a hash (#) to the start of each row id. This can be useful for then using the ids as selectors + * false - Do not modify the id value. + * @returns Api instance with the selected rows in its result set. If a row does not have an id available 'undefined' will be returned as the value. + */ + ids(hash?: boolean): DataTable; + /** * Get the row indexes of the selected rows. */ @@ -1057,11 +1081,12 @@ declare namespace DataTables { isDataTable(table: string): boolean; /** - * Get all DataTables on the page + * Get all DataTable tables that have been initialised - optionally you can select to get only currently visible tables and / or retrieve the tables as API instances. * - * @param visible Get only visible tables + * @param visible As a boolean value this options is used to indicate if you want all tables on the page should be returned (false), or visible tables only (true). + * Since 1.10.8 this option can also be given as an object. */ - tables(visible?: boolean): DataTables.DataTable[]; + tables(visible?: boolean | ObjectTablesStatic): DataTables.DataTable[] | DataTables.DataTable; /** * Version number compatibility check function @@ -1100,6 +1125,18 @@ declare namespace DataTables { throttle(fn: Function, period?: number): Function; } + interface ObjectTablesStatic { + /** + * Get only visible tables (true) or all tables regardless of visibility (false). + */ + visible: boolean + + /** + * Return a DataTables API instance for the selected tables (true) or an array (false). + */ + api: boolean + } + //#endregion "Static-Methods" //#region "Settings" @@ -1257,7 +1294,7 @@ declare namespace DataTables { pageLength?: number; /** - * Pagination button display options. Basic Types: simple, simple_numbers, full, full_numbers + * Pagination button display options. Basic Types: numbers (1.10.8) simple, simple_numbers, full, full_numbers */ pagingType?: string; @@ -1271,6 +1308,11 @@ declare namespace DataTables { */ renderer?: string | RendererSettings; + /** + * Data property name that DataTables will use to set element DOM IDs. Since: 1.10.8 + */ + rowId?: string; + /** * Allow the table to reduce in height when a limited number of rows are shown. Since: 1.10 */ From 7ee04856878c9a8a09125b315a971cdee2aa5081 Mon Sep 17 00:00:00 2001 From: Leo Rudberg Date: Tue, 25 Oct 2016 09:26:49 -0400 Subject: [PATCH 056/246] Added Seeded interface to Chance definition (#11919) * Fixes #10684 I kept the deprecated `pick` declarations, but added the proposed (JSDoc-influenced) [deprecation annotation](https://github.com/Microsoft/TypeScript/issues/390) to them. The added `pickone` and `pickset` declarations have identical types to their respective `pick` flavors. * Added Seeded interface to Chance definition --- chance/chance.d.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/chance/chance.d.ts b/chance/chance.d.ts index 6390b57864..7ce79b431f 100644 --- a/chance/chance.d.ts +++ b/chance/chance.d.ts @@ -5,13 +5,19 @@ declare namespace Chance { + interface Seeded { + seed: number; + } + + type SeededChance = Chance & Seeded; + interface ChanceStatic { (): Chance - (seed: number): Chance + (seed: number): SeededChance (generator: () => any): Chance new(): Chance; - new(seed: number): Chance; + new(seed: number): SeededChance; new(generator: () => any): Chance; } From a7d9f4a4f55a6791d8a6b4b8c9159a0f098885c9 Mon Sep 17 00:00:00 2001 From: CJ Bell Date: Tue, 25 Oct 2016 09:30:55 -0400 Subject: [PATCH 057/246] Updating pegs to 0.10.0. (#12151) Also added comments and more detailed typing restrictions on parser-generator options. --- pegjs/pegjs-tests.ts | 8 ++--- pegjs/pegjs.d.ts | 71 ++++++++++++++++++++++++++++++++++++++------ 2 files changed, 66 insertions(+), 13 deletions(-) diff --git a/pegjs/pegjs-tests.ts b/pegjs/pegjs-tests.ts index 082836e74f..abd6b601c7 100644 --- a/pegjs/pegjs-tests.ts +++ b/pegjs/pegjs-tests.ts @@ -8,7 +8,7 @@ import * as pegjs from 'pegjs'; { - let pegparser: pegjs.Parser = pegjs.buildParser("start = ('a' / 'b')+"); + let pegparser: pegjs.Parser = pegjs.generate("start = ('a' / 'b')+"); try { let result: string = pegparser.parse("abba"); @@ -20,7 +20,7 @@ import * as pegjs from 'pegjs'; } { - let parser = pegjs.buildParser("A = 'test'", { + let parser = pegjs.generate("A = 'test'", { cache: true, allowedStartRules: ["A"], optimize: "speed", @@ -29,7 +29,7 @@ import * as pegjs from 'pegjs'; } try { - let parserOrSource: pegjs.Parser | string = pegjs.buildParser("A = 'test'", {output: "source"}); + let source: string = pegjs.generate("A = 'test'", {output: "source"}); } catch (error) { if (error instanceof pegjs.GrammarError) { let e: pegjs.GrammarError = error; @@ -46,4 +46,4 @@ try { console.log(e.location.end.line); console.log(e.message); console.log(e.name); -} \ No newline at end of file +} diff --git a/pegjs/pegjs.d.ts b/pegjs/pegjs.d.ts index 8dae497cfa..340fed4bf2 100644 --- a/pegjs/pegjs.d.ts +++ b/pegjs/pegjs.d.ts @@ -1,6 +1,6 @@ -// Type definitions for PEG.js +// Type definitions for PEG.js v0.10.0 // Project: http://pegjs.org/ -// Definitions by: vvakame , Tobias Kahlert +// Definitions by: vvakame , Tobias Kahlert , C.J. Bell // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace PEG { @@ -63,19 +63,72 @@ declare module "pegjs" { SyntaxError: any; } - interface BuildOptions { - cache?: boolean; + interface BuildOptionsBase { + /** rules the parser will be allowed to start parsing from (default: the first rule in the grammar) */ allowedStartRules?: string[]; - optimize?: string; + /** if `true`, makes the parser cache results, avoiding exponential parsing time in pathological cases but making the parser slower (default: `false`) */ + cache?: boolean; + /** selects between optimizing the generated parser for parsing speed (`"speed"`) or code size (`"size"`) (default: `"speed"`) */ + optimize?: "speed" | "size"; + /** plugins to use */ plugins?: any[]; + /** makes the parser trace its progress (default: `false`) */ + trace?: boolean } - interface OutputBuildOptions extends BuildOptions { - output?: string; + + interface ParserBuildOptions extends BuildOptionsBase { + /** if set to `"parser"`, the method will return generated parser object; if set to `"source"`, it will return parser source code as a string (default: `"parser"`) */ + output?: "parser" } - function buildParser(grammar: string, options?: BuildOptions): Parser; - function buildParser(grammar: string, options?: OutputBuildOptions): Parser | string; + interface OutputFormatAmdCommonjs extends BuildOptionsBase { + /** if set to `"parser"`, the method will return generated parser object; if set to `"source"`, it will return parser source code as a string (default: `"parser"`) */ + output: "source"; + /** format of the genreated parser (`"amd"`, `"bare"`, `"commonjs"`, `"globals"`, or `"umd"`); valid only when `output` is set to `"source"` (default: `"bare"`) */ + format: "amd" | "commonjs"; + /** parser dependencies, the value is an object which maps variables used to access the dependencies in the parser to module IDs used to load them; valid only when `format` is set to `"amd"`, `"commonjs"`, or `"umd"` (default: `{}`) */ + dependencies?: any + } + + interface OutputFormatUmd extends BuildOptionsBase { + /** if set to `"parser"`, the method will return generated parser object; if set to `"source"`, it will return parser source code as a string (default: `"parser"`) */ + output: "source"; + /** format of the genreated parser (`"amd"`, `"bare"`, `"commonjs"`, `"globals"`, or `"umd"`); valid only when `output` is set to `"source"` (default: `"bare"`) */ + format: "umd"; + /** parser dependencies, the value is an object which maps variables used to access the dependencies in the parser to module IDs used to load them; valid only when `format` is set to `"amd"`, `"commonjs"`, or `"umd"` (default: `{}`) */ + dependencies?: any + /** name of a global variable into which the parser object is assigned to when no module loader is detected; valid only when `format` is set to `"globals"` or `"umd"` (default: `null`) */ + exportVar?: any + } + + interface OutputFormatGlobals extends BuildOptionsBase { + /** if set to `"parser"`, the method will return generated parser object; if set to `"source"`, it will return parser source code as a string (default: `"parser"`) */ + output: "source"; + /** format of the genreated parser (`"amd"`, `"bare"`, `"commonjs"`, `"globals"`, or `"umd"`); valid only when `output` is set to `"source"` (default: `"bare"`) */ + format: "globals"; + /** name of a global variable into which the parser object is assigned to when no module loader is detected; valid only when `format` is set to `"globals"` or `"umd"` (default: `null`) */ + exportVar?: any + } + + interface OutputFormatBare extends BuildOptionsBase { + /** if set to `"parser"`, the method will return generated parser object; if set to `"source"`, it will return parser source code as a string (default: `"parser"`) */ + output: "source"; + /** format of the genreated parser (`"amd"`, `"bare"`, `"commonjs"`, `"globals"`, or `"umd"`); valid only when `output` is set to `"source"` (default: `"bare"`) */ + format?: "bare" + } + + /** Returns a generated parser object. It will throw an exception if the grammar is invalid. The exception will contain `message` property with more details about the error. */ + function generate(grammar: string, options?: ParserBuildOptions): Parser; + /** Returns the generated source code as a `string`. It will throw an exception if the grammar is invalid. The exception will contain `message` property with more details about the error. */ + function generate(grammar: string, options: OutputFormatAmdCommonjs): string; + /** Returns the generated source code as a `string`. It will throw an exception if the grammar is invalid. The exception will contain `message` property with more details about the error. */ + function generate(grammar: string, options: OutputFormatUmd): string; + /** Returns the generated source code as a `string`. It will throw an exception if the grammar is invalid. The exception will contain `message` property with more details about the error. */ + function generate(grammar: string, options: OutputFormatGlobals): string; + /** Returns the generated source code as a `string`. It will throw an exception if the grammar is invalid. The exception will contain `message` property with more details about the error. */ + function generate(grammar: string, options: OutputFormatBare): string; + namespace parser { type SyntaxError = PegjsError; From 28b8b029adde23a6e93a3b7b6d88fec239e15e3a Mon Sep 17 00:00:00 2001 From: Bert Loedeman Date: Tue, 25 Oct 2016 15:49:22 +0200 Subject: [PATCH 058/246] Added support for automapper-ts npm package (#12159) --- automapper-ts/automapper-ts-tests.ts | 1990 ++++++++++++++++++++++++++ automapper-ts/automapper-ts.d.ts | 559 ++++++++ 2 files changed, 2549 insertions(+) create mode 100644 automapper-ts/automapper-ts-tests.ts create mode 100644 automapper-ts/automapper-ts.d.ts diff --git a/automapper-ts/automapper-ts-tests.ts b/automapper-ts/automapper-ts-tests.ts new file mode 100644 index 0000000000..5e18f75789 --- /dev/null +++ b/automapper-ts/automapper-ts-tests.ts @@ -0,0 +1,1990 @@ +/// +/// + +var globalScope = this; + +declare module jasmine { + interface Matchers { + toEqualData(data: any): boolean; + fail(message: string): boolean; + } +} + +declare function expect(): jasmine.Matchers; + +module AutoMapperJs { + describe('AutoMapper', () => { + beforeEach(() => { + jasmine.addMatchers(ExtendJasmine.addCustomMatchers()); + + // clear mappings (please, don't try this at home!) + for (var key in (automapper)._mappings) { + if (!(automapper)._mappings.hasOwnProperty(key)) { + continue; + } + delete (automapper)._mappings[key]; + } + }); + + it('should validate mapping using strictMode set to \'true\' (with valid mappings)', () => { + // arrange + automapper.createMap(AssertConfigPropertiesProp, AssertConfigPropertiesProp); + + // act and assert + automapper.assertConfigurationIsValid(true); + }); + + it('should set strictMode to \'true\' when no value is provided and validate (with valid mappings)', () => { + // arrange + automapper.createMap(AssertConfigPropertiesProp, AssertConfigPropertiesProp); + + // act and assert + automapper.assertConfigurationIsValid(); + }); + + it('should validate mapping using strictMode set to \'false\'', () => { + // arrange + automapper.createMap(AssertConfigPropertiesProp, AssertConfigPropertiesProp); + automapper.createMap('AssertMappingConfigUntestableA', 'AssertMappingConfigUntestableB'); + + // act and assert + automapper.assertConfigurationIsValid(false); + }); + + it('should fail when validating mappings using strictMode set to \'true\' (with unvalidatable mappings)', () => { + // arrange + automapper.createMap(AssertConfigPropertiesProp, AssertConfigPropertiesProp); + automapper.createMap('AssertMappingConfigUntestableA', 'AssertMappingConfigUntestableB'); + + // act + try { + automapper.assertConfigurationIsValid(true); + } catch (e) { + // assert + var errorMessage: string = e.message; + var dekeyedErrorMessage = + errorMessage.substr(0, errorMessage.indexOf('\'') + 1) + + errorMessage.substr(errorMessage.lastIndexOf('\'')); + + expect(dekeyedErrorMessage).toEqual(`Mapping '' cannot be validated, since mapping.sourceType or mapping.destinationType are unspecified.`); + return; + } + + // assert + expect(null).fail('Expected error was not raised.'); + }); + + it('should fail when auto mapping a property which does not exist on destination', () => { + // arrange + var srcType = AssertConfigPropertiesProp; + var dstType = AssertConfigPropertiesProp2; + + var srcName = AutoMapperHelper.getClassName(srcType); + var dstName = AutoMapperHelper.getClassName(dstType); + + automapper.createMap(srcType, dstType); + + try { + // act + automapper.assertConfigurationIsValid(true); + } catch (e) { + // assert + expect(e.message).toEqual(`Mapping '${srcName}=>${dstName}' is invalid: Source member 'prop' is configured to be mapped, ` + + `but does not exist on destination type (source: '${srcName}', destination: '${dstName}').`); + return; + } + + // assert + expect(null).fail('Expected error was not raised.'); + }); + + it('should succeed when mapping objects with ignored properties not existing on the other side', () => { + // arrange + var srcType = AssertConfigPropertiesProp; + var dstType = AssertConfigPropertiesProp2; + + var srcName = AutoMapperHelper.getClassName(srcType); + var dstName = AutoMapperHelper.getClassName(dstType); + + automapper + .createMap(srcType, dstType) + .forSourceMember('prop', (opts: ISourceMemberConfigurationOptions) => { opts.ignore(); }) + .forMember('prop2', (opts: IMemberConfigurationOptions) => { opts.ignore(); }); + + // act and assert + automapper.assertConfigurationIsValid(true); + }); + + it('should fail when auto mapping a property which does not exist on source', () => { + // arrange + var srcType = AssertConfigPropertiesProp; + var dstType = AssertConfigPropertiesPropProp2; + + var srcName = AutoMapperHelper.getClassName(srcType); + var dstName = AutoMapperHelper.getClassName(dstType); + + automapper.createMap(srcType, dstType); + + try { + // act + automapper.assertConfigurationIsValid(true); + } catch (e) { + // assert + expect(e.message).toEqual(`Mapping '${srcName}=>${dstName}' is invalid: Destination member 'prop2' does not exist on source type (source: '${srcName}', destination: '${dstName}').`); + return; + } + + // assert + expect(null).fail('Expected error was not raised.'); + }); + + it('should fail when providing configuration for a property which does not exist on destination', () => { + // arrange + var srcType = AssertConfigPropertiesProp; + var dstType = AssertConfigPropertiesPropProp2; + + var srcName = AutoMapperHelper.getClassName(srcType); + var dstName = AutoMapperHelper.getClassName(dstType); + + automapper + .createMap(srcType, dstType) + .forMember('prop3', (opts: IMemberConfigurationOptions) => { opts.ignore(); }); + + try { + // act + automapper.assertConfigurationIsValid(true); + } catch (e) { + // assert + expect(e.message).toEqual(`Mapping '${srcName}=>${dstName}' is invalid: Destination member 'prop3' is configured, but does not exist on destination type (source: '${srcName}', destination: '${dstName}').`); + return; + } + + // assert + expect(null).fail('Expected error was not raised.'); + }); + + it('should fail when providing configuration for a property which does not exist on source', () => { + // arrange + var srcType = AssertConfigPropertiesProp; + var dstType = AssertConfigPropertiesPropProp2; + + var srcName = AutoMapperHelper.getClassName(srcType); + var dstName = AutoMapperHelper.getClassName(dstType); + + automapper + .createMap(srcType, dstType) + .forSourceMember('prop2', (opts: ISourceMemberConfigurationOptions) => { opts.ignore(); }); + + try { + // act + automapper.assertConfigurationIsValid(true); + } catch (e) { + // assert + expect(e.message).toEqual(`Mapping '${srcName}=>${dstName}' is invalid: Source member 'prop2' is configured, but does not exist on source type (source: '${srcName}', destination: '${dstName}').`); + return; + } + + // assert + expect(null).fail('Expected error was not raised.'); + }); + }); + + describe('AutoMapper (asynchronous mapping)', () => { + beforeEach(() => { + jasmine.addMatchers(ExtendJasmine.addCustomMatchers()); + }); + + it('should be able to map asynchronous using forMember', (done) => { + // arrange + var objFrom = { prop: 'prop' }; + + var fromKey = 'async-forMember-'; + var toKey = 'valid-1'; + + // act + automapper + .createMap(fromKey, toKey) + .forMember('prop', (opts: IMemberConfigurationOptions, cb: IMemberCallback) => { + var func = (o: IMemberConfigurationOptions, c: IMemberCallback) => { + c(o.intermediatePropertyValue + ' (async)'); + }; + + // do something asynchronous + setTimeout((): void => { + func(opts, cb); + }, 10); + }) + .forMember('prop', (opts: IMemberConfigurationOptions) => { + return opts.intermediatePropertyValue + ' (sync)'; + }); + + automapper.mapAsync(fromKey, toKey, objFrom, (result: any) => { + // assert + expect(result.prop).toEqual(objFrom.prop + ' (async)' + ' (sync)'); + done(); + }); + }); + + it('should be able to map asynchronous using forMember in combination with a constant value', (done: () => void) => { + // arrange + var objFrom = { prop: 'prop' }; + + var fromKey = 'async-forMember-'; + var toKey = 'valid-2'; + + // act + automapper + .createMap(fromKey, toKey) + .forMember('prop', (opts: IMemberConfigurationOptions, cb: IMemberCallback) => { + var func = (o: IMemberConfigurationOptions, c: IMemberCallback) => { + c(o.intermediatePropertyValue + ' (async)'); + }; + + // do something asynchronous + setTimeout((): void => { + func(opts, cb); + }, 10); + }) + .forMember('prop', 'Async With Constant Value'); + + automapper.mapAsync(fromKey, toKey, objFrom, (result: any) => { + // assert + expect(result.prop).toEqual('Async With Constant Value'); + done(); + }); + }); + + it('should be able to map asynchronous using an asynchronous forMember in combination with a synchronous forMember mapping', (done: () => void) => { + // arrange + var objFrom = { prop1: 'prop1', prop2: 'prop2' }; + + var fromKey = 'async-forMember-'; + var toKey = 'valid-3'; + + // act + automapper + .createMap(fromKey, toKey) + .forMember('prop1', (opts: IMemberConfigurationOptions, cb: IMemberCallback) => { + var func = (o: IMemberConfigurationOptions, c: IMemberCallback) => { + c(o.intermediatePropertyValue + ' (async)'); + }; + + // do something asynchronous + setTimeout((): void => { + func(opts, cb); + }, 10); + }) + .forMember('prop2', (opts: IMemberConfigurationOptions): any => opts.intermediatePropertyValue); + + automapper.mapAsync(fromKey, toKey, objFrom, (result: any) => { + // assert + expect(result.prop1).toEqual(objFrom.prop1 + ' (async)'); + expect(result.prop2).toEqual(objFrom.prop2); + done(); + }); + }); + + it('should fail when mapping an asynchronous mapping using synchronous map function', () => { + // arrange + var objFrom = { prop: 'prop' }; + + var fromKey = 'async-forMember-'; + var toKey = 'invalid-1'; + + automapper + .createMap(fromKey, toKey) + .forMember('prop', (opts: IMemberConfigurationOptions, cb: IMemberCallback) => { + var func = (o: IMemberConfigurationOptions, c: IMemberCallback) => { + c(o.intermediatePropertyValue + ' (async)'); + } + + // do something asynchronous + setTimeout((): void => { + func(opts, cb); + }, 10); + }) + .forMember('prop', (opts: IMemberConfigurationOptions) => { + return opts.intermediatePropertyValue + ' (sync)'; + }); + + // act + try { + var objB = automapper.map(fromKey, toKey, objFrom); + } catch (e) { + // assert + expect(e.message).toEqual('Impossible to use asynchronous mapping using automapper.map(); use automapper.mapAsync() instead.'); + return; + } + + // assert + expect(null).fail('Expected error was not raised.'); + }); + + it('should be able to map asynchronous using forSourceMember', (done: () => void) => { + // arrange + var objFrom = { prop: 'prop' }; + + var fromKey = 'async-forSourceMember-'; + var toKey = 'valid-1'; + + automapper + .createMap(fromKey, toKey) + .forSourceMember('prop', (opts: ISourceMemberConfigurationOptions, cb: IMemberCallback) => { + var func = (o: ISourceMemberConfigurationOptions, c: IMemberCallback) => { + c('AsyncValue'); + }; + + // do something asynchronous + setTimeout((): void => { + func(opts, cb); + }, 10); + }); + + // act + automapper.mapAsync(fromKey, toKey, objFrom, (result: any) => { + // assert + expect(result.prop).toEqual('AsyncValue'); + done(); + }); + }); + + it('should be able to use convertUsing to map an object with a custom asynchronous type resolver function', (done: () => void) => { + var objA = { propA: 'propA' }; + + var fromKey = '{D1534A0F-6120-475E-B7E2-BF2489C58571}'; + var toKey = '{1896FF99-1A28-4FE6-800B-072D5616B02D}'; + + automapper + .createMap(fromKey, toKey) + .convertUsing((opts: IResolutionContext, cb: IMapCallback): void => { + var func = (o: IResolutionContext, c: IMapCallback) => { + var res = { propA: o.sourceValue.propA + ' (custom async mapped with resolution context)' }; + c(res); + }; + + // do something asynchronous + setTimeout((): void => { + func(opts, cb); + }, 10); + }); + + // act + automapper.mapAsync(fromKey, toKey, objA, (result: any) => { + // assert + expect(result.propA).toEqual(objA.propA + ' (custom async mapped with resolution context)'); + done(); + }); + }); + + it('should asynchronously map an array', (done: () => void) => { + // arrange + var arrA = [{ prop1: 'From A', prop2: 'From A too' }]; + + var fromKey = '{60D9DGH6-DSEC-48GF-9BAC-0805FCAF91B7}'; + var toKey = '{AC6D5B97-9AE3-BERT-ZB60-AZFEDZXE541A}'; + + automapper.createMap(fromKey, toKey) + .forMember('prop1', (opts: IMemberConfigurationOptions, cb: IMemberCallback) => { + var func = (o: IMemberConfigurationOptions, c: IMemberCallback) => { + c(o.intermediatePropertyValue); + }; + + // do something asynchronous + setTimeout((): void => { + func(opts, cb); + }, 10); + }); + // act + var arrB = automapper.mapAsync(fromKey, toKey, arrA, (result: any) => { + // assert + expect(result).toEqualData(arrA); + done(); + }); + }); + }); + + describe('AutoMapper', () => { + beforeEach(() => { + jasmine.addMatchers(ExtendJasmine.addCustomMatchers()); + }); + + it('should have a global automapper object', () => { + expect(automapper).not.toBeUndefined(); + expect(automapper).not.toBeNull(); + + expect(automapper.createMap).not.toBeUndefined(); + expect(automapper.createMap).not.toBeNull(); + expect(typeof automapper.createMap === 'function').toBeTruthy(); + + expect(automapper.map).not.toBeUndefined(); + expect(automapper.map).not.toBeNull(); + expect(typeof automapper.map === 'function').toBeTruthy(); + }); + + it('should return the Singleton instance when instantiating the Singleton directly', () => { + // arrange + var caught = false; + + // act + var mapper = new AutoMapper(); + expect(automapper).toBe(mapper); + }); + + it('should use created mapping profile', () => { + // arrange + var fromKey = '{5700E351-8D88-4327-A216-3CC94A308EDF}'; + var toKey = '{BB33A261-3CA9-48FC-85E6-2C269F73728D}'; + + automapper.createMap(fromKey, toKey); + + // act + automapper.map(fromKey, toKey, {}); + + // assert + }); + + it('should fail when using a non-existing mapping profile', () => { + // arrange + var caught = false; + + var fromKey = '{5AEFD48C-4472-41E7-BA7E-0977A864E116}'; + var toKey = '{568DCA5E-477E-4739-86B2-38BB237B8EF8}'; + + // act + try { + automapper.map(fromKey, toKey, {}); + } catch (e) { + caught = true; + + // assert + expect(e.message).toEqual('Could not find map object with a source of ' + fromKey + ' and a destination of ' + toKey); + } + + if (!caught) { + // assert + expect().fail('Using a non-existing mapping profile should result in an error.'); + } + }); + + it('should be able to use forAllMemberMappings', () => { + // arrange + var fromKey = '{5700E351-8D88-4327-A216-3CCBHJ808EDF}'; + var toKey = '{BB33A261-3CA9-48FC-85E6-2C269FDFT28D}'; + + var source = { prop1: 'prop1', prop2: 'prop2' }; + var suffix = ' [forAllMembers]'; + + automapper.createMap(fromKey, toKey) + .forMember('prop1', (opts: IMemberConfigurationOptions): any => opts.intermediatePropertyValue) + .forMember('prop2', (opts: IMemberConfigurationOptions): any => opts.intermediatePropertyValue) + .forAllMembers((destinationObject: any, + destinationPropertyName: string, + value: any): void => { + destinationObject[destinationPropertyName] = value + suffix; + }); + + // act + var destination = automapper.map(fromKey, toKey, source); + + // assert + expect(destination.prop1).toEqual(source.prop1 + suffix); + expect(destination.prop2).toEqual(source.prop2 + suffix); + }); + + it('should be able to use forAllMemberMappings when automapping', () => { + // arrange + var fromKey = '{5700E351-8D88-4327-A216-3CCBHJ808EDF}'; + var toKey = '{BB33A261-3CA9-48FC-85E6-2C269FDFT28D}'; + + var source = { prop1: 'prop1', prop2: 'prop2' }; + var suffix = ' [forAllMembers]'; + + automapper.createMap(fromKey, toKey) + .forAllMembers((destinationObject: any, + destinationPropertyName: string, + value: any): void => { + destinationObject[destinationPropertyName] = value + suffix; + }); + + // act + var destination = automapper.map(fromKey, toKey, source); + + // assert + expect(destination.prop1).toEqual(source.prop1 + suffix); + expect(destination.prop2).toEqual(source.prop2 + suffix); + }); + + it('should accept multiple forMember calls for the same destination property and overwrite with the last one specified', () => { + //arrange + var objA = { prop1: 'From A', prop2: 'From A too' }; + + var fromKey = '{7AC4134B-ECC1-464B-B144-5B9D8F5B568E}'; + var toKey = '{2BDE907C-1CE6-4CC5-A601-9A94CC665837}'; + + automapper + .createMap(fromKey, toKey) + .forMember('prop1', (opts: IMemberConfigurationOptions) => { opts.mapFrom('prop2'); }) + .forMember('prop1', (opts: IMemberConfigurationOptions) => { opts.ignore(); }); + + // act + var objB = automapper.map(fromKey, toKey, objA); + + // assert + expect(objB).toEqualData({ prop2: objA.prop2 }); + }); + + it('should be able to ignore a source property using the forSourceMember function', () => { + // arrange + var objA = { prop1: 'From A', prop2: 'From A too' }; + + var fromKey = '{AD88481E-597B-4C1B-967B-3D700B8BAB0F}'; + var toKey = '{2A6714C4-784E-47D3-BBF4-6205834EC8D5}'; + + automapper + .createMap(fromKey, toKey) + .forSourceMember('prop1', (opts: ISourceMemberConfigurationOptions) => { opts.ignore(); }); + + // act + var objB = automapper.map(fromKey, toKey, objA); + + // assert + expect(objB).toEqualData({ prop2: 'From A too' }); + }); + + it('should be able to custom map a source property using the forSourceMember function', () => { + // arrange + var objA = { prop1: 'From A', prop2: 'From A too' }; + + var fromKey = '{AD88481E-597B-4C1B-967B-3D700B8BAB0F}'; + var toKey = '{2A6714C4-784E-47D3-BBF4-6205834EC8D5}'; + + automapper + .createMap(fromKey, toKey) + .forSourceMember('prop1', (opts: ISourceMemberConfigurationOptions) => { return 'Yeah!'; }); + + // act + var objB = automapper.map(fromKey, toKey, objA); + + // assert + expect(objB).toEqualData({ prop1: 'Yeah!', prop2: 'From A too' }); + }); + + it('should be able to ignore a source property already specified (by forMember) using the forSourceMember function', () => { + // arrange + var objA = { prop1: 'From A', prop2: 'From A too' }; + + var fromKey = '{AD88481E-597B-4C1B-967B-3D701B8CAB0A}'; + var toKey = '{2A6714C4-784E-47D3-BBF4-620583DEC86A}'; + + automapper + .createMap(fromKey, toKey) + .forMember('prop1', 12) + .forSourceMember('prop1', (opts: ISourceMemberConfigurationOptions) => { opts.ignore(); }); + + // act + var objB = automapper.map(fromKey, toKey, objA); + + // assert + expect(objB).toEqualData({ prop2: 'From A too' }); + }); + + it('should fail when forSourceMember is used with anything else than a function', () => { + // arrange + var caught = false; + + var fromKey = '{5EE20DF9-84B3-4A6A-8C5D-37AEDC44BE87}'; + var toKey = '{986C959D-2E2E-41FA-9857-8EF519467AEB}'; + + try { + // act + automapper + .createMap(fromKey, toKey) + .forSourceMember('prop1', 12); + } catch (e) { + // assert + caught = true; + expect(e.message).toEqual('Configuration of forSourceMember has to be a function with one (sync) or two (async) options parameters.'); + } + + if (!caught) { + // assert + expect().fail('Using anything else than a function with forSourceMember should result in an error.'); + } + }); + + it('should be able to use forMember to map a source property to a destination property with a different name', () => { + //arrange + var objA = { prop1: 'From A', prop2: 'From A too' }; + + var fromKey = '{7AC4134B-ECC1-464B-B144-5B9D8F5B568E}'; + var toKey = '{2BDE907C-1CE6-4CC5-A601-9A94CC665837}'; + + automapper + .createMap(fromKey, toKey) + .forMember('prop', (opts: IMemberConfigurationOptions) => { opts.mapFrom('prop2'); }); + + // act + var objB = automapper.map(fromKey, toKey, objA); + + // assert + expect(objB).toEqualData({ prop1: objA.prop1, prop: objA.prop2 }); + }); + + it('should use forAllMembers function for each mapped destination property when specified', () => { + // arrange + var objA = { prop1: 'From A', prop2: 'From A too' }; + + var fromKey = '{C4056539-FA86-4398-A10B-C41D3A791F26}'; + var toKey = '{01C64E8D-CDB5-4307-9011-0C7F1E70D115}'; + + var forAllMembersSpy = jasmine.createSpy('forAllMembersSpy').and.callFake((destinationObject: any, destinationProperty: string, value: any) => { + destinationObject[destinationProperty] = value; + }); + + automapper + .createMap(fromKey, toKey) + .forAllMembers(forAllMembersSpy); + + // act + var objB = automapper.map(fromKey, toKey, objA); + + // assert + expect(forAllMembersSpy).toHaveBeenCalled(); + expect(forAllMembersSpy.calls.count()).toBe(Object.keys(objB).length); + }); + + it('should be able to use forMember with a constant value', () => { + // arrange + var objA = { prop: 1 }; + + var fromKey = '{54E67626-B877-4824-82E6-01E9F411B78F}'; + var toKey = '{2D7FDB88-97E9-45EF-A111-C9CC9C188227}'; + + var constantResult = 2; + + automapper + .createMap(fromKey, toKey) + .forMember('prop', constantResult); + + // act + var objB = automapper.map(fromKey, toKey, objA); + + // assert + expect(objB.prop).toBe(constantResult); + }); + + it('should be able to use forMember with a function returning a constant value', () => { + // arrange + var objA = { prop: 1 }; + + var fromKey = '{74C12B56-1DD1-4EA0-A640-D1F814971124}'; + var toKey = '{BBC617B8-26C8-42A0-A204-45CC77073355}'; + + var constantResult = 3; + + automapper + .createMap(fromKey, toKey) + .forMember('prop', () => { return constantResult; }); + + // act + var objB = automapper.map(fromKey, toKey, objA); + + // assert + expect(objB.prop).toBe(constantResult); + }); + + it('should be able to use forMember with a function using the source object', () => { + // arrange + var objA = { prop: { subProp: { value: 1 } } }; + + var fromKey = '{54E67626-B877-4824-82E6-01E9F411B78F}'; + var toKey = '{2D7FDB88-97E9-45EF-A111-C9CC9C188227}'; + + automapper + .createMap(fromKey, toKey) + .forMember('prop', (opts: IMemberConfigurationOptions) => { return opts.sourceObject[opts.sourcePropertyName].subProp.value * 2; }); + + // act + var objB = automapper.map(fromKey, toKey, objA); + + // assert + expect(objB.prop).toBe(objA.prop.subProp.value * 2); + }); + + it('should be able to use forMember to ignore a property', () => { + // arrange + var objA = { prop: 1 }; + + var fromKey = '{76D26B33-888A-4DF7-ABDA-E5B99E944272}'; + var toKey = '{18192391-85FF-4729-9A08-5954FCFE3954}'; + + automapper + .createMap(fromKey, toKey) + .forMember('prop', (opts: IMemberConfigurationOptions) => { opts.ignore(); }); + + // act + var objB = automapper.map(fromKey, toKey, objA); + + // assert + expect(objB.hasOwnProperty('prop')).not.toBeTruthy(); + }); + + it('should be able to use forMember to map a source property to a destination property with a different name', () => { + // arrange + var objA = { propDiff: 1 }; + + var fromKey = '{A317A36A-AD92-4346-A015-AE06FC862DB4}'; + var toKey = '{03B05E43-3028-44FD-909F-652E2DA5E607}'; + + automapper + .createMap(fromKey, toKey) + .forMember('prop', (opts: IMemberConfigurationOptions) => { opts.mapFrom('propDiff'); }); + + // act + var objB = automapper.map(fromKey, toKey, objA); + + // assert + expect(objB.prop).toEqual(objA.propDiff); + }); + + it('should be able to use stack forMember calls to map a source property to a destination property using multiple mapping steps', () => { + // arrange + var birthdayString = '2000-01-01T00:00:00.000Z'; + var objA = { birthdayString: birthdayString }; + + var fromKey = '{564F1F57-FD4F-413C-A9D3-4B1C1333A20B}'; + var toKey = '{F9F45923-2D13-4EF1-9685-4883AD1D2F98}'; + + automapper + .createMap(fromKey, toKey) + .forMember('birthday', (opts: IMemberConfigurationOptions) => { opts.mapFrom('birthdayString'); }) + .forMember('birthday', (opts: IMemberConfigurationOptions) => { return new Date(opts.intermediatePropertyValue); }); + + // act + var objB = automapper.map(fromKey, toKey, objA); + + // assert + expect(objB.birthday instanceof Date).toBeTruthy(); + expect(objB.birthday.toISOString()).toEqual('2000-01-01T00:00:00.000Z'); + }); + + it('should be able to use stack forMember calls to map a source property to a destination property using multiple mapping steps in any order', () => { + // arrange + var birthdayString = '2000-01-01T00:00:00.000Z'; + var objA = { birthdayString: birthdayString }; + + var fromKey = '{1609A9B5-6083-448B-8FD6-51DAD106B63D}'; + var toKey = '{47AF7D2D-A848-4C5B-904F-39402E2DCDD5}'; + + automapper + .createMap(fromKey, toKey) + .forMember('birthday', (opts: IMemberConfigurationOptions) => { return new Date(opts.intermediatePropertyValue); }) + .forMember('birthday', (opts: IMemberConfigurationOptions) => { opts.mapFrom('birthdayString'); }); + + // act + var objB = automapper.map(fromKey, toKey, objA); + + // assert + expect(objB.birthday instanceof Date).toBeTruthy(); + expect(objB.birthday.toISOString()).toEqual('2000-01-01T00:00:00.000Z'); + }); + + it('should not map properties that are not an object\'s own properties', () => { + var objA = new ClassA(); + objA.propA = 'propA'; + + var fromKey = '{A317A36A-AD92-4346-A015-AE06FC862DB4}'; + var toKey = '{03B05E43-3028-44FD-909F-652E2DA5E607}'; + + automapper + .createMap(fromKey, toKey); + + // act + var objB = automapper.map(fromKey, toKey, objA); + + // assert + expect(objB.propA).toEqual(objA.propA); + }); + + it('should be able to use convertUsing to map an object with a custom type resolver function', () => { + var objA = { propA: 'propA' }; + + var fromKey = '{D1534A0F-6120-475E-B7E2-BF2489C58571}'; + var toKey = '{1896FF99-1A28-4FE6-800B-072D5616B02D}'; + + automapper + .createMap(fromKey, toKey) + .convertUsing(function(resolutionContext: IResolutionContext): any { + return { propA: resolutionContext.sourceValue.propA + ' (custom mapped with resolution context)' }; + }); + + // act + var objB = automapper.map(fromKey, toKey, objA); + + // assert + expect(objB.propA).toEqual(objA.propA + ' (custom mapped with resolution context)'); + }); + + it('should be able to use convertUsing to map an object with a custom type resolver class', () => { + // arrange + var objA = { propA: 'propA' }; + + var fromKey = '{6E7F5757-1E55-4B55-BB86-44FF5B33DE2F}'; + var toKey = '{8521AE41-C3AF-4FCD-B7C7-A915C037D69E}'; + + automapper + .createMap(fromKey, toKey) + .convertUsing(CustomTypeConverterDefinition); + + // act + var objB = automapper.map(fromKey, toKey, objA); + + // assert + expect(objB.propA).toEqual(objA.propA + ' (convertUsing with a class definition)'); + }); + + it('should be able to use convertUsing to map an object with a custom type resolver instance', () => { + // arrange + // NOTE BL The CustomTypeConverter class definition is defined at the bottom, since TypeScript + // does not allow classes to be defined inline. + + var objA = { propA: 'propA' }; + + var fromKey = '{BDF3758C-B38E-4343-95B6-AE0F80C8B9C4}'; + var toKey = '{13DD7AE1-4177-4A80-933B-B60A55859E50}'; + + automapper + .createMap(fromKey, toKey) + .convertUsing(new CustomTypeConverterInstance()); + + // act + var objB = automapper.map(fromKey, toKey, objA); + + // assert + expect(objB.propA).toEqual(objA.propA + ' (convertUsing with a class instance)'); + }); + + it('should fail when directly using the type converter base class', () => { + // arrange + var caught = false; + var objA = { propA: 'propA' }; + + var fromKey = 'should fail when directly using '; + var toKey = 'the type converter base class'; + + automapper + .createMap(fromKey, toKey) + .convertUsing(TypeConverter); + + try { + // act + var objB = automapper.map(fromKey, toKey, objA); + } catch (e) { + // assert + caught = true; + expect(e.message).toEqual('The TypeConverter.convert method is abstract. Use a TypeConverter extension class instead.'); + } + + if (!caught) { + // assert + expect().fail('Using the type converter base class directly should fail.'); + } + }); + + it('should fail when convertUsing is used with a function not having exactly one (resolutionContext) parameter.', () => { + // arrange + var caught = false; + + var fromKey = '{1EF9AC11-BAA1-48DB-9C96-9DFC40E33BCA}'; + var toKey = '{C4DA81D3-9072-4140-BFA7-431C35C01F54}'; + + try { + // act + automapper + .createMap(fromKey, toKey) + .convertUsing(() => { + return {}; + }); + + //var objB = automapper.map(fromKey, toKey, objA); + } catch (e) { + // assert + caught = true; + expect(e.message).toEqual('The value provided for typeConverterClassOrFunction is invalid. ' + + 'Error: The function provided does not provide exactly one (resolutionContext) parameter.'); + } + + if (!caught) { + // assert + expect().fail('Using anything else than a function with forSourceMember should result in an error.'); + } + }); + + it('should be able to use convertToType to map a source object to a destination object which is an instance of a given class', () => { + //arrange + var objA = { ApiProperty: 'From A' }; + + + var fromKey = '{7AC4134B-ECC1-464B-B144-5C9D8F5B5A7E}'; + var toKey = '{2BDE907C-1CE6-4CC5-A601-9A94CA6C4737}'; + + automapper + .createMap(fromKey, toKey) + .forMember('property', (opts: IMemberConfigurationOptions) => { opts.mapFrom('ApiProperty'); }) + .convertToType(DemoToBusinessType); + + // act + var objB = automapper.map(fromKey, toKey, objA); + + // assert + expect(objB instanceof DemoToBusinessType).toBeTruthy(); + expect(objB.property).toEqual(objA.ApiProperty); + }); + + it('should be able to use a condition to map or ignore a property', () => { + // arrange + var objA = { prop: 1, prop2: 2 }; + + var fromKey = '{76D23B33-888A-4DF7-BEBE-E5B99E944272}'; + var toKey = '{18192191-85FE-4729-A980-5954FCFE3954}'; + + automapper + .createMap(fromKey, toKey) + .forMember('prop', (opts: IMemberConfigurationOptions) => { opts.condition((sourceObject: any) => sourceObject.prop === 0); }) + .forMember('prop2', (opts: IMemberConfigurationOptions) => { opts.condition((sourceObject: any) => sourceObject.prop2 === 2); }); + + // act + var objB = automapper.map(fromKey, toKey, objA); + + // assert + expect(objB.hasOwnProperty('prop')).not.toBeTruthy(); + expect(objB.hasOwnProperty('prop2')).toBeTruthy(); + }); + + it('should be able to ignore all unmapped members using the ignoreAllNonExisting function', () => { + // arrange + var objA = { + propA: 'Prop A', + propB: 'Prop B', + propC: 'Prop C', + propD: 'Prop D' + }; + + var fromKey = '{AD88481E-597B-4C1C-9A7B-3D70DB8BCB0F}'; + var toKey = '{2A6614C4-784E-47D3-BBF4-6205834EA8D1}'; + + automapper + .createMap(fromKey, toKey) + .forMember('propA', (opts: IMemberConfigurationOptions) => opts.mapFrom('propA')) + .ignoreAllNonExisting(); + + // act + var objB = automapper.map(fromKey, toKey, objA); + + // assert + expect(objB).toEqualData({ propA: 'Prop A' }); + }); + + it('should be able to create a map and use it using class types', () => { + // arrange + var objA = new ClassA(); + objA.propA = 'Value'; + + // act + automapper.createMap(ClassA, ClassB); + var objB = automapper.map(ClassA, ClassB, objA); + + // assert + expect(objB instanceof ClassB).toBeTruthy(); + expect(objB).toEqualData({ propA: 'Value' }); + }); + + it('should throw an error when creating a map using class types and specifying a conflicting destination type', () => { + // arrange + var caught = false; + + // act + try { + automapper + .createMap(ClassA, ClassB) + .convertToType(ClassC); + } catch (e) { + caught = true; + // assert + expect(e.message).toEqual('Destination type class can only be set once.'); + } + + if (!caught) { + // assert + expect(null).fail('AutoMapper should throw an error when creating a map using class types and specifying a conflicting destination type.'); + } + }); + + it('should be able to use forMember to map a nested source property to a destination property', () => { + //arrange + var objA = { prop1: { propProp1: 'From A' }, prop2: 'From A too' }; + + var fromKey = '{7AC4134B-ECC1-464B-B144-5B9D8F5B568E}'; + var toKey = '{2BDE907C-1CE6-4CC5-A601-9A94CC665837}'; + + automapper + .createMap(fromKey, toKey) + .forMember('propFromNestedSource', (opts: IMemberConfigurationOptions) => { opts.mapFrom('prop1.propProp1'); }); + + // act + var objB = automapper.map(fromKey, toKey, objA); + + // assert + expect(objB).toEqualData({ prop2: objA.prop2, propFromNestedSource: objA.prop1.propProp1 }); + }); + + it('should be able to stack forMember calls when mapping a nested source property to a destination property', () => { + //arrange + var objA = { prop1: { propProp1: 'From A' }, prop2: 'From A too' }; + var addition = ' - sure works!'; + + var fromKey = '{7AC4134B-ECC1-464B-B144-5B99CF5B558E}'; + var toKey = '{2BDE907C-1CE6-4CC5-56A1-9A94CC6658C7}'; + + automapper + .createMap(fromKey, toKey) + .forMember('propFromNestedSource', (opts: IMemberConfigurationOptions) => { opts.mapFrom('prop1.propProp1'); }) + .forMember('propFromNestedSource', (opts: IMemberConfigurationOptions) => { return opts.intermediatePropertyValue + addition; }); + + // act + var objB = automapper.map(fromKey, toKey, objA); + + // assert + expect(objB).toEqualData({ prop2: objA.prop2, propFromNestedSource: objA.prop1.propProp1 + addition }); + }); + + it('should be able to stack forMember calls when mapping a nested source property to a destination property in any order', () => { + //arrange + var objA = { prop1: { propProp1: 'From A' }, prop2: 'From A too' }; + var addition = ' - sure works!'; + + var fromKey = '{7AC4134B-ECD1-46EB-B14A-5B9D8F5B5F8E}'; + var toKey = '{BBD6907C-ACE6-4FC8-A60D-1A943C66D83F}'; + + automapper + .createMap(fromKey, toKey) + .forMember('propFromNestedSource', (opts: IMemberConfigurationOptions) => { return opts.intermediatePropertyValue + addition; }) + .forMember('propFromNestedSource', (opts: IMemberConfigurationOptions) => { opts.mapFrom('prop1.propProp1'); }); + + // act + var objB = automapper.map(fromKey, toKey, objA); + + // assert + expect(objB).toEqualData({ prop2: objA.prop2, propFromNestedSource: objA.prop1.propProp1 + addition }); + }); + + it('should be able to stack forMember mapFrom calls when mapping a nested source property to a destination property', () => { + //arrange + var objA = { prop1: { propProp1: 'From A', propProp2: { propProp2Prop: 'From A' } }, prop2: 'From A too' }; + var addition = ' - sure works!'; + + var fromKey = '{7AC4134B-ECD1-46EB-B14A-5B9D8F5B5F8E}'; + var toKey = '{BBD6907C-ACE6-4FC8-A60D-1A943C66D83F}'; + + automapper + .createMap(fromKey, toKey) + .forMember('propFromNestedSource', (opts: IMemberConfigurationOptions) => { return opts.intermediatePropertyValue + addition; }) + .forMember('propFromNestedSource', (opts: IMemberConfigurationOptions) => { opts.mapFrom('prop1.propProp2.propProp2Prop'); }) + .forMember('propFromNestedSource', (opts: IMemberConfigurationOptions) => { opts.mapFrom('prop1.propProp1'); }); + + // act + var objB = automapper.map(fromKey, toKey, objA); + + // assert + expect(objB).toEqualData({ prop2: objA.prop2, propFromNestedSource: objA.prop1.propProp1 + addition }); + }); + + it('should be able to use forMember to map to a nested destination', () => { + //arrange + var objA = { prop1: { propProp1: 'From A', propProp2: { propProp2Prop: 'From A' } }, prop2: 'From A too' }; + var addition = ' - sure works!'; + + var fromKey = '{7AC4134B-ECD1-46EB-B14A-5B9D8F5B5F8E}'; + var toKey = '{BBD6907C-ACE6-4FC8-A60D-1A943C66D83F}'; + + automapper + .createMap(fromKey, toKey) + .forMember('nested.property', (opts: IMemberConfigurationOptions) => { return opts.intermediatePropertyValue + addition; }) + .forMember('nested.property', (opts: IMemberConfigurationOptions) => { opts.mapFrom('prop1.propProp2.propProp2Prop'); }) + .forMember('nested.property', (opts: IMemberConfigurationOptions) => { opts.mapFrom('prop1.propProp1'); }); + + // act + var objB = automapper.map(fromKey, toKey, objA); + + // assert + expect(objB).toEqualData({ prop2: objA.prop2, nested: { property: objA.prop1.propProp1 + addition }}); + }); + + it('should be able to use mapFrom to switch properties and ignore a property as well', () => { + // arrange + var objA = { prop1: 'From A', prop2: 'From A too', prop3: 'Also from A (really)' }; + + var fromKey = 'should be able to use mapFrom to switch '; + var toKey = 'properties and ignore a property as well'; + + // act + automapper + .createMap(fromKey, toKey) + .forMember('prop1', (opts: IMemberConfigurationOptions) => { opts.mapFrom('prop2'); }) + .forMember('prop2', (opts: IMemberConfigurationOptions) => { opts.mapFrom('prop1'); }) + .forSourceMember('prop3', (opts: ISourceMemberConfigurationOptions) => { opts.ignore(); }); + + var objB = automapper.map(fromKey, toKey, objA); + + // assert + expect(objB).toEqualData({ prop1: objA.prop2, prop2: objA.prop1 }); + }); + + it('should be able to create a new property using a constant value', () => { + // arrange + var objA = { }; + + var fromKey = 'should be able to create a new property '; + var toKey = 'using a constant value'; + + // act + automapper + .createMap(fromKey, toKey) + .forMember('prop4', (opts: IMemberConfigurationOptions) => { return 12; }); + + var objB = automapper.map(fromKey, toKey, objA); + + // assert + expect(objB).toEqualData({ prop4: 12 }); + }); + + it('should just return source object when no properties are created using null source object', () => { + // arrange + var objA: any = null; + + var fromKey = 'should just return source object when no '; + var toKey = 'properties created using null source object'; + + // act + automapper + .createMap(fromKey, toKey); + + var objB = automapper.map(fromKey, toKey, objA); + + // assert + expect(objB).toBeNull(); + }); + + it('should be able to create a new property using a constant value (null source object)', () => { + // arrange + var objA: any = null; + + var fromKey = 'should be able to create a new property '; + var toKey = 'using a constant value (null source object)'; + + // act + automapper + .createMap(fromKey, toKey) + .forMember('prop4', (opts: IMemberConfigurationOptions) => { return 12; }); + + var objB = automapper.map(fromKey, toKey, objA); + + // assert + expect(objB).toEqualData({ prop4: 12 }); + }); + }); + + it('should map a source object with empty nested objects', () => { + // arrange + var src: any = { + homeAddress: null /*{ + address1: '200 Main St', + address2: '200 Main St', + city: 'Los Angeles', + state: 'CA', + zip: '90000' + }*/, + businessAddress: { + address1: '200 Main St', + // address2: '200 Main St', + city: 'Los Angeles', + state: 'CA', + zip: '90000' + } + }; + + var fromKey = '{60E9DC56-D6E1-48FF-9BAC-0805FCAF91B7}'; + var toKey = '{AC6D5A97-9AEF-42C7-BD60-A5F3D17E541A}'; + + automapper + .createMap(fromKey, toKey) + // .forMember('homeAddress.address1', (opts: IMemberConfigurationOptions) => { opts.mapFrom('homeAddress.address1'); }) + .forMember('homeAddress.address2', (opts: IMemberConfigurationOptions) => { opts.mapFrom('homeAddress.address2'); }) + // .forMember('homeAddress.city', (opts: IMemberConfigurationOptions) => { opts.mapFrom('homeAddress.city'); }) + // .forMember('homeAddress.state', (opts: IMemberConfigurationOptions) => { opts.mapFrom('homeAddress.state'); }) + // .forMember('homeAddress.zip', (opts: IMemberConfigurationOptions) => { opts.mapFrom('homeAddress.zip'); }) + + .forMember('businessAddress.address1', (opts: IMemberConfigurationOptions) => { opts.mapFrom('businessAddress.address1'); }) + .forMember('businessAddress.address2', (opts: IMemberConfigurationOptions) => null) + .forMember('businessAddress.city', (opts: IMemberConfigurationOptions) => { opts.mapFrom('businessAddress.city'); }) + .forMember('businessAddress.state', (opts: IMemberConfigurationOptions) => { opts.mapFrom('businessAddress.state'); }) + .forMember('businessAddress.zip', (opts: IMemberConfigurationOptions) => { opts.mapFrom('businessAddress.zip'); }) + ; + + // act + var dst = automapper.map(fromKey, toKey, src); + + // assert + expect(dst).not.toBeNull(); + + expect(dst.homeAddress).toBeNull(); + + expect(dst.businessAddress.address1).toBe(src.businessAddress.address1); + expect(dst.businessAddress.address2).toBeUndefined(); + expect(dst.businessAddress.city).toBe(src.businessAddress.city); + expect(dst.businessAddress.state).toBe(src.businessAddress.state); + expect(dst.businessAddress.zip).toBe(src.businessAddress.zip); + }); + + describe('AutoMapper - Currying support', () => { + beforeEach(() => { + jasmine.addMatchers(ExtendJasmine.addCustomMatchers()); + }); + + it('should be able to use currying when calling createMap', () => { + // arrange + var fromKey = '{808D9D7F-AA89-4D07-917E-A528F055EE64}'; + var toKey1 = '{B364C0A0-9E24-4424-A569-A4C14101947C}'; + var toKey2 = '{1055CA5A-4FC4-44CB-B4D8-B004F43D8840}'; + + var source = { prop: 'Value' }; + + // act + var mapFromKeyCurry = automapper.createMap(fromKey); + + mapFromKeyCurry(toKey1) + .forSourceMember('prop', (opts: ISourceMemberConfigurationOptions) => { opts.ignore(); }); + + mapFromKeyCurry(toKey2); + + var result1 = automapper.map(fromKey, toKey1, source); + var result2 = automapper.map(fromKey, toKey2, source); + + // assert + expect(typeof mapFromKeyCurry === 'function').toBeTruthy(); + expect(result1.prop).toBeUndefined(); + expect(result2.prop).toEqual(source.prop); + }); + + it('should be able to use currying (one parameter) when calling map', () => { + // arrange + var fromKey = 'should be able to use currying (one parameter)'; + var toKey1 = 'when calling map (1)'; + var toKey2 = 'when calling map (2)'; + + var source = { prop: 'Value' }; + + // act + var createMapFromKeyCurry = automapper.createMap(fromKey); + + createMapFromKeyCurry(toKey1) + .forSourceMember('prop', (opts: ISourceMemberConfigurationOptions) => { opts.ignore(); }); + + createMapFromKeyCurry(toKey2); + + var result1MapCurry = automapper.map(fromKey); + var result2MapCurry = automapper.map(fromKey); + + var result1 = result1MapCurry(toKey1, source); + var result2 = result2MapCurry(toKey2, source); + + // assert + expect(typeof createMapFromKeyCurry === 'function').toBeTruthy(); + expect(typeof result1MapCurry === 'function').toBeTruthy(); + expect(typeof result2MapCurry === 'function').toBeTruthy(); + + expect(result1.prop).toBeUndefined(); + expect(result2.prop).toEqual(source.prop); + }); + + it('should be able to use currying when calling map', () => { + // arrange + var fromKey = '{FC18523B-5A7C-4193-B938-B6AA2EABB37A}'; + var toKey1 = '{609202F4-15F7-4512-9178-CFAF073800E1}'; + var toKey2 = '{85096AE2-92FB-43D7-8FC3-EC14DDC1DFDD}'; + + var source = { prop: 'Value' }; + + // act + var createMapFromKeyCurry = automapper.createMap(fromKey); + + createMapFromKeyCurry(toKey1) + .forSourceMember('prop', (opts: ISourceMemberConfigurationOptions) => { opts.ignore(); }); + + createMapFromKeyCurry(toKey2); + + var result1MapCurry = automapper.map(fromKey, toKey1); + var result2MapCurry = automapper.map(fromKey, toKey2); + + var result1 = result1MapCurry(source); + var result2 = result2MapCurry(source); + + // assert + expect(typeof createMapFromKeyCurry === 'function').toBeTruthy(); + expect(typeof result1MapCurry === 'function').toBeTruthy(); + expect(typeof result2MapCurry === 'function').toBeTruthy(); + + expect(result1.prop).toBeUndefined(); + expect(result2.prop).toEqual(source.prop); + }); + + it('should be able to use currying when calling mapAsync', (done: () => void) => { + // arrange + var fromKey = '{1CA8523C-5A7C-4193-B938-B6AA2EABB37A}'; + var toKey1 = '{409212FD-15E7-4512-9178-CFAF073800EG}'; + var toKey2 = '{85096AE2-92FA-43N7-8FA3-EC14DDC1DFDE}'; + + var source = { prop: 'Value' }; + + // act + var createMapFromKeyCurry = automapper.createMap(fromKey); + + createMapFromKeyCurry(toKey1) + .forSourceMember('prop', (opts: ISourceMemberConfigurationOptions, cb: IMemberCallback) => { cb('Constant Value 1'); }); + + createMapFromKeyCurry(toKey2) + .forMember('prop', (opts: IMemberConfigurationOptions, cb: IMemberCallback) => { cb('Constant Value 2'); }); + + var result1MapCurry = automapper.mapAsync(fromKey, toKey1); + var result2MapCurry = automapper.mapAsync(fromKey, toKey2); + + // assert + expect(typeof createMapFromKeyCurry === 'function').toBeTruthy(); + expect(typeof result1MapCurry === 'function').toBeTruthy(); + expect(typeof result2MapCurry === 'function').toBeTruthy(); + + var resCount = 0; + var result1 = result1MapCurry(source, (result: any) => { + // assert + expect(result.prop).toEqual('Constant Value 1'); + if (++resCount === 2) { + done(); + } + }); + + var result2 = result2MapCurry(source, (result: any) => { + // assert + expect(result.prop).toEqual('Constant Value 2'); + if (++resCount === 2) { + done(); + } + }); + }); + + it('should be able to use currying when calling mapAsync with one parameter', (done: () => void) => { + // arrange + var fromKey = '{1CA8523C-5AVC-4193-BS38-B6AA2EABB37A}'; + var toKey = '{409212FD-1527-4512-9178-CFAG073800EG}'; + + var source = { prop: 'Value' }; + + // act + automapper.createMap(fromKey, toKey) + .forSourceMember('prop', (opts: ISourceMemberConfigurationOptions, cb: IMemberCallback) => { cb('Constant Value'); }); + + var mapAsyncCurry = automapper.mapAsync(fromKey); + + // assert + expect(typeof mapAsyncCurry === 'function').toBeTruthy(); + + var result = mapAsyncCurry(toKey, source, (result: any) => { + // assert + expect(result.prop).toEqual('Constant Value'); + done(); + }); + }); + + it('should be able to use currying when calling mapAsync with two parameters', (done: () => void) => { + // arrange + var fromKey = '{1CA852SC-5AVC-4193-BS38-B6AA2KABB3LA}'; + var toKey = '{409212FD-1Q27-45G2-9178-CFAG073800EG}'; + + var source = { prop: 'Value' }; + + // act + automapper.createMap(fromKey, toKey) + .forMember('prop', (opts: IMemberConfigurationOptions, cb: IMemberCallback) => { cb('Constant Value'); }); + + var mapAsyncCurry = automapper.mapAsync(fromKey, toKey); + + // assert + expect(typeof mapAsyncCurry === 'function').toBeTruthy(); + + var result = mapAsyncCurry(source, (result: any) => { + // assert + expect(result.prop).toEqual('Constant Value'); + done(); + }); + }); + + it('should be able to use currying when calling mapAsync with three parameters', (done: () => void) => { + // NOTE BL 20151214 I wonder why anyone would like calling this one? Maybe this one will be removed in + // the future. Please get in touch if you need this one to stay in place... + + // arrange + var fromKey = '{1CA852SC-5AVC-ZZ93-BS38-B6AA2KABB3LA}'; + var toKey = '{409212FD-1Q27-45G2-91BB-CFAG0738WCEG}'; + + var source = { prop: 'Value' }; + + // act + automapper.createMap(fromKey, toKey) + .forMember('prop', (opts: IMemberConfigurationOptions, cb: IMemberCallback) => { cb('Constant Value'); }); + + var mapAsyncCurry = automapper.mapAsync(fromKey, toKey, source); + + // assert + expect(typeof mapAsyncCurry === 'function').toBeTruthy(); + + var result = mapAsyncCurry((result: any) => { + // assert + expect(result.prop).toEqual('Constant Value'); + done(); + }); + }); + + it('should fail when calling mapAsync without parameters', () => { + // arrange + + // act + try { + var mapAsyncCurry = (automapper).mapAsync(); + } catch (e) { + // assert + expect(e.message).toEqual('The mapAsync function expects between 1 and 4 parameters, you provided 0.'); + return; + } + + // assert + expect(null).fail('Expected error was not raised.'); + }); + + it('should fail when calling mapAsync with > 4 parameters', () => { + // arrange + + // act + try { + var mapAsyncCurry = (automapper).mapAsync(undefined, undefined, undefined, undefined, undefined); + } catch (e) { + // assert + expect(e.message).toEqual('The mapAsync function expects between 1 and 4 parameters, you provided 5.'); + return; + } + + // assert + expect(null).fail('Expected error was not raised.'); + }); + + + it('should fail when specifying < 2 parameters to the asynchronous map function', () => { + // arrange + + // act + try { + (new AsyncAutoMapper()).map(undefined); + } catch (e) { + // assert + expect(e.message).toEqual('The AsyncAutoMapper.map function expects between 2 and 5 parameters, you provided 1.'); + return; + } + + // assert + expect(null).fail('Expected error was not raised.'); + }); + + it('should fail when specifying > 5 parameters to the asynchronous map function', () => { + // arrange + + // act + try { + (new AsyncAutoMapper()).map(undefined, undefined, undefined, undefined, undefined, undefined); + } catch (e) { + // assert + expect(e.message).toEqual('The AsyncAutoMapper.map function expects between 2 and 5 parameters, you provided 6.'); + return; + } + + // assert + expect(null).fail('Expected error was not raised.'); + }); + }); + + describe('AutoMapper.initialize', () => { + beforeEach(() => { + jasmine.addMatchers(ExtendJasmine.addCustomMatchers()); + }); + + it('should use created mapping profile', () => { + // arrange + var fromKey = '{5700E351-8D88-A327-A216-3CC94A308EDE}'; + var toKey = '{BB33A261-3CA9-A8FC-85E6-2C269F73728C}'; + + automapper.initialize((config: IConfiguration) => { + config.createMap(fromKey, toKey); + }); + + // act + automapper.map(fromKey, toKey, {}); + + // assert + }); + + it('should be able to use a naming convention to convert Pascal case to camel case', () => { + automapper.initialize((config: IConfiguration) => { + config.addProfile(new PascalCaseToCamelCaseMappingProfile()); + }); + + const sourceKey = 'PascalCase'; + const destinationKey = 'CamelCase'; + + const sourceObject = { FullName: 'John Doe' }; + + automapper + .createMap(sourceKey, destinationKey) + .withProfile('PascalCaseToCamelCase'); + + var result = automapper.map(sourceKey, destinationKey, sourceObject); + + expect(result).toEqualData({ fullName: 'John Doe' }); + }); + + it('should be able to use a naming convention to convert camelCase to PascalCase', () => { + automapper.initialize((config: IConfiguration) => { + config.addProfile(new CamelCaseToPascalCaseMappingProfile()); + }); + + const sourceKey = 'CamelCase2'; + const destinationKey = 'PascalCase2'; + + const sourceObject = { fullName: 'John Doe' }; + + automapper + .createMap(sourceKey, destinationKey) + .withProfile('CamelCaseToPascalCase'); + + var result = automapper.map(sourceKey, destinationKey, sourceObject); + + expect(result).toEqualData({ FullName: 'John Doe' }); + }); + + it('should be able to use forMember besides using a profile', () => { + automapper.initialize((config: IConfiguration) => { + config.addProfile(new CamelCaseToPascalCaseMappingProfile()); + }); + + const sourceKey = 'CamelCase'; + const destinationKey = 'PascalCase'; + + const sourceObject = { fullName: 'John Doe', age: 20 }; + + automapper + .createMap(sourceKey, destinationKey) + .forMember('theAge', (opts: IMemberConfigurationOptions) => opts.mapFrom('age')) + .withProfile('CamelCaseToPascalCase'); + + var result = automapper.map(sourceKey, destinationKey, sourceObject); + + expect(result).toEqualData({ FullName: 'John Doe', theAge: sourceObject.age }); + }); + + it('should use profile when only profile properties are specified', () => { + automapper.initialize((config: IConfiguration) => { + config.addProfile(new ValidatedAgeMappingProfile2()); + }); + + const sourceKey = '{918D9D7F-AA89-4D07-917E-A528F07EEF42}'; + const destinationKey = '{908D9D6F-BA89-4D17-915E-A528E988EE64}'; + + const sourceObject = { fullName: 'John Doe', proclaimedAge: 21, ageOnId: 15 }; + + automapper + .createMap(sourceKey, destinationKey) + .withProfile('ValidatedAgeMappingProfile2'); + + var result = automapper.map(sourceKey, destinationKey, sourceObject); + + expect(result).toEqualData({ fullName: 'John Doe', age: sourceObject.ageOnId }); + expect(result instanceof Person).toBeTruthy(); + expect(result instanceof BeerBuyingYoungster).not.toBeTruthy(); + }); + + it('should fail when using a non-existimg profile', () => { + // arrange + var caught = false; + var profileName = 'Non-existing profile'; + const sourceKey = 'should fail when using '; + const destinationKey = 'a non-existimg profile'; + const sourceObject = { }; + + // act + try { + automapper + .createMap(sourceKey, destinationKey) + .withProfile(profileName); + var result = automapper.map(sourceKey, destinationKey, sourceObject); + } catch (e) { + caught = true; + + // assert + expect(e.message).toEqual('Could not find profile with profile name \'' + profileName + '\'.'); + } + + if (!caught) { + // assert + expect().fail('Using a non-existing mapping profile should result in an error.'); + } + }); + + it('should merge forMember calls when specifying the same destination property normally and using profile', () => { + automapper.initialize((config: IConfiguration) => { + config.addProfile(new ValidatedAgeMappingProfile()); + }); + + const sourceKey = '{808D9D7F-AA89-4D07-917E-A528F078E642}'; + const destinationKey = '{808D9D6F-BA89-4D17-915E-A528E178EE64}'; + + const sourceObject = { fullName: 'John Doe', proclaimedAge: 21, ageOnId: 15 }; + + automapper + .createMap(sourceKey, destinationKey) + .forMember('ageOnId', (opts: IMemberConfigurationOptions) => opts.ignore()) + .forMember('age', (opts: IMemberConfigurationOptions) => opts.mapFrom('proclaimedAge')) + .convertToType(BeerBuyingYoungster) + .withProfile('ValidatedAgeMappingProfile'); + + var result = automapper.map(sourceKey, destinationKey, sourceObject); + + expect(result).toEqualData({ fullName: 'John Doe', age: sourceObject.ageOnId }); + expect(result instanceof Person).toBeTruthy(); + expect(result instanceof BeerBuyingYoungster).not.toBeTruthy(); + }); + + it('should be able to use currying when calling initialize(cfg => cfg.createMap)', () => { + // arrange + var fromKey = '{808D9D7F-AA89-4D07-917E-A528F078EE64}'; + var toKey1 = '{B364C0A0-9E24-4424-A569-A4C14102147C}'; + var toKey2 = '{1055CA5A-4FC4-44CA-B4D8-B004F43D4440}'; + + var source = { prop: 'Value' }; + + // act + var mapFromKeyCurry: (destinationKey: string) => ICreateMapFluentFunctions; + + automapper.initialize((config: IConfiguration) => { + mapFromKeyCurry = config.createMap(fromKey); + + mapFromKeyCurry(toKey1) + .forSourceMember('prop', (opts: ISourceMemberConfigurationOptions) => { opts.ignore(); }); + + mapFromKeyCurry(toKey2); + }); + + var result1 = automapper.map(fromKey, toKey1, source); + var result2 = automapper.map(fromKey, toKey2, source); + + // assert + expect(typeof mapFromKeyCurry === 'function').toBeTruthy(); + expect(result1.prop).toBeUndefined(); + expect(result2.prop).toEqual(source.prop); + }); + + }); + + describe('AutoMapper', () => { + beforeEach(() => { + jasmine.addMatchers(ExtendJasmine.addCustomMatchers()); + }); + + it('should auto map matching properties', () => { + // arrange + var objA = { prop1: 'From A', prop2: 'From A too' }; + + var fromKey = '{7F5AF9AC-2E9E-4676-8BE1-3E72866B11E8}'; + var toKey = '{8089EBDC-3BBB-4988-95F2-683CC1AD23A3}'; + + automapper.createMap(fromKey, toKey); + + // act + var objB = automapper.map(fromKey, toKey, objA); + + // assert + expect(objB).toEqualData(objA); + }); + + it('should map an array', () => { + // arrange + var arrA = [{ prop1: 'From A', prop2: 'From A too' }]; + + var fromKey = '{60D9DB56-D6E1-48FF-9BAC-0805FCAF91B7}'; + var toKey = '{AC6D5B97-9AE3-4267-BD60-A5FED17E541A}'; + + automapper.createMap(fromKey, toKey); + + // act + var arrB = automapper.map(fromKey, toKey, arrA); + + // assert + expect(arrB).toEqualData(arrA); + }); + + it('should map an array and handle empty items', () => { + // arrange + var arrA = [{ prop1: 'From A', prop2: 'From A too' }, undefined]; + + var fromKey = '{60D9DB56-D6E1-48FF-9BAC-0805FCAF91B7}'; + var toKey = '{AC6D5B97-9AE3-4267-BD60-A5FED17E541A}'; + + automapper.createMap(fromKey, toKey); + + // act + var arrB = automapper.map(fromKey, toKey, arrA); + + // assert + expect(arrB).toEqualData(arrA); + }); + }); + + /** AutoMapper helper functions */ + class AutoMapperHelper { + public static getClassName(classType: new() => any): string { + if (classType && (classType).name) { + return (classType).name; + } + // source: http://stackoverflow.com/a/13914278/702357 + if (classType && classType.constructor) { + let className = classType.toString(); + if (className) { + // classType.toString() is "function classType (...) { ... }" + let matchParts = className.match(/function\s*(\w+)/); + if (matchParts && matchParts.length === 2) { + return matchParts[1]; + } + } + + // for browsers which have name property in the constructor + // of the object, such as chrome + if ((classType.constructor).name) { + return (classType.constructor).name; + } + + if (classType.constructor.toString()) { + var str = classType.constructor.toString(); + + if (str.charAt(0) === '[') { + // executed if the return of object.constructor.toString() is "[object objectClass]" + var arr = str.match(/\[\w+\s*(\w+)\]/); + } else { + // executed if the return of object.constructor.toString() is "function objectClass () {}" + // (IE and Firefox) + var arr = str.match(/function\s*(\w+)/); + } + + if (arr && arr.length === 2) { + return arr[1]; + } + } + } + + throw new Error(`Unable to extract class name from type '${classType}'`); + } + } + + class AssertConfigPropertiesProp { + prop: string = undefined; // TODO Wiki: properties are only available when initialized: http://stackoverflow.com/a/20534039/702357 + } + + class AssertConfigPropertiesProp2 { + prop2: string = undefined; + } + + class AssertConfigPropertiesPropProp2 { + prop: string = undefined; + prop2: string = undefined; + } + + class ClassA { + public propA: string; + } + + class ClassB { + public propA: string; + } + + class ClassC { + public propA: string; + } + + class DemoToBusinessType { + } + + class CustomTypeConverterInstance extends TypeConverter { + public convert(resolutionContext: IResolutionContext): any { + return { propA: resolutionContext.sourceValue.propA + ' (convertUsing with a class instance)' }; + } + } + + class CustomTypeConverterDefinition extends TypeConverter { + public convert(resolutionContext: IResolutionContext): any { + return { propA: resolutionContext.sourceValue.propA + ' (convertUsing with a class definition)' }; + } + } + + class PascalCaseToCamelCaseMappingProfile extends Profile { + public sourceMemberNamingConvention: INamingConvention; + public destinationMemberNamingConvention: INamingConvention; + + public profileName = 'PascalCaseToCamelCase'; + + public configure() { + this.sourceMemberNamingConvention = new PascalCaseNamingConvention(); + this.destinationMemberNamingConvention = new CamelCaseNamingConvention(); + + super.createMap('a', 'b'); + } + } + + class CamelCaseToPascalCaseMappingProfile extends Profile { + public sourceMemberNamingConvention: INamingConvention; + public destinationMemberNamingConvention: INamingConvention; + + public profileName = 'CamelCaseToPascalCase'; + + public configure() { + this.sourceMemberNamingConvention = new CamelCaseNamingConvention(); + this.destinationMemberNamingConvention = new PascalCaseNamingConvention(); + } + } + + class ValidatedAgeMappingProfile extends Profile { + public profileName = 'ValidatedAgeMappingProfile'; + + public configure() { + const sourceKey = '{808D9D7F-AA89-4D07-917E-A528F078E642}'; + const destinationKey = '{808D9D6F-BA89-4D17-915E-A528E178EE64}'; + + this.createMap(sourceKey, destinationKey) + .forMember('proclaimedAge', (opts: IMemberConfigurationOptions) => opts.ignore()) + .forMember('age', (opts: IMemberConfigurationOptions) => opts.mapFrom('ageOnId')) + .convertToType(Person); + } + } + + class ValidatedAgeMappingProfile2 extends Profile { + public profileName = 'ValidatedAgeMappingProfile2'; + + public configure() { + const sourceKey = '{918D9D7F-AA89-4D07-917E-A528F07EEF42}'; + const destinationKey = '{908D9D6F-BA89-4D17-915E-A528E988EE64}'; + + this.createMap(sourceKey, destinationKey) + .forMember('proclaimedAge', (opts: IMemberConfigurationOptions) => opts.ignore()) + .forMember('age', (opts: IMemberConfigurationOptions) => opts.mapFrom('ageOnId')) + .convertToType(Person); + } + } + + class Person { + fullName: string; + age: number; + } + + class BeerBuyingYoungster extends Person { + } + class ExtendJasmine { + public static addCustomMatchers(): jasmine.CustomMatcherFactories { + var customMatchers: jasmine.CustomMatcherFactories = { + /** toEqualData compares to data objects using property matching */ + toEqualData: (util: jasmine.MatchersUtil, customEqualityTesters: Array): any => { + return { + compare: function (actual: any, expected: any): jasmine.CustomMatcherResult { + var pass = ExtendJasmine.equalsData(actual, expected); + return { + pass: pass, + message: pass + ? 'Data sets do equal. Congratulations ;) !' + : 'Data sets do not equal: expected "' + JSON.stringify(expected) + '", actual "' + JSON.stringify(actual) + '".' + }; + } + }; + }, + "fail": (util: jasmine.MatchersUtil, customEqualityTesters: Array): any => { + return { + compare: function (actual: any, message: string): jasmine.CustomMatcherResult { + return { + pass: false, + message: message || 'Jasmine test failed. Please provide a fix.' + }; + } + } + } + }; + return customMatchers; + } + + public static equalsData(actual: any, expected: any): boolean { + var toClass = {}.toString; + + // check array. + var actualType = toClass.call(actual); + var expectedType = toClass.call(expected); + + if (actualType === '[object Array]') { + // check both are arrays + if (expectedType !== '[object Array]') { + return false; + } + + // check both have same length + if (expected.length !== actual.length) { + return false; + } + + for (var i = 0; i < actual.length; i++) { + // check each item in the array + if (!ExtendJasmine.equalsData(actual[i], expected[i])) + return false; + } + } + else if (actualType === '[object Object]') { + // check both are objects + if (expectedType !== '[object Object]') { + return false; + } + + // check each property in the object + for (var propertyName in expected) { + if (!expected.hasOwnProperty(propertyName)) { + continue; + } + + if (!actual.hasOwnProperty(propertyName)) { + return false; + } + + if (!ExtendJasmine.equalsData(actual[propertyName], expected[propertyName])) + return false; + } + } else { + var actualIsUndefined = typeof actual === 'undefined'; + var expectedIsUndefined = typeof expected === 'undefined'; + if (actualIsUndefined !== expectedIsUndefined) { + return false; + } + + return actual === expected; + } + + return true; + } + } +} \ No newline at end of file diff --git a/automapper-ts/automapper-ts.d.ts b/automapper-ts/automapper-ts.d.ts new file mode 100644 index 0000000000..b2bf17a966 --- /dev/null +++ b/automapper-ts/automapper-ts.d.ts @@ -0,0 +1,559 @@ +// Type definitions for automapper-ts +// Project: https://github.com/loedeman/AutoMapper +// Definitions by: Bert Loedeman +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module AutoMapperJs { + /** + * AutoMapper implementation, for both creating maps and performing maps. Comparable usage and functionality to the original + * .NET AutoMapper library is the pursuit of this implementation. + */ + class AutoMapper { + /** + * Initializes the mapper with the supplied configuration. + * @param {(config: IConfiguration) => void} Configuration function to call. + */ + initialize(configFunction: (config: IConfiguration) => void): void; + + /** + * Create a createMap curry function which expects only a destination key. + * @param {string} sourceKey The map source key. + * @returns {(destinationKey: string) => ICreateMapFluentFunctions} + */ + createMap(sourceKey: string | (new() => any)): (destinationKey: string | (new() => any)) => ICreateMapFluentFunctions; + + /** + * Create a mapping profile. + * @param {string} sourceKey The map source key. + * @param {string} destinationKey The map destination key. + * @returns {Core.ICreateMapFluentFunctions} + */ + createMap(sourceKey: string | (new() => any), destinationKey: string | (new() => any)): ICreateMapFluentFunctions; + + /** + * Create a map curry function which expects a destination key and a source object. + * @param sourceKey Source key, for instance the source type name. + * @returns {(destinationKey: string, sourceObject: any) => any} + */ + map(sourceKey: string | (new() => any)): (destinationKey: string | (new() => any), sourceObject: any) => any; + + /** + * Create a map curry function which expects only a source object. + * @param sourceKey Source key, for instance the source type name. + * @param destinationKey Destination key, for instance the destination type name. + * @returns {(sourceObject: any) => any} + */ + map(sourceKey: string | (new() => any), destinationKey: string | (new() => any)): (sourceObject: any) => any; + + /** + * Execute a mapping from the source object to a new destination object with explicit mapping configuration and supplied mapping options (using createMap). + * @param sourceKey Source key, for instance the source type name. + * @param destinationKey Destination key, for instance the destination type name. + * @param sourceObject The source object to map. + * @returns {any} Destination object. + */ + map(sourceKey: string | (new() => any), destinationKey: string | (new() => any), sourceObject: any): any; + + /** + * Create a mapAsync curry function which expects a destination key, a source object and a callback function. + * @param sourceKey Source key, for instance the source type name. + * @returns {(destinationKey: string, sourceObject: any, callback: IMapCallback) => void} + */ + mapAsync(sourceKey: string | (new() => any)): (destinationKey: string | (new() => any), sourceObject: any, callback: IMapCallback) => void; + + /** + * Create a map curry function which expects only a source object and a callback function. + * @param sourceKey Source key, for instance the source type name. + * @param destinationKey Destination key, for instance the destination type name. + * @param sourceObject The source object to map. + * @returns {(callback: IMapCallback) => void} + */ + mapAsync(sourceKey: string | (new() => any), destinationKey: string | (new() => any), sourceObject: any): (callback: IMapCallback) => void; + + /** + * Create a map curry function which expects only a source object and a callback function. + * @param sourceKey Source key, for instance the source type name. + * @param destinationKey Destination key, for instance the destination type name. + * @returns {(sourceObject: any, callback: IMapCallback) => void} + */ + mapAsync(sourceKey: string | (new() => any), destinationKey: string | (new() => any)): (sourceObject: any, callback: IMapCallback) => void; + + /** + * Execute an asynchronous mapping from the source object to a new destination object with explicit mapping configuration and supplied mapping options (using createMap). + * @param sourceKey Source key, for instance the source type name. + * @param destinationKey Destination key, for instance the destination type name. + * @param sourceObject The source object to map. + * @param {IMapCallback} callback The callback to call when asynchronous mapping is complete. + */ + mapAsync(sourceKey: string | (new() => any), destinationKey: string | (new() => any), sourceObject: any, callback: IMapCallback): void; + + /** + * Validates mapping configuration by dry-running. Since JS does not + * fully support typing, it only checks if properties match on both + * sides. The function needs IMapping.sourceTypeClass and + * IMapping.destinationTypeClass to function. + * @param {boolean} strictMode Whether or not to fail when properties + * sourceTypeClass or destinationTypeClass + * are unavailable. + */ + assertConfigurationIsValid(strictMode?: boolean): void; + } + + class AsyncAutoMapper { + /* For Test Purposes Only */ + } + + /** + * Converts source type to destination type instead of normal member mapping + */ + class TypeConverter implements ITypeConverter { + /** + * Performs conversion from source to destination type. + * @param {IResolutionContext} resolutionContext Resolution context. + * @returns {any} Destination object. + */ + convert(resolutionContext: IResolutionContext): any; + } + + export class Profile implements IProfile { + /** Profile name */ + public profileName: string; + + /** Naming convention for source members */ + public sourceMemberNamingConvention: INamingConvention; + + /** Naming convention for destination members */ + public destinationMemberNamingConvention: INamingConvention; + + /** + * Create a createMap curry function which expects only a destination key. + * @param {string} sourceKey The map source key. + * @returns {(destinationKey: string) => ICreateMapFluentFunctions} + */ + protected createMap(sourceKey: string): (destinationKey: string) => ICreateMapFluentFunctions; + + /** + * Create a mapping profile. + * @param {string} sourceKey The map source key. + * @param {string} destinationKey The map destination key. + * @returns {Core.ICreateMapFluentFunctions} + */ + protected createMap(sourceKey: string, destinationKey: string): ICreateMapFluentFunctions; + + /** + * Implement this method in a derived class and call the CreateMap method to associate that map with this profile. + * Avoid calling the AutoMapper class / automapper instance from this method. + */ + public configure(): void; + } + + /** + * Defines the PascalCase naming convention strategy. + */ + class PascalCaseNamingConvention implements INamingConvention { + /** Regular expression on how to tokenize a member. */ + splittingExpression: RegExp; + + /** Character to separate on. */ + separatorCharacter: string; + + /** + * Transformation function called when this convention is the destination naming convention. + * @param {string[]} sourcePropertyNameParts Array containing tokenized source property name parts. + * @returns {string} Destination property name + */ + transformPropertyName(sourcePropertyNameParts: string[]): string; + } + + /** + * Defines the camelCase naming convention strategy. + */ + class CamelCaseNamingConvention implements INamingConvention { + /** Regular expression on how to tokenize a member. */ + splittingExpression: RegExp; + + /** Character to separate on. */ + separatorCharacter: string; + + /** + * Transformation function called when this convention is the destination naming convention. + * @param {string[]} sourcePropertyNameParts Array containing tokenized source property name parts. + * @returns {string} Destination property name + */ + transformPropertyName(sourcePropertyNameParts: string[]): string; + } + + + + interface IProperty { + name: string; + metadata: IPropertyMetadata; + level: number; + sourceMapping: boolean; + ignore: boolean; + async: boolean; + children?: IProperty[]; + destinations?: IProperty[]; + conversionValuesAndFunctions: any[]; + conditionFunction?: (sourceObject: any) => boolean; + } + + interface IPropertyMetadata { + mapping: IMapping; + root: IProperty; + parent: IProperty; + destinations: {[name: string]: IPropertyDestinationMetadata}; + destinationCount: number; + } + + interface IPropertyDestinationMetadata { + source: IProperty; + destination: IProperty; + } + + interface IMemberMappingMetaData { + destination: string; + source: string; + sourceMapping: boolean; + ignore: boolean; + async: boolean; + condition: (sourceObject: any) => boolean; + } + + /** + * Member mapping properties. + */ + interface IForMemberMapping { + /** The source member property name. */ + sourceProperty: string; + /** The destination member property name parts for nested property support (e.g. 'type.name'). */ + destinationProperty: string; + /** Source or destination mapping. */ + sourceMapping: boolean; + /** All mapping values and/or functions resulting from stacked for(Source)Member calls. */ + mappingValuesAndFunctions: Array; + /** Whether or not this destination property must be ignored. */ + ignore: boolean; + /** Whether or not this member mapping has an asynchronous mapping function. */ + async: boolean; + /** + * The object will only be mapped when the condition is met. + * @param {any} sourceObject The source object to check. + * @returns {boolean} + */ + conditionFunction: (sourceObject: any) => boolean; + } + + /** + * Interface for returning an object with available 'sub' functions to enable method chaining (e.g. automapper.createMap().forMember().forMember() ...) + */ + interface ICreateMapFluentFunctions { + /** + * Customize configuration for an individual destination member. + * @param sourceProperty The destination member property name. + * @param valueOrFunction The value or function to use for this individual member. + * @returns {IAutoMapperCreateMapChainingFunctions} + */ + forMember: (sourceProperty: string, valueOrFunction: any | + ((opts: IMemberConfigurationOptions) => any) | + ((opts: IMemberConfigurationOptions, cb: IMemberCallback) => void)) => ICreateMapFluentFunctions; + + /** + * Customize configuration for an individual source member. + * @param sourceProperty The source member property name. + * @param sourceMemberConfigFunction The function to use for this individual member. + * @returns {IAutoMapperCreateMapChainingFunctions} + */ + forSourceMember: (sourceProperty: string, + sourceMemberConfigFunction: ((opts: ISourceMemberConfigurationOptions) => any) | + ((opts: ISourceMemberConfigurationOptions, cb: IMemberCallback) => void) + ) => ICreateMapFluentFunctions; + + /** + * Customize configuration for all destination members. + * @param func The function to use for this individual member. + * @returns {IAutoMapperCreateMapChainingFunctions} + */ + forAllMembers: (func: (destinationObject: any, destinationPropertyName: string, value: any) => void) => ICreateMapFluentFunctions; + + /** + * Ignore all members not specified explicitly. + */ + ignoreAllNonExisting: () => ICreateMapFluentFunctions; + + /** + * Skip normal member mapping and convert using a custom type converter (instantiated during mapping). + * @param typeConverterClassOrFunction The converter class or function to use when converting. + */ + convertUsing: (typeConverterClassOrFunction: ((resolutionContext: IResolutionContext) => any) | + ((resolutionContext: IResolutionContext, callback: IMapCallback) => void) | + ITypeConverter | + (new() => ITypeConverter) + ) => void; + + /** + * Specify to which class type AutoMapper should convert. When specified, AutoMapper will create an instance of the given type, instead of returning a new object literal. + * @param typeClass The destination type class. + * @returns {IAutoMapperCreateMapChainingFunctions} + */ + convertToType: (typeClass: new () => any) => ICreateMapFluentFunctions; + + /** + * Specify which profile should be used when mapping. + * @param {string} profileName The profile name. + * @returns {IAutoMapperCreateMapChainingFunctions} + */ + withProfile: (profileName: string) => void; + } + + /** + * The mapping configuration for the current mapping keys/types. + */ + interface IMapping { + /** The mapping source key. */ + sourceKey: string; + + /** The mapping destination key. */ + destinationKey: string; + + /** The mappings for forAllMembers functions. */ + forAllMemberMappings: Array<(destinationObject: any, destinationPropertyName: string, value: any) => void>; + + properties: IProperty[]; + + /** + * Skip normal member mapping and convert using a type converter. + * @param resolutionContext Context information regarding resolution of a destination value + * @returns {any} Destination object. + */ + typeConverterFunction: ((resolutionContext: IResolutionContext) => any) | + ((resolutionContext: IResolutionContext, callback: IMapCallback) => void); + + /** The source type class to convert from. */ + sourceTypeClass: any; + + /** The destination type class to convert to. */ + destinationTypeClass: any; + + /** The profile used when mapping. */ + profile?: IProfile; + + /** Whether or not to ignore all properties not specified using createMap. */ + ignoreAllNonExisting?: boolean; + + /** Whether or not an mapping has to be asynchronous. */ + async: boolean; + + /* + * PERFORMANCE ENHANCEMENTS + */ + + /** + * Item mapping function to use. + */ + mapItemFunction: IMapItemFunction | IAsyncMapItemFunction; + } + + // export interface IMappingMapOptimized extends IMapping { + // final: boolean; + // forMemberMappingsArray: Array; + // } + + /** + * Context information regarding resolution of a destination value + */ + export interface IResolutionContext { + /** Source value */ + sourceValue: any; + + /** Destination value */ + destinationValue: any; + + /** Source property name */ + sourcePropertyName?: string; + + /** Destination property name */ + destinationPropertyName?: string; + + /** Index of current collection mapping */ + arrayIndex?: number; + } + + /** + * Configuration options for forMember mapping function. + */ + interface IMemberConfigurationOptions { + /** + * Map from a custom source property name. + * @param sourcePropertyName The source property to map. + */ + mapFrom: (sourcePropertyName: string) => void; + + /** + * When this configuration function is used, the (destination) property is ignored + * when mapping. + */ + ignore?: () => void; + + /** + * If specified, the property will only be mapped when the condition is fulfilled. + */ + condition: (predicate: ((sourceObject: any) => boolean)) => void; + + /** The source object to map. */ + sourceObject: any; + + /** The source property to map. */ + sourcePropertyName: string; + + /** + * The intermediate destination property value, used for stacking multiple for(Source)Member calls + * while elaborating the intermediate result. + */ + intermediatePropertyValue: any; + } + + /** + * Configuration options for forSourceMember mapping function. + */ + interface ISourceMemberConfigurationOptions { + /** + * When this configuration function is used, the source property is ignored + * when mapping. + */ + ignore: () => void; + } + + /** + * Member callback interface + */ + interface IMemberCallback { + /** + * Callback function to call when the async operation is executed. + * @param {any} callbackValue Callback value to be used as output for the for(Source)Member call. + */ + (callbackValue: any): void; + } + + /** + * Member callback interface + */ + interface IMapCallback { + /** + * Callback function to call when the async operation is executed. + * @param {any} result Callback value to be used as output for the mapAsync call. + */ + (result: any): void; + } + + /** + * Converts source type to destination type instead of normal member mapping + */ + export interface ITypeConverter { + /** + * Performs conversion from source to destination type. + * @param {IResolutionContext} resolutionContext Resolution context. + * @returns {any} Destination object. + */ + convert: (resolutionContext: IResolutionContext) => any; + } + + /** + * Defines a naming convention strategy. + */ + export interface INamingConvention { + /** Regular expression on how to tokenize a member. */ + splittingExpression: RegExp; + + /** Character to separate on. */ + separatorCharacter: string; + + /** + * Transformation function called when this convention is the destination naming convention. + * @param {string[]} sourcePropertyNameParts Array containing tokenized source property name parts. + * @returns {string} Destination property name + */ + transformPropertyName: (sourcePropertyNameParts: string[]) => string; + } + + /** + * Configuration for profile-specific maps. + */ + export interface IConfiguration { + /** + * Add an existing profile + * @param profile {IProfile} Profile to add. + */ + addProfile(profile: IProfile): void; + + /** + * Create a createMap curry function which expects only a destination key. + * @param {string} sourceKey The map source key. + * @returns {(destinationKey: string) => IAutoMapperCreateMapChainingFunctions} + */ + createMap?(sourceKey: string): (destinationKey: string) => ICreateMapFluentFunctions; + + /** + * Create a mapping profile. + * @param {string} sourceKey The map source key. + * @param {string} destinationKey The map destination key. + * @returns {Core.IAutoMapperCreateMapChainingFunctions} + */ + createMap?(sourceKey: string, destinationKey: string): ICreateMapFluentFunctions; + } + + /** + * Provides a named configuration for maps. Naming conventions become scoped per profile. + */ + export interface IProfile { + /** Profile name */ + profileName: string; + + /** Naming convention for source members */ + sourceMemberNamingConvention: INamingConvention; + + /** Naming convention for destination members */ + destinationMemberNamingConvention: INamingConvention; + + /** + * Implement this method in a derived class and call the CreateMap method to associate that map with this profile. + * Avoid calling the AutoMapper class / automapper instance from this method. + */ + configure: () => void; + } + + export interface IMapItemFunction { + (mapping: IMapping, sourceObject: any, destinationObject: any): any; + } + + export interface IAsyncMapItemFunction { + (mapping: IMapping, sourceObject: any, destinationObject: any, callback: IMapCallback): void; + } + + interface ICreateMapParameters { + mapping: IMapping; + destinationProperty: string; + conversionValueOrFunction: any; + sourceMapping: boolean; + fluentFunctions: ICreateMapFluentFunctions; + } + + interface IGetOrCreatePropertyParameters { + propertyNameParts: string[]; + mapping: IMapping; + parent?: IProperty; + propertyArray: IProperty[]; + destination?: string; + sourceMapping: boolean; + } + + interface ICreatePropertyParameters { + name: string; + mapping: IMapping; + parent: IProperty; + propertyArray: IProperty[]; + sourceMapping: boolean; + } +} + +declare var automapper: AutoMapperJs.AutoMapper; \ No newline at end of file From 6f000f4a2409b3f7737eb48896002f1970c75519 Mon Sep 17 00:00:00 2001 From: "Dmitry A. Efimenko" Date: Tue, 25 Oct 2016 07:17:34 -0700 Subject: [PATCH 059/246] add prompt() override returning promise (#12172) according to [docs](https://www.npmjs.com/package/inquirer#inquirerpromptquestions---promise) --- inquirer/inquirer.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/inquirer/inquirer.d.ts b/inquirer/inquirer.d.ts index 032740b31c..2abd6e6d53 100644 --- a/inquirer/inquirer.d.ts +++ b/inquirer/inquirer.d.ts @@ -33,6 +33,7 @@ declare module "inquirer" { * @return */ prompt(questions: Questions, cb?: (answers: Answers) => any): ui.Prompt; + prompt(questions: Questions): Promise; prompts: Prompts; Separator: objects.SeparatorStatic; ui: { From 9f18cfbe989d0a8299e0decd99f47e76db2901b8 Mon Sep 17 00:00:00 2001 From: Mohsen Azimi Date: Tue, 25 Oct 2016 07:22:20 -0700 Subject: [PATCH 060/246] Add stats to config (#12023) * Add stats to config Reference https://github.com/webpack/extract-text-webpack-plugin/issues/35#issuecomment-176689891 * Update webpack.d.ts --- webpack-dev-server/webpack-dev-server.d.ts | 2 +- webpack/webpack.d.ts | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/webpack-dev-server/webpack-dev-server.d.ts b/webpack-dev-server/webpack-dev-server.d.ts index 9abc2004eb..c58a44ff7f 100644 --- a/webpack-dev-server/webpack-dev-server.d.ts +++ b/webpack-dev-server/webpack-dev-server.d.ts @@ -29,7 +29,7 @@ declare module "webpack-dev-server" { watchOptions?: webpack.WatchOptions; publicPath: string; headers?: any; - stats?: webpack.compiler.StatsToJsonOptions | webpack.compiler.StatsToStringOptions; + stats?: webpack.compiler.StatsOptions| webpack.compiler.StatsToStringOptions; setup?(app: core.Express): void; } diff --git a/webpack/webpack.d.ts b/webpack/webpack.d.ts index 42dbc81e05..b53d44bfb8 100644 --- a/webpack/webpack.d.ts +++ b/webpack/webpack.d.ts @@ -63,6 +63,8 @@ declare module "webpack" { recordsOutputPath?: string; /** Add additional plugins to the compiler. */ plugins?: (Plugin|Function)[]; + /** Stats options for logging */ + stats?: compiler.StatsOptions; } interface Entry { @@ -482,12 +484,12 @@ declare module "webpack" { /** Returns true if there were warnings while compiling. */ hasWarnings(): boolean; /** Return information as json object */ - toJson(options?: StatsToJsonOptions): any; //TODO: type this + toJson(options?: StatsOptions): any; //TODO: type this /** Returns a formatted string of the result. */ toString(options?: StatsToStringOptions): string; } - interface StatsToJsonOptions { + interface StatsOptions { /** context directory for request shortening */ context?: boolean; /** add the hash of the compilation */ @@ -524,7 +526,7 @@ declare module "webpack" { assetsSort?: string; } - interface StatsToStringOptions extends StatsToJsonOptions { + interface StatsToStringOptions extends StatsOptions { /** With console colors */ colors?: boolean; } From dab1b23f46df7c93051894071f84c3fd269e28d2 Mon Sep 17 00:00:00 2001 From: Pavel Birukov Date: Tue, 25 Oct 2016 15:23:39 +0100 Subject: [PATCH 061/246] Add .observe() to Observable (which is added in 3.3.0) (#11973) --- kefir/kefir-tests.ts | 13 +++++++++++++ kefir/kefir.d.ts | 20 +++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/kefir/kefir-tests.ts b/kefir/kefir-tests.ts index 94300550b4..e706f51159 100644 --- a/kefir/kefir-tests.ts +++ b/kefir/kefir-tests.ts @@ -70,6 +70,19 @@ import { Observable, ObservablePool, Stream, Property, Event, Emitter } from 'ke Kefir.sequentially(1000, [1, 2]).log('my stream'); Kefir.sequentially(1000, [1, 2]).offLog('my stream'); Kefir.sequentially(1000, [1, 2]).toPromise().then((x: number) => console.log('fulfilled with:', x)); + Kefir.sequentially(1000, [1, 2]).observe({}); + Kefir.sequentially(1000, [1, 2]).observe({ + value: _ => {}, + error: _ => {}, + end: () => {}, + }); + Kefir.sequentially(1000, [1, 2]).observe(); + const subscription = Kefir.sequentially(1000, [1, 2]).observe( + _ => {}, + _ => {}, + () => {} + ); + if (!subscription.closed) subscription.unsubscribe(); } // Modify an observable diff --git a/kefir/kefir.d.ts b/kefir/kefir.d.ts index e726dba915..d2d32c92d8 100644 --- a/kefir/kefir.d.ts +++ b/kefir/kefir.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Kefir 3.2.0 +// Type definitions for Kefir 3.3.0 // Project: http://rpominov.github.io/kefir/ // Definitions by: Aya Morisawa // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -7,6 +7,17 @@ declare module "kefir" { + export interface Subscription { + unsubscribe(): void; + closed: boolean; // Actually, `readonly` but it's avaiable in tsc starting with 2.0.0 + } + + export interface Observer { + value?: (value: T) => void; + error?: (error: S) => void; + end?: () => void; + } + export interface Observable { // Subscribe / add side effects onValue(callback: (value: T) => void): void; @@ -22,6 +33,13 @@ declare module "kefir" { flatten(transformer?: (value: T) => U[]): Stream; toPromise(PromiseConstructor?: any): any; toESObservable(): any; + // This method is designed to replace all other methods for subscribing + observe(params: Observer): Subscription; + observe( + onValue?: (value: T) => void, + onError?: (error: S) => void, + onEnd?: () => void + ): Subscription; } export interface Stream extends Observable { From 55f61799509836ce672e7763ecc249942b029275 Mon Sep 17 00:00:00 2001 From: Sumit Date: Tue, 25 Oct 2016 15:48:44 +0100 Subject: [PATCH 062/246] Updating Quill definitions to 1.1.0. Added more interfaces from the Quill framework. Also changed top level namespace to Quill as requested by some users. (#12147) --- quill/quill-tests.ts | 17 +++--- quill/quill.d.ts | 123 ++++++++++++++++++++++++++++--------------- 2 files changed, 92 insertions(+), 48 deletions(-) diff --git a/quill/quill-tests.ts b/quill/quill-tests.ts index 172b5fd461..b642611a54 100644 --- a/quill/quill-tests.ts +++ b/quill/quill-tests.ts @@ -1,4 +1,4 @@ -/// +/// function test_quill() { var quillEditor = new Quill('#editor', { @@ -25,9 +25,14 @@ function test_enable() { quillEditor.enable(); } +function test_enable_false() { + let quillEditor = new Quill('#Editor'); + quillEditor.enable(false); +} + function test_getContents() { var quillEditor = new Quill('#editor'); - var delta: QuillJS.DeltaStatic = quillEditor.getContents(); + var delta: Quill.DeltaStatic = quillEditor.getContents(); } function test_getLength() { @@ -95,24 +100,24 @@ function test_insertEmbed() { function test_updateContents() { var quillEditor = new Quill('#editor'); - quillEditor.updateContents({ + quillEditor.updateContents(new Delta({ ops: [ { retain: 6 }, // Keep 'Hello ' { delete: 5 }, // 'World' is deleted { insert: 'Quill' }, // Insert 'Quill' { retain: 1, attributes: { bold: true } } // Apply bold to exclamation mark ] - }); + })); } function test_setContents() { var quillEditor = new Quill('#editor'); - quillEditor.setContents([ + quillEditor.setContents(new Delta({ ops: [ { insert: 'Hello ' }, { insert: 'World!', attributes: { bold: true } }, { insert: '\n' } - ]); + ]})); } function test_setText() { diff --git a/quill/quill.d.ts b/quill/quill.d.ts index 8bd99d9496..7fa3788a5a 100644 --- a/quill/quill.d.ts +++ b/quill/quill.d.ts @@ -1,17 +1,33 @@ -// Type definitions for Quill v1.0.3 +// Type definitions for Quill v1.1.0 // Project: http://quilljs.com // Definitions by: Sumit // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare namespace QuillJS { +declare namespace Quill { + + type Key = { key: string, shortKey?: boolean }; + type Sources = "api" | "user" | "silent"; + type Formats = { [key: string]: any }; + + export interface KeyboardStatic { + addBinding(key: Key, callback: (range: RangeStatic, context: any) => void): void; + addBinding(key: Key, context: any, callback: (range: RangeStatic, context: any) => void) : void; + } + + export interface ClipboardStatic { + addMatcher(selector: string, callback: (node: any, delta: DeltaStatic) => DeltaStatic) : void; + addMatcher(nodeType: number, callback: (node: any, delta: DeltaStatic) => DeltaStatic) : void; + dangerouslyPasteHTML(html: string, source?: Sources): void; + dangerouslyPasteHTML(index: number, html: string, source?: Sources): void; + } export interface QuillOptionsStatic { debug?: string, - modules?: { [key: string]: any }, + modules?: Formats, placeholder?: string, readOnly?: boolean, theme?: string, - formats?: string[] + formats?: string[] } export interface BoundsStatic { @@ -22,11 +38,26 @@ declare namespace QuillJS { } export interface DeltaStatic { + new (ops: Array) : DeltaStatic; + new (ops: any) : DeltaStatic; ops?: Array; - retain?: any, - delete?: any, - insert?: any, - attributes?: any + retain(length: number, attributes: any) : DeltaStatic; + delete(length: number) : DeltaStatic; + filter(predicate: any) : DeltaStatic; + forEach(predicate: any) : DeltaStatic; + insert(text: any, attributes: any): DeltaStatic; + map(predicate: any) : DeltaStatic; + partition(predicate: any) : DeltaStatic; + reduce(predicate: any, initial: number): DeltaStatic; + chop() : DeltaStatic; + length(): number; + slice(start: number, end: number): DeltaStatic; + compose(other: any): DeltaStatic; + concat(other: DeltaStatic): DeltaStatic; + diff(other: DeltaStatic, index: number) : DeltaStatic; + eachLine(predicate: any, newline: any) : DeltaStatic; + transform(other: any, priority: any) : DeltaStatic; + transformPosition(index: number, priority: any) : DeltaStatic; } export interface RangeStatic { @@ -35,62 +66,70 @@ declare namespace QuillJS { length: number; } - type sourceType = "api" | "user" | "silent"; - type formatsType = { [key: string]: any }; - - export interface QuillStatic { - new (container: string | Element, options?: QuillOptionsStatic): QuillStatic; - deleteText(start: number, end: number, source?: sourceType): void; + export interface Quill { + new (container: string | Element, options?: QuillOptionsStatic): Quill; + deleteText(index: number, length: number, source?: Sources): void; disable(): void; enable(enabled?: boolean): void; - getContents(start?: number, end?: number): DeltaStatic; + getContents(index?: number, length?: number): DeltaStatic; getLength(): number; - getText(start?: number, end?: number): string; - insertEmbed(index: number, type: string, url: string, source?: sourceType): void; - insertText(index: number, text: string, source?: sourceType): void; - insertText(index: number, text: string, format: string, value: string, source?: sourceType): void; - insertText(index: number, text: string, formats: formatsType, source?: sourceType): void; - pasteHTML(index: number, html: string, source?:sourceType): string; - pasteHTML(html:string, source?: sourceType): string; - setContents(delta: DeltaStatic, source?: sourceType): void; - setText(text: string, source?: sourceType): void; + getText(index?: number, length?: number): string; + insertEmbed(index: number, type: string, value: any, source?: Sources): void; + insertText(index: number, text: string, source?: Sources): DeltaStatic; + insertText(index: number, text: string, format: string, value: any, source?: Sources): DeltaStatic; + insertText(index: number, text: string, formats: Formats, source?: Sources): DeltaStatic; + /** + * @deprecated Use clipboard.dangerouslyPasteHTML(index: number, html: string, source: Sources) + */ + pasteHTML(index: number, html: string, source?: Sources): string; + /** + * @deprecated Use dangerouslyPasteHTML(html: string, source: Sources): void; + */ + pasteHTML(html: string, source?: Sources): string; + setContents(delta: DeltaStatic, source?: Sources): DeltaStatic; + setText(text: string, source?: Sources): DeltaStatic; update(source?: string): void; - updateContents(delta: DeltaStatic, source?: sourceType): void; + updateContents(delta: DeltaStatic, source?: Sources): DeltaStatic; - format(name: string, value: any, source?: sourceType): void; - formatLine(index: number, length: number, source?: sourceType): void; - formatLine(index: number, length: number, format: string, value: any, source?: sourceType): void; - formatLine(index: number, length: number, formats: formatsType, source?: sourceType): void; - formatText(index: number, length: number, source?: sourceType): void; - formatText(index: number, length: number, format: string, value: any, source?: sourceType): void; - formatText(index: number, length: number, formats: formatsType, source?: sourceType): void; - getFormat(range?: RangeStatic): formatsType; - getFormat(index: number, length?: number): formatsType; - removeFormat(index: Number, length: Number, source?: sourceType): void; + format(name: string, value: any, source?: Sources): DeltaStatic; + formatLine(index: number, length: number, source?: Sources): DeltaStatic; + formatLine(index: number, length: number, format: string, value: any, source?: Sources): DeltaStatic; + formatLine(index: number, length: number, formats: Formats, source?: Sources): DeltaStatic; + formatText(index: number, length: number, source?: Sources): DeltaStatic; + formatText(index: number, length: number, format: string, value: any, source?: Sources): DeltaStatic; + formatText(index: number, length: number, formats: Formats, source?: Sources): DeltaStatic; + getFormat(range?: RangeStatic): Formats; + getFormat(index: number, length?: number): Formats; + removeFormat(index: number, length: number, source?: Sources): void; blur(): void; focus(): void; getBounds(index: number, length?: number): BoundsStatic; getSelection(focus?: boolean): RangeStatic; hasFocus(): boolean; - setSelection(index: number, length: number, source?: sourceType): void; - setSelection(range: RangeStatic, source?: sourceType): void; + setSelection(index: number, length: number, source?: Sources): void; + setSelection(range: RangeStatic, source?: Sources): void; on(eventName: string, callback: ((delta: T, oldContents: T, source: string) => void) | - ((name: string, ...args: any[]) => void)): QuillStatic; - once(eventName: string, callback: (delta: DeltaStatic, source: string) => void): QuillStatic; - off(eventName: string, callback: (delta: DeltaStatic, source: string) => void): QuillStatic; + ((name: string, ...args: any[]) => void)): Quill; + once(eventName: string, callback: (delta: DeltaStatic, source: string) => void): Quill; + off(eventName: string, callback: (delta: DeltaStatic, source: string) => void): Quill; debug(level: string): void; import(path: string): any; register(path: string, def: any, suppressWarning?: boolean): void; - register(defs: formatsType, suppressWarning?: boolean): void; + register(defs: Formats, suppressWarning?: boolean): void; addContainer(className: string, refNode?: any): any; + addContainer(domNode: any, refNode?: any): any; getModule(name: string): any + + clipboard: ClipboardStatic; } } -declare var Quill: QuillJS.QuillStatic; +declare var Quill: Quill.Quill; + +declare var Delta: Quill.DeltaStatic; declare module "quill" { export = Quill; From d290d688b339e3609e77da9db008709e9051bb18 Mon Sep 17 00:00:00 2001 From: Duy Dao Date: Tue, 25 Oct 2016 16:54:01 +0200 Subject: [PATCH 063/246] Update redux-storage-decorator-filter to 1.1.6 (#12067) Added support for blacklist. --- redux-storage/redux-storage-tests.ts | 3 ++- redux-storage/redux-storage.d.ts | 25 +++++++++++++++---------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/redux-storage/redux-storage-tests.ts b/redux-storage/redux-storage-tests.ts index 484366c925..93cb732582 100644 --- a/redux-storage/redux-storage-tests.ts +++ b/redux-storage/redux-storage-tests.ts @@ -11,6 +11,7 @@ import createReactNativeAsyncStorageEngine from "redux-storage-engine-reactnativ interface TestState { a: number; b: string; + c: string; } function rootReducer(state: TestState, action: Action): TestState { @@ -19,7 +20,7 @@ function rootReducer(state: TestState, action: Action): TestState { const enhancedReducer = reducer(rootReducer, reduxStorageImmutableMerger); -const storageEngine = createEngine("test"); +const storageEngine = filter(createEngine("test"), ['a', 'b'], ['c']); const initialStateLoader = createLoader(storageEngine); diff --git a/redux-storage/redux-storage.d.ts b/redux-storage/redux-storage.d.ts index e9583d157b..3ff982c50b 100644 --- a/redux-storage/redux-storage.d.ts +++ b/redux-storage/redux-storage.d.ts @@ -26,7 +26,7 @@ declare module "redux-storage" { * Save * @param state */ - save(state: any): PromiseLike + save(state: any): PromiseLike; } export interface StateMerger { @@ -66,28 +66,33 @@ declare module "redux-storage" { declare module "redux-storage-decorator-filter" { import { StorageEngine } from "redux-storage"; - interface WhitelistArg { + interface FilterList { [key: number]: string | string[]; } /** * Filter decorator for redux-storage to only store a subset of the whole state tree. - * @param engine - * @param whitelist + * @param {StorageEngine} engine the redux storage engine + * @param {FilterList} [whitelist=[]] keys that will be stored. + * @param {FilterList} [blacklist=[]] keys that won't be stored. * @example + * import filter from 'redux-storage-decorator-filter'; * engine = filter(engine, [ - * 'simple-key', - * ['nested', 'key'], - * ['another', 'very', 'nested', 'key'] + * 'whitelisted-key', + * ['nested', 'key'], + * ['another', 'very', 'nested', 'key'] + * ], [ + * 'blacklisted-key', + * ['nested', 'blacklisted-key'] * ]); */ - export default function(engine: StorageEngine, whitelist?: WhitelistArg): StorageEngine; + export default function (engine: StorageEngine, whitelist?: FilterList, blacklist?: FilterList): StorageEngine; } declare module "redux-storage-engine-localstorage" { import { StorageEngine } from "redux-storage"; - export interface LocalStorageEngine extends StorageEngine {} + export interface LocalStorageEngine extends StorageEngine { } /** * Create local storage @@ -99,7 +104,7 @@ declare module "redux-storage-engine-localstorage" { declare module "redux-storage-engine-reactnativeasyncstorage" { import { StorageEngine } from "redux-storage"; - export interface ReactNativeAsyncStorageEngine extends StorageEngine {} + export interface ReactNativeAsyncStorageEngine extends StorageEngine { } /** * Create React Native Async Storage From b424d28ab14b2d54b52e7cc7aaeca34cd1dacc11 Mon Sep 17 00:00:00 2001 From: Chris Fisher Date: Wed, 26 Oct 2016 03:58:26 +1300 Subject: [PATCH 064/246] Update react-native.d.ts (#12050) * Update react-native.d.ts Added additional props to NavigationHeaderProps. * Update react-native.d.ts Fixed indentation. * Added more NavigationHeaderProps. Also updated type for NavigationHeaderStatic.Title. --- react-native/react-native.d.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/react-native/react-native.d.ts b/react-native/react-native.d.ts index f215fd3c8b..4cc5d47449 100644 --- a/react-native/react-native.d.ts +++ b/react-native/react-native.d.ts @@ -7502,11 +7502,16 @@ declare namespace __React { export interface NavigationHeaderProps { renderTitleComponent?(props: Object): JSX.Element + renderLeftComponent?(props: Object): JSX.Element + renderRightComponent?(props: Object): JSX.Element onNavigateBack(): void + style?: ViewStyle + viewProps?: any + statusBarHeight?: number | NavigationAnimatedValue } export interface NavigationHeaderStatic extends React.ComponentClass { - Title: JSX.Element + Title: () => JSX.ElementClass HEIGHT: number } From dbd5fbc59a3cfe084a06d80b591ed86987234159 Mon Sep 17 00:00:00 2001 From: Linda_pp Date: Wed, 26 Oct 2016 00:02:42 +0900 Subject: [PATCH 065/246] Add 'react-bytesize-icons' package (#12150) * Add 'react-bytesize-icons' package * Do not use 'import' in augumented module declaration * Remove non-module namespace --- .../react-bytesize-icons-tests.tsx | 10 ++ .../react-bytesize-icons.d.ts | 106 ++++++++++++++++++ 2 files changed, 116 insertions(+) create mode 100644 react-bytesize-icons/react-bytesize-icons-tests.tsx create mode 100644 react-bytesize-icons/react-bytesize-icons.d.ts diff --git a/react-bytesize-icons/react-bytesize-icons-tests.tsx b/react-bytesize-icons/react-bytesize-icons-tests.tsx new file mode 100644 index 0000000000..6247ee49d8 --- /dev/null +++ b/react-bytesize-icons/react-bytesize-icons-tests.tsx @@ -0,0 +1,10 @@ +/// +/// + +import * as React from 'react'; +import {render} from 'react-dom'; +import {Activity, External, Export} from 'react-bytesize-icons'; + +render(, document.getElementById('test')); +render(, document.getElementById('test')); +render(, document.getElementById('test')); diff --git a/react-bytesize-icons/react-bytesize-icons.d.ts b/react-bytesize-icons/react-bytesize-icons.d.ts new file mode 100644 index 0000000000..956ab90cd0 --- /dev/null +++ b/react-bytesize-icons/react-bytesize-icons.d.ts @@ -0,0 +1,106 @@ +// Type definitions for react-bytesize-icons 0.6.4 +// Project: https://github.com/abdelhai/react-bytesize-icons +// Definitions by: rhysd +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "react-bytesize-icons" { + export type StrokeLinejoin = "round" | "bevel" | "miter" | "inherit"; + export type StrokeLinecap = "round" | "butt" | "square" | "inherit"; + interface BytesizeIconsProps extends __React.Props { + width?: number; + height?: number; + strokeWidth?: string; + strokeLinejoin?: StrokeLinejoin; + strokeLinecap?: StrokeLinecap; + color?: string; + } + export class BytesizeIconComponent extends __React.Component {} + + export class Activity extends BytesizeIconComponent {} + export class Alert extends BytesizeIconComponent {} + export class Archive extends BytesizeIconComponent {} + export class ArrowBottom extends BytesizeIconComponent {} + export class ArrowLeft extends BytesizeIconComponent {} + export class ArrowRight extends BytesizeIconComponent {} + export class ArrowTop extends BytesizeIconComponent {} + export class Backwards extends BytesizeIconComponent {} + export class Ban extends BytesizeIconComponent {} + export class Bell extends BytesizeIconComponent {} + export class Bookmark extends BytesizeIconComponent {} + export class Camera extends BytesizeIconComponent {} + export class CaretBottom extends BytesizeIconComponent {} + export class CaretLeft extends BytesizeIconComponent {} + export class CaretRight extends BytesizeIconComponent {} + export class CaretTop extends BytesizeIconComponent {} + export class Cart extends BytesizeIconComponent {} + export class Checkmark extends BytesizeIconComponent {} + export class ChevronBottom extends BytesizeIconComponent {} + export class ChevronLeft extends BytesizeIconComponent {} + export class ChevronRight extends BytesizeIconComponent {} + export class ChevronTop extends BytesizeIconComponent {} + export class Clock extends BytesizeIconComponent {} + export class Close extends BytesizeIconComponent {} + export class Code extends BytesizeIconComponent {} + export class Compose extends BytesizeIconComponent {} + export class Creditcard extends BytesizeIconComponent {} + export class Download extends BytesizeIconComponent {} + export class Send extends BytesizeIconComponent {} + export class Edit extends BytesizeIconComponent {} + export class Eject extends BytesizeIconComponent {} + export class EllipsisHorizontal extends BytesizeIconComponent {} + export class EllipsisVertical extends BytesizeIconComponent {} + export class End extends BytesizeIconComponent {} + export class Export extends BytesizeIconComponent {} + export class External extends BytesizeIconComponent {} + export class Book extends BytesizeIconComponent {} + export class Calendar extends BytesizeIconComponent {} + export class Print extends BytesizeIconComponent {} + export class Eye extends BytesizeIconComponent {} + export class File extends BytesizeIconComponent {} + export class Fire extends BytesizeIconComponent {} + export class Flag extends BytesizeIconComponent {} + export class FolderOpen extends BytesizeIconComponent {} + export class Folder extends BytesizeIconComponent {} + export class Forwards extends BytesizeIconComponent {} + export class Gift extends BytesizeIconComponent {} + export class Github extends BytesizeIconComponent {} + export class Heart extends BytesizeIconComponent {} + export class Home extends BytesizeIconComponent {} + export class Import extends BytesizeIconComponent {} + export class Inbox extends BytesizeIconComponent {} + export class Info extends BytesizeIconComponent {} + export class Lightning extends BytesizeIconComponent {} + export class Link extends BytesizeIconComponent {} + export class Location extends BytesizeIconComponent {} + export class Lock extends BytesizeIconComponent {} + export class Mail extends BytesizeIconComponent {} + export class Menu extends BytesizeIconComponent {} + export class Message extends BytesizeIconComponent {} + export class Music extends BytesizeIconComponent {} + export class Mute extends BytesizeIconComponent {} + export class Options extends BytesizeIconComponent {} + export class Paperclip extends BytesizeIconComponent {} + export class Pause extends BytesizeIconComponent {} + export class Photo extends BytesizeIconComponent {} + export class Plus extends BytesizeIconComponent {} + export class Minus extends BytesizeIconComponent {} + export class Play extends BytesizeIconComponent {} + export class Portfolio extends BytesizeIconComponent {} + export class Reload extends BytesizeIconComponent {} + export class Reply extends BytesizeIconComponent {} + export class Search extends BytesizeIconComponent {} + export class Settings extends BytesizeIconComponent {} + export class Star extends BytesizeIconComponent {} + export class Start extends BytesizeIconComponent {} + export class Tag extends BytesizeIconComponent {} + export class Trash extends BytesizeIconComponent {} + export class Twitter extends BytesizeIconComponent {} + export class Unlock extends BytesizeIconComponent {} + export class Upload extends BytesizeIconComponent {} + export class User extends BytesizeIconComponent {} + export class Video extends BytesizeIconComponent {} + export class Volume extends BytesizeIconComponent {} + export class Work extends BytesizeIconComponent {} +} From 4e310dbcc077de71388f1370e1621f7fad7a4ff6 Mon Sep 17 00:00:00 2001 From: Xavier Stouder Date: Tue, 25 Oct 2016 17:08:41 +0200 Subject: [PATCH 066/246] Create xmldoc definitions (#12219) * Create xmldoc definitions * Fix implicit any --- xmldoc/xmldoc-tests.ts | 7 +++++++ xmldoc/xmldoc.d.ts | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 xmldoc/xmldoc-tests.ts create mode 100644 xmldoc/xmldoc.d.ts diff --git a/xmldoc/xmldoc-tests.ts b/xmldoc/xmldoc-tests.ts new file mode 100644 index 0000000000..4cc1f82c94 --- /dev/null +++ b/xmldoc/xmldoc-tests.ts @@ -0,0 +1,7 @@ +/// +/// + +import * as xmldoc from "xmldoc"; + +const doc = new xmldoc.XmlDocument("magic"); +console.log(doc.toString()); \ No newline at end of file diff --git a/xmldoc/xmldoc.d.ts b/xmldoc/xmldoc.d.ts new file mode 100644 index 0000000000..f9ae994e82 --- /dev/null +++ b/xmldoc/xmldoc.d.ts @@ -0,0 +1,33 @@ +// Type definitions for xmldoc 0.5.1 +// Project: https://www.npmjs.com/package/xmldoc +// Definitions by: Xavier Stouder +// Definitions: https://github.com/DefinitelyTyped/ + +declare module "xmldoc" { + export class XmlDocument { + constructor(xmlString: string); + + eachChild(func: (child: XmlElement, index?: number, array?: XmlElement[]) => void): void; + childNamed(name: string): XmlElement; + childrenNamed(name: string): XmlElement[]; + childWithAttribute(name: string, value?: string): XmlElement; + descendantWithPath(path: string): XmlElement; + valueWithPath(path: string): string; + toString(opts?: XmlOptions): string; + } + export class XmlElement { + eachChild(func: (child: XmlElement, index?: number, array?: XmlElement[]) => void): void; + childNamed(name: string): XmlElement; + childrenNamed(name: string): XmlElement[]; + childWithAttribute(name: string, value?: string): XmlElement; + descendantWithPath(path: string): XmlElement; + valueWithPath(path: string): string; + toString(opts?: XmlOptions): string; + } + + export interface XmlOptions { + compressed?: boolean; + trimmed?: boolean; + preserveWhitespace?: boolean; + } +} \ No newline at end of file From b6f6ba5f89cf1eaf295ca78a0ad74c4dab2457c1 Mon Sep 17 00:00:00 2001 From: Karol Janyst Date: Wed, 26 Oct 2016 00:29:19 +0900 Subject: [PATCH 067/246] Update definitions for react-fa (#12119) --- react-fa/react-fa-4.0.0.d.ts | 28 +++++++++++++++++++++++ react-fa/react-fa-tests.tsx | 22 +++++++++++++----- react-fa/react-fa.d.ts | 43 +++++++++++++++++++++--------------- 3 files changed, 70 insertions(+), 23 deletions(-) create mode 100644 react-fa/react-fa-4.0.0.d.ts diff --git a/react-fa/react-fa-4.0.0.d.ts b/react-fa/react-fa-4.0.0.d.ts new file mode 100644 index 0000000000..0b6b166a22 --- /dev/null +++ b/react-fa/react-fa-4.0.0.d.ts @@ -0,0 +1,28 @@ +// Type definitions for react-fa v4.0.0 +// Project: https://github.com/andreypopp/react-fa +// Definitions by: Frank Laub +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "react-fa" { + import { ComponentClass, Props } from 'react'; + + interface IconProps extends Props { + name: string; + className?: string; + size?: string; + spin?: boolean; + rotate?: string; + flip?: string; + fixedWidth?: boolean; + pulse?: boolean; + stack?: string; + inverse?: boolean; + } + + interface Icon extends ComponentClass { } + const Icon: Icon; + + export = Icon; +} diff --git a/react-fa/react-fa-tests.tsx b/react-fa/react-fa-tests.tsx index 778c6b16ac..2fa87a20dc 100644 --- a/react-fa/react-fa-tests.tsx +++ b/react-fa/react-fa-tests.tsx @@ -1,11 +1,23 @@ +// React Fa Test +// ================================================================================ /// /// -import * as React from "react"; -import { render } from 'react-dom'; -import Icon = require('react-fa'); +// Imports +// -------------------------------------------------------------------------------- +import * as React from "react" +import { render } from "react-dom" +import { Icon, IconStack } from "react-fa" render( - , - document.getElementById('main') + , + document.getElementById("main") +) + +render( + + + + , + document.getElementById("main") ) diff --git a/react-fa/react-fa.d.ts b/react-fa/react-fa.d.ts index 0b6b166a22..570a50893e 100644 --- a/react-fa/react-fa.d.ts +++ b/react-fa/react-fa.d.ts @@ -1,28 +1,35 @@ -// Type definitions for react-fa v4.0.0 +// Type definitions for react-fa v4.1.2 // Project: https://github.com/andreypopp/react-fa -// Definitions by: Frank Laub +// Definitions by: Frank Laub , Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// declare module "react-fa" { - import { ComponentClass, Props } from 'react'; + import { Component, ClassAttributes } from "react"; - interface IconProps extends Props { - name: string; - className?: string; - size?: string; - spin?: boolean; - rotate?: string; - flip?: string; - fixedWidth?: boolean; - pulse?: boolean; - stack?: string; - inverse?: boolean; - } + type IconSize = "lg" | "2x" | "3x" | "4x" | "5x" - interface Icon extends ComponentClass { } - const Icon: Icon; + interface IconProps extends ClassAttributes { + name: string + className?: string + size?: IconSize + rotate?: "45" | "90" | "135" | "180" | "225" | "270" | "315" + flip?: "horizontal" | "vertical" + fixedWidth?: boolean + spin?: boolean + pulse?: boolean + stack?: "1x" | "2x" + inverse?: boolean + Component?: string | Function + } + export class Icon extends Component {} - export = Icon; + interface IconStackProps extends ClassAttributes { + className?: string + size?: IconSize + } + export class IconStack extends Component {} + + export default Icon } From 4cc7cbabf6dce8e5e684622d538db6241fbc0a7b Mon Sep 17 00:00:00 2001 From: Mike Deverell Date: Tue, 25 Oct 2016 11:35:40 -0400 Subject: [PATCH 068/246] [enzyme] state() with no props as an "S" (state type) return type (#12211) * clarify and fix 'options' object types; Hammer.Manager requires an EventTarget, not HTMLElement * fix RecognizerTuple type * `state()` with no props has an `S` (state type) return value --- enzyme/enzyme-tests.tsx | 2 +- enzyme/enzyme.d.ts | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/enzyme/enzyme-tests.tsx b/enzyme/enzyme-tests.tsx index e5d56200cb..b87a759861 100644 --- a/enzyme/enzyme-tests.tsx +++ b/enzyme/enzyme-tests.tsx @@ -204,7 +204,7 @@ namespace ShallowWrapperTest { } function test_state() { - shallowWrapper.state(); + const state: MyComponentState = shallowWrapper.state(); shallowWrapper.state('key'); const tmp: String = shallowWrapper.state('key'); } diff --git a/enzyme/enzyme.d.ts b/enzyme/enzyme.d.ts index 5a53f8bf20..85a72127c1 100644 --- a/enzyme/enzyme.d.ts +++ b/enzyme/enzyme.d.ts @@ -204,8 +204,9 @@ declare module "enzyme" { * Returns the state hash for the root node of the wrapper. Optionally pass in a prop name and it will return just that value. * @param [key] */ - state(key?: string): any; - state(key?: string): T; + state(): S; + state(key: string): any; + state(key: string): T; /** * Returns the context hash for the root node of the wrapper. Optionally pass in a prop name and it will return just that value. From 54eb1c37f3c1a5dc9c8c09972849b7345e4a4b86 Mon Sep 17 00:00:00 2001 From: Ivo Stratev Date: Tue, 25 Oct 2016 18:37:04 +0300 Subject: [PATCH 069/246] Adding react-syntax-highlighter (#12165) --- .../react-syntax-highlighter-tests.tsx | 20 + .../react-syntax-highlighter.d.ts | 502 ++++++++++++++++++ 2 files changed, 522 insertions(+) create mode 100644 react-syntax-highlighter/react-syntax-highlighter-tests.tsx create mode 100644 react-syntax-highlighter/react-syntax-highlighter.d.ts diff --git a/react-syntax-highlighter/react-syntax-highlighter-tests.tsx b/react-syntax-highlighter/react-syntax-highlighter-tests.tsx new file mode 100644 index 0000000000..00a8cac6f7 --- /dev/null +++ b/react-syntax-highlighter/react-syntax-highlighter-tests.tsx @@ -0,0 +1,20 @@ +/// + +import * as React from 'react'; +import SyntaxHighlighter from 'react-syntax-highlighter'; +import { docco } from 'react-syntax-highlighter/dist/styles'; + +function highlighter(): JSX.Element { + const codeString: string = +`class CPP { + private year: number; + public constructor(private version: string) { + this.year = Number(version.match(/.+\d+$/)); + } + public version(): string { + return this.version; + } +} +`; + return {codeString}; +} \ No newline at end of file diff --git a/react-syntax-highlighter/react-syntax-highlighter.d.ts b/react-syntax-highlighter/react-syntax-highlighter.d.ts new file mode 100644 index 0000000000..127fe10b31 --- /dev/null +++ b/react-syntax-highlighter/react-syntax-highlighter.d.ts @@ -0,0 +1,502 @@ +// Type definitions for react-syntax-highlighter +// Project: https://github.com/conorhastings/react-syntax-highlighter +// Definitions by: Ivo Stratev +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module 'react-syntax-highlighter' { + import SyntaxHighlighter from 'react-syntax-highlighter/dist/light'; + export default SyntaxHighlighter; +} + +declare module 'react-syntax-highlighter/dist/light' { + import * as React from 'react'; + + interface SyntaxHighlighterProps { + language?: string; + style?: any; + customStyle?: any; + codeTagProps?: HTMLElement; + useInlineStyles?: boolean; + showLineNumbers?: boolean; + startingLineNumber?: number; + lineNumberStyle?: any; + [spread: string]: any; + } + + export default class SyntaxHighlighter extends React.Component { + + } +} + +declare module 'react-syntax-highlighter/dist/styles' { + export { default as agate } from 'react-syntax-highlighter/dist/styles/agate'; + export { default as androidstudio } from 'react-syntax-highlighter/dist/styles/androidstudio'; + export { default as arduinoLight } from 'react-syntax-highlighter/dist/styles/arduino-light'; + export { default as arta } from 'react-syntax-highlighter/dist/styles/arta'; + export { default as ascetic } from 'react-syntax-highlighter/dist/styles/ascetic'; + export { default as atelierCaveDark } from 'react-syntax-highlighter/dist/styles/atelier-cave-dark'; + export { default as atelierCaveLight } from 'react-syntax-highlighter/dist/styles/atelier-cave-light'; + export { default as atelierDuneDark } from 'react-syntax-highlighter/dist/styles/atelier-dune-dark'; + export { default as atelierDuneLight } from 'react-syntax-highlighter/dist/styles/atelier-dune-light'; + export { default as atelierEstuaryDark } from 'react-syntax-highlighter/dist/styles/atelier-estuary-dark'; + export { default as atelierEstuaryLight } from 'react-syntax-highlighter/dist/styles/atelier-estuary-light'; + export { default as atelierForestDark } from 'react-syntax-highlighter/dist/styles/atelier-forest-dark'; + export { default as atelierForestLight } from 'react-syntax-highlighter/dist/styles/atelier-forest-light'; + export { default as atelierHeathDark } from 'react-syntax-highlighter/dist/styles/atelier-heath-dark'; + export { default as atelierHeathLight } from 'react-syntax-highlighter/dist/styles/atelier-heath-light'; + export { default as atelierLakesideDark } from 'react-syntax-highlighter/dist/styles/atelier-lakeside-dark'; + export { default as atelierLakesideLight } from 'react-syntax-highlighter/dist/styles/atelier-lakeside-light'; + export { default as atelierPlateauDark } from 'react-syntax-highlighter/dist/styles/atelier-plateau-dark'; + export { default as atelierPlateauLight } from 'react-syntax-highlighter/dist/styles/atelier-plateau-light'; + export { default as atelierSavannaDark } from 'react-syntax-highlighter/dist/styles/atelier-savanna-dark'; + export { default as atelierSavannaLight } from 'react-syntax-highlighter/dist/styles/atelier-savanna-light'; + export { default as atelierSeasideDark } from 'react-syntax-highlighter/dist/styles/atelier-seaside-dark'; + export { default as atelierSeasideLight } from 'react-syntax-highlighter/dist/styles/atelier-seaside-light'; + export { default as atelierSulphurpoolDark } from 'react-syntax-highlighter/dist/styles/atelier-sulphurpool-dark'; + export { default as atelierSulphurpoolLight } from 'react-syntax-highlighter/dist/styles/atelier-sulphurpool-light'; + export { default as atomOneDark } from 'react-syntax-highlighter/dist/styles/atom-one-dark'; + export { default as atomOneLight } from 'react-syntax-highlighter/dist/styles/atom-one-light'; + export { default as brownPaper } from 'react-syntax-highlighter/dist/styles/brown-paper'; + export { default as codepenEmbed } from 'react-syntax-highlighter/dist/styles/codepen-embed'; + export { default as colorBrewer } from 'react-syntax-highlighter/dist/styles/color-brewer'; + export { default as darcula } from 'react-syntax-highlighter/dist/styles/darcula'; + export { default as dark } from 'react-syntax-highlighter/dist/styles/dark'; + export { default as darkula } from 'react-syntax-highlighter/dist/styles/darkula'; + export { default as defaultStyle } from 'react-syntax-highlighter/dist/styles/default-style'; + export { default as docco } from 'react-syntax-highlighter/dist/styles/docco'; + export { default as dracula } from 'react-syntax-highlighter/dist/styles/dracula'; + export { default as far } from 'react-syntax-highlighter/dist/styles/far'; + export { default as foundation } from 'react-syntax-highlighter/dist/styles/foundation'; + export { default as githubGist } from 'react-syntax-highlighter/dist/styles/github-gist'; + export { default as github } from 'react-syntax-highlighter/dist/styles/github'; + export { default as googlecode } from 'react-syntax-highlighter/dist/styles/googlecode'; + export { default as grayscale } from 'react-syntax-highlighter/dist/styles/grayscale'; + export { default as gruvboxDark } from 'react-syntax-highlighter/dist/styles/gruvbox-dark'; + export { default as gruvboxLight } from 'react-syntax-highlighter/dist/styles/gruvbox-light'; + export { default as hopscotch } from 'react-syntax-highlighter/dist/styles/hopscotch'; + export { default as hybrid } from 'react-syntax-highlighter/dist/styles/hybrid'; + export { default as idea } from 'react-syntax-highlighter/dist/styles/idea'; + export { default as irBlack } from 'react-syntax-highlighter/dist/styles/ir-black'; + export { default as kimbieDark } from 'react-syntax-highlighter/dist/styles/kimbie.dark'; + export { default as kimbieLight } from 'react-syntax-highlighter/dist/styles/kimbie.light'; + export { default as magula } from 'react-syntax-highlighter/dist/styles/magula'; + export { default as monoBlue } from 'react-syntax-highlighter/dist/styles/mono-blue'; + export { default as monokaiSublime } from 'react-syntax-highlighter/dist/styles/monokai-sublime'; + export { default as monokai } from 'react-syntax-highlighter/dist/styles/monokai'; + export { default as obsidian } from 'react-syntax-highlighter/dist/styles/obsidian'; + export { default as ocean } from 'react-syntax-highlighter/dist/styles/ocean'; + export { default as paraisoDark } from 'react-syntax-highlighter/dist/styles/paraiso-dark'; + export { default as paraisoLight } from 'react-syntax-highlighter/dist/styles/paraiso-light'; + export { default as pojoaque } from 'react-syntax-highlighter/dist/styles/pojoaque'; + export { default as purebasic } from 'react-syntax-highlighter/dist/styles/purebasic'; + export { default as qtcreatorDark } from 'react-syntax-highlighter/dist/styles/qtcreator_dark'; + export { default as qtcreatorLight } from 'react-syntax-highlighter/dist/styles/qtcreator_light'; + export { default as railscasts } from 'react-syntax-highlighter/dist/styles/railscasts'; + export { default as rainbow } from 'react-syntax-highlighter/dist/styles/rainbow'; + export { default as schoolBook } from 'react-syntax-highlighter/dist/styles/school-book'; + export { default as solarizedDark } from 'react-syntax-highlighter/dist/styles/solarized-dark'; + export { default as solarizedLight } from 'react-syntax-highlighter/dist/styles/solarized-light'; + export { default as sunburst } from 'react-syntax-highlighter/dist/styles/sunburst'; + export { default as tomorrowNightBlue } from 'react-syntax-highlighter/dist/styles/tomorrow-night-blue'; + export { default as tomorrowNightBright } from 'react-syntax-highlighter/dist/styles/tomorrow-night-bright'; + export { default as tomorrowNightEighties } from 'react-syntax-highlighter/dist/styles/tomorrow-night-eighties'; + export { default as tomorrowNight } from 'react-syntax-highlighter/dist/styles/tomorrow-night'; + export { default as tomorrow } from 'react-syntax-highlighter/dist/styles/tomorrow'; + export { default as vs } from 'react-syntax-highlighter/dist/styles/vs'; + export { default as xcode } from 'react-syntax-highlighter/dist/styles/xcode'; + export { default as xt256 } from 'react-syntax-highlighter/dist/styles/xt256'; + export { default as zenburn } from 'react-syntax-highlighter/dist/styles/zenburn'; +} + +declare module 'react-syntax-highlighter/dist/styles/agate' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/androidstudio' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/arduino-light' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/arta' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/ascetic' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/atelier-cave-dark' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/atelier-cave-light' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/atelier-dune-dark' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/atelier-dune-light' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/atelier-estuary-dark' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/atelier-estuary-light' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/atelier-forest-dark' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/atelier-forest-light' { + const style: any; + export default style; +} + + +declare module 'react-syntax-highlighter/dist/styles/atelier-heath-dark' { + const style: any; + export default style; +} + + +declare module 'react-syntax-highlighter/dist/styles/atelier-heath-light' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/atelier-lakeside-dark' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/atelier-lakeside-light' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/atelier-plateau-dark' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/atelier-plateau-light' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/atelier-savanna-dark' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/atelier-savanna-light' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/atelier-seaside-dark' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/atelier-seaside-light' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/atelier-sulphurpool-dark' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/atelier-sulphurpool-light' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/atom-one-dark' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/atom-one-light' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/brown-paper' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/codepen-embed' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/color-brewer' { + const style: any; + export default style; +} + + +declare module 'react-syntax-highlighter/dist/styles/darcula' { + const style: any; + export default style; +} + + +declare module 'react-syntax-highlighter/dist/styles/dark' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/darkula' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/default-style' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/docco' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/dracula' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/far' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/foundation' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/github-gist' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/github' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/googlecode' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/grayscale' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/gruvbox-dark' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/gruvbox-light' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/hopscotch' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/hybrid' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/idea' { + const style: any; + export default style; +} + + +declare module 'react-syntax-highlighter/dist/styles/ir-black' { + const style: any; + export default style; +} + + +declare module 'react-syntax-highlighter/dist/styles/kimbie.dark' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/kimbie.light' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/magula' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/mono-blue' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/monokai-sublime' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/monokai' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/obsidian' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/ocean' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/paraiso-dark' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/paraiso-light' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/pojoaque' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/purebasic' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/qtcreator_dark' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/qtcreator_light' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/railscasts' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/rainbow' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/school-book' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/solarized-dark' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/solarized-light' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/sunburst' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/tomorrow-night-blue' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/tomorrow-night-bright' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/tomorrow-night-eighties' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/tomorrow-night' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/tomorrow' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/vs' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/xcode' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/xt256' { + const style: any; + export default style; +} + +declare module 'react-syntax-highlighter/dist/styles/zenburn' { + const style: any; + export default style; +} \ No newline at end of file From b62292ba07eb91922e1e64ceef81ed25bb215275 Mon Sep 17 00:00:00 2001 From: Ivo Stratev Date: Tue, 25 Oct 2016 18:37:25 +0300 Subject: [PATCH 070/246] Adding lowlight (#12164) --- lowlight/lowlight-tests.ts | 82 +++++++++++++++++++++++++++++++ lowlight/lowlight.d.ts | 99 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 181 insertions(+) create mode 100644 lowlight/lowlight-tests.ts create mode 100644 lowlight/lowlight.d.ts diff --git a/lowlight/lowlight-tests.ts b/lowlight/lowlight-tests.ts new file mode 100644 index 0000000000..0160093785 --- /dev/null +++ b/lowlight/lowlight-tests.ts @@ -0,0 +1,82 @@ +/// + +import { highlight, highlightAuto, registerLanguage } from 'lowlight'; +import * as core from 'lowlight/lib/core'; + +function highlighter(hljs: any): any { + return { + aliases: ['cmake.in'], + case_insensitive: true, + keywords: { + keyword: + 'forall all exists exist only m M i e 1 2 3 4 5 6 7 8 9 0 - + * / \ % ! . , ; : | lim limsup liminf infinity not' + }, + contains: [ + { + className: 'variable', + begin: '(', end: ')' + }, + ] + }; +} + +registerLanguage('math', highlighter); + +console.log(highlight('typescript', +`class CPP { + private year: number; + public constructor(private version: string) { + this.year = Number(version.match(/.+\d+$/)); + } + + public version(): string { + return this.version; + } +} +` +)); + +console.info(highlightAuto( +`class CPP { + private year: number; + public constructor(private version: string) { + this.year = Number(version.match(/.+\d+$/)); + } + + public version(): string { + return this.version; + } +} +` +)); + +core.registerLanguage('math', highlighter); + +console.log(core.highlight('javascript', +`class CPP { + constructor(version) { + this.version = version; + this.year = Number(version.match(/.+\d+$/)); + } + + version(){ + return this.version; + } +} +` +, { prefix: 'core-' })); + + +console.info(core.highlightAuto( +`class CPP { + constructor(version) { + this.version = version; + this.year = Number(version.match(/.+\d+$/)); + } + + version(){ + return this.version; + } +} +` +, { prefix: 'core-', subset: ['purescript', 'javascript', 'typescript', 'coffeescript'] })); \ No newline at end of file diff --git a/lowlight/lowlight.d.ts b/lowlight/lowlight.d.ts new file mode 100644 index 0000000000..589c9b50fd --- /dev/null +++ b/lowlight/lowlight.d.ts @@ -0,0 +1,99 @@ +// Type definitions for lowlight +// Project: https://github.com/wooorm/lowlight +// Definitions by: Ivo Stratev +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module 'lowlight' { + export { highlight, highlightAuto, registerLanguage } from 'lowlight/lib/core'; +} + +declare module 'lowlight/lib/core' { + export function highlight(language: string, value: string, options?: lowlight.HighlightOptions): lowlight.HighlightResult; + export function highlightAuto(value: string, options?: lowlight.HighlightAutoOptions): lowlight.HighlightAutoResult; + export function registerLanguage(name: string, syntax: Function): void; +} + +declare namespace lowlight { + namespace AST { + namespace Unist { + interface Data { + [index: string]: any; + } + + interface Position { + line: number; + column: number; + offset?: number; + } + + interface Location { + start: Position; + end: Position; + indent?: Array; + } + + export interface Node { + type: string; + data?: Data; + position?: Location; + } + + export interface Parent extends Node { + children: Array; + } + + export interface Text extends Node { + value: string; + } + } + + interface Properties { + [index: string]: any; + } + + export interface Root extends Unist.Parent { + type: 'root'; + } + + export interface Element extends Unist.Parent { + type: 'element'; + tagName: string; + properties: Properties; + } + + export interface Doctype extends Unist.Node { + type: 'doctype'; + name: string; + public?: string; + system?: string; + } + + export interface Comment extends Unist.Text { + type: 'comment'; + } + + export interface Text extends Unist.Text { + type: 'text'; + } + } + + type HastNode = AST.Root | AST.Element | AST.Doctype | AST.Comment | AST.Text; + + interface HighlightOptions { + prefix?: string; + } + + interface HighlightAutoOptions extends HighlightOptions { + subset?: Array; + } + + interface HighlightResult { + relevance: number; + language: string; + value: Array; + } + + interface HighlightAutoResult extends HighlightResult { + secondBest?: HighlightAutoResult; + } +} \ No newline at end of file From 87fef742c9e1eac7e6484e017cb03b8261549612 Mon Sep 17 00:00:00 2001 From: Nathan Dao Date: Tue, 25 Oct 2016 18:38:18 +0300 Subject: [PATCH 071/246] add support for Highcharts 5.0.0 update (#12170) * add support for Highcharts 5.0.0 update * add update return type * change redraw in update to optional --- highcharts/highcharts.d.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/highcharts/highcharts.d.ts b/highcharts/highcharts.d.ts index 7f2d28e99b..debb67ef48 100644 --- a/highcharts/highcharts.d.ts +++ b/highcharts/highcharts.d.ts @@ -5946,6 +5946,19 @@ declare namespace __Highcharts { * @since 2.0.5 */ showLoading(str?: string): void; + /** + * A generic function to update any element of the chart. Elements can be enabled and disabled, moved, re-styled, + * re-formatted etc. + * A special case is configuration objects that take arrays, for example xAxis, yAxis or series. For these collections, + * an id option is used to map the new option set to an existing object. If an existing object of the same id is not + * found, the first item is updated. So for example, running chart.update with a series item without an id, will cause + * the existing chart's first series to be updated. + * See also the responsive option set. Switching between responsive.rules basically runs chart.update under the hood. + * @param {ChartOptions} option A configuration object for the new chart options as defined in the options section of the API. + * @param [boolean] redraw Whether to redraw the chart. Defaults to true. + * @since 5.0.0 + */ + update(options: ChartOptions, redraw?: boolean): void; /** * This method is deprecated as of 2.0.1. Updating the chart position after a move operation is no longer necessary. * @since 1.2.5 From 65ec496d302f1d4a2709590134d9d4130b57e4eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Crist=C3=B3v=C3=A3o?= Date: Tue, 25 Oct 2016 16:39:02 +0100 Subject: [PATCH 072/246] added silly and verbose levels to winston (#12230) --- winston/winston-tests.ts | 6 ++++++ winston/winston.d.ts | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/winston/winston-tests.ts b/winston/winston-tests.ts index 60423f9fc8..dc1773875b 100644 --- a/winston/winston-tests.ts +++ b/winston/winston-tests.ts @@ -77,9 +77,15 @@ winston.exitOnError = bool; winston.log(str, str); winston.log(str, str, metadata); winston.log(str, str, metadata, metadata, metadata); +winston.silly(str); +winston.silly(str, metadata); +winston.silly(str, metadata, metadata, metadata); winston.debug(str); winston.debug(str, metadata); winston.debug(str, metadata, metadata, metadata); +winston.verbose(str); +winston.verbose(str, metadata); +winston.verbose(str, metadata, metadata, metadata); winston.info(str); winston.info(str, metadata); winston.info(str, metadata, metadata, metadata); diff --git a/winston/winston.d.ts b/winston/winston.d.ts index 762e69532f..deb00be187 100644 --- a/winston/winston.d.ts +++ b/winston/winston.d.ts @@ -26,7 +26,9 @@ declare module "winston" { export var log: LogMethod; + export var silly: LeveledLogMethod; export var debug: LeveledLogMethod; + export var verbose: LeveledLogMethod; export var info: LeveledLogMethod; export var warn: LeveledLogMethod; export var error: LeveledLogMethod; @@ -109,7 +111,9 @@ declare module "winston" { log: LogMethod; + silly: LeveledLogMethod; debug: LeveledLogMethod; + verbose: LeveledLogMethod; info: LeveledLogMethod; warn: LeveledLogMethod; error: LeveledLogMethod; From 003c965b31ab9c478937a7b6e56dfb74f94b5c47 Mon Sep 17 00:00:00 2001 From: Michael McKenzie Date: Tue, 25 Oct 2016 16:49:14 +0100 Subject: [PATCH 073/246] Update Settings definition (#12163) --- polymer/polymer.d.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/polymer/polymer.d.ts b/polymer/polymer.d.ts index 57135e54e1..47636265da 100644 --- a/polymer/polymer.d.ts +++ b/polymer/polymer.d.ts @@ -292,14 +292,17 @@ declare namespace polymer { } interface Settings { - - wantShadow:boolean; - hasShadow:boolean; - nativeShadow:boolean; - useShadow:boolean; - useNativeShadow:boolean; - useNativeImports:boolean; - useNativeCustomElements:boolean; + hasNativeCSSProperties: boolean + hasNativeImports: boolean + hasShadow: boolean + nativeShadow: boolean + useNativeCSSProperties: boolean + useNativeCustomElements: boolean + useNativeImports: boolean + useNativeShadow: boolean + usePolyfillProto: boolean + useShadow: boolean + wantShadow: boolean } interface PolymerStatic { From 8def457e061a90162dd857d3b23cebc3417f8ff8 Mon Sep 17 00:00:00 2001 From: Shivaraj kv Date: Wed, 26 Oct 2016 00:06:35 +0530 Subject: [PATCH 074/246] Replaced Object with {} --- fusioncharts/fusioncharts.d.ts | 48 +++++++++++++++++----------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/fusioncharts/fusioncharts.d.ts b/fusioncharts/fusioncharts.d.ts index 5e68eab97f..8af7589f07 100644 --- a/fusioncharts/fusioncharts.d.ts +++ b/fusioncharts/fusioncharts.d.ts @@ -46,11 +46,11 @@ declare namespace FusionCharts { dataFormat?: ChartDataFormats; - dataSource?: string | Object; + dataSource?: string | {}; - events?: Object; + events?: {}; - link?: Object; + link?: {}; showDataLoadingMessage?: boolean; @@ -142,17 +142,17 @@ declare namespace FusionCharts { } interface FusionCharts { - clone(overrides?: Object, argsOnly?: boolean): any; + clone(overrides?: {}, argsOnly?: boolean): any; isActive(): boolean; chartType(value?: string, options?: any): string; - addEventListener(type: string | string[], listener: (eventObject?: EventObject, eventArgs?: Object) => void): void; + addEventListener(type: string | string[], listener: (eventObject?: EventObject, eventArgs?: {}) => void): void; - removeEventListener(type: string | string[], listener: (eventObject?: EventObject, eventArgs?: Object) => void): void; + removeEventListener(type: string | string[], listener: (eventObject?: EventObject, eventArgs?: {}) => void): void; - configureLink(param: Object | any[], level?: number): void; + configureLink(param: {} | any[], level?: number): void; setChartAttribute(attributes: ChartObject | String, value?: string): void; @@ -160,13 +160,13 @@ declare namespace FusionCharts { getXMLData(): any; - setXMLData(data: string | Object): void; + setXMLData(data: string | {}): void; setXMLUrl(url: string): void; setChartDataUrl(url: string, format: ChartDataFormats): void; - setChartData(data: string | Object, format: ChartDataFormats): void; + setChartData(data: string | {}, format: ChartDataFormats): void; getChartData(format: ChartDataFormats): any; @@ -194,7 +194,7 @@ declare namespace FusionCharts { getXML(): any; - setDataXML(data: string | Object): void; + setDataXML(data: string | {}): void; setDataURL(url: string): void; @@ -206,7 +206,7 @@ declare namespace FusionCharts { slicePlotItem(index: number, slice: boolean): void; - centerLabel(labelText: string, options?: Object): void; + centerLabel(labelText: string, options?: {}): void; startingAngle(angle?: number, relative?: boolean): void; @@ -222,9 +222,9 @@ declare namespace FusionCharts { getViewEndIndex(): number; - print(options?: Object): void; + print(options?: {}): void; - exportChart(options?: Object): void; + exportChart(options?: {}): void; getSVGString(): string; @@ -234,7 +234,7 @@ declare namespace FusionCharts { getJSONData(): JSON; - setJSONData(data: string | Object): void; + setJSONData(data: string | {}): void; setJSONUrl(url: string): void; @@ -248,30 +248,30 @@ declare namespace FusionCharts { dispose(): void; - configure(options: Object): void; + configure(options: {}): void; - ref: Object; + ref: {}; } interface FusionChartStatic { - new (chartObject: ChartObject|Object): FusionCharts; + new (chartObject: ChartObject|{}): FusionCharts; (chartId: string): FusionCharts; getObjectReference(elementId: string): Element; - addEventListener(type: string | string[], listener: (eventObject?: EventObject, eventArgs?: Object) => void): void; + addEventListener(type: string | string[], listener: (eventObject?: EventObject, eventArgs?: {}) => void): void; - removeEventListener(type: string | string[], listener: (eventObject?: EventObject, eventArgs?: Object) => void): void; + removeEventListener(type: string | string[], listener: (eventObject?: EventObject, eventArgs?: {}) => void): void; ready(callback: (fusionChartStatic?: FusionChartStatic) => any, context?: any): FusionChartStatic; - transcodeData(data: string | Object, source: ChartDataFormats, target: ChartDataFormats, advanced: boolean): any; + transcodeData(data: string | {}, source: ChartDataFormats, target: ChartDataFormats, advanced: boolean): any; - batchExport(options: Object): void; + batchExport(options: {}): void; - formatNumber(num: number, type?: string, config?: Object): Element; + formatNumber(num: number, type?: string, config?: {}): Element; setCurrentRenderer(name: string): void @@ -281,9 +281,9 @@ declare namespace FusionCharts { version: string[]; - items: Object; + items: {}; - options: Object; + options: {}; debugger:Debugger; From 14eed8a1fef49ef9543dd9a75a5622afb23ade30 Mon Sep 17 00:00:00 2001 From: Christian Rackerseder Date: Wed, 26 Oct 2016 07:34:34 +0200 Subject: [PATCH 075/246] Replaced Text with string --- ora/index.d.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ora/index.d.ts b/ora/index.d.ts index 6e06bd35ec..976005200b 100644 --- a/ora/index.d.ts +++ b/ora/index.d.ts @@ -7,9 +7,8 @@ declare module "ora" { type Color = 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'gray'; - type Text = string; interface Options { - text?: Text; + text?: string; spinner?: string | Spinner; color?: Color; interval?: number; @@ -32,6 +31,6 @@ declare module "ora" { text: string; color: Color; } - function ora(options: Options | Text): Instance; + function ora(options: Options | string): Instance; export = ora; } From b4fccb09fcdaca007f4a43865c674a7b4162abe4 Mon Sep 17 00:00:00 2001 From: Michael McKenzie Date: Thu, 20 Oct 2016 17:25:17 +0100 Subject: [PATCH 076/246] adding RenderStatus to API --- polymer/polymer.d.ts | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/polymer/polymer.d.ts b/polymer/polymer.d.ts index 47636265da..24c1fcbc8f 100644 --- a/polymer/polymer.d.ts +++ b/polymer/polymer.d.ts @@ -7,7 +7,7 @@ declare namespace polymer { - type PropConstructorType = StringConstructor|ObjectConstructor|BooleanConstructor|NumberConstructor|DateConstructor|ArrayConstructor; + type PropConstructorType = StringConstructor | ObjectConstructor | BooleanConstructor | NumberConstructor | DateConstructor | ArrayConstructor; interface PropObjectType { type: PropConstructorType; @@ -305,15 +305,38 @@ declare namespace polymer { wantShadow: boolean } - interface PolymerStatic { + interface RenderStatus { + _afterNextRenderQueue: [Element, Function, any][]; + _callbacks: Function[]; + _ready: boolean; + _waitingNextRender: boolean; + _catchFirstRender(): void; + _flushNextRender(): void; + _flushRenderCallbacks(callbacks: [Element, Function, any][]): void; + _makeReady(): void; + _watchNextRender(): void; + afterNextRender(element: Element, fn: Function, args?: any): void; + hasRendered(): boolean; + whenReady(cb: Function): void; + } + + interface ImportStatus extends RenderStatus { + whenLoaded(cb: Function): void; + } + + interface PolymerStatic { Settings: Settings; - dom:DomApiStatic; + dom: DomApiStatic; - (prototype: Base|{new ():Base}):webcomponents.CustomElementConstructor; + (prototype: Base | { new (): Base }): webcomponents.CustomElementConstructor; - Class(prototype: Base|{new ():Base}):webcomponents.CustomElementConstructor; + Class(prototype: Base | { new (): Base }): webcomponents.CustomElementConstructor; + + RenderStatus: RenderStatus + + ImportStatus: ImportStatus } } From 58f16959cec5001d85271491a306dd3b7944db7d Mon Sep 17 00:00:00 2001 From: Michael McKenzie Date: Mon, 24 Oct 2016 14:31:27 +0100 Subject: [PATCH 077/246] add @deprecated comment to ImportStatus --- polymer/polymer.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/polymer/polymer.d.ts b/polymer/polymer.d.ts index 24c1fcbc8f..984bf024b8 100644 --- a/polymer/polymer.d.ts +++ b/polymer/polymer.d.ts @@ -336,6 +336,7 @@ declare namespace polymer { RenderStatus: RenderStatus + /** @deprecated */ ImportStatus: ImportStatus } } From 5ac33397a5a829a29ca9a2b15c60f4d4028343fa Mon Sep 17 00:00:00 2001 From: Michael McKenzie Date: Tue, 25 Oct 2016 15:19:58 +0100 Subject: [PATCH 078/246] remove private methods from Renderstatus --- polymer/polymer.d.ts | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/polymer/polymer.d.ts b/polymer/polymer.d.ts index 984bf024b8..3d08e17111 100644 --- a/polymer/polymer.d.ts +++ b/polymer/polymer.d.ts @@ -306,16 +306,6 @@ declare namespace polymer { } interface RenderStatus { - _afterNextRenderQueue: [Element, Function, any][]; - _callbacks: Function[]; - _ready: boolean; - _waitingNextRender: boolean; - _catchFirstRender(): void; - _flushNextRender(): void; - _flushRenderCallbacks(callbacks: [Element, Function, any][]): void; - _makeReady(): void; - _watchNextRender(): void; - afterNextRender(element: Element, fn: Function, args?: any): void; hasRendered(): boolean; whenReady(cb: Function): void; From 31eb66a8ddb3870d008bc4259501049d8dedc8aa Mon Sep 17 00:00:00 2001 From: Andy Date: Wed, 26 Oct 2016 08:41:58 -0700 Subject: [PATCH 079/246] Improve README (#12133) --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7da7d1530b..c69d5135b5 100644 --- a/README.md +++ b/README.md @@ -149,14 +149,18 @@ and you may also add the `"jsx"` compiler option if your library needs it. DefinitelyTyped members routinely monitor for new PRs, though keep in mind that the number of other PRs may slow things down. +For a good example package, see [base64-js](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/types-2.0/base64-js). #### Common mistakes * First, follow advice from the [handbook](http://www.typescriptlang.org/docs/handbook/declaration-files/do-s-and-don-ts.html). * Formatting: Either use all tabs, or always use 4 spaces. Also, always use semicolons, and use egyptian braces. * `interface X {}`: An empty interface is essentially the `{}` type: it places no constraints on an object. -* `interface Foo { new(): Foo }`: +* `interface IFoo {}`: Don't add `I` to the front of an interface name. +* `interface Foo { new(): Foo; }`: This defines a type of objects that are new-able. You probably want `declare class Foo { constructor(); } +* `const Class: { new(): IClass; }`: + Prefer to use a class declaration `class Class { constructor(); }` instead of a new-able constant. * `namespace foo {}`: Do not add a namespace just so that the `import * as foo` syntax will work. If it is commonJs module with a single export, you should use the `import foo = require("foo")` syntax. @@ -194,7 +198,7 @@ Changes to the `master` branch are also manually merged into the `types-2.0` bra #### I'm writing a definition that depends on another definition. Should I use `` or an import? -If the module you're referencing is an written as an external module (uses `export`), use an import. +If the module you're referencing is an external module (uses `export`), use an import. If the module you're referenceing is an ambient module (uses `declare module`, or just declares globals), use ``. #### What do I do about older versions of typings? From 6685090e942ab78cc101b72a4472ec418a189f38 Mon Sep 17 00:00:00 2001 From: Andy Date: Wed, 26 Oct 2016 08:42:23 -0700 Subject: [PATCH 080/246] Fix tsconfig in readme (#12107) --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c69d5135b5..8caef8c8e2 100644 --- a/README.md +++ b/README.md @@ -128,7 +128,7 @@ The `Project` link does not have to be to GitHub, but prefer linking to a source "module": "commonjs", "target": "es6", "noImplicitAny": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" @@ -213,6 +213,10 @@ A `package.json` may be included for the sake of specifying dependencies. Here's We do not allow other fields, such as `"description"`, to be defined manually. Also, if you need to reference an older version of typings, you must do that by adding `"dependencies": { "@types/foo": "x.y.z" }` to the package.json. +#### I notice some `tsconfig.json` are missing `"noImplicitAny": true` or `"strictNullChecks": true`. + +Then they are wrong. You can help by submitting a pull request to fix them. + #### Definitions in types-2.0 seem written differently than in master. If you're targeting types-2.0, write it like the types-2.0 definitions. From 10685542728efb9dd1be9f6bbcc14c7451de2594 Mon Sep 17 00:00:00 2001 From: Andy Date: Wed, 26 Oct 2016 08:42:37 -0700 Subject: [PATCH 081/246] Write new pull request template (#12100) --- PULL_REQUEST_TEMPLATE.md | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/PULL_REQUEST_TEMPLATE.md b/PULL_REQUEST_TEMPLATE.md index 730bd78af2..053b2c3eae 100644 --- a/PULL_REQUEST_TEMPLATE.md +++ b/PULL_REQUEST_TEMPLATE.md @@ -1,8 +1,16 @@ -case 1. Add a new type definition. -- [ ] checked compilation succeeds with `--target es6` and `--noImplicitAny` options. -- [ ] has correct [naming convention](http://definitelytyped.org/guides/contributing.html#naming-the-file) -- [ ] has a [test file](http://definitelytyped.org/guides/contributing.html#tests) with the suffix of `-tests.ts` or `-tests.tsx`. +Please fill in this template. -case 2. Improvement to existing type definition. -- documentation or source code reference which provides context for the suggested changes. url http://api.jquery.com/html . - - it has been reviewed by a DefinitelyTyped member. +- [ ] Prefer to make your PR against the `types-2.0` branch. +- [ ] The package does not provide its own types, and you can not add them. +- [ ] Test the change in your own code. +- [ ] Follow the advice from the [readme](https://github.com/DefinitelyTyped/DefinitelyTyped#make-a-pull-request). +- [ ] Avoid [common mistakes](https://github.com/DefinitelyTyped/DefinitelyTyped#common-mistakes). + +If adding a new definition: +- [ ] If this is for an NPM package, match the name. If not, do not conflict with the name of an NPM package. +- [ ] Run `tsc` without errors. +- [ ] Include the required [files](https://github.com/DefinitelyTyped/DefinitelyTyped#create-a-new-package) and header. + +If changing an existing definition: +- [ ] Provide a URL to documentation or source code which provides context for the suggested changes: <> +- [ ] Increase the version number in the header if appropriate. From 4662d28b4aa01065db29d47059ab33183b83d3b2 Mon Sep 17 00:00:00 2001 From: Horiuchi_H Date: Thu, 27 Oct 2016 17:02:10 +0900 Subject: [PATCH 082/246] feat: update xml2js type definition --- xml2js/index.d.ts | 34 +++++----------------------- xml2js/tsconfig.json | 4 ++-- xml2js/xml2js-tests.ts | 50 +++++++++++++++++++++++++++++++++++++++--- 3 files changed, 54 insertions(+), 34 deletions(-) diff --git a/xml2js/index.d.ts b/xml2js/index.d.ts index e9d4e12ad0..0e180f7ba8 100644 --- a/xml2js/index.d.ts +++ b/xml2js/index.d.ts @@ -9,7 +9,7 @@ export = xml2js; declare namespace xml2js { function parseString(xml: string, callback: (err: any, result: any) => void): void; - function parseString(xml: string, options: Options, callback: (err: any, result: any) => void): void; + function parseString(xml: string, options: OptionsV2, callback: (err: any, result: any) => void): void; var defaults: { '0.1': Options; @@ -17,41 +17,15 @@ declare namespace xml2js { } class Builder { - constructor(options?: BuilderOptions); + constructor(options?: OptionsV2); buildObject(rootObj: any): string; } class Parser { - constructor(options?: Options); - processAsync(): any; - assignOrPush(obj: any, key: string, newValue: any): any; - reset(): any; + constructor(options?: OptionsV2); parseString(str: string, cb?: Function): void; } - interface RenderOptions { - indent?: string; - newline?: string; - pretty?: boolean; - } - - interface XMLDeclarationOptions { - encoding?: string; - standalone?: boolean; - version?: string; - } - - interface BuilderOptions { - doctype?: any; - headless?: boolean; - indent?: string; - newline?: string; - pretty?: boolean; - renderOpts?: RenderOptions; - rootName?: string; - xmldec?: XMLDeclarationOptions; - } - interface Options { async?: boolean; attrkey?: string; @@ -66,6 +40,7 @@ declare namespace xml2js { explicitChildren?: boolean; explicitRoot?: boolean; ignoreAttrs?: boolean; + includeWhiteChars?: boolean; mergeAttrs?: boolean; normalize?: boolean; normalizeTags?: boolean; @@ -96,3 +71,4 @@ declare namespace xml2js { cdata?: boolean; } } + diff --git a/xml2js/tsconfig.json b/xml2js/tsconfig.json index 61e4e5e52f..8e23bd3395 100644 --- a/xml2js/tsconfig.json +++ b/xml2js/tsconfig.json @@ -3,7 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" @@ -16,4 +16,4 @@ "index.d.ts", "xml2js-tests.ts" ] -} \ No newline at end of file +} diff --git a/xml2js/xml2js-tests.ts b/xml2js/xml2js-tests.ts index 3e3981156e..38306d9bb4 100644 --- a/xml2js/xml2js-tests.ts +++ b/xml2js/xml2js-tests.ts @@ -1,9 +1,35 @@ import xml2js = require('xml2js'); -xml2js.parseString("Hello xml2js!", (err: any, result: any) => { }); +xml2js.parseString('Hello xml2js!', (err: any, result: any) => { }); -xml2js.parseString("Hello xml2js!", {trim: true}, (err: any, result: any) => { }); +xml2js.parseString('Hello xml2js!', {trim: true}, (err: any, result: any) => { }); + +xml2js.parseString('Hello xml2js!', { + attrkey: '$', + charkey: '_', + explicitCharkey: false, + trim: false, + normalizeTags: false, + explicitRoot: true, + emptyTag: '', + explicitArray: true, + ignoreAttrs: false, + mergeAttrs: false, + validator: undefined, + xmlns: false, + explicitChildren: false, + childkey: '$$', + preserveChildrenOrder: false, + charsAsChildren: false, + includeWhiteChars: false, + async: false, + strict: true, + attrNameProcessors: undefined, + attrValueProcessors: undefined, + tagNameProcessors: undefined, + valueProcessors: undefined +}, (err: any, result: any) => { }); var builder = new xml2js.Builder({ renderOpts: { @@ -11,6 +37,23 @@ var builder = new xml2js.Builder({ } }); +var builder = new xml2js.Builder({ + rootName: 'root', + renderOpts: { + pretty: true, + indent: ' ', + newline: '\n' + }, + xmldec: { + version: '1.0', + encoding: 'UTF-8', + standalone: true + }, + doctype: { ext: 'hello.dtd' }, + headless: false, + cdata: false +}); + var outString = builder.buildObject({ 'hello': 'xml2js!' }); @@ -22,4 +65,5 @@ v1Defaults.async = true; var v2Defaults = xml2js.defaults['0.2']; v2Defaults.async = false; -v2Defaults.chunkSize = 20000; \ No newline at end of file +v2Defaults.chunkSize = 20000; + From a27693680c4fcde005f99ceeb2f4b1182c76ee7b Mon Sep 17 00:00:00 2001 From: Christian Rackerseder Date: Thu, 27 Oct 2016 11:21:39 +0200 Subject: [PATCH 083/246] Removed declare module "ora" --- ora/index.d.ts | 54 ++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/ora/index.d.ts b/ora/index.d.ts index 976005200b..e45a585442 100644 --- a/ora/index.d.ts +++ b/ora/index.d.ts @@ -5,32 +5,30 @@ /// -declare module "ora" { - type Color = 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'gray'; - interface Options { - text?: string; - spinner?: string | Spinner; - color?: Color; - interval?: number; - stream?: NodeJS.WritableStream; - enabled?: boolean; - } - interface Spinner { - interval?: number; - frames: string[]; - } - interface Instance { - start(): Instance; - stop(): Instance; - succeed(): Instance; - fail(): Instance; - stopAndPersist(symbol?: string): Instance; - clear(): Instance; - render(): Instance; - frame(): Instance; - text: string; - color: Color; - } - function ora(options: Options | string): Instance; - export = ora; +type Color = 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'gray'; +interface Options { + text?: string; + spinner?: string | Spinner; + color?: Color; + interval?: number; + stream?: NodeJS.WritableStream; + enabled?: boolean; } +interface Spinner { + interval?: number; + frames: string[]; +} +interface Instance { + start(): Instance; + stop(): Instance; + succeed(): Instance; + fail(): Instance; + stopAndPersist(symbol?: string): Instance; + clear(): Instance; + render(): Instance; + frame(): Instance; + text: string; + color: Color; +} +declare function ora(options: Options | string): Instance; +export = ora; From 6e4467c37963e826fbf47cc2460130aa83608503 Mon Sep 17 00:00:00 2001 From: Kostya Esmukov Date: Thu, 27 Oct 2016 15:35:59 +0300 Subject: [PATCH 084/246] react-router: added render prop and fixed applyRouterMiddleware types --- react-router/index.d.ts | 2 +- react-router/lib/Router.d.ts | 20 +++++++++++--------- react-router/lib/applyRouterMiddleware.d.ts | 8 +++++--- react-router/react-router-tests.tsx | 14 +++++++++++++- 4 files changed, 30 insertions(+), 14 deletions(-) diff --git a/react-router/index.d.ts b/react-router/index.d.ts index 8dfc205478..f85b121c6a 100644 --- a/react-router/index.d.ts +++ b/react-router/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for react-router v2.0.0 // Project: https://github.com/rackt/react-router -// Definitions by: Sergey Buturlakin , Yuichi Murata , Václav Ostrožlík , Nathan Brown , Alex Wendland +// Definitions by: Sergey Buturlakin , Yuichi Murata , Václav Ostrožlík , Nathan Brown , Alex Wendland , Kostya Esmukov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export as namespace ReactRouter; diff --git a/react-router/lib/Router.d.ts b/react-router/lib/Router.d.ts index c375f71513..5a4cfacb15 100644 --- a/react-router/lib/Router.d.ts +++ b/react-router/lib/Router.d.ts @@ -1,4 +1,5 @@ import * as React from 'react'; +import RouterContext from './RouterContext'; import { QueryString, Query, Location, LocationDescriptor, LocationState, @@ -48,16 +49,17 @@ declare namespace Router { components: RouteComponent[]; } - interface RouterProps extends React.Props { - history?: History; - routes?: RouteConfig; // alias for children - createElement?: (component: RouteComponent, props: Object) => any; - onError?: (error: any) => any; - onUpdate?: () => any; - parseQueryString?: ParseQueryString; - stringifyQuery?: StringifyQuery; + interface RouterProps extends React.Props { + history?: History; + routes?: RouteConfig; // alias for children + createElement?: (component: RouteComponent, props: Object) => any; + onError?: (error: any) => any; + onUpdate?: () => any; + parseQueryString?: ParseQueryString; + stringifyQuery?: StringifyQuery; basename?: string; - } + render?: (renderProps: React.Props<{}>) => RouterContext; + } interface PlainRoute { path?: RoutePattern; diff --git a/react-router/lib/applyRouterMiddleware.d.ts b/react-router/lib/applyRouterMiddleware.d.ts index a92384bba6..ed87d815db 100644 --- a/react-router/lib/applyRouterMiddleware.d.ts +++ b/react-router/lib/applyRouterMiddleware.d.ts @@ -1,7 +1,9 @@ import * as React from 'react'; +import Router from './Router'; +import RouterContext from './RouterContext'; export interface Middleware { - renderRouterContext: (previous: React.Props<{}>[], props: React.Props<{}>) => React.Props<{}>[]; - renderRouteComponent: (previous: React.Props<{}>[], props: React.Props<{}>) => React.Props<{}>[]; + renderRouterContext?: (previous: RouterContext, props: React.Props<{}>) => RouterContext; + renderRouteComponent?: (previous: Router.RouteComponent, props: React.Props<{}>) => Router.RouteComponent; } -export default function applyRouterMiddleware(...middlewares: Middleware[]): (renderProps: React.Props<{}>) => React.Props<{}>[]; +export default function applyRouterMiddleware(...middlewares: Middleware[]): (renderProps: React.Props<{}>) => RouterContext; diff --git a/react-router/react-router-tests.tsx b/react-router/react-router-tests.tsx index 77262bad50..77a0703462 100644 --- a/react-router/react-router-tests.tsx +++ b/react-router/react-router-tests.tsx @@ -2,7 +2,7 @@ import * as React from "react" import * as ReactDOM from "react-dom" import {renderToString} from "react-dom/server"; -import { browserHistory, hashHistory, match, createMemoryHistory, withRouter, routerShape, Router, Route, IndexRoute, InjectedRouter, Link, RouterOnContext, RouterContext} from "react-router"; +import { applyRouterMiddleware, browserHistory, hashHistory, match, createMemoryHistory, withRouter, routerShape, Router, Route, IndexRoute, InjectedRouter, Link, RouterOnContext, RouterContext} from "react-router"; interface MasterContext { router: RouterOnContext; @@ -105,3 +105,15 @@ const routes = ( match({history, routes, location: "baseurl"}, (error, redirectLocation, renderProps) => { renderToString(); }); + + +ReactDOM.render(( + child + })} + > + +), document.body); From 3b995c66f4276281c489558cec4f0519b2ea2d76 Mon Sep 17 00:00:00 2001 From: lucideer Date: Thu, 27 Oct 2016 21:42:46 +0100 Subject: [PATCH 085/246] Union types for possibly undefined return values See https://github.com/libxmljs/libxmljs/wiki --- libxmljs/index.d.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libxmljs/index.d.ts b/libxmljs/index.d.ts index bc33a4eec1..c928f57362 100644 --- a/libxmljs/index.d.ts +++ b/libxmljs/index.d.ts @@ -17,13 +17,13 @@ export declare function parseHtmlString(source: string): HTMLDocument; export declare class XMLDocument { constructor(version: number, encoding: string); - child(idx: number): Element; + child(idx: number): Element | undefined; childNodes(): Element[]; errors(): SyntaxError[]; encoding(): string; encoding(enc: string): void; find(xpath: string): Element[]; - get(xpath: string): Element; + get(xpath: string): Element | undefined; node(name: string, content: string): Element; root(): Element; toString(): string; @@ -48,7 +48,7 @@ export declare class Element { attrs(): Attribute[]; parent(): Element; doc(): XMLDocument; - child(idx: number): Element; + child(idx: number): Element | undefined; childNodes(): Element[]; addChild(child: Element): Element; nextSibling(): Element; @@ -60,9 +60,9 @@ export declare class Element { find(xpath: string): Element[]; find(xpath: string, ns_uri: string): Element[]; find(xpath: string, namespaces: { [key: string]: string; }): Element[]; - get(xpath: string): Element; - get(xpath: string, ns_uri: string): Element; - get(xpath: string, ns_uri: { [key: string]: string; }): Element; + get(xpath: string): Element | undefined; + get(xpath: string, ns_uri: string): Element | undefined; + get(xpath: string, ns_uri: { [key: string]: string; }): Element | undefined; defineNamespace(href: string): Namespace; defineNamespace(prefix: string, href: string): Namespace; namespace(): Namespace; From 737653ccb00bce0a39e2070a78a7105806ebd6f9 Mon Sep 17 00:00:00 2001 From: Casper Skydt Date: Fri, 28 Oct 2016 13:39:38 +0200 Subject: [PATCH 086/246] Added Kinises to AWS-SDK --- aws-sdk/aws-sdk-tests.ts | 39 ++++++++++++++++++++++++++++++ aws-sdk/index.d.ts | 52 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 90 insertions(+), 1 deletion(-) diff --git a/aws-sdk/aws-sdk-tests.ts b/aws-sdk/aws-sdk-tests.ts index 7d3b7a5c2c..5188a3e725 100644 --- a/aws-sdk/aws-sdk-tests.ts +++ b/aws-sdk/aws-sdk-tests.ts @@ -381,3 +381,42 @@ dynamoDBDocClient.query( else console.log(data); // successful response } ); + +var kinesis = new AWS.Kinesis(); + +var putRecordParam = { + Data: new Buffer('...') || 'STRING_VALUE', /* required */ + PartitionKey: 'STRING_VALUE', /* required */ + StreamName: 'STRING_VALUE', /* required */ + ExplicitHashKey: 'STRING_VALUE', + SequenceNumberForOrdering: 'STRING_VALUE' +}; +kinesis.putRecord(putRecordParam, function(err, data) { + if (err) console.log(err, err.stack); // an error occurred + else console.log(data); // successful response +}); + +var putRecordParams = { + Records: [ /* required */ + { + Data: new Buffer('...') || 'STRING_VALUE', /* required */ + PartitionKey: 'STRING_VALUE', /* required */ + ExplicitHashKey: 'STRING_VALUE' + }, + /* more items */ + ], + StreamName: 'STRING_VALUE' /* required */ +}; +kinesis.putRecords(putRecordParams, function(err, data) { + if (err) console.log(err, err.stack); // an error occurred + else console.log(data); // successful response +}); + +var increaseStreamRetentionPeriodParams = { + RetentionPeriodHours: 0, /* required */ + StreamName: 'STRING_VALUE' /* required */ +}; +kinesis.increaseStreamRetentionPeriod(increaseStreamRetentionPeriodParams, function(err, data) { + if (err) console.log(err, err.stack); // an error occurred + else console.log(data); // successful response +}); \ No newline at end of file diff --git a/aws-sdk/index.d.ts b/aws-sdk/index.d.ts index 7d70edf939..42919b3d57 100644 --- a/aws-sdk/index.d.ts +++ b/aws-sdk/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for aws-sdk // Project: https://github.com/aws/aws-sdk-js -// Definitions by: midknight41 +// Definitions by: midknight41 , Casper Skydt // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Imported from: https://github.com/soywiz/typescript-node-definitions/aws-sdk.d.ts @@ -335,6 +335,56 @@ export declare class SNS { publish(request: Sns.PublishRequest, callback: (err: any, data: any) => void): void; } +export class Kinesis { + constructor(options?: any); + endpoint: Endpoint; + + putRecord(params: KINESIS.PutRecordParams, callback: (error: Error, data: KINESIS.PutRecordResult) => void): void; + putRecords(params: KINESIS.PutRecordsParams, callback: (error: Error, data: KINESIS.PutRecordsResult) => void): void; + increaseStreamRetentionPeriod(params: KINESIS.IncreaseStreamRetentionPeriodParams, callback: (error: Error, data: any) => void): void; + } + + export module KINESIS { + export interface Record { + Data: Buffer | string | Blob; + PartitionKey: string; + ExplicitHashKey?: string; + } + + export interface RecordResult { + SequenceNumber: string; + ShardId: string; + ErrorCode: string; + ErrorMessage: string; + } + + export interface PutRecordParams extends Record { + StreamName: string; + SequenceNumberForOrdering?: string; + } + + export interface PutRecordResult { + ShardId: string; + SequenceNumber: string; + } + + export interface PutRecordsParams { + StreamName: string; + Records: Record[]; + } + + export interface PutRecordsResult { + FailedRecordCount: number; + Records: RecordResult[] + } + + export interface IncreaseStreamRetentionPeriodParams { + RetentionPeriodHours: number; + StreamName: string; + } + } + + export declare class SWF { constructor(options?: any); endpoint: Endpoint; From a37e6d24dcf6fbac1018317777fa5811eb6c8ddb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20S=C3=A1nchez?= Date: Fri, 28 Oct 2016 07:13:03 -0600 Subject: [PATCH 087/246] Make callback arguments non optional per best practices on callback signatures (#12238) --- immutable/immutable.d.ts | 80 ++++++++++++++++++++-------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/immutable/immutable.d.ts b/immutable/immutable.d.ts index 86f23bc6e3..f14986ee8d 100644 --- a/immutable/immutable.d.ts +++ b/immutable/immutable.d.ts @@ -258,11 +258,11 @@ declare namespace Immutable { * @see `Map#mergeWith` */ mergeWith( - merger: (previous?: T, next?: T, key?: number) => T, + merger: (previous: T, next: T, key: number) => T, ...iterables: Iterable.Indexed[] ): List; mergeWith( - merger: (previous?: T, next?: T, key?: number) => T, + merger: (previous: T, next: T, key: number) => T, ...iterables: Array[] ): List; @@ -276,11 +276,11 @@ declare namespace Immutable { * @see `Map#mergeDeepWith` */ mergeDeepWith( - merger: (previous?: T, next?: T, key?: number) => T, + merger: (previous: T, next: T, key: number) => T, ...iterables: Iterable.Indexed[] ): List; mergeDeepWith( - merger: (previous?: T, next?: T, key?: number) => T, + merger: (previous: T, next: T, key: number) => T, ...iterables: Array[] ): List; @@ -539,11 +539,11 @@ declare namespace Immutable { * */ mergeWith( - merger: (previous?: V, next?: V, key?: K) => V, + merger: (previous: V, next: V, key: K) => V, ...iterables: Iterable[] ): Map; mergeWith( - merger: (previous?: V, next?: V, key?: K) => V, + merger: (previous: V, next: V, key: K) => V, ...iterables: {[key: string]: V}[] ): Map; @@ -570,11 +570,11 @@ declare namespace Immutable { * */ mergeDeepWith( - merger: (previous?: V, next?: V, key?: K) => V, + merger: (previous: V, next: V, key: K) => V, ...iterables: Iterable[] ): Map; mergeDeepWith( - merger: (previous?: V, next?: V, key?: K) => V, + merger: (previous: V, next: V, key: K) => V, ...iterables: {[key: string]: V}[] ): Map; @@ -1457,7 +1457,7 @@ declare namespace Immutable { * */ mapKeys( - mapper: (key?: K, value?: V, iter?: this) => M, + mapper: (key: K, value: V, iter: this) => M, context?: any ): /*this*/Iterable.Keyed; @@ -1472,9 +1472,9 @@ declare namespace Immutable { */ mapEntries( mapper: ( - entry?: [K, V], - index?: number, - iter?: this + entry: [K, V], + index: number, + iter: this ) => [KM, VM], context?: any ): /*this*/Iterable.Keyed; @@ -1639,7 +1639,7 @@ declare namespace Immutable { * provided predicate function. Otherwise -1 is returned. */ findIndex( - predicate: (value?: T, index?: number, iter?: this) => boolean, + predicate: (value: T, index: number, iter: this) => boolean, context?: any ): number; @@ -1648,7 +1648,7 @@ declare namespace Immutable { * provided predicate function. Otherwise -1 is returned. */ findLastIndex( - predicate: (value?: T, index?: number, iter?: this) => boolean, + predicate: (value: T, index: number, iter: this) => boolean, context?: any ): number; } @@ -1969,7 +1969,7 @@ declare namespace Immutable { * */ map( - mapper: (value?: V, key?: K, iter?: this) => M, + mapper: (value: V, key: K, iter: this) => M, context?: any ): /*this*/Iterable; @@ -1982,7 +1982,7 @@ declare namespace Immutable { * */ filter( - predicate: (value?: V, key?: K, iter?: this) => boolean, + predicate: (value: V, key: K, iter: this) => boolean, context?: any ): this; @@ -1995,7 +1995,7 @@ declare namespace Immutable { * */ filterNot( - predicate: (value?: V, key?: K, iter?: this) => boolean, + predicate: (value: V, key: K, iter: this) => boolean, context?: any ): this; @@ -2031,7 +2031,7 @@ declare namespace Immutable { * */ sortBy( - comparatorValueMapper: (value?: V, key?: K, iter?: this) => C, + comparatorValueMapper: (value: V, key: K, iter: this) => C, comparator?: (valueA: C, valueB: C) => number ): this; @@ -2042,7 +2042,7 @@ declare namespace Immutable { * Note: This is always an eager operation. */ groupBy( - grouper: (value?: V, key?: K, iter?: this) => G, + grouper: (value: V, key: K, iter: this) => G, context?: any ): Seq.Keyed; @@ -2057,7 +2057,7 @@ declare namespace Immutable { * (including the last iteration which returned false). */ forEach( - sideEffect: (value?: V, key?: K, iter?: this) => any, + sideEffect: (value: V, key: K, iter: this) => any, context?: any ): number; @@ -2116,7 +2116,7 @@ declare namespace Immutable { * */ skipWhile( - predicate: (value?: V, key?: K, iter?: this) => boolean, + predicate: (value: V, key: K, iter: this) => boolean, context?: any ): this; @@ -2130,7 +2130,7 @@ declare namespace Immutable { * */ skipUntil( - predicate: (value?: V, key?: K, iter?: this) => boolean, + predicate: (value: V, key: K, iter: this) => boolean, context?: any ): this; @@ -2156,7 +2156,7 @@ declare namespace Immutable { * */ takeWhile( - predicate: (value?: V, key?: K, iter?: this) => boolean, + predicate: (value: V, key: K, iter: this) => boolean, context?: any ): this; @@ -2169,7 +2169,7 @@ declare namespace Immutable { * */ takeUntil( - predicate: (value?: V, key?: K, iter?: this) => boolean, + predicate: (value: V, key: K, iter: this) => boolean, context?: any ): this; @@ -2207,11 +2207,11 @@ declare namespace Immutable { * Similar to `iter.map(...).flatten(true)`. */ flatMap( - mapper: (value?: V, key?: K, iter?: this) => Iterable, + mapper: (value: V, key: K, iter: this) => Iterable, context?: any ): /*this*/Iterable; flatMap( - mapper: (value?: V, key?: K, iter?: this) => /*iterable-like*/any, + mapper: (value: V, key: K, iter: this) => /*iterable-like*/any, context?: any ): /*this*/Iterable; @@ -2228,7 +2228,7 @@ declare namespace Immutable { * @see `Array#reduce`. */ reduce( - reducer: (reduction?: R, value?: V, key?: K, iter?: this) => R, + reducer: (reduction: R, value: V, key: K, iter: this) => R, initialReduction?: R, context?: any ): R; @@ -2240,7 +2240,7 @@ declare namespace Immutable { * with `Array#reduceRight`. */ reduceRight( - reducer: (reduction?: R, value?: V, key?: K, iter?: this) => R, + reducer: (reduction: R, value: V, key: K, iter: this) => R, initialReduction?: R, context?: any ): R; @@ -2249,7 +2249,7 @@ declare namespace Immutable { * True if `predicate` returns true for all entries in the Iterable. */ every( - predicate: (value?: V, key?: K, iter?: this) => boolean, + predicate: (value: V, key: K, iter: this) => boolean, context?: any ): boolean; @@ -2257,7 +2257,7 @@ declare namespace Immutable { * True if `predicate` returns true for any entry in the Iterable. */ some( - predicate: (value?: V, key?: K, iter?: this) => boolean, + predicate: (value: V, key: K, iter: this) => boolean, context?: any ): boolean; @@ -2287,7 +2287,7 @@ declare namespace Immutable { */ count(): number; count( - predicate: (value?: V, key?: K, iter?: this) => boolean, + predicate: (value: V, key: K, iter: this) => boolean, context?: any ): number; @@ -2298,7 +2298,7 @@ declare namespace Immutable { * Note: This is not a lazy operation. */ countBy( - grouper: (value?: V, key?: K, iter?: this) => G, + grouper: (value: V, key: K, iter: this) => G, context?: any ): Seq.Keyed; @@ -2309,7 +2309,7 @@ declare namespace Immutable { * Returns the first value for which the `predicate` returns true. */ find( - predicate: (value?: V, key?: K, iter?: this) => boolean, + predicate: (value: V, key: K, iter: this) => boolean, context?: any, notSetValue?: V ): V; @@ -2320,7 +2320,7 @@ declare namespace Immutable { * Note: `predicate` will be called for each entry in reverse. */ findLast( - predicate: (value?: V, key?: K, iter?: this) => boolean, + predicate: (value: V, key: K, iter: this) => boolean, context?: any, notSetValue?: V ): V; @@ -2329,7 +2329,7 @@ declare namespace Immutable { * Returns the first [key, value] entry for which the `predicate` returns true. */ findEntry( - predicate: (value?: V, key?: K, iter?: this) => boolean, + predicate: (value: V, key: K, iter: this) => boolean, context?: any, notSetValue?: V ): [K, V]; @@ -2341,7 +2341,7 @@ declare namespace Immutable { * Note: `predicate` will be called for each entry in reverse. */ findLastEntry( - predicate: (value?: V, key?: K, iter?: this) => boolean, + predicate: (value: V, key: K, iter: this) => boolean, context?: any, notSetValue?: V ): [K, V]; @@ -2350,7 +2350,7 @@ declare namespace Immutable { * Returns the key for which the `predicate` returns true. */ findKey( - predicate: (value?: V, key?: K, iter?: this) => boolean, + predicate: (value: V, key: K, iter: this) => boolean, context?: any ): K; @@ -2360,7 +2360,7 @@ declare namespace Immutable { * Note: `predicate` will be called for each entry in reverse. */ findLastKey( - predicate: (value?: V, key?: K, iter?: this) => boolean, + predicate: (value: V, key: K, iter: this) => boolean, context?: any ): K; @@ -2399,7 +2399,7 @@ declare namespace Immutable { * */ maxBy( - comparatorValueMapper: (value?: V, key?: K, iter?: this) => C, + comparatorValueMapper: (value: V, key: K, iter: this) => C, comparator?: (valueA: C, valueB: C) => number ): V; @@ -2428,7 +2428,7 @@ declare namespace Immutable { * */ minBy( - comparatorValueMapper: (value?: V, key?: K, iter?: this) => C, + comparatorValueMapper: (value: V, key: K, iter: this) => C, comparator?: (valueA: C, valueB: C) => number ): V; From 8a84aefa0406e2002465fa460620d6449c58af01 Mon Sep 17 00:00:00 2001 From: Chris Khoo Date: Fri, 28 Oct 2016 06:25:13 -0700 Subject: [PATCH 088/246] set strictNullChecks to true in doc (#12242) From 5411d2e84a619b7a0aa493558fe8217ca06ceada Mon Sep 17 00:00:00 2001 From: Derek Louie Date: Fri, 28 Oct 2016 06:43:38 -0700 Subject: [PATCH 089/246] Adds the onCloseSuccess config to MdPanel and reveals absPosition enum (#12171) --- angular-material/angular-material.d.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/angular-material/angular-material.d.ts b/angular-material/angular-material.d.ts index da20af95fc..f100fd4d4b 100644 --- a/angular-material/angular-material.d.ts +++ b/angular-material/angular-material.d.ts @@ -339,6 +339,7 @@ declare namespace angular.material { onRemoving?: Function; onDomRemoved?: Function; origin?: string|JQuery|Element; + onCloseSuccess?: ((panel: IPanelRef, closeReason: string) => any); } interface IPanelRef { @@ -411,5 +412,15 @@ declare namespace angular.material { interceptorTypes: { CLOSE: string, }; + closeReasons: { + CLICK_OUTSIDE: string, + ESCAPE: string, + }; + absPosition: { + TOP: string, + RIGHT: string, + BOTTOM: string, + LEFT: string, + }; } } From 2ad9354d494da56f7d97a10ef1ad353b3656af35 Mon Sep 17 00:00:00 2001 From: PishangCode Date: Fri, 28 Oct 2016 21:44:12 +0800 Subject: [PATCH 090/246] added type definitions for node-billplz (#12041) * added type definitions for node-billplz * renamed folder node-billplz to billplz * renamed billplz-test.ts to billplz-tests.ts * update constructor type * update BillplzOptions interface * update create_bill test * change key to require * remove trailing comma * update callback type * update code pattern --- billplz/billplz-tests.ts | 46 +++++++++++++++++++++++ billplz/billplz.d.ts | 80 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 126 insertions(+) create mode 100644 billplz/billplz-tests.ts create mode 100644 billplz/billplz.d.ts diff --git a/billplz/billplz-tests.ts b/billplz/billplz-tests.ts new file mode 100644 index 0000000000..4f0e4633a2 --- /dev/null +++ b/billplz/billplz-tests.ts @@ -0,0 +1,46 @@ +/// + +import * as Billplz from 'billplz'; + +const billplz = new Billplz({ + key: 'your-api-key', + endpoint: 'http://localhost/', + sandbox: true +}); + +// test create collection +billplz.create_collection({ + title: 'your-title' +}); + +// test create open collection +billplz.create_collectionOpen({ + title: 'your-title', + description: 'your-description', + amount: 100 +}); + +// test create bill +billplz.create_bill({ + collection_id: 'your-collection-id', + description: 'your-description', + email: 'your-email', + mobile: 12345, + name: 'your-name', + amount: 100, + callback_url: 'https://example.com/webhook/', + redirect_url: 'https://example.com/done', + due_at: '0000-00-00' +}); + +// test get bill +billplz.get_bill('your-bill-id'); + +// test delete bill +billplz.delete_bill('your-bill-id'); + +// test change collection status +billplz.change_collection_status('your-collection-id', 'status-here'); + +// test registration check +billplz.registration_check('your-bank-account-number'); diff --git a/billplz/billplz.d.ts b/billplz/billplz.d.ts new file mode 100644 index 0000000000..53355f280b --- /dev/null +++ b/billplz/billplz.d.ts @@ -0,0 +1,80 @@ +// Type definitions for billplz 1.0.2 +// Project: https://github.com/suhz/node-billplz +// Definitions by: Akim +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module Billplz { + // api options type + interface BillplzOptions { + key: string; + endpoint?: string; + sandbox?: boolean; + } + + // collection type + interface CollectionArguments { + title: string; + } + + // open collection type + interface OpenCollectionArguments { + title: string; + description: string; + amount: number; + fixed_amount?: boolean; + fixed_quantity?: boolean; + payment_button?: string; + reference_1_label?: string + reference_2_label?: string; + email_link?: string; + tax?: number; + } + + // bill type + interface BillArguments { + collection_id: string; + email: string; + mobile: number; + name: string; + amount: number; + callback_url: string; + description: string; + due_at?: string; + redirect_url?: string; + deliver?: boolean; + reference_1_label?: string; + reference_1?: string; + reference_2_label?: string; + reference_2?: string; + } +} + +declare class Billplz { + // constructor + constructor(options: string | Billplz.BillplzOptions); + + // create_collection + create_collection(title: Billplz.CollectionArguments, callback?: (res: any, err: any) => void): void; + + // create collectionOpen + create_collectionOpen(args: Billplz.OpenCollectionArguments, callback?: (res: any, err: any) => void): void; + + // create bill + create_bill(args: Billplz.BillArguments, callback?: (res: any, err: any) => void): void; + + // get bill + get_bill(billId: string, callback?: (res: any, err: any) => void): void; + + // delete bill + delete_bill(billId: string, callback?: (res: any, err: any) => void): void; + + // change_collection status + change_collection_status(collectionId: string, status: string, callback?: (res: any, err: any) => void): void; + + // registration check + registration_check(bankAccountNumber: string, callback?: (res: any, err: any) => void): void; +} + +declare module "billplz" { + export = Billplz; +} From 38f3096f496105654c9e9e20551888e5bba2934a Mon Sep 17 00:00:00 2001 From: TonyYang Date: Fri, 28 Oct 2016 21:54:00 +0800 Subject: [PATCH 091/246] [node] Update events for child_process (#12260) * Update events for child_process * Add related tests --- node/node-tests.ts | 96 ++++++++++++++++++++++++++++++++++++++++++++++ node/node.d.ts | 52 +++++++++++++++++++++++++ 2 files changed, 148 insertions(+) diff --git a/node/node-tests.ts b/node/node-tests.ts index b11eb0526e..b0f724b8f4 100644 --- a/node/node-tests.ts +++ b/node/node-tests.ts @@ -1226,6 +1226,102 @@ namespace child_process_tests { childProcess.exec("echo test"); childProcess.spawnSync("echo test"); } + + { + let _cp: childProcess.ChildProcess; + let _boolean: boolean; + + _cp = _cp.addListener("close", (code, signal) => { + let _code: number = code; + let _signal: string = signal; + }) + _cp = _cp.addListener("disconnet", () => { }); + _cp = _cp.addListener("error", (err) => { + let _err: Error = err; + }) + _cp = _cp.addListener("exit", (code, signal) => { + let _code: number = code; + let _signal: string = signal; + }) + _cp = _cp.addListener("message", (message, sendHandle) => { + let _message: any = message; + let _sendHandle: net.Socket | net.Server = sendHandle; + }) + + _boolean = _cp.emit("close", () => { }); + _boolean = _cp.emit("disconnet", () => { }); + _boolean = _cp.emit("error", () => { }); + _boolean = _cp.emit("exit", () => { }); + _boolean = _cp.emit("message", () => { }); + + _cp = _cp.on("close", (code, signal) => { + let _code: number = code; + let _signal: string = signal; + }) + _cp = _cp.on("disconnet", () => { }); + _cp = _cp.on("error", (err) => { + let _err: Error = err; + }) + _cp = _cp.on("exit", (code, signal) => { + let _code: number = code; + let _signal: string = signal; + }) + _cp = _cp.on("message", (message, sendHandle) => { + let _message: any = message; + let _sendHandle: net.Socket | net.Server = sendHandle; + }) + + _cp = _cp.once("close", (code, signal) => { + let _code: number = code; + let _signal: string = signal; + }) + _cp = _cp.once("disconnet", () => { }); + _cp = _cp.once("error", (err) => { + let _err: Error = err; + }) + _cp = _cp.once("exit", (code, signal) => { + let _code: number = code; + let _signal: string = signal; + }) + _cp = _cp.once("message", (message, sendHandle) => { + let _message: any = message; + let _sendHandle: net.Socket | net.Server = sendHandle; + }) + + _cp = _cp.prependListener("close", (code, signal) => { + let _code: number = code; + let _signal: string = signal; + }) + _cp = _cp.prependListener("disconnet", () => { }); + _cp = _cp.prependListener("error", (err) => { + let _err: Error = err; + }) + _cp = _cp.prependListener("exit", (code, signal) => { + let _code: number = code; + let _signal: string = signal; + }) + _cp = _cp.prependListener("message", (message, sendHandle) => { + let _message: any = message; + let _sendHandle: net.Socket | net.Server = sendHandle; + }) + + _cp = _cp.prependOnceListener("close", (code, signal) => { + let _code: number = code; + let _signal: string = signal; + }) + _cp = _cp.prependOnceListener("disconnet", () => { }); + _cp = _cp.prependOnceListener("error", (err) => { + let _err: Error = err; + }) + _cp = _cp.prependOnceListener("exit", (code, signal) => { + let _code: number = code; + let _signal: string = signal; + }) + _cp = _cp.prependOnceListener("message", (message, sendHandle) => { + let _message: any = message; + let _sendHandle: net.Socket | net.Server = sendHandle; + }) + } } ////////////////////////////////////////////////////////////////////// diff --git a/node/node.d.ts b/node/node.d.ts index 1067e008c0..b14f18c5a6 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -1412,6 +1412,7 @@ declare module "vm" { declare module "child_process" { import * as events from "events"; import * as stream from "stream"; + import * as net from "net"; export interface ChildProcess extends events.EventEmitter { stdin: stream.Writable; @@ -1425,6 +1426,57 @@ declare module "child_process" { disconnect(): void; unref(): void; ref(): void; + + /** + * events.EventEmitter + * 1. close + * 2. disconnet + * 3. error + * 4. exit + * 5. message + **/ + + addListener(event: string, listener: Function): this; + addListener(event: "close", listener: (code: number, signal: string) => void): this; + addListener(event: "disconnet", listener: () => void): this; + addListener(event: "error", listener: (err: Error) => void): this; + addListener(event: "exit", listener: (code: number, signal: string) => void): this; + addListener(event: "message", listener: (message: any, sendHandle: net.Socket | net.Server) => void): this; + + emit(event: string, ...args: any[]): boolean; + emit(event: "close", code: number, signal: string): boolean; + emit(event: "disconnet"): boolean; + emit(event: "error", err: Error): boolean; + emit(event: "exit", code: number, signal: string): boolean; + emit(event: "message", message: any, sendHandle: net.Socket | net.Server): boolean; + + on(event: string, listener: Function): this; + on(event: "close", listener: (code: number, signal: string) => void): this; + on(event: "disconnet", listener: () => void): this; + on(event: "error", listener: (err: Error) => void): this; + on(event: "exit", listener: (code: number, signal: string) => void): this; + on(event: "message", listener: (message: any, sendHandle: net.Socket | net.Server) => void): this; + + once(event: string, listener: Function): this; + once(event: "close", listener: (code: number, signal: string) => void): this; + once(event: "disconnet", listener: () => void): this; + once(event: "error", listener: (err: Error) => void): this; + once(event: "exit", listener: (code: number, signal: string) => void): this; + once(event: "message", listener: (message: any, sendHandle: net.Socket | net.Server) => void): this; + + prependListener(event: string, listener: Function): this; + prependListener(event: "close", listener: (code: number, signal: string) => void): this; + prependListener(event: "disconnet", listener: () => void): this; + prependListener(event: "error", listener: (err: Error) => void): this; + prependListener(event: "exit", listener: (code: number, signal: string) => void): this; + prependListener(event: "message", listener: (message: any, sendHandle: net.Socket | net.Server) => void): this; + + prependOnceListener(event: string, listener: Function): this; + prependOnceListener(event: "close", listener: (code: number, signal: string) => void): this; + prependOnceListener(event: "disconnet", listener: () => void): this; + prependOnceListener(event: "error", listener: (err: Error) => void): this; + prependOnceListener(event: "exit", listener: (code: number, signal: string) => void): this; + prependOnceListener(event: "message", listener: (message: any, sendHandle: net.Socket | net.Server) => void): this; } export interface SpawnOptions { From 8791a14cc554925a0ab85eaf0ce3ba40662e9a2c Mon Sep 17 00:00:00 2001 From: TonyYang Date: Fri, 28 Oct 2016 21:54:20 +0800 Subject: [PATCH 092/246] [node] Update events for readline (#12261) * Update events for readline * update related tests --- node/node-tests.ts | 63 ++++++++++++++++++++++++++++++++++++++++++++ node/node.d.ts | 65 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 128 insertions(+) diff --git a/node/node-tests.ts b/node/node-tests.ts index b0f724b8f4..a21940cd7e 100644 --- a/node/node-tests.ts +++ b/node/node-tests.ts @@ -1200,6 +1200,69 @@ namespace readline_tests { readline.clearScreenDown(stream); } + + { + let _rl: readline.ReadLine; + let _boolean: boolean; + + _rl = _rl.addListener("close", () => { }); + _rl = _rl.addListener("line", (input) => { + let _input: any = input; + }) + _rl = _rl.addListener("pause", () => { }); + _rl = _rl.addListener("resume", () => { }); + _rl = _rl.addListener("SIGCONT", () => { }); + _rl = _rl.addListener("SIGINT", () => { }); + _rl = _rl.addListener("SIGTSTP", () => { }); + + _boolean = _rl.emit("close", () => { }); + _boolean = _rl.emit("line", () => { }); + _boolean = _rl.emit("pause", () => { }); + _boolean = _rl.emit("resume", () => { }); + _boolean = _rl.emit("SIGCONT", () => { }); + _boolean = _rl.emit("SIGINT", () => { }); + _boolean = _rl.emit("SIGTSTP", () => { }); + + _rl = _rl.on("close", () => { }); + _rl = _rl.on("line", (input) => { + let _input: any = input; + }) + _rl = _rl.on("pause", () => { }); + _rl = _rl.on("resume", () => { }); + _rl = _rl.on("SIGCONT", () => { }); + _rl = _rl.on("SIGINT", () => { }); + _rl = _rl.on("SIGTSTP", () => { }); + + _rl = _rl.once("close", () => { }); + _rl = _rl.once("line", (input) => { + let _input: any = input; + }) + _rl = _rl.once("pause", () => { }); + _rl = _rl.once("resume", () => { }); + _rl = _rl.once("SIGCONT", () => { }); + _rl = _rl.once("SIGINT", () => { }); + _rl = _rl.once("SIGTSTP", () => { }); + + _rl = _rl.prependListener("close", () => { }); + _rl = _rl.prependListener("line", (input) => { + let _input: any = input; + }) + _rl = _rl.prependListener("pause", () => { }); + _rl = _rl.prependListener("resume", () => { }); + _rl = _rl.prependListener("SIGCONT", () => { }); + _rl = _rl.prependListener("SIGINT", () => { }); + _rl = _rl.prependListener("SIGTSTP", () => { }); + + _rl = _rl.prependOnceListener("close", () => { }); + _rl = _rl.prependOnceListener("line", (input) => { + let _input: any = input; + }) + _rl = _rl.prependOnceListener("pause", () => { }); + _rl = _rl.prependOnceListener("resume", () => { }); + _rl = _rl.prependOnceListener("SIGCONT", () => { }); + _rl = _rl.prependOnceListener("SIGINT", () => { }); + _rl = _rl.prependOnceListener("SIGTSTP", () => { }); + } } //////////////////////////////////////////////////// diff --git a/node/node.d.ts b/node/node.d.ts index b14f18c5a6..ea7e913ea8 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -1348,6 +1348,71 @@ declare module "readline" { resume(): ReadLine; close(): void; write(data: string | Buffer, key?: Key): void; + + /** + * events.EventEmitter + * 1. close + * 2. line + * 3. pause + * 4. resume + * 5. SIGCONT + * 6. SIGINT + * 7. SIGTSTP + **/ + + addListener(event: string, listener: Function): this; + addListener(event: "close", listener: () => void): this; + addListener(event: "line", listener: (input: any) => void): this; + addListener(event: "pause", listener: () => void): this; + addListener(event: "resume", listener: () => void): this; + addListener(event: "SIGCONT", listener: () => void): this; + addListener(event: "SIGINT", listener: () => void): this; + addListener(event: "SIGTSTP", listener: () => void): this; + + emit(event: string, ...args: any[]): boolean; + emit(event: "close"): boolean; + emit(event: "line", input: any): boolean; + emit(event: "pause"): boolean; + emit(event: "resume"): boolean; + emit(event: "SIGCONT"): boolean; + emit(event: "SIGINT"): boolean; + emit(event: "SIGTSTP"): boolean; + + on(event: string, listener: Function): this; + on(event: "close", listener: () => void): this; + on(event: "line", listener: (input: any) => void): this; + on(event: "pause", listener: () => void): this; + on(event: "resume", listener: () => void): this; + on(event: "SIGCONT", listener: () => void): this; + on(event: "SIGINT", listener: () => void): this; + on(event: "SIGTSTP", listener: () => void): this; + + once(event: string, listener: Function): this; + once(event: "close", listener: () => void): this; + once(event: "line", listener: (input: any) => void): this; + once(event: "pause", listener: () => void): this; + once(event: "resume", listener: () => void): this; + once(event: "SIGCONT", listener: () => void): this; + once(event: "SIGINT", listener: () => void): this; + once(event: "SIGTSTP", listener: () => void): this; + + prependListener(event: string, listener: Function): this; + prependListener(event: "close", listener: () => void): this; + prependListener(event: "line", listener: (input: any) => void): this; + prependListener(event: "pause", listener: () => void): this; + prependListener(event: "resume", listener: () => void): this; + prependListener(event: "SIGCONT", listener: () => void): this; + prependListener(event: "SIGINT", listener: () => void): this; + prependListener(event: "SIGTSTP", listener: () => void): this; + + prependOnceListener(event: string, listener: Function): this; + prependOnceListener(event: "close", listener: () => void): this; + prependOnceListener(event: "line", listener: (input: any) => void): this; + prependOnceListener(event: "pause", listener: () => void): this; + prependOnceListener(event: "resume", listener: () => void): this; + prependOnceListener(event: "SIGCONT", listener: () => void): this; + prependOnceListener(event: "SIGINT", listener: () => void): this; + prependOnceListener(event: "SIGTSTP", listener: () => void): this; } export interface Completer { From 896f939be74ac31e376fe256f48edc23bebcabb6 Mon Sep 17 00:00:00 2001 From: TonyYang Date: Fri, 28 Oct 2016 21:55:20 +0800 Subject: [PATCH 093/246] [node] Update events for repl (#12262) * Update events for repl * Update related tests * Fix argument --- node/node-tests.ts | 31 +++++++++++++++++++++++++++++++ node/node.d.ts | 32 +++++++++++++++++++++++++++++++- 2 files changed, 62 insertions(+), 1 deletion(-) diff --git a/node/node-tests.ts b/node/node-tests.ts index a21940cd7e..b98b23ad69 100644 --- a/node/node-tests.ts +++ b/node/node-tests.ts @@ -22,6 +22,7 @@ import * as vm from "vm"; import * as string_decoder from "string_decoder"; import * as stream from "stream"; import * as timers from "timers"; +import * as repl from "repl"; // Specifically test buffer module regression. import {Buffer as ImportedBuffer, SlowBuffer as ImportedSlowBuffer} from "buffer"; @@ -1804,6 +1805,36 @@ namespace net_tests { } +///////////////////////////////////////////////////// +/// repl Tests : https://nodejs.org/api/repl.html /// +///////////////////////////////////////////////////// + +namespace repl_tests { + { + let _server: repl.REPLServer; + let _boolean: boolean; + let _ctx: any; + + _server = _server.addListener("exit", () => { }); + _server = _server.addListener("reset", () => { }); + + _boolean = _server.emit("exit", () => { }); + _boolean = _server.emit("reset", _ctx); + + _server = _server.on("exit", () => { }); + _server = _server.on("reset", () => { }); + + _server = _server.once("exit", () => { }); + _server = _server.once("reset", () => { }); + + _server = _server.prependListener("exit", () => { }); + _server = _server.prependListener("reset", () => { }); + + _server = _server.prependOnceListener("exit", () => { }); + _server = _server.prependOnceListener("reset", () => { }); + } +} + /***************************************************************************** * * * The following tests are the modules not mentioned in document but existed * diff --git a/node/node.d.ts b/node/node.d.ts index ea7e913ea8..fe56ba851a 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -1322,7 +1322,37 @@ declare module "repl" { export interface REPLServer extends readline.ReadLine { defineCommand(keyword: string, cmd: Function | { help: string, action: Function }): void; - displayPrompt(preserveCursor?: boolean): void + displayPrompt(preserveCursor?: boolean): void; + + /** + * events.EventEmitter + * 1. exit + * 2. reset + **/ + + addListener(event: string, listener: Function): this; + addListener(event: "exit", listener: () => void): this; + addListener(event: "reset", listener: Function): this; + + emit(event: string, ...args: any[]): boolean; + emit(event: "exit"): boolean; + emit(event: "reset", context: any): boolean; + + on(event: string, listener: Function): this; + on(event: "exit", listener: () => void): this; + on(event: "reset", listener: Function): this; + + once(event: string, listener: Function): this; + once(event: "exit", listener: () => void): this; + once(event: "reset", listener: Function): this; + + prependListener(event: string, listener: Function): this; + prependListener(event: "exit", listener: () => void): this; + prependListener(event: "reset", listener: Function): this; + + prependOnceListener(event: string, listener: Function): this; + prependOnceListener(event: "exit", listener: () => void): this; + prependOnceListener(event: "reset", listener: Function): this; } export function start(options: ReplOptions): REPLServer; From 0190982444ef670839deb3fde37a26c79dfce08e Mon Sep 17 00:00:00 2001 From: Edward Silverton Date: Fri, 28 Oct 2016 15:55:57 +0200 Subject: [PATCH 094/246] added setVRDisplay to VRControls and VREffect (#12008) * added setVRDisplay to VRControls and VREffect * return void --- threejs/three-vrcontrols.d.ts | 3 +++ threejs/three-vreffect.d.ts | 2 ++ 2 files changed, 5 insertions(+) diff --git a/threejs/three-vrcontrols.d.ts b/threejs/three-vrcontrols.d.ts index 1e0b018a6a..e1c9940cee 100644 --- a/threejs/three-vrcontrols.d.ts +++ b/threejs/three-vrcontrols.d.ts @@ -4,6 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// +/// declare namespace THREE { export class VRControls { @@ -16,5 +17,7 @@ declare namespace THREE { zeroSensor(): void; scale: number; + + setVRDisplay(display: VRDisplay): void; } } diff --git a/threejs/three-vreffect.d.ts b/threejs/three-vreffect.d.ts index 1e1684cc67..93f5e28acb 100644 --- a/threejs/three-vreffect.d.ts +++ b/threejs/three-vreffect.d.ts @@ -4,6 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// +/// declare namespace THREE { export class VREffect { @@ -15,6 +16,7 @@ declare namespace THREE { FovToNDCScaleOffset(fov: VRFov): VREffectOffset; FovPortToProjection(fov: VRFov, rightHanded: boolean, zNear: number, zFar: number): Matrix4; FovToProjection(fov: VRFov, rightHanded: boolean, zNear: number, zFar: number): Matrix4; + setVRDisplay(display: VRDisplay): void; } export interface VRFov{ From 94bd397fdaca6e705731f9cc3aa3c07091db92b3 Mon Sep 17 00:00:00 2001 From: Niels Kristian Hansen Skovmand Date: Fri, 28 Oct 2016 16:06:17 +0200 Subject: [PATCH 095/246] Removed typings for spotify-web-api-js because they are now integrated in the package. (#12145) --- .../spotify-web-api-js-tests.ts | 70 --- spotify-web-api-js/spotify-web-api-js.d.ts | 533 ------------------ 2 files changed, 603 deletions(-) delete mode 100644 spotify-web-api-js/spotify-web-api-js-tests.ts delete mode 100644 spotify-web-api-js/spotify-web-api-js.d.ts diff --git a/spotify-web-api-js/spotify-web-api-js-tests.ts b/spotify-web-api-js/spotify-web-api-js-tests.ts deleted file mode 100644 index 11fcf2b43b..0000000000 --- a/spotify-web-api-js/spotify-web-api-js-tests.ts +++ /dev/null @@ -1,70 +0,0 @@ -// Test for the type definitions for spotify-web-api-js -// Project: https://github.com/JMPerez/spotify-web-api-js -// Definitions by: Niels Kristian Hansen Skovmand -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -// This test-file assumes the following two d.ts files to be present. - -/// -/// - -var spotify = new SpotifyWebApi(); - -/** - * Tests getAlbums - */ -spotify.getAlbums(['1uw3ISK6Khq5xVWF1GWTjt', '5R8N32ocA6RqSxibt4W6x3'], { market: 'DK' }) -.then(results => { - results.albums.forEach(album => { - album.images.forEach(image => { - console.log('Image URL: ' + image.url.toUpperCase()); - }) - }); -}); - - - -/** - * Tests getAlbum with an error - */ -function albumSearchCallback(error: SpotifyWebApiJs.ErrorObject, results: SpotifyApi.SingleAlbumResponse) { - console.log(error.status.toString() + " - message is: " + error.statusText); -}; - -spotify.getAlbum('xxx1uw3ISK6Khq5xVWF1GWTjt', albumSearchCallback); - - - -/** - * Tests getCategories with a callback - */ -function trackSearchCallback(error: SpotifyWebApiJs.ErrorObject, results: SpotifyApi.TrackSearchResponse) { - console.log("Found a total of " + results.tracks.total + " tracks"); - var onlyExplicitTracks = results.tracks.items.filter(track => { - return track.explicit; - }); - onlyExplicitTracks.forEach(track => console.log(track.name)); -}; - -spotify.searchTracks("Love itself", {limit: 5, market: 'DK'}, trackSearchCallback); - - -/** - * Tests getting a users public profile - */ -spotify.getUser('physicaltunes') -.then(results => { - console.log(results.id.toUpperCase(), - 'Followers: ' + results.followers.total.toString()); -}); - - -/** - * Tests getting top tracks - */ -spotify.getArtistTopTracks('07QEuhtrNmmZ0zEcqE9SF6', 'DK') -.then(results => { - results.tracks.forEach(track => { - console.log(track.name, track.artists.shift().name); - }) -}); \ No newline at end of file diff --git a/spotify-web-api-js/spotify-web-api-js.d.ts b/spotify-web-api-js/spotify-web-api-js.d.ts deleted file mode 100644 index 817626199c..0000000000 --- a/spotify-web-api-js/spotify-web-api-js.d.ts +++ /dev/null @@ -1,533 +0,0 @@ -// Type definitions for spotify-web-api-js -// Project: https://github.com/JMPerez/spotify-web-api-js -// Definitions by: Niels Kristian Hansen Skovmand -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - -/** - * Declare SpotifyWebApi variable, sincle that is the name of the function in spotify-web-api-js. - */ -declare var SpotifyWebApi: SpotifyWebApiJs.SpotifyWebApiJsStatic; - -declare namespace SpotifyWebApiJs { - /** - * An optional callback that receives 2 parameters. The first - * one is the error object (null if no error), and the second is the value if the request succeeded. - */ - interface ResultsCallback { - (error: ErrorObject, value: T) : any - } - - /** - * Describes the regular error object: https://developer.spotify.com/web-api/user-guide/#error-details - */ - interface ErrorObject { - status: number, - response: string, - statusText: string - } - - /** - * Describes the static side of SpotifyApi. Get a new instance of the SpotifyApi. - */ - interface SpotifyWebApiJsStatic { - new(): SpotifyApiJs; - } - - /** - * Describes an instance of SpotifyApi - */ - interface SpotifyApiJs { - /** - * Fetches a resource through a generic GET request. - * - * @param url The URL to be fetched - * @param callback An optional callback - */ - getGeneric(url: string, callback?: ResultsCallback) : Promise; - - /** - * Fetches information about the current user. - * See [Get Current User's Profile](https://developer.spotify.com/web-api/get-current-users-profile/) - * - * @param options A JSON object with options that can be passed - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. - */ - getMe(options?: Object, callback?: ResultsCallback) : Promise; - - /** - * Fetches current user's saved tracks. - * See [Get Current User's Saved Tracks](https://developer.spotify.com/web-api/get-users-saved-tracks/) - * - * @param options A JSON object with options that can be passed - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. - */ - getMySavedTracks(options?: Object, callback?: ResultsCallback) : Promise; - - /** - * Adds a list of tracks to the current user's saved tracks. - * See [Save Tracks for Current User](https://developer.spotify.com/web-api/save-tracks-user/) - * - * @param trackIds The ids of the tracks. If you know their Spotify URI it is easy to find their track id (e.g. spotify:track:) - * @param options A JSON object with options that can be passed - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. - */ - addToMySavedTracks(trackIds: string[], options?: Object, callback?: ResultsCallback) : Promise; - - /** - * Remove a list of tracks from the current user's saved tracks. - * See [Remove Tracks for Current User](https://developer.spotify.com/web-api/remove-tracks-user/) - * - * @param trackIds The ids of the tracks. If you know their Spotify URI it is easy to find their track id (e.g. spotify:track:) - * @param options A JSON object with options that can be passed - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. - */ - removeFromMySavedTracks(trackIds: string[], options?: Object, callback?: ResultsCallback) : Promise; - - /** - * Checks if the current user's saved tracks contains a certain list of tracks. - * See [Check Current User's Saved Tracks](https://developer.spotify.com/web-api/check-users-saved-tracks/) on the Spotify Developer site for more information about the endpoint. - * - * @param trackIds The ids of the tracks. If you know their Spotify URI it is easy to find their track id (e.g. spotify:track:) - * @param options A JSON object with options that can be passed - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. - */ - containsMySavedTracks(trackIds: string[], options?: Object, callback?: ResultsCallback) : Promise; - - /** - * Adds the current user as a follower of one or more other Spotify users. - * See [Follow Artists or Users](https://developer.spotify.com/web-api/follow-artists-users/) on the Spotify Developer site for more information about the endpoint. - * - * @param userIds The ids of the users. If you know their Spotify URI it is easy to find their user id (e.g. spotify:user:) - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. one is the error object (null if no error), and the second is an empty value if the request succeeded. - */ - followUsers(userIds: string[], callback?: ResultsCallback) : Promise; - - /** - * Adds the current user as a follower of one or more artists. - * See [Follow Artists or Users](https://developer.spotify.com/web-api/follow-artists-users/) on the Spotify Developer site for more information about the endpoint. - * - * @param artistIds The ids of the artists. If you know their Spotify URI it is easy to find their artist id (e.g. spotify:artist:) - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. one is the error object (null if no error), and the second is an empty value if the request succeeded. - */ - followArtists(artistIds: string[], callback?: ResultsCallback) : Promise; - - /** - * Add the current user as a follower of one playlist. - * See [Follow a Playlist](https://developer.spotify.com/web-api/follow-playlist/) on the Spotify Developer site for more information about the endpoint. - * - * @param ownerId The id of the playlist owner. If you know the Spotify URI of the playlist, it is easy to find the owner's user id (e.g. spotify:user::playlist:xxxx) - * @param playlistId The id of the playlist. If you know the Spotify URI it is easy to find the playlist id (e.g. spotify:user:xxxx:playlist:) - * @param options A JSON object with options that can be passed. For instance, whether you want the playlist to be followed privately ({public: false}) - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. - */ - followPlaylist(ownerId: string, playlistId: string, options?: Object, callback?: ResultsCallback) : Promise; - - /** - * Removes the current user as a follower of one or more other Spotify users. - * See [Unfollow Artists or Users](https://developer.spotify.com/web-api/unfollow-artists-users/) on the Spotify Developer site for more information about the endpoint. - * - * @param userIds The ids of the users. If you know their Spotify URI it is easy to find their user id (e.g. spotify:user:) - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. - */ - unfollowUsers(userIds: string[], callback?: ResultsCallback) : Promise; - - /** - * Removes the current user as a follower of one or more artists. - * See [Unfollow Artists or Users](https://developer.spotify.com/web-api/unfollow-artists-users/) on the Spotify Developer site for more information about the endpoint. - * - * @param artistIds The ids of the artists. If you know their Spotify URI it is easy to find their artist id (e.g. spotify:artist:) - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. - */ - unfollowArtists(artistIds: string[], callback?: ResultsCallback) : Promise; - - /** - * Remove the current user as a follower of one playlist. - * See [Unfollow a Playlist](https://developer.spotify.com/web-api/unfollow-playlist/) on the Spotify Developer site for more information about the endpoint. - * - * @param ownerId The id of the playlist owner. If you know the Spotify URI of the playlist, it is easy to find the owner's user id (e.g. spotify:user::playlist:xxxx) - * @param playlistId The id of the playlist. If you know the Spotify URI it is easy to find the playlist id (e.g. spotify:user:xxxx:playlist:) - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. - */ - unfollowPlaylist(ownerId: string, playlistId: string, callback?: ResultsCallback) : Promise; - - /** - * Checks to see if the current user is following one or more other Spotify users. - * See [Check if Current User Follows Users or Artists](https://developer.spotify.com/web-api/check-current-user-follows/) on the Spotify Developer site for more information about the endpoint. - * - * @param userIds The ids of the users. If you know their Spotify URI it is easy to find their user id (e.g. spotify:user:) - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. - */ - isFollowingUsers(userIds: string[], callback?: ResultsCallback) : Promise - - /** - * Checks to see if the current user is following one or more artists. - * See [Check if Current User Follows](https://developer.spotify.com/web-api/check-current-user-follows/) on the Spotify Developer site for more information about the endpoint. - * - * @param artistIds The ids of the artists. If you know their Spotify URI it is easy to find their artist id (e.g. spotify:artist:) - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. - */ - isFollowingArtists(artistIds: string[], callback?: ResultsCallback) : Promise; - - /** - * Check to see if one or more Spotify users are following a specified playlist. - * See [Check if Users Follow a Playlist](https://developer.spotify.com/web-api/check-user-following-playlist/) on the Spotify Developer site for more information about the endpoint. - * - * @param ownerId The id of the playlist owner. If you know the Spotify URI of the playlist, it is easy to find the owner's user id (e.g. spotify:user::playlist:xxxx) - * @param playlistId The id of the playlist. If you know the Spotify URI it is easy to find the playlist id (e.g. spotify:user:xxxx:playlist:) - * @param userIds The ids of the users. If you know their Spotify URI it is easy to find their user id (e.g. spotify:user:) - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. - */ - areFollowingPlaylist(ownerId: string, playlistId: string, userIds: string[], callback?: ResultsCallback) : Promise; - - /** - * Get the current user's followed artists. - * See [Get User's Followed Artists](https://developer.spotify.com/web-api/get-followed-artists/) on the Spotify Developer site for more information about the endpoint. - * - * @param options Options, being after and limit. - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. - */ - getFollowedArtists(options?: Object, callback?: ResultsCallback) : Promise; - - /** - * Fetches information about a specific user. - * See [Get a User's Profile](https://developer.spotify.com/web-api/get-users-profile/) on the Spotify Developer site for more information about the endpoint. - * - * @param userId The id of the user. If you know the Spotify URI it is easy to find the id (e.g. spotify:user:) - * @param options A JSON object with options that can be passed - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. - */ - getUser(userId: string, options?: Object, callback?: ResultsCallback) : Promise; - - /** - * Fetches a list of the current user's playlists. - * See [Get a List of a User's Playlists](https://developer.spotify.com/web-api/get-list-users-playlists/) on the Spotify Developer site for more information about the endpoint. - * - * @param userId The id of the user. If you know the Spotify URI it is easy to find the id (e.g. spotify:user:) - * @param options A JSON object with options that can be passed - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. - */ - getUserPlaylists(userId: string, options?: Object, callback?: ResultsCallback) : Promise; - - /** - * Fetches a specific playlist. - * See [Get a Playlist](https://developer.spotify.com/web-api/get-playlist/) on the Spotify Developer site for more information about the endpoint. - * - * @param userId The id of the user. If you know the Spotify URI it is easy to find the user id (e.g. spotify:user::playlist:xxxx) - * @param playlistId The id of the playlist. If you know the Spotify URI it is easy to find the playlist id (e.g. spotify:user:xxxx:playlist:) - * @param options A JSON object with options that can be passed - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. - */ - getPlaylist(userId: string, playlistId: string, options?: Object, callback?: ResultsCallback) : Promise; - - /** - * Fetches the tracks from a specific playlist. - * See [Get a Playlist's Tracks](https://developer.spotify.com/web-api/get-playlists-tracks/) on the Spotify Developer site for more information about the endpoint. - * - * @param userId The id of the user. If you know the Spotify URI it is easy to find the user id (e.g. spotify:user::playlist:xxxx) - * @param playlistId The id of the playlist. If you know the Spotify URI it is easy to find the playlist id (e.g. spotify:user:xxxx:playlist:) - * @param options A JSON object with options that can be passed - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. - */ - getPlaylistTracks(userId: string, playlistId: string, options?: Object, callback?: ResultsCallback) : Promise; - - /** - * Creates a playlist and stores it in the current user's library. - * See [Create a Playlist](https://developer.spotify.com/web-api/create-playlist/) on the Spotify Developer site for more information about the endpoint. - * - * @param userId The id of the user. You may want to user the "getMe" function to find out the id of the current logged in user - * @param options A JSON object with options that can be passed - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. - */ - createPlaylist(userId: string, options?: Object, callback?: ResultsCallback) : Promise; - - /** - * Change a playlist's name and public/private state - * See [Change a Playlist's Details](https://developer.spotify.com/web-api/change-playlist-details/) on the Spotify Developer site for more information about the endpoint. - * - * @param userId The id of the user. You may want to user the "getMe" function to find out the id of the current logged in user - * @param playlistId The id of the playlist. If you know the Spotify URI it is easy to find the playlist id (e.g. spotify:user:xxxx:playlist:) - * @param data A JSON object with the data to update. E.g. {name: 'A new name', public: true} - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. - */ - changePlaylistDetails(userId: string, playlistId: string, data: Object, callback?: ResultsCallback) : Promise; - - /** - * Add tracks to a playlist. - * See [Add Tracks to a Playlist](https://developer.spotify.com/web-api/add-tracks-to-playlist/) on the Spotify Developer site for more information about the endpoint. - * - * @param userId The id of the user. If you know the Spotify URI it is easy to find the user id (e.g. spotify:user::playlist:xxxx) - * @param playlistId The id of the playlist. If you know the Spotify URI it is easy to find the playlist id (e.g. spotify:user:xxxx:playlist:) - * @param uris An array of Spotify URIs for the tracks - * @param options A JSON object with options that can be passed - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. - */ - addTracksToPlaylist(userId: string, playlistId: string, uris: string[], options?: Object, callback?: ResultsCallback) : Promise; - - /** - * Replace the tracks of a playlist - * See [Replace a Playlist's Tracks](https://developer.spotify.com/web-api/replace-playlists-tracks/) on the Spotify Developer site for more information about the endpoint. - * - * @param userId The id of the user. If you know the Spotify URI it is easy to find the user id (e.g. spotify:user::playlist:xxxx) - * @param playlistId The id of the playlist. If you know the Spotify URI it is easy to find the playlist id (e.g. spotify:user:xxxx:playlist:) - * @param uris An array of Spotify URIs for the tracks - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. - */ - replaceTracksInPlaylist(userId: string, playlistId: string, uris: string[], callback?: ResultsCallback) : Promise; - - /** - * Reorder tracks in a playlist - * See [Reorder a Playlist’s Tracks](https://developer.spotify.com/web-api/reorder-playlists-tracks/) on the Spotify Developer site for more information about the endpoint. - * - * @param userId The id of the user. If you know the Spotify URI it is easy to find the user id (e.g. spotify:user::playlist:xxxx) - * @param playlistId The id of the playlist. If you know the Spotify URI it is easy to find the playlist id (e.g. spotify:user:xxxx:playlist:) - * @param rangeStart The position of the first track to be reordered. - * @param insertBefore The position where the tracks should be inserted. To reorder the tracks to the end of the playlist, simply set insert_before to the position after the last track. - * @param options An object with optional parameters (range_length, snapshot_id) - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. - */ - reorderTracksInPlaylist(userId: string, playlistId: string, rangeStart: number, insertBefore: number, options?: Object, callback?: ResultsCallback) : Promise; - - /** - * Remove tracks from a playlist - * See [Remove Tracks from a Playlist](https://developer.spotify.com/web-api/remove-tracks-playlist/) on the Spotify Developer site for more information about the endpoint. - * - * @param userId The id of the user. If you know the Spotify URI it is easy to find the user id (e.g. spotify:user::playlist:xxxx) - * @param playlistId The id of the playlist. If you know the Spotify URI it is easy to find the playlist id (e.g. spotify:user:xxxx:playlist:) - * @param uris An array of tracks to be removed. Each element of the array can be either a string, in which case it is treated as a URI, or an object containing the properties `uri` (which is a string) and `positions` (which is an array of integers). - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. - */ - removeTracksFromPlaylist(userId: string, playlistId: string, uris: Object[], callback?: ResultsCallback) : Promise; - - /** - * Remove tracks from a playlist, specifying a snapshot id. - * See [Remove Tracks from a Playlist](https://developer.spotify.com/web-api/remove-tracks-playlist/) on the Spotify Developer site for more information about the endpoint. - * - * @param userId The id of the user. If you know the Spotify URI it is easy to find the user id (e.g. spotify:user::playlist:xxxx) - * @param playlistId The id of the playlist. If you know the Spotify URI it is easy to find the playlist id (e.g. spotify:user:xxxx:playlist:) - * @param uris An array of tracks to be removed. Each element of the array can be either a string, in which case it is treated as a URI, or an object containing the properties `uri` (which is a string) and `positions` (which is an array of integers). - * @param snapshotId The playlist's snapshot ID against which you want to make the changes - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. - */ - removeTracksFromPlaylistWithSnapshotId(userId: string, playlistId: string, uris: Object[], snapshotId: string, callback?: ResultsCallback) : Promise; - - /** - * Remove tracks from a playlist, specifying the positions of the tracks to be removed. - * See [Remove Tracks from a Playlist](https://developer.spotify.com/web-api/remove-tracks-playlist/) on - * the Spotify Developer site for more information about the endpoint. - * @param userId The id of the user. If you know the Spotify URI it is easy - * to find the user id (e.g. spotify:user::playlist:xxxx) - * @param playlistId The id of the playlist. If you know the Spotify URI it is easy to find the playlist id (e.g. spotify:user:xxxx:playlist:) - * @param positions array of integers containing the positions of the tracks to remove from the playlist. - * @param snapshotId The playlist's snapshot ID against which you want to make the changes - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. - */ - removeTracksFromPlaylistInPositions(userId: string, playlistId: string, positions: number[], snapshotId: string, callback?: ResultsCallback) : Promise; - - /** - * Fetches an album from the Spotify catalog. - * See [Get an Album](https://developer.spotify.com/web-api/get-album/) on the Spotify Developer site for more information about the endpoint. - * - * @param albumId The id of the album. If you know the Spotify URI it is easy to find the album id (e.g. spotify:album:) - * @param options A JSON object with options that can be passed - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. - */ - getAlbum(albumId: string, options?: Object, callback?: ResultsCallback) : Promise; - - /** - * Fetches the tracks of an album from the Spotify catalog. - * See [Get an Album's Tracks](https://developer.spotify.com/web-api/get-albums-tracks/) on the Spotify Developer site for more information about the endpoint. - * - * @param albumId The id of the album. If you know the Spotify URI it is easy to find the album id (e.g. spotify:album:) - * @param options A JSON object with options that can be passed - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. - */ - getAlbumTracks(albumId: string, options?: Object, callback?: ResultsCallback) : Promise; - - /** - * Fetches multiple albums from the Spotify catalog. - * See [Get Several Albums](https://developer.spotify.com/web-api/get-several-albums/) on the Spotify Developer site for more information about the endpoint. - * - * @param albumIds The ids of the albums. If you know their Spotify URI it is easy to find their album id (e.g. spotify:album:) - * @param options A JSON object with options that can be passed - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. - */ - getAlbums(albumIds: string[], options?: Object, callback?: ResultsCallback) : Promise; - - /** - * Fetches a track from the Spotify catalog. - * See [Get a Track](https://developer.spotify.com/web-api/get-track/) on the Spotify Developer site for more information about the endpoint. - * - * @param trackId The id of the track. If you know the Spotify URI it is easy to find the track id (e.g. spotify:track:) - * @param options A JSON object with options that can be passed - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. - */ - getTrack(trackId: string, options?: Object, callback?: ResultsCallback) : Promise; - - /** - * Fetches multiple tracks from the Spotify catalog. - * See [Get Several Tracks](https://developer.spotify.com/web-api/get-several-tracks/) on - * the Spotify Developer site for more information about the endpoint. - * @param trackIds The ids of the tracks. If you know their Spotify URI it is easy to find their track id (e.g. spotify:track:) - * @param options A JSON object with options that can be passed - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. - */ - getTracks(trackIds: string[], options?: Object, callback?: ResultsCallback) : Promise; - - /** - * Fetches an artist from the Spotify catalog. - * See [Get an Artist](https://developer.spotify.com/web-api/get-artist/) on the Spotify Developer site for more information about the endpoint. - * - * @param artistId The id of the artist. If you know the Spotify URI it is easy to find the artist id (e.g. spotify:artist:) - * @param options A JSON object with options that can be passed - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. - */ - getArtist(artistId: string, options?: Object, callback?: ResultsCallback) : Promise; - - /** - * Fetches multiple artists from the Spotify catalog. - * See [Get Several Artists](https://developer.spotify.com/web-api/get-several-artists/) on the Spotify Developer site for more information about the endpoint. - * - * @param artistIds The ids of the artists. If you know their Spotify URI it is easy to find their artist id (e.g. spotify:artist:) - * @param options A JSON object with options that can be passed - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. - */ - getArtists(artistIds: string[], options?: Object, callback?: ResultsCallback) : Promise; - - /** - * Fetches the albums of an artist from the Spotify catalog. - * See [Get an Artist's Albums](https://developer.spotify.com/web-api/get-artists-albums/) on the Spotify Developer site for more information about the endpoint. - * - * @param artistId The id of the artist. If you know the Spotify URI it is easy to find the artist id (e.g. spotify:artist:) - * @param options A JSON object with options that can be passed - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. - */ - getArtistAlbums(artistId: string, options?: Object, callback?: ResultsCallback) : Promise; - - /** - * Fetches a list of top tracks of an artist from the Spotify catalog, for a specific country. - * See [Get an Artist's Top Tracks](https://developer.spotify.com/web-api/get-artists-top-tracks/) on the Spotify Developer site for more information about the endpoint. - * - * @param artistId The id of the artist. If you know the Spotify URI it is easy to find the artist id (e.g. spotify:artist:) - * @param countryId The id of the country (e.g. ES for Spain or US for United States) - * @param options A JSON object with options that can be passed - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. - */ - getArtistTopTracks(artistId: string, countryId: string, options?: Object, callback?: ResultsCallback) : Promise; - - /** - * Fetches a list of artists related with a given one from the Spotify catalog. - * See [Get an Artist's Related Artists](https://developer.spotify.com/web-api/get-related-artists/) on the Spotify Developer site for more information about the endpoint. - * - * @param artistId The id of the artist. If you know the Spotify URI it is easy to find the artist id (e.g. spotify:artist:) - * @param options A JSON object with options that can be passed - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. - */ - getArtistRelatedArtists(artistId: string, options?: Object, callback?: ResultsCallback) : Promise; - - /** - * Fetches a list of Spotify featured playlists (shown, for example, on a Spotify player's "Browse" tab). - * See [Get a List of Featured Playlists](https://developer.spotify.com/web-api/get-list-featured-playlists/) on the Spotify Developer site for more information about the endpoint. - * - * @param options A JSON object with options that can be passed - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. - */ - getFeaturedPlaylists(options?: Object, callback?: ResultsCallback) : Promise; - - /** - * Fetches a list of new album releases featured in Spotify (shown, for example, on a Spotify player's "Browse" tab). - * See [Get a List of New Releases](https://developer.spotify.com/web-api/get-list-new-releases/) on the Spotify Developer site for more information about the endpoint. - * - * @param options A JSON object with options that can be passed - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. - */ - getNewReleases(options?: Object, callback?: ResultsCallback) : Promise; - - /** - * Get a list of categories used to tag items in Spotify (on, for example, the Spotify player's "Browse" tab). - * See [Get a List of Categories](https://developer.spotify.com/web-api/get-list-categories/) on the Spotify Developer site for more information about the endpoint. - * - * @param options A JSON object with options that can be passed - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. - */ - getCategories(options?: Object, callback?: ResultsCallback) : Promise; - - /** - * Get a single category used to tag items in Spotify (on, for example, the Spotify player's "Browse" tab). - * See [Get a Category](https://developer.spotify.com/web-api/get-category/) on the Spotify Developer site for more information about the endpoint. - * - * @param categoryId The id of the category. These can be found with the getCategories function - * @param options A JSON object with options that can be passed - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. - */ - getCategory(categoryId: string, options?: Object, callback?: ResultsCallback) : Promise; - - /** - * Get a list of Spotify playlists tagged with a particular category. - * See [Get a Category's Playlists](https://developer.spotify.com/web-api/get-categorys-playlists/) on the Spotify Developer site for more information about the endpoint. - * - * @param categoryId The id of the category. These can be found with the getCategories function - * @param options A JSON object with options that can be passed - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. - */ - getCategoryPlaylists(categoryId: string, options?: Object, callback?: ResultsCallback) : Promise; - - /** - * Fetches albums from the Spotify catalog according to a query. - * See [Search for an Item](https://developer.spotify.com/web-api/search-item/) on the Spotify Developer site for more information about the endpoint. - * - * @param query The search query - * @param options A JSON object with options that can be passed - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. - */ - searchAlbums(query: string, options?: SpotifyApi.SearchForItemParameterObject, callback?: ResultsCallback) : Promise; - - /** - * Fetches artists from the Spotify catalog according to a query. - * See [Search for an Item](https://developer.spotify.com/web-api/search-item/) on the Spotify Developer site for more information about the endpoint. - * - * @param query The search query - * @param options A JSON object with options that can be passed - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. - */ - searchArtists(query: string, options?: SpotifyApi.SearchForItemParameterObject, callback?: ResultsCallback) : Promise; - - /** - * Fetches tracks from the Spotify catalog according to a query. - * See [Search for an Item](https://developer.spotify.com/web-api/search-item/) on the Spotify Developer site for more information about the endpoint. - * - * @param query The search query - * @param options A JSON object with options that can be passed - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. - */ - searchTracks(query: string, options?: SpotifyApi.SearchForItemParameterObject, callback?: ResultsCallback) : Promise; - - /** - * Fetches playlists from the Spotify catalog according to a query. - * See [Search for an Item](https://developer.spotify.com/web-api/search-item/) on the Spotify Developer site for more information about the endpoint. - * - * @param query The search query - * @param options A JSON object with options that can be passed - * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. - */ - searchPlaylists(query: string, options?: SpotifyApi.SearchForItemParameterObject, callback?: ResultsCallback) : Promise; - - /** - * Sets the access token to be used. - * See [the Authorization Guide](https://developer.spotify.com/web-api/authorization-guide/) on the Spotify Developer site for more information about obtaining an access token. - * - * @param accessToken The access token - */ - setAccessToken(accessToken: string) : void; - - /** - * Sets an implementation of Promises/A+ to be used. E.g. Q, when. - * See [Conformant Implementations](https://github.com/promises-aplus/promises-spec/blob/master/implementations.md) for a list of some available options - * - * @param promiseImplementation A Promises/A+ valid implementation - * @throws {Error} If the implementation being set doesn't conform with Promises/A+ - */ - setPromiseImplementation(promiseImplementation: Object) : void; - } -} From 45c5bcd85453cc195ed09a2e03c3f2e3d0fc4f39 Mon Sep 17 00:00:00 2001 From: Flarna Date: Fri, 28 Oct 2016 16:13:14 +0200 Subject: [PATCH 096/246] Add process.mainModule, improve NodeModule (#12257) * Add process.mainModule, improve NodeModule Add mainModule in process. See https://nodejs.org/dist/latest-v6.x/docs/api/process.html#process_process_mainmodule improve require.main see https://nodejs.org/dist/latest-v6.x/docs/api/modules.html#modules_accessing_the_main_module improve NodeModule see https://nodejs.org/dist/latest-v6.x/docs/api/modules.html#modules_module_children and https://nodejs.org/dist/latest-v6.x/docs/api/modules.html#modules_module_parent * Correct require.main and NodeModule --- node/node-4-tests.ts | 17 +++++++++++++++++ node/node-4.d.ts | 7 ++++--- node/node-tests.ts | 17 +++++++++++++++++ node/node.d.ts | 7 ++++--- 4 files changed, 42 insertions(+), 6 deletions(-) diff --git a/node/node-4-tests.ts b/node/node-4-tests.ts index 26e201c910..f21c3b58f8 100644 --- a/node/node-4-tests.ts +++ b/node/node-4-tests.ts @@ -24,6 +24,19 @@ import * as string_decoder from "string_decoder"; // Specifically test buffer module regression. import {Buffer as ImportedBuffer, SlowBuffer as ImportedSlowBuffer} from "buffer"; +////////////////////////////////////////////////////////// +/// Global Tests : https://nodejs.org/api/global.html /// +////////////////////////////////////////////////////////// +namespace global_tests { + { + let x: NodeModule; + let y: NodeModule; + x.children.push(y); + x.parent = require.main; + require.main = y; + } +} + ////////////////////////////////////////////////////////// /// Assert Tests : https://nodejs.org/api/assert.html /// ////////////////////////////////////////////////////////// @@ -922,6 +935,10 @@ namespace process_tests { var _p: NodeJS.Process = process; _p = p; } + { + var module: NodeModule; + module = process.mainModule; + } } /////////////////////////////////////////////////////////// diff --git a/node/node-4.d.ts b/node/node-4.d.ts index feee10f12d..bd6196d17c 100644 --- a/node/node-4.d.ts +++ b/node/node-4.d.ts @@ -52,7 +52,7 @@ interface NodeRequire extends NodeRequireFunction { resolve(id:string): string; cache: any; extensions: any; - main: any; + main: NodeModule; } declare var require: NodeRequire; @@ -63,8 +63,8 @@ interface NodeModule { id: string; filename: string; loaded: boolean; - parent: any; - children: any[]; + parent: NodeModule; + children: NodeModule[]; } declare var module: NodeModule; @@ -339,6 +339,7 @@ declare namespace NodeJS { title: string; arch: string; platform: string; + mainModule?: NodeModule; memoryUsage(): MemoryUsage; nextTick(callback: Function): void; umask(mask?: number): number; diff --git a/node/node-tests.ts b/node/node-tests.ts index b98b23ad69..0025505e67 100644 --- a/node/node-tests.ts +++ b/node/node-tests.ts @@ -27,6 +27,19 @@ import * as repl from "repl"; // Specifically test buffer module regression. import {Buffer as ImportedBuffer, SlowBuffer as ImportedSlowBuffer} from "buffer"; +////////////////////////////////////////////////////////// +/// Global Tests : https://nodejs.org/api/global.html /// +////////////////////////////////////////////////////////// +namespace global_tests { + { + let x: NodeModule; + let y: NodeModule; + x.children.push(y); + x.parent = require.main; + require.main = y; + } +} + ////////////////////////////////////////////////////////// /// Assert Tests : https://nodejs.org/api/assert.html /// ////////////////////////////////////////////////////////// @@ -1554,6 +1567,10 @@ namespace process_tests { { assert(process.argv[0] === process.argv0); } + { + var module: NodeModule; + module = process.mainModule; + } } /////////////////////////////////////////////////////////// diff --git a/node/node.d.ts b/node/node.d.ts index fe56ba851a..61132b9232 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -52,7 +52,7 @@ interface NodeRequire extends NodeRequireFunction { resolve(id: string): string; cache: any; extensions: any; - main: any; + main: NodeModule; } declare var require: NodeRequire; @@ -63,8 +63,8 @@ interface NodeModule { id: string; filename: string; loaded: boolean; - parent: any; - children: any[]; + parent: NodeModule; + children: NodeModule[]; } declare var module: NodeModule; @@ -372,6 +372,7 @@ declare namespace NodeJS { title: string; arch: string; platform: string; + mainModule?: NodeModule; memoryUsage(): MemoryUsage; nextTick(callback: Function, ...args: any[]): void; umask(mask?: number): number; From 7155ef2d2dced331b5e389363a4180957e76f95e Mon Sep 17 00:00:00 2001 From: Stefan Dobrev Date: Fri, 28 Oct 2016 17:15:24 +0300 Subject: [PATCH 097/246] [mocha] Add global run function (#12136) --- mocha/mocha.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mocha/mocha.d.ts b/mocha/mocha.d.ts index 5304f9333a..e512984ba4 100644 --- a/mocha/mocha.d.ts +++ b/mocha/mocha.d.ts @@ -42,6 +42,9 @@ declare var xit: Mocha.ITestDefinition; declare var test: Mocha.ITestDefinition; declare var specify: Mocha.ITestDefinition; +// Used with the --delay flag; see https://mochajs.org/#hooks +declare function run(): void; + interface MochaDone { (error?: any): any; } From 47221120dfa262f725ee96fe21523c32b56f2005 Mon Sep 17 00:00:00 2001 From: ToastHawaii Date: Fri, 28 Oct 2016 16:25:12 +0200 Subject: [PATCH 098/246] Create type definition for synaptic (#12185) * Create synaptic-tests.ts * Create synaptic.d.ts * Update synaptic.d.ts * Update synaptic.d.ts * Update synaptic-tests.ts * Update synaptic.d.ts * Update synaptic.d.ts Remove not needed public, change overloading to optional parameters, remove duplicate method. --- synaptic/synaptic-tests.ts | 522 ++++++++++++++++++++++++++++++ synaptic/synaptic.d.ts | 648 +++++++++++++++++++++++++++++++++++++ 2 files changed, 1170 insertions(+) create mode 100644 synaptic/synaptic-tests.ts create mode 100644 synaptic/synaptic.d.ts diff --git a/synaptic/synaptic-tests.ts b/synaptic/synaptic-tests.ts new file mode 100644 index 0000000000..2ffc60eafe --- /dev/null +++ b/synaptic/synaptic-tests.ts @@ -0,0 +1,522 @@ +/// + +// Neurons +// ======= +namespace NeuronTests { + // project + // ------- + var A = new Neuron(); + var B = new Neuron(); + A.project(B); // A now projects a connection to B + A.project(A); // Neurons can also self-connect + + // gate + // ---- + var A = new Neuron(); + var B = new Neuron(); + var connection = A.project(B); + + var C = new Neuron(); + C.gate(connection); // now C gates the connection between A and B + + // activate + // -------- + var A = new Neuron(); + var B = new Neuron(); + A.project(B); + + A.activate(0.5); // 0.5 + B.activate(); // 0.3244554645 + + // propagate + // --------- + var A = new Neuron(); + var B = new Neuron(); + A.project(B); + + var learningRate = .3; + + for (var i = 0; i < 20000; i++) { + // when A activates 1 + A.activate(1); + + // train B to activate 0 + B.activate(); + B.propagate(learningRate, 0); + } + + // test it + A.activate(1); + B.activate(); // 0.006540565760853365 + + // squashing function and bias + var A = new Neuron(); + A.squash = Neuron.squash.TANH; + A.bias = 1; +} + +// Layers +// ====== +namespace LayerTests { + // project + // ------- + var A = new Layer(5); + var B = new Layer(3); + A.project(B, Layer.connectionType.ALL_TO_ALL); // All the neurons in layer A now project a connection to all the neurons in layer B + A.project(A, Layer.connectionType.ONE_TO_ONE); + + // gate + // ---- + var A = new Layer(5); + var B = new Layer(3); + var connection = A.project(B); + + var C = new Layer(4); + C.gate(connection, Layer.gateType.INPUT); // now C gates the connection between A and B (input gate) + + // activate + // -------- + var A = new Layer(5); + var B = new Layer(3); + A.project(B); + + A.activate([1, 0, 1, 0, 1]); // [1,0,1,0,1] + B.activate(); // [0.3280457, 0.83243247, 0.5320423] + + // propagate + // --------- + var A = new Layer(5); + var B = new Layer(2); + A.project(B); + + var learningRate = .3; + + for (var i = 0; i < 20000; i++) { + // when A activates [1, 0, 1, 0, 1] + A.activate([1, 0, 1, 0, 1]); + + // train B to activate [0,0] + B.activate(); + B.propagate(learningRate, [0, 0]); + } + + // test it + A.activate([1, 0, 1, 0, 1]); + B.activate(); // [0.004606949693864496, 0.004606763721459169] + + // squashing function and bias + A.set({ + squash: Neuron.squash.TANH, + bias: 0 + }) + + // neurons + // ------- + A.neurons(); +} + +// Networks +// ======== + +namespace NetworkTests { + var inputLayer = new Layer(4); + var hiddenLayer = new Layer(6); + var outputLayer = new Layer(2); + + inputLayer.project(hiddenLayer); + hiddenLayer.project(outputLayer); + + var A = new Network({ + input: inputLayer, + hidden: [hiddenLayer], + output: outputLayer + }); + + var B = new Network({ + input: inputLayer, + hidden: [hiddenLayer], + output: outputLayer + }); + + // project + // ------- + A.project(B, Layer.connectionType.ALL_TO_ALL); + + // gate + // ---- + + var C = new Network({ + input: inputLayer, + hidden: [hiddenLayer], + output: outputLayer + }); + var connection = A.project(B); + C.gate(connection, Layer.gateType.INPUT); // now C's output layer gates the connection between A's output layer and B's input layer (input gate) + + // activate + // -------- + var inputLayer = new Layer(4); + var hiddenLayer = new Layer(6); + var outputLayer = new Layer(2); + + inputLayer.project(hiddenLayer); + hiddenLayer.project(outputLayer); + + var myNetwork = new Network({ + input: inputLayer, + hidden: [hiddenLayer], + output: outputLayer + }); + + myNetwork.activate([1, 0, 1, 0]); // [0.5200553602396137, 0.4792707231811006] + + // propagate + // --------- + // create the network + var inputLayer = new Layer(2); + var hiddenLayer = new Layer(3); + var outputLayer = new Layer(1); + + inputLayer.project(hiddenLayer); + hiddenLayer.project(outputLayer); + + var myNetwork = new Network({ + input: inputLayer, + hidden: [hiddenLayer], + output: outputLayer + }); + + // train the network + var learningRate = .3; + for (var i = 0; i < 20000; i++) { + // 0,0 => 0 + myNetwork.activate([0, 0]); + myNetwork.propagate(learningRate, [0]); + + // 0,1 => 1 + myNetwork.activate([0, 1]); + myNetwork.propagate(learningRate, [1]); + + // 1,0 => 1 + myNetwork.activate([1, 0]); + myNetwork.propagate(learningRate, [1]); + + // 1,1 => 0 + myNetwork.activate([1, 1]); + myNetwork.propagate(learningRate, [0]); + } + + // test the network + myNetwork.activate([0, 0]); // [0.015020775950893527] + myNetwork.activate([0, 1]); // [0.9815816381088985] + myNetwork.activate([1, 0]); // [0.9871822457132193] + myNetwork.activate([1, 1]); // [0.012950087641929467] + + // optimize + // -------- + + // extend + // ------ + + // toJSON/fromJSON + // --------------- + var exported = myNetwork.toJSON(); + var imported = Network.fromJSON(exported); + + // worker + // ------ + // training set + var learningRate = .3; + var trainingSet = [ + { + input: [0, 0], + output: [0] + }, + { + input: [0, 1], + output: [1] + }, + { + input: [1, 0], + output: [1] + }, + { + input: [1, 1], + output: [0] + }, + ]; + + // create a network + var inputLayer = new Layer(2); + var hiddenLayer = new Layer(3); + var outputLayer = new Layer(1); + + inputLayer.project(hiddenLayer); + hiddenLayer.project(outputLayer); + + var myNetwork = new Network({ + input: inputLayer, + hidden: [hiddenLayer], + output: outputLayer + }); + + // create a worker + var myWorker = myNetwork.worker(); + + // activate the network + function activateWorker(input: number[]) { + myWorker.postMessage({ + action: "activate", + input: input, + memoryBuffer: myNetwork.optimized.memory + }, [myNetwork.optimized.memory.buffer]); + } + + // backpropagate the network + function propagateWorker(target: number[]) { + myWorker.postMessage({ + action: "propagate", + target: target, + rate: learningRate, + memoryBuffer: myNetwork.optimized.memory + }, [myNetwork.optimized.memory.buffer]); + } + + // train the worker + myWorker.onmessage = function (e) { + // give control of the memory back to the network - this is mandatory! + myNetwork.optimized.ownership(e.data.memoryBuffer); + + if (e.data.action == "propagate") { + if (index >= 4) { + index = 0; + iterations++; + if (iterations % 100 == 0) { + var output00 = myNetwork.activate([0, 0]); + var output01 = myNetwork.activate([0, 1]); + var output10 = myNetwork.activate([1, 0]); + var output11 = myNetwork.activate([1, 1]); + + console.log("0,0 => ", output00); + console.log("0,1 => ", output01); + console.log("1,0 => ", output10); + console.log("1,1 => ", output11, "\n"); + } + } + + activateWorker(trainingSet[index].input); + } + + if (e.data.action == "activate") { + propagateWorker(trainingSet[index].output); + index++; + } + } + + // kick it + var index = 0; + var iterations = 0; + activateWorker(trainingSet[index].input); + + // standalone + // ---------- + var inputLayer = new Layer(4); + var hiddenLayer = new Layer(6); + var outputLayer = new Layer(2); + + inputLayer.project(hiddenLayer); + hiddenLayer.project(outputLayer); + + var myNetwork = new Network({ + input: inputLayer, + hidden: [hiddenLayer], + output: outputLayer + }); + + var standalone = myNetwork.standalone(); + + myNetwork.activate([1, 0, 1, 0]); // [0.5466397925108878, 0.5121246668637663] + standalone([1, 0, 1, 0]); // [0.5466397925108878, 0.5121246668637663] + + // clone + // ----- + var inputLayer = new Layer(4); + var hiddenLayer = new Layer(6); + var outputLayer = new Layer(2); + + inputLayer.project(hiddenLayer); + hiddenLayer.project(outputLayer); + + var myNetwork = new Network({ + input: inputLayer, + hidden: [hiddenLayer], + output: outputLayer + }); + + var clone = myNetwork.clone(); + + myNetwork.activate([1, 0, 1, 0]); // [0.5466397925108878, 0.5121246668637663] + clone.activate([1, 0, 1, 0]); // [0.5466397925108878, 0.5121246668637663] + + // neurons + // ------- + myNetwork.neurons(); + + // set + // --- + var inputLayer = new Layer(4); + var hiddenLayer = new Layer(6); + var outputLayer = new Layer(2); + + inputLayer.project(hiddenLayer); + hiddenLayer.project(outputLayer); + + var myNetwork = new Network(); + + myNetwork.set({ + input: inputLayer, + hidden: [hiddenLayer], + output: outputLayer + }); +} + +// Architect +// ========= +namespace ArchitectTests { + // Perceptron + // ---------- + var myPerceptron = new Architect.Perceptron(2, 3, 1); + + // LSTM + // ---- + var myLSTM = new Architect.LSTM(2, 6, 1); + + // Liquid + // ------ + var input = 2; + var pool = 20; + var output = 1; + var connections = 30; + var gates = 10; + + var myLiquidStateMachine = new Architect.Liquid(input, pool, output, connections, gates); + + // Hopfield + // -------- + var hopfield = new Architect.Hopfield(10) // create a network for 10-bit patterns + + // teach the network two different patterns + hopfield.learn([ + [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], + [1, 1, 1, 1, 1, 0, 0, 0, 0, 0] + ]) + + // feed new patterns to the network and it will return the most similar to the ones it was trained to remember + hopfield.feed([0, 1, 0, 1, 0, 1, 0, 1, 1, 1]) // [0, 1, 0, 1, 0, 1, 0, 1, 0, 1] + hopfield.feed([1, 1, 1, 1, 1, 0, 0, 1, 0, 0]) // [1, 1, 1, 1, 1, 0, 0, 0, 0, 0] +} + +// Trainer +// ======= +namespace TrainerTests { + // train + // ----- + var myNetwork = new Architect.Perceptron(2, 2, 1) + var trainer = new Trainer(myNetwork) + + var trainingSet = [ + { + input: [0, 0], + output: [0] + }, + { + input: [0, 1], + output: [1] + }, + { + input: [1, 0], + output: [1] + }, + { + input: [1, 1], + output: [0] + }, + ] + + trainer.train(trainingSet); + + var traningOptions = { + rate: .1, + iterations: 20000, + error: .005, + shuffle: true, + log: 1000, + cost: Trainer.cost.CROSS_ENTROPY, + schedule: { + every: 500, // repeat this task every 500 iterations + do: function (data: Synaptic.Trainer.TrainingScheduleDoData) { + // custom log + console.log("error", data.error, "iterations", data.iterations, "rate", data.rate); + if (data.error > .5) + return true; // abort/stop training + } + } + }; + + trainer.train(trainingSet, traningOptions); + + // trainAsync + // ---------- + var trainer = new Trainer(myNetwork); + trainer.trainAsync(trainingSet, traningOptions) + .then((results: any) => console.log('done!', results)) + + var myNetwork = new Architect.Perceptron(2, 2, 1) + var trainer = new Trainer(myNetwork) + + var trainingSet = [ + { + input: [0, 0], + output: [0] + }, + { + input: [0, 1], + output: [1] + }, + { + input: [1, 0], + output: [1] + }, + { + input: [1, 1], + output: [0] + }, + ] + + trainer.trainAsync(trainingSet) + .then((results: any) => console.log('done!', results)) + + // test + // ---- + + // XOR + // --- + var trainer = new Trainer(myNetwork); + trainer.XOR(); // {error: 0.004999821588193305, iterations: 21333, time: 111} + + // DSR + // --- + trainer.DSR({ + targets: [2, 4], + distractors: [3, 5], + prompts: [0, 1], + length: 10 + }); + + // ERG + // --- + trainer.ERG(); + + // timingTask + // ---------- +} diff --git a/synaptic/synaptic.d.ts b/synaptic/synaptic.d.ts new file mode 100644 index 0000000000..767695a89e --- /dev/null +++ b/synaptic/synaptic.d.ts @@ -0,0 +1,648 @@ +// Type definitions for synaptic 1.0.8 +// Project: https://github.com/cazala/synaptic +// Definitions by: Markus Peloso +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare var Neuron: typeof Synaptic.Neuron; +declare var Layer: typeof Synaptic.Layer; +declare var Network: typeof Synaptic.Network; +declare var Architect: typeof Synaptic.Architect; +declare var Trainer: typeof Synaptic.Trainer; + +declare module "synaptic" { + export = Synaptic; +} + +declare namespace Synaptic { + namespace Neuron { + type SquashingFunction = (x: number, derivate: boolean) => number; + + namespace squash { + const LOGISTIC: SquashingFunction; + const TANH: SquashingFunction; + const IDENTITY: SquashingFunction; + const HLIM: SquashingFunction; + const ReLU: SquashingFunction; + } + + class Connection { + ID: number; + from: number; + to: number; + weight: number; + gain: number; + gater: Neuron; + + constructor(from: number, to: number, weight?: number); + + static uid(): number; + } + + var connection: typeof Connection; + } + + /** + * Neurons are the basic unit of the neural network. They can be connected together, or used to gate connections between other neurons. + */ + class Neuron { + /** + * By default, a neuron uses a Logistic Sigmoid as its squashing/activation function. + * @default LOGISTIC + */ + squash: Neuron.SquashingFunction; + + /** + * By default, a neuron uses a random bias. + * @default random + */ + bias: number; + + /** + * Neurons are the basic unit of the neural network. They can be connected together, or used to gate connections between other neurons. + */ + constructor(); + + /** + * A neuron can project a connection to another neuron. Neurons can also self-connect. + */ + project(neuron: Neuron, weight?: number): Neuron.Connection; + + /** + * A neuron can gate a connection between two neurons, or a neuron's self-connection. This allows you to create second order neural network architectures. + * @param connection + */ + gate(connection: Neuron.Connection): void; + + /** + * When a neuron activates, it computes its state from all its input connections and squashes it using its activation function, and returns the output (activation). + * @param activation You can provide the activation as a parameter (useful for neurons in the input layer. it has to be a float between 0 and 1). + */ + activate(activation?: number): number; + + /** + * After an activation, you can teach the neuron what should have been the correct output (a.k.a. train). This is done by backpropagating the error. + * @param learningRate a learning rate + * @param targetValue a target value (float between 0 and 1) + */ + propagate(learningRate: number, targetValue: number): void; + + /** + * Returns true or false whether the neuron is self-connected or not. + */ + selfconnected(): boolean; + + /** + * Returns true or false whether the neuron is connected to another neuron (parameter). + * @param neuron + */ + connected(neuron?: any): { result: any; connection: any } | boolean; + + /** + * Clears all the traces (the neuron forgets it's context, but the connections remain intact). + */ + clear(): void; + + /** + * All the connections are randomized and the traces are cleared. + */ + reset(): void; + + /** + * Hardcodes the behavior of the neuron into an optimized function. + */ + optimize(optimized?: any, layer?: any): { + memory: any; + neurons: any; + inputs: any; + outputs: any; + targets: any; + variables: any; + activation_sentences: any; + trace_sentences: any; + propagation_sentences: any; + layers: any; + }; + + static uid(): number; + + static quantity(): { neurons: number; connections: number; }; + } + + namespace Layer { + /** + * Types of connections. + */ + enum connectionType { + /** + * It connects every neuron from layer A, to every neuron in layer B. + */ + ALL_TO_ALL, + + /** + * It connects each neuron from layer A, to one neuron in layer B. Both layers must be the same size in order to work. + */ + ONE_TO_ONE, + + /** + * Useful only in self-connections. It connects every neuron from a layer to all the other neurons in that same layer, except with itself. If this connectionType is used in a connection between different layers, it produces the same result as ALL_TO_ALL. + */ + ALL_TO_ELSE + } + + /** + * Represents a connection from one layer to another, and keeps track of its weight and gain. + */ + class LayerConnection { + ID: number; + from: any; + to: any; + selfconnection: any; + type: any; + connections: any; + list: any; + size: any; + gatedfrom: any; + + static uid(): number; + } + + var connection: typeof LayerConnection; + + /** + * Types of gates. + */ + enum gateType { + /** + * If layer C is gating connections between layer A and B, all the neurons from C gate all the input connections to B. + */ + INPUT, + + /** + * If layer C is gating connections between layer A and B, all the neurons from C gate all the output connections from A. + */ + OUTPUT, + + /** + * If layer C is gating connections between layer A and B, each neuron from C gates one connection from A to B. This is useful for gating self-connected layers. To use this kind of gateType, A, B and C must be the same size. + */ + ONE_TO_ONE + } + + interface Options { + label?: any; + squash?: Neuron.SquashingFunction; + bias?: number; + } + } + + /** + * Normally you won't work with single neurons, but use Layers instead. A layer is basically an array of neurons, they can do pretty much the same things as neurons do, but it makes the programming process faster. + */ + class Layer { + size: number; + list: Neuron[]; + label: any; + connectedTo: any; + + /** + * Normally you won't work with single neurons, but use Layers instead. A layer is basically an array of neurons, they can do pretty much the same things as neurons do, but it makes the programming process faster. + * @param numberOfNeurons the number of neurons in that layer + */ + constructor(numberOfNeurons: number); + + /** + * A layer can project a connection to another layer. Layers can also self-connect. + * @param connectionType If not specified, the connection type is always Layer.connectionType.ALL_TO_ALL when connecting two different layers, and is Layer.connectionType.ONE_TO_ONE when connecting a layer to itself (ie myLayer.project(myLayer)). + */ + project(layer: Layer | Network, connectionType?: Layer.connectionType, weights?: any): Layer.LayerConnection; + + /** + * A layer can gate a connection between two other layers, or a layers's self-connection. + */ + gate(connection: Layer.LayerConnection, gateType: Layer.gateType): void; + + /** + * When a layer activates, it just activates all the neurons in that layer in order, and returns an array with the outputs. + * @param activation It accepts an array of activations as parameter (for input layers). + */ + activate(activation?: number[]): number[]; + + /** + * After an activation, you can teach the layer what should have been the correct output (a.k.a. train). This is done by backpropagating the error. + * @param learningRate A learning rate. + * @param targetValue A target value (array of floats between 0 and 1). + */ + propagate(learningRate: number, targetValue: number[]): void; + + /** + * True or false whether the whole layer is self-connected or not. + */ + selfconnected(): boolean; + + /** + * True of false whether the layer is connected to another layer (parameter) or not. + * @param layer + */ + connected(layer: any): any; + + /** + * Clears all the neurons in the layer. + */ + clear(): void; + + /** + * Resets all the neurons in the layer. + */ + reset(): void; + + /** + * Adds a neuron to the layer. + * @param neuron + */ + add(neuron: any): void; + + /** + * Set the squashing function and bias of all the neurons in a layer. + * @param options + */ + set(options: Layer.Options): this; + + /** + * Returns an array with all the neurons in the layer, in activation order. + */ + neurons(): Neuron[]; + } + + namespace Network { + interface Options { + input: Layer; + hidden: Layer[]; + output: Layer; + } + + interface Optimized { + memory: Float64Array; + ownership: (memoryBuffer: Float64Array) => void; + } + } + + /** + * Networks are basically an array of layers. They have an input layer, a number of hidden layers, and an output layer. + */ + class Network { + layer: Network.Options; + + optimized: Network.Optimized; + + /** + * Networks are basically an array of layers. They have an input layer, a number of hidden layers, and an output layer. + */ + constructor(options?: Network.Options); + /** + * A network can project a connection to another, or gate a connection between two others networks in the same way Layers do. + * @param [connectionType=Layer.connectionType.ALL_TO_ALL] + */ + project(otherNetwork: Network | Layer, connectionType?: Layer.connectionType, weights?: any): Layer.LayerConnection; + + /** + * A Network can gate a connection between two other Networks or Layers, or a Layers's self-connection. + * @param layerConnection + * @param gateType + */ + gate(layerConnection: Layer.LayerConnection, gateType: Layer.gateType): void; + + /** + * When a network is activated, an input must be provided to activate the input layer, then all the hidden layers are activated in order, and finally the output layer is activated and its activation is returned. + * @param activation + */ + activate(activation: number[]): number[]; + + /** + * You can provide a target value and a learning rate to a network and backpropagate the error from the output layer to all the hidden layers in reverse order until reaching the input layer. + * @param learningRate + * @param targetValue + */ + propagate(learningRate: number, targetValue: number[]): void; + + /** + * Networks can be stored as JSON's. + */ + toJSON(): string; + + /** + * Creates a static String to store the source code of the functions that are identical for all the workers (train, _trainSet, test). + * @returns Source code that can train a network inside a worker. + */ + static getWorkerSharedFunctions(): string; + + /** + * Rebuild a network that has been stored in a json using the method toJSON(). + */ + static fromJSON(exported: string): Network; + + /** + * The network can be converted into a WebWorker. This feature doesn't work in node.js, and it's not supported on every browser (it must support Blob). + * @returns Return a HTML5 WebWorker specialized on training the network stored in `memory`. Train based on the given dataSet and options. The worker returns the updated `memory` when done. + */ + worker(memory?: any, set?: any, options?: any): Worker; + + /** + * Export the topology into dot language which can be visualized as graphs using dot. + * @param edgeConnection + */ + toDot(edgeConnection?: any): { code: string; link: string }; + + /** + * The network can be exported to a single javascript Function. This can be useful when your network is already trained and you just need to use it, since the standalone functions is just one javascript function with an array and operations within, with no dependencies on Synaptic or any other library. + * @returns Returns a function that works as the activation of the network and can be used without depending on the library. + */ + standalone(): (inputs: number[]) => number[]; + + /** + * A network can be cloned to a completely new instance, with the same connections and traces. + * @returns Returns a copy of the network. + */ + clone(): Network; + + /** + * Return an array with all the neurons in the network, in activation order. + */ + neurons(): number[]; + + /** + * The method set(layers) receives an object with layers in the same format as the constructor of Network and sets them as the layers of the Network, this is useful when you are extending the Network class to create your own architectures. + */ + set(options: Network.Options): void; + + /** + * Returns number of inputs of the network. + */ + inputs(): number; + + /** + * Returns number of outputs of hte network. + */ + outputs(): number; + + setOptimize(optimize: any): void; + + /** + * Restores all the values from the optimized network the their respective objects in order to manipulate the network. + */ + restore(): any | void; + + /** + * Hardcodes the behaviour of the whole network into a single optimized function. + */ + optimize(): void; + + /** + * Clear all elegibility traces and extended elegibility traces (the network forgets its context, but not what was trained). + */ + clear(): void; + + /** + * Reset all weights and clear all traces (ends up like a new network). + */ + reset(): void; + } + + /** + * The Architect contains built-in architectures, ready to use. + */ + namespace Architect { + /** + * This architecture allows you to create multilayer perceptrons, also known as feed-forward neural networks. They consist of a sequence of layers, each fully connected to the next one. + */ + class Perceptron extends Network { + trainer: Trainer; + + /** + * This architecture allows you to create multilayer perceptrons, also known as feed-forward neural networks. They consist of a sequence of layers, each fully connected to the next one. + * @param numberOfNeurons You have to provide a minimum of 3 layers (input, hidden and output), but you can use as many hidden layers as you wish. + */ + constructor(...numberOfNeurons: number[]); + } + + /** + * The long short-term memory is an architecture well-suited to learn from experience to classify, process and predict time series when there are very long time lags of unknown size between important events. + */ + class LSTM extends Network { + trainer: Trainer; + + /** + * The long short-term memory is an architecture well-suited to learn from experience to classify, process and predict time series when there are very long time lags of unknown size between important events. + * @param numberOfNeurons To use this architecture you have to set at least one input layer, one memory block assembly (consisting of four layers: input gate, memory cell, forget gate and output gate), and an output layer. Also you can set many layers of memory blocks. + */ + constructor(...numberOfNeurons: number[]); + } + + /** + * The Liquid architecture allows you to create Liquid State Machines. In these networks, neurons are randomly connected to each other. The recurrent nature of the connections turns the time varying input into a spatio-temporal pattern of activations in the network nodes. + */ + class Liquid extends Network { + trainer: Trainer; + + /** + * The Liquid architecture allows you to create Liquid State Machines. In these networks, neurons are randomly connected to each other. The recurrent nature of the connections turns the time varying input into a spatio-temporal pattern of activations in the network nodes. + * @param input The size of the input layer. + * @param pool The size of the pool. + * @param output The size of the output layer. + * @param connections The number of random connections in the pool. + * @param gates The number of random gates among the connections. + */ + constructor(input: number, pool: number, output: number, connections: number, gates: number); + } + + /** + * The Hopfield architecture serves as content-addressable memory. They are trained to remember patterns and then when feeding new patterns to the network it returns the most similar one from the patterns it was trained to remember. + */ + class Hopfield extends Network { + /** + * The Hopfield architecture serves as content-addressable memory. They are trained to remember patterns and then when feeding new patterns to the network it returns the most similar one from the patterns it was trained to remember. + * @param patternSize Pattern size in bits. + */ + constructor(patternSize: number); + + /** + * Teach the network two different patterns. + * @param patterns + */ + learn(patterns: [number[], number[]]): any; + + /** + * Feed new patterns to the network and it will return the most similar to the ones it was trained to remember. + * @param pattern + */ + feed(pattern: number[]): number[]; + } + } + + namespace Trainer { + interface TrainingPair { + input: number[]; + output: number[]; + } + + type TrainingSet = TrainingPair[]; + + interface TrainingOptions { + /** + * Learning rate to train the network. It can be a static rate (just a number), dynamic (an array of numbers, which will transition from one to the next one according to the number of iterations) or a callback function: (iterations, error) => rate. + */ + rate?: number | number[] | ((iterations: number, error: number) => number); + + /** + * Maximum number of iterations. + */ + iterations?: number; + + /** + * Minimum error. + */ + error?: number; + + /** + * If true, the training set is shuffled after every iteration, this is useful for training data sequences which order is not meaningful to networks with context memory, like LSTM's. + */ + shuffle?: boolean; + + /** + * You can set what cost function to use for the training, there are three built-in cost functions (Trainer.cost.CROSS_ENTROPY, Trainer.cost.MSE and Trainer.cost.BINARY) to choose from cross-entropy or mean squared error. You can also use you own cost function(targetValues, outputValues). + */ + cost?: CostFunction; + + /** + * This commands the trainer to console.log the error and iterations every X number of iterations. + */ + log?: number; + + /** + * You can create custom scheduled tasks that will be executed every X number of iterations. It can be used to create custom logs, or to compute analytics based on the data passed to the task (data object includes error, iterations and the current learning rate). If the returned value of the task is true, the training will be aborted. This can be used to create special conditions to stop the training (i.e. if the error starts to increase). + */ + schedule?: TrainingScheduleOptions; + } + + interface TrainingScheduleDoData { + error: any; + + iterations: any; + + /** + * The current learning rate. + */ + rate: any; + } + + interface TrainingScheduleOptions { + every: number; + do: (data: TrainingScheduleDoData) => boolean | void; + } + + type CostFunction = (targetValues: number[], outputValues: number[]) => number; + + namespace cost { + const CROSS_ENTROPY: CostFunction; + const MSE: CostFunction; + const BINARY: CostFunction; + } + + interface TrainingResult { + error: number; + iterations: number; + time: number; + } + + interface XOROptions { + iterations?: number; + log?: number; + shuffle?: boolean; + cost?: CostFunction; + } + + interface DSROptions { + targets?: number[]; + distractors?: number[]; + prompts?: number[]; + length?: number; + success?: number; + iterations?: number; + rate?: number; + log?: number; + schedule?: TrainingScheduleOptions; + cost?: CostFunction; + } + + interface DSRTrainingResult { + error: number; + iterations: number; + time: number; + success: any; + } + + interface ERGOptions { + iterations?: number; + error?: number; + rate?: number; + log?: number; + cost?: CostFunction; + } + + interface ERGTrainingResult { + error: number; + iterations: number; + time: number; + test: any; + generate: any; + } + } + + /** + * The Trainer makes it easier to train any set to any network, no matter its architecture. The trainer also contains built-in tasks to test the performance of your network. + */ + class Trainer { + /** + * The Trainer makes it easier to train any set to any network, no matter its architecture. The trainer also contains built-in tasks to test the performance of your network. + * @param network + */ + constructor(network: Network); + + /** + * This method allows you to train any training set to a Network. + * @returns When the training is done this method returns an object with the error, the iterations, and the elapsed time of the training. + */ + train(trainingSet: Trainer.TrainingSet, trainingOptions?: Trainer.TrainingOptions): Trainer.TrainingResult; + + /** + * This method allows you to train any training set to a Network. + * @returns When the training is done this method returns an object with the error, the iterations, and the elapsed time of the training. + */ + trainAsync(trainingSet: Trainer.TrainingSet, trainingOptions?: Trainer.TrainingOptions): Promise; + + /** + * This method accepts the same arguments as train(dataSet, options). It will iterate over the dataSet, activating the network. + * @returns It returns the elapsed time and the error (by default, the MSE, but you can specify the cost function in the options, same way as in train()). + */ + test(trainingSet: Trainer.TrainingSet, trainingOptions?: Trainer.TrainingOptions): Trainer.TrainingResult; + + /** + * This method trains an XOR to the network, is useful when you are experimenting with different architectures and you want to test and compare their performances. + */ + XOR(options?: Trainer.XOROptions): Trainer.TrainingResult; + + /** + * This method trains the network to complete a Discrete Sequence Recall, which is a task for testing context memory in neural networks. + */ + DSR(options?: Trainer.DSROptions): Trainer.DSRTrainingResult; + + /** + * This method trains the network to pass an Embedded Reber Grammar test. + */ + ERG(options?: Trainer.ERGOptions): Trainer.ERGTrainingResult; + + /** + * This test challenges the network to complete a timing task. + */ + timingTask(options?: any): { train: any; test: any }; + } +} From b6bd0766d8416ef39dcfb872e63b226f56dcc722 Mon Sep 17 00:00:00 2001 From: Karol Janyst Date: Fri, 28 Oct 2016 23:35:07 +0900 Subject: [PATCH 099/246] Add definitions for reactcss (#12122) * Add definitions for react-css-transition-replace * Add definitions for reactcss * Change test header * Remove accidentally added other definitions * Remove yarn.lock from .gitignore --- reactcss/reactcss-tests.tsx | 29 +++++++++++++++++++++++++++++ reactcss/reactcss.d.ts | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 reactcss/reactcss-tests.tsx create mode 100644 reactcss/reactcss.d.ts diff --git a/reactcss/reactcss-tests.tsx b/reactcss/reactcss-tests.tsx new file mode 100644 index 0000000000..9435e3bbf5 --- /dev/null +++ b/reactcss/reactcss-tests.tsx @@ -0,0 +1,29 @@ +// ReactCSS Test +// ================================================================================ +/// +/// +/// + +// Imports +// -------------------------------------------------------------------------------- +import * as React from "react" +import { StatelessComponent } from "react" +import { render } from "react-dom" +import { default as reactCSS, hover, loop } from "reactcss" + +interface TestProps extends ReactCSS.HoverProps {} + +var styles: any = reactCSS({ + default : {}, + hover : {} +}, { hover : true }) + +var loopProps: ReactCSS.LoopableProps = loop(1, 10) + +var TestComponent: StatelessComponent +var Test = hover(TestComponent) + +render( + , + document.getElementById("main") +) diff --git a/reactcss/reactcss.d.ts b/reactcss/reactcss.d.ts new file mode 100644 index 0000000000..3d309adb78 --- /dev/null +++ b/reactcss/reactcss.d.ts @@ -0,0 +1,34 @@ +// Type definitions for ReactCSS v1.0.0 +// Project: http://reactcss.com/ +// Definitions by: Karol Janyst +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace ReactCSS { + interface LoopableProps { + "first-child"?: boolean + "last-child"?: boolean + even?: boolean + odd?: boolean + [nthChild: string]: boolean + } + + interface HoverProps { + hover?: boolean + } + + interface Classes { + default: any + [scope: string]: any + } +} + +declare module "reactcss" { + import React = __React + + export type LoopableProps = ReactCSS.LoopableProps + export function hover(component: React.ComponentClass | React.StatelessComponent): React.ComponentClass + export function loop(i: number, length: number): ReactCSS.LoopableProps + export default function reactCSS (classes: ReactCSS.Classes, ...activations: Array): any +} From 2c6d2feff0f244ee13496674ff8ed399d3d31164 Mon Sep 17 00:00:00 2001 From: Hassan Abdel-Rahman Date: Fri, 28 Oct 2016 10:45:54 -0400 Subject: [PATCH 100/246] S3 (#12169) * updated bull typing * add copyObject to S3 --- aws-sdk/aws-sdk.d.ts | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/aws-sdk/aws-sdk.d.ts b/aws-sdk/aws-sdk.d.ts index 6ed671ab8f..3fe8f65b0f 100644 --- a/aws-sdk/aws-sdk.d.ts +++ b/aws-sdk/aws-sdk.d.ts @@ -382,6 +382,7 @@ declare module "aws-sdk" { endpoint: Endpoint; getObject(params: s3.GetObjectRequest, callback?: (err: Error, data: any) => void): any; + copyObject(params: s3.CopyObjectRequest, callback?: (err: Error, data: any) => void): any; putObject(params: s3.PutObjectRequest, callback: (err: Error, data: any) => void): void; deleteObject(params: s3.DeleteObjectRequest, callback: (err: Error, data: any) => void): void; headObject(params: s3.HeadObjectRequest, callback: (err: Error, data: any) => void): void; @@ -2263,6 +2264,40 @@ declare module "aws-sdk" { WebsiteRedirectLocation?: string; } + export interface CopyObjectRequest { + Bucket: string; + CopySource: string; + Key: string; + ACL?: string; + CacheControl?: string; + ContentDisposition?: string; + ContentEncoding?: string; + ContentLanguage?: string; + ContentType?: string; + CopySourceIfMatch?: string; + CopySourceIfModifiedSince?: any; + CopySourceIfNoneMatch?: string; + CopySourceIfUnmodifiedSince?: any; + CopySourceSSECustomerAlgorithm?: string; + CopySourceSSECustomerKey?: any; + CopySourceSSECustomerKeyMD5?: string; + Expires?: any; + GrantFullControl?: string; + GrantRead?: string; + GrantReadACP?: string; + GrantWriteACP?: string; + Metadata?: { [key: string]: string; }; + MetadataDirective?: string; + RequestPayer?: string; + SSECustomerAlgorithm?: string; + SSECustomerKey?: any; + SSECustomerKeyMD5?: string; + SSEKMSKeyId?: string; + ServerSideEncryption?: string; + StorageClass?: string; + WebsiteRedirectLocation?: string; + } + export interface GetObjectRequest { Bucket: string; IfMatch?: string; From a8bd330e4b73caf6c386d1025531db19ac926351 Mon Sep 17 00:00:00 2001 From: ptrckc Date: Fri, 28 Oct 2016 10:33:09 -0500 Subject: [PATCH 101/246] Update Joi's ValidationOptions and AnySchema interfaces (#12102) * Update ValidationOptions and AnySchema interfaces * Update ValidationOptions and AnySchema interfaces * Remove `error` from global options See: https://github.com/hapijs/joi/issues/1012 * Remove `error` from global options See: https://github.com/hapijs/joi/issues/1012 --- joi/joi-tests.ts | 3 +++ joi/joi.d.ts | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/joi/joi-tests.ts b/joi/joi-tests.ts index 8d5463a7c0..c832b3eb05 100644 --- a/joi/joi-tests.ts +++ b/joi/joi-tests.ts @@ -58,6 +58,7 @@ validOpts = {stripUnknown: bool}; validOpts = {language: bool}; validOpts = {presence: str}; validOpts = {context: obj}; +validOpts = {noDefaults: bool}; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- @@ -221,6 +222,8 @@ namespace common { anySchema = anySchema.empty(); anySchema = anySchema.empty(str); anySchema = anySchema.empty(anySchema); + + anySchema = anySchema.error(err); } // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- diff --git a/joi/joi.d.ts b/joi/joi.d.ts index 206c5778ca..a4a029f737 100644 --- a/joi/joi.d.ts +++ b/joi/joi.d.ts @@ -40,6 +40,10 @@ declare module 'joi' { * provides an external data set to be used in references */ context?: Object; + /** + * when true, do not apply default values. Defaults to false. + */ + noDefaults?: boolean; } export interface RenameOptions { @@ -287,6 +291,17 @@ declare module 'joi' { * @param schema - any object or joi schema to match. An undefined schema unsets that rule. */ empty(schema?: any) : T; + + /** + * Overrides the default joi error with a custom error if the rule fails where: + * @param err - the override error. + * + * Note that the provided error will be returned as-is, unmodified and undecorated + * with any of the normal joi error properties. If validation fails and another + * error is found before the error override, that error will be returned and the + * override will be ignored (unless the abortEarly option has been set to false). + */ + error?(err: Error): T; } export interface BooleanSchema extends AnySchema { From dc17e1a2474ca70754ecdc5737f07ecd2eba9fe6 Mon Sep 17 00:00:00 2001 From: TonyYang Date: Fri, 28 Oct 2016 23:40:38 +0800 Subject: [PATCH 102/246] [loadsh] Make method module definitions (#12220) * Define type for method modules * Update lodash-tests.ts --- lodash/lodash-tests.ts | 575 +++++++++++++ lodash/lodash.d.ts | 1829 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 2404 insertions(+) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index f0f958b0c8..11f0a52a42 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -11905,3 +11905,578 @@ result = <_.TemplateSettings>_.templateSettings; res1___ = _.partialRight(func4, "foo", true, 100); res____ = _.partialRight(func4, 42, "foo", true, 100); } + +/*************************** + * method_modules_tests * + ***************************/ + +import afterFunc = require("lodash.after"); +import aryFunc = require("lodash.ary"); +import assignFunc = require("lodash.assign"); +import assignInFunc = require("lodash.assignIn"); +import assignInWithFunc = require("lodash.assignInWith"); +import assignWithFunc = require("lodash.assignWith"); +import atFunc = require("lodash.at"); +import beforeFunc = require("lodash.before"); +import bindFunc = require("lodash.bind"); +import bindAllFunc = require("lodash.bindAll"); +import bindKeyFunc = require("lodash.bindKey"); +import castArrayFunc = require("lodash.castArray"); +import chainFunc = require("lodash.chain"); +import chunkFunc = require("lodash.chunk"); +import compactFunc = require("lodash.compact"); +import concatFunc = require("lodash.concat"); +import constantFunc = require("lodash.constant"); +import countByFunc = require("lodash.countBy"); +import createFunc = require("lodash.create"); +import curryFunc = require("lodash.curry"); +import curryRightFunc = require("lodash.curryRight"); +import debounceFunc = require("lodash.debounce"); +import defaultsFunc = require("lodash.defaults"); +import defaultsDeepFunc = require("lodash.defaultsDeep"); +import deferFunc = require("lodash.defer"); +import delayFunc = require("lodash.delay"); +import differenceFunc = require("lodash.difference"); +import differenceByFunc = require("lodash.differenceBy"); +import differenceWithFunc = require("lodash.differenceWith"); +import dropFunc = require("lodash.drop"); +import dropRightFunc = require("lodash.dropRight"); +import dropRightWhileFunc = require("lodash.dropRightWhile"); +import dropWhileFunc = require("lodash.dropWhile"); +import fillFunc = require("lodash.fill"); +import filterFunc = require("lodash.filter"); +import flatMapFunc = require("lodash.flatMap"); +import flattenFunc = require("lodash.flatten"); +import flattenDeepFunc = require("lodash.flattenDeep"); +import flattenDepthFunc = require("lodash.flattenDepth"); +import flipFunc = require("lodash.flip"); +import flowFunc = require("lodash.flow"); +import flowRightFunc = require("lodash.flowRight"); +import fromPairsFunc = require("lodash.fromPairs"); +import functionsFunc = require("lodash.functions"); +import functionsInFunc = require("lodash.functionsIn"); +import groupByFunc = require("lodash.groupBy"); +import initialFunc = require("lodash.initial"); +import intersectionFunc = require("lodash.intersection"); +import intersectionByFunc = require("lodash.intersectionBy"); +import intersectionWithFunc = require("lodash.intersectionWith"); +import invertFunc = require("lodash.invert"); +import invertByFunc = require("lodash.invertBy"); +import invokeMapFunc = require("lodash.invokeMap"); +import iterateeFunc = require("lodash.iteratee"); +import keyByFunc = require("lodash.keyBy"); +import keysFunc = require("lodash.keys"); +import keysInFunc = require("lodash.keysIn"); +import mapFunc = require("lodash.map"); +import mapKeysFunc = require("lodash.mapKeys"); +import mapValuesFunc = require("lodash.mapValues"); +import matchesFunc = require("lodash.matches"); +import matchesPropertyFunc = require("lodash.matchesProperty"); +import memoizeFunc = require("lodash.memoize"); +import mergeFunc = require("lodash.merge"); +import mergeWithFunc = require("lodash.mergeWith"); +import methodFunc = require("lodash.method"); +import methodOfFunc = require("lodash.methodOf"); +import mixinFunc = require("lodash.mixin"); +import negateFunc = require("lodash.negate"); +import nthArgFunc = require("lodash.nthArg"); +import omitFunc = require("lodash.omit"); +import omitByFunc = require("lodash.omitBy"); +import onceFunc = require("lodash.once"); +import orderByFunc = require("lodash.orderBy"); +import overFunc = require("lodash.over"); +import overArgsFunc = require("lodash.overArgs"); +import overEveryFunc = require("lodash.overEvery"); +import overSomeFunc = require("lodash.overSome"); +import partialFunc = require("lodash.partial"); +import partialRightFunc = require("lodash.partialRight"); +import partitionFunc = require("lodash.partition"); +import pickFunc = require("lodash.pick"); +import pickByFunc = require("lodash.pickBy"); +import propertyFunc = require("lodash.property"); +import propertyOfFunc = require("lodash.propertyOf"); +import pullFunc = require("lodash.pull"); +import pullAllFunc = require("lodash.pullAll"); +import pullAllByFunc = require("lodash.pullAllBy"); +import pullAtFunc = require("lodash.pullAt"); +import rangeFunc = require("lodash.range"); +import rangeRightFunc = require("lodash.rangeRight"); +import reargFunc = require("lodash.rearg"); +import rejectFunc = require("lodash.reject"); +import removeFunc = require("lodash.remove"); +import restFunc = require("lodash.rest"); +import reverseFunc = require("lodash.reverse"); +import sampleSizeFunc = require("lodash.sampleSize"); +import setFunc = require("lodash.set"); +import setWithFunc = require("lodash.setWith"); +import shuffleFunc = require("lodash.shuffle"); +import sliceFunc = require("lodash.slice"); +import sortByFunc = require("lodash.sortBy"); +import sortedUniqFunc = require("lodash.sortedUniq"); +import sortedUniqByFunc = require("lodash.sortedUniqBy"); +import splitFunc = require("lodash.split"); +import spreadFunc = require("lodash.spread"); +import tailFunc = require("lodash.tail"); +import takeFunc = require("lodash.take"); +import takeRightFunc = require("lodash.takeRight"); +import takeRightWhileFunc = require("lodash.takeRightWhile"); +import takeWhileFunc = require("lodash.takeWhile"); +import tapFunc = require("lodash.tap"); +import throttleFunc = require("lodash.throttle"); +import thruFunc = require("lodash.thru"); +import toArrayFunc = require("lodash.toArray"); +import toPairsFunc = require("lodash.toPairs"); +import toPairsInFunc = require("lodash.toPairsIn"); +import toPathFunc = require("lodash.toPath"); +import toPlainObjectFunc = require("lodash.toPlainObject"); +import transformFunc = require("lodash.transform"); +import unaryFunc = require("lodash.unary"); +import unionFunc = require("lodash.union"); +import unionByFunc = require("lodash.unionBy"); +import unionWithFunc = require("lodash.unionWith"); +import uniqFunc = require("lodash.uniq"); +import uniqByFunc = require("lodash.uniqBy"); +import uniqWithFunc = require("lodash.uniqWith"); +import unsetFunc = require("lodash.unset"); +import unzipFunc = require("lodash.unzip"); +import unzipWithFunc = require("lodash.unzipWith"); +import updateFunc = require("lodash.update"); +import valuesFunc = require("lodash.values"); +import valuesInFunc = require("lodash.valuesIn"); +import withoutFunc = require("lodash.without"); +import wordsFunc = require("lodash.words"); +import wrapFunc = require("lodash.wrap"); +import xorFunc = require("lodash.xor"); +import xorByFunc = require("lodash.xorBy"); +import xorWithFunc = require("lodash.xorWith"); +import zipFunc = require("lodash.zip"); +import zipObjectFunc = require("lodash.zipObject"); +import zipWithFunc = require("lodash.zipWith"); +import extendFunc = require("lodash.extend"); +import extendWithFunc = require("lodash.extendWith"); +import addFunc = require("lodash.add"); +import attemptFunc = require("lodash.attempt"); +import camelCaseFunc = require("lodash.camelCase"); +import capitalizeFunc = require("lodash.capitalize"); +import ceilFunc = require("lodash.ceil"); +import clampFunc = require("lodash.clamp"); +import cloneFunc = require("lodash.clone"); +import cloneDeepFunc = require("lodash.cloneDeep"); +import cloneDeepWithFunc = require("lodash.cloneDeepWith"); +import cloneWithFunc = require("lodash.cloneWith"); +import deburrFunc = require("lodash.deburr"); +import endsWithFunc = require("lodash.endsWith"); +import eqFunc = require("lodash.eq"); +import escapeFunc = require("lodash.escape"); +import escapeRegExpFunc = require("lodash.escapeRegExp"); +import everyFunc = require("lodash.every"); +import findFunc = require("lodash.find"); +import findIndexFunc = require("lodash.findIndex"); +import findKeyFunc = require("lodash.findKey"); +import findLastFunc = require("lodash.findLast"); +import findLastIndexFunc = require("lodash.findLastIndex"); +import findLastKeyFunc = require("lodash.findLastKey"); +import floorFunc = require("lodash.floor"); +import forEachFunc = require("lodash.forEach"); +import forEachRightFunc = require("lodash.forEachRight"); +import forInFunc = require("lodash.forIn"); +import forInRightFunc = require("lodash.forInRight"); +import forOwnFunc = require("lodash.forOwn"); +import forOwnRightFunc = require("lodash.forOwnRight"); +import getFunc = require("lodash.get"); +import gtFunc = require("lodash.gt"); +import gteFunc = require("lodash.gte"); +import hasFunc = require("lodash.has"); +import hasInFunc = require("lodash.hasIn"); +import headFunc = require("lodash.head"); +import identityFunc = require("lodash.identity"); +import includesFunc = require("lodash.includes"); +import indexOfFunc = require("lodash.indexOf"); +import inRangeFunc = require("lodash.inRange"); +import invokeFunc = require("lodash.invoke"); +import isArgumentsFunc = require("lodash.isArguments"); +import isArrayFunc = require("lodash.isArray"); +import isArrayBufferFunc = require("lodash.isArrayBuffer"); +import isArrayLikeFunc = require("lodash.isArrayLike"); +import isArrayLikeObjectFunc = require("lodash.isArrayLikeObject"); +import isBooleanFunc = require("lodash.isBoolean"); +import isBufferFunc = require("lodash.isBuffer"); +import isDateFunc = require("lodash.isDate"); +import isElementFunc = require("lodash.isElement"); +import isEmptyFunc = require("lodash.isEmpty"); +import isEqualFunc = require("lodash.isEqual"); +import isEqualWithFunc = require("lodash.isEqualWith"); +import isErrorFunc = require("lodash.isError"); +import isFiniteFunc = require("lodash.isFinite"); +import isFunctionFunc = require("lodash.isFunction"); +import isIntegerFunc = require("lodash.isInteger"); +import isLengthFunc = require("lodash.isLength"); +import isMapFunc = require("lodash.isMap"); +import isMatchFunc = require("lodash.isMatch"); +import isMatchWithFunc = require("lodash.isMatchWith"); +import isNaNFunc = require("lodash.isNaN"); +import isNativeFunc = require("lodash.isNative"); +import isNilFunc = require("lodash.isNil"); +import isNullFunc = require("lodash.isNull"); +import isNumberFunc = require("lodash.isNumber"); +import isObjectFunc = require("lodash.isObject"); +import isObjectLikeFunc = require("lodash.isObjectLike"); +import isPlainObjectFunc = require("lodash.isPlainObject"); +import isRegExpFunc = require("lodash.isRegExp"); +import isSafeIntegerFunc = require("lodash.isSafeInteger"); +import isSetFunc = require("lodash.isSet"); +import isStringFunc = require("lodash.isString"); +import isSymbolFunc = require("lodash.isSymbol"); +import isTypedArrayFunc = require("lodash.isTypedArray"); +import isUndefinedFunc = require("lodash.isUndefined"); +import isWeakMapFunc = require("lodash.isWeakMap"); +import isWeakSetFunc = require("lodash.isWeakSet"); +import joinFunc = require("lodash.join"); +import kebabCaseFunc = require("lodash.kebabCase"); +import lastFunc = require("lodash.last"); +import lastIndexOfFunc = require("lodash.lastIndexOf"); +import lowerCaseFunc = require("lodash.lowerCase"); +import lowerFirstFunc = require("lodash.lowerFirst"); +import ltFunc = require("lodash.lt"); +import lteFunc = require("lodash.lte"); +import maxFunc = require("lodash.max"); +import maxByFunc = require("lodash.maxBy"); +import meanFunc = require("lodash.mean"); +import minFunc = require("lodash.min"); +import minByFunc = require("lodash.minBy"); +import noConflictFunc = require("lodash.noConflict"); +import noopFunc = require("lodash.noop"); +import nowFunc = require("lodash.now"); +import padFunc = require("lodash.pad"); +import padEndFunc = require("lodash.padEnd"); +import padStartFunc = require("lodash.padStart"); +import parseIntFunc = require("lodash.parseInt"); +import randomFunc = require("lodash.random"); +import reduceFunc = require("lodash.reduce"); +import reduceRightFunc = require("lodash.reduceRight"); +import repeatFunc = require("lodash.repeat"); +import replaceFunc = require("lodash.replace"); +import resultFunc = require("lodash.result"); +import roundFunc = require("lodash.round"); +import runInContextFunc = require("lodash.runInContext"); +import sampleFunc = require("lodash.sample"); +import sizeFunc = require("lodash.size"); +import snakeCaseFunc = require("lodash.snakeCase"); +import someFunc = require("lodash.some"); +import sortedIndexFunc = require("lodash.sortedIndex"); +import sortedIndexByFunc = require("lodash.sortedIndexBy"); +import sortedIndexOfFunc = require("lodash.sortedIndexOf"); +import sortedLastIndexFunc = require("lodash.sortedLastIndex"); +import sortedLastIndexByFunc = require("lodash.sortedLastIndexBy"); +import sortedLastIndexOfFunc = require("lodash.sortedLastIndexOf"); +import startCaseFunc = require("lodash.startCase"); +import startsWithFunc = require("lodash.startsWith"); +import subtractFunc = require("lodash.subtract"); +import sumFunc = require("lodash.sum"); +import sumByFunc = require("lodash.sumBy"); +import templateFunc = require("lodash.template"); +import timesFunc = require("lodash.times"); +import toIntegerFunc = require("lodash.toInteger"); +import toLengthFunc = require("lodash.toLength"); +import toLowerFunc = require("lodash.toLower"); +import toNumberFunc = require("lodash.toNumber"); +import toSafeIntegerFunc = require("lodash.toSafeInteger"); +import toStringFunc = require("lodash.toString"); +import toUpperFunc = require("lodash.toUpper"); +import trimFunc = require("lodash.trim"); +import trimEndFunc = require("lodash.trimEnd"); +import trimStartFunc = require("lodash.trimStart"); +import truncateFunc = require("lodash.truncate"); +import unescapeFunc = require("lodash.unescape"); +import uniqueIdFunc = require("lodash.uniqueId"); +import upperCaseFunc = require("lodash.upperCase"); +import upperFirstFunc = require("lodash.upperFirst"); +import eachFunc = require("lodash.each"); +import eachRightFunc = require("lodash.eachRight"); +import firstFunc = require("lodash.first"); +namespace method_modules_tests { + _.after = afterFunc; + _.ary = aryFunc; + _.assign = assignFunc; + _.assignIn = assignInFunc; + _.assignInWith = assignInWithFunc; + _.assignWith = assignWithFunc; + _.at = atFunc; + _.before = beforeFunc; + _.bind = bindFunc; + _.bindAll = bindAllFunc; + _.bindKey = bindKeyFunc; + _.castArray = castArrayFunc; + _.chain = chainFunc; + _.chunk = chunkFunc; + _.compact = compactFunc; + _.concat = concatFunc; + _.constant = constantFunc; + _.countBy = countByFunc; + _.create = createFunc; + _.curry = curryFunc; + _.curryRight = curryRightFunc; + _.debounce = debounceFunc; + _.defaults = defaultsFunc; + _.defaultsDeep = defaultsDeepFunc; + _.defer = deferFunc; + _.delay = delayFunc; + _.difference = differenceFunc; + _.differenceBy = differenceByFunc; + _.differenceWith = differenceWithFunc; + _.drop = dropFunc; + _.dropRight = dropRightFunc; + _.dropRightWhile = dropRightWhileFunc; + _.dropWhile = dropWhileFunc; + _.fill = fillFunc; + _.filter = filterFunc; + _.flatMap = flatMapFunc; + _.flatten = flattenFunc; + _.flattenDeep = flattenDeepFunc; + _.flattenDepth = flattenDepthFunc; + _.flip = flipFunc; + _.flow = flowFunc; + _.flowRight = flowRightFunc; + _.fromPairs = fromPairsFunc; + _.functions = functionsFunc; + _.functionsIn = functionsInFunc; + _.groupBy = groupByFunc; + _.initial = initialFunc; + _.intersection = intersectionFunc; + _.intersectionBy = intersectionByFunc; + _.intersectionWith = intersectionWithFunc; + _.invert = invertFunc; + _.invertBy = invertByFunc; + _.invokeMap = invokeMapFunc; + _.iteratee = iterateeFunc; + _.keyBy = keyByFunc; + _.keys = keysFunc; + _.keysIn = keysInFunc; + _.map = mapFunc; + _.mapKeys = mapKeysFunc; + _.mapValues = mapValuesFunc; + _.matches = matchesFunc; + _.matchesProperty = matchesPropertyFunc; + _.memoize = memoizeFunc; + _.merge = mergeFunc; + _.mergeWith = mergeWithFunc; + _.method = methodFunc; + _.methodOf = methodOfFunc; + _.mixin = mixinFunc; + _.negate = negateFunc; + _.nthArg = nthArgFunc; + _.omit = omitFunc; + _.omitBy = omitByFunc; + _.once = onceFunc; + _.orderBy = orderByFunc; + _.over = overFunc; + _.overArgs = overArgsFunc; + _.overEvery = overEveryFunc; + _.overSome = overSomeFunc; + _.partial = partialFunc; + _.partialRight = partialRightFunc; + _.partition = partitionFunc; + _.pick = pickFunc; + _.pickBy = pickByFunc; + _.property = propertyFunc; + _.propertyOf = propertyOfFunc; + _.pull = pullFunc; + _.pullAll = pullAllFunc; + _.pullAllBy = pullAllByFunc; + _.pullAt = pullAtFunc; + _.range = rangeFunc; + _.rangeRight = rangeRightFunc; + _.rearg = reargFunc; + _.reject = rejectFunc; + _.remove = removeFunc; + _.rest = restFunc; + _.reverse = reverseFunc; + _.sampleSize = sampleSizeFunc; + _.set = setFunc; + _.setWith = setWithFunc; + _.shuffle = shuffleFunc; + _.slice = sliceFunc; + _.sortBy = sortByFunc; + _.sortedUniq = sortedUniqFunc; + _.sortedUniqBy = sortedUniqByFunc; + _.split = splitFunc; + _.spread = spreadFunc; + _.tail = tailFunc; + _.take = takeFunc; + _.takeRight = takeRightFunc; + _.takeRightWhile = takeRightWhileFunc; + _.takeWhile = takeWhileFunc; + _.tap = tapFunc; + _.throttle = throttleFunc; + _.thru = thruFunc; + _.toArray = toArrayFunc; + _.toPairs = toPairsFunc; + _.toPairsIn = toPairsInFunc; + _.toPath = toPathFunc; + _.toPlainObject = toPlainObjectFunc; + _.transform = transformFunc; + _.unary = unaryFunc; + _.union = unionFunc; + _.unionBy = unionByFunc; + _.unionWith = unionWithFunc; + _.uniq = uniqFunc; + _.uniqBy = uniqByFunc; + _.uniqWith = uniqWithFunc; + _.unset = unsetFunc; + _.unzip = unzipFunc; + _.unzipWith = unzipWithFunc; + _.update = updateFunc; + _.values = valuesFunc; + _.valuesIn = valuesInFunc; + _.without = withoutFunc; + _.words = wordsFunc; + _.wrap = wrapFunc; + _.xor = xorFunc; + _.xorBy = xorByFunc; + _.xorWith = xorWithFunc; + _.zip = zipFunc; + _.zipObject = zipObjectFunc; + _.zipWith = zipWithFunc; + _.extend = extendFunc; + _.extendWith = extendWithFunc; + _.add = addFunc; + _.attempt = attemptFunc; + _.camelCase = camelCaseFunc; + _.capitalize = capitalizeFunc; + _.ceil = ceilFunc; + _.clamp = clampFunc; + _.clone = cloneFunc; + _.cloneDeep = cloneDeepFunc; + _.cloneDeepWith = cloneDeepWithFunc; + _.cloneWith = cloneWithFunc; + _.deburr = deburrFunc; + _.endsWith = endsWithFunc; + _.eq = eqFunc; + _.escape = escapeFunc; + _.escapeRegExp = escapeRegExpFunc; + _.every = everyFunc; + _.find = findFunc; + _.findIndex = findIndexFunc; + _.findKey = findKeyFunc; + _.findLast = findLastFunc; + _.findLastIndex = findLastIndexFunc; + _.findLastKey = findLastKeyFunc; + _.floor = floorFunc; + _.forEach = forEachFunc; + _.forEachRight = forEachRightFunc; + _.forIn = forInFunc; + _.forInRight = forInRightFunc; + _.forOwn = forOwnFunc; + _.forOwnRight = forOwnRightFunc; + _.get = getFunc; + _.gt = gtFunc; + _.gte = gteFunc; + _.has = hasFunc; + _.hasIn = hasInFunc; + _.head = headFunc; + _.identity = identityFunc; + _.includes = includesFunc; + _.indexOf = indexOfFunc; + _.inRange = inRangeFunc; + _.invoke = invokeFunc; + _.isArguments = isArgumentsFunc; + _.isArray = isArrayFunc; + _.isArrayBuffer = isArrayBufferFunc; + _.isArrayLike = isArrayLikeFunc; + _.isArrayLikeObject = isArrayLikeObjectFunc; + _.isBoolean = isBooleanFunc; + _.isBuffer = isBufferFunc; + _.isDate = isDateFunc; + _.isElement = isElementFunc; + _.isEmpty = isEmptyFunc; + _.isEqual = isEqualFunc; + _.isEqualWith = isEqualWithFunc; + _.isError = isErrorFunc; + _.isFinite = isFiniteFunc; + _.isFunction = isFunctionFunc; + _.isInteger = isIntegerFunc; + _.isLength = isLengthFunc; + _.isMap = isMapFunc; + _.isMatch = isMatchFunc; + _.isMatchWith = isMatchWithFunc; + _.isNaN = isNaNFunc; + _.isNative = isNativeFunc; + _.isNil = isNilFunc; + _.isNull = isNullFunc; + _.isNumber = isNumberFunc; + _.isObject = isObjectFunc; + _.isObjectLike = isObjectLikeFunc; + _.isPlainObject = isPlainObjectFunc; + _.isRegExp = isRegExpFunc; + _.isSafeInteger = isSafeIntegerFunc; + _.isSet = isSetFunc; + _.isString = isStringFunc; + _.isSymbol = isSymbolFunc; + _.isTypedArray = isTypedArrayFunc; + _.isUndefined = isUndefinedFunc; + _.isWeakMap = isWeakMapFunc; + _.isWeakSet = isWeakSetFunc; + _.join = joinFunc; + _.kebabCase = kebabCaseFunc; + _.last = lastFunc; + _.lastIndexOf = lastIndexOfFunc; + _.lowerCase = lowerCaseFunc; + _.lowerFirst = lowerFirstFunc; + _.lt = ltFunc; + _.lte = lteFunc; + _.max = maxFunc; + _.maxBy = maxByFunc; + _.mean = meanFunc; + _.min = minFunc; + _.minBy = minByFunc; + _.noConflict = noConflictFunc; + _.noop = noopFunc; + _.now = nowFunc; + _.pad = padFunc; + _.padEnd = padEndFunc; + _.padStart = padStartFunc; + _.parseInt = parseIntFunc; + _.random = randomFunc; + _.reduce = reduceFunc; + _.reduceRight = reduceRightFunc; + _.repeat = repeatFunc; + _.replace = replaceFunc; + _.result = resultFunc; + _.round = roundFunc; + _.runInContext = runInContextFunc; + _.sample = sampleFunc; + _.size = sizeFunc; + _.snakeCase = snakeCaseFunc; + _.some = someFunc; + _.sortedIndex = sortedIndexFunc; + _.sortedIndexBy = sortedIndexByFunc; + _.sortedIndexOf = sortedIndexOfFunc; + _.sortedLastIndex = sortedLastIndexFunc; + _.sortedLastIndexBy = sortedLastIndexByFunc; + _.sortedLastIndexOf = sortedLastIndexOfFunc; + _.startCase = startCaseFunc; + _.startsWith = startsWithFunc; + _.subtract = subtractFunc; + _.sum = sumFunc; + _.sumBy = sumByFunc; + _.template = templateFunc; + _.times = timesFunc; + _.toInteger = toIntegerFunc; + _.toLength = toLengthFunc; + _.toLower = toLowerFunc; + _.toNumber = toNumberFunc; + _.toSafeInteger = toSafeIntegerFunc; + _.toString = toStringFunc; + _.toUpper = toUpperFunc; + _.trim = trimFunc; + _.trimEnd = trimEndFunc; + _.trimStart = trimStartFunc; + _.truncate = truncateFunc; + _.unescape = unescapeFunc; + _.uniqueId = uniqueIdFunc; + _.upperCase = upperCaseFunc; + _.upperFirst = upperFirstFunc; + _.each = eachFunc; + _.eachRight = eachRightFunc; + _.first = firstFunc; +} diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 3305528a5e..961520e6c4 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -21031,6 +21031,1835 @@ declare module "lodash" { export = _; } +/************************************************* + * * + * The lodash method _.XXX exported as a module. * + * * + *************************************************/ + + +declare module "lodash.after" { + const after: typeof _.after; + export = after; +} + + +declare module "lodash.ary" { + const ary: typeof _.ary; + export = ary; +} + + +declare module "lodash.assign" { + const assign: typeof _.assign; + export = assign; +} + + +declare module "lodash.assignIn" { + const assignIn: typeof _.assignIn; + export = assignIn; +} + + +declare module "lodash.assignInWith" { + const assignInWith: typeof _.assignInWith; + export = assignInWith; +} + + +declare module "lodash.assignWith" { + const assignWith: typeof _.assignWith; + export = assignWith; +} + + +declare module "lodash.at" { + const at: typeof _.at; + export = at; +} + + +declare module "lodash.before" { + const before: typeof _.before; + export = before; +} + + +declare module "lodash.bind" { + const bind: typeof _.bind; + export = bind; +} + + +declare module "lodash.bindAll" { + const bindAll: typeof _.bindAll; + export = bindAll; +} + + +declare module "lodash.bindKey" { + const bindKey: typeof _.bindKey; + export = bindKey; +} + + +declare module "lodash.castArray" { + const castArray: typeof _.castArray; + export = castArray; +} + + +declare module "lodash.chain" { + const chain: typeof _.chain; + export = chain; +} + + +declare module "lodash.chunk" { + const chunk: typeof _.chunk; + export = chunk; +} + + +declare module "lodash.compact" { + const compact: typeof _.compact; + export = compact; +} + + +declare module "lodash.concat" { + const concat: typeof _.concat; + export = concat; +} + +/** +* uncoment it if definition exists +*/ +/* +declare module "lodash.cond" { + const cond: typeof _.cond; + export = cond; +} +*/ + +/** +* uncoment it if definition exists +*/ +/* +declare module "lodash.conforms" { + const conforms: typeof _.conforms; + export = conforms; +} +*/ + +declare module "lodash.constant" { + const constant: typeof _.constant; + export = constant; +} + + +declare module "lodash.countBy" { + const countBy: typeof _.countBy; + export = countBy; +} + + +declare module "lodash.create" { + const create: typeof _.create; + export = create; +} + + +declare module "lodash.curry" { + const curry: typeof _.curry; + export = curry; +} + + +declare module "lodash.curryRight" { + const curryRight: typeof _.curryRight; + export = curryRight; +} + + +declare module "lodash.debounce" { + const debounce: typeof _.debounce; + export = debounce; +} + + +declare module "lodash.defaults" { + const defaults: typeof _.defaults; + export = defaults; +} + + +declare module "lodash.defaultsDeep" { + const defaultsDeep: typeof _.defaultsDeep; + export = defaultsDeep; +} + + +declare module "lodash.defer" { + const defer: typeof _.defer; + export = defer; +} + + +declare module "lodash.delay" { + const delay: typeof _.delay; + export = delay; +} + + +declare module "lodash.difference" { + const difference: typeof _.difference; + export = difference; +} + + +declare module "lodash.differenceBy" { + const differenceBy: typeof _.differenceBy; + export = differenceBy; +} + + +declare module "lodash.differenceWith" { + const differenceWith: typeof _.differenceWith; + export = differenceWith; +} + + +declare module "lodash.drop" { + const drop: typeof _.drop; + export = drop; +} + + +declare module "lodash.dropRight" { + const dropRight: typeof _.dropRight; + export = dropRight; +} + + +declare module "lodash.dropRightWhile" { + const dropRightWhile: typeof _.dropRightWhile; + export = dropRightWhile; +} + + +declare module "lodash.dropWhile" { + const dropWhile: typeof _.dropWhile; + export = dropWhile; +} + + +declare module "lodash.fill" { + const fill: typeof _.fill; + export = fill; +} + + +declare module "lodash.filter" { + const filter: typeof _.filter; + export = filter; +} + + +declare module "lodash.flatMap" { + const flatMap: typeof _.flatMap; + export = flatMap; +} + +/** +* uncoment it if definition exists +*/ +/* +declare module "lodash.flatMapDeep" { + const flatMapDeep: typeof _.flatMapDeep; + export = flatMapDeep; +} +*/ +/** +* uncoment it if definition exists +*/ +/* +declare module "lodash.flatMapDepth" { + const flatMapDepth: typeof _.flatMapDepth; + export = flatMapDepth; +} +*/ + +declare module "lodash.flatten" { + const flatten: typeof _.flatten; + export = flatten; +} + + +declare module "lodash.flattenDeep" { + const flattenDeep: typeof _.flattenDeep; + export = flattenDeep; +} + +declare module "lodash.flattenDepth" { + const flattenDepth: typeof _.flattenDepth; + export = flattenDepth; +} + +declare module "lodash.flip" { + const flip: typeof _.flip; + export = flip; +} + + +declare module "lodash.flow" { + const flow: typeof _.flow; + export = flow; +} + + +declare module "lodash.flowRight" { + const flowRight: typeof _.flowRight; + export = flowRight; +} + + +declare module "lodash.fromPairs" { + const fromPairs: typeof _.fromPairs; + export = fromPairs; +} + + +declare module "lodash.functions" { + const functions: typeof _.functions; + export = functions; +} + + +declare module "lodash.functionsIn" { + const functionsIn: typeof _.functionsIn; + export = functionsIn; +} + + +declare module "lodash.groupBy" { + const groupBy: typeof _.groupBy; + export = groupBy; +} + + +declare module "lodash.initial" { + const initial: typeof _.initial; + export = initial; +} + + +declare module "lodash.intersection" { + const intersection: typeof _.intersection; + export = intersection; +} + + +declare module "lodash.intersectionBy" { + const intersectionBy: typeof _.intersectionBy; + export = intersectionBy; +} + + +declare module "lodash.intersectionWith" { + const intersectionWith: typeof _.intersectionWith; + export = intersectionWith; +} + + +declare module "lodash.invert" { + const invert: typeof _.invert; + export = invert; +} + + +declare module "lodash.invertBy" { + const invertBy: typeof _.invertBy; + export = invertBy; +} + + +declare module "lodash.invokeMap" { + const invokeMap: typeof _.invokeMap; + export = invokeMap; +} + + +declare module "lodash.iteratee" { + const iteratee: typeof _.iteratee; + export = iteratee; +} + + +declare module "lodash.keyBy" { + const keyBy: typeof _.keyBy; + export = keyBy; +} + + +declare module "lodash.keys" { + const keys: typeof _.keys; + export = keys; +} + + +declare module "lodash.keysIn" { + const keysIn: typeof _.keysIn; + export = keysIn; +} + + +declare module "lodash.map" { + const map: typeof _.map; + export = map; +} + + +declare module "lodash.mapKeys" { + const mapKeys: typeof _.mapKeys; + export = mapKeys; +} + + +declare module "lodash.mapValues" { + const mapValues: typeof _.mapValues; + export = mapValues; +} + + +declare module "lodash.matches" { + const matches: typeof _.matches; + export = matches; +} + + +declare module "lodash.matchesProperty" { + const matchesProperty: typeof _.matchesProperty; + export = matchesProperty; +} + + +declare module "lodash.memoize" { + const memoize: typeof _.memoize; + export = memoize; +} + + +declare module "lodash.merge" { + const merge: typeof _.merge; + export = merge; +} + + +declare module "lodash.mergeWith" { + const mergeWith: typeof _.mergeWith; + export = mergeWith; +} + + +declare module "lodash.method" { + const method: typeof _.method; + export = method; +} + + +declare module "lodash.methodOf" { + const methodOf: typeof _.methodOf; + export = methodOf; +} + + +declare module "lodash.mixin" { + const mixin: typeof _.mixin; + export = mixin; +} + + +declare module "lodash.negate" { + const negate: typeof _.negate; + export = negate; +} + + +declare module "lodash.nthArg" { + const nthArg: typeof _.nthArg; + export = nthArg; +} + + +declare module "lodash.omit" { + const omit: typeof _.omit; + export = omit; +} + + +declare module "lodash.omitBy" { + const omitBy: typeof _.omitBy; + export = omitBy; +} + + +declare module "lodash.once" { + const once: typeof _.once; + export = once; +} + + +declare module "lodash.orderBy" { + const orderBy: typeof _.orderBy; + export = orderBy; +} + + +declare module "lodash.over" { + const over: typeof _.over; + export = over; +} + + +declare module "lodash.overArgs" { + const overArgs: typeof _.overArgs; + export = overArgs; +} + + +declare module "lodash.overEvery" { + const overEvery: typeof _.overEvery; + export = overEvery; +} + + +declare module "lodash.overSome" { + const overSome: typeof _.overSome; + export = overSome; +} + + +declare module "lodash.partial" { + const partial: typeof _.partial; + export = partial; +} + + +declare module "lodash.partialRight" { + const partialRight: typeof _.partialRight; + export = partialRight; +} + + +declare module "lodash.partition" { + const partition: typeof _.partition; + export = partition; +} + + +declare module "lodash.pick" { + const pick: typeof _.pick; + export = pick; +} + + +declare module "lodash.pickBy" { + const pickBy: typeof _.pickBy; + export = pickBy; +} + + +declare module "lodash.property" { + const property: typeof _.property; + export = property; +} + + +declare module "lodash.propertyOf" { + const propertyOf: typeof _.propertyOf; + export = propertyOf; +} + + +declare module "lodash.pull" { + const pull: typeof _.pull; + export = pull; +} + + +declare module "lodash.pullAll" { + const pullAll: typeof _.pullAll; + export = pullAll; +} + + +declare module "lodash.pullAllBy" { + const pullAllBy: typeof _.pullAllBy; + export = pullAllBy; +} + +/** +* uncoment it if definition exists +*/ +/* +declare module "lodash.pullAllWith" { + const pullAllWith: typeof _.pullAllWith; + export = pullAllWith; +} +*/ + +declare module "lodash.pullAt" { + const pullAt: typeof _.pullAt; + export = pullAt; +} + + +declare module "lodash.range" { + const range: typeof _.range; + export = range; +} + + +declare module "lodash.rangeRight" { + const rangeRight: typeof _.rangeRight; + export = rangeRight; +} + + +declare module "lodash.rearg" { + const rearg: typeof _.rearg; + export = rearg; +} + + +declare module "lodash.reject" { + const reject: typeof _.reject; + export = reject; +} + + +declare module "lodash.remove" { + const remove: typeof _.remove; + export = remove; +} + + +declare module "lodash.rest" { + const rest: typeof _.rest; + export = rest; +} + + +declare module "lodash.reverse" { + const reverse: typeof _.reverse; + export = reverse; +} + + +declare module "lodash.sampleSize" { + const sampleSize: typeof _.sampleSize; + export = sampleSize; +} + + +declare module "lodash.set" { + const set: typeof _.set; + export = set; +} + + +declare module "lodash.setWith" { + const setWith: typeof _.setWith; + export = setWith; +} + + +declare module "lodash.shuffle" { + const shuffle: typeof _.shuffle; + export = shuffle; +} + + +declare module "lodash.slice" { + const slice: typeof _.slice; + export = slice; +} + + +declare module "lodash.sortBy" { + const sortBy: typeof _.sortBy; + export = sortBy; +} + + +declare module "lodash.sortedUniq" { + const sortedUniq: typeof _.sortedUniq; + export = sortedUniq; +} + + +declare module "lodash.sortedUniqBy" { + const sortedUniqBy: typeof _.sortedUniqBy; + export = sortedUniqBy; +} + + +declare module "lodash.split" { + const split: typeof _.split; + export = split; +} + + +declare module "lodash.spread" { + const spread: typeof _.spread; + export = spread; +} + + +declare module "lodash.tail" { + const tail: typeof _.tail; + export = tail; +} + + +declare module "lodash.take" { + const take: typeof _.take; + export = take; +} + + +declare module "lodash.takeRight" { + const takeRight: typeof _.takeRight; + export = takeRight; +} + + +declare module "lodash.takeRightWhile" { + const takeRightWhile: typeof _.takeRightWhile; + export = takeRightWhile; +} + + +declare module "lodash.takeWhile" { + const takeWhile: typeof _.takeWhile; + export = takeWhile; +} + + +declare module "lodash.tap" { + const tap: typeof _.tap; + export = tap; +} + + +declare module "lodash.throttle" { + const throttle: typeof _.throttle; + export = throttle; +} + + +declare module "lodash.thru" { + const thru: typeof _.thru; + export = thru; +} + + +declare module "lodash.toArray" { + const toArray: typeof _.toArray; + export = toArray; +} + + +declare module "lodash.toPairs" { + const toPairs: typeof _.toPairs; + export = toPairs; +} + + +declare module "lodash.toPairsIn" { + const toPairsIn: typeof _.toPairsIn; + export = toPairsIn; +} + + +declare module "lodash.toPath" { + const toPath: typeof _.toPath; + export = toPath; +} + + +declare module "lodash.toPlainObject" { + const toPlainObject: typeof _.toPlainObject; + export = toPlainObject; +} + + +declare module "lodash.transform" { + const transform: typeof _.transform; + export = transform; +} + + +declare module "lodash.unary" { + const unary: typeof _.unary; + export = unary; +} + + +declare module "lodash.union" { + const union: typeof _.union; + export = union; +} + + +declare module "lodash.unionBy" { + const unionBy: typeof _.unionBy; + export = unionBy; +} + + +declare module "lodash.unionWith" { + const unionWith: typeof _.unionWith; + export = unionWith; +} + + +declare module "lodash.uniq" { + const uniq: typeof _.uniq; + export = uniq; +} + + +declare module "lodash.uniqBy" { + const uniqBy: typeof _.uniqBy; + export = uniqBy; +} + + +declare module "lodash.uniqWith" { + const uniqWith: typeof _.uniqWith; + export = uniqWith; +} + + +declare module "lodash.unset" { + const unset: typeof _.unset; + export = unset; +} + + +declare module "lodash.unzip" { + const unzip: typeof _.unzip; + export = unzip; +} + + +declare module "lodash.unzipWith" { + const unzipWith: typeof _.unzipWith; + export = unzipWith; +} + + +declare module "lodash.update" { + const update: typeof _.update; + export = update; +} + +/** +* uncoment it if definition exists +*/ +/* +declare module "lodash.updateWith" { + const updateWith: typeof _.updateWith; + export = updateWith; +} +*/ + +declare module "lodash.values" { + const values: typeof _.values; + export = values; +} + + +declare module "lodash.valuesIn" { + const valuesIn: typeof _.valuesIn; + export = valuesIn; +} + + +declare module "lodash.without" { + const without: typeof _.without; + export = without; +} + + +declare module "lodash.words" { + const words: typeof _.words; + export = words; +} + + +declare module "lodash.wrap" { + const wrap: typeof _.wrap; + export = wrap; +} + + +declare module "lodash.xor" { + const xor: typeof _.xor; + export = xor; +} + + +declare module "lodash.xorBy" { + const xorBy: typeof _.xorBy; + export = xorBy; +} + + +declare module "lodash.xorWith" { + const xorWith: typeof _.xorWith; + export = xorWith; +} + + +declare module "lodash.zip" { + const zip: typeof _.zip; + export = zip; +} + + +declare module "lodash.zipObject" { + const zipObject: typeof _.zipObject; + export = zipObject; +} + +/** +* uncoment it if definition exists +*/ +/* +declare module "lodash.zipObjectDeep" { + const zipObjectDeep: typeof _.zipObjectDeep; + export = zipObjectDeep; +} +*/ + + +declare module "lodash.zipWith" { + const zipWith: typeof _.zipWith; + export = zipWith; +} + +/** +* uncoment it if definition exists +*/ +/* +declare module "lodash.entries" { + const entries: typeof _.entries; + export = entries; +} +*/ +/** +* uncoment it if definition exists +*/ +/* +declare module "lodash.entriesIn" { + const entriesIn: typeof _.entriesIn; + export = entriesIn; +} +*/ + + +declare module "lodash.extend" { + const extend: typeof _.extend; + export = extend; +} + + +declare module "lodash.extendWith" { + const extendWith: typeof _.extendWith; + export = extendWith; +} + + +declare module "lodash.add" { + const add: typeof _.add; + export = add; +} + + +declare module "lodash.attempt" { + const attempt: typeof _.attempt; + export = attempt; +} + + +declare module "lodash.camelCase" { + const camelCase: typeof _.camelCase; + export = camelCase; +} + + +declare module "lodash.capitalize" { + const capitalize: typeof _.capitalize; + export = capitalize; +} + + +declare module "lodash.ceil" { + const ceil: typeof _.ceil; + export = ceil; +} + + +declare module "lodash.clamp" { + const clamp: typeof _.clamp; + export = clamp; +} + + +declare module "lodash.clone" { + const clone: typeof _.clone; + export = clone; +} + + +declare module "lodash.cloneDeep" { + const cloneDeep: typeof _.cloneDeep; + export = cloneDeep; +} + + +declare module "lodash.cloneDeepWith" { + const cloneDeepWith: typeof _.cloneDeepWith; + export = cloneDeepWith; +} + + +declare module "lodash.cloneWith" { + const cloneWith: typeof _.cloneWith; + export = cloneWith; +} + + +declare module "lodash.deburr" { + const deburr: typeof _.deburr; + export = deburr; +} + +/** +* uncoment it if definition exists +*/ +/* +declare module "lodash.divide" { + const divide: typeof _.divide; + export = divide; +} +*/ + +declare module "lodash.endsWith" { + const endsWith: typeof _.endsWith; + export = endsWith; +} + + +declare module "lodash.eq" { + const eq: typeof _.eq; + export = eq; +} + + +declare module "lodash.escape" { + const escape: typeof _.escape; + export = escape; +} + + +declare module "lodash.escapeRegExp" { + const escapeRegExp: typeof _.escapeRegExp; + export = escapeRegExp; +} + + +declare module "lodash.every" { + const every: typeof _.every; + export = every; +} + + +declare module "lodash.find" { + const find: typeof _.find; + export = find; +} + + +declare module "lodash.findIndex" { + const findIndex: typeof _.findIndex; + export = findIndex; +} + + +declare module "lodash.findKey" { + const findKey: typeof _.findKey; + export = findKey; +} + + +declare module "lodash.findLast" { + const findLast: typeof _.findLast; + export = findLast; +} + + +declare module "lodash.findLastIndex" { + const findLastIndex: typeof _.findLastIndex; + export = findLastIndex; +} + + +declare module "lodash.findLastKey" { + const findLastKey: typeof _.findLastKey; + export = findLastKey; +} + + +declare module "lodash.floor" { + const floor: typeof _.floor; + export = floor; +} + + +declare module "lodash.forEach" { + const forEach: typeof _.forEach; + export = forEach; +} + + +declare module "lodash.forEachRight" { + const forEachRight: typeof _.forEachRight; + export = forEachRight; +} + + +declare module "lodash.forIn" { + const forIn: typeof _.forIn; + export = forIn; +} + + +declare module "lodash.forInRight" { + const forInRight: typeof _.forInRight; + export = forInRight; +} + + +declare module "lodash.forOwn" { + const forOwn: typeof _.forOwn; + export = forOwn; +} + + +declare module "lodash.forOwnRight" { + const forOwnRight: typeof _.forOwnRight; + export = forOwnRight; +} + + +declare module "lodash.get" { + const get: typeof _.get; + export = get; +} + + +declare module "lodash.gt" { + const gt: typeof _.gt; + export = gt; +} + + +declare module "lodash.gte" { + const gte: typeof _.gte; + export = gte; +} + + +declare module "lodash.has" { + const has: typeof _.has; + export = has; +} + + +declare module "lodash.hasIn" { + const hasIn: typeof _.hasIn; + export = hasIn; +} + + +declare module "lodash.head" { + const head: typeof _.head; + export = head; +} + + +declare module "lodash.identity" { + const identity: typeof _.identity; + export = identity; +} + + +declare module "lodash.includes" { + const includes: typeof _.includes; + export = includes; +} + + +declare module "lodash.indexOf" { + const indexOf: typeof _.indexOf; + export = indexOf; +} + + +declare module "lodash.inRange" { + const inRange: typeof _.inRange; + export = inRange; +} + + +declare module "lodash.invoke" { + const invoke: typeof _.invoke; + export = invoke; +} + + +declare module "lodash.isArguments" { + const isArguments: typeof _.isArguments; + export = isArguments; +} + + +declare module "lodash.isArray" { + const isArray: typeof _.isArray; + export = isArray; +} + + +declare module "lodash.isArrayBuffer" { + const isArrayBuffer: typeof _.isArrayBuffer; + export = isArrayBuffer; +} + + +declare module "lodash.isArrayLike" { + const isArrayLike: typeof _.isArrayLike; + export = isArrayLike; +} + + +declare module "lodash.isArrayLikeObject" { + const isArrayLikeObject: typeof _.isArrayLikeObject; + export = isArrayLikeObject; +} + + +declare module "lodash.isBoolean" { + const isBoolean: typeof _.isBoolean; + export = isBoolean; +} + + +declare module "lodash.isBuffer" { + const isBuffer: typeof _.isBuffer; + export = isBuffer; +} + + +declare module "lodash.isDate" { + const isDate: typeof _.isDate; + export = isDate; +} + + +declare module "lodash.isElement" { + const isElement: typeof _.isElement; + export = isElement; +} + + +declare module "lodash.isEmpty" { + const isEmpty: typeof _.isEmpty; + export = isEmpty; +} + + +declare module "lodash.isEqual" { + const isEqual: typeof _.isEqual; + export = isEqual; +} + + +declare module "lodash.isEqualWith" { + const isEqualWith: typeof _.isEqualWith; + export = isEqualWith; +} + + +declare module "lodash.isError" { + const isError: typeof _.isError; + export = isError; +} + + +declare module "lodash.isFinite" { + const isFinite: typeof _.isFinite; + export = isFinite; +} + + +declare module "lodash.isFunction" { + const isFunction: typeof _.isFunction; + export = isFunction; +} + + +declare module "lodash.isInteger" { + const isInteger: typeof _.isInteger; + export = isInteger; +} + + +declare module "lodash.isLength" { + const isLength: typeof _.isLength; + export = isLength; +} + + +declare module "lodash.isMap" { + const isMap: typeof _.isMap; + export = isMap; +} + + +declare module "lodash.isMatch" { + const isMatch: typeof _.isMatch; + export = isMatch; +} + + +declare module "lodash.isMatchWith" { + const isMatchWith: typeof _.isMatchWith; + export = isMatchWith; +} + + +declare module "lodash.isNaN" { + const isNaN: typeof _.isNaN; + export = isNaN; +} + + +declare module "lodash.isNative" { + const isNative: typeof _.isNative; + export = isNative; +} + + +declare module "lodash.isNil" { + const isNil: typeof _.isNil; + export = isNil; +} + + +declare module "lodash.isNull" { + const isNull: typeof _.isNull; + export = isNull; +} + + +declare module "lodash.isNumber" { + const isNumber: typeof _.isNumber; + export = isNumber; +} + + +declare module "lodash.isObject" { + const isObject: typeof _.isObject; + export = isObject; +} + + +declare module "lodash.isObjectLike" { + const isObjectLike: typeof _.isObjectLike; + export = isObjectLike; +} + + +declare module "lodash.isPlainObject" { + const isPlainObject: typeof _.isPlainObject; + export = isPlainObject; +} + + +declare module "lodash.isRegExp" { + const isRegExp: typeof _.isRegExp; + export = isRegExp; +} + + +declare module "lodash.isSafeInteger" { + const isSafeInteger: typeof _.isSafeInteger; + export = isSafeInteger; +} + + +declare module "lodash.isSet" { + const isSet: typeof _.isSet; + export = isSet; +} + + +declare module "lodash.isString" { + const isString: typeof _.isString; + export = isString; +} + + +declare module "lodash.isSymbol" { + const isSymbol: typeof _.isSymbol; + export = isSymbol; +} + + +declare module "lodash.isTypedArray" { + const isTypedArray: typeof _.isTypedArray; + export = isTypedArray; +} + + +declare module "lodash.isUndefined" { + const isUndefined: typeof _.isUndefined; + export = isUndefined; +} + + +declare module "lodash.isWeakMap" { + const isWeakMap: typeof _.isWeakMap; + export = isWeakMap; +} + + +declare module "lodash.isWeakSet" { + const isWeakSet: typeof _.isWeakSet; + export = isWeakSet; +} + + +declare module "lodash.join" { + const join: typeof _.join; + export = join; +} + + +declare module "lodash.kebabCase" { + const kebabCase: typeof _.kebabCase; + export = kebabCase; +} + + +declare module "lodash.last" { + const last: typeof _.last; + export = last; +} + + +declare module "lodash.lastIndexOf" { + const lastIndexOf: typeof _.lastIndexOf; + export = lastIndexOf; +} + + +declare module "lodash.lowerCase" { + const lowerCase: typeof _.lowerCase; + export = lowerCase; +} + + +declare module "lodash.lowerFirst" { + const lowerFirst: typeof _.lowerFirst; + export = lowerFirst; +} + + +declare module "lodash.lt" { + const lt: typeof _.lt; + export = lt; +} + + +declare module "lodash.lte" { + const lte: typeof _.lte; + export = lte; +} + + +declare module "lodash.max" { + const max: typeof _.max; + export = max; +} + + +declare module "lodash.maxBy" { + const maxBy: typeof _.maxBy; + export = maxBy; +} + + +declare module "lodash.mean" { + const mean: typeof _.mean; + export = mean; +} + +/** +* uncoment it if definition exists +*/ +/* +declare module "lodash.meanBy" { + const meanBy: typeof _.meanBy; + export = meanBy; +} +*/ + +declare module "lodash.min" { + const min: typeof _.min; + export = min; +} + + +declare module "lodash.minBy" { + const minBy: typeof _.minBy; + export = minBy; +} + +/** +* uncoment it if definition exists +*/ +/* +declare module "lodash.multiply" { + const multiply: typeof _.multiply; + export = multiply; +} +*/ + +/** +* uncoment it if definition exists +*/ +/* +declare module "lodash.nth" { + const nth: typeof _.nth; + export = nth; +} +*/ + +declare module "lodash.noConflict" { + const noConflict: typeof _.noConflict; + export = noConflict; +} + + +declare module "lodash.noop" { + const noop: typeof _.noop; + export = noop; +} + + +declare module "lodash.now" { + const now: typeof _.now; + export = now; +} + + +declare module "lodash.pad" { + const pad: typeof _.pad; + export = pad; +} + + +declare module "lodash.padEnd" { + const padEnd: typeof _.padEnd; + export = padEnd; +} + + +declare module "lodash.padStart" { + const padStart: typeof _.padStart; + export = padStart; +} + + +declare module "lodash.parseInt" { + const parseInt: typeof _.parseInt; + export = parseInt; +} + + +declare module "lodash.random" { + const random: typeof _.random; + export = random; +} + + +declare module "lodash.reduce" { + const reduce: typeof _.reduce; + export = reduce; +} + + +declare module "lodash.reduceRight" { + const reduceRight: typeof _.reduceRight; + export = reduceRight; +} + + +declare module "lodash.repeat" { + const repeat: typeof _.repeat; + export = repeat; +} + + +declare module "lodash.replace" { + const replace: typeof _.replace; + export = replace; +} + + +declare module "lodash.result" { + const result: typeof _.result; + export = result; +} + + +declare module "lodash.round" { + const round: typeof _.round; + export = round; +} + + +declare module "lodash.runInContext" { + const runInContext: typeof _.runInContext; + export = runInContext; +} + + +declare module "lodash.sample" { + const sample: typeof _.sample; + export = sample; +} + + +declare module "lodash.size" { + const size: typeof _.size; + export = size; +} + + +declare module "lodash.snakeCase" { + const snakeCase: typeof _.snakeCase; + export = snakeCase; +} + + +declare module "lodash.some" { + const some: typeof _.some; + export = some; +} + + +declare module "lodash.sortedIndex" { + const sortedIndex: typeof _.sortedIndex; + export = sortedIndex; +} + + +declare module "lodash.sortedIndexBy" { + const sortedIndexBy: typeof _.sortedIndexBy; + export = sortedIndexBy; +} + + +declare module "lodash.sortedIndexOf" { + const sortedIndexOf: typeof _.sortedIndexOf; + export = sortedIndexOf; +} + + +declare module "lodash.sortedLastIndex" { + const sortedLastIndex: typeof _.sortedLastIndex; + export = sortedLastIndex; +} + + +declare module "lodash.sortedLastIndexBy" { + const sortedLastIndexBy: typeof _.sortedLastIndexBy; + export = sortedLastIndexBy; +} + + +declare module "lodash.sortedLastIndexOf" { + const sortedLastIndexOf: typeof _.sortedLastIndexOf; + export = sortedLastIndexOf; +} + + +declare module "lodash.startCase" { + const startCase: typeof _.startCase; + export = startCase; +} + + +declare module "lodash.startsWith" { + const startsWith: typeof _.startsWith; + export = startsWith; +} + + +declare module "lodash.subtract" { + const subtract: typeof _.subtract; + export = subtract; +} + + +declare module "lodash.sum" { + const sum: typeof _.sum; + export = sum; +} + + +declare module "lodash.sumBy" { + const sumBy: typeof _.sumBy; + export = sumBy; +} + + +declare module "lodash.template" { + const template: typeof _.template; + export = template; +} + + +declare module "lodash.times" { + const times: typeof _.times; + export = times; +} + + +declare module "lodash.toInteger" { + const toInteger: typeof _.toInteger; + export = toInteger; +} + + +declare module "lodash.toLength" { + const toLength: typeof _.toLength; + export = toLength; +} + + +declare module "lodash.toLower" { + const toLower: typeof _.toLower; + export = toLower; +} + + +declare module "lodash.toNumber" { + const toNumber: typeof _.toNumber; + export = toNumber; +} + + +declare module "lodash.toSafeInteger" { + const toSafeInteger: typeof _.toSafeInteger; + export = toSafeInteger; +} + + +declare module "lodash.toString" { + const toString: typeof _.toString; + export = toString; +} + + +declare module "lodash.toUpper" { + const toUpper: typeof _.toUpper; + export = toUpper; +} + + +declare module "lodash.trim" { + const trim: typeof _.trim; + export = trim; +} + + +declare module "lodash.trimEnd" { + const trimEnd: typeof _.trimEnd; + export = trimEnd; +} + + +declare module "lodash.trimStart" { + const trimStart: typeof _.trimStart; + export = trimStart; +} + + +declare module "lodash.truncate" { + const truncate: typeof _.truncate; + export = truncate; +} + + +declare module "lodash.unescape" { + const unescape: typeof _.unescape; + export = unescape; +} + + +declare module "lodash.uniqueId" { + const uniqueId: typeof _.uniqueId; + export = uniqueId; +} + + +declare module "lodash.upperCase" { + const upperCase: typeof _.upperCase; + export = upperCase; +} + + +declare module "lodash.upperFirst" { + const upperFirst: typeof _.upperFirst; + export = upperFirst; +} + + +declare module "lodash.each" { + const each: typeof _.each; + export = each; +} + + +declare module "lodash.eachRight" { + const eachRight: typeof _.eachRight; + export = eachRight; +} + + +declare module "lodash.first" { + const first: typeof _.first; + export = first; +} + // Backward compatibility with --target es5 interface Set {} interface Map {} From 0ad40bb042ea5253673fab5e8a85da14f79d41ae Mon Sep 17 00:00:00 2001 From: TonyYang Date: Fri, 28 Oct 2016 23:54:55 +0800 Subject: [PATCH 103/246] [joi] Correct the validate function (#12306) * Correct the validate function * I lookup source code to correct validate func * Find the correct type assert for validate * According to new definition, to update tests * Delete redundant function * Enhance test completeness * Fix the error --- joi/joi-tests.ts | 75 ++++++++++++++++++++++++++++++++---------------- joi/joi.d.ts | 15 ++++++++-- 2 files changed, 63 insertions(+), 27 deletions(-) diff --git a/joi/joi-tests.ts b/joi/joi-tests.ts index c832b3eb05..7002a3872c 100644 --- a/joi/joi-tests.ts +++ b/joi/joi-tests.ts @@ -759,30 +759,57 @@ schema = Joi.lazy(() => schema) // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- -Joi.validate(value, obj); -Joi.validate(value, schema); -Joi.validate(value, schema, validOpts); -Joi.validate(value, schema, validOpts, (err, value) => { - x = value; - str = err.message; - str = err.details[0].path; - str = err.details[0].message; - str = err.details[0].type; -}); -Joi.validate(value, schema, (err, value) => { - x = value; - str = err.message; - str = err.details[0].path; - str = err.details[0].message; - str = err.details[0].type; -}); -// variant -Joi.validate(num, schema, validOpts, (err, value) => { - num = value; -}); +namespace validate_tests { + { + Joi.validate(value, obj); + Joi.validate(value, schema); + Joi.validate(value, schema, validOpts); + Joi.validate(value, schema, validOpts, (err, value) => { + x = value; + str = err.message; + str = err.details[0].path; + str = err.details[0].message; + str = err.details[0].type; + }); + Joi.validate(value, schema, (err, value) => { + x = value; + str = err.message; + str = err.details[0].path; + str = err.details[0].message; + str = err.details[0].type; + }); + // variant + Joi.validate(num, schema, validOpts, (err, value) => { + num = value; + }); + + // plain opts + Joi.validate(value, {}); + } + + { + let value = { username: 'example', password: 'example' }; + let schema = Joi.object().keys({ + username: Joi.string().max(255).required(), + password: Joi.string().regex(/^[a-zA-Z0-9]{3,255}$/).required(), + }); + let returnValue: Joi.ValidationResult; + + returnValue = Joi.validate(value); + value = Joi.validate(value, (err, value) => value); + + returnValue = Joi.validate(value, schema); + returnValue = Joi.validate(value, obj); + value = Joi.validate(value, obj, (err, value) => value); + value = Joi.validate(value, schema, (err, value) => value); + + returnValue = Joi.validate(value, schema, validOpts); + returnValue = Joi.validate(value, obj, validOpts); + value = Joi.validate(value, obj, validOpts, (err, value) => value); + value = Joi.validate(value, schema, validOpts, (err, value) => value); + } +} -// plain opts -Joi.validate(value, {}); // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- @@ -856,4 +883,4 @@ schema = Joi.raw(); schema = Joi.raw(bool); schema = Joi.empty(); schema = Joi.empty(str); -schema = Joi.empty(anySchema); \ No newline at end of file +schema = Joi.empty(anySchema); diff --git a/joi/joi.d.ts b/joi/joi.d.ts index a4a029f737..9a7d73cbbf 100644 --- a/joi/joi.d.ts +++ b/joi/joi.d.ts @@ -842,9 +842,18 @@ declare module 'joi' { /** * Validates a value using the given schema and options. */ - export function validate(value: T, schema: Schema, callback: (err: ValidationError, value: T) => void): void; - export function validate(value: T, schema: Object, callback: (err: ValidationError, value: T) => void): void; - export function validate(value: T, schema: Object, options?: ValidationOptions, callback?: (err: ValidationError, value: T) => void): ValidationResult; + export function validate(value: T): ValidationResult; + export function validate(value: T, callback: (err: ValidationError, value: T) => R): R; + + export function validate(value: T, schema: Schema): ValidationResult; + export function validate(value: T, schema: Object): ValidationResult; + export function validate(value: T, schema: Schema, callback: (err: ValidationError, value: T) => R): R; + export function validate(value: T, schema: Object, callback: (err: ValidationError, value: T) => R): R; + + export function validate(value: T, schema: Schema, options: ValidationOptions): ValidationResult; + export function validate(value: T, schema: Object, options: ValidationOptions): ValidationResult; + export function validate(value: T, schema: Schema, options: ValidationOptions, callback: (err: ValidationError, value: T) => R): R; + export function validate(value: T, schema: Object, options: ValidationOptions, callback: (err: ValidationError, value: T) => R): R; /** * Converts literal schema definition to joi schema object (or returns the same back if already a joi schema object). From 54d1d6f8edf12d0b5a549cb32b116e9bf9e72af0 Mon Sep 17 00:00:00 2001 From: Caleb Meredith Date: Fri, 28 Oct 2016 11:55:16 -0400 Subject: [PATCH 104/246] Expose AST types (#12143) * Expose AST types /cc @TonyPythoneer * Update graphql.d.ts --- graphql/graphql.d.ts | 114 ++++++++++++++++++------------------------- 1 file changed, 48 insertions(+), 66 deletions(-) diff --git a/graphql/graphql.d.ts b/graphql/graphql.d.ts index 9413195d72..570fbe3a2f 100644 --- a/graphql/graphql.d.ts +++ b/graphql/graphql.d.ts @@ -85,26 +85,7 @@ declare module "graphql" { // Parse and operate on GraphQL language source files. - export { - Source, - getLocation, - - // Parse - parse, - parseValue, - parseType, - - // Print - print, - - // Visit - visit, - visitInParallel, - visitWithTypeInfo, - Kind, - TokenKind, - BREAK, - } from 'graphql/language'; + export * from 'graphql/language'; // Execute GraphQL queries. @@ -254,6 +235,7 @@ declare module "graphql/language" { } declare module "graphql/language/index" { + export * from 'graphql/language/ast'; export { getLocation } from 'graphql/language/location'; import * as Kind from 'graphql/language/kinds'; export { Kind }; @@ -271,7 +253,7 @@ declare module "graphql/language/ast" { * Contains a range of UTF-8 character offsets and token references that * identify the region of the source from which the AST derived. */ - type Location = { + export type Location = { /** * The character offset at which this Node begins. @@ -303,7 +285,7 @@ declare module "graphql/language/ast" { * Represents a range of characters represented by a lexical token * within a Source. */ - type Token = { + export type Token = { /** * The kind of Token. @@ -366,7 +348,7 @@ declare module "graphql/language/ast" { /** * The list of all possible AST node types. */ - type Node = Name + export type Node = Name | Document | OperationDefinition | VariableDefinition @@ -405,7 +387,7 @@ declare module "graphql/language/ast" { // Name - type Name = { + export type Name = { kind: 'Name'; loc?: Location; value: string; @@ -413,17 +395,17 @@ declare module "graphql/language/ast" { // Document - type Document = { + export type Document = { kind: 'Document'; loc?: Location; definitions: Array; } - type Definition = OperationDefinition + export type Definition = OperationDefinition | FragmentDefinition | TypeSystemDefinition // experimental non-spec addition. - type OperationDefinition = { + export type OperationDefinition = { kind: 'OperationDefinition'; loc?: Location; operation: OperationType; @@ -434,9 +416,9 @@ declare module "graphql/language/ast" { } // Note: subscription is an experimental non-spec addition. - type OperationType = 'query' | 'mutation' | 'subscription'; + export type OperationType = 'query' | 'mutation' | 'subscription'; - type VariableDefinition = { + export type VariableDefinition = { kind: 'VariableDefinition'; loc?: Location; variable: Variable; @@ -444,23 +426,23 @@ declare module "graphql/language/ast" { defaultValue?: Value; } - type Variable = { + export type Variable = { kind: 'Variable'; loc?: Location; name: Name; } - type SelectionSet = { + export type SelectionSet = { kind: 'SelectionSet'; loc?: Location; selections: Array; } - type Selection = Field + export type Selection = Field | FragmentSpread | InlineFragment - type Field = { + export type Field = { kind: 'Field'; loc?: Location; alias?: Name; @@ -470,7 +452,7 @@ declare module "graphql/language/ast" { selectionSet?: SelectionSet; } - type Argument = { + export type Argument = { kind: 'Argument'; loc?: Location; name: Name; @@ -480,14 +462,14 @@ declare module "graphql/language/ast" { // Fragments - type FragmentSpread = { + export type FragmentSpread = { kind: 'FragmentSpread'; loc?: Location; name: Name; directives?: Array; } - type InlineFragment = { + export type InlineFragment = { kind: 'InlineFragment'; loc?: Location; typeCondition?: NamedType; @@ -495,7 +477,7 @@ declare module "graphql/language/ast" { selectionSet: SelectionSet; } - type FragmentDefinition = { + export type FragmentDefinition = { kind: 'FragmentDefinition'; loc?: Location; name: Name; @@ -507,7 +489,7 @@ declare module "graphql/language/ast" { // Values - type Value = Variable + export type Value = Variable | IntValue | FloatValue | StringValue @@ -516,49 +498,49 @@ declare module "graphql/language/ast" { | ListValue | ObjectValue - type IntValue = { + export type IntValue = { kind: 'IntValue'; loc?: Location; value: string; } - type FloatValue = { + export type FloatValue = { kind: 'FloatValue'; loc?: Location; value: string; } - type StringValue = { + export type StringValue = { kind: 'StringValue'; loc?: Location; value: string; } - type BooleanValue = { + export type BooleanValue = { kind: 'BooleanValue'; loc?: Location; value: boolean; } - type EnumValue = { + export type EnumValue = { kind: 'EnumValue'; loc?: Location; value: string; } - type ListValue = { + export type ListValue = { kind: 'ListValue'; loc?: Location; values: Array; } - type ObjectValue = { + export type ObjectValue = { kind: 'ObjectValue'; loc?: Location; fields: Array; } - type ObjectField = { + export type ObjectField = { kind: 'ObjectField'; loc?: Location; name: Name; @@ -568,7 +550,7 @@ declare module "graphql/language/ast" { // Directives - type Directive = { + export type Directive = { kind: 'Directive'; loc?: Location; name: Name; @@ -578,23 +560,23 @@ declare module "graphql/language/ast" { // Type Reference - type Type = NamedType + export type Type = NamedType | ListType | NonNullType - type NamedType = { + export type NamedType = { kind: 'NamedType'; loc?: Location; name: Name; }; - type ListType = { + export type ListType = { kind: 'ListType'; loc?: Location; type: Type; } - type NonNullType = { + export type NonNullType = { kind: 'NonNullType'; loc?: Location; type: NamedType | ListType; @@ -602,40 +584,40 @@ declare module "graphql/language/ast" { // Type System Definition - type TypeSystemDefinition = SchemaDefinition + export type TypeSystemDefinition = SchemaDefinition | TypeDefinition | TypeExtensionDefinition | DirectiveDefinition - type SchemaDefinition = { + export type SchemaDefinition = { kind: 'SchemaDefinition'; loc?: Location; directives: Array; operationTypes: Array; } - type OperationTypeDefinition = { + export type OperationTypeDefinition = { kind: 'OperationTypeDefinition'; loc?: Location; operation: OperationType; type: NamedType; } - type TypeDefinition = ScalarTypeDefinition + export type TypeDefinition = ScalarTypeDefinition | ObjectTypeDefinition | InterfaceTypeDefinition | UnionTypeDefinition | EnumTypeDefinition | InputObjectTypeDefinition - type ScalarTypeDefinition = { + export type ScalarTypeDefinition = { kind: 'ScalarTypeDefinition'; loc?: Location; name: Name; directives?: Array; } - type ObjectTypeDefinition = { + export type ObjectTypeDefinition = { kind: 'ObjectTypeDefinition'; loc?: Location; name: Name; @@ -644,7 +626,7 @@ declare module "graphql/language/ast" { fields: Array; } - type FieldDefinition = { + export type FieldDefinition = { kind: 'FieldDefinition'; loc?: Location; name: Name; @@ -653,7 +635,7 @@ declare module "graphql/language/ast" { directives?: Array; } - type InputValueDefinition = { + export type InputValueDefinition = { kind: 'InputValueDefinition'; loc?: Location; name: Name; @@ -662,7 +644,7 @@ declare module "graphql/language/ast" { directives?: Array; } - type InterfaceTypeDefinition = { + export type InterfaceTypeDefinition = { kind: 'InterfaceTypeDefinition'; loc?: Location; name: Name; @@ -670,7 +652,7 @@ declare module "graphql/language/ast" { fields: Array; } - type UnionTypeDefinition = { + export type UnionTypeDefinition = { kind: 'UnionTypeDefinition'; loc?: Location; name: Name; @@ -678,7 +660,7 @@ declare module "graphql/language/ast" { types: Array; } - type EnumTypeDefinition = { + export type EnumTypeDefinition = { kind: 'EnumTypeDefinition'; loc?: Location; name: Name; @@ -686,14 +668,14 @@ declare module "graphql/language/ast" { values: Array; } - type EnumValueDefinition = { + export type EnumValueDefinition = { kind: 'EnumValueDefinition'; loc?: Location; name: Name; directives?: Array; } - type InputObjectTypeDefinition = { + export type InputObjectTypeDefinition = { kind: 'InputObjectTypeDefinition'; loc?: Location; name: Name; @@ -701,13 +683,13 @@ declare module "graphql/language/ast" { fields: Array; } - type TypeExtensionDefinition = { + export type TypeExtensionDefinition = { kind: 'TypeExtensionDefinition'; loc?: Location; definition: ObjectTypeDefinition; } - type DirectiveDefinition = { + export type DirectiveDefinition = { kind: 'DirectiveDefinition'; loc?: Location; name: Name; From 0b4ef9b4120472447623cc31aba54692df28f310 Mon Sep 17 00:00:00 2001 From: Karl-Aksel Puulmann Date: Fri, 28 Oct 2016 18:56:10 +0300 Subject: [PATCH 105/246] Bump toastr version to 2.1.3 (#12311) Adds support for escapeHtml, see https://github.com/CodeSeven/toastr/blob/master/CHANGELOG.md#new-features-1 --- toastr/toastr.d.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/toastr/toastr.d.ts b/toastr/toastr.d.ts index e921bfbd7b..33a739f52e 100644 --- a/toastr/toastr.d.ts +++ b/toastr/toastr.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Toastr 2.1.1 +// Type definitions for Toastr 2.1.3 // Project: https://github.com/CodeSeven/toastr // Definitions by: Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -130,9 +130,13 @@ interface ToastrOptions { */ onclick?: () => void; /** - * Set if toastr should parse containing html + * Set if toastr should parse containing html **/ allowHtml?: boolean; + /** + * Set if toastr should escape html + **/ + escapeHtml?: boolean; } interface ToastrDisplayMethod { From ad261d041d385a0c64854ff7027715bd50fcd75b Mon Sep 17 00:00:00 2001 From: Caleb Meredith Date: Fri, 28 Oct 2016 12:01:37 -0400 Subject: [PATCH 106/246] Expose structural GraphQL types (#12142) * Expose structural GraphQL types https://github.com/DefinitelyTyped/DefinitelyTyped/pull/12078, but on the `master` branch. /cc @TonyPythoneer, @zhengbli * Update graphql.d.ts --- graphql/graphql.d.ts | 178 ++++++++++++------------------------------- 1 file changed, 47 insertions(+), 131 deletions(-) diff --git a/graphql/graphql.d.ts b/graphql/graphql.d.ts index 570fbe3a2f..c7310ab3cc 100644 --- a/graphql/graphql.d.ts +++ b/graphql/graphql.d.ts @@ -19,69 +19,7 @@ declare module "graphql" { // Create and operate on GraphQL type definitions and schema. - export { - GraphQLSchema, - - // Definitions - GraphQLScalarType, - GraphQLObjectType, - GraphQLInterfaceType, - GraphQLUnionType, - GraphQLEnumType, - GraphQLInputObjectType, - GraphQLList, - GraphQLNonNull, - GraphQLDirective, - - // "Enum" of Type Kinds - TypeKind, - - // "Enum" of Directive Locations - DirectiveLocation, - - // Scalars - GraphQLInt, - GraphQLFloat, - GraphQLString, - GraphQLBoolean, - GraphQLID, - - // Built-in Directives defined by the Spec - specifiedDirectives, - GraphQLIncludeDirective, - GraphQLSkipDirective, - GraphQLDeprecatedDirective, - - // Constant Deprecation Reason - DEFAULT_DEPRECATION_REASON, - - // Meta-field definitions. - SchemaMetaFieldDef, - TypeMetaFieldDef, - TypeNameMetaFieldDef, - - // GraphQL Types for introspection. - __Schema, - __Directive, - __DirectiveLocation, - __Type, - __Field, - __InputValue, - __EnumValue, - __TypeKind, - - // Predicates - isType, - isInputType, - isOutputType, - isLeafType, - isCompositeType, - isAbstractType, - - // Un-modifiers - getNullableType, - getNamedType, - } from 'graphql/type'; + export * from 'graphql/type'; // Parse and operate on GraphQL language source files. @@ -994,29 +932,7 @@ declare module "graphql/type/index" { // GraphQL Schema definition export { GraphQLSchema } from 'graphql/type/schema'; - export { - // Predicates - isType, - isInputType, - isOutputType, - isLeafType, - isCompositeType, - isAbstractType, - - // Un-modifiers - getNullableType, - getNamedType, - - // Definitions - GraphQLScalarType, - GraphQLObjectType, - GraphQLInterfaceType, - GraphQLUnionType, - GraphQLEnumType, - GraphQLInputObjectType, - GraphQLList, - GraphQLNonNull, - } from 'graphql/type/definition'; + export * from 'graphql/type/definition'; export { // "Enum" of Directive Locations @@ -1078,7 +994,7 @@ declare module "graphql/type/definition" { /** * These are all of the possible kinds of types. */ - type GraphQLType = + export type GraphQLType = GraphQLScalarType | GraphQLObjectType | GraphQLInterfaceType | @@ -1088,12 +1004,12 @@ declare module "graphql/type/definition" { GraphQLList | GraphQLNonNull; - function isType(type: any): boolean; + export function isType(type: any): type is GraphQLType; /** * These types may be used as input types for arguments and directives. */ - type GraphQLInputType = + export type GraphQLInputType = GraphQLScalarType | GraphQLEnumType | GraphQLInputObjectType | @@ -1105,12 +1021,12 @@ declare module "graphql/type/definition" { GraphQLList >; - function isInputType(type: GraphQLType): boolean; + export function isInputType(type: GraphQLType): type is GraphQLInputType; /** * These types may be used as output types as the result of fields. */ - type GraphQLOutputType = + export type GraphQLOutputType = GraphQLScalarType | GraphQLObjectType | GraphQLInterfaceType | @@ -1126,40 +1042,40 @@ declare module "graphql/type/definition" { GraphQLList >; - function isOutputType(type: GraphQLType): boolean; + export function isOutputType(type: GraphQLType): type is GraphQLOutputType; /** * These types may describe types which may be leaf values. */ - type GraphQLLeafType = + export type GraphQLLeafType = GraphQLScalarType | GraphQLEnumType; - function isLeafType(type: GraphQLType): boolean; + export function isLeafType(type: GraphQLType): type is GraphQLLeafType; /** * These types may describe the parent context of a selection set. */ - type GraphQLCompositeType = + export type GraphQLCompositeType = GraphQLObjectType | GraphQLInterfaceType | GraphQLUnionType; - function isCompositeType(type: GraphQLType): boolean; + export function isCompositeType(type: GraphQLType): type is GraphQLCompositeType; /** * These types may describe the parent context of a selection set. */ - type GraphQLAbstractType = + export type GraphQLAbstractType = GraphQLInterfaceType | GraphQLUnionType; - function isAbstractType(type: GraphQLType): boolean; + export function isAbstractType(type: GraphQLType): type is GraphQLAbstractType; /** * These types can all accept null as a value. */ - type GraphQLNullableType = + export type GraphQLNullableType = GraphQLScalarType | GraphQLObjectType | GraphQLInterfaceType | @@ -1168,14 +1084,14 @@ declare module "graphql/type/definition" { GraphQLInputObjectType | GraphQLList; - function getNullableType( + export function getNullableType( type: T ): (T & GraphQLNullableType); /** * These named types do not include modifiers like List or NonNull. */ - type GraphQLNamedType = + export type GraphQLNamedType = GraphQLScalarType | GraphQLObjectType | GraphQLInterfaceType | @@ -1183,7 +1099,7 @@ declare module "graphql/type/definition" { GraphQLEnumType | GraphQLInputObjectType; - function getNamedType(type: GraphQLType): GraphQLNamedType + export function getNamedType(type: GraphQLType): GraphQLNamedType /** * Used while defining GraphQL types to allow for circular references in @@ -1225,7 +1141,7 @@ declare module "graphql/type/definition" { toString(): string; } - interface GraphQLScalarTypeConfig { + export interface GraphQLScalarTypeConfig { name: string; description?: string; serialize: (value: any) => TInternal; @@ -1283,7 +1199,7 @@ declare module "graphql/type/definition" { // - interface GraphQLObjectTypeConfig { + export interface GraphQLObjectTypeConfig { name: string; interfaces?: Thunk>; fields: Thunk>; @@ -1291,26 +1207,26 @@ declare module "graphql/type/definition" { description?: string } - type GraphQLTypeResolveFn = ( + export type GraphQLTypeResolveFn = ( value: any, context: any, info: GraphQLResolveInfo ) => GraphQLObjectType; - type GraphQLIsTypeOfFn = ( + export type GraphQLIsTypeOfFn = ( source: any, context: any, info: GraphQLResolveInfo ) => boolean; - type GraphQLFieldResolveFn = ( + export type GraphQLFieldResolveFn = ( source: TSource, args: { [argName: string]: any }, context: any, info: GraphQLResolveInfo ) => any; - interface GraphQLResolveInfo { + export interface GraphQLResolveInfo { fieldName: string; fieldASTs: Array; returnType: GraphQLOutputType; @@ -1323,7 +1239,7 @@ declare module "graphql/type/definition" { variableValues: { [variableName: string]: any }; } - interface GraphQLFieldConfig { + export interface GraphQLFieldConfig { type: GraphQLOutputType; args?: GraphQLFieldConfigArgumentMap; resolve?: GraphQLFieldResolveFn; @@ -1331,21 +1247,21 @@ declare module "graphql/type/definition" { description?: string; } - interface GraphQLFieldConfigArgumentMap { + export interface GraphQLFieldConfigArgumentMap { [argName: string]: GraphQLArgumentConfig; } - interface GraphQLArgumentConfig { + export interface GraphQLArgumentConfig { type: GraphQLInputType; defaultValue?: any; description?: string; } - interface GraphQLFieldConfigMap { + export interface GraphQLFieldConfigMap { [fieldName: string]: GraphQLFieldConfig; } - interface GraphQLFieldDefinition { + export interface GraphQLFieldDefinition { name: string; description: string; type: GraphQLOutputType; @@ -1355,14 +1271,14 @@ declare module "graphql/type/definition" { deprecationReason: string; } - interface GraphQLArgument { + export interface GraphQLArgument { name: string; type: GraphQLInputType; defaultValue?: any; description?: string; } - interface GraphQLFieldDefinitionMap { + export interface GraphQLFieldDefinitionMap { [fieldName: string]: GraphQLFieldDefinition; } @@ -1396,7 +1312,7 @@ declare module "graphql/type/definition" { toString(): string; } - interface GraphQLInterfaceTypeConfig { + export interface GraphQLInterfaceTypeConfig { name: string, fields: Thunk>, /** @@ -1443,7 +1359,7 @@ declare module "graphql/type/definition" { toString(): string; } - interface GraphQLUnionTypeConfig { + export interface GraphQLUnionTypeConfig { name: string, types: Thunk>, /** @@ -1488,23 +1404,23 @@ declare module "graphql/type/definition" { toString(): string; } - interface GraphQLEnumTypeConfig { + export interface GraphQLEnumTypeConfig { name: string; values: GraphQLEnumValueConfigMap; description?: string; } - interface GraphQLEnumValueConfigMap { + export interface GraphQLEnumValueConfigMap { [valueName: string]: GraphQLEnumValueConfig; } - interface GraphQLEnumValueConfig { + export interface GraphQLEnumValueConfig { value?: any; deprecationReason?: string; description?: string; } - interface GraphQLEnumValueDefinition { + export interface GraphQLEnumValueDefinition { name: string; description: string; deprecationReason: string; @@ -1534,36 +1450,36 @@ declare module "graphql/type/definition" { class GraphQLInputObjectType { name: string; description: string; - constructor(config: InputObjectConfig); - getFields(): InputObjectFieldMap; + constructor(config: GraphQLInputObjectTypeConfig); + getFields(): GraphQLInputFieldDefinitionMap; toString(): string; } - interface InputObjectConfig { + export interface GraphQLInputObjectTypeConfig { name: string; - fields: Thunk; + fields: Thunk; description?: string; } - interface InputObjectFieldConfig { + export interface GraphQLInputFieldConfig { type: GraphQLInputType; defaultValue?: any; description?: string; } - interface InputObjectConfigFieldMap { - [fieldName: string]: InputObjectFieldConfig; + export interface GraphQLInputFieldConfigMap { + [fieldName: string]: GraphQLInputFieldConfig; } - interface InputObjectField { + export interface GraphQLInputFieldDefinition { name: string; type: GraphQLInputType; defaultValue?: any; description?: string; } - interface InputObjectFieldMap { - [fieldName: string]: InputObjectField; + export interface GraphQLInputFieldDefinitionMap { + [fieldName: string]: GraphQLInputFieldDefinition; } /** From 44be13ae844ec0721109542d5902e41438d72855 Mon Sep 17 00:00:00 2001 From: Tsvetomir Tsonev Date: Fri, 28 Oct 2016 19:10:07 +0300 Subject: [PATCH 107/246] feat: update Kendo UI definitions to 2016.3.1028 (#12316) --- kendo-ui/kendo-ui.d.ts | 176 ++++++++++++++++++++++++++--------------- 1 file changed, 111 insertions(+), 65 deletions(-) diff --git a/kendo-ui/kendo-ui.d.ts b/kendo-ui/kendo-ui.d.ts index ac6022ecd4..429bc00c12 100644 --- a/kendo-ui/kendo-ui.d.ts +++ b/kendo-ui/kendo-ui.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Kendo UI Professional v2016.3.914 +// Type definitions for Kendo UI Professional v2016.3.1028 // Project: http://www.telerik.com/kendo-ui // Definitions by: Telerik // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -1112,7 +1112,7 @@ declare namespace kendo.data { } interface DataSourceFilterItem extends DataSourceFilter { - operator?: string; + operator?: string|Function; field?: string; value?: any; } @@ -1245,6 +1245,7 @@ declare namespace kendo.data { type?: string; change? (e: DataSourceChangeEvent): void; error?(e: DataSourceErrorEvent): void; + push?(e: DataSourcePushEvent): void; sync?(e: DataSourceEvent): void; requestStart?(e: DataSourceRequestStartEvent): void; requestEnd?(e: DataSourceRequestEndEvent): void; @@ -1274,6 +1275,12 @@ declare namespace kendo.data { node?: any; } + interface DataSourcePushEvent extends DataSourceEvent { + items?: DataSourceItemOrGroup[]; + type?: string; + + } + interface DataSourceErrorEvent extends DataSourceEvent { xhr: JQueryXHR; status: string; @@ -1480,6 +1487,7 @@ declare namespace kendo.mobile { statusBarStyle?: string; transition?: string; useNativeScrolling?: boolean; + init?(e: ApplicationEvent): void; } interface ApplicationEvent { @@ -1538,7 +1546,7 @@ declare namespace kendo.ui { static extend(proto: Object): AgendaView; } - class Alert extends kendo.ui.Widget { + class Alert extends kendo.ui.Dialog { static fn: Alert; @@ -2043,12 +2051,13 @@ declare namespace kendo.ui { } - class Confirm extends kendo.ui.Widget { + class Confirm extends kendo.ui.Dialog { static fn: Confirm; options: ConfirmOptions; + result: JQueryPromise; element: JQuery; wrapper: JQuery; @@ -2809,66 +2818,95 @@ declare namespace kendo.ui { } interface EditorMessages { - bold?: string; - italic?: string; - underline?: string; - strikethrough?: string; - superscript?: string; - subscript?: string; - justifyCenter?: string; - justifyLeft?: string; - justifyRight?: string; - justifyFull?: string; - insertUnorderedList?: string; - insertOrderedList?: string; - indent?: string; - outdent?: string; - createLink?: string; - unlink?: string; - insertImage?: string; - insertFile?: string; - insertHtml?: string; - viewHtml?: string; - fontName?: string; - fontNameInherit?: string; - fontSize?: string; - fontSizeInherit?: string; - formatBlock?: string; - formatting?: string; - foreColor?: string; - backColor?: string; - style?: string; - emptyFolder?: string; - uploadFile?: string; - editAreaTitle?: string; - orderBy?: string; - orderBySize?: string; - orderByName?: string; - invalidFileType?: string; - deleteFile?: string; - overwriteFile?: string; - directoryNotFound?: string; - imageWebAddress?: string; - imageAltText?: string; - imageWidth?: string; - imageHeight?: string; - fileWebAddress?: string; - fileTitle?: string; - linkWebAddress?: string; - linkText?: string; - linkToolTip?: string; - linkOpenInNewWindow?: string; - dialogUpdate?: string; - dialogInsert?: string; - dialogCancel?: string; - createTable?: string; - createTableHint?: string; + accessibilityTab?: string; addColumnLeft?: string; addColumnRight?: string; addRowAbove?: string; addRowBelow?: string; - deleteRow?: string; + alignCenter?: string; + alignCenterBottom?: string; + alignCenterMiddle?: string; + alignCenterTop?: string; + alignLeft?: string; + alignLeftBottom?: string; + alignLeftMiddle?: string; + alignLeftTop?: string; + alignRemove?: string; + alignRight?: string; + alignRightBottom?: string; + alignRightMiddle?: string; + alignRightTop?: string; + alignment?: string; + associateCellsWithHeaders?: string; + backColor?: string; + background?: string; + bold?: string; + border?: string; + style?: string; + caption?: string; + cellMargin?: string; + cellPadding?: string; + cellSpacing?: string; + cellTab?: string; + cleanFormatting?: string; + collapseBorders?: string; + columns?: string; + createLink?: string; + createTable?: string; + createTableHint?: string; + cssClass?: string; deleteColumn?: string; + deleteRow?: string; + dialogCancel?: string; + dialogInsert?: string; + dialogOk?: string; + dialogUpdate?: string; + editAreaTitle?: string; + fileTitle?: string; + fileWebAddress?: string; + fontName?: string; + fontNameInherit?: string; + fontSize?: string; + fontSizeInherit?: string; + foreColor?: string; + formatBlock?: string; + formatting?: string; + height?: string; + id?: string; + imageAltText?: string; + imageHeight?: string; + imageWebAddress?: string; + imageWidth?: string; + indent?: string; + insertFile?: string; + insertHtml?: string; + insertImage?: string; + insertOrderedList?: string; + insertUnorderedList?: string; + italic?: string; + justifyCenter?: string; + justifyFull?: string; + justifyLeft?: string; + justifyRight?: string; + linkOpenInNewWindow?: string; + linkText?: string; + linkToolTip?: string; + linkWebAddress?: string; + outdent?: string; + print?: string; + rows?: string; + selectAllCells?: string; + strikethrough?: string; + subscript?: string; + summary?: string; + superscript?: string; + tableTab?: string; + tableWizard?: string; + underline?: string; + unlink?: string; + viewHtml?: string; + width?: string; + wrapText?: string; } interface EditorPasteCleanup { @@ -5141,12 +5179,13 @@ declare namespace kendo.ui { } - class Prompt extends kendo.ui.Widget { + class Prompt extends kendo.ui.Dialog { static fn: Prompt; options: PromptOptions; + result: JQueryPromise; element: JQuery; wrapper: JQuery; @@ -5542,6 +5581,7 @@ declare namespace kendo.ui { minorTimeHeaderTemplate?: string|Function; selected?: boolean; selectedDateFormat?: string; + selectedShortDateFormat?: string; showWorkHours?: boolean; slotTemplate?: string|Function; startTime?: Date; @@ -6068,6 +6108,7 @@ declare namespace kendo.ui { comparerType?: string; dataType?: string; from?: string; + showButton?: boolean; to?: string; allowNulls?: boolean; messageTemplate?: string; @@ -6102,6 +6143,7 @@ declare namespace kendo.ui { cells?: SpreadsheetSheetRowCell[]; height?: number; index?: number; + type?: string; } interface SpreadsheetSheetSortColumn { @@ -7291,7 +7333,7 @@ declare namespace kendo.ui { destroy(): void; disable(): void; enable(enable?: boolean): void; - getFiles(): void; + getFiles(): any; removeAllFiles(): void; removeFile(): void; removeFileByUid(): void; @@ -7470,6 +7512,8 @@ declare namespace kendo.ui { content(content?: string): kendo.ui.Window; content(content?: JQuery): kendo.ui.Window; destroy(): void; + isMaximized(): boolean; + isMinimized(): boolean; maximize(): kendo.ui.Window; minimize(): kendo.ui.Window; open(): kendo.ui.Window; @@ -11017,7 +11061,6 @@ declare namespace kendo.dataviz.ui { autoBind?: boolean; axisDefaults?: ChartAxisDefaults; categoryAxis?: ChartCategoryAxisItem[]; - valueAxis?: ChartValueAxisItem[]; chartArea?: ChartChartArea; dataSource?: any|any|kendo.data.DataSource; legend?: ChartLegend; @@ -11033,6 +11076,7 @@ declare namespace kendo.dataviz.ui { title?: ChartTitle; tooltip?: ChartTooltip; transitions?: boolean; + valueAxis?: ChartValueAxisItem[]; xAxis?: ChartXAxisItem[]; yAxis?: ChartYAxisItem[]; zoomable?: boolean|ChartZoomable; @@ -16928,7 +16972,7 @@ declare namespace kendo { function bind(element: Element, viewModel: any, namespace?: any): void; function bind(element: Element, viewModel: kendo.data.ObservableObject, namespace?: any): void; function observableHierarchy(array: any): void; - function confirm(text: string): void; + function confirm(text: string): JQueryPromise; function culture(culture: string): void; function destroy(element: string): void; function destroy(element: JQuery): void; @@ -16939,7 +16983,7 @@ declare namespace kendo { function parseFloat(value: string, culture?: string): number; function parseInt(value: string, culture?: string): number; function parseColor(color: string, noerror: boolean): kendo.Color; - function prompt(text: string, defaultValue: string): void; + function prompt(text: string, defaultValue: string): JQueryPromise; function proxyModelSetters(): void; function proxyModelSetters(data: kendo.data.Model): void; function resize(element: string, force: boolean): void; @@ -16947,7 +16991,7 @@ declare namespace kendo { function resize(element: Element, force: boolean): void; function saveAs(options: any): void; function stringify(value: any): string; - function throttle(fn: Function, timeout: number): void; + function throttle(fn: Function, timeout: number): Function; function touchScroller(element: string): void; function touchScroller(element: JQuery): void; function touchScroller(element: Element): void; @@ -17032,6 +17076,8 @@ declare namespace kendo.spreadsheet { clear(options?: any): void; clearFilter(indices: any): void; clearFilter(indices: number): void; + editor(): string; + editor(value?: string): void; enable(): boolean; enable(value?: boolean): void; fillFrom(srcRange: Range, direction?: number): void; From c9999d4e97f660ea35c20f87506d4ee8074666f8 Mon Sep 17 00:00:00 2001 From: Tom Davidson Date: Tue, 1 Nov 2016 06:12:53 -0600 Subject: [PATCH 108/246] promises on putObject (#11923) --- aws-sdk/aws-sdk.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aws-sdk/aws-sdk.d.ts b/aws-sdk/aws-sdk.d.ts index 3fe8f65b0f..f484c5fdac 100644 --- a/aws-sdk/aws-sdk.d.ts +++ b/aws-sdk/aws-sdk.d.ts @@ -382,8 +382,8 @@ declare module "aws-sdk" { endpoint: Endpoint; getObject(params: s3.GetObjectRequest, callback?: (err: Error, data: any) => void): any; + putObject(params: s3.PutObjectRequest, callback?: (err: Error, data: any) => void): any; copyObject(params: s3.CopyObjectRequest, callback?: (err: Error, data: any) => void): any; - putObject(params: s3.PutObjectRequest, callback: (err: Error, data: any) => void): void; deleteObject(params: s3.DeleteObjectRequest, callback: (err: Error, data: any) => void): void; headObject(params: s3.HeadObjectRequest, callback: (err: Error, data: any) => void): void; getSignedUrl(operation: string, params: any): string; @@ -660,7 +660,7 @@ declare module "aws-sdk" { export interface DescribeStackResourcesParams { StackName?: string; // must specify either StackName or PhysicalResourceId - LogicalResourceId?: string; + LogicalResourceId?: string; PhysicalResourceId?: string; // must specify either StackName or PhysicalResourceId } From 300ed0bb42cf6f9894d7b9ad9e9b543097bd502e Mon Sep 17 00:00:00 2001 From: Till Wolff Date: Tue, 1 Nov 2016 13:19:32 +0100 Subject: [PATCH 109/246] added missing type for ReactSelectProps.value (#11964) --- react-select/react-select.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react-select/react-select.d.ts b/react-select/react-select.d.ts index 8011122fed..c50d5f6883 100644 --- a/react-select/react-select.d.ts +++ b/react-select/react-select.d.ts @@ -298,7 +298,7 @@ declare namespace ReactSelect { /** * initial field value */ - value?: Option | Option[] | string | string[] | number | number[]; + value?: Option | Option[] | string | string[] | number | number[] | boolean; /** * the option property to use for the value * @default "value" From 0ad4edb4e86a936e4462a02f616730068d4de29d Mon Sep 17 00:00:00 2001 From: Fenying Date: Tue, 1 Nov 2016 20:25:56 +0800 Subject: [PATCH 110/246] Improvement to definitions of module async. (#12180) * Updated module async. 1. Added Dictionary for the collection APIs. 2. Fixed incorrected callback definition for some collection APIs. * Simplify some definitions of module async. * Fixed the callback type of async.someLimit. --- async/async-tests.ts | 354 +++++++++++++++++++++++++++++++++++++++++++ async/async.d.ts | 134 +++++++++------- 2 files changed, 431 insertions(+), 57 deletions(-) diff --git a/async/async-tests.ts b/async/async-tests.ts index 63640cecf6..67df5bae09 100644 --- a/async/async-tests.ts +++ b/async/async-tests.ts @@ -435,3 +435,357 @@ async.dir(function (name, callback) { callback(null, { hello: name }); }, 1000); }, "world"); + +// each + +async.each({ + "a": 1, + "b": 2 +}, function(val: number, next: ErrorCallback): void { + + setTimeout(function(): void { + + console.log(`async.each: ${val}`); + + next(); + + }, 500); + +}, function(err?: Error): void { + + console.log("async.each: done."); + +}); + +async.eachSeries({ + "a": 1, + "b": 2 +}, function(val: number, next: ErrorCallback): void { + + setTimeout(function(): void { + + console.log(`async.eachSeries: ${val}`); + + next(); + + }, 500); + +}, function(err?: Error): void { + + console.log("async.eachSeries: done."); + +}); + +async.eachLimit({ + "a": 1, + "b": 2, + "c": 3, + "d": 4, + "e": 5, + "f": 6 +}, 2, function(val: number, next: ErrorCallback): void { + + setTimeout(function(): void { + + console.log(`async.eachLimit: ${val}`); + + next(); + + }, 500); + +}, function(err?: Error): void { + + console.log("async.eachLimit: done."); + +}); + +// forEachOf/eachOf + +async.eachOf({ + "a": 1, + "b": 2 +}, function(val: number, key: string, next: ErrorCallback): void { + + setTimeout(function(): void { + + console.log(`async.forEachOf/eachOf: ${key} = ${val}`); + + next(); + + }, 500); + +}, function(err?: Error): void { + + console.log("async.forEachOf/eachOf: done."); + +}); + +async.forEachOfSeries({ + "a": 1, + "b": 2 +}, function(val: number, key: string, next: ErrorCallback): void { + + setTimeout(function(): void { + + console.log(`async.forEachOfSeries: ${key} = ${val}`); + + next(); + + }, 500); + +}, function(err?: Error): void { + + console.log("async.forEachOfSeries: done."); + +}); + +async.forEachOfLimit({ + "a": 1, + "b": 2, + "c": 3, + "d": 4, + "e": 5, + "f": 6 +}, 2, function(val: number, key: string, next: ErrorCallback): void { + + setTimeout(function(): void { + + console.log(`async.forEachOfLimit: ${key} = ${val}`); + + next(); + + }, 500); + +}, function(err?: Error): void { + + console.log("async.forEachOfLimit: done."); + +}); + +// map + +async.map({ + "a": 1, + "b": 2, + "c": 3 +}, function(val: number, next: AsyncResultCallback): void { + + setTimeout(function(): void { + + console.log(`async.map: ${val}`); + + next(null, val.toString()); + + }, 500); + +}, function(err: Error, results: string[]): void { + + console.log("async.map: done with results", results); + +}); + +async.mapSeries({ + "a": 1, + "b": 2, + "c": 3 +}, function(val: number, next: AsyncResultCallback): void { + + setTimeout(function(): void { + + console.log(`async.mapSeries: ${val}`); + + next(null, val.toString()); + + }, 500); + +}, function(err: Error, results: string[]): void { + + console.log("async.mapSeries: done with results", results); + +}); + +async.mapLimit({ + "a": 1, + "b": 2, + "c": 3, + "d": 4, + "e": 5, + "f": 6 +}, 2, function(val: number, next: AsyncResultCallback): void { + + setTimeout(function(): void { + + console.log(`async.mapLimit: ${val}`); + + next(null, val.toString()); + + }, 500); + +}, function(err: Error, results: string[]): void { + + console.log("async.mapLimit: done with results", results); + +}); + +// mapValues + +async.mapValues({ + "a": 1, + "b": 2, + "c": 3 +}, function(val: number, key: string, next: AsyncResultCallback): void { + + setTimeout(function(): void { + + console.log(`async.mapValues: ${key} = ${val}`); + + next(null, val.toString()); + + }, 500); + +}, function(err: Error, results: string[]): void { + + console.log("async.mapValues: done with results", results); + +}); + +async.mapValuesSeries({ + "a": 1, + "b": 2, + "c": 3 +}, function(val: number, key: string, next: AsyncResultCallback): void { + + setTimeout(function(): void { + + console.log(`async.mapValuesSeries: ${key} = ${val}`); + + next(null, val.toString()); + + }, 500); + +}, function(err: Error, results: string[]): void { + + console.log("async.mapValuesSeries: done with results", results); + +}); + +// filter/select/reject + +async.filter({ + "a": 1, + "b": 2, + "c": 3 +}, function(val: number, next: AsyncBooleanResultCallback): void { + + setTimeout(function(): void { + + console.log(`async.filter/select: ${val}`); + + next(null, val % 2 === 0); + + }, 500); + +}, function(err: Error, results: number[]): void { + + console.log("async.filter/select: done with results", results); + +}); + +async.reject({ + "a": 1, + "b": 2, + "c": 3 +}, function(val: number, next: AsyncBooleanResultCallback): void { + + setTimeout(function(): void { + + console.log(`async.reject: ${val}`); + + next(null, val % 2 === 0); + + }, 500); + +}, function(err: Error, results: number[]): void { + + console.log("async.reject: done with results", results); + +}); + +// concat + +async.concat({ + "a": "1", + "b": "2", + "c": "3" +}, function(item: string, next: AsyncResultCallback): void { + + console.log(`async.concat: ${item}`); + + next(null, [item, item, item]); + +}, function(err: Error, results: string[]) { + + console.log("async.concat: done with results", results); + +}); + +// detect/find + +async.detect({ + "a": 1, + "b": 2, + "c": 3 +}, function(item: number, next: AsyncBooleanResultCallback): void { + + console.log(`async.detect/find: ${item}`); + + next(null, item > 1); + +}, function(err: Error, result: number) { + + if (err) { + + console.log(err); + + } else { + + console.log("async.detect/find: done with result", result); + } + +}); + +// every/all + +async.every({ + "a": 1, + "b": 2, + "c": 3 +}, function(item: number, next: AsyncBooleanResultCallback): void { + + console.log(`async.every/all: ${item}`); + + next(null, item > 0); + +}, function(err: Error, result: boolean) { + + console.log("async.every/all: done with result", result); + +}); + +// some/any + +async.some({ + "a": 1, + "b": 2, + "c": 3 +}, function(item: number, next: AsyncBooleanResultCallback): void { + + console.log(`async.some/any: ${item}`); + + next(null, item > 2); + +}, function(err: Error, result: boolean) { + + console.log("async.some/any: done with result", result); + +}); diff --git a/async/async.d.ts b/async/async.d.ts index 96da35c1ea..8b564fbd80 100644 --- a/async/async.d.ts +++ b/async/async.d.ts @@ -1,11 +1,13 @@ // Type definitions for Async 2.0.1 // Project: https://github.com/caolan/async -// Definitions by: Boris Yankov , Arseniy Maximov , Joe Herman +// Definitions by: Boris Yankov , Arseniy Maximov , Joe Herman , Angus Fenying // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped interface Dictionary { [key: string]: T; } interface ErrorCallback { (err?: Error): void; } +interface AsyncWaterfallCallback { (err: Error, ...args: any[]): void; } +interface AsyncBooleanResultCallback { (err: Error, truthValue: boolean): void; } interface AsyncResultCallback { (err: Error, result: T): void; } interface AsyncResultArrayCallback { (err: Error, results: T[]): void; } interface AsyncResultObjectCallback { (err: Error, results: Dictionary): void; } @@ -15,7 +17,7 @@ interface AsyncIterator { (item: T, callback: ErrorCallback): void; } interface AsyncForEachOfIterator { (item: T, key: number|string, callback: ErrorCallback): void; } interface AsyncResultIterator { (item: T, callback: AsyncResultCallback): void; } interface AsyncMemoIterator { (memo: R, item: T, callback: AsyncResultCallback): void; } -interface AsyncBooleanIterator { (item: T, callback: (err: string, truthValue: boolean) => void): void; } +interface AsyncBooleanIterator { (item: T, callback: AsyncBooleanResultCallback): void; } interface AsyncWorker { (task: T, callback: ErrorCallback): void; } interface AsyncVoidFunction { (callback: ErrorCallback): void; } @@ -89,52 +91,74 @@ interface Async { // Collections each(arr: T[], iterator: AsyncIterator, callback?: ErrorCallback): void; - eachSeries(arr: T[], iterator: AsyncIterator, callback?: ErrorCallback): void; + each(arr: Dictionary, iterator: AsyncIterator, callback?: ErrorCallback): void; + eachSeries: typeof async.each; eachLimit(arr: T[], limit: number, iterator: AsyncIterator, callback?: ErrorCallback): void; - forEachOf(obj: any, iterator: (item: any, key: string|number, callback?: ErrorCallback) => void, callback: ErrorCallback): void; + eachLimit(arr: Dictionary, limit: number, iterator: AsyncIterator, callback?: ErrorCallback): void; + forEach: typeof async.each; + forEachSeries: typeof async.each; + forEachLimit: typeof async.eachLimit; forEachOf(obj: T[], iterator: AsyncForEachOfIterator, callback?: ErrorCallback): void; - forEachOfSeries(obj: any, iterator: (item: any, key: string|number, callback?: ErrorCallback) => void, callback: ErrorCallback): void; - forEachOfSeries(obj: T[], iterator: AsyncForEachOfIterator, callback?: ErrorCallback): void; - forEachOfLimit(obj: any, limit: number, iterator: (item: any, key: string|number, callback?: ErrorCallback) => void, callback: ErrorCallback): void; + forEachOf(obj: Dictionary, iterator: AsyncForEachOfIterator, callback?: ErrorCallback): void; + forEachOfSeries: typeof async.forEachOf; forEachOfLimit(obj: T[], limit: number, iterator: AsyncForEachOfIterator, callback?: ErrorCallback): void; - map(arr: T[], iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): any; - mapSeries(arr: T[], iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): any; - mapLimit(arr: T[], limit: number, iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): any; - mapValuesLimit(obj: {[name: string]: T}, limit: number, iteratee: (value: string, key: T, callback: AsyncResultCallback) => void, callback: AsyncResultCallback): void; - mapValues(obj: {[name: string]: T}, iteratee: (value: string, key: T, callback: AsyncResultCallback) => void, callback: AsyncResultCallback): void; + forEachOfLimit(obj: Dictionary, limit: number, iterator: AsyncForEachOfIterator, callback?: ErrorCallback): void; + eachOf: typeof async.forEachOf; + eachOfSeries: typeof async.forEachOf; + eachOfLimit: typeof async.forEachOfLimit; + map(arr: T[], iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): void; + map(arr: Dictionary, iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): void; + mapSeries: typeof async.map; + mapLimit(arr: T[], limit: number, iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): void; + mapLimit(arr: Dictionary, limit: number, iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): void; + mapValuesLimit(obj: Dictionary, limit: number, iteratee: (value: T, key: string, callback: AsyncResultCallback) => void, callback: AsyncResultCallback): void; + mapValues(obj: Dictionary, iteratee: (value: T, key: string, callback: AsyncResultCallback) => void, callback: AsyncResultCallback): void; mapValuesSeries: typeof async.mapValues; - filter(arr: T[], iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): any; - select(arr: T[], iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): any; - filterSeries(arr: T[], iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): any; - selectSeries(arr: T[], iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): any; - filterLimit(arr: T[], limit: number, iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): any; - selectLimit(arr: T[], limit: number, iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): any; - reject(arr: T[], iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): any; - rejectSeries(arr: T[], iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): any; - rejectLimit(arr: T[], limit: number, iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): any; - reduce(arr: T[], memo: R, iterator: AsyncMemoIterator, callback?: AsyncResultCallback): any; - inject(arr: T[], memo: R, iterator: AsyncMemoIterator, callback?: AsyncResultCallback): any; - foldl(arr: T[], memo: R, iterator: AsyncMemoIterator, callback?: AsyncResultCallback): any; - reduceRight(arr: T[], memo: R, iterator: AsyncMemoIterator, callback: AsyncResultCallback): any; - foldr(arr: T[], memo: R, iterator: AsyncMemoIterator, callback: AsyncResultCallback): any; - detect(arr: T[], iterator: AsyncBooleanIterator, callback?: AsyncResultCallback): any; + filter(arr: T[], iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): void; + filter(arr: Dictionary, iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): void; + filterSeries: typeof async.filter; + filterLimit(arr: T[], limit: number, iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): void; + filterLimit(arr: Dictionary, limit: number, iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): void; + select: typeof async.filter; + selectSeries: typeof async.filter; + selectLimit: typeof async.filterLimit; + reject: typeof async.filter; + rejectSeries: typeof async.filter; + rejectLimit: typeof async.filterLimit; + reduce(arr: T[], memo: R, iterator: AsyncMemoIterator, callback?: AsyncResultCallback): void; + inject: typeof async.reduce; + foldl: typeof async.reduce; + reduceRight: typeof async.reduce; + foldr: typeof async.reduce; + detect(arr: T[], iterator: AsyncBooleanIterator, callback?: AsyncResultCallback): void; + detect(arr: Dictionary, iterator: AsyncBooleanIterator, callback?: AsyncResultCallback): void; + detectSeries: typeof async.detect; + detectLimit(arr: T[], limit: number, iterator: AsyncBooleanIterator, callback?: AsyncResultCallback): void; + detectLimit(arr: Dictionary, limit: number, iterator: AsyncBooleanIterator, callback?: AsyncResultCallback): void; find: typeof async.detect; - detectSeries(arr: T[], iterator: AsyncBooleanIterator, callback?: AsyncResultCallback): any; - findSeries: typeof async.detectSeries; - detectLimit(arr: T[], limit: number, iterator: AsyncBooleanIterator, callback?: AsyncResultCallback): any; + findSeries: typeof async.detect; findLimit: typeof async.detectLimit; - sortBy(arr: T[], iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): any; - some(arr: T[], iterator: AsyncBooleanIterator, callback?: (result: boolean) => void): any; - someLimit(arr: T[], limit: number, iterator: AsyncBooleanIterator, callback?: (result: boolean) => void): any; - anyLimit: typeof async.someLimit; - someSeries(arr: T[], iterator: AsyncBooleanIterator, callback?: (result: boolean) => void): any; + sortBy(arr: T[], iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): void; + some(arr: T[], iterator: AsyncBooleanIterator, callback?: AsyncBooleanResultCallback): void; + some(arr: Dictionary, iterator: AsyncBooleanIterator, callback?: AsyncBooleanResultCallback): void; + someSeries: typeof async.some; + someLimit(arr: T[], limit: number, iterator: AsyncBooleanIterator, callback?: AsyncBooleanResultCallback): void; + someLimit(arr: Dictionary, limit: number, iterator: AsyncBooleanIterator, callback?: AsyncBooleanResultCallback): void; + any: typeof async.some; anySeries: typeof async.someSeries; - any(arr: T[], iterator: AsyncBooleanIterator, callback?: (result: boolean) => void): any; - every(arr: T[], iterator: AsyncBooleanIterator, callback?: (result: boolean) => any): any; - everyLimit(arr: T[], limit: number, iterator: AsyncBooleanIterator, callback?: (result: boolean) => any): any; - all(arr: T[], iterator: AsyncBooleanIterator, callback?: (result: boolean) => any): any; - concat(arr: T[], iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): any; - concatSeries(arr: T[], iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): any; + anyLimit: typeof async.someLimit; + every(arr: T[], iterator: AsyncBooleanIterator, callback?: AsyncBooleanResultCallback): void; + every(arr: Dictionary, iterator: AsyncBooleanIterator, callback?: AsyncBooleanResultCallback): void; + everySeries: typeof async.every; + everyLimit(arr: T[], limit: number, iterator: AsyncBooleanIterator, callback?: AsyncBooleanResultCallback): void; + everyLimit(arr: Dictionary, limit: number, iterator: AsyncBooleanIterator, callback?: AsyncBooleanResultCallback): void; + all: typeof async.every; + allSeries: typeof async.every; + allLimit: typeof async.everyLimit; + + concat(arr: T[], iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): void; + concat(arr: Dictionary, iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): void; + concatSeries: typeof async.concat; // Control Flow series(tasks: AsyncFunction[], callback?: AsyncResultArrayCallback): void; @@ -143,14 +167,14 @@ interface Async { parallel(tasks: Dictionary>, callback?: AsyncResultObjectCallback): void; parallelLimit(tasks: Array>, limit: number, callback?: AsyncResultArrayCallback): void; parallelLimit(tasks: Dictionary>, limit: number, callback?: AsyncResultObjectCallback): void; - whilst(test: () => boolean, fn: AsyncVoidFunction, callback: (err: any) => void): void; - doWhilst(fn: AsyncVoidFunction, test: () => boolean, callback: (err: any) => void): void; - until(test: () => boolean, fn: AsyncVoidFunction, callback: (err: any) => void): void; - doUntil(fn: AsyncVoidFunction, test: () => boolean, callback: (err: any) => void): void; - during(test: (testCallback : (error: Error, truth: boolean) => void) => void, fn: AsyncVoidFunction, callback: (err: any) => void): void; - doDuring(fn: AsyncVoidFunction, test: (testCallback: (error: Error, truth: boolean) => void) => void, callback: (err: any) => void): void; - forever(next: (errCallback : (err: Error) => void) => void, errBack: (err: Error) => void) : void; - waterfall(tasks: Function[], callback?: (err: Error, results?: any) => void): void; + whilst(test: () => boolean, fn: AsyncVoidFunction, callback: ErrorCallback): void; + doWhilst(fn: AsyncVoidFunction, test: () => boolean, callback: ErrorCallback): void; + until(test: () => boolean, fn: AsyncVoidFunction, callback: ErrorCallback): void; + doUntil(fn: AsyncVoidFunction, test: () => boolean, callback: ErrorCallback): void; + during(test: (testCallback : AsyncBooleanResultCallback) => void, fn: AsyncVoidFunction, callback: ErrorCallback): void; + doDuring(fn: AsyncVoidFunction, test: (testCallback: AsyncBooleanResultCallback) => void, callback: ErrorCallback): void; + forever(next: (next : ErrorCallback) => void, errBack: ErrorCallback) : void; + waterfall(tasks: Function[], callback?: AsyncResultCallback): void; compose(...fns: Function[]): Function; seq(...fns: Function[]): Function; applyEach(fns: Function[], argsAndCallback: any[]): void; // applyEach(fns, args..., callback). TS does not support ... for a middle argument. Callback is optional. @@ -158,19 +182,15 @@ interface Async { queue(worker: AsyncWorker, concurrency?: number): AsyncQueue; priorityQueue(worker: AsyncWorker, concurrency: number): AsyncPriorityQueue; cargo(worker : (tasks: any[], callback : ErrorCallback) => void, payload? : number) : AsyncCargo; - auto(tasks: any, concurrency?: number, callback?: (error: Error, results: any) => void): void; - autoInject(tasks: any, callback?: (error: Error, results: any) => void): void; - retry(opts: number, task: (callback : AsyncResultCallback, results: any) => void, callback: (error: Error, results: any) => void): void; - retry(opts: { times: number, interval: number|((retryCount: number) => number) }, task: (callback: AsyncResultCallback, results : any) => void, callback: (error: Error, results: any) => void): void; + auto(tasks: any, concurrency?: number, callback?: AsyncResultCallback): void; + autoInject(tasks: any, callback?: AsyncResultCallback): void; + retry(opts: number, task: (callback : AsyncResultCallback, results: any) => void, callback: AsyncResultCallback): void; + retry(opts: { times: number, interval: number|((retryCount: number) => number) }, task: (callback: AsyncResultCallback, results : any) => void, callback: AsyncResultCallback): void; retryable(opts: number | {times: number, interval: number}, task: AsyncFunction): AsyncFunction; apply(fn: Function, ...arguments: any[]): AsyncFunction; nextTick(callback: Function, ...args: any[]): void; setImmediate: typeof async.nextTick; - allLimit(arr: T[], limit: number, iteratee: AsyncBooleanIterator, cb?: (result: boolean) => any) : any; - everySeries(arr: T[], iteratee: AsyncBooleanIterator, cb?: (result: boolean) => any) : any - allSeries: typeof async.everySeries; - reflect(fn: AsyncFunction) : (callback: (err: void, result: {error?: Error, value?: T}) => void) => void; reflectAll(tasks: AsyncFunction[]): ((callback: (err: void, result: {error?: Error, value?: T}) => void) => void)[]; From a8ecb3be1dfaf898cd95bdf40529ade758781365 Mon Sep 17 00:00:00 2001 From: "Dmitry A. Efimenko" Date: Tue, 1 Nov 2016 05:41:02 -0700 Subject: [PATCH 111/246] inquirer - make sure methods don't conflict (#12247) * add prompt() override returning promise according to [docs](https://www.npmjs.com/package/inquirer#inquirerpromptquestions---promise) * made sure there won't be conflicts * Revert "made sure there won't be conflicts" This reverts commit 0281989a3826e2b57fcd4e355d899ebd11604153. * Revert "add prompt() override returning promise" This reverts commit b5094ce38d78fc40c59653926711de2b297105cf. * resolve method conflicts --- inquirer/inquirer.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inquirer/inquirer.d.ts b/inquirer/inquirer.d.ts index 2abd6e6d53..c0f45a58ba 100644 --- a/inquirer/inquirer.d.ts +++ b/inquirer/inquirer.d.ts @@ -32,7 +32,7 @@ declare module "inquirer" { * @param cb Callback being passed the user answers * @return */ - prompt(questions: Questions, cb?: (answers: Answers) => any): ui.Prompt; + prompt(questions: Questions, cb: (answers: Answers) => any): ui.Prompt; prompt(questions: Questions): Promise; prompts: Prompts; Separator: objects.SeparatorStatic; From 0b5e88ac7064beb23f379bd4837e0b20356810a6 Mon Sep 17 00:00:00 2001 From: Georgii Dolzhykov Date: Tue, 1 Nov 2016 14:49:50 +0200 Subject: [PATCH 112/246] angularjs: as a shortcut, directives can be defined with just the linking function (#12144) See https://docs.angularjs.org/api/ng/service/$compile "You can either return a Directive Definition Object (see below) that defines the directive properties, or just the postLink function (all other properties will have the default values)." --- angularjs/angular-tests.ts | 21 +++++++++++++++++++-- angularjs/angular.d.ts | 7 +++---- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/angularjs/angular-tests.ts b/angularjs/angular-tests.ts index 6b5e5580a7..0b0314b7d6 100644 --- a/angularjs/angular-tests.ts +++ b/angularjs/angular-tests.ts @@ -192,8 +192,25 @@ mod.controller({ MyCtrl2: function() {}, MyCtrl3: ['$fooService', function($fooService: any) { }] }); -mod.directive('name', function ($scope: ng.IScope) { }) -mod.directive('name', ['$scope', function ($scope: ng.IScope) { }]) +mod.directive('myDirectiveA', ($rootScope: ng.IRootScopeService) => { + return (scope, el, attrs) => { + let foo = 'none'; + el.click(e => { + foo = e.type; + $rootScope.$apply(); + }); + scope.$watch(() => foo, () => el.text(foo)); + }; +}); +mod.directive('myDirectiveB', ['$rootScope', function ($rootScope: ng.IRootScopeService) { + return { + link(scope, el, attrs) { + el.click(e => { + el.hide(); + }); + } + }; +}]); mod.directive({ myFooDir: () => ({ template: 'my-foo-dir.tpl.html' diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index 0e3e1b214e..b16438bdcb 100644 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -1770,7 +1770,7 @@ declare namespace angular { /////////////////////////////////////////////////////////////////////////// interface IDirectiveFactory { - (...args: any[]): IDirective; + (...args: any[]): IDirective | IDirectiveLinkFn; } interface IDirectiveLinkFn { @@ -1778,8 +1778,8 @@ declare namespace angular { scope: IScope, instanceElement: JQuery, instanceAttributes: IAttributes, - controller: {}, - transclude: ITranscludeFunction + controller?: IController | IController[] | {[key: string]: IController}, + transclude?: ITranscludeFunction ): void; } @@ -1807,7 +1807,6 @@ declare namespace angular { controller?: string | Injectable; controllerAs?: string; /** - * @deprecated * Deprecation warning: although bindings for non-ES6 class controllers are currently bound to this before * the controller constructor is called, this use is now deprecated. Please place initialization code that * relies upon bindings inside a $onInit method on the controller, instead. From 3827cbea3f48b526ba9f6d86582b92d1e2594950 Mon Sep 17 00:00:00 2001 From: sqwk Date: Tue, 1 Nov 2016 14:26:33 +0100 Subject: [PATCH 113/246] Add Preliminary Tests --- paper/paper-tests.ts | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/paper/paper-tests.ts b/paper/paper-tests.ts index 8e011255a2..48a82524d8 100644 --- a/paper/paper-tests.ts +++ b/paper/paper-tests.ts @@ -1 +1,38 @@ /// + +import paper = require('paper'); + +var canvas = document.createElement('canvas') + +paper.setup(canvas); + +// Circle +var path = paper.Path.Circle({ + center: [80, 50], + radius: 35, + fillColor: 'red' +}); + +// Dotted Line Tool +var dottedLinePath: paper.Path; +var dottedLineTool = new paper.Tool(); + +dottedLineTool.onMouseDown = function(event: any) { + new paper.Layer().activate(); + dottedLinePath = new paper.Path(); + dottedLinePath.strokeColor = '#00'; + dottedLinePath.strokeWidth = 2; + dottedLinePath.dashArray = [5, 8]; + dottedLinePath.strokeCap = 'round'; + dottedLinePath.strokeJoin = 'round'; + dottedLinePath.add(event.point); +}; + +dottedLineTool.onMouseDrag = function(event: any) { + dottedLinePath.add(event.point); +}; + +dottedLineTool.onMouseUp = function(event: any) { + dottedLinePath.smooth(); + dottedLinePath.simplify(); +}; From eaaf036c78f7e15959fa21ba1b028f830f4871ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isidro=20Mart=C3=ADnez?= Date: Tue, 1 Nov 2016 07:34:57 -0600 Subject: [PATCH 114/246] add supported types by jQuery selector (#11967) Actually jQuery supports multiple selector types see: http://api.jquery.com/jquery --- angular-protractor/angular-protractor.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/angular-protractor/angular-protractor.d.ts b/angular-protractor/angular-protractor.d.ts index d33eeddace..b05eda4a13 100644 --- a/angular-protractor/angular-protractor.d.ts +++ b/angular-protractor/angular-protractor.d.ts @@ -1829,8 +1829,8 @@ declare namespace protractor { function wrapDriver(webdriver: webdriver.WebDriver, opt_baseUrl?: string, opt_rootElement?: string): Protractor; } -interface cssSelectorHelper { - (cssLocator: string): protractor.ElementFinder; +interface selectorHelper { + (cssLocator: string | Function | HTMLElement | Document | Array): protractor.ElementFinder; } interface cssArraySelectorHelper { @@ -1841,7 +1841,7 @@ declare var browser: protractor.IBrowser; declare var by: protractor.IProtractorLocatorStrategy; declare var By: protractor.IProtractorLocatorStrategy; declare var element: protractor.Element; -declare var $: cssSelectorHelper; +declare var $: selectorHelper; declare var $$: cssArraySelectorHelper; declare module 'protractor' { From 769e7894540064a33ef43c3f420d0bf4092820f4 Mon Sep 17 00:00:00 2001 From: Leo Rudberg Date: Tue, 1 Nov 2016 10:00:44 -0400 Subject: [PATCH 115/246] Fix ordering of Server.listen definitions (#12399) The version of `Server.listen` that takes a `ListenOptions` as the first argument should come before the versions that take `any` as the first argument. For example, even if a `ListenOptions` object is given, VSCode will assume it is `any` in its helper text. I find that not as preferable for type-safety reasons ( avoid all `any`s ;) ). --- 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 61132b9232..1766a854a3 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -1933,9 +1933,9 @@ declare module "net" { listen(port: number, listeningListener?: Function): Server; listen(path: string, backlog?: number, listeningListener?: Function): Server; listen(path: string, listeningListener?: Function): Server; + listen(options: ListenOptions, listeningListener?: Function): Server; listen(handle: any, backlog?: number, listeningListener?: Function): Server; listen(handle: any, listeningListener?: Function): Server; - listen(options: ListenOptions, listeningListener?: Function): Server; close(callback?: Function): Server; address(): { port: number; family: string; address: string; }; getConnections(cb: (error: Error, count: number) => void): void; From 423675cf5f904cf5d9bfd17b8f9f33a5a37b710a Mon Sep 17 00:00:00 2001 From: Linda_pp Date: Wed, 2 Nov 2016 22:40:01 +0900 Subject: [PATCH 116/246] New reference path for 'electron' directory (#12396) --- .../electron-devtools-installer-tests.ts | 4 ++-- electron-json-storage/electron-json-storage-tests.ts | 2 +- electron-notifications/electron-notifications.d.ts | 4 ++-- electron-notify/electron-notify.d.ts | 4 ++-- electron-window-state/electron-window-state.d.ts | 2 +- menubar/menubar.d.ts | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/electron-devtools-installer/electron-devtools-installer-tests.ts b/electron-devtools-installer/electron-devtools-installer-tests.ts index daf19a1daf..fd2ea2cc1e 100644 --- a/electron-devtools-installer/electron-devtools-installer-tests.ts +++ b/electron-devtools-installer/electron-devtools-installer-tests.ts @@ -1,4 +1,4 @@ -/// +/// /// import installExtension, { @@ -17,4 +17,4 @@ installExtension(ANGULARJS_BATARANG); installExtension(VUEJS_DEVTOOLS); installExtension(REDUX_DEVTOOLS); installExtension(REACT_PERF); -installExtension('abcdefghijkl'); \ No newline at end of file +installExtension('abcdefghijkl'); diff --git a/electron-json-storage/electron-json-storage-tests.ts b/electron-json-storage/electron-json-storage-tests.ts index 3a0c43bce1..8f75d5908b 100644 --- a/electron-json-storage/electron-json-storage-tests.ts +++ b/electron-json-storage/electron-json-storage-tests.ts @@ -1,4 +1,4 @@ -/// +/// /// import electron = require('electron'); diff --git a/electron-notifications/electron-notifications.d.ts b/electron-notifications/electron-notifications.d.ts index 5cbb655246..e0235d6e63 100644 --- a/electron-notifications/electron-notifications.d.ts +++ b/electron-notifications/electron-notifications.d.ts @@ -3,7 +3,7 @@ // Definitions by: Daniel Pereira // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +/// declare namespace ElectronNotifications { @@ -38,4 +38,4 @@ declare namespace ElectronNotifications { /** A node module for sending notifications in electron applications */ declare module 'electron-notifications' { export function notify(title: string, data?: ElectronNotifications.NotifierOptions): ElectronNotifications.NotificationWindow; -} \ No newline at end of file +} diff --git a/electron-notify/electron-notify.d.ts b/electron-notify/electron-notify.d.ts index b29efa0e50..316ee79e4d 100644 --- a/electron-notify/electron-notify.d.ts +++ b/electron-notify/electron-notify.d.ts @@ -3,7 +3,7 @@ // Definitions by: Daniel Pereira // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +/// /** Nice and simple notifications for electron apps */ declare module 'electron-notify' { @@ -61,4 +61,4 @@ declare module 'electron-notify' { export function setTemplatePath(path: string): void; -} \ No newline at end of file +} diff --git a/electron-window-state/electron-window-state.d.ts b/electron-window-state/electron-window-state.d.ts index dfcb297e4f..45fce5edaf 100644 --- a/electron-window-state/electron-window-state.d.ts +++ b/electron-window-state/electron-window-state.d.ts @@ -3,7 +3,7 @@ // Definitions by: rhysd // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +/// declare namespace ElectronWindowState { interface WindowState { diff --git a/menubar/menubar.d.ts b/menubar/menubar.d.ts index 678207fb78..bb20201bfc 100644 --- a/menubar/menubar.d.ts +++ b/menubar/menubar.d.ts @@ -3,7 +3,7 @@ // Definitions by: rhysd // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +/// /// declare namespace Menubar { From a9a732cb4d68d2fb46313a3ab07114c9bddb03b8 Mon Sep 17 00:00:00 2001 From: John Vilk Date: Wed, 2 Nov 2016 10:33:27 -0400 Subject: [PATCH 117/246] [Node] errno is a number, not a string. (#11890) --- node/node-tests.ts | 2 +- node/node.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/node/node-tests.ts b/node/node-tests.ts index 0025505e67..99a728ab92 100644 --- a/node/node-tests.ts +++ b/node/node-tests.ts @@ -179,7 +179,7 @@ namespace fs_tests { } { - var errno: string; + var errno: number; fs.readFile('testfile', (err, data) => { if (err && err.errno) { errno = err.errno; diff --git a/node/node.d.ts b/node/node.d.ts index 1766a854a3..9abffa79e3 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -233,7 +233,7 @@ declare var Buffer: { ************************************************/ declare namespace NodeJS { export interface ErrnoException extends Error { - errno?: string; + errno?: number; code?: string; path?: string; syscall?: string; From 323168508789eeaade1984d184cc5088f7787149 Mon Sep 17 00:00:00 2001 From: TonyYang Date: Wed, 2 Nov 2016 22:39:31 +0800 Subject: [PATCH 118/246] Add a method (#12430) --- mongodb/mongodb.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mongodb/mongodb.d.ts b/mongodb/mongodb.d.ts index 8254701033..b64868b93f 100644 --- a/mongodb/mongodb.d.ts +++ b/mongodb/mongodb.d.ts @@ -428,6 +428,8 @@ declare module "mongodb" { getTimestamp(): Date; // Returns the ObjectID id as a 24 byte hex string representation toHexString(): string; + // Returns the ObjectID id as a 24 byte hex string representation + toString(): string; } // Class documentation : http://mongodb.github.io/node-mongodb-native/2.1/api/Binary.html From 5b3fcc4f7d0e404b738f86195f8f49035b6133c5 Mon Sep 17 00:00:00 2001 From: Stefan Dobrev Date: Tue, 1 Nov 2016 15:25:15 +0200 Subject: [PATCH 119/246] [material-ui] Add boolean for muiTheme.userAgent It turns out that `muiTheme.userAgent` supports booleans as well. This is used when you want to disable the autoprefixer functionality: https://github.com/callemall/material-ui/blob/ccf712c5733508784cd709c18c29059542d6aad1/src/utils/autoprefixer.js#L20 --- material-ui/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/material-ui/index.d.ts b/material-ui/index.d.ts index 941b7aff72..c04d673dc9 100644 --- a/material-ui/index.d.ts +++ b/material-ui/index.d.ts @@ -141,7 +141,7 @@ declare namespace __MaterialUI { fontFamily?: string; palette?: ThemePalette; isRtl?: boolean; - userAgent?: string; + userAgent?: string | boolean; zIndex?: zIndex; baseTheme?: RawTheme; rawTheme?: RawTheme; From baadc0b1309dbd75b25bac04bbee67976e2fbd17 Mon Sep 17 00:00:00 2001 From: TANAKA Koichi Date: Thu, 3 Nov 2016 00:21:54 +0900 Subject: [PATCH 120/246] Add prompt sync (#12412) * Add definition for prompt-sync * Add definition for prompt-sync-history --- .../prompt-sync-history-tests.ts | 12 +++ prompt-sync-history/prompt-sync-history.d.ts | 15 ++++ prompt-sync/prompt-sync-tests.ts | 55 ++++++++++++++ prompt-sync/prompt-sync.d.ts | 75 +++++++++++++++++++ 4 files changed, 157 insertions(+) create mode 100644 prompt-sync-history/prompt-sync-history-tests.ts create mode 100644 prompt-sync-history/prompt-sync-history.d.ts create mode 100644 prompt-sync/prompt-sync-tests.ts create mode 100644 prompt-sync/prompt-sync.d.ts diff --git a/prompt-sync-history/prompt-sync-history-tests.ts b/prompt-sync-history/prompt-sync-history-tests.ts new file mode 100644 index 0000000000..2132f8166f --- /dev/null +++ b/prompt-sync-history/prompt-sync-history-tests.ts @@ -0,0 +1,12 @@ +/// +/// +'use strict'; + +import * as promptHistory from 'prompt-sync-history'; +import * as PromptSync from 'prompt-sync'; + +let history:PromptSync.History; + +history = promptHistory(); +history = promptHistory('/path/to/file'); +history = promptHistory(null, 1000); diff --git a/prompt-sync-history/prompt-sync-history.d.ts b/prompt-sync-history/prompt-sync-history.d.ts new file mode 100644 index 0000000000..6b343fbb51 --- /dev/null +++ b/prompt-sync-history/prompt-sync-history.d.ts @@ -0,0 +1,15 @@ +// Type definitions for prompt-sync-history 1.0.1 +// Project: https://github.com/davidmarkclements/prompt-sync-history +// Definitions by: TANAKA Koichi +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module 'prompt-sync-history' { + import {History} from 'prompt-sync'; + + namespace history {} + function history(file?:string, max?:number): History; + + export = history; +} diff --git a/prompt-sync/prompt-sync-tests.ts b/prompt-sync/prompt-sync-tests.ts new file mode 100644 index 0000000000..fbe2e120e7 --- /dev/null +++ b/prompt-sync/prompt-sync-tests.ts @@ -0,0 +1,55 @@ +/// +'use strict'; + +import * as promptSync from 'prompt-sync'; + +declare const history: promptSync.History; + +let prompt: promptSync.Prompt; + +// without config +prompt = promptSync(); + +// with config +prompt = promptSync({ + history: history, + sigint: false, + autocomplete: (input:string) => [input] +}); + +// with empty config +prompt = promptSync({}); + +let name:string = prompt('Enter name: '); +let nickname:string = prompt({ask: 'Enter nickname: ', value: 'N/A'}); +let gender:string = prompt('Enter gender: ', { autocomplete: complete(['male', 'female']) }); +let age:string = prompt('Enter age: ', '18', { echo: '*' }); +let password:string = prompt.hide('Enter password: '); +let anotherPassword:string = prompt('Enter another password: ', { echo: '', value: '*password*'}); + +function complete(commands: string[]) { + return function (str: string) { + const ret:string[] = []; + for (let i=0; i< commands.length; i++) { + if (commands[i].indexOf(str) == 0) + ret.push(commands[i]); + } + return ret; + }; +} + +// History interface +let bool: boolean; + +bool = history.atStart(); +bool = history.atPenultimate(); +bool = history.pastEnd(); +bool = history.atEnd(); + +let str: string; +str = history.prev(); +str = history.next(); + +history.reset(); +history.push('aaa'); +history.save(); diff --git a/prompt-sync/prompt-sync.d.ts b/prompt-sync/prompt-sync.d.ts new file mode 100644 index 0000000000..3b997c93ca --- /dev/null +++ b/prompt-sync/prompt-sync.d.ts @@ -0,0 +1,75 @@ +// Type definitions for prompt-sync 4.1.4 +// Project: https://github.com/0x00A/prompt-sync +// Definitions by: TANAKA Koichi +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module 'prompt-sync' { + namespace PromptSync { + export interface Prompt { + + (opts: Option): string; + (ask: string): string; + (ask: string, opts: Option): string; + (ask: string, value: string): string; + /** + * prompt -- sync function for reading user input from stdin + * @param {String} ask opening question/statement to prompt for + * @param {String} value initial value for the prompt + * @param {Object} opts { + * echo: set to a character to be echoed, default is '*'. Use '' for no echo + * value: {String} initial value for the prompt + * ask: {String} opening question/statement to prompt for, does not override ask param + * autocomplete: {StringArray} function({String}) + * } + * + * @returns {string} Returns the string input or (if sigint === false) + * null if user terminates with a ^C + */ + (ask: string, value: string, opts: Option): string; + + hide(ask: string): string; + } + + export interface Option { + ask?: string; + echo?: string; + autocomplete?: AutoCompleteFunction; + value?: string; + } + + export interface Config { + sigint?: boolean; + autocomplete?: AutoCompleteFunction; + history?: History; + } + + export interface History { + atStart(): boolean; + atPenultimate(): boolean; + pastEnd(): boolean; + atEnd(): boolean; + prev(): string; + next(): string; + reset(): void; + push(str: string): void; + save(): void; + } + + export interface AutoCompleteFunction { + (input: string): string[]; + } + } + + /** + * create -- sync function for reading user input from stdin + * @param {Object} config { + * sigint: {Boolean} exit on ^C + * autocomplete: {StringArray} function({String}) + * history: {String} a history control object (see `prompt-sync-history`) + * } + * @returns {Function} prompt function + */ + function PromptSync(config?: PromptSync.Config): PromptSync.Prompt; + + export = PromptSync; +} From c5ea2b4c69f6f6a8f8346645630c805773f628b1 Mon Sep 17 00:00:00 2001 From: Connor Peet Date: Tue, 1 Nov 2016 09:06:04 -0700 Subject: [PATCH 121/246] Treat clipboard as a CJS module --- clipboard/clipboard-tests.ts | 2 +- clipboard/index.d.ts | 98 ++++++++++++++++++------------------ 2 files changed, 51 insertions(+), 49 deletions(-) diff --git a/clipboard/clipboard-tests.ts b/clipboard/clipboard-tests.ts index c6c7b756cb..7521c651dd 100644 --- a/clipboard/clipboard-tests.ts +++ b/clipboard/clipboard-tests.ts @@ -1,4 +1,4 @@ - +import * as Clipboard from 'clipboard'; var cb1 = new Clipboard('.btn'); var cb2 = new Clipboard(document.getElementById('id'), { diff --git a/clipboard/index.d.ts b/clipboard/index.d.ts index d4b014e2f3..0757eb1208 100644 --- a/clipboard/index.d.ts +++ b/clipboard/index.d.ts @@ -3,54 +3,56 @@ // Definitions by: Andrei Kurosh // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare class Clipboard { - constructor(selector: (string | Element | NodeListOf), options?: ClipboardOptions); - - /** - * Subscribes to events that indicate the result of a copy/cut operation. - * @param type {String} Event type ('success' or 'error'). - * @param handler Callback function. - */ - on(type: "success", handler: (e: ClipboardEvent) => void): this; - on(type: "error", handler: (e: ClipboardEvent) => void): this; - on(type: string, handler: (e: ClipboardEvent) => void): this; - - /** - * Clears all event bindings. - */ - destroy(): void; -} - -interface ClipboardOptions { - /** - * Overwrites default command ('cut' or 'copy'). - * @param {Element} elem Current element - * @returns {String} Only 'cut' or 'copy'. - */ - action?: (elem: Element) => string; - - /** - * Overwrites default target input element. - * @param {Element} elem Current element - * @returns {Element} element to use. - */ - target?: (elem: Element) => Element; - - /** - * Returns the explicit text to copy. - * @param {Element} elem Current element - * @returns {String} Text to be copied. - */ - text?: (elem: Element) => string; -} - -interface ClipboardEvent { - action: string; - text: string; - trigger: Element; - clearSelection(): void; -} - declare module 'clipboard' { + class Clipboard { + constructor(selector: (string | Element | NodeListOf), options?: Clipboard.Options); + + /** + * Subscribes to events that indicate the result of a copy/cut operation. + * @param type {String} Event type ('success' or 'error'). + * @param handler Callback function. + */ + on(type: "success", handler: (e: Clipboard.Event) => void): this; + on(type: "error", handler: (e: Clipboard.Event) => void): this; + on(type: string, handler: (e: Clipboard.Event) => void): this; + + /** + * Clears all event bindings. + */ + destroy(): void; + } + + namespace Clipboard { + interface Options { + /** + * Overwrites default command ('cut' or 'copy'). + * @param {Element} elem Current element + * @returns {String} Only 'cut' or 'copy'. + */ + action?: (elem: Element) => string; + + /** + * Overwrites default target input element. + * @param {Element} elem Current element + * @returns {Element} element to use. + */ + target?: (elem: Element) => Element; + + /** + * Returns the explicit text to copy. + * @param {Element} elem Current element + * @returns {String} Text to be copied. + */ + text?: (elem: Element) => string; + } + + interface Event { + action: string; + text: string; + trigger: Element; + clearSelection(): void; + } + } + export = Clipboard; } From db8a22f4417fdb8a21bbe4393fe00f917b63ec3b Mon Sep 17 00:00:00 2001 From: bluepichu Date: Wed, 2 Nov 2016 17:44:27 -0400 Subject: [PATCH 122/246] pixi.js - Fix "hex2string" bug --- pixi.js/pixi.js-tests.ts | 2 +- pixi.js/pixi.js.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pixi.js/pixi.js-tests.ts b/pixi.js/pixi.js-tests.ts index ac50d9d955..1e6a88ff3b 100644 --- a/pixi.js/pixi.js-tests.ts +++ b/pixi.js/pixi.js-tests.ts @@ -274,7 +274,7 @@ namespace basics { // draw a circle, set the lineStyle to zero so the circle doesn't have an outline this.graphics.lineStyle(0); - this.graphics.beginFill(0xFFFF0B, 0.5); + this.graphics.beginFill(PIXI.utils.hex2string(0xFFFF0B), 0.5); this.graphics.drawCircle(470, 90, 60); this.graphics.endFill(); diff --git a/pixi.js/pixi.js.d.ts b/pixi.js/pixi.js.d.ts index d8e6bf86d7..3de0f3f296 100644 --- a/pixi.js/pixi.js.d.ts +++ b/pixi.js/pixi.js.d.ts @@ -1103,7 +1103,7 @@ declare namespace PIXI { static uuid(): number; static hex2rgb(hex: number, out?: number[]): number[]; - static hex2String(hex: number): string; + static hex2string(hex: number): string; static rgb2hex(rgb: Number[]): number; static canUseNewCanvasBlendModel(): boolean; static getNextPowerOfTwo(number: number): number; From ccf944ff703b6580f1155ad07367c60a43557382 Mon Sep 17 00:00:00 2001 From: bluepichu Date: Wed, 2 Nov 2016 17:53:35 -0400 Subject: [PATCH 123/246] Replace hex2string test with a legal use --- pixi.js/pixi.js-tests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pixi.js/pixi.js-tests.ts b/pixi.js/pixi.js-tests.ts index 1e6a88ff3b..f54da3fb00 100644 --- a/pixi.js/pixi.js-tests.ts +++ b/pixi.js/pixi.js-tests.ts @@ -274,7 +274,7 @@ namespace basics { // draw a circle, set the lineStyle to zero so the circle doesn't have an outline this.graphics.lineStyle(0); - this.graphics.beginFill(PIXI.utils.hex2string(0xFFFF0B), 0.5); + this.graphics.beginFill(0xFFFF0B, 0.5); this.graphics.drawCircle(470, 90, 60); this.graphics.endFill(); @@ -461,7 +461,7 @@ namespace basics { var style: PIXI.TextStyle = { font: '36px Arial bold italic', - fill: '#F7EDCA', + fill: PIXI.utils.hex2string(0xF7EDCA), stroke: '#4a1850', strokeThickness: 5, dropShadow: true, From 9742548d05dd7433ea6da088ac4120488e6092e9 Mon Sep 17 00:00:00 2001 From: Rufus Linke Date: Thu, 3 Nov 2016 08:59:06 +0100 Subject: [PATCH 124/246] add type definitions for angular-promise-tracker --- .../angular-promise-tracker-tests.ts | 22 ++++++++++++++++ .../angular-promise-tracker.d.ts | 26 +++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 angular-promise-tracker/angular-promise-tracker-tests.ts create mode 100644 angular-promise-tracker/angular-promise-tracker.d.ts diff --git a/angular-promise-tracker/angular-promise-tracker-tests.ts b/angular-promise-tracker/angular-promise-tracker-tests.ts new file mode 100644 index 0000000000..8c575567ff --- /dev/null +++ b/angular-promise-tracker/angular-promise-tracker-tests.ts @@ -0,0 +1,22 @@ +/// + +angular.module('promise-tracker-tests', []).run(['$q', 'promiseTracker', + ($q: angular.IQService, promiseTracker: angular.promisetracker.PromiseTrackerService) => { + const trackerWithoutOptions = promiseTracker(); + + const options = { + activationDelay: 10, + minDuration: 500 + } as angular.promisetracker.PromiseTrackerOptions; + const trackerWithOptions = promiseTracker(options); + + const isActive: boolean = trackerWithOptions.active(); + const tracking: boolean = trackerWithOptions.tracking(); + const trackingCount: number = trackerWithOptions.trackingCount(); + trackerWithOptions.cancel(); + + const createdPromise: angular.IDeferred = trackerWithOptions.createPromise(); + + const promiseToAdd = $q.defer().promise; + const addedPromise: angular.IDeferred = trackerWithOptions.addPromise(promiseToAdd); +}]); diff --git a/angular-promise-tracker/angular-promise-tracker.d.ts b/angular-promise-tracker/angular-promise-tracker.d.ts new file mode 100644 index 0000000000..28b6721fb7 --- /dev/null +++ b/angular-promise-tracker/angular-promise-tracker.d.ts @@ -0,0 +1,26 @@ +// Type definitions for angular-promise-tracker v2.2.2 +// Project: https://github.com/ajoslin/angular-promise-tracker +// Definitions by: Rufus Linke +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace angular.promisetracker { + interface PromiseTrackerOptions { + activationDelay: number; + minDuration: number; + } + + interface PromiseTracker { + active(): boolean; + tracking(): boolean; + trackingCount(): number; + addPromise(promise: angular.IPromise): angular.IDeferred; + createPromise(): angular.IDeferred; + cancel(): void; + } + + interface PromiseTrackerService { + (options?: PromiseTrackerOptions): PromiseTracker; + } +} From a2c847cc871734bf3f0c5a8695582c821c762efb Mon Sep 17 00:00:00 2001 From: Rufus Linke Date: Thu, 3 Nov 2016 11:06:48 +0100 Subject: [PATCH 125/246] adjust angular-promise-tracker typings to types-2.0 --- .../angular-promise-tracker-tests.ts | 4 +-- .../angular-promise-tracker.d.ts | 26 ---------------- angular-promise-tracker/index.d.ts | 30 +++++++++++++++++++ angular-promise-tracker/tsconfig.json | 19 ++++++++++++ 4 files changed, 50 insertions(+), 29 deletions(-) delete mode 100644 angular-promise-tracker/angular-promise-tracker.d.ts create mode 100644 angular-promise-tracker/index.d.ts create mode 100644 angular-promise-tracker/tsconfig.json diff --git a/angular-promise-tracker/angular-promise-tracker-tests.ts b/angular-promise-tracker/angular-promise-tracker-tests.ts index 8c575567ff..82f9e66c06 100644 --- a/angular-promise-tracker/angular-promise-tracker-tests.ts +++ b/angular-promise-tracker/angular-promise-tracker-tests.ts @@ -1,9 +1,7 @@ -/// - angular.module('promise-tracker-tests', []).run(['$q', 'promiseTracker', ($q: angular.IQService, promiseTracker: angular.promisetracker.PromiseTrackerService) => { const trackerWithoutOptions = promiseTracker(); - + const options = { activationDelay: 10, minDuration: 500 diff --git a/angular-promise-tracker/angular-promise-tracker.d.ts b/angular-promise-tracker/angular-promise-tracker.d.ts deleted file mode 100644 index 28b6721fb7..0000000000 --- a/angular-promise-tracker/angular-promise-tracker.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -// Type definitions for angular-promise-tracker v2.2.2 -// Project: https://github.com/ajoslin/angular-promise-tracker -// Definitions by: Rufus Linke -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - -declare namespace angular.promisetracker { - interface PromiseTrackerOptions { - activationDelay: number; - minDuration: number; - } - - interface PromiseTracker { - active(): boolean; - tracking(): boolean; - trackingCount(): number; - addPromise(promise: angular.IPromise): angular.IDeferred; - createPromise(): angular.IDeferred; - cancel(): void; - } - - interface PromiseTrackerService { - (options?: PromiseTrackerOptions): PromiseTracker; - } -} diff --git a/angular-promise-tracker/index.d.ts b/angular-promise-tracker/index.d.ts new file mode 100644 index 0000000000..91f7ad72e5 --- /dev/null +++ b/angular-promise-tracker/index.d.ts @@ -0,0 +1,30 @@ +// Type definitions for angular-promise-tracker 2.2.2 +// Project: https://github.com/ajoslin/angular-promise-tracker +// Definitions by: Rufus Linke +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import * as angular from 'angular'; + +declare module 'angular' { + namespace promisetracker { + interface PromiseTrackerOptions { + activationDelay: number; + minDuration: number; + } + + interface PromiseTracker { + active(): boolean; + tracking(): boolean; + trackingCount(): number; + addPromise(promise: angular.IPromise): angular.IDeferred; + createPromise(): angular.IDeferred; + cancel(): void; + } + + interface PromiseTrackerService { + (options?: PromiseTrackerOptions): PromiseTracker; + } + } +} diff --git a/angular-promise-tracker/tsconfig.json b/angular-promise-tracker/tsconfig.json new file mode 100644 index 0000000000..266a8adf90 --- /dev/null +++ b/angular-promise-tracker/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "angular-promise-tracker-tests.ts" + ] +} From 3779c195edad61e684430f53273f2aaf665ab1fe Mon Sep 17 00:00:00 2001 From: James Dowell Date: Thu, 3 Nov 2016 10:22:04 +0000 Subject: [PATCH 126/246] Update AjvOptions - multipleOfPrecision property Updating the AjvOptions - multipleOfPrecision property to allow boolean or number. Precision is specified as a number while the value defaults to false (i.e. disabled) Link to PR which added the multipleOfPrecision option: https://github.com/epoberezkin/ajv/commit/5f2cc30449d81a7d10148567f3f1ed038b00718e --- ajv/ajv.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ajv/ajv.d.ts b/ajv/ajv.d.ts index d8bfd56ef3..304fba2512 100644 --- a/ajv/ajv.d.ts +++ b/ajv/ajv.d.ts @@ -82,7 +82,7 @@ declare module "ajv" { passContext?: boolean; loopRequired?: number; ownProperties?: boolean; - multipleOfPrecision?: boolean; + multipleOfPrecision?: boolean | number; errorDataPath?: string, messages?: boolean; beautify?: boolean; From 16b5c4a4fd4bcea7f83b32b760889558da240a60 Mon Sep 17 00:00:00 2001 From: Jesper Date: Thu, 3 Nov 2016 11:30:47 +0100 Subject: [PATCH 127/246] Solved export error in index.d.ts Please fill in this template. - [X] Prefer to make your PR against the `types-2.0` branch. - [X] The package does not provide its own types, and you can not add them. - [X] Test the change in your own code. - [X] Follow the advice from the [readme](https://github.com/DefinitelyTyped/DefinitelyTyped#make-a-pull-request). - [X] Avoid [common mistakes](https://github.com/DefinitelyTyped/DefinitelyTyped#common-mistakes). If changing an existing definition: - [X] Provide a URL to documentation or source code which provides context for the suggested changes: There are no changes made to the API, only in how the module is exported. Thus no URL has been included as it's not relevant. - [X] Increase the version number in the header if appropriate. **Solution for error "error TS2694: Namespace 'angular' has no exported member 'gettext'.". Module "angular" is now imported. The "angular.gettext" namespace declaration has been changed to instead extend the angular module.** --- angular-gettext/index.d.ts | 112 +++++++++++++++++++------------------ 1 file changed, 59 insertions(+), 53 deletions(-) diff --git a/angular-gettext/index.d.ts b/angular-gettext/index.d.ts index 380ef1d8b7..224f5032e0 100644 --- a/angular-gettext/index.d.ts +++ b/angular-gettext/index.d.ts @@ -1,73 +1,79 @@ -// Type definitions for angular-gettext v2.1.0 +// Type definitions for angular-gettext v2.1.0 // Project: https://angular-gettext.rocketeer.be/ // Definitions by: Ákos Lukács // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// -declare namespace angular.gettext { - interface gettextCatalog { - ////////////// - /// Fields /// - ////////////// - - /** (default: false): Whether or not to prefix untranslated strings with [MISSING]: or a custom prefix. */ - debug: boolean; - /** (default: [MISSING]:): Custom prefix for untranslated strings. */ - debugPrefix: string; - /** (default: false): Whether or not to wrap all processed text with markers.Example output: [Welcome] */ - showTranslatedMarkers: boolean; - /** (default: [): Custom prefix to mark strings that have been run through angular-gettext. */ - translatedMarkerPrefix: string; - /** (default: ]): Custom suffix to mark strings that have been run through angular-gettext. */ - translatedMarkerSuffix: string; - /** An object of loaded translation strings.Shouldn't be used directly. */ - strings: {}; - /** The default language, in which you're application is written. This defaults to English and it's generally a bad idea to use anything else: if your language has different pluralization rules you'll end up with incorrect translations. Deprecated - * @deprecreated - */ - baseLanguage: string; +import * as angular from 'angular'; - /////////////// - /// Methods /// - /////////////// +declare module 'angular' { + export namespace gettext { + interface gettextCatalog { - /** Sets the current language and makes sure that all translations get updated correctly. */ - setCurrentLanguage(lang: string): void; + ////////////// + /// Fields /// + ////////////// - /** Returns the current language. */ - getCurrentLanguage(): string; + /** (default: false): Whether or not to prefix untranslated strings with [MISSING]: or a custom prefix. */ + debug: boolean; + /** (default: [MISSING]:): Custom prefix for untranslated strings. */ + debugPrefix: string; + /** (default: false): Whether or not to wrap all processed text with markers.Example output: [Welcome] */ + showTranslatedMarkers: boolean; + /** (default: [): Custom prefix to mark strings that have been run through angular-gettext. */ + translatedMarkerPrefix: string; + /** (default: ]): Custom suffix to mark strings that have been run through angular-gettext. */ + translatedMarkerSuffix: string; + /** An object of loaded translation strings.Shouldn't be used directly. */ + strings: {}; + /** The default language, in which you're application is written. This defaults to English and it's generally a bad idea to use anything else: if your language has different pluralization rules you'll end up with incorrect translations. Deprecated + * @deprecreated + */ + baseLanguage: string; - /** Processes an object of string definitions. More details https://angular-gettext.rocketeer.be/dev-guide/manual-setstrings/ - * @param language A language code. - * @param strings A dictionary of strings. The format of this dictionary is: - * - Keys: Singular English strings (as defined in the source files) - * - Values: Either a single string for signular-only strings or an array of plural forms. - */ - setStrings(language: string, strings: { [key: string]: string|string[] }): void; - /** Get the correct pluralized (but untranslated) string for the value of n. */ - getStringForm(string: string, n: number): string; + /////////////// + /// Methods /// + /////////////// - /** Translate a string with the given scope. Uses Angular.JS interpolation, so something like this will do what you expect: - * var hello = gettextCatalog.getString("Hello {{name}}!", { name: "Ruben" }); - * // var hello will be "Hallo Ruben!" in Dutch. - * The scope parameter is optional: pass null (or don't pass anything) if you're not using it: this skips interpolation and is a lot faster. - */ - getString(string: string, scope?: any, context?: string): string; + /** Sets the current language and makes sure that all translations get updated correctly. */ + setCurrentLanguage(lang: string): void; - /** Translate a plural string with the given context. */ - getPlural(n: number, string: string, stringPlural: string, context?: any): string; + /** Returns the current language. */ + getCurrentLanguage(): string; - /** Load a set of translation strings from a given URL.This should be a JSON catalog generated with grunt-angular-gettext. More details https://angular-gettext.rocketeer.be/dev-guide/lazy-loading/ */ - loadRemote(url: string): ng.IHttpPromise; - } + /** Processes an object of string definitions. More details https://angular-gettext.rocketeer.be/dev-guide/manual-setstrings/ + * @param language A language code. + * @param strings A dictionary of strings. The format of this dictionary is: + * - Keys: Singular English strings (as defined in the source files) + * - Values: Either a single string for signular-only strings or an array of plural forms. + */ + setStrings(language: string, strings: { [key: string]: string|string[] }): void; - /** If you have text that should be translated in your JavaScript code, wrap it with a call to a function named gettext. This module provides an injectable function to do so */ - interface gettextFunction { - (dummyString: string): string; + /** Get the correct pluralized (but untranslated) string for the value of n. */ + getStringForm(string: string, n: number): string; + + /** Translate a string with the given scope. Uses Angular.JS interpolation, so something like this will do what you expect: + * var hello = gettextCatalog.getString("Hello {{name}}!", { name: "Ruben" }); + * // var hello will be "Hallo Ruben!" in Dutch. + * The scope parameter is optional: pass null (or don't pass anything) if you're not using it: this skips interpolation and is a lot faster. + */ + getString(string: string, scope?: any, context?: string): string; + + /** Translate a plural string with the given context. */ + getPlural(n: number, string: string, stringPlural: string, context?: any): string; + + /** Load a set of translation strings from a given URL.This should be a JSON catalog generated with grunt-angular-gettext. More details https://angular-gettext.rocketeer.be/dev-guide/lazy-loading/ */ + loadRemote(url: string): ng.IHttpPromise; + } + + /** If you have text that should be translated in your JavaScript code, wrap it with a call to a function named gettext. This module provides an injectable function to do so */ + interface gettextFunction { + (dummyString: string): string; + } } } From f080b63646be89a2466028ebdbaac80a7e0abc08 Mon Sep 17 00:00:00 2001 From: Andy Date: Thu, 3 Nov 2016 09:34:43 -0700 Subject: [PATCH 128/246] Remove the `github-electron` directory, as its contents have already been moved to `electron` (#12300) --- github-electron/electron.d.ts | 8 -------- github-electron/github-electron.d.ts | 8 -------- 2 files changed, 16 deletions(-) delete mode 100644 github-electron/electron.d.ts delete mode 100644 github-electron/github-electron.d.ts diff --git a/github-electron/electron.d.ts b/github-electron/electron.d.ts deleted file mode 100644 index 585c9e4668..0000000000 --- a/github-electron/electron.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -// Type definitions for electron 1.3.3 -// Project: https://github.com/electron-userland/electron-prebuilt -// Definitions by: rhysd -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - -// this file will be removed. diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts deleted file mode 100644 index ccb5b5b843..0000000000 --- a/github-electron/github-electron.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -// Type definitions for Electron v1.4.2 -// Project: http://electron.atom.io/ -// Definitions by: jedmao , rhysd , Milan Burda -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - -// this file will be removed. From 5c443dc6d175da96b5d7ee970071ebca2ce2cf4c Mon Sep 17 00:00:00 2001 From: goleon Date: Fri, 4 Nov 2016 00:52:13 +0400 Subject: [PATCH 129/246] * Use native mouse event in originalEvent propery * Added DomUtil declaration * Added Class declaration (think about generics) * Evented class inherited from Class --- leaflet/leaflet.d.ts | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/leaflet/leaflet.d.ts b/leaflet/leaflet.d.ts index 38872edcb1..6b0a8990d8 100644 --- a/leaflet/leaflet.d.ts +++ b/leaflet/leaflet.d.ts @@ -5,7 +5,42 @@ /// +type NativeMouseEvent = MouseEvent; + declare namespace L { + export class Class { + static extend(props:any):any/* how to return constructor of self extended type ? */; + static include(props:any):any /* how to return self extended type ? */; + static mergeOptions(props:any): any /* how to return self extended type ? */; + static addInitHook(initHookFn: ()=> void): any/* how to return self extended type ? */; + } + + export class DomUtil { + static get(id: string|HTMLElement): HTMLElement; + static getStyle(el: HTMLElement, styleAttrib: string): string; + static create(tagName: String, className?: String, container?: HTMLElement): HTMLElement; + static remove(el: HTMLElement):void; + static empty(el: HTMLElement):void; + static toFront(el: HTMLElement):void; + static toBack(el: HTMLElement):void; + static hasClass(el: HTMLElement, name: String): Boolean; + static addClass(el: HTMLElement, name: String):void; + static removeClass(el: HTMLElement, name: String):void; + static setClass(el: HTMLElement, name: String):void; + static getClass(el: HTMLElement): String; + static setOpacity(el: HTMLElement, opacity: Number); + static testProp(props: String[]): String|boolean/*=false*/; + static setTransform(el: HTMLElement, offset: Point, scale?: Number); + static setPosition(el: HTMLElement, position: Point):void; + static getPosition(el: HTMLElement): Point + static disableTextSelection(): void + static enableTextSelection(): void + static disableImageDrag(): void + static enableImageDrag(): void + static preventOutline(el: HTMLElement): void + static restoreOutline(): void + } + export interface CRS { latLngToPoint(latlng: LatLng, zoom: number): Point; latLngToPoint(latlng: LatLngLiteral, zoom: number): Point; @@ -211,7 +246,7 @@ declare namespace L { * with an object (e.g. the user clicks on the map, causing the map to fire * 'click' event). */ - export interface Evented { + export interface Evented extends Class { /** * Adds a listener function (fn) to a particular event type of the object. * You can optionally specify the context of the listener (object the this @@ -1125,7 +1160,7 @@ declare namespace L { latlng: LatLng; layerPoint: Point; containerPoint: Point; - originalEvent: MouseEvent; // how can I reference the global MouseEvent? + originalEvent: NativeMouseEvent; } export interface LocationEvent extends Event { From 3a1606d0519f838de2166d91687ae3ec8eabd37b Mon Sep 17 00:00:00 2001 From: goleon Date: Fri, 4 Nov 2016 01:06:53 +0400 Subject: [PATCH 130/246] fix return type for DomUtil --- leaflet/leaflet.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/leaflet/leaflet.d.ts b/leaflet/leaflet.d.ts index 6b0a8990d8..f9fb91d4c9 100644 --- a/leaflet/leaflet.d.ts +++ b/leaflet/leaflet.d.ts @@ -28,9 +28,9 @@ declare namespace L { static removeClass(el: HTMLElement, name: String):void; static setClass(el: HTMLElement, name: String):void; static getClass(el: HTMLElement): String; - static setOpacity(el: HTMLElement, opacity: Number); + static setOpacity(el: HTMLElement, opacity: Number):void; static testProp(props: String[]): String|boolean/*=false*/; - static setTransform(el: HTMLElement, offset: Point, scale?: Number); + static setTransform(el: HTMLElement, offset: Point, scale?: Number):void; static setPosition(el: HTMLElement, position: Point):void; static getPosition(el: HTMLElement): Point static disableTextSelection(): void From 7e0ebfc5d209c654d86d30b6f54fae4a4ee498a8 Mon Sep 17 00:00:00 2001 From: Ray Solomon Date: Thu, 3 Nov 2016 19:59:30 -0700 Subject: [PATCH 131/246] Update bunyan LoggerOptions to accept stdSerializers --- bunyan/bunyan-tests.ts | 1 + bunyan/index.d.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/bunyan/bunyan-tests.ts b/bunyan/bunyan-tests.ts index c609901b0a..06fce4b410 100644 --- a/bunyan/bunyan-tests.ts +++ b/bunyan/bunyan-tests.ts @@ -26,6 +26,7 @@ level = bunyan.resolveLevel(bunyan.FATAL); var options:bunyan.LoggerOptions = { name: 'test-logger', + serializers: bunyan.stdSerializers, streams: [{ type: 'stream', stream: process.stdout, diff --git a/bunyan/index.d.ts b/bunyan/index.d.ts index 79aa9e5f20..2983d8bb62 100644 --- a/bunyan/index.d.ts +++ b/bunyan/index.d.ts @@ -21,7 +21,7 @@ declare class Logger extends EventEmitter { levels(name: number | string, value: number | string): void; fields: any; - src:boolean; + src:boolean; trace(error: Error, format?: any, ...params: any[]): void; trace(buffer: Buffer, format?: any, ...params: any[]): void; @@ -54,7 +54,7 @@ interface LoggerOptions { streams?: Stream[]; level?: string | number; stream?: NodeJS.WritableStream; - serializers?: Serializers; + serializers?: Serializers | StdSerializers; src?: boolean; } From 08bbc012f2f126662bf3751ccd87e5758f7f375f Mon Sep 17 00:00:00 2001 From: gatsbimantico Date: Fri, 4 Nov 2016 08:14:32 +0100 Subject: [PATCH 132/246] Updated header Updated header with info about Project and Definitions --- gapi.analytics/gapi.analytics.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gapi.analytics/gapi.analytics.d.ts b/gapi.analytics/gapi.analytics.d.ts index da9b81cb68..dc49ffd617 100644 --- a/gapi.analytics/gapi.analytics.d.ts +++ b/gapi.analytics/gapi.analytics.d.ts @@ -1,4 +1,7 @@ // Type definitions for Google Analytics API +// Project: https://developers.google.com/analytics/devguides/reporting/core/v4/ +// Definitions by: César Costas +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// From 093a21a7e5a7ab87057cf8b97a3385761223ec64 Mon Sep 17 00:00:00 2001 From: Bruce Lindsay Date: Fri, 4 Nov 2016 15:35:28 -0400 Subject: [PATCH 133/246] remove trailing whitespaces --- jquery/jquery-tests.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/jquery/jquery-tests.ts b/jquery/jquery-tests.ts index 479081c477..3fe93e73a6 100644 --- a/jquery/jquery-tests.ts +++ b/jquery/jquery-tests.ts @@ -209,9 +209,9 @@ function test_ajax() { url: "test.js" }); jqXHR.abort('aborting because I can'); - + //Test the promise exposed by the jqXHR object - + // done method $.ajax({ url: "test.js" @@ -239,7 +239,7 @@ function test_ajax() { }).promise().always((jqXHR, textStatus, errorThrown) => { console.log(jqXHR, textStatus, errorThrown); }); - + // then method (as of 1.8) $.ajax({ url: "test.js" @@ -252,7 +252,7 @@ function test_ajax() { // generic then method var p: JQueryPromise = $.ajax({ url: "test.js" }).promise() .then(() => "Hello") - .then((x) => x.length); + .then((x) => x.length); } function test_ajaxComplete() { From a7baddf2ad0ab5b224d1d7c2800bcd966a4f0240 Mon Sep 17 00:00:00 2001 From: Bruce Lindsay Date: Fri, 4 Nov 2016 16:03:55 -0400 Subject: [PATCH 134/246] fix return type to include a chained promise --- jquery/index.d.ts | 2 +- jquery/jquery-tests.ts | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/jquery/index.d.ts b/jquery/index.d.ts index f8af62caba..fa22a1599b 100644 --- a/jquery/index.d.ts +++ b/jquery/index.d.ts @@ -180,7 +180,7 @@ interface JQueryXHR extends XMLHttpRequest, JQueryPromise { /** * Incorporates the functionality of the .done() and .fail() methods, allowing (as of jQuery 1.8) the underlying Promise to be manipulated. Refer to deferred.then() for implementation details. */ - then(doneCallback: (data: any, textStatus: string, jqXHR: JQueryXHR) => R, failCallback?: (jqXHR: JQueryXHR, textStatus: string, errorThrown: any) => void): JQueryPromise; + then(doneCallback: (data: any, textStatus: string, jqXHR: JQueryXHR) => R|JQueryPromise, failCallback?: (jqXHR: JQueryXHR, textStatus: string, errorThrown: any) => void): JQueryPromise; /** * Property containing the parsed response if the response Content-Type is json */ diff --git a/jquery/jquery-tests.ts b/jquery/jquery-tests.ts index 3fe93e73a6..c33967febd 100644 --- a/jquery/jquery-tests.ts +++ b/jquery/jquery-tests.ts @@ -169,6 +169,12 @@ function test_ajax() { console.log(data, textStatus, jqXHR); }); + // done method can change promise type through promise chaining + var chainedValuePromise : JQueryPromise; + chainedValuePromise = $.ajax({ + url: "test.js" + }).then(() => $.when(1)); + // fail method $.ajax({ url: "test.js" From 57556c944d19fe551bd2f796d841ea09ea280971 Mon Sep 17 00:00:00 2001 From: bruce-lindsay Date: Fri, 4 Nov 2016 17:24:36 -0400 Subject: [PATCH 135/246] Update jquery-tests.ts fixed comment --- jquery/jquery-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery/jquery-tests.ts b/jquery/jquery-tests.ts index c33967febd..b64fdc43cf 100644 --- a/jquery/jquery-tests.ts +++ b/jquery/jquery-tests.ts @@ -169,7 +169,7 @@ function test_ajax() { console.log(data, textStatus, jqXHR); }); - // done method can change promise type through promise chaining + // then method can change promise type through promise chaining var chainedValuePromise : JQueryPromise; chainedValuePromise = $.ajax({ url: "test.js" From e7772769fab8c206449ce9673cac417370330aa9 Mon Sep 17 00:00:00 2001 From: DJ_Middle Date: Sun, 6 Nov 2016 04:38:31 +0900 Subject: [PATCH 136/246] Added isEmpty function definition (#12500) --- validator/validator-tests.ts | 4 ++++ validator/validator.d.ts | 14 +++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/validator/validator-tests.ts b/validator/validator-tests.ts index abe3e41a2d..0dba730288 100644 --- a/validator/validator-tests.ts +++ b/validator/validator-tests.ts @@ -27,6 +27,7 @@ import isDateFunc = require('validator/lib/isDate'); import isDecimalFunc = require('validator/lib/isDecimal'); import isDivisibleByFunc = require('validator/lib/isDivisibleBy'); import isEmailFunc = require('validator/lib/isEmail'); +import isEmptyFunc = require('validator/lib/isEmpty'); import isFQDNFunc = require('validator/lib/isFQDN'); import isFloatFunc = require('validator/lib/isFloat'); import isFullWidthFunc = require('validator/lib/isFullWidth'); @@ -126,6 +127,9 @@ namespace import_tests { let _isEmail = validator.isEmail; _isEmail = isEmailFunc; + let _isEmpty = validator.isEmpty; + _isEmpty = isEmptyFunc; + let _isFQDN = validator.isFQDN; _isFQDN = isFQDNFunc; diff --git a/validator/validator.d.ts b/validator/validator.d.ts index 4cf18650f0..ad91c01204 100644 --- a/validator/validator.d.ts +++ b/validator/validator.d.ts @@ -7,7 +7,7 @@ declare namespace ValidatorJS { type AlphaLocale = "ar" | "ar-AE" | "ar-BH" | "ar-DZ" | "ar-EG" | "ar-IQ" | "ar-JO" | "ar-KW" | "ar-LB" | "ar-LY" | "ar-MA" | "ar-QA" | "ar-QM" | "ar-SA" | "ar-SD" | "ar-SY" | "ar-TN" | "ar-YE" | "cs-CZ" | "de-DE" | "en-AU" | "en-GB" | "en-HK" | "en-IN" | "en-NZ" | "en-US" | "en-ZA" | "en-ZM" | "es-ES" | "fr-FR" | "hu-HU" | "nl-NL" | "pl-PL" | "pt-BR" | "pt-PT" | "ru-RU" | "sr-RS" | "sr-RS@latin" | "tr-TR"; type AlphanumericLocale = "ar" | "ar-AE" | "ar-BH" | "ar-DZ" | "ar-EG" | "ar-IQ" | "ar-JO" | "ar-KW" | "ar-LB" | "ar-LY" | "ar-MA" | "ar-QA" | "ar-QM" | "ar-SA" | "ar-SD" | "ar-SY" | "ar-TN" | "ar-YE" | "cs-CZ" | "de-DE" | "en-AU" | "en-GB" | "en-HK" | "en-IN" | "en-NZ" | "en-US" | "en-ZA" | "en-ZM" | "es-ES" | "fr-FR" | "fr-BE" | "hu-HU" | "nl-BE" | "nl-NL" | "pl-PL" | "pt-BR" | "pt-PT" | "ru-RU" | "sr-RS" | "sr-RS@latin" | "tr-TR"; type MobilePhoneLocale = "ar-DZ" | "ar-SA" | "ar-SY" | "cs-CZ" | "de-DE" | "da-DK" | "el-GR" | "en-AU" | "en-GB" | "en-HK" | "en-IN" | "en-NZ" | "en-US" | "en-CA" | "en-ZA" | "en-ZM" | "es-ES" | "fi-FI" | "fr-FR" | "hu-HU" | "it-IT" | "ja-JP" | "ms-MY" | "nb-NO" | "nn-NO" | "pl-PL" | "pt-PT" | "ru-RU" | "sr-RS" | "tr-TR" | "vi-VN" | "zh-CN" | "zh-TW" - + interface ValidatorStatic { // ************** @@ -72,6 +72,9 @@ declare namespace ValidatorJS { // check if the string is an email. isEmail(str: string, options?: IsEmailOptions): boolean; + // check if the string has a length of zero. + isEmpty(str: string): boolean; + // check if the string is a fully qualified domain name (e.g. domain.com). isFQDN(str: string, options?: IsFQDNOptions): boolean; @@ -213,9 +216,9 @@ declare namespace ValidatorJS { // remove characters that do not appear in the whitelist. The characters are used in a RegExp and so you will // need to escape some chars, e.g. whitelist(input, '\\[\\]'). whitelist(input: string, chars: string): string; - + toString(input: any | any[]): string; - + version: string; // ************** @@ -407,6 +410,11 @@ declare module "validator/lib/isEmail" { export = isEmail; } +declare module "validator/lib/isEmpty" { + const isEmpty: typeof validator.isEmpty; + export = isEmpty; +} + declare module "validator/lib/isFQDN" { const isFQDN: typeof validator.isFQDN; export = isFQDN; From 5483214f02eb5e13ffb45fddd044203b8d33cc72 Mon Sep 17 00:00:00 2001 From: Dave Alden Date: Sun, 6 Nov 2016 14:16:13 +0000 Subject: [PATCH 137/246] Update for cordova.plugins.diagnostic@3.3.0 --- .../cordova.plugins.diagnostic-tests.ts | 24 ++++++++++ .../cordova.plugins.diagnostic.d.ts | 46 ++++++++++++++++++- 2 files changed, 69 insertions(+), 1 deletion(-) diff --git a/cordova.plugins.diagnostic/cordova.plugins.diagnostic-tests.ts b/cordova.plugins.diagnostic/cordova.plugins.diagnostic-tests.ts index e95c973171..47ce7a108a 100644 --- a/cordova.plugins.diagnostic/cordova.plugins.diagnostic-tests.ts +++ b/cordova.plugins.diagnostic/cordova.plugins.diagnostic-tests.ts @@ -507,4 +507,28 @@ cordova.plugins.diagnostic.getBackgroundRefreshStatus(function(status){ } }, function(error){ console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.requestBluetoothAuthorization(function(){ + console.log("Bluetooth authorization requested"); +}, function(error){ + console.error(error); +}); + +cordova.plugins.diagnostic.isMotionAvailable(function(available){ + console.log("Motion tracking is " + (available ? "available" : "not available") + " on this device"); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.isMotionRequestOutcomeAvailable(function(available){ + console.log("Motion tracking request outcome is " + (available ? "available" : "not available") + " on this device"); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.requestAndCheckMotionAuthorization(function(status){ + console.log("Motion authorization is " +status); +}, function(error){ + console.error(error); }); \ No newline at end of file diff --git a/cordova.plugins.diagnostic/cordova.plugins.diagnostic.d.ts b/cordova.plugins.diagnostic/cordova.plugins.diagnostic.d.ts index 0fcca3b1ca..cbb7adac8f 100644 --- a/cordova.plugins.diagnostic/cordova.plugins.diagnostic.d.ts +++ b/cordova.plugins.diagnostic/cordova.plugins.diagnostic.d.ts @@ -1,4 +1,4 @@ -// Type definitions for cordova.plugins.diagnostic v3.2.2 +// Type definitions for cordova.plugins.diagnostic v3.3.0 // Project: https://github.com/dpa99c/cordova-diagnostic-plugin // Definitions by: Dave Alden // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -686,6 +686,50 @@ interface Diagnostic { successCallback: (status: string) => void, errorCallback: (error: string) => void ) => void; + + /** + * iOS ONLY + * Requests Bluetooth authorization for the application. + * @param successCallback + * @param errorCallback + */ + requestBluetoothAuthorization?: ( + successCallback: () => void, + errorCallback: (error: string) => void + ) => void; + + /** + * iOS ONLY + * Checks if motion tracking is available on the current device. + * @param successCallback + * @param errorCallback + */ + isMotionAvailable?: ( + successCallback: (available: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * iOS ONLY + * Checks if it's possible to determine the outcome of a motion authorization request on the current device. + * @param successCallback + * @param errorCallback + */ + isMotionRequestOutcomeAvailable?: ( + successCallback: (available: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * iOS ONLY + * Requests and checks motion authorization for the application. + * @param successCallback + * @param errorCallback + */ + requestAndCheckMotionAuthorization?: ( + successCallback: (status: string) => void, + errorCallback: (error: string) => void + ) => void; } interface CordovaPlugins { From 121ddf1be68def3f5dc245eacd0d0471eac590b0 Mon Sep 17 00:00:00 2001 From: Will Munn Date: Sun, 6 Nov 2016 15:42:16 +0000 Subject: [PATCH 138/246] Needle (#12108) * Derive type of response in callback from nodes IncomingMessage * Allow any request header name --- needle/needle-tests.ts | 8 +- needle/needle.d.ts | 168 ++++++++++++++++++++--------------------- 2 files changed, 85 insertions(+), 91 deletions(-) diff --git a/needle/needle-tests.ts b/needle/needle-tests.ts index 106d46a716..6b4d991a93 100644 --- a/needle/needle-tests.ts +++ b/needle/needle-tests.ts @@ -1,12 +1,12 @@ /// - -import needle = require("needle"); +import * as needle from "needle"; function Usage() { // using callback needle.get('http://ifconfig.me/all.json', function (error, response) { if (!error) console.log(response.body.ip_addr); // JSON decoding magic. :) + console.log(response.statusCode); }); // using streams @@ -15,7 +15,9 @@ function Usage() { } function ResponsePipeline() { - needle.get('http://stackoverflow.com/feeds', { compressed: true }, function (err, resp) { + needle.get('http://stackoverflow.com/feeds', { compressed: true, headers: { + Authorization: 'bearer 12dsfgsdgsgq' + } }, function (err, resp) { console.log(resp.body); // this little guy won't be a Gzipped binary blob // but a nice object containing all the latest entries }); diff --git a/needle/needle.d.ts b/needle/needle.d.ts index 449368e185..8e23024072 100644 --- a/needle/needle.d.ts +++ b/needle/needle.d.ts @@ -5,95 +5,87 @@ /// -declare namespace Needle { - interface ReadableStream extends NodeJS.ReadableStream { - } - - interface Callback { - (error: Error, response: any, body: any): void; - } - - interface RequestOptions { - timeout?: number; - follow?: number; - follow_max?: number; - multipart?: boolean; - proxy?: string; - agent?: string; - headers?: HttpHeaderOptions; - auth?: string; // auto | digest | basic (default) - json?: boolean; - - // These properties are overwritten by those in the 'headers' field - compressed?: boolean; - cookies?: { [name: string]: any; }; - // Overwritten if present in the URI - username?: string; - password?: string; - } - - interface ResponseOptions { - decode?: boolean; - parse?: boolean; - output?: any; - } - - interface HttpHeaderOptions { - cookies?: { [name: string]: any; }; - compressed?: boolean; - accept?: string; - connection?: string; - user_agent?: string; - - // Overwritten if present in the URI - username?: string; - password?: string; - } - - interface TLSOptions { - pfx?: any; - key?: any; - passphrase?: string; - cert?: any; - ca?: any; - ciphers?: any; - rejectUnauthorized?: boolean; - secureProtocol?: any; - } - - interface NeedleOptions extends RequestOptions, ResponseOptions, HttpHeaderOptions, TLSOptions { - } - - interface NeedleStatic { - defaults(options?: any): void; - - head(url: string): ReadableStream; - head(url: string, callback?: Callback): ReadableStream; - head(url: string, options?: RequestOptions, callback?: Callback): ReadableStream; - - get(url: string): ReadableStream; - get(url: string, callback?: Callback): ReadableStream; - get(url: string, options?: RequestOptions, callback?: Callback): ReadableStream; - - post(url: string, data: any): ReadableStream; - post(url: string, data: any, callback?: Callback): ReadableStream; - post(url: string, data: any, options?: RequestOptions, callback?: Callback): ReadableStream; - - put(url: string, data: any): ReadableStream; - put(url: string, data: any, callback?: Callback): ReadableStream; - put(url: string, data: any, options?: RequestOptions, callback?: Callback): ReadableStream; - - delete(url: string, data: any): ReadableStream; - delete(url: string, data: any, callback?: Callback): ReadableStream; - delete(url: string, data: any, options?: RequestOptions, callback?: Callback): ReadableStream; - - request(method: string, url: string, data: any): ReadableStream; - request(method: string, url: string, data: any, callback?: Callback): ReadableStream; - request(method: string, url: string, data: any, options?: RequestOptions, callback?: Callback): ReadableStream; - } -} - declare module "needle" { + import * as http from 'http'; + import * as Buffer from 'buffer'; + module Needle { + interface NeedleResponse extends http.IncomingMessage { + body: any; + raw: Buffer; + bytes: number; + } + interface ReadableStream extends NodeJS.ReadableStream { + } + + interface Callback { + (error: Error, response: NeedleResponse, body: any): void; + } + + interface RequestOptions { + timeout?: number; + follow?: number; + follow_max?: number; + multipart?: boolean; + proxy?: string; + agent?: string; + headers?: Object; + auth?: string; // auto | digest | basic (default) + json?: boolean; + + // These properties are overwritten by those in the 'headers' field + compressed?: boolean; + cookies?: { [name: string]: any; }; + // Overwritten if present in the URI + username?: string; + password?: string; + } + + interface ResponseOptions { + decode?: boolean; + parse?: boolean; + output?: any; + } + + interface TLSOptions { + pfx?: any; + key?: any; + passphrase?: string; + cert?: any; + ca?: any; + ciphers?: any; + rejectUnauthorized?: boolean; + secureProtocol?: any; + } + + interface NeedleStatic { + defaults(options?: any): void; + + head(url: string): ReadableStream; + head(url: string, callback?: Callback): ReadableStream; + head(url: string, options?: RequestOptions, callback?: Callback): ReadableStream; + + get(url: string): ReadableStream; + get(url: string, callback?: Callback): ReadableStream; + get(url: string, options?: RequestOptions, callback?: Callback): ReadableStream; + + post(url: string, data: any): ReadableStream; + post(url: string, data: any, callback?: Callback): ReadableStream; + post(url: string, data: any, options?: RequestOptions, callback?: Callback): ReadableStream; + + put(url: string, data: any): ReadableStream; + put(url: string, data: any, callback?: Callback): ReadableStream; + put(url: string, data: any, options?: RequestOptions, callback?: Callback): ReadableStream; + + delete(url: string, data: any): ReadableStream; + delete(url: string, data: any, callback?: Callback): ReadableStream; + delete(url: string, data: any, options?: RequestOptions, callback?: Callback): ReadableStream; + + request(method: string, url: string, data: any): ReadableStream; + request(method: string, url: string, data: any, callback?: Callback): ReadableStream; + request(method: string, url: string, data: any, options?: RequestOptions, callback?: Callback): ReadableStream; + } + } + var needle: Needle.NeedleStatic; export = needle; } From dcaa0c94d81ecd1f396d7af8d1afd0bd0198b025 Mon Sep 17 00:00:00 2001 From: Borek Bernard Date: Sun, 6 Nov 2016 17:17:32 +0100 Subject: [PATCH 139/246] `url` and `uri` options objects are now `string | Url` --- request/index.d.ts | 5 +++-- request/request-tests.ts | 28 +++++++++++++++++++--------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/request/index.d.ts b/request/index.d.ts index 71c69f9d49..f842e37400 100644 --- a/request/index.d.ts +++ b/request/index.d.ts @@ -13,6 +13,7 @@ import https = require('https'); import url = require('url'); import fs = require('fs'); import FormData = require('form-data'); +import { Url } from 'url'; declare namespace request { export interface RequestAPI Date: Mon, 7 Nov 2016 11:56:56 +0100 Subject: [PATCH 140/246] add namespace export --- angular-promise-tracker/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angular-promise-tracker/index.d.ts b/angular-promise-tracker/index.d.ts index 91f7ad72e5..c00f36e77c 100644 --- a/angular-promise-tracker/index.d.ts +++ b/angular-promise-tracker/index.d.ts @@ -8,7 +8,7 @@ import * as angular from 'angular'; declare module 'angular' { - namespace promisetracker { + export namespace promisetracker { interface PromiseTrackerOptions { activationDelay: number; minDuration: number; From 64b3d2051455372bf904727b81065f99b97971d8 Mon Sep 17 00:00:00 2001 From: Endel Dreyer Date: Mon, 7 Nov 2016 14:30:08 +0100 Subject: [PATCH 141/246] Loader classes inherits from AbstractLoader (#12415) * Loader classes inherits from AbstractLoader * update PreloadJS version on header comments * added contributor name --- preloadjs/index.d.ts | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/preloadjs/index.d.ts b/preloadjs/index.d.ts index e31995c4a0..1d3c96ddcb 100644 --- a/preloadjs/index.d.ts +++ b/preloadjs/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for PreloadJS 0.6.0 +// Type definitions for PreloadJS 0.6.2 // Project: http://www.createjs.com/#!/PreloadJS -// Definitions by: Pedro Ferreira +// Definitions by: Pedro Ferreira , Endel Dreyer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /* @@ -64,7 +64,7 @@ declare namespace createjs { load(): void; } - export class BinaryLoader + export class BinaryLoader extends AbstractLoader { constructor(loadItem: Object); @@ -72,7 +72,7 @@ declare namespace createjs { static canLoadItem(item: Object): boolean; } - export class CSSLoader + export class CSSLoader extends AbstractLoader { constructor(loadItem: Object, preferXHR: boolean); @@ -96,28 +96,28 @@ declare namespace createjs { title: string; } - export class ImageLoader + export class ImageLoader extends AbstractLoader { constructor(loadItem: Object, preferXHR: boolean); static canLoadItem(item: Object): boolean; } - export class JavaScriptLoader + export class JavaScriptLoader extends AbstractLoader { constructor(loadItem: Object, preferXHR: boolean); static canLoadItem(item: Object): boolean; } - export class JSONLoader + export class JSONLoader extends AbstractLoader { constructor(loadItem: Object); static canLoadItem(item: Object): boolean; } - export class JSONPLoader + export class JSONPLoader extends AbstractLoader { constructor(loadItem: Object); @@ -175,7 +175,7 @@ declare namespace createjs { unregisterLoader(loader: AbstractLoader): void; } - export class ManifestLoader + export class ManifestLoader extends AbstractLoader { constructor(loadItem: LoadItem | Object); @@ -228,21 +228,21 @@ declare namespace createjs { static parseURI(path: string): Object; } - export class SoundLoader + export class SoundLoader extends AbstractLoader { constructor(loadItem: Object, preferXHR: boolean); static canLoadItem(item: Object): boolean; } - export class SpriteSheetLoader + export class SpriteSheetLoader extends AbstractLoader { constructor(loadItem: Object); static canLoadItem(item: Object): boolean; } - export class SVGLoader + export class SVGLoader extends AbstractLoader { constructor(loadItem: Object, preferXHR: boolean); @@ -254,14 +254,14 @@ declare namespace createjs { } - export class TextLoader + export class TextLoader extends AbstractLoader { constructor(loadItem: Object); static canLoadItem(item: Object): boolean; } - export class VideoLoader + export class VideoLoader extends AbstractLoader { constructor(loadItem: Object, preferXHR: boolean); @@ -277,7 +277,7 @@ declare namespace createjs { getResponseHeader(header: string): string; } - export class XMLLoader + export class XMLLoader extends AbstractLoader { constructor(loadItem: Object); From 678f191c7216a49e82306fa72c2fbc3838baadc4 Mon Sep 17 00:00:00 2001 From: ptrckc Date: Mon, 7 Nov 2016 07:30:47 -0600 Subject: [PATCH 142/246] Update express-brute types (#12422) * proxyDepth option on ExpressBrute has been removed See https://github.com/AdamPflug/express-brute/commit/94ee1f43e849ba1d9573823f65e5bb109c72e587 * getIPFromRequest(req) has been removed from instances See https://github.com/AdamPflug/express-brute/commit/94ee1f43e849ba1d9573823f65e5bb109c72e587 * Document ExpressBruteOptions * Export MemoryStoreOptions, Middleware and Options interfaces --- express-brute/index.d.ts | 138 ++++++++++++++++++++++----------------- 1 file changed, 77 insertions(+), 61 deletions(-) diff --git a/express-brute/index.d.ts b/express-brute/index.d.ts index 3f0c3927b9..b6a60d4247 100644 --- a/express-brute/index.d.ts +++ b/express-brute/index.d.ts @@ -7,58 +7,6 @@ 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 Options for {@link ExpressBrute} class. - * @interface - */ -interface ExpressBruteOptions { - freeRetries?: number; - proxyDepth?: number; - attachResetToRequest?: boolean; - refreshTimeoutOnRequest?: boolean; - minWait?: number; - maxWait?: number; - lifetime?: number; - failCallback?: (req: express.Request, res: express.Response, next: Function, nextValidRequestDate: any) => void; - handleStoreError?: any; -} - /** * @summary Middleware. * @class @@ -69,20 +17,13 @@ declare class ExpressBrute { * @constructor * @param {any} store The store. */ - constructor(store: any, options?: ExpressBruteOptions); + constructor(store: any, options?: ExpressBrute.Options); /** * @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; + getMiddleware(options: ExpressBrute.Middleware): express.RequestHandler; /** * @summary Middleware that will bounce requests that happen faster than the current wait time by calling failCallback. @@ -104,6 +45,81 @@ declare class ExpressBrute { } declare namespace ExpressBrute { + /** + * @summary Options for {@link MemoryStore} class. + * @interface + */ + export interface MemoryStoreOptions { + /** + * @summary Key prefix. + * @type {string} + */ + prefix: string; + } + + /** + * @summary Options for {@link ExpressBrute#getMiddleware} class. + * @interface + */ + export interface Middleware { + /** + * @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 Options for {@link ExpressBrute} class. + * @interface + */ + export interface Options { + /** + * @summary The number of retires the user has before they need to start waiting (default: 2) + */ + freeRetries?: number; + /** + * @summary Specify whether or not a simplified reset method should be attached at req.brute.reset. The simplified method takes only a callback, and resets all ExpressBrute middleware that was called on the current request. If multiple instances of ExpressBrute have middleware on the same request, only those with attachResetToRequest set to true will be reset (default: true) + */ + attachResetToRequest?: boolean; + /** + * @summary Defines whether the lifetime counts from the time of the last request that ExpressBrute didn't prevent for a given IP (true) or from of that IP's first request (false). Useful for allowing limits over fixed periods of time, for example: a limited number of requests per day. (Default: true). + */ + refreshTimeoutOnRequest?: boolean; + /** + * @summary The initial wait time (in milliseconds) after the user runs out of retries (default: 500 milliseconds) + */ + minWait?: number; + /** + * @summary The maximum amount of time (in milliseconds) between requests the user needs to wait (default: 15 minutes). The wait for a given request is determined by adding the time the user needed to wait for the previous two requests. + */ + maxWait?: number; + /** + * @summary The length of time (in seconds since the last request) to remember the number of requests that have been made by an IP. By default it will be set to maxWait * the number of attempts before you hit maxWait to discourage simply waiting for the lifetime to expire before resuming an attack. With default values this is about 6 hours. + */ + lifetime?: number; + /** + * @summary Gets called with (req, res, next, nextValidRequestDate) when a request is rejected (default: ExpressBrute.FailForbidden) + */ + failCallback?: (req: express.Request, res: express.Response, next: Function, nextValidRequestDate: any) => void; + /** + * @summary Gets called whenever an error occurs with the persistent store from which ExpressBrute cannot recover. It is passed an object containing the properties message (a description of the message), parent (the error raised by the session store), and [key, ip] or [req, res, next] depending on whether or the error occurs during reset or in the middleware itself. + */ + handleStoreError?: any; + } + /** * @summary In-memory store. * @class From af3261e419cb714a777b0d09735fe07ccadf4a5e Mon Sep 17 00:00:00 2001 From: Matt Martin Date: Mon, 7 Nov 2016 05:31:44 -0800 Subject: [PATCH 143/246] update getFragment declaration (#12255) The documentation is pretty bad, but Relay's getFragment method allows for an optional second argument for passing initial variables to the fragment. This simply adds that. --- react-relay/react-relay.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react-relay/react-relay.d.ts b/react-relay/react-relay.d.ts index 08833c8bc5..5aad6d4e4e 100644 --- a/react-relay/react-relay.d.ts +++ b/react-relay/react-relay.d.ts @@ -23,7 +23,7 @@ declare module "react-relay" { /** add static getFragment method to the component constructor */ interface RelayContainerClass extends React.ComponentClass { - getFragment: ((q: string) => string) + getFragment: ((q: string, v?: RelayVariables) => string) } interface RelayQueryRequestResolve { From 8ef8a160c9a647434a7be4d22ea4946d5c8e52a6 Mon Sep 17 00:00:00 2001 From: Ethan Date: Mon, 7 Nov 2016 08:34:54 -0500 Subject: [PATCH 144/246] Twilio tweaks (#12109) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Cleanup Imports These should be uniform, and should all use the require() syntax, as they’re referring to common js modules. * Enable client.calls.list() * Split up RestMethod signature By splitting up the union into an overload, we get much more useful autocomplete info. * Remove BaseRequestCallback BaseRequestCallback was only used in RestMethod, and it’s incorrect: the user’s callback is always called with 3 arguments. I think this was an attempt to say that the user’s callback doesn’t need to specify a third argument, but a two-argument callback will already conform to RequestCallback anyway. As the updated tests show, this change gives us better type inference too. * Use new Node HTTP Interface This MiddlewareFunction type isn’t assignable to an express middleware otherwise, as the latest express-static-core type declarations removes Http.ServerRequest from the type definition of an express RequestHandler --- twilio/index.d.ts | 18 +++++++++--------- twilio/twilio-tests.ts | 13 +++++++++---- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/twilio/index.d.ts b/twilio/index.d.ts index 022ac98440..b5b653f64a 100644 --- a/twilio/index.d.ts +++ b/twilio/index.d.ts @@ -6,11 +6,9 @@ /// /// /// - -import * as Express from 'express'; -import * as Http from 'http'; - -import Q = require('q'); +import Express = require("express"); +import Http = require("http"); +import Q = require("q"); declare interface twilio { (sid?: string, tkn?: string, options?: twilio.ClientOptions): twilio.RestClient; @@ -52,9 +50,11 @@ declare namespace twilio { } export interface RequestCallback { (err: any, data: any, response: Http.ClientResponse): void; } - export interface BaseRequestCallback { (err: any, data: any): void; } - export interface RestMethod { (args: any | BaseRequestCallback, callback?: RequestCallback): Q.Promise; } + export interface RestMethod { + (callback: RequestCallback): Q.Promise; + (args: any, callback?: RequestCallback): Q.Promise; + } /// Resource stock interfaces export interface BaseMappedResource { @@ -448,7 +448,7 @@ declare namespace twilio { } // For interop with node middleware chains - export interface MiddlewareFunction { (request: Http.ServerRequest, response: Http.ServerResponse, next: Express.NextFunction): void; } + export interface MiddlewareFunction { (request: Http.IncomingMessage, response: Http.ServerResponse, next: Express.NextFunction): void; } export function webhook(authToken: string, options?: WebhookOptions): MiddlewareFunction; export function webhook(options?: WebhookOptions): MiddlewareFunction; @@ -581,7 +581,7 @@ declare namespace twilio { post: RestMethod; create: RestMethod; } - export interface CallResource extends CreatableMappedResource { + export interface CallResource extends CreatableMappedResource, ListableResource { feedbackSummary: CallFeedbackSummaryResource; } diff --git a/twilio/twilio-tests.ts b/twilio/twilio-tests.ts index 54823816eb..44ade2e246 100644 --- a/twilio/twilio-tests.ts +++ b/twilio/twilio-tests.ts @@ -18,11 +18,16 @@ client.calls.get(function(err: any, response: any) { }); }); +// Using the alias described above +client.calls.list(function(err: any, response: any) { + response.calls.forEach(function(call: any) {}); +}); + //Get a list of calls made by this account, from this phone number // GET /2010-04-01/Accounts/ACCOUNT_SID/Calls?From=+16513334455 client.calls.get({ from:'+16513334455' -}, function(err: any, response: any) { +}, function(err, response) { response.calls.forEach(function(call: any) { console.log('Received call from: ' + call.from); console.log('This call\'s unique ID is: ' + call.sid); @@ -31,14 +36,14 @@ client.calls.get({ //Get data for a specific call // GET /2010-04-01/Accounts/ACCOUNT_SID/Calls/abc123... -client.calls('abc123...').get(function(err: any, call: any) { +client.calls('abc123...').get(function(err, call) { console.log('This call\'s unique ID is: ' + call.sid); console.log('This call was created at: ' + call.dateCreated); }); //Get data for a specific call, for a specific account // GET /2010-04-01/Accounts/AC.../Calls/abc123... -client.accounts('AC...').calls('abc123...').get(function(err: any, response: any) { +client.accounts('AC...').calls('abc123...').get(function(err, response) { response.calls.forEach(function(call: any) { console.log('Received call from: ' + call.from); console.log('This call\'s unique ID is: ' + call.sid); @@ -59,7 +64,7 @@ client.sms.messages.post({ // Delete a TwiML application // DELETE /2010-04-01/Accounts/ACCOUNT_SID/Applications/APP... -client.applications('APP...').delete(function(err: any, response: any, nodeResponse: any) { +client.applications('APP...').delete(function(err, response, nodeResponse) { //DELETE requests do not return data - if there was no error, it worked. err ? console.log('There was an error') : console.log('it worked!'); }); From b71a1515002a7e108411702824d9838a0946a252 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Mat=C3=ADas=20Ciruzzi?= Date: Mon, 7 Nov 2016 10:40:04 -0300 Subject: [PATCH 145/246] Improved camo support and updated to v0.12.2 (#12318) * Improved camo support and updated to v0.12.2 * Fixed issue with camo lacking Template Schema --- camo/camo-tests.ts | 3 +- camo/index.d.ts | 439 ++++++++++++++++++++++++++++++++------------- 2 files changed, 313 insertions(+), 129 deletions(-) diff --git a/camo/camo-tests.ts b/camo/camo-tests.ts index 31354dc945..6830133f8f 100644 --- a/camo/camo-tests.ts +++ b/camo/camo-tests.ts @@ -1,4 +1,3 @@ - import { connect, Document as CamoDocument, @@ -16,7 +15,7 @@ connect("mongodb://user:password@localhost:27017/database?authSource=admin").the dateCreated?: Date; } - class User extends CamoDocument { + class User extends CamoDocument { private name: SchemaTypeExtended = String; private password: SchemaTypeExtended = String; private friends: SchemaTypeExtended = [String]; diff --git a/camo/index.d.ts b/camo/index.d.ts index 168765f136..325a1c3b95 100644 --- a/camo/index.d.ts +++ b/camo/index.d.ts @@ -1,137 +1,322 @@ -// Type definitions for camo v0.11.4 +// Type definitions for camo v0.12.2 // Project: https://github.com/scottwrobinson/camo // Definitions by: Lucas Matías Ciruzzi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +declare module "camo" { + /** + * Connect function + * + * @export + * @param {string} uri Connection URI + * @returns {Promise} + */ + export function connect (uri: string): Promise; -type TypeOrArray = Type | Type[]; + type TypeOrArrayOfType = Type | Type[]; -/** - * Supported type constructors for document properties - */ -export type SchemaTypeConstructor = - TypeOrArray | - TypeOrArray | - TypeOrArray | - TypeOrArray | - TypeOrArray | - TypeOrArray; + /** + * Supported type constructors for document properties + */ + export type SchemaTypeConstructor = + TypeOrArrayOfType | + TypeOrArrayOfType | + TypeOrArrayOfType | + TypeOrArrayOfType | + TypeOrArrayOfType | + TypeOrArrayOfType | + TypeOrArrayOfType; -/** - * Supported types for document properties - */ -export type SchemaType = TypeOrArray; + /** + * Supported types for document properties + */ + export type SchemaType = TypeOrArrayOfType; + + /** + * Document property with options + */ + export interface SchemaTypeOptions { + /** + * Type of data + */ + type: SchemaTypeConstructor; + /** + * Default value + */ + default?: Type; + /** + * Min value (only with Number) + */ + min?: number; + /** + * Max value (only with Number) + */ + max?: number; + /** + * Posible options + */ + choices?: Type[]; + /** + * RegEx to match value + */ + match?: RegExp; + /** + * Validation function. + * + * @param {Type} value Value taken. + * @returns {boolean} true (validation ok) or false (validation wrong). + */ + validate?(value: Type): boolean; + /** + * Unique value (like ids) + */ + unique?: boolean; + /** + * Required field + */ + required?: boolean; + } + + /** + * Document property type or options + */ + export type SchemaTypeExtended = SchemaTypeConstructor | SchemaTypeOptions; + + /** + * Schema passed to Document.create() + */ + export interface DocumentSchema { + /** + * Index signature + */ + [property: string]: SchemaType; + /** + * Document id + */ + _id?: string; + } + + /** + * findOneAndUpdate method options. + * + * @interface findOneAndUpdateOptions + */ + export interface FindOneAndUpdateOptions { + /** + * Return a new document if one is not found with the given query. + * + * @type {boolean} + */ + upsert?: boolean; + } + + /** + * findOne method options. + * + * @interface FindOneOptions + */ + export interface FindOneOptions { + /** + * Find all or no references. + * Pass an array of field names to only populate the specified references. + * + * @type {(boolean | string[])} + */ + populate?: boolean | string[]; + } + + /** + * find method options. + * + * @interface FindOptions + */ + export interface FindOptions { + /** + * Find all or no references. + * Pass an array of field names to only populate the specified references. + * + * @type {(boolean | string[])} + */ + populate?: boolean | string[]; + /** + * Sort the documents by the given field(s). + * + * @type {TypeOrArrayOfType} + */ + sort?: TypeOrArrayOfType; + /** + * Limits the number of documents returned. + * + * @type {number} + */ + limit?: number; + /** + * Skips the given number of documents and returns the rest. + * + * @type {number} + */ + skip?: number; + } + + /** + * Camo document + */ + export class Document { + /** + * Index signature + */ + [property: string]: SchemaTypeExtended | string | Document | Function; + /** + * Static method to define the collection name. + * + * @protected + * @static + * @returns {string} The collection name. + */ + protected static collectionName(): string; + /** + * Sets the schema (to be used on the constructor). + * + * @protected + * @template Schema + * @param {Schema} schema + */ + protected schema(schema: Schema): void; + /** + * Creates a camo document instance. + * + * @static + * @template StaticSchema + * @param {StaticSchema} schema Base schema to create a document. + * @returns {DocumentInstance} A camo document instance. + */ + public static create(schema: StaticSchema): Document; + /** + * Saves the document instance to the database. + * + * @returns {Promise} + */ + public save(): Promise; + /** + * Return the first document found, even if multiple documents match the query. + * + * @static + * @template StaticSchema + * @param {*} query Find query. + * @param {FindOneOptions} options findOne method options. + * @returns {Promise} + */ + public static findOne(query: any, options?: FindOneOptions): Promise; + /** + * Return all documents matching the query. + * + * @static + * @template StaticSchema + * @param {*} query Find query. + * @param {FindOptions} options + * @returns {Promise} + */ + public static find(query: any, options?: FindOptions): Promise; + /** + * Find and update (or insert) a document in one atomic operation (atomic for MongoDB only). + * + * @static + * @template StaticSchema + * @param {*} query Find query. + * @param {Schema} values Values to set. + * @param {FindOneAndUpdateOptions} options findOneAndUpdate method options. + * @returns {Promise} + */ + public static findOneAndUpdate(query: any, values: StaticSchema, options?: FindOneAndUpdateOptions): Promise; + /** + * Removes documents from the database. + * Should only be used on an instantiated document with a valid id. + * + * @returns {Promise} Number of deleted documents. + */ + public delete(): Promise; + /** + * Removes the first document found, even if multiple documents match the query. + * + * @static + * @param {*} query Delete query. + * @returns {Promise} Number of deleted documents. + */ + public static deleteOne(query: any): Promise; + /** + * Removes all documents matching the query. + * + * @static + * @param {*} query Delete query. + * @returns {Promise} Number of deleted documents. + */ + public static deleteMany(query: any): Promise; + /** + * Find the first document and delete it. + * + * @static + * @param {*} query Delete query. + * @param {*} options Database Options for findOneAndDelete method. + * @returns {Promise} Number of deleted documents. + */ + public static findOneAndDelete(query: any, options?: any): Promise; + /** + * Number of matching documents without retrieving all the data. + * + * @static + * @param {*} query Count query. + * @returns {Promise} + */ + public static count(query: any): Promise; + /** + * pre-validate hook. + * + * @protected + * @returns {Promise} + */ + protected preValidate(): Promise; + /** + * post-validate hook. + * + * @protected + * @returns {Promise} + */ + protected postValidate(): Promise; + /** + * pre-save hook. + * + * @protected + * @returns {Promise} + */ + protected preSave(): Promise; + /** + * post-save hook. + * + * @protected + * @returns {Promise} + */ + protected postSave(): Promise; + /** + * pre-delete hook. + * + * @protected + * @returns {Promise} + */ + protected preDelete(): Promise; + /** + * post-delete hook. + * + * @protected + * @returns {Promise} + */ + protected postDelete(): Promise; + /** + * Serialized document to just the data, which includes nested and referenced data. + * + * @returns {*} + */ + public toJSON(): any; + } -/** - * Document property with options - */ -export interface SchemaTypeOptions { - /** - * Type of data - */ - type: SchemaTypeConstructor; - /** - * Default value - */ - default?: Type; - /** - * Min value (only with Number) - */ - min?: number; - /** - * Max value (only with Number) - */ - max?: number; - /** - * Posible options - */ - choices?: Type[]; - /** - * RegEx to match value - */ - match?: RegExp; - /** - * Validation function - * - * @param value Value taken - * @returns true (validation ok) or false (validation wrong) - */ - validate?(value: Type): boolean; - /** - * Unique value (like ids) - */ - unique?: boolean; - /** - * Required field - */ - required?: boolean; } - -/** - * Document property type or options - */ -export type SchemaTypeExtended = SchemaTypeConstructor | SchemaTypeOptions; - -/** - * Schema passed to Document.create() - */ -interface DocumentSchema { - /** - * Index signature - */ - [property: string]: SchemaType; - /** - * Document id - */ - _id?: string; -} - -/** - * Camo document instance - */ -declare class DocumentInstance { - public save(): Promise; - public loadOne(): Promise; - public loadMany(): Promise; - public delete(): Promise; - public deleteOne(): Promise; - public deleteMany(): Promise; - public loadOneAndDelete(): Promise; - public count(): Promise; - public preValidate(): Promise; - public postValidate(): Promise; - public preSave(): Promise; - public postSave(): Promise; - public preDelete(): Promise; - public postDelete(): Promise; -} - -/** - * Camo document - */ -export declare class Document { - /** - * Index signature - */ - [property: string]: SchemaTypeExtended | string | DocumentInstance; - /** - * Static method to define the collection name - * - * @returns The collection name - */ - static collectionName(): string; - /** - * Creates a camo document instance - * - * @returns A camo document instance - */ - static create(schema: Schema): DocumentInstance; -} - -/** - * Connect function - * - * @param uri Connection URI - */ -export declare function connect(uri: string): Promise; From 8c4ea150008d3760105155abe67b6cf60583b34d Mon Sep 17 00:00:00 2001 From: Syncfusion-JavaScript Date: Mon, 7 Nov 2016 19:19:35 +0530 Subject: [PATCH 146/246] Syncfusion TypeScript(v13.3.0.52) files committed to Typings 2.0 (#12474) --- ej.web.all/ej.web.all-tests.ts | 407 +- ej.web.all/index.d.ts | 6961 ++++++++++++++++++++++---------- 2 files changed, 4812 insertions(+), 2556 deletions(-) diff --git a/ej.web.all/ej.web.all-tests.ts b/ej.web.all/ej.web.all-tests.ts index 389d152c44..faf5a48e0f 100644 --- a/ej.web.all/ej.web.all-tests.ts +++ b/ej.web.all/ej.web.all-tests.ts @@ -2,7 +2,7 @@ /// - + module AccordionComponent { $(function () { var sample = new ej.Accordion($("#basicAccordion"), { @@ -247,63 +247,6 @@ module ChartComponent { - - -module circulargaugecomponent { - $(function () { - var circularsample = new ej.datavisualization.CircularGauge($("#CircularGauge"), { - enableAnimation: false, - isResponsive: true, - backgroundColor: "transparent", width: 500, - scales: [{ - showRanges: true, - startAngle: 122, sweepAngle: 296, radius: 130, showScaleBar: true, size: 1, maximum: 120, majorIntervalValue: 20, minorIntervalValue: 10, - border: { - width: 0.5, - }, - pointers: [{ - value: 60, - showBackNeedle: true, - backNeedleLength: 20, - length: 95, - width: 7, - pointerCap: { radius: 12 } - }], - ticks: [{ - type: "major", - distanceFromScale: 2, - height: 16, - width: 1, color: "#8c8c8c" - }, { type: "minor", height: 8, width: 1, distanceFromScale: 2, color: "#8c8c8c" }], - labels: [{ - color: "#8c8c8c" - }], - ranges: [{ - distanceFromScale: -30, - startValue: 0, - endValue: 70 - }, { - distanceFromScale: -30, - startValue: 70, - endValue: 110, - backgroundColor: "#fc0606", - border: { color: "#fc0606" } - }, - { - distanceFromScale: -30, - startValue: 110, - endValue: 120, - backgroundColor: "#f5b43f", - border: { color: "#f5b43f" } - }] - }] - }); - }); -} - - - - module ColorPickerComponent { $(function () { var colorSample = new ej.ColorPicker($("#colorpick"), { @@ -1027,357 +970,9 @@ module PDFViewerComponent { -module PivotChartOlap { - $(function () { - var sample = new ej.PivotChart($("#PivotChart"),{ - dataSource: { - data: "http://bi.syncfusion.com/olap/msmdpump.dll", - catalog: "Adventure Works DW 2008 SE", - cube: "Adventure Works", - rows: [ - { - fieldName: "[Date].[Fiscal]" - } - ], - columns: [ - { - fieldName: "[Customer].[Customer Geography]" - } - ], - values: [ - { - measures: [ - { - fieldName: "[Measures].[Internet Sales Amount]" - } - ], - axis: "columns" - } - ], - filters:[] - }, - isResponsive: true, - commonSeriesOptions: { - enableAnimation: true, - type: "column", tooltip: { visible: true } - }, - size: { height: "460px", width: "950px" }, - primaryXAxis: { title: { text: "Date - Fiscal" }, labelRotation: 0 }, - primaryYAxis: { title: { text: "Internet Sales Amount" } }, - legend: { visible: true, rowCount: 2 } - }); - }); -} -var pivot_dataset = [ - { Amount: 100, Country: "Canada", Date: "FY 2005", Product: "Bike", Quantity: 2, State: "Alberta" }, - { Amount: 200, Country: "Canada", Date: "FY 2006", Product: "Van", Quantity: 3, State: "British Columbia" }, - { Amount: 300, Country: "Canada", Date: "FY 2007", Product: "Car", Quantity: 4, State: "Brunswick" }, - { Amount: 150, Country: "Canada", Date: "FY 2008", Product: "Bike", Quantity: 3, State: "Manitoba" }, - { Amount: 200, Country: "Canada", Date: "FY 2006", Product: "Car", Quantity: 4, State: "Ontario" }, - { Amount: 100, Country: "Canada", Date: "FY 2007", Product: "Van", Quantity: 1, State: "Quebec" }, - { Amount: 200, Country: "France", Date: "FY 2005", Product: "Bike", Quantity: 2, State: "Charente-Maritime" }, - { Amount: 250, Country: "France", Date: "FY 2006", Product: "Van", Quantity: 4, State: "Essonne" }, - { Amount: 300, Country: "France", Date: "FY 2007", Product: "Car", Quantity: 3, State: "Garonne (Haute)" }, - { Amount: 150, Country: "France", Date: "FY 2008", Product: "Van", Quantity: 2, State: "Gers" }, - { Amount: 200, Country: "Germany", Date: "FY 2006", Product: "Van", Quantity: 3, State: "Bayern" }, - { Amount: 250, Country: "Germany", Date: "FY 2007", Product: "Car", Quantity: 3, State: "Brandenburg" }, - { Amount: 150, Country: "Germany", Date: "FY 2008", Product: "Car", Quantity: 4, State: "Hamburg" }, - { Amount: 200, Country: "Germany", Date: "FY 2008", Product: "Bike", Quantity: 4, State: "Hessen" }, - { Amount: 150, Country: "Germany", Date: "FY 2007", Product: "Van", Quantity: 3, State: "Nordrhein-Westfalen" }, - { Amount: 100, Country: "Germany", Date: "FY 2005", Product: "Bike", Quantity: 2, State: "Saarland" }, - { Amount: 150, Country: "United Kingdom", Date: "FY 2008", Product: "Bike", Quantity: 5, State: "England" }, - { Amount: 250, Country: "United States", Date: "FY 2007", Product: "Car", Quantity: 4, State: "Alabama" }, - { Amount: 200, Country: "United States", Date: "FY 2005", Product: "Van", Quantity: 4, State: "California" }, - { Amount: 100, Country: "United States", Date: "FY 2006", Product: "Bike", Quantity: 2, State: "Colorado" }, - { Amount: 150, Country: "United States", Date: "FY 2008", Product: "Car", Quantity: 3, State: "New Mexico" }, - { Amount: 200, Country: "United States", Date: "FY 2005", Product: "Bike", Quantity: 4, State: "New York" }, - { Amount: 250, Country: "United States", Date: "FY 2008", Product: "Car", Quantity: 3, State: "North Carolina" }, - { Amount: 300, Country: "United States", Date: "FY 2007", Product: "Van", Quantity: 4, State: "South Carolina" } -] - -module PivotChartRelational { - - $(function () { - var sample = new ej.PivotChart($("#PivotChart"),{ - dataSource: { - data: pivot_dataset, - rows: [ - { - fieldName: "Country", - fieldCaption: "Country" - }, - { - fieldName: "State", - fieldCaption: "State" - }, - { - fieldName: "Date", - fieldCaption: "Date" - } - ], - columns: [ - { - fieldName: "Product", - fieldCaption: "Product" - } - ], - values: [ - { - fieldName: "Amount", - fieldCaption: "Amount" - } - ], - filters:[] - }, - isResponsive: true, - commonSeriesOptions: { - enableAnimation: true, - type: "column", tooltip: { visible: true } - }, - size: { height: "460px", width: "950px" }, - primaryYAxis: { title: { text: "Amount" } }, - legend: { visible: true } - }); - }); -} - - - -module PivotGaugeOlap { - - $(function () { - var sample = new ej.PivotGauge($("#PivotGauge"),{ - dataSource: { - data: "http://bi.syncfusion.com/olap/msmdpump.dll", - catalog: "Adventure Works DW 2008 SE", - cube: "Adventure Works", - rows: [ - { - fieldName: "[Date].[Fiscal]", - filterItems: { filterType: "include", values: ["[Date].[Fiscal].[Fiscal Year].&[2004]"] } - }, - ], - columns: [ - { - fieldName: "[Customer].[Customer Geography]" - } - ], - values: [ - { - measures: [ - { - fieldName: "[Measures].[Internet Sales Amount]" - }, - { - fieldName: "[Measures].[Internet Revenue Status]" - }, - { - fieldName: "[Measures].[Internet Revenue Trend]" - }, - { - fieldName: "[Measures].[Internet Revenue Goal]" - }, - ], - axis: "columns" - } - ], - filters:[] - }, - enableTooltip: true, isResponsive: true, - backgroundColor: "transparent", - labelFormatSettings: { decimalPlaces: 2 }, - scales: [{ - showRanges: true, - radius: 150, showScaleBar: true, size: 1, - border: { - width: 0.5 - }, - showIndicators: true, showLabels: true, - pointers: [{ - showBackNeedle: true, - backNeedleLength: 20, - length: 120, - width: 7 - }, - { - type: "marker", - markerType: "diamond", - distanceFromScale: 5, - placement: "center", - backgroundColor: "#29A4D9", - length: 25, - width: 15 - }], - ticks: [{ - type: "major", - distanceFromScale: 2, - height: 16, - width: 1, color: "#8c8c8c" - }, - { - type: "minor", - height: 6, - width: 1, - distanceFromScale: 2, - color: "#8c8c8c" - }], - labels: [{ - color: "#8c8c8c" - }], - ranges: [{ - distanceFromScale: -5, - backgroundColor: "#fc0606", - border: { color: "#fc0606" } - }, - { - distanceFromScale: -5 - }], - customLabels: [{ - position: { x: 180, y: 290 }, - font: { size: "10px", fontFamily: "Segoe UI", fontStyle: "Normal" }, color: "#666666" - }, - { - position: { x: 180, y: 320 }, - font: { size: "10px", fontFamily: "Segoe UI", fontStyle: "Normal" }, color: "#666666" - }, - { - position: { x: 180, y: 150 }, - font: { size: "12px", fontFamily: "Segoe UI", fontStyle: "Normal" }, color: "#666666" - }] - }] - }); - }); -} - - - -var pivot_dataset = [ - { Amount: 100, Country: "Canada", Date: "FY 2005", Product: "Bike", Quantity: 2, State: "Alberta" }, - { Amount: 200, Country: "Canada", Date: "FY 2006", Product: "Van", Quantity: 3, State: "British Columbia" }, - { Amount: 300, Country: "Canada", Date: "FY 2007", Product: "Car", Quantity: 4, State: "Brunswick" }, - { Amount: 150, Country: "Canada", Date: "FY 2008", Product: "Bike", Quantity: 3, State: "Manitoba" }, - { Amount: 200, Country: "Canada", Date: "FY 2006", Product: "Car", Quantity: 4, State: "Ontario" }, - { Amount: 100, Country: "Canada", Date: "FY 2007", Product: "Van", Quantity: 1, State: "Quebec" }, - { Amount: 200, Country: "France", Date: "FY 2005", Product: "Bike", Quantity: 2, State: "Charente-Maritime" }, - { Amount: 250, Country: "France", Date: "FY 2006", Product: "Van", Quantity: 4, State: "Essonne" }, - { Amount: 300, Country: "France", Date: "FY 2007", Product: "Car", Quantity: 3, State: "Garonne (Haute)" }, - { Amount: 150, Country: "France", Date: "FY 2008", Product: "Van", Quantity: 2, State: "Gers" }, - { Amount: 200, Country: "Germany", Date: "FY 2006", Product: "Van", Quantity: 3, State: "Bayern" }, - { Amount: 250, Country: "Germany", Date: "FY 2007", Product: "Car", Quantity: 3, State: "Brandenburg" }, - { Amount: 150, Country: "Germany", Date: "FY 2008", Product: "Car", Quantity: 4, State: "Hamburg" }, - { Amount: 200, Country: "Germany", Date: "FY 2008", Product: "Bike", Quantity: 4, State: "Hessen" }, - { Amount: 150, Country: "Germany", Date: "FY 2007", Product: "Van", Quantity: 3, State: "Nordrhein-Westfalen" }, - { Amount: 100, Country: "Germany", Date: "FY 2005", Product: "Bike", Quantity: 2, State: "Saarland" }, - { Amount: 150, Country: "United Kingdom", Date: "FY 2008", Product: "Bike", Quantity: 5, State: "England" }, - { Amount: 250, Country: "United States", Date: "FY 2007", Product: "Car", Quantity: 4, State: "Alabama" }, - { Amount: 200, Country: "United States", Date: "FY 2005", Product: "Van", Quantity: 4, State: "California" }, - { Amount: 100, Country: "United States", Date: "FY 2006", Product: "Bike", Quantity: 2, State: "Colorado" }, - { Amount: 150, Country: "United States", Date: "FY 2008", Product: "Car", Quantity: 3, State: "New Mexico" }, - { Amount: 200, Country: "United States", Date: "FY 2005", Product: "Bike", Quantity: 4, State: "New York" }, - { Amount: 250, Country: "United States", Date: "FY 2008", Product: "Car", Quantity: 3, State: "North Carolina" }, - { Amount: 300, Country: "United States", Date: "FY 2007", Product: "Van", Quantity: 4, State: "South Carolina" } -] - -module PivotGaugeRelational { - $(function () { - var sample = new ej.PivotGauge($("#PivotGauge"),{ - dataSource: { - data: pivot_dataset, - rows: [ - { - fieldName: "Country", - fieldCaption: "Country" - }, - { - fieldName: "State", - fieldCaption: "State" - } - ], - columns: [ - { - fieldName: "Product", - fieldCaption: "Product" - } - ], - values: [ - { - fieldName: "Amount", - fieldCaption: "Amount" - }, - { - fieldName: "Quantity", - fieldCaption: "Quantity" - } - ] - }, - enableTooltip: true, isResponsive: true, - backgroundColor: "transparent", - labelFormatSettings: { decimalPlaces: 2 }, - scales: [{ - showRanges: true, - radius: 150, showScaleBar: true, size: 1, - border: { - width: 0.5 - }, - showIndicators: true, showLabels: true, - pointers: [{ - showBackNeedle: true, - backNeedleLength: 20, - length: 120, - width: 7 - }, - { - type: "marker", - markerType: "diamond", - distanceFromScale: 5, - placement: "center", - backgroundColor: "#29A4D9", - length: 25, - width: 15 - }], - ticks: [{ - type: "major", - distanceFromScale: 2, - height: 16, - width: 1, color: "#8c8c8c" - }, - { - type: "minor", - height: 6, - width: 1, - distanceFromScale: 2, - color: "#8c8c8c" - }], - labels: [{ - color: "#8c8c8c" - }], - ranges: [{ - distanceFromScale: -5, - backgroundColor: "#fc0606", - border: { color: "#fc0606" } - }, - { - distanceFromScale: -5 - }], - customLabels: [{ - position: { x: 180, y: 290 }, - font: { size: "10px", fontFamily: "Segoe UI", fontStyle: "Normal" }, color: "#666666" - }, - { - position: { x: 180, y: 320 }, - font: { size: "10px", fontFamily: "Segoe UI", fontStyle: "Normal" }, color: "#666666" - }, - { - position: { x: 180, y: 150 }, - font: { size: "12px", fontFamily: "Segoe UI", fontStyle: "Normal" }, color: "#666666" - }] - }] - }); - }); -} diff --git a/ej.web.all/index.d.ts b/ej.web.all/index.d.ts index 85eb18fe46..71d773d5b7 100644 --- a/ej.web.all/index.d.ts +++ b/ej.web.all/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for ej.web.all v14.3.0.49 +// Type definitions for ej.web.all v14.3.0.52 // Project: http://help.syncfusion.com/js/typescript // Definitions by: Syncfusion // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -7,7 +7,7 @@ /*! * filename: ej.web.all.d.ts -* version : 14.3.0.49 +* version : 14.3.0.52 * Copyright Syncfusion Inc. 2001 - 2016. All rights reserved. * Use of this code is subject to the terms of our license. * A copy of the current license can be obtained at any time by e-mailing @@ -34,7 +34,8 @@ declare module ej { function cancelEvent(): string; function copyObject(): string; function createObject(nameSpace: string, value: Object, initIn: any): JQuery; - function createObject(element : any , eventEmitter :any, model : any): any; + function createObject(element: any, eventEmitter: any, model: any): any; + function setCulture(culture: string): void; function getObject(element :string, model :any ): T; function defineClass(className: string, constructor:any, proto: Object, replace: boolean): Object; function destroyWidgets(element: Object): void; @@ -500,10 +501,15 @@ declare module ej { Overlay, Slide } + enum SortOrder{ + Ascending, + Descending + } class Draggable extends ej.Widget { static fn: Draggable; constructor(element: JQuery, options?: Draggable.Model); constructor(element: Element, options?: Draggable.Model); + static Locale: any; model:Draggable.Model; defaults:Draggable.Model; @@ -662,6 +668,7 @@ class Droppable extends ej.Widget { static fn: Droppable; constructor(element: JQuery, options?: Droppable.Model); constructor(element: Element, options?: Droppable.Model); + static Locale: any; model:Droppable.Model; defaults:Droppable.Model; @@ -756,6 +763,7 @@ class Resizable extends ej.Widget { static fn: Resizable; constructor(element: JQuery, options?: Resizable.Model); constructor(element: Element, options?: Resizable.Model); + static Locale: any; model:Resizable.Model; defaults:Resizable.Model; @@ -930,6 +938,7 @@ class Scroller extends ej.Widget { static fn: Scroller; constructor(element: JQuery, options?: Scroller.Model); constructor(element: Element, options?: Scroller.Model); + static Locale: any; model:Scroller.Model; defaults:Scroller.Model; @@ -963,15 +972,21 @@ class Scroller extends ej.Widget { */ refresh(): void; - /** Scroller moves to given pixel in X (left) position. We can also specify the animation speed,in which the scroller has to move while re-positioning it. + /** Horizontal scroller moves to given pixel from its origin position. We can also specify the animation speed,in which the scroller has to move while re-positioning it. + * @param {number|string} Horizontal scroller moves to the specified pixel. + * @param {boolean} Specifies to enable/disable the animation. + * @param {number} Specifies the animation speed when scrolling, if animation is enabled. * @returns {void} */ - scrollX(): void; + scrollX(pixel: number|string, disableAnimation: boolean, animationSpeed: number): void; - /** Scroller moves to given pixel in Y (top) position. We can also specify the animation speed,in which the scroller has to move while re-positioning it. + /** Vertical scroller moves to given pixel from its origin position. We can also specify the animation speed,in which the scroller has to move while re-positioning it. + * @param {number|string} Vertical scroller moves to the specified pixel. + * @param {boolean} Specifies to enable/disable the animation. + * @param {number} Specifies the animation speed when scrolling, if animation is enabled. * @returns {void} */ - scrollY(): void; + scrollY(pixel: number|string, disableAnimation: boolean, animationSpeed: number): void; } export module Scroller{ @@ -1053,12 +1068,21 @@ export interface Model { /** Fires when Scroller control is destroyed. */ destroy? (e: DestroyEventArgs): void; + /** Fires when a thumb point is moved along the touch surface. */ + thumbMove? (e: ThumbMoveEventArgs): void; + + /** Fires when a thumb point is placed on the touch surface. */ + thumbStart? (e: ThumbStartEventArgs): void; + + /** Fires when a thumb point is removed from the touch surface. */ + thumbEnd? (e: ThumbEndEventArgs): void; + + /** It fires whenever the mouse wheel is rotated either in upwards or downwards. */ + wheelMove? (e: WheelMoveEventArgs): void; + /** It will fire when mouse trackball has been start to wheel. */ wheelStart? (e: WheelStartEventArgs): void; - /** It fires whenever the mouse wheel is rotated either in upwards or downwards */ - wheelMove? (e: WheelMoveEventArgs): void; - /** It will fire when mouse trackball has been stop to wheel. */ wheelStop? (e: WheelStopEventArgs): void; } @@ -1089,7 +1113,53 @@ export interface DestroyEventArgs { type?: string; } -export interface WheelStartEventArgs { +export interface ThumbMoveEventArgs { + + /** if the event should be canceled; otherwise, false. + */ + cancel?: boolean; + + /** returns the scroller model + */ + model?: ej.Scroller.Model; + + /** returns the original event name and its event properties of the current event. + */ + originalEvent?: any; + + /** returns the current data related to the event. + */ + scrollData?: any; + + /** returns the name of the event. + */ + type?: string; +} + +export interface ThumbStartEventArgs { + + /** if the event should be canceled; otherwise, false. + */ + cancel?: boolean; + + /** returns the scroller model + */ + model?: ej.Scroller.Model; + + /** returns the original event name and its event properties of the current event. + */ + originalEvent?: any; + + /** returns the current data related to the event. + */ + scrollData?: any; + + /** returns the name of the event. + */ + type?: string; +} + +export interface ThumbEndEventArgs { /** if the event should be canceled; otherwise, false. */ @@ -1127,6 +1197,29 @@ export interface WheelMoveEventArgs { originalEvent?: any; } +export interface WheelStartEventArgs { + + /** if the event should be canceled; otherwise, false. + */ + cancel?: boolean; + + /** returns the scroller model + */ + model?: ej.Scroller.Model; + + /** returns the original event name and its event properties of the current event. + */ + originalEvent?: any; + + /** returns the current data related to the event. + */ + scrollData?: any; + + /** returns the name of the event. + */ + type?: string; +} + export interface WheelStopEventArgs { /** if the event should be canceled; otherwise, false. @@ -1151,6 +1244,7 @@ class Accordion extends ej.Widget { static fn: Accordion; constructor(element: JQuery, options?: Accordion.Model); constructor(element: Element, options?: Accordion.Model); + static Locale: any; model:Accordion.Model; defaults:Accordion.Model; @@ -1248,7 +1342,7 @@ export interface Model { /** Accordion headers can be expanded and collapsed on keyboard action. * @Default {true} */ - allowKeyboardNavigation?: boolean; + allowKeyboardNavigation?: Boolean; /** To set the Accordion headers Collapse Speed. * @Default {300} @@ -1262,7 +1356,7 @@ export interface Model { /** Sets the root CSS class for Accordion theme, which is used customize. */ - cssClass?: string; + cssClass?: String; /** Allows you to set the custom header Icon. It accepts two key values “header”, ”selectedHeader”. * @Default {{ header: e-collapse, selectedHeader: e-expand }} @@ -1277,12 +1371,12 @@ export interface Model { /** Specifies the animation behavior in accordion. * @Default {true} */ - enableAnimation?: boolean; + enableAnimation?: Boolean; /** With this enabled property, you can enable or disable the Accordion. * @Default {true} */ - enabled?: boolean; + enabled?: Boolean; /** Used to enable the disabled items in accordion. * @Default {[]} @@ -1292,22 +1386,22 @@ export interface Model { /** Multiple content panels to activate at a time. * @Default {false} */ - enableMultipleOpen?: boolean; + enableMultipleOpen?: Boolean; /** Save current model value to browser cookies for maintaining states. When refreshing the accordion control page, the model value is applied from browser cookies or HTML 5local storage. * @Default {false} */ - enablePersistence?: boolean; + enablePersistence?: Boolean; /** Display headers and panel text from right-to-left. * @Default {false} */ - enableRTL?: boolean; + enableRTL?: Boolean; /** The events API binds the action for activating the accordion header. Users can activate the header by using mouse actions such as mouse-over, mouse-up, mouse-down, and soon. * @Default {click} */ - events?: string; + events?: String; /** To set the Accordion headers Expand Speed. * @Default {300} @@ -1346,7 +1440,7 @@ export interface Model { /** Used to determines the close button visibility an each accordion items. This close button helps to remove the accordion item from the control. * @Default {false} */ - showCloseButton?: boolean; + showCloseButton?: Boolean; /** Displays rounded corner borders on the Accordion control's panels and headers. * @Default {false} @@ -1611,15 +1705,15 @@ export interface AjaxSettings { /** It specifies, whether to enable or disable asynchronous request. */ - async?: boolean; + async?: Boolean; /** It specifies the page will be cached in the web browser. */ - cache?: boolean; + cache?: Boolean; /** It specifies the type of data is send in the query string. */ - contentType?: string; + contentType?: String; /** It specifies the data as an object, will be passed in the query string. */ @@ -1627,22 +1721,22 @@ export interface AjaxSettings { /** It specifies the type of data that you're expecting back from the response. */ - dataType?: string; + dataType?: String; /** It specifies the HTTP request type. */ - type?: string; + type?: String; } export interface CustomIcon { /** This class name set to collapsing header. */ - header?: string; + header?: String; /** This class name set to expanded (active) header. */ - selectedHeader?: string; + selectedHeader?: String; } enum HeightAdjustMode{ @@ -1663,6 +1757,7 @@ class Autocomplete extends ej.Widget { static fn: Autocomplete; constructor(element: JQuery, options?: Autocomplete.Model); constructor(element: Element, options?: Autocomplete.Model); + static Locale: any; model:Autocomplete.Model; defaults:Autocomplete.Model; @@ -1730,17 +1825,17 @@ export interface Model { /** Customize "Add New" text (label) to be added in the autocomplete popup list for the entered text when there are no suggestions for it. * @Default {Add New} */ - addNewText?: boolean; + addNewText?: Boolean; /** Allows new values to be added to the autocomplete input other than the values in the suggestion list. Normally, when there are no suggestions it will display “No suggestions” label in the popup. * @Default {false} */ - allowAddNew?: boolean; + allowAddNew?: Boolean; /** Enables or disables the sorting of suggestion list item. The default sort order is ascending order. You customize sort order. * @Default {true} */ - allowSorting?: boolean; + allowSorting?: Boolean; /** Enables or disables selecting the animation style for the popup list. Animation types can be selected through either of the following options, * @Default {slide} @@ -1750,17 +1845,17 @@ export interface Model { /** To focus the items in the suggestion list when the popup is shown. By default first item will be focused. * @Default {false} */ - autoFocus?: boolean; + autoFocus?: Boolean; /** Enables or disables the case sensitive search. * @Default {false} */ - caseSensitiveSearch?: boolean; + caseSensitiveSearch?: Boolean; /** The root class for the Autocomplete textbox widget which helps in customizing its theme. * @Default {””} */ - cssClass?: string; + cssClass?: String; /** The data source contains the list of data for the suggestions list. It can be a string array or JSON array. * @Default {null} @@ -1770,42 +1865,42 @@ export interface Model { /** The time delay (in milliseconds) after which the suggestion popup will be shown. * @Default {200} */ - delaySuggestionTimeout?: number; + delaySuggestionTimeout?: Number; /** The special character which acts as a separator for the given words for multi-mode search i.e. the text after the delimiter are considered as a separate word or query for search operation. * @Default {’,’} */ - delimiterChar?: string; + delimiterChar?: String; /** The text to be displayed in the popup when there are no suggestions available for the entered text. * @Default {“No suggestions”} */ - emptyResultText?: string; + emptyResultText?: String; /** Fills the autocomplete textbox with the first matched item from the suggestion list automatically based on the entered text when enabled. * @Default {false} */ - enableAutoFill?: boolean; + enableAutoFill?: Boolean; /** Enables or disables the Autocomplete textbox widget. * @Default {true} */ - enabled?: boolean; + enabled?: Boolean; /** Enables or disables displaying the duplicate names present in the search result. * @Default {false} */ - enableDistinct?: boolean; + enableDistinct?: Boolean; /** Allows the current model values to be saved in local storage or browser cookies for state maintenance when it is set to true. While refreshing the page, it retains the model value from browser cookies or local storage. * @Default {false} */ - enablePersistence?: boolean; + enablePersistence?: Boolean; /** Displays the Autocomplete widget’s content from right to left when enabled. * @Default {false} */ - enableRTL?: boolean; + enableRTL?: Boolean; /** Mapping fields for the suggestion items of the Autocomplete textbox widget. * @Default {null} @@ -1815,27 +1910,27 @@ export interface Model { /** Specifies the search filter type. There are several types of search filter available such as ‘startswith’, ‘contains’, ‘endswith’, ‘lessthan’, ‘lessthanorequal’, ‘greaterthan’, ‘greaterthanorequal’, ‘equal’, ‘notequal’. * @Default {ej.filterType.StartsWith} */ - filterType?: string; + filterType?: String; /** The height of the Autocomplete textbox. * @Default {null} */ - height?: string; + height?: String; /** The search text can be highlighted in the AutoComplete suggestion list when enabled. * @Default {false} */ - highlightSearch?: boolean; + highlightSearch?: Boolean; /** Number of items to be displayed in the suggestion list. * @Default {0} */ - itemsCount?: number; + itemsCount?: Number; /** Minimum number of character to be entered in the Autocomplete textbox to show the suggestion list. * @Default {1} */ - minCharacter?: number; + minCharacter?: Number; /** An Autocomplete column collection can be defined and customized through the multiColumnSettings property.Column's header, field, and stringFormat can be define via multiColumnSettings properties. */ @@ -1849,12 +1944,12 @@ export interface Model { /** The height of the suggestion list. * @Default {“152px”} */ - popupHeight?: string; + popupHeight?: String; /** The width of the suggestion list. * @Default {“auto”} */ - popupWidth?: string; + popupWidth?: String; /** The query to retrieve the data from the data source. * @Default {null} @@ -1864,36 +1959,36 @@ export interface Model { /** Indicates that the autocomplete textbox values can only be readable. * @Default {false} */ - readOnly?: boolean; + readOnly?: Boolean; /** Sets the value for the Autocomplete textbox based on the given input key value. */ - selectValueByKey?: number; + selectValueByKey?: Number; /** Enables or disables showing the message when there are no suggestions for the entered text. * @Default {true} */ - showEmptyResultText?: boolean; + showEmptyResultText?: Boolean; /** Enables or disables the loading icon to intimate the searching operation. The loading icon is visible when there is a time delay to perform the search. * @Default {true} */ - showLoadingIcon?: boolean; + showLoadingIcon?: Boolean; /** Enables the showPopup button in autocomplete textbox. When the showPopup button is clicked, it displays all the available data from the data source. * @Default {false} */ - showPopupButton?: boolean; + showPopupButton?: Boolean; /** Enables or disables rounded corner. * @Default {false} */ - showRoundedCorner?: boolean; + showRoundedCorner?: Boolean; /** Enables or disables reset icon to clear the textbox values. * @Default {false} */ - showResetIcon?: boolean; + showResetIcon?: Boolean; /** Sort order specifies whether the suggestion list values has to be displayed in ascending or descending order. * @Default {ej.SortOrder.Ascending} @@ -1903,7 +1998,7 @@ export interface Model { /** The template to display the suggestion list items with customized appearance. * @Default {null} */ - template?: string; + template?: String; /** The jQuery validation error message to be displayed on form validation. * @Default {null} @@ -1918,22 +2013,22 @@ export interface Model { /** The value to be displayed in the autocomplete textbox. * @Default {null} */ - value?: string; + value?: String; /** Enables or disables the visibility of the autocomplete textbox. * @Default {true} */ - visible?: boolean; + visible?: Boolean; /** The text to be displayed when the value of the autocomplete textbox is empty. * @Default {null} */ - watermarkText?: string; + watermarkText?: String; /** The width of the Autocomplete textbox. * @Default {null} */ - width?: string; + width?: String; /** Triggers when the AJAX requests Begins. */ actionBegin? (e: ActionBeginEventArgs): void; @@ -1988,7 +2083,7 @@ export interface ChangeEventArgs { /** Set this option to true to cancel the event. */ - cancel?: boolean; + cancel?: Boolean; /** Instance of the autocomplete model object. */ @@ -1996,11 +2091,11 @@ export interface ChangeEventArgs { /** Name of the event. */ - type?: string; + type?: String; /** Value of the autocomplete textbox. */ - value?: string; + value?: String; } export interface CloseEventArgs { @@ -2015,7 +2110,7 @@ export interface CloseEventArgs { /** Name of the event. */ - type?: string; + type?: String; } export interface CreateEventArgs { @@ -2163,7 +2258,7 @@ export interface MultiColumnSettingsColumn { /** Gets or sets a value that indicates to render the multicolumn with custom theme. */ - cssClass?: string; + cssClass?: String; /** Specifies the search data type. There are four types of data types available such as string, ‘number’, ‘boolean’ and ‘date’. * @Default {ej.Type.String} @@ -2245,6 +2340,7 @@ class Button extends ej.Widget { static fn: Button; constructor(element: JQuery, options?: Button.Model); constructor(element: Element, options?: Button.Model); + static Locale: any; model:Button.Model; defaults:Button.Model; @@ -2460,6 +2556,7 @@ class Captcha extends ej.Widget { static fn: Captcha; constructor(element: JQuery, options?: Captcha.Model); constructor(element: Element, options?: Captcha.Model); + static Locale: any; model:Captcha.Model; defaults:Captcha.Model; } @@ -2690,6 +2787,7 @@ class ListBox extends ej.Widget { static fn: ListBox; constructor(element: JQuery, options?: ListBox.Model); constructor(element: Element, options?: ListBox.Model); + static Locale: any; model:ListBox.Model; defaults:ListBox.Model; @@ -2723,10 +2821,10 @@ class ListBox extends ej.Widget { disable(): void; /** Disables a list item by passing the item text as parameter. - * @param {string} Text of the listbox item to be disabled. + * @param {String} Text of the listbox item to be disabled. * @returns {void} */ - disableItem(text: string): void; + disableItem(text: String): void; /** Disables a list Item using its index value. * @param {number} Index of the listbox item to be disabled. @@ -2818,10 +2916,10 @@ class ListBox extends ej.Widget { moveUp(): void; /** Refreshes the ListBox widget. - * @param {boolean} Refreshes both the datasource and the dimensions of the ListBox widget when the parameter is passed as true, otherwise only the ListBox dimensions will be refreshed. + * @param {Boolean} Refreshes both the datasource and the dimensions of the ListBox widget when the parameter is passed as true, otherwise only the ListBox dimensions will be refreshed. * @returns {void} */ - refresh(refreshData: boolean): void; + refresh(refreshData: Boolean): void; /** Removes all the list items from listbox. * @returns {void} @@ -2857,10 +2955,10 @@ class ListBox extends ej.Widget { selectItemByText(text: string): void; /** Selects list item using its value property. - * @param {string} Value of the listbox item to be selected. + * @param {String} Value of the listbox item to be selected. * @returns {void} */ - selectItemByValue(value: string): void; + selectItemByValue(value: String): void; /** Selects list item using its index value. * @param {number} Index of the listbox item to be selected. @@ -2950,16 +3048,16 @@ class ListBox extends ej.Widget { hideItemsByValues(values: Array): void; /** Shows a hidden list item using its value. - * @param {string} Value of the listbox item to be shown. + * @param {String} Value of the listbox item to be shown. * @returns {void} */ - showItemByValue(value: string): void; + showItemByValue(value: String): void; /** Hide a list item using its value. - * @param {string} Value of the listbox item to be hidden. + * @param {String} Value of the listbox item to be hidden. * @returns {void} */ - hideItemByValue(value: string): void; + hideItemByValue(value: String): void; /** Shows a hidden list item using its index value. * @param {number} Index of the listbox item to be shown. @@ -3216,7 +3314,7 @@ export interface ActionBeforeSuccessEventArgs { /** Name of the event. */ - type?: string; + type?: String; /** List of actual object. */ @@ -3228,7 +3326,7 @@ export interface ActionBeforeSuccessEventArgs { /** Set this option to true to cancel the event. */ - cancel?: boolean; + cancel?: Boolean; /** List of array object */ @@ -3247,7 +3345,7 @@ export interface ChangeEventArgs { /** Name of the event. */ - type?: string; + type?: String; /** List item object. */ @@ -3259,31 +3357,31 @@ export interface ChangeEventArgs { /** List item’s index. */ - index?: number; + index?: Number; /** Set this option to true to cancel the event. */ - cancel?: boolean; + cancel?: Boolean; /** Boolean value based on whether the list item is checked or not. */ - isChecked?: boolean; + isChecked?: Boolean; /** Boolean value based on whether the list item is selected or not. */ - isSelected?: boolean; + isSelected?: Boolean; /** Boolean value based on the list item is enabled or not. */ - isEnabled?: boolean; + isEnabled?: Boolean; /** List item’s text (label). */ - text?: string; + text?: String; /** List item’s value. */ - value?: string; + value?: String; } export interface CheckChangeEventArgs { @@ -3294,7 +3392,7 @@ export interface CheckChangeEventArgs { /** Name of the event. */ - type?: string; + type?: String; /** List item object. */ @@ -3306,31 +3404,31 @@ export interface CheckChangeEventArgs { /** List item’s index. */ - index?: number; + index?: Number; /** Set this option to true to cancel the event. */ - cancel?: boolean; + cancel?: Boolean; /** Boolean value based on whether the list item is checked or not. */ - isChecked?: boolean; + isChecked?: Boolean; /** Boolean value based on whether the list item is selected or not. */ - isSelected?: boolean; + isSelected?: Boolean; /** Boolean value based on the list item is enabled or not. */ - isEnabled?: boolean; + isEnabled?: Boolean; /** List item’s text (label). */ - text?: string; + text?: String; /** List item’s value. */ - value?: string; + value?: String; } export interface CreateEventArgs { @@ -3345,7 +3443,7 @@ export interface CreateEventArgs { /** Set this option to true to cancel the event. */ - cancel?: boolean; + cancel?: Boolean; } export interface DestroyEventArgs { @@ -3356,11 +3454,11 @@ export interface DestroyEventArgs { /** Name of the event. */ - type?: string; + type?: String; /** Set this option to true to cancel the event. */ - cancel?: boolean; + cancel?: Boolean; } export interface FocusInEventArgs { @@ -3371,11 +3469,11 @@ export interface FocusInEventArgs { /** Name of the event. */ - type?: string; + type?: String; /** Set this option to true to cancel the event. */ - cancel?: boolean; + cancel?: Boolean; } export interface FocusOutEventArgs { @@ -3386,11 +3484,11 @@ export interface FocusOutEventArgs { /** Name of the event. */ - type?: string; + type?: String; /** Set this option to true to cancel the event. */ - cancel?: boolean; + cancel?: Boolean; } export interface ItemDragEventArgs { @@ -3401,11 +3499,11 @@ export interface ItemDragEventArgs { /** Name of the event. */ - type?: string; + type?: String; /** Set this option to true to cancel the event. */ - cancel?: boolean; + cancel?: Boolean; /** The Datasource of the listbox. */ @@ -3413,27 +3511,27 @@ export interface ItemDragEventArgs { /** List item’s index. */ - index?: number; + index?: Number; /** Boolean value based on whether the list item is checked or not. */ - isChecked?: boolean; + isChecked?: Boolean; /** Boolean value based on whether the list item is selected or not. */ - isSelected?: boolean; + isSelected?: Boolean; /** Boolean value based on whether the list item is enabled or not. */ - isEnabled?: boolean; + isEnabled?: Boolean; /** List item’s text (label). */ - text?: string; + text?: String; /** List item’s value. */ - value?: string; + value?: String; } export interface ItemDragStartEventArgs { @@ -3444,11 +3542,11 @@ export interface ItemDragStartEventArgs { /** Name of the event. */ - type?: string; + type?: String; /** Set this option to true to cancel the event. */ - cancel?: boolean; + cancel?: Boolean; /** The Datasource of the listbox. */ @@ -3456,27 +3554,27 @@ export interface ItemDragStartEventArgs { /** List item’s index. */ - index?: number; + index?: Number; /** Boolean value based on whether the list item is checked or not. */ - isChecked?: boolean; + isChecked?: Boolean; /** Boolean value based on whether the list item is selected or not. */ - isSelected?: boolean; + isSelected?: Boolean; /** Boolean value based on whether the list item is enabled or not. */ - isEnabled?: boolean; + isEnabled?: Boolean; /** List item’s text (label). */ - text?: string; + text?: String; /** List item’s value. */ - value?: string; + value?: String; } export interface ItemDragStopEventArgs { @@ -3487,11 +3585,11 @@ export interface ItemDragStopEventArgs { /** Name of the event. */ - type?: string; + type?: String; /** Set this option to true to cancel the event. */ - cancel?: boolean; + cancel?: Boolean; /** The Datasource of the listbox. */ @@ -3499,27 +3597,27 @@ export interface ItemDragStopEventArgs { /** List item’s index. */ - index?: number; + index?: Number; /** Boolean value based on whether the list item is checked or not. */ - isChecked?: boolean; + isChecked?: Boolean; /** Boolean value based on whether the list item is selected or not. */ - isSelected?: boolean; + isSelected?: Boolean; /** Boolean value based on whether the list item is enabled or not. */ - isEnabled?: boolean; + isEnabled?: Boolean; /** List item’s text (label). */ - text?: string; + text?: String; /** List item’s value. */ - value?: string; + value?: String; } export interface ItemDropEventArgs { @@ -3530,11 +3628,11 @@ export interface ItemDropEventArgs { /** Name of the event. */ - type?: string; + type?: String; /** Set this option to true to cancel the event. */ - cancel?: boolean; + cancel?: Boolean; /** The Datasource of the listbox. */ @@ -3542,27 +3640,27 @@ export interface ItemDropEventArgs { /** List item’s index. */ - index?: number; + index?: Number; /** Boolean value based on whether the list item is checked or not. */ - isChecked?: boolean; + isChecked?: Boolean; /** Boolean value based on whether the list item is selected or not. */ - isSelected?: boolean; + isSelected?: Boolean; /** Boolean value based on whether the list item is enabled or not. */ - isEnabled?: boolean; + isEnabled?: Boolean; /** List item’s text (label). */ - text?: string; + text?: String; /** List item’s value. */ - value?: string; + value?: String; } export interface SelectEventArgs { @@ -3573,7 +3671,7 @@ export interface SelectEventArgs { /** Name of the event. */ - type?: string; + type?: String; /** List item object. */ @@ -3585,31 +3683,31 @@ export interface SelectEventArgs { /** List item’s index. */ - index?: number; + index?: Number; /** Set this option to true to cancel the event. */ - cancel?: boolean; + cancel?: Boolean; /** Boolean value based on whether the list item is checked or not. */ - isChecked?: boolean; + isChecked?: Boolean; /** Boolean value based on whether the list item is selected or not. */ - isSelected?: boolean; + isSelected?: Boolean; /** Boolean value based on the list item is enabled or not. */ - isEnabled?: boolean; + isEnabled?: Boolean; /** List item’s text (label). */ - text?: string; + text?: String; /** List item’s value. */ - value?: string; + value?: String; } export interface UnselectEventArgs { @@ -3620,7 +3718,7 @@ export interface UnselectEventArgs { /** Name of the event. */ - type?: string; + type?: String; /** List item object. */ @@ -3632,31 +3730,31 @@ export interface UnselectEventArgs { /** List item’s index. */ - index?: number; + index?: Number; /** Set this option to true to cancel the event. */ - cancel?: boolean; + cancel?: Boolean; /** Boolean value based on whether the list item is checked or not. */ - isChecked?: boolean; + isChecked?: Boolean; /** Boolean value based on whether the list item is selected or not. */ - isSelected?: boolean; + isSelected?: Boolean; /** Boolean value based on the list item is enabled or not. */ - isEnabled?: boolean; + isEnabled?: Boolean; /** List item’s text (label). */ - text?: string; + text?: String; /** List item’s value. */ - value?: string; + value?: String; } export interface Fields { @@ -3711,6 +3809,7 @@ class Calculate { static fn: Calculate; constructor(element: JQuery, options?: Calculate.Model); constructor(element: Element, options?: Calculate.Model); + static Locale: any; model:Calculate.Model; defaults:Calculate.Model; @@ -3773,6 +3872,7 @@ class CheckBox extends ej.Widget { static fn: CheckBox; constructor(element: JQuery, options?: CheckBox.Model); constructor(element: Element, options?: CheckBox.Model); + static Locale: any; model:CheckBox.Model; defaults:CheckBox.Model; @@ -3997,6 +4097,7 @@ class ColorPicker extends ej.Widget { static fn: ColorPicker; constructor(element: JQuery, options?: ColorPicker.Model); constructor(element: Element, options?: ColorPicker.Model); + static Locale: any; model:ColorPicker.Model; defaults:ColorPicker.Model; @@ -4431,6 +4532,7 @@ class FileExplorer extends ej.Widget { static fn: FileExplorer; constructor(element: JQuery, options?: FileExplorer.Model); constructor(element: Element, options?: FileExplorer.Model); + static Locale: any; model:FileExplorer.Model; defaults:FileExplorer.Model; @@ -4497,6 +4599,11 @@ export interface Model { */ allowDragAndDrop?: boolean; + /** Gets or sets a value that indicates whether to enable keyboard support for FileExplorer actions. + * @Default {true} + */ + allowKeyboardNavigation?: boolean; + /** The FileExplorer allows to select multiple files by enabling the allowMultiSelection property. You can perform multi selection by pressing the Ctrl key or Shift key. * @Default {true} */ @@ -4626,12 +4733,12 @@ export interface Model { showNavigationPane?: boolean; /** The tools property is used to configure and group required toolbar items in FileExplorer control. - * @Default {{ creation: [NewFolder], navigation: [Back, Forward, Upward], addressBar: [Addressbar], editing: [Refresh, Upload, Delete, Rename, Download], copyPaste: [Cut, Copy, Paste], getProperties: [Details], searchBar: [Searchbar], layout: [Layout]}} + * @Default {{ creation: [NewFolder], navigation: [Back, Forward, Upward], addressBar: [Addressbar], editing: [Refresh, Upload, Delete, Rename, Download], copyPaste: [Cut, Copy, Paste], getProperties: [Details], searchBar: [Searchbar], layout: [Layout], sortBy: [SortBy]}} */ tools?: any; /** The toolsList property is used to arrange the toolbar items in the FileExplorer control. - * @Default {[layout, creation, navigation, addressBar, editing, copyPaste, getProperties, searchBar]} + * @Default {[layout, creation, navigation, addressBar, editing, copyPaste, sortBy, getProperties, searchBar]} */ toolsList?: Array; @@ -4689,6 +4796,9 @@ export interface Model { /** Fires after loading the requested image from server. Using this event, you can get the details of loaded image. */ getImage? (e: GetImageEventArgs): void; + /** Fires when keydown in FileExplorer control. */ + keydown? (e: KeydownEventArgs): void; + /** Fires when the file view type is changed. */ layoutChange? (e: LayoutChangeEventArgs): void; } @@ -5078,6 +5188,41 @@ export interface GetImageEventArgs { type?: string; } +export interface KeydownEventArgs { + + /** Set to true when the event has to be canceled, else false. + */ + cancel?: boolean; + + /** returns the downed key keyCode value + */ + keyCode?: number; + + /** returns altKey value. + */ + altKey?: boolean; + + /** returns shiftKey value. + */ + shiftKey?: boolean; + + /** returns ctrlKey value. + */ + ctrlKey?: boolean; + + /** returns the event object. + */ + originalArgs?: any; + + /** returns the FileExplorer model. + */ + model?: ej.FileExplorer.Model; + + /** returns the name of the event. + */ + type?: string; +} + export interface LayoutChangeEventArgs { /** Set to true when the event has to be canceled, else false. @@ -5100,7 +5245,7 @@ export interface LayoutChangeEventArgs { export interface ContextMenuSettings { /** The items property is used to configure and group the required ContextMenu items in FileExplorer control. - * @Default {{% highlight javascript %}{navbar: [NewFolder, Upload, |, Delete, Rename, |, Cut, Copy, Paste, |, Getinfo],cwd: [Refresh, Paste,|, Sortby, |, NewFolder, Upload, |, Getinfo],files: [Open, Download, |, Upload, |, Delete, Rename, |, Cut, Copy, Paste, |, OpenFolderLocation, Getinfo]}{% endhighlight %}} + * @Default {{% highlight javascript %}{navbar: [NewFolder, Upload, |, Delete, Rename, |, Cut, Copy, Paste, |, Getinfo],cwd: [Refresh, Paste,|, SortBy, |, NewFolder, Upload, |, Getinfo],files: [Open, Download, |, Upload, |, Delete, Rename, |, Cut, Copy, Paste, |, OpenFolderLocation, Getinfo]}{% endhighlight %}} */ items?: any; @@ -5182,6 +5327,7 @@ class DatePicker extends ej.Widget { static fn: DatePicker; constructor(element: JQuery, options?: DatePicker.Model); constructor(element: Element, options?: DatePicker.Model); + static Locale: any; model:DatePicker.Model; defaults:DatePicker.Model; @@ -5796,6 +5942,7 @@ class DateTimePicker extends ej.Widget { static fn: DateTimePicker; constructor(element: JQuery, options?: DateTimePicker.Model); constructor(element: Element, options?: DateTimePicker.Model); + static Locale: any; model:DateTimePicker.Model; defaults:DateTimePicker.Model; @@ -6264,6 +6411,7 @@ class Dialog extends ej.Widget { static fn: Dialog; constructor(element: JQuery, options?: Dialog.Model); constructor(element: Element, options?: Dialog.Model); + static Locale: any; model:Dialog.Model; defaults:Dialog.Model; @@ -6345,15 +6493,15 @@ export interface Model { /** Adds action buttons like close, minimize, pin, maximize in the dialog header. */ - actionButtons?: string[]; + actionButtons?: String[]; /** Enables or disables draggable. */ - allowDraggable?: boolean; + allowDraggable?: Boolean; /** Enables or disables keyboard interaction. */ - allowKeyboardNavigation?: boolean; + allowKeyboardNavigation?: Boolean; /** Customizes the Dialog widget animations. The Dialog widget can be animated while opening and closing the dialog. In order to customize animation effects, you need to set “enableAnimation” as true. It contains the following sub properties. */ @@ -6361,79 +6509,79 @@ export interface Model { /** Closes the dialog widget on pressing the ESC key when it is set to true. */ - closeOnEscape?: boolean; + closeOnEscape?: Boolean; /** The selector for the container element. If the property is set, then dialog will append to the selected element and it is restricted to move only within the specified container element. */ - containment?: string; + containment?: String; /** The content type to load the dialog content at run time. The possible values are null, AJAX, iframe and image. When it is null (default value), the content inside dialog element will be displayed as content and when it is not null, the content will be loaded from the URL specified in the contentUrl property. */ - contentType?: string; + contentType?: String; /** The URL to load the dialog content (such as AJAX, image, and iframe). In order to load content from URL, you need to set contentType as ‘ajax’ or ‘iframe’ or ‘image’. */ - contentUrl?: string; + contentUrl?: String; /** The root class for the Dialog widget to customize the existing theme. */ - cssClass?: string; + cssClass?: String; /** Enable or disables animation when the dialog is opened or closed. */ - enableAnimation?: boolean; + enableAnimation?: Boolean; /** Enables or disables the Dialog widget. */ - enabled?: boolean; + enabled?: Boolean; /** Enable or disables modal dialog. The modal dialog acts like a child window that is displayed on top of the main window/screen and disables the main window interaction until it is closed. */ - enableModal?: boolean; + enableModal?: Boolean; /** Allows the current model values to be saved in local storage or browser cookies for state maintenance when it is set to true. */ - enablePersistence?: boolean; + enablePersistence?: Boolean; /** Allows the dialog to be resized. The dialog cannot be resized less than the minimum height, width values and greater than the maximum height and width. */ - enableResize?: boolean; + enableResize?: Boolean; /** Displays dialog content from right to left when set to true. */ - enableRTL?: boolean; + enableRTL?: Boolean; /** The CSS class name to display the favicon in the dialog header. In order to display favicon, you need to set showHeader as true since the favicon will be displayed in the dialog header. */ - faviconCSS?: string; + faviconCSS?: String; /** Sets the height for the dialog widget. It accepts both string and integer values. For example, it can accepts values like “auto”, “100%”, “100px” as string type and “100”, “500” as integer type. */ - height?: string|number; + height?: String|Number; /** Enable or disables responsive behavior. */ - isResponsive?: boolean; + isResponsive?: Boolean; /** Set the localization culture for Dialog Widget. */ - locale?: number; + locale?: Number; /** Sets the maximum height for the dialog widget. */ - maxHeight?: number; + maxHeight?: Number; /** Sets the maximum width for the dialog widget. */ - maxWidth?: number; + maxWidth?: Number; /** Sets the minimum height for the dialog widget. */ - minHeight?: number; + minHeight?: Number; /** Sets the minimum width for the dialog widget. */ - minWidth?: number; + minWidth?: Number; /** Displays the Dialog widget at the given X and Y position. */ @@ -6441,23 +6589,23 @@ export interface Model { /** Shows or hides the dialog header. */ - showHeader?: boolean; + showHeader?: Boolean; /** The Dialog widget can be opened by default i.e. on initialization, when it is set to true. */ - showOnInit?: boolean; + showOnInit?: Boolean; /** Enables or disables the rounder corner. */ - showRoundedCorner?: boolean; + showRoundedCorner?: Boolean; /** The selector for the container element. If this property is set, the dialog will be displayed (positioned) based on its container. */ - target?: string; + target?: String; /** The title text to be displayed in the dialog header. In order to set title, you need to set showHeader as true since the title will be displayed in the dialog header. */ - title?: string; + title?: String; /** Add or configure the tooltip text for actionButtons in the dialog header. */ @@ -6465,19 +6613,19 @@ export interface Model { /** Sets the height for the dialog widget. It accepts both string and integer values. For example, it can accepts values like “auto”, “100%”, “100px” as string type and “100”, “500” as integer type. */ - width?: string|number; + width?: String|Number; /** Sets the z-index value for the Dialog widget. */ - zIndex?: number; + zIndex?: Number; /** Sets the Footer for the Dialog widget. */ - showFooter?: boolean; + showFooter?: Boolean; /** Sets the FooterTemplate for the Dialog widget. */ - footerTemplateId?: string; + footerTemplateId?: String; /** This event is triggered before the dialog widgets gets open. */ beforeOpen? (e: BeforeOpenEventArgs): void; @@ -6546,7 +6694,7 @@ export interface BeforeOpenEventArgs { /** Name of the event */ - type?: string; + type?: String; } export interface AjaxErrorEventArgs { @@ -6638,7 +6786,7 @@ export interface CloseEventArgs { /** Name of the event */ - type?: string; + type?: String; } export interface ContentLoadEventArgs { @@ -6653,11 +6801,11 @@ export interface ContentLoadEventArgs { /** Name of the event. */ - type?: string; + type?: String; /** URL of the content. */ - URL?: string; + URL?: String; /** Content type */ @@ -6808,7 +6956,7 @@ export interface ResizeStopEventArgs { /** Set this option to true to cancel the event. */ - cancel?: boolean; + cancel?: Boolean; /** Instance of the dialog model object. */ @@ -6816,7 +6964,7 @@ export interface ResizeStopEventArgs { /** Name of the event */ - type?: string; + type?: String; /** Current event object. */ @@ -6877,10 +7025,149 @@ export interface ActionButtonClickEventArgs { } } +class DocumentEditor extends ej.Widget { + static fn: DocumentEditor; + constructor(element: JQuery, options?: DocumentEditor.Model); + constructor(element: Element, options?: DocumentEditor.Model); + static Locale: any; + model:DocumentEditor.Model; + defaults:DocumentEditor.Model; + + /** Loads the document from specified path using web API provided by importUrl. + * @param {String} Specifies the file path. + * @returns {void} + */ + load(Path: String): void; + + /** Gets the page number of current selection in the document. + * @returns {void} + */ + getCurrentPageNumber(): void; + + /** Gets the total number of pages in the document. + * @returns {void} + */ + getPageCount(): void; + + /** Gets the current zoom factor value of the document container. + * @returns {void} + */ + getZoomFactor(): void; + + /** Scales the document container with the specified zoom factor. The range of zoom factor should be 0.10 to 5.00. + * @returns {void} + */ + setZoomFactor(): void; + + /** Prints the document content as page by page. + * @returns {void} + */ + print(): void; + + /** Finds the first occurrence of specified text from current selection and highlights the result. If the document end is reached, find operation will occur from the document start position. + * @param {String} Specifies the text to search in a document. + * @returns {void} + */ + find(Text: String): void; +} +export module DocumentEditor{ + +export interface Model { + + /** Gets or sets an object that indicates initialization of importing and exporting documents in document editor. + */ + importExportSettings?: ImportExportSettings; + + /** Triggers when the document changes. */ + onDocumentChange? (e: OnDocumentChangeEventArgs): void; + + /** Triggers when the selection changes. */ + onSelectionChange? (e: OnSelectionChangeEventArgs): void; + + /** Triggers when the zoom factor changes. */ + onZoomFactorChange? (e: OnZoomFactorChangeEventArgs): void; + + /** Triggers when the hyperlink is clicked. */ + onRequestNavigate? (e: OnRequestNavigateEventArgs): void; +} + +export interface OnDocumentChangeEventArgs { + + /** True, if the event should be canceled; otherwise, false. + */ + cancel?: boolean; + + /** Returns the document editor model. + */ + model?: any; + + /** Returns the name of the event. + */ + type?: string; +} + +export interface OnSelectionChangeEventArgs { + + /** True, if the event should be canceled; otherwise, false. + */ + cancel?: boolean; + + /** Returns the document editor model. + */ + model?: any; + + /** Returns the name of the event. + */ + type?: string; +} + +export interface OnZoomFactorChangeEventArgs { + + /** True, if the event should be canceled; otherwise, false. + */ + cancel?: boolean; + + /** Returns the document editor model. + */ + model?: any; + + /** Returns the name of the event. + */ + type?: string; +} + +export interface OnRequestNavigateEventArgs { + + /** true, if the event should be canceled; otherwise, false. + */ + cancel?: boolean; + + /** Returns the document editor model. + */ + model?: any; + + /** Returns the link type and navigation link. + */ + hyperlink?: any; + + /** Returns the name of the event. + */ + type?: string; +} + +export interface ImportExportSettings { + + /** Gets or sets URL of Web API that should be used to parse the document while loading. + */ + importUrl?: string; +} +} + class DropDownList extends ej.Widget { static fn: DropDownList; constructor(element: JQuery, options?: DropDownList.Model); constructor(element: Element, options?: DropDownList.Model); + static Locale: any; model:DropDownList.Model; defaults:DropDownList.Model; @@ -7178,7 +7465,7 @@ export interface Model { showRoundedCorner?: boolean; /** When the enableSorting property value is set to true, this property helps to sort the items either in ascending or descending order - * @Default {ej.sortOrder.Ascending} + * @Default {ej.SortOrder.Ascending} */ sortOrder?: ej.SortOrder|string; @@ -7845,13 +8132,6 @@ Delimiter, // can select multiple items and it's show's like visual box in textbox VisualMode, } -enum SortOrder -{ -// Sort the data in ascending order -Ascending, -//Sort the data in descending order -Descending, -} enum VirtualScrollMode { // The data is loaded only to the corresponding page (display items). When scrolling some other position, it enables the load on demand with the DropDownList. @@ -7864,6 +8144,7 @@ class Tooltip extends ej.Widget { static fn: Tooltip; constructor(element: JQuery, options?: Tooltip.Model); constructor(element: Element, options?: Tooltip.Model); + static Locale: any; model:Tooltip.Model; defaults:Tooltip.Model; @@ -8319,6 +8600,7 @@ class Editor extends ej.Widget { static fn: Editor; constructor(element: JQuery, options?: Editor.Model); constructor(element: Element, options?: Editor.Model); + static Locale: any; model:Editor.Model; defaults:Editor.Model; @@ -8390,14 +8672,14 @@ export interface Model { groupSize?: string; /** It provides the options to get the customized character to separate the digits. If not set, the separator defined by the current culture. - * @Default {null} + * @Default {Based on the culture} */ groupSeparator?: string; /** Specifies the height of the editor. * @Default {30} */ - height?: number|string; + height?: string; /** It allows to define the characteristics of the Editors control. It will helps to extend the capability of an HTML element. * @Default {{}} @@ -8475,13 +8757,14 @@ export interface Model { value?: number|string; /** Specifies the watermark text to editor. + * @Default {Based on the culture.} */ watermarkText?: string; /** Specifies the width of the editor. * @Default {143} */ - width?: number|string; + width?: string; /** Fires after Editor control value is changed. */ change? (e: ChangeEventArgs): void; @@ -8595,6 +8878,7 @@ class ListView extends ej.Widget { static fn: ListView; constructor(element: JQuery, options?: ListView.Model); constructor(element: Element, options?: ListView.Model); + static Locale: any; model:ListView.Model; defaults:ListView.Model; @@ -8805,7 +9089,7 @@ export interface Model { /** Specifies the height. * @Default {null} */ - height?: string|number; + height?: String|Number; /** Specifies whether to retain the selection of the item. * @Default {false} @@ -8845,7 +9129,7 @@ export interface Model { /** Specifies the width. * @Default {null} */ - width?: string|number; + width?: String|Number; /** Event triggers before the AJAX request happens. */ ajaxBeforeLoad? (e: AjaxBeforeLoadEventArgs): void; @@ -8869,7 +9153,7 @@ export interface Model { mouseDown? (e: MouseDownEventArgs): void; /** Event triggers when mouse up happens on the item. */ - mouseUP? (e: MouseUPEventArgs): void; + mouseUp? (e: MouseUpEventArgs): void; } export interface AjaxBeforeLoadEventArgs { @@ -9049,7 +9333,7 @@ export interface MouseDownEventArgs { checkedItemsText?: string; } -export interface MouseUPEventArgs { +export interface MouseUpEventArgs { /** returns true if the event should be canceled; otherwise, false. */ @@ -9097,6 +9381,7 @@ class MaskEdit extends ej.Widget { static fn: MaskEdit; constructor(element: JQuery, options?: MaskEdit.Model); constructor(element: Element, options?: MaskEdit.Model); + static Locale: any; model:MaskEdit.Model; defaults:MaskEdit.Model; @@ -9496,6 +9781,7 @@ class Menu extends ej.Widget { static fn: Menu; constructor(element: JQuery, options?: Menu.Model); constructor(element: Element, options?: Menu.Model); + static Locale: any; model:Menu.Model; defaults:Menu.Model; @@ -9970,6 +10256,7 @@ class Pager extends ej.Widget { static fn: Pager; constructor(element: JQuery, options?: Pager.Model); constructor(element: Element, options?: Pager.Model); + static Locale: any; model:Pager.Model; defaults:Pager.Model; @@ -9990,61 +10277,61 @@ export interface Model { /** Gets or sets a value that indicates whether to display the custom text message in Pager. */ - customText?: string; + customText?: String; /** Gets or sets a value that indicates whether to define which page to display currently in pager. * @Default {1} */ - currentPage?: number; + currentPage?: Number; /** Gets or sets a value that indicates whether to display the external Message in Pager. * @Default {false} */ - enableExternalMessage?: boolean; + enableExternalMessage?: Boolean; /** Gets or sets a value that indicates whether to pass the current page information as a query string along with the URL while navigating to other page. * @Default {false} */ - enableQueryString?: boolean; + enableQueryString?: Boolean; /** Align content in the pager control from right to left by setting the property as true. * @Default {false} */ - enableRTL?: boolean; + enableRTL?: Boolean; /** Gets or sets a value that indicates whether to display the external Message in Pager. */ - externalMessage?: string; + externalMessage?: String; /** Gets or sets a value that indicates whether to customizing the user interface (UI) as locale-specific in order to display regional data i.e. in a language and culture specific to a particular country or region. * @Default {en-US} */ - locale?: string; + locale?: String; /** Gets or sets a value that indicates whether to define the number of pages displayed in the pager for navigation. * @Default {10} */ - pageCount?: number; + pageCount?: Number; /** Gets or sets a value that indicates whether to define the number of records displayed per page. * @Default {12} */ - pageSize?: number; + pageSize?: Number; /** Get or sets a value of total number of pages in the pager. The totalPages value is calculated based on page size and total records. * @Default {null} */ - totalPages?: number; + totalPages?: Number; /** Get the value of total number of records which is bound to a data item. * @Default {null} */ - totalRecordsCount?: number; + totalRecordsCount?: Number; /** Shows or hides the current page information in pager footer. * @Default {true} */ - showPageInfo?: boolean; + showPageInfo?: Boolean; /** Triggered when pager numeric item is clicked in pager control. */ click? (e: ClickEventArgs): void; @@ -10078,6 +10365,7 @@ class ProgressBar extends ej.Widget { static fn: ProgressBar; constructor(element: JQuery, options?: ProgressBar.Model); constructor(element: Element, options?: ProgressBar.Model); + static Locale: any; model:ProgressBar.Model; defaults:ProgressBar.Model; @@ -10295,6 +10583,7 @@ class RadioButton extends ej.Widget { static fn: RadioButton; constructor(element: JQuery, options?: RadioButton.Model); constructor(element: Element, options?: RadioButton.Model); + static Locale: any; model:RadioButton.Model; defaults:RadioButton.Model; @@ -10481,6 +10770,7 @@ class Rating extends ej.Widget { static fn: Rating; constructor(element: JQuery, options?: Rating.Model); constructor(element: Element, options?: Rating.Model); + static Locale: any; model:Rating.Model; defaults:Rating.Model; @@ -10771,6 +11061,7 @@ class Ribbon extends ej.Widget { static fn: Ribbon; constructor(element: JQuery, options?: Ribbon.Model); constructor(element: Element, options?: Ribbon.Model); + static Locale: any; model:Ribbon.Model; defaults:Ribbon.Model; @@ -10836,9 +11127,9 @@ class Ribbon extends ej.Widget { /** Gets text of the given index tab in the ribbon control. * @param {number} index of the tab item. - * @returns {string} + * @returns {String} */ - getTabText(index: number): string; + getTabText(index: number): String; /** Hides the given text tab in the ribbon control. * @param {string} text of the tab item. @@ -10848,15 +11139,15 @@ class Ribbon extends ej.Widget { /** Checks whether the given text tab in the ribbon control is enabled or not. * @param {string} text of the tab item. - * @returns {boolean} + * @returns {Boolean} */ - isEnable(text: string): boolean; + isEnable(text: string): Boolean; /** Checks whether the given text tab in the ribbon control is visible or not. * @param {string} text of the tab item. - * @returns {boolean} + * @returns {Boolean} */ - isVisible(text: string): boolean; + isVisible(text: string): Boolean; /** Removes the given index tab item from the ribbon control. * @param {number} index of tab item. @@ -11889,6 +12180,7 @@ class Kanban extends ej.Widget { static fn: Kanban; constructor(element: JQuery, options?: Kanban.Model); constructor(element: Element, options?: Kanban.Model); + static Locale: any; model:Kanban.Model; defaults:Kanban.Model; @@ -11935,14 +12227,14 @@ class Kanban extends ej.Widget { /** Get the column details based on the given header text in Kanban. * @param {string} Pass the header text of the column to get the corresponding column object - * @returns {string} + * @returns {String} */ - getColumnByHeaderText(headerText: string): string; + getColumnByHeaderText(headerText: string): String; /** Get the table details based on the given header table in Kanban. - * @returns {string} + * @returns {String} */ - getHeaderTable(): string; + getHeaderTable(): String; /** Hide columns from the Kanban based on the header text * @param {Array|string} you can pass either array of header text of various columns or a header text of a column to hide @@ -12168,7 +12460,7 @@ export interface Model { /** To perform kanban functionalities with touch interaction. * @Default {true} */ - enableTouch?: boolean; + enableTouch?: Boolean; /** Align content in the Kanban control align from right to left by setting the property as true. * @Default {false} @@ -12252,7 +12544,7 @@ export interface Model { /** Gets or sets a value that indicates whether to customizing the user interface (UI) as locale-specific in order to display regional data i.e. in a language and culture specific to a particular country or region. * @Default {en-US} */ - locale?: string; + locale?: String; /** Triggered for every Kanban action before its starts. */ actionBegin? (e: ActionBeginEventArgs): void; @@ -12749,7 +13041,7 @@ export interface ContextMenuSettingsCustomMenuItem { /** Gets the template to render custom context menu item. * @Default {null} */ - template?: string; + template?: String; } export interface ContextMenuSettings { @@ -12915,7 +13207,7 @@ export interface EditSettings { /** This specifies the id of the template which is require to be edited using the Dialog Box. * @Default {null} */ - dialogTemplate?: string; + dialogTemplate?: String; /** Get or sets an object that indicates whether to customize the editMode of the Kanban. * @Default {ej.Kanban.EditMode.Dialog} @@ -12930,7 +13222,7 @@ export interface EditSettings { /** This specifies the id of the template which is require to be edited using the External edit form. * @Default {null} */ - externalFormTemplate?: string; + externalFormTemplate?: String; /** This specifies to set the position of an External edit form either in the right or bottom of the Kanban. * @Default {ej.Kanban.FormPosition.Bottom} @@ -13168,6 +13460,7 @@ class Rotator extends ej.Widget { static fn: Rotator; constructor(element: JQuery, options?: Rotator.Model); constructor(element: Element, options?: Rotator.Model); + static Locale: any; model:Rotator.Model; defaults:Rotator.Model; @@ -13585,6 +13878,7 @@ class RTE extends ej.Widget { static fn: RTE; constructor(element: JQuery, options?: RTE.Model); constructor(element: Element, options?: RTE.Model); + static Locale: any; model:RTE.Model; defaults:RTE.Model; @@ -14356,6 +14650,7 @@ class Slider extends ej.Widget { static fn: Slider; constructor(element: JQuery, options?: Slider.Model); constructor(element: Element, options?: Slider.Model); + static Locale: any; model:Slider.Model; defaults:Slider.Model; @@ -14374,7 +14669,7 @@ class Slider extends ej.Widget { */ getValue(): number; - /** To set value to slider handle.By defaut animation is false while set the value. If you want to enable the animation, pass the enableAnimation as true to this method. + /** To set value to slider handle.By default animation is false while set the value. If you want to enable the animation, pass the enableAnimation as true to this method. * @returns {void} */ setValue(): void; @@ -14686,6 +14981,7 @@ class SplitButton extends ej.Widget { static fn: SplitButton; constructor(element: JQuery, options?: SplitButton.Model); constructor(element: Element, options?: SplitButton.Model); + static Locale: any; model:SplitButton.Model; defaults:SplitButton.Model; @@ -14931,11 +15227,11 @@ export interface ItemMouseOutEvent { /** return the menu item id */ - ID?: string; + ID?: String; /** return the clicked menu item text */ - Text?: string; + Text?: String; } export interface ItemMouseOverEventArgs { @@ -14965,11 +15261,11 @@ export interface ItemMouseOverEvent { /** return the menu item id */ - ID?: string; + ID?: String; /** return the clicked menu item text */ - Text?: string; + Text?: String; } export interface ItemSelectedEventArgs { @@ -14996,11 +15292,11 @@ export interface ItemSelectedEventArgs { /** return the menu id */ - menuId?: string; + menuId?: String; /** return the clicked menu item text */ - menuText?: string; + menuText?: String; } export interface OpenEventArgs { @@ -15034,6 +15330,7 @@ class Splitter extends ej.Widget { static fn: Splitter; constructor(element: JQuery, options?: Splitter.Model); constructor(element: Element, options?: Splitter.Model); + static Locale: any; model:Splitter.Model; defaults:Splitter.Model; @@ -15259,6 +15556,7 @@ class Tab extends ej.Widget { static fn: Tab; constructor(element: JQuery, options?: Tab.Model); constructor(element: Element, options?: Tab.Model); + static Locale: any; model:Tab.Model; defaults:Tab.Model; @@ -15830,6 +16128,7 @@ class TagCloud extends ej.Widget { static fn: TagCloud; constructor(element: JQuery, options?: TagCloud.Model); constructor(element: Element, options?: TagCloud.Model); + static Locale: any; model:TagCloud.Model; defaults:TagCloud.Model; @@ -16067,6 +16366,7 @@ class TimePicker extends ej.Widget { static fn: TimePicker; constructor(element: JQuery, options?: TimePicker.Model); constructor(element: Element, options?: TimePicker.Model); + static Locale: any; model:TimePicker.Model; defaults:TimePicker.Model; @@ -16471,6 +16771,7 @@ class ToggleButton extends ej.Widget { static fn: ToggleButton; constructor(element: JQuery, options?: ToggleButton.Model); constructor(element: Element, options?: ToggleButton.Model); + static Locale: any; model:ToggleButton.Model; defaults:ToggleButton.Model; @@ -16678,6 +16979,7 @@ class Toolbar extends ej.Widget { static fn: Toolbar; constructor(element: JQuery, options?: Toolbar.Model); constructor(element: Element, options?: Toolbar.Model); + static Locale: any; model:Toolbar.Model; defaults:Toolbar.Model; @@ -17023,6 +17325,7 @@ class TreeView extends ej.Widget { static fn: TreeView; constructor(element: JQuery, options?: TreeView.Model); constructor(element: Element, options?: TreeView.Model); + static Locale: any; model:TreeView.Model; defaults:TreeView.Model; @@ -17051,11 +17354,12 @@ class TreeView extends ej.Widget { */ checkNode(element: string|any): void; - /** This method is used to collapse all nodes in TreeView control. If you want to collapse all nodes up to the specific level in TreeView control then we need to pass level as argument to this method. + /** This method is used to collapse all nodes in TreeView control. If you want to collapse all nodes up to the specific level in TreeView control then we need to pass levelUntil as argument to this method. * @param {number} TreeView nodes will collapse until the given level + * @param {boolean} Weather exclude the hidden nodes of TreeView while collapse all nodes * @returns {void} */ - collapseAll(levelUntil?: number): void; + collapseAll(levelUntil?: number, excludeHiddenNodes?: boolean): void; /** To collapse a particular node in TreeView. * @param {string|any} ID of TreeView node|object of TreeView node @@ -17081,11 +17385,12 @@ class TreeView extends ej.Widget { */ ensureVisible(element: string|any): boolean; - /** This method is used to expand all nodes in TreeView control. If you want to expand all nodes up to the specific level in TreeView control then we need to pass level as argument to this method. + /** This method is used to expand all nodes in TreeView control. If you want to expand all nodes up to the specific level in TreeView control then we need to pass levelUntil as argument to this method. * @param {number} TreeView nodes will expand until the given level + * @param {boolean} Weather exclude the hidden nodes of TreeView while expand all nodes * @returns {void} */ - expandAll(levelUntil?: number): void; + expandAll(levelUntil?: number, excludeHiddenNodes?: boolean): void; /** To expandNode particular node in TreeView. * @param {string|any} ID of TreeView node/object of TreeView node @@ -18089,11 +18394,11 @@ export interface NodeClickEventArgs { */ currentElement?: any; - /** returns the id of current element + /** returns the id of currently clicked TreeView node */ id?: string; - /** returns the parentId of current element + /** returns the parentId of currently clicked TreeView node */ parentId?: string; } @@ -18616,11 +18921,11 @@ export interface Fields { /** Specifies the node to be in expanded state. */ - expanded?: boolean; + expanded?: string; /** Its allow us to indicate whether the node has child or not in load on demand */ - hasChild?: boolean; + hasChild?: string; /** Specifies the HTML Attributes to "li" item list. */ @@ -18640,7 +18945,7 @@ export interface Fields { /** If its true Checkbox node will be checked when rendered with checkbox. */ - isChecked?: boolean; + isChecked?: string; /** Specifies the link attribute to “a” tag in item list. */ @@ -18656,7 +18961,7 @@ export interface Fields { /** Allow us to specify the node to be in selected state */ - selected?: boolean; + selected?: string; /** Specifies the sprite CSS class to "li" item list. */ @@ -18696,6 +19001,7 @@ class Uploadbox extends ej.Widget { static fn: Uploadbox; constructor(element: JQuery, options?: Uploadbox.Model); constructor(element: Element, options?: Uploadbox.Model); + static Locale: any; model:Uploadbox.Model; defaults:Uploadbox.Model; @@ -18874,7 +19180,7 @@ export interface Model { /** Fires when the file upload progress is completed. */ complete? (e: CompleteEventArgs): void; - /** Fires when the file upload progress is successed. */ + /** Fires when the file upload progress is succeeded. */ success? (e: SuccessEventArgs): void; /** Fires when the Uploadbox control is created. */ @@ -19198,6 +19504,7 @@ class WaitingPopup extends ej.Widget { static fn: WaitingPopup; constructor(element: JQuery, options?: WaitingPopup.Model); constructor(element: Element, options?: WaitingPopup.Model); + static Locale: any; model:WaitingPopup.Model; defaults:WaitingPopup.Model; @@ -19302,6 +19609,7 @@ class Grid extends ej.Widget { static fn: Grid; constructor(element: JQuery, options?: Grid.Model); constructor(element: Element, options?: Grid.Model); + static Locale: any; model:Grid.Model; defaults:Grid.Model; @@ -19344,22 +19652,22 @@ class Grid extends ej.Widget { cancelEditCell(): void; /** It is used to clear all the cell selection. - * @returns {boolean} + * @returns {Boolean} */ - clearCellSelection(): boolean; + clearCellSelection(): Boolean; /** It is used to clear specified cell selection based on the rowIndex and columnIndex provided. * @param {number} It is used to pass the row index of the cell * @param {number} It is used to pass the column index of the cell. - * @returns {boolean} + * @returns {Boolean} */ - clearCellSelection(rowIndex: number, columnIndex: number): boolean; + clearCellSelection(rowIndex: number, columnIndex: number): Boolean; /** It is used to clear all the row selection or at specific row selection based on the index provided. * @param {number} optional If index of the column is specified then it will remove the selection from the particular column else it will clears all of the column selection - * @returns {boolean} + * @returns {Boolean} */ - clearColumnSelection(index?: number): boolean; + clearColumnSelection(index?: number): Boolean; /** It is used to clear all the filtering done. * @param {string} If field of the column is specified then it will clear the particular filtering column @@ -19374,9 +19682,9 @@ class Grid extends ej.Widget { /** Clear all the row selection or at specific row selection based on the index provided * @param {number} optional If index of the row is specified then it will remove the selection from the particular row else it will clears all of the row selection - * @returns {boolean} + * @returns {Boolean} */ - clearSelection(index?: number): boolean; + clearSelection(index?: number): Boolean; /** Clear the sorting from columns in the grid * @returns {void} @@ -19516,9 +19824,9 @@ class Grid extends ej.Widget { /** Get the column index of the given field in grid. * @param {string} Pass the field name of the column to get the corresponding column index - * @returns {number} + * @returns {Number} */ - getColumnIndexByField(fieldName: string): number; + getColumnIndexByField(fieldName: string): Number; /** Get the content div element of grid. * @returns {HTMLElement} @@ -19526,9 +19834,9 @@ class Grid extends ej.Widget { getContent(): HTMLElement; /** Get the content table element of grid - * @returns {HTMLElement} + * @returns {Array} */ - getContentTable(): HTMLElement; + getContentTable(): Array; /** Get the data of currently edited cell value in "batch" edit mode * @returns {any} @@ -19536,9 +19844,9 @@ class Grid extends ej.Widget { getCurrentEditCellData(): any; /** Get the current page index in grid pager. - * @returns {number} + * @returns {Number} */ - getCurrentIndex(): number; + getCurrentIndex(): Number; /** Get the current page data source of grid. * @returns {Array} @@ -19547,9 +19855,9 @@ class Grid extends ej.Widget { /** Get the column field name from the given header text in grid. * @param {string} Pass header text of the column to get its corresponding field name - * @returns {string} + * @returns {String} */ - getFieldNameByHeaderText(headerText: string): string; + getFieldNameByHeaderText(headerText: string): String; /** Get the filter bar of grid * @returns {HTMLElement} @@ -19583,9 +19891,9 @@ class Grid extends ej.Widget { /** Get the column header text from the given field name in grid. * @param {string} Pass field name of the column to get its corresponding header text - * @returns {string} + * @returns {String} */ - getHeaderTextByFieldName(field: string): string; + getHeaderTextByFieldName(field: string): String; /** Get the names of all the hidden column collections in grid. * @returns {Array} @@ -19594,9 +19902,9 @@ class Grid extends ej.Widget { /** Get the row index based on the given tr element in grid. * @param {JQuery} Pass the tr element in grid content to get its row index - * @returns {number} + * @returns {Number} */ - getIndexByRow($tr: JQuery): number; + getIndexByRow($tr: JQuery): Number; /** Get the pager of grid. * @returns {HTMLElement} @@ -19616,9 +19924,9 @@ class Grid extends ej.Widget { getRowByIndex(from: number, to: number): HTMLElement; /** Get the row height of grid. - * @returns {number} + * @returns {Number} */ - getRowHeight(): number; + getRowHeight(): Number; /** Get the rows(tr element)of grid which is displayed in the current page. * @returns {HTMLElement} @@ -19626,21 +19934,21 @@ class Grid extends ej.Widget { getRows(): HTMLElement; /** Get the scroller object of grid. - * @returns {any} + * @returns {ej.Scroller} */ - getScrollObject(): any; + getScrollObject(): ej.Scroller; /** Get the selected records details in grid. - * @returns {void} + * @returns {Array} */ - getSelectedRecords(): void; + getSelectedRecords(): Array; /** Get the calculated summary values of JSON data passed to it * @param {any} Pass Summary Column details * @param {any} Pass JSON Array for which its field values to be calculated - * @returns {number} + * @returns {Number} */ - getSummaryValues(summaryCol: any, summaryData: any): number; + getSummaryValues(summaryCol: any, summaryData: any): Number; /** Get the names of all the visible column collections in grid * @returns {Array} @@ -19727,9 +20035,9 @@ class Grid extends ej.Widget { rowHeightRefresh(): void; /** Save the particular edited cell in grid. - * @returns {boolean} + * @returns {Boolean} */ - saveCell(): boolean; + saveCell(): Boolean; /** We can prevent the client side cellSave event triggering by passing the preventSaveEvent argument as true. * @param {boolean} optionalIf we pass preventSaveEvent as true, it prevents the client side cellSave event triggering @@ -19770,9 +20078,9 @@ class Grid extends ej.Widget { /** Select the specified columns in grid based on Index provided. * @param {number} It is used to set the starting index of column for selecting columns. * @param {number} optionalIt is used to set the ending index of column for selecting columns. - * @returns {boolean} + * @returns {Boolean} */ - selectColumns(columnIndex: number, toIndex?: number): boolean; + selectColumns(columnIndex: number, toIndex?: number): Boolean; /** Select rows in grid. * @param {number} It is used to set the starting index of row for selecting rows. @@ -19808,6 +20116,12 @@ class Grid extends ej.Widget { */ setCellValue(Index: number, fieldName: string, value: any): void; + /** The grid rows has to be rendered as detail view in mobile mode based on given value. + * @param {number} It is used to render grid rows as details view in mobile mode. + * @returns {void} + */ + setPhoneModeMaxWidth(Index: number): void; + /** Set validation to a field during editing. * @param {string} Specify the field name of the column to set validation rules * @param {any} Specify the validation rules for the field @@ -19859,86 +20173,86 @@ export interface Model { /** Gets or sets a value that indicates whether to customizing cell based on our needs. * @Default {false} */ - allowCellMerging?: boolean; + allowCellMerging?: Boolean; /** Gets or sets a value that indicates whether to enable dynamic grouping behavior. Grouping can be done by drag on drop desired columns to grid’s GroupDropArea. This can be further customized through “groupSettings” property. * @Default {false} */ - allowGrouping?: boolean; + allowGrouping?: Boolean; /** Gets or sets a value that indicates whether to enable keyboard support for performing grid actions. selectionType – Gets or sets a value that indicates whether to enable single row or multiple rows selection behavior in grid. Multiple selection can be done through by holding CTRL and clicking the grid rows * @Default {true} */ - allowKeyboardNavigation?: boolean; + allowKeyboardNavigation?: Boolean; /** Gets or sets a value that indicates whether to enable dynamic filtering behavior on grid. Filtering can be used to limit the records displayed using required criteria and this can be further customized through “filterSettings” property * @Default {false} */ - allowFiltering?: boolean; + allowFiltering?: Boolean; /** Gets or sets a value that indicates whether to enable the dynamic sorting behavior on grid data. Sorting can be done through clicking on particular column header. * @Default {false} */ - allowSorting?: boolean; + allowSorting?: Boolean; /** Gets or sets a value that indicates whether to enable multi columns sorting behavior in grid. Sort multiple columns by holding CTRL and click on the corresponding column header. * @Default {false} */ - allowMultiSorting?: boolean; + allowMultiSorting?: Boolean; /** This specifies the grid to show the paginated data. Also enables pager control at the bottom of grid for dynamic navigation through data source. Paging can be further customized through “pageSettings” property. * @Default {false} */ - allowPaging?: boolean; + allowPaging?: Boolean; /** Gets or sets a value that indicates whether to enable the columns reordering behavior in the grid. Reordering can be done through by drag and drop the particular column from one index to another index within the grid. * @Default {false} */ - allowReordering?: boolean; + allowReordering?: Boolean; /** Gets or sets a value that indicates whether the column is non resizable. Column width is set automatically based on the content or header text which is large. * @Default {false} */ - allowResizeToFit?: boolean; + allowResizeToFit?: Boolean; /** Gets or sets a value that indicates whether to enable dynamic resizable of columns. Resize the width of the columns by simply click and move the particular column header line * @Default {false} */ - allowResizing?: boolean; + allowResizing?: Boolean; /** Gets or sets a value that indicates whether to enable the rows reordering in Grid and drag & drop rows between multiple Grid. * @Default {false} */ - allowRowDragAndDrop?: boolean; + allowRowDragAndDrop?: Boolean; /** Gets or sets a value that indicates whether to enable the scrollbar in the grid and view the records by scroll through the grid manually * @Default {false} */ - allowScrolling?: boolean; + allowScrolling?: Boolean; /** Gets or sets a value that indicates whether to enable dynamic searching behavior in grid. Currently search box can be enabled through “toolbarSettings” * @Default {false} */ - allowSearching?: boolean; + allowSearching?: Boolean; /** Gets or sets a value that indicates whether user can select rows on grid. On enabling feature, selected row will be highlighted. * @Default {true} */ - allowSelection?: boolean; + allowSelection?: Boolean; /** Gets or sets a value that indicates whether the Content will wrap to the next line if the content exceeds the boundary of the Column Cells. * @Default {false} */ - allowTextWrap?: boolean; + allowTextWrap?: Boolean; /** Gets or sets a value that indicates whether to enable the multiple exporting behavior on grid data. * @Default {false} */ - allowMultipleExporting?: boolean; + allowMultipleExporting?: Boolean; /** Gets or sets a value that indicates to define common width for all the columns in the grid. */ - commonWidth?: number; + commonWidth?: Number; /** Gets or sets a value that indicates to enable the visibility of the grid lines. * @Default {ej.Grid.GridLines.Both} @@ -19966,7 +20280,7 @@ export interface Model { /** Gets or sets a value that indicates to render the grid with custom theme. */ - cssClass?: string; + cssClass?: String; /** Gets or sets the data to render the grid with records * @Default {null} @@ -19976,7 +20290,7 @@ export interface Model { /** This specifies the grid to add the details row for the corresponding master row * @Default {null} */ - detailsTemplate?: string; + detailsTemplate?: String; /** Gets or sets an object that indicates whether to customize the editing behavior of the grid. */ @@ -19985,42 +20299,42 @@ export interface Model { /** Gets or sets a value that indicates whether to enable the alternative rows differentiation in the grid records based on corresponding theme. * @Default {true} */ - enableAltRow?: boolean; + enableAltRow?: Boolean; /** Gets or sets a value that indicates whether to enable the save action in the grid through row selection * @Default {true} */ - enableAutoSaveOnSelectionChange?: boolean; + enableAutoSaveOnSelectionChange?: Boolean; /** Gets or sets a value that indicates whether to enable mouse over effect on the corresponding column header cell of the grid * @Default {false} */ - enableHeaderHover?: boolean; + enableHeaderHover?: Boolean; /** Gets or sets a value that indicates whether to persist the grid model state in page using applicable medium i.e., HTML5 localStorage or cookies * @Default {false} */ - enablePersistence?: boolean; + enablePersistence?: Boolean; /** Gets or sets a value that indicates whether the grid rows has to be rendered as detail view in mobile mode * @Default {false} */ - enableResponsiveRow?: boolean; + enableResponsiveRow?: Boolean; /** Gets or sets a value that indicates whether to enable mouse over effect on corresponding grid row. * @Default {true} */ - enableRowHover?: boolean; + enableRowHover?: Boolean; /** Align content in the grid control from right to left by setting the property as true. * @Default {false} */ - enableRTL?: boolean; + enableRTL?: Boolean; /** To Disable the mouse swipe property as false. * @Default {true} */ - enableTouch?: boolean; + enableTouch?: Boolean; /** Gets or sets an object that indicates whether to customize the filtering behavior of the grid */ @@ -20033,7 +20347,7 @@ export interface Model { /** Gets or sets a value that indicates whether the grid design has be to made responsive. * @Default {false} */ - isResponsive?: boolean; + isResponsive?: Boolean; /** This specifies to change the key in keyboard interaction to grid control * @Default {null} @@ -20043,12 +20357,12 @@ export interface Model { /** Gets or sets a value that indicates whether to customizing the user interface (UI) as locale-specific in order to display regional data i.e. in a language and culture specific to a particular country or region. * @Default {en-US} */ - locale?: string; + locale?: String; /** Gets or sets a value that indicates whether to set the minimum width of the responsive grid while isResponsive property is true and enableResponsiveRow property is set as false. * @Default {0} */ - minWidth?: number; + minWidth?: Number; /** Gets or sets an object that indicates whether to modify the pager default configuration. */ @@ -20059,14 +20373,14 @@ export interface Model { */ query?: any; - /** Gets or sets an object that indicates whether to modify the resizing behaviour. + /** Gets or sets an object that indicates whether to modify the resizing behavior. */ resizeSettings?: ResizeSettings; /** Gets or sets a value that indicates to render the grid with template rows. The template row must be a table row. That table row must have the JavaScript render binding format ({{:columnName}}) then the grid data source binds the data to the corresponding table row of the template. * @Default {null} */ - rowTemplate?: string; + rowTemplate?: String; /** Gets or sets an object that indicates whether to customize the drag and drop behavior of the grid rows */ @@ -20084,7 +20398,12 @@ export interface Model { /** Gets or sets a value that indicates to select the row while initializing the grid * @Default {-1} */ - selectedRowIndex?: number; + selectedRowIndex?: Number; + + /** Gets or sets a value that indicates the selected rows in grid + * @Default {[]} + */ + selectedRowIndices?: Array; /** This property is used to configure the selection behavior of the grid. */ @@ -20102,17 +20421,17 @@ export interface Model { /** Gets or sets a value that indicates whether to enable column chooser on grid. On enabling feature able to show/hide grid columns * @Default {false} */ - showColumnChooser?: boolean; + showColumnChooser?: Boolean; /** Gets or sets a value that indicates stacked header should be shown on grid layout when the property “stackedHeaderRows” is set. * @Default {false} */ - showStackedHeader?: boolean; + showStackedHeader?: Boolean; /** Gets or sets a value that indicates summary rows should be shown on grid layout when the property “summaryRows” is set * @Default {false} */ - showSummary?: boolean; + showSummary?: Boolean; /** Gets or sets a value that indicates whether to customize the sorting behavior of the grid. */ @@ -21954,27 +22273,27 @@ export interface Column { /** Gets or sets a value that indicates whether to enable editing behavior for particular column. * @Default {true} */ - allowEditing?: boolean; + allowEditing?: Boolean; /** Gets or sets a value that indicates whether to enable dynamic filtering behavior for particular column. * @Default {true} */ - allowFiltering?: boolean; + allowFiltering?: Boolean; /** Gets or sets a value that indicates whether to enable dynamic grouping behavior for particular column. * @Default {true} */ - allowGrouping?: boolean; + allowGrouping?: Boolean; /** Gets or sets a value that indicates whether to enable dynamic sorting behavior for particular column. * @Default {true} */ - allowSorting?: boolean; + allowSorting?: Boolean; /** Gets or sets a value that indicates whether to enable dynamic resizable for particular column. * @Default {true} */ - allowResizing?: boolean; + allowResizing?: Boolean; /** Gets or sets an object that indicates to define a command column in the grid. * @Default {[]} @@ -21983,7 +22302,7 @@ export interface Column { /** Gets or sets a value that indicates to provide custom CSS for an individual column. */ - cssClass?: string; + cssClass?: String; /** Gets or sets a value that indicates the attribute values to the td element of a particular column */ @@ -21996,17 +22315,17 @@ export interface Column { /** Gets or sets a value that indicates to display the specified default value while adding a new record to the grid */ - defaultValue?: string|number|boolean|Date; + defaultValue?: String|Number|Boolean|Date; /** Gets or sets a value that indicates to render the grid content and header with an HTML elements * @Default {false} */ - disableHtmlEncode?: boolean; + disableHtmlEncode?: Boolean; /** Gets or sets a value that indicates to display a column value as checkbox or string * @Default {true} */ - displayAsCheckBox?: boolean; + displayAsCheckBox?: Boolean; /** Gets or sets a value that indicates to customize ejNumericTextbox of an editable column. See editingType */ @@ -22022,32 +22341,37 @@ export interface Column { */ editType?: ej.Grid.EditingType|string; + /** Gets or sets a value that indicates to groups the column based on its column format. + * @Default {false} + */ + enableGroupByFormat?: Boolean; + /** Gets or sets a value that indicates to display the columns in the grid mapping with column name of the dataSource. */ - field?: string; + field?: String; /** Gets or sets a value that indicates to define foreign key field name of the grid datasource. * @Default {null} */ - foreignKeyField?: string; + foreignKeyField?: String; /** Gets or sets a value that indicates to bind the field which is in foreign column datasource based on the foreignKeyField * @Default {null} */ - foreignKeyValue?: string; + foreignKeyValue?: String; /** Gets or sets a value that indicates the format for the text applied on the column */ - format?: string; + format?: String; /** Gets or sets a value that indicates to add the template within the header element of the particular column. * @Default {null} */ - headerTemplateID?: string; + headerTemplateID?: String; /** Gets or sets a value that indicates to display the title of that particular column. */ - headerText?: string; + headerText?: String; /** This defines the text alignment of a particular column header cell value. See headerTextAlign * @Default {ej.TextAlign.Left} @@ -22057,32 +22381,32 @@ export interface Column { /** You can use this property to freeze selected columns in grid at the time of scrolling. * @Default {false} */ - isFrozen?: boolean; + isFrozen?: Boolean; /** Gets or sets a value that indicates the column has an identity in the database. * @Default {false} */ - isIdentity?: boolean; + isIdentity?: Boolean; /** Gets or sets a value that indicates the column is act as a primary key(read-only) of the grid. The editing is performed based on the primary key column * @Default {false} */ - isPrimaryKey?: boolean; + isPrimaryKey?: Boolean; /** Gets or sets a value that indicates the order of Column that are to be hidden or visible when Grid element is in responsive mode and could not occupy all columns. * @Default {null} */ - priority?: number; + priority?: Number; /** Used to hide the particular column in column chooser by giving value as false. * @Default {true} */ - showInColumnChooser?: boolean; + showInColumnChooser?: Boolean; /** Gets or sets a value that indicates whether to enables column template for a particular column. * @Default {false} */ - template?: boolean|string; + template?: Boolean|String; /** Gets or sets a value that indicates to align the text within the column. See textAlign * @Default {ej.TextAlign.Left} @@ -22095,7 +22419,7 @@ export interface Column { /** Gets or sets a value that indicates to specify the data type of the specified columns. */ - type?: string; + type?: String; /** Gets or sets a value that indicates to define constraints for saving data to the database. */ @@ -22104,11 +22428,11 @@ export interface Column { /** Gets or sets a value that indicates whether this column is visible in the grid. * @Default {true} */ - visible?: boolean; + visible?: Boolean; /** Gets or sets a value that indicates to define the width for a particular column in the grid. */ - width?: number; + width?: Number; } export interface ContextMenuSettingsSubContextMenu { @@ -22139,7 +22463,7 @@ export interface ContextMenuSettings { /** Gets or sets a value that indicates whether to enable the context menu action in the grid. * @Default {false} */ - enableContextMenu?: boolean; + enableContextMenu?: Boolean; /** Used to get or set the subMenu to the corresponding custom context menu item. */ @@ -22148,7 +22472,7 @@ export interface ContextMenuSettings { /** Gets or sets a value that indicates whether to disable the default context menu items in the grid. * @Default {false} */ - disableDefaultItems?: boolean; + disableDefaultItems?: Boolean; } export interface EditSettings { @@ -22156,27 +22480,27 @@ export interface EditSettings { /** Gets or sets a value that indicates whether to enable insert action in the editing mode. * @Default {false} */ - allowAdding?: boolean; + allowAdding?: Boolean; /** Gets or sets a value that indicates whether to enable the delete action in the editing mode. * @Default {false} */ - allowDeleting?: boolean; + allowDeleting?: Boolean; /** Gets or sets a value that indicates whether to enable the edit action in the editing mode. * @Default {false} */ - allowEditing?: boolean; + allowEditing?: Boolean; /** Gets or sets a value that indicates whether to enable the editing action while double click on the record * @Default {true} */ - allowEditOnDblClick?: boolean; + allowEditOnDblClick?: Boolean; /** This specifies the id of the template. This template can be used to display the data that you require to be edited using the Dialog Box * @Default {null} */ - dialogEditorTemplateID?: string; + dialogEditorTemplateID?: String; /** Gets or sets a value that indicates whether to define the mode of editing See editMode * @Default {ej.Grid.EditMode.Normal} @@ -22186,7 +22510,7 @@ export interface EditSettings { /** This specifies the id of the template. This template can be used to display the data that you require to be edited using the External edit form * @Default {null} */ - externalFormTemplateID?: string; + externalFormTemplateID?: String; /** This specifies to set the position of an External edit form either in the top-right or bottom-left of the grid * @Default {ej.Grid.FormPosition.BottomLeft} @@ -22196,7 +22520,7 @@ export interface EditSettings { /** This specifies the id of the template. This template can be used to display the data that you require to be edited using the Inline edit form * @Default {null} */ - inlineFormTemplateID?: string; + inlineFormTemplateID?: String; /** This specifies to set the position of an adding new row either in the top or bottom of the grid * @Default {ej.Grid.RowPosition.Top} @@ -22206,22 +22530,22 @@ export interface EditSettings { /** Gets or sets a value that indicates whether the confirm dialog has to be shown while saving or discarding the batch changes * @Default {true} */ - showConfirmDialog?: boolean; + showConfirmDialog?: Boolean; /** Gets or sets a value that indicates whether the confirm dialog has to be shown while deleting record * @Default {false} */ - showDeleteConfirmDialog?: boolean; + showDeleteConfirmDialog?: Boolean; /** Gets or sets a value that indicates whether the title for edit form is different from the primarykey column. * @Default {null} */ - titleColumn?: string; + titleColumn?: String; /** Gets or sets a value that indicates whether to display the add new form by default in the grid. * @Default {false} */ - showAddNewRow?: boolean; + showAddNewRow?: Boolean; } export interface FilterSettingsFilteredColumn { @@ -22248,7 +22572,7 @@ export interface FilterSettings { /** Gets or sets a value that indicates to perform the filter operation with case sensitive in excel styled filter menu mode * @Default {false} */ - enableCaseSensitivity?: boolean; + enableCaseSensitivity?: Boolean; /** This specifies the grid to starts the filter action while typing in the filterBar or after pressing the enter key. based on the filterBarMode. See filterBarMode * @Default {ej.Grid.FilterBarMode.Immediate} @@ -22268,17 +22592,17 @@ export interface FilterSettings { /** Gets or sets a value that indicates the maximum number of filter choices that can be showed in the excel styled filter menu. * @Default {1000} */ - maxFilterChoices?: number; + maxFilterChoices?: Number; /** This specifies the grid to show the filter text within the grid pager itself. * @Default {true} */ - showFilterBarMessage?: boolean; + showFilterBarMessage?: Boolean; /** Gets or sets a value that indicates whether to enable the predicate options in the filtering menu * @Default {false} */ - showPredicate?: boolean; + showPredicate?: Boolean; } export interface GroupSettings { @@ -22286,12 +22610,12 @@ export interface GroupSettings { /** Gets or sets a value that customize the group caption format. * @Default {null} */ - captionFormat?: string; + captionFormat?: String; /** Gets or sets a value that indicates whether to enable animation button option in the group drop area of the grid. * @Default {false} */ - enableDropAreaAutoSizing?: boolean; + enableDropAreaAutoSizing?: Boolean; /** Gets or sets a value that indicates whether to add grouped columns programmatically at initial load * @Default {[]} @@ -22301,22 +22625,22 @@ export interface GroupSettings { /** Gets or sets a value that indicates whether to show the group drop area just above the column header. It can be used to avoid ungrouping the already grouped column using groupSettings. * @Default {true} */ - showDropArea?: boolean; + showDropArea?: Boolean; /** Gets or sets a value that indicates whether to hide the grouped columns from the grid * @Default {false} */ - showGroupedColumn?: boolean; + showGroupedColumn?: Boolean; /** Gets or sets a value that indicates whether to show the group button image(toggle button)in the column header and also in the grouped column in the group drop area . It can be used to group/ungroup the columns by click on the toggle button. * @Default {false} */ - showToggleButton?: boolean; + showToggleButton?: Boolean; /** Gets or sets a value that indicates whether to enable the close button in the grouped column which is in the group drop area to ungroup the grouped column * @Default {false} */ - showUngroupButton?: boolean; + showUngroupButton?: Boolean; } export interface PageSettings { @@ -22324,47 +22648,47 @@ export interface PageSettings { /** Gets or sets a value that indicates whether to define which page to display currently in the grid * @Default {1} */ - currentPage?: number; + currentPage?: Number; /** Gets or sets a value that indicates whether to pass the current page information as a query string along with the URL while navigating to other page. * @Default {false} */ - enableQueryString?: boolean; + enableQueryString?: Boolean; /** Gets or sets a value that indicates whether to enables pager template for the grid. * @Default {false} */ - enableTemplates?: boolean; + enableTemplates?: Boolean; /** Gets or sets a value that indicates whether to define the number of pages displayed in the pager for navigation * @Default {8} */ - pageCount?: number; + pageCount?: Number; /** Gets or sets a value that indicates whether to define the number of records displayed per page * @Default {12} */ - pageSize?: number; + pageSize?: Number; /** Gets or sets a value that indicates whether to enables default pager for the grid. * @Default {false} */ - showDefaults?: boolean; + showDefaults?: Boolean; /** Gets or sets a value that indicates to add the template as a pager template for grid. * @Default {null} */ - template?: string; + template?: String; /** Get the value of total number of pages in the grid. The totalPages value is calculated based on page size and total records of grid * @Default {null} */ - totalPages?: number; + totalPages?: Number; /** Get the value of total number of records which is bound to the grid. The totalRecordsCount value is calculated based on dataSource bound to the grid. * @Default {null} */ - totalRecordsCount?: number; + totalRecordsCount?: Number; /** Gets or sets a value that indicates whether to define the number of pages to print * @Default {ej.Grid.PrintMode.AllPages} @@ -22374,7 +22698,7 @@ export interface PageSettings { export interface ResizeSettings { - /** Gets or sets a value that indicates whether to define the mode of resizing.Accepting types are "normal", "nextcolumn" and "control". + /** Gets or sets a value that indicates whether to define the mode of resizing. * @Default {ej.Grid.ResizeMode.Normal} */ resizeMode?: ej.Grid.ResizeMode|string; @@ -22425,7 +22749,7 @@ export interface SelectionSettings { /** Gets or sets a value that indicates whether to enable the toggle selection behavior for row, cell and column. * @Default {false} */ - enableToggle?: boolean; + enableToggle?: Boolean; /** Gets or sets a value that indicates whether to add the default selection actions as a selection mode.See selectionMode * @Default {[row]} @@ -22438,27 +22762,27 @@ export interface ScrollSettings { /** This specify the grid to to view data that you require without buffering the entire load of a huge database * @Default {false} */ - allowVirtualScrolling?: boolean; + allowVirtualScrolling?: Boolean; /** This specify the grid to enable/disable touch control for scrolling. * @Default {true} */ - enableTouchScroll?: boolean; + enableTouchScroll?: Boolean; /** This specify the grid to freeze particular columns at the time of scrolling. * @Default {0} */ - frozenColumns?: number; + frozenColumns?: Number; /** This specify the grid to freeze particular rows at the time of scrolling. * @Default {0} */ - frozenRows?: number; + frozenRows?: Number; /** This specify the grid to show the vertical scroll bar, to scroll and view the grid contents. * @Default {0} */ - height?: string|number; + height?: String|Number; /** This is used to define the mode of virtual scrolling in grid. See virtualScrollMode * @Default {ej.Grid.VirtualScrollMode.Normal} @@ -22468,28 +22792,28 @@ export interface ScrollSettings { /** This is used to enable the enhanced virtual scrolling in Grid. * @Default {false} */ - enableVirtualization?: boolean; + enableVirtualization?: Boolean; /** This specify the grid to show the horizontal scroll bar, to scroll and view the grid contents * @Default {250} */ - width?: string|number; + width?: String|Number; /** This specify the scroll down pixel of mouse wheel, to scroll mouse wheel and view the grid contents. * @Default {57} */ - scrollOneStepBy?: number; + scrollOneStepBy?: Number; } export interface SortSettingsSortedColumn { /** Gets or sets a value that indicates whether to define the direction to sort the column. */ - direction?: string; + direction?: String; /** Gets or sets a value that indicates whether to define the field name of the column to be sort */ - field?: string; + field?: String; } export interface SortSettings { @@ -22509,17 +22833,17 @@ export interface StackedHeaderRowsStackedHeaderColumn { /** Gets or sets a value that indicates class to the corresponding stackedHeaderColumn. * @Default {null} */ - cssClass?: string; + cssClass?: String; /** Gets or sets a value that indicates the header text for the particular stacked header column. * @Default {null} */ - headerText?: string; + headerText?: String; /** Gets or sets a value that indicates the text alignment of the corresponding headerText. * @Default {ej.TextAlign.Left} */ - textAlign?: string; + textAlign?: String; } export interface StackedHeaderRow { @@ -22535,32 +22859,32 @@ export interface SummaryRowsSummaryColumn { /** Gets or sets a value that indicates the text displayed in the summary column as a value * @Default {null} */ - customSummaryValue?: string; + customSummaryValue?: String; /** This specifies summary column used to perform the summary calculation * @Default {null} */ - dataMember?: string; + dataMember?: String; /** Gets or sets a value that indicates to define the target column at which to display the summary. * @Default {null} */ - displayColumn?: string; + displayColumn?: String; /** Gets or sets a value that indicates the format for the text applied on the column * @Default {null} */ - format?: string; + format?: String; /** Gets or sets a value that indicates the text displayed before the summary column value * @Default {null} */ - prefix?: string; + prefix?: String; /** Gets or sets a value that indicates the text displayed after the summary column value * @Default {null} */ - suffix?: string; + suffix?: String; /** Gets or sets a value that indicates the type of calculations to be performed for the corresponding summary column * @Default {[]} @@ -22570,7 +22894,7 @@ export interface SummaryRowsSummaryColumn { /** Gets or sets a value that indicates to add the template for the summary value of dataMember given. * @Default {null} */ - template?: string; + template?: String; } export interface SummaryRow { @@ -22578,17 +22902,17 @@ export interface SummaryRow { /** Gets or sets a value that indicates whether to show the summary value within the group caption area for the corresponding summary column while grouping the column * @Default {false} */ - showCaptionSummary?: boolean; + showCaptionSummary?: Boolean; /** Gets or sets a value that indicates whether to show the group summary value for the corresponding summary column while grouping a column * @Default {false} */ - showGroupSummary?: boolean; + showGroupSummary?: Boolean; /** Gets or sets a value that indicates whether to show the total summary value the for the corresponding summary column. The summary row is added after the grid content. * @Default {true} */ - showTotalSummary?: boolean; + showTotalSummary?: Boolean; /** Gets or sets a value that indicates whether to add summary columns into the summary rows. * @Default {[]} @@ -22597,12 +22921,12 @@ export interface SummaryRow { /** This specifies the grid to show the title for the summary rows. */ - title?: string; + title?: String; /** This specifies the grid to show the title of summary row in the specified column. * @Default {null} */ - titleColumn?: string; + titleColumn?: String; } export interface TextWrapSettings { @@ -22623,7 +22947,7 @@ export interface ToolbarSettings { /** Gets or sets a value that indicates whether to enable toolbar in the grid. * @Default {false} */ - showToolbar?: boolean; + showToolbar?: Boolean; /** Gets or sets a value that indicates whether to add the default editing actions as a toolbar items * @Default {[]} @@ -22868,6 +23192,7 @@ class Sparkline extends ej.Widget { static fn: Sparkline; constructor(element: JQuery, options?: Sparkline.Model); constructor(element: Element, options?: Sparkline.Model); + static Locale: any; model:Sparkline.Model; defaults:Sparkline.Model; @@ -23464,20 +23789,21 @@ class PivotGrid extends ej.Widget { static fn: PivotGrid; constructor(element: JQuery, options?: PivotGrid.Model); constructor(element: Element, options?: PivotGrid.Model); + static Locale: any; model:PivotGrid.Model; defaults:PivotGrid.Model; - /** Perform an asynchronous HTTP (AJAX) request. + /** Performs an asynchronous HTTP (AJAX) request. * @returns {void} */ doAjaxPost(): void; - /** Perform an asynchronous HTTP (FullPost) submit. + /** Performs an asynchronous HTTP (FullPost) submit. * @returns {void} */ doPostBack(): void; - /** Exports the PivotGrid to an appropriate format based on the parameter passed. + /** Exports the PivotGrid to the specified format. * @returns {void} */ exportPivotGrid(): void; @@ -23487,11 +23813,61 @@ class PivotGrid extends ej.Widget { */ refreshPagedPivotGrid(): void; - /** This function is helps to update or refresh the PivotGrid with modified data source in client-mode. + /** This function refreshes the PivotGrid with modified data input in client-mode. * @returns {void} */ refreshPivotGrid(): void; + /** This function re-renders the control with the report available at that instant. + * @returns {void} + */ + refreshControl(): void; + + /** This function returns the height of all rows and width each and every column. + * @returns {void} + */ + calculateCellWidths(): void; + + /** This function creates the conditional formatting dialog to apply conditional formatting for PivotGrid control. + * @returns {void} + */ + createConditionalDialog(): void; + + /** This function saves the current report to the database/local storage. + * @returns {void} + */ + saveReport(): void; + + /** This function loads the specified report from the database/local storage. + * @returns {void} + */ + loadReport(): void; + + /** This function reconstructs the JSON data formed for rendering PivotGrid in excel-like layout format. + * @returns {void} + */ + excelLikeLayout(): void; + + /** Returns the OlapReport string maintained along with the axis elements information. + * @returns {void} + */ + getOlapReport(): void; + + /** Sets the OlapReport string along with the axis information. + * @returns {void} + */ + setOlapReport(): void; + + /** Returns the JSON records formed to render the control. + * @returns {void} + */ + getJSONRecords(): void; + + /** Sets the JSON records formed to render the control. + * @returns {void} + */ + setJSONRecords(): void; + /** This function allows user to change the caption of the Pivot Item (name displayed in UI) on-demand for relational datasource in client-mode. * @returns {void} */ @@ -23507,51 +23883,51 @@ export module PivotGrid{ export interface Model { /** Sets the mode for the PivotGrid widget for binding either OLAP or relational data source. - * @Default {ej.PivotGrid.AnalysisMode.Olap} + * @Default {ej.Pivot.AnalysisMode.Pivot} */ - analysisMode?: ej.PivotGrid.AnalysisMode|string; + analysisMode?: ej.Pivot.AnalysisMode|string; /** Specifies the CSS class to PivotGrid to achieve custom theme. * @Default {“”} */ cssClass?: string; - /** Contains the serialized OlapReport at that instant. - * @Default {“”} - */ - currentReport?: string; - /** Initializes the data source for the PivotGrid widget, when it functions completely on client-side. * @Default {{}} */ dataSource?: DataSource; - /** Used to bind the drilled members by default through report. - * @Default {[]} + /** Object that holds the settings of frozen headers. + * @Default {{}} */ - drilledItems?: Array; + frozenHeaderSettings?: FrozenHeaderSettings; - /** Object utilized to pass additional information between client-end and service-end. + /** Object utilized to pass additional information between client-end and service-end on operating the control in server mode. * @Default {null} */ customObject?: any; + /** Allows the user to collapsed the specified members in each field by default. + * @Default {null} + */ + collapsedMembers?: any; + /** Allows the user to access each cell on mouse right-click. * @Default {false} */ enableCellContext?: boolean; - /** Enables the cell selection for a specified range of value cells. And, the individual row/column cells can be selected by clicking its headers. + /** Enables the cell selection for a specific range of value cells. * @Default {false} */ enableCellSelection?: boolean; - /** Enables the Drill-Through feature which retrieves the raw items that are used to create a specified cell in PivotGrid. This is only applicable in server mode component. + /** Enables the Drill-Through feature which retrieves the raw items that are used to create the specific cell in PivotGrid. This is only applicable in server mode component. * @Default {false} */ enableDrillThrough?: boolean; - /** Allows user to get the cell details in JSON format when double clicking the cell. + /** Allows user to get the cell details in JSON format on double clicking the cell. * @Default {false} */ enableCellDoubleClick?: boolean; @@ -23561,12 +23937,12 @@ export interface Model { */ enableCellEditing?: boolean; - /** Collapses the Pivot Items along rows and columns by default. It works only for relational data source. + /** Collapses the Pivot items along rows and columns by default. It works only for relational data source. * @Default {false} */ enableCollapseByDefault?: boolean; - /** Enables the display of grand total for all the columns. + /** Enables/Disables the display of grand total for all the columns. * @Default {true} */ enableColumnGrandTotal?: boolean; @@ -23581,12 +23957,12 @@ export interface Model { */ enableDeferUpdate?: boolean; - /** Enables the display of GroupingBar allowing you to filter, sort and remove fields obtained from relational datasource. + /** Enables the display of GroupingBar allowing you to filter, sort and remove fields obtained from datasource. * @Default {false} */ enableGroupingBar?: boolean; - /** Enables the display of grand total for rows and columns. + /** Enables/Disables the display of grand total for rows and columns. * @Default {true} */ enableGrandTotal?: boolean; @@ -23596,7 +23972,7 @@ export interface Model { */ enableJSONRendering?: boolean; - /** Enables rendering of PivotGrid widget along with the PivotTable Field List, which allows UI operation. + /** Enables rendering of PivotGrid widget along with the PivotTable Field List, which allows UI operations. * @Default {true} */ enablePivotFieldList?: boolean; @@ -23621,32 +23997,36 @@ export interface Model { */ enableToolTipAnimation?: boolean; + /** Allows the user to adjust the width of the columns dynamically. + * @Default {false} + */ + enableColumnResizing?: boolean; + /** Allows the user to view large amount of data through virtual scrolling. * @Default {false} */ enableVirtualScrolling?: boolean; + /** Allows the user to view large amount of data by applying paging. + * @Default {false} + */ + enablePaging?: boolean; + /** Allows the user to configure hyperlink settings of PivotGrid control. * @Default {{}} */ hyperlinkSettings?: HyperlinkSettings; - /** This is used for identifying whether the member is Named Set or not. - * @Default {false} - */ - isNamedSets?: boolean; - /** Allows the user to enable PivotGrid’s responsiveness in the browser layout. * @Default {false} */ isResponsive?: boolean; /** Contains the serialized JSON string which renders PivotGrid. - * @Default {“”} */ jsonRecords?: string; - /** Sets the summary layout for PivotGrid. Following are the ways in which summary can be positioned: normal summary (bottom), top summary, no summary and excel-like summary. + /** Sets the summary layout for PivotGrid.Following are the ways in which summary can be positioned: normal summary (bottom), top summary, no summary and excel-like summary. * @Default {ej.PivotGrid.Layout.Normal} */ layout?: ej.PivotGrid.Layout|string; @@ -23657,9 +24037,9 @@ export interface Model { locale?: string; /** Sets the mode for the PivotGrid widget for binding data source either in server-side or client-side. - * @Default {ej.PivotGrid.OperationalMode.ClientMode} + * @Default {ej.Pivot.OperationalMode.ClientMode} */ - operationalMode?: ej.PivotGrid.OperationalMode|string; + operationalMode?: ej.Pivot.OperationalMode|string; /** Allows the user to set custom name for the methods at service-end, communicated during AJAX post. * @Default {{}} @@ -23718,114 +24098,74 @@ export interface Model { /** Triggers when the hyperlink of value cell is clicked. */ valueCellHyperlinkClick? (e: ValueCellHyperlinkClickEventArgs): void; + + /** Triggers before saving the current report to database. */ + saveReport? (e: SaveReportEventArgs): void; + + /** Triggers before loading a report from database. */ + loadReport? (e: LoadReportEventArgs): void; + + /** Triggers before performing exporting in pivot grid. */ + beforeExport? (e: BeforeExportEventArgs): void; + + /** Triggers before editing the cells. */ + cellEdit? (e: CellEditEventArgs): void; } export interface AfterServiceInvokeEventArgs { - /** return the current action of PivotGrid control. + /** returns the current action of PivotGrid control. */ action?: string; - /** return the custom object bounds with PivotGrid control. + /** returns the custom object bound with PivotGrid control. */ customObject?: any; - /** return the outer HTML of PivotGrid control. + /** returns the HTML element of PivotGrid control. */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotGrid model - */ - model?: ej.PivotGrid.Model; - - /** returns the name of the event - */ - type?: string; + element?: any; } export interface BeforeServiceInvokeEventArgs { - /** return the current action of PivotGrid control. + /** returns the current action of PivotGrid control. */ action?: string; - /** return the custom object bounds with PivotGrid control. + /** returns the custom object bound with PivotGrid control. */ customObject?: any; - /** return the outer HTML of PivotGrid control. + /** returns the HTML element of PivotGrid control. */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotGrid model - */ - model?: ej.PivotGrid.Model; - - /** returns the name of the event - */ - type?: string; + element?: any; } export interface BeforePivotEnginePopulateEventArgs { /** returns the PivotGrid object */ - pivotObject?: any; - - /** returns the PivotGrid model - */ - model?: ej.PivotGrid.Model; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the name of the event - */ - type?: string; + pivotGridObject?: any; } export interface CellDoubleClickEventArgs { - /** return the JSON details of the double clicked cell. + /** returns the JSON details of the double clicked cell. */ - selectedData?: any; + selectedData?: Array; - /** return the custom object bounds with PivotGrid widget. + /** returns the custom object bound with PivotGrid control. */ customObject?: any; - /** return the outer HTML of PivotGrid control. + /** returns the HTML element of PivotGrid control. */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotGrid model - */ - model?: ej.PivotGrid.Model; - - /** returns the name of the event - */ - type?: string; + element?: any; } export interface CellContextEventArgs { - /** returns the original event args. - */ - args?: any; - /** returns the cell position (row index and column index) in table. */ cellPosition?: string; @@ -23834,78 +24174,66 @@ export interface CellContextEventArgs { */ cellType?: string; - /** returns the serialized data of the header cells. + /** returns the content of the cell. */ - rowData?: string; + cellValue?: string; /** returns the unique name of levels/members. */ uniqueName?: string; + + /** returns the role of the cell in PivotGrid. + */ + role?: string; + + /** returns JSON record corresponding to the selected cell. + */ + rawdata?: any; + + /** returns the original event object. + */ + args?: any; } export interface CellSelectionEventArgs { - /** returns the original event args. + /** returns the JSON records of the selected range of cells. */ - args?: any; + JSONRecords?: any; - /** Returns the selected cell values. + /** Returns the row headers corresponding to the selected value cells. */ - cellvalue?: any; + rowheader?: any; - /** Returns the selected value cells row headers. + /** Returns the column headers corresponding to the selected value cells. */ - rowheaders?: any; + columnheader?: any; - /** Returns the selected value cells column headers. + /** Returns the information about the measure associated with the selected cell. */ - colheaders?: any; - - /** Returns the selected value cells measure. - */ - measure?: any; - - /** Return the row and column measure count. - */ - measureValue?: any; + measureCount?: string; } export interface ColumnHeaderHyperlinkClickEventArgs { - /** returns the original event args. + /** returns the information about the clicked cell */ args?: any; - /** returns the cell position (row index and column index) in table. + /** returns the HTML element of the control. */ - cellPosition?: string; + element?: any; - /** returns the type of the cell. + /** returns the custom object bound to the control. */ - cellType?: string; - - /** returns the serialized data of the header cells. - */ - rowData?: string; - - /** returns the unique name of levels/members. - */ - uniqueName?: string; + customObject?: any; } export interface DrillSuccessEventArgs { - /** if the event should be canceled; otherwise, false. + /** returns the HTML element of the control. */ - cancel?: boolean; - - /** returns the PivotGrid model - */ - model?: ej.PivotGrid.Model; - - /** returns the name of the event - */ - type?: string; + args?: any; } export interface DrillThroughEventArgs { @@ -23914,241 +24242,192 @@ export interface DrillThroughEventArgs { */ data?: any; - /** return the outer HTML of PivotGrid control. + /** returns the HTML element of PivotGrid control. */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotGrid model - */ - model?: ej.PivotGrid.Model; - - /** returns the name of the event - */ - type?: string; + element?: any; } export interface LoadEventArgs { - /** returns the original event args. - */ - args?: any; - - /** returns the current action of PivotGrid control. - */ - action?: string; - - /** returns the custom object bounded with the control. + /** returns the custom object bound with the control. */ customObject?: any; - /** returns the HTML of PivotGrid control. + /** returns the HTML element of PivotGrid control. */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotGrid model. - */ - model?: ej.PivotGrid.Model; - - /** returns the name of the event. - */ - type?: string; + element?: any; } export interface RenderCompleteEventArgs { - /** returns the original event args. - */ - args?: any; - /** returns the current action of PivotGrid control. */ action?: string; - /** returns the custom object bounded with the control. + /** returns the custom object bound with the control. */ customObject?: any; - /** returns the HTML of PivotGrid control. + /** returns the HTML element of PivotGrid control. */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotGrid model. - */ - model?: ej.PivotGrid.Model; - - /** returns the name of the event. - */ - type?: string; + element?: any; } export interface RenderFailureEventArgs { - /** returns the original event args. - */ - args?: any; - /** returns the current action of PivotGrid control. */ action?: string; - /** returns the custom object bounded with the control. + /** returns the custom object bound with the control. */ customObject?: any; - /** returns the HTML of PivotGrid control. + /** returns the HTML element of PivotGrid control. */ - element?: string; + element?: any; /** returns the error message with error code. */ - message?: any; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotGrid model. - */ - model?: ej.PivotGrid.Model; - - /** returns the name of the event. - */ - type?: string; + message?: string; } export interface RenderSuccessEventArgs { - /** returns the original event args. - */ - args?: any; - /** returns the current action of PivotGrid control. */ action?: string; - /** returns the custom object bounded with the control. + /** returns the custom object bound with the control. */ customObject?: any; - /** returns the HTML of PivotGrid control. + /** returns the HTML element of PivotGrid control. */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotGrid model. - */ - model?: ej.PivotGrid.Model; - - /** returns the name of the event. - */ - type?: string; + element?: any; } export interface RowHeaderHyperlinkClickEventArgs { - /** returns the original event args. + /** returns the information about the clicked cell */ args?: any; - /** returns the cell position (row index and column index) in table. + /** returns the HTML element of the control. */ - cellPosition?: string; + element?: any; - /** returns the type of the cell. + /** returns the custom object bound to the control. */ - cellType?: string; - - /** returns the serialized data of the header cells. - */ - rowData?: string; - - /** returns the unique name of levels/members. - */ - uniqueName?: string; + customObject?: any; } export interface SummaryCellHyperlinkClickEventArgs { - /** returns the original event args. + /** returns the information about the clicked cell */ args?: any; - /** returns the cell position (row index and column index) in table. + /** returns the HTML element of the control. */ - cellPosition?: string; + element?: any; - /** returns the type of the cell. + /** returns the custom object bound to the control. */ - cellType?: string; - - /** returns the serialized data of the header cells. - */ - rowData?: string; - - /** returns the unique name of levels/members. - */ - uniqueName?: string; + customObject?: any; } export interface ValueCellHyperlinkClickEventArgs { - /** returns the original event args. + /** returns the information about the clicked cell */ args?: any; - /** returns the cell position (row index and column index) in table. + /** returns the HTML element of the control. */ - cellPosition?: string; + element?: any; - /** returns the type of the cell. + /** returns the custom object bound to the control. */ - cellType?: string; + customObject?: any; +} - /** returns the serialized data of the header cells. - */ - rowData?: string; +export interface SaveReportEventArgs { - /** returns the unique name of levels/members. + /** returns the report to be stored in database. */ - uniqueName?: string; + report?: any; +} + +export interface LoadReportEventArgs { + + /** returns the PivotGrid object. + */ + targetControl?: any; + + /** returns whether the control is bound with OLAP or Relational data source. + */ + dataModel?: string; +} + +export interface BeforeExportEventArgs { + + /** contains the url of the service responsible for exporting. + */ + url?: string; + + /** contains the name of the exporting file. + */ + fileName?: string; +} + +export interface CellEditEventArgs { + + /** contains the array of cells selected for editing. + */ + editCellsInfo?: Array; } export interface DataSourceColumnsAdvancedFilter { - /** Allows the user to provide level unique name to do advanced filtering (excel-like) for OLAP data source in client-mode. + /** Allows the user to provide level unique name to perform advanced filtering. */ name?: string; - /** Allows the user to set the operator for label filtering to do advanced filtering (excel-like) for OLAP data source in client-mode. + /** Allows the user to set the operator to perform Label Filtering. + * @Default {none} */ labelFilterOperator?: string; - /** Allows the user to set the operator for value filtering to do advanced filtering (excel-like) for OLAP data source in client-mode. + /** Allows the user to set the operator to perform Value Filtering. + * @Default {none} */ valueFilterOperator?: string; - /** Allows the user to set the filtering type while doing advanced filtering (excel-like) for OLAP data source in client-mode. + /** Allows the user to set the filtering type while performing advanced filtering. */ advancedFilterType?: string; - /** Allows the user to holds the filter value in advanced filtering (excel-like) option for OLAP data source in client-mode. + /** In case of value filtering, this property contains the measure name to which the filter is applied. */ - values?: string; + measure?: string; + + /** Allows the user to hold the filter operand values in advanced filtering. + */ + values?: Array; +} + +export interface DataSourceColumnsFilterItems { + + /** Sets the type of filter whether to include/exclude the mentioned values. + * @Default {ej.PivotAnalysis.FilterType.Exclude} + */ + filterType?: ej.PivotAnalysis.FilterType|string; + + /** Contains the collection of items to be included/excluded among the field members. + * @Default {[]} + */ + values?: Array; } export interface DataSourceColumn { @@ -24157,7 +24436,7 @@ export interface DataSourceColumn { */ fieldName?: string; - /** Allows the user to set the display name for an item. + /** Allows the user to set the display caption for an item. */ fieldCaption?: string; @@ -24166,33 +24445,72 @@ export interface DataSourceColumn { */ advancedFilter?: Array; - /** Allows the user to enable the usage of named set items in respective axis. This is only applicable for OLAP datasource. + /** Allows the user to indicate whether the added item is a named set or not. * @Default {false} */ isNamedSets?: boolean; + + /** Shows/Hides the sub-total of the field in PivotGrid. + * @Default {true} + */ + showSubTotal?: boolean; + + /** Allows the user to set the sorting order of the members of the field. + * @Default {ej.PivotAnalysis.SortOrder.Ascending} + */ + sortOrder?: ej.PivotAnalysis.SortOrder|string; + + /** Contains the list of members need to be drilled down by default in the field. + * @Default {[]} + */ + drilledItems?: Array; + + /** Applies filter to the field members. + * @Default {null} + */ + filterItems?: DataSourceColumnsFilterItems; } export interface DataSourceRowsAdvancedFilter { - /** Allows the user to provide level unique name to do advanced filtering (excel-like) for OLAP data source in client-mode. + /** Allows the user to provide level unique name to perform advanced filtering. */ name?: string; - /** Allows the user to set the operator for label filtering to do advanced filtering (excel-like) for OLAP data source in client-mode. + /** Allows the user to set the operator to perform Label Filtering. + * @Default {none} */ labelFilterOperator?: string; - /** Allows the user to set the operator for value filtering to do advanced filtering (excel-like) for OLAP data source in client-mode. + /** Allows the user to set the operator to perform Value Filtering. + * @Default {none} */ valueFilterOperator?: string; - /** Allows the user to set the filtering type while doing advanced filtering (excel-like) for OLAP data source in client-mode. + /** Allows the user to set the filtering type while performing advanced filtering. */ advancedFilterType?: string; - /** Allows the user to holds the filter value in advanced filtering (excel-like) option for OLAP data source in client-mode. + /** In case of value filtering, this property contains the measure name to which the filter is applied. */ - values?: string; + measure?: string; + + /** Allows the user to hold the filter operand values in advanced filtering. + */ + values?: Array; +} + +export interface DataSourceRowsFilterItems { + + /** Sets the type of filter whether to include/exclude the mentioned values. + * @Default {ej.PivotAnalysis.FilterType.Exclude} + */ + filterType?: ej.PivotAnalysis.FilterType|string; + + /** Contains the collection of items to be included/excluded among the field members. + * @Default {[]} + */ + values?: Array; } export interface DataSourceRow { @@ -24201,7 +24519,7 @@ export interface DataSourceRow { */ fieldName?: string; - /** Allows the user to set the display name for an item. + /** Allows the user to set the display caption for an item. */ fieldCaption?: string; @@ -24210,42 +24528,95 @@ export interface DataSourceRow { */ advancedFilter?: Array; - /** Allows the user to enable the usage of named set items in respective axis. This is only applicable for OLAP datasource. + /** Allows the user to indicate whether the added item is a named set or not. * @Default {false} */ isNamedSets?: boolean; + + /** Shows/Hides the sub-total of the field. + * @Default {true} + */ + showSubTotal?: boolean; + + /** Allows the user to set the sorting order of the members of the field. + * @Default {ej.PivotAnalysis.SortOrder.Ascending} + */ + sortOrder?: ej.PivotAnalysis.SortOrder|string; + + /** Contains the list of members need to be drilled down by default in the field. + * @Default {[]} + */ + drilledItems?: Array; + + /** Applies filter to the field members. + * @Default {null} + */ + filterItems?: DataSourceRowsFilterItems; +} + +export interface DataSourceValuesMeasure { + + /** Allows the user to bind the measure from OLAP datasource by using its unique name as field name. + */ + fieldName?: string; } export interface DataSourceValue { - /** This holds the measures unique name to bind them from the Cube. - * @Default {[]} - */ - measures?: Array; - - /** Allows to set the axis name to place the measures items. - * @Default {“”} - */ - axis?: string; - - /** Allows the user to bind the item by using its unique name as field name. + /** Allows the user to bind the item by using its unique name as field name for Relational datasource. */ fieldName?: string; - /** Allows the user to set the display name for an item. + /** Allows the user to set the display caption for an item for Relational datasource. */ fieldCaption?: string; - /** Allows the user to create new fields by enabling the calculated field option for relational data source at client-side. + /** This holds the list of unique names of measures to bind them from the OLAP cube. + * @Default {[]} + */ + measures?: Array; + + /** Allows to set the axis name to place the measures items. + * @Default {rows} + */ + axis?: string; + + /** Indicates whether the field is a calculated field or not with Relational datasource. * @Default {false} */ isCalculatedField?: boolean; - /** Allows the user to apply the formula as an expression in-order to create new field using calculated field option (in code-behind) for relational data source at client-side. + /** Allows to set the type of PivotGrid summary calculation for the value field with Relational datasource. + * @Default {ej.PivotAnalysis.SummaryType.Sum} + */ + summaryType?: ej.PivotAnalysis.SummaryType|string; + + /** Allows to set the format of the values. + */ + format?: string; + + /** This property sets type of display of date. + */ + formatString?: string; + + /** Allows to set the formula for calculation of values for calculated members in Relational datasource. */ formula?: string; } +export interface DataSourceFiltersFilterItems { + + /** Sets the type of filter whether to include/exclude the mentioned values. + * @Default {ej.PivotAnalysis.FilterType.Exclude} + */ + filterType?: ej.PivotAnalysis.FilterType|string; + + /** Contains the collection of items to be included/excluded among the field members. + * @Default {[]} + */ + values?: Array; +} + export interface DataSourceFilter { /** Allows the user to bind the item by using its unique name as field name. @@ -24256,35 +24627,43 @@ export interface DataSourceFilter { */ fieldCaption?: string; - /** Allows the user to enable the usage of named set items in respective axis. This is only applicable for OLAP datasource. - * @Default {false} + /** Applies filter to the field members. + * @Default {null} */ - isNamedSets?: boolean; + filterItems?: DataSourceFiltersFilterItems; +} + +export interface DataSourcePagerOptions { + + /** Allows to set the number of categorical columns to be displayed in each page on applying paging. + * @Default {0} + */ + categoricalPageSize?: number; + + /** Allows to set the number of series rows to be displayed in each page on applying paging. + * @Default {0} + */ + seriesPageSize?: number; + + /** Allows to set the page number in categorical axis to be loaded by default. + * @Default {1} + */ + categoricalCurrentPage?: number; + + /** Allows to set the page number in series axis to be loaded by default. + * @Default {1} + */ + seriesCurrentPage?: number; } export interface DataSource { - /** Contains the database name as string type to fetch the data from the given connection string. - * @Default {“”} - */ - catalog?: string; - - /** Lists out the items to be arranged in column section of PivotGrid. + /** Lists out the items to be arranged in columns section of PivotGrid. * @Default {[]} */ columns?: Array; - /** Contains the respective Cube name from database as string type. - * @Default {“”} - */ - cube?: string; - - /** Provides the raw data source for the PivotGrid. - * @Default {null} - */ - data?: any; - - /** Lists out the items to be arranged in row section of PivotGrid. + /** Lists out the items to be arranged in rows section of PivotGrid. * @Default {[]} */ rows?: Array; @@ -24294,15 +24673,57 @@ export interface DataSource { */ values?: Array; - /** Allows user to filter the members (by its name and values) by enable the advanced filtering (excel-like) option for OLAP data source in client-mode. + /** Lists out the items which supports filtering of values without displaying the members in UI in PivotGrid. + * @Default {[]} + */ + filters?: Array; + + /** Contains the respective cube name from OLAP database as string type. + * @Default {“”} + */ + cube?: string; + + /** Provides the raw data source for the PivotGrid. + * @Default {null} + */ + data?: any; + + /** In connection with an OLAP database, this property contains the database name as string to fetch the data from the given connection string. + * @Default {“”} + */ + catalog?: string; + + /** Allows user to filter the members (by its name and values) through advanced filtering (excel-like) option for OLAP data source in client-mode. * @Default {false} */ enableAdvancedFilter?: boolean; - /** Lists out the items which supports filtering of values in PivotGrid. - * @Default {[]} + /** Sets a name to the report bound to the control. */ - filters?: Array; + reportName?: string; + + /** Allows to set the page size and current page number for each axis on applying paging. + * @Default {{}} + */ + pagerOptions?: DataSourcePagerOptions; +} + +export interface FrozenHeaderSettings { + + /** Allows the user to freeze the row headers alone on scrolling the horizontal scroll bar. + * @Default {false} + */ + enableFrozenRowHeaders?: boolean; + + /** Allows the user to freeze the column headers alone on scrolling the vertical scroll bar. + * @Default {false} + */ + enableFrozenColumnHeaders?: boolean; + + /** Allows the user to freeze both the row headers and column headers on scrolling. + * @Default {false} + */ + enableFrozenHeaders?: boolean; } export interface HyperlinkSettings { @@ -24330,77 +24751,97 @@ export interface HyperlinkSettings { export interface ServiceMethodSettings { - /** Allows the user to set the custom name for the service method that's responsible for drill up/down operation in PivotGrid. + /** Allows the user to set the custom name for the service method responsible for drill up/down operation in PivotGrid. * @Default {DrillGrid} */ drillDown?: string; - /** Allows the user to set the custom name for the service method that’s responsible for exporting. + /** Allows the user to set the custom name for the service method responsible for exporting. * @Default {Export} */ exportPivotGrid?: string; - /** Allows the user to set the custom name for the service method that’s responsible for performing server-side actions on defer update. + /** Allows the user to set the custom name for the service method responsible for performing server-side actions on defer update. * @Default {DeferUpdate} */ deferUpdate?: string; - /** Allows the user to set the custom name for the service method that’s responsible to getting the values for the tree-view inside filter dialog. + /** Allows the user to set the custom name for the service method responsible for getting the values for the tree-view inside filter dialog. * @Default {FetchMembers} */ fetchMembers?: string; - /** Allows the user to set the custom name for the service method that's responsible for filtering operation in PivotGrid. + /** Allows the user to set the custom name for the service method responsible for filtering operation in PivotGrid. * @Default {Filtering} */ filtering?: string; - /** Allows the user to set the custom name for the service method that's responsible for initializing PivotGrid. + /** Allows the user to set the custom name for the service method responsible for initializing PivotGrid. * @Default {InitializeGrid} */ initialize?: string; - /** Allows the user to set the custom name for the service method that's responsible for the server-side action, on dropping a node into Field List. + /** Allows the user to set the custom name for the service method responsible for the server-side action, on dropping a node from Field List. * @Default {NodeDropped} */ nodeDropped?: string; - /** Allows the user to set the custom name for the service method that’s responsible for the server-side action on changing the checked state of a node in Field List. + /** Allows the user to set the custom name for the service method responsible for the server-side action on changing the checked state of a node in Field List. * @Default {NodeStateModified} */ nodeStateModified?: string; - /** Allows the user to set the custom name for the service method that's responsible for performing paging operation in PivotGrid. + /** Allows the user to set the custom name for the service method responsible for performing paging operation in PivotGrid. * @Default {Paging} */ paging?: string; - /** Allows the user to set the custom name for the service method that's responsible for sorting operation in PivotGrid. + /** Allows the user to set the custom name for the service method responsible for sorting operation in PivotGrid. * @Default {Sorting} */ sorting?: string; - /** Allows the user to set the custom name for the service method that’s responsible for expanding members inside member editor. + /** Allows the user to set the custom name for the service method responsible for expanding members inside member editor. * @Default {MemberExpanded} */ memberExpand?: string; - /** Allows the user to set the custom name for the service method that’s responsible for write-back operation in OLAP Cube. This is only applicable in server-side component. + /** Allows the user to set the custom name for the service method responsible for editing the cells. + * @Default {CellEditing} + */ + cellEditing?: string; + + /** Allows the user to set the custom name for the service method responsible for saving the current report to database. + * @Default {SaveReport} + */ + saveReport?: string; + + /** Allows the user to set the custom name for the service method responsible for loading a report from database. + * @Default {LoadReportFromDB} + */ + loadReport?: string; + + /** Allows the user to set the custom name for the service method responsible for adding a calculated field to the report. + * @Default {CalculatedField} + */ + calculatedField?: string; + + /** Allows the user to set the custom name for the service method responsible for performing drill through operation. + * @Default {DrillThroughHierarchies} + */ + drillThroughHierarchies?: string; + + /** Allows the user to set the custom name for the service method responsible for performing drill through operation in data table. + * @Default {DrillThroughDataTable} + */ + drillThroughDataTable?: string; + + /** Allows the user to set the custom name for the service method responsible for write-back operation in OLAP Cube. This is only applicable in server-side component. * @Default {WriteBack} */ writeBack?: string; } -enum AnalysisMode{ - - ///To bind an OLAP data source to PivotGrid. - OLAP, - - ///To bind a relational data source to PivotGrid. - Relational -} - - enum Layout{ ///To set normal summary layout in PivotGrid. @@ -24416,29 +24857,83 @@ enum Layout{ ExcelLikeLayout } - -enum OperationalMode{ - - ///To bind data source completely from client-side. - ClientMode, - - ///To bind data source completely from server-side. - ServerMode } - +module Pivot +{ +enum AnalysisMode +{ +//To bind an OLAP data source to PivotGrid. +OLAP, +//To bind a relational data source to PivotGrid. +Pivot, +} +} +module PivotAnalysis +{ +enum SortOrder +{ +//Sorts the members of the field in ascending order. +Ascending, +//Sorts the members of the field in descending order. +Descending, +//Displays the members without sorting in any order. +None, +} +} +module PivotAnalysis +{ +enum FilterType +{ +//Excludes the specified values among the members of the field. +Exclude, +//Includes the specified values alone among the members of the field. +Include, +} +} +module PivotAnalysis +{ +enum SummaryType +{ +//Calculates the summary as the total of all values. +Sum, +//Displays the average of all values as the summaries. +Average, +//Displays the count of items in summaries. +Count, +//Displays the minimum value of all the items in the summary. +Min, +//Displays the maximum value of all the items in the summary. +Max, +} +} +module Pivot +{ +enum OperationalMode +{ +//To bind data source completely from client-side. +ClientMode, +//To bind data source completely from server-side. +ServerMode, +} } class PivotSchemaDesigner extends ej.Widget { static fn: PivotSchemaDesigner; constructor(element: JQuery, options?: PivotSchemaDesigner.Model); constructor(element: Element, options?: PivotSchemaDesigner.Model); + static Locale: any; model:PivotSchemaDesigner.Model; defaults:PivotSchemaDesigner.Model; - /** Perform an asynchronous HTTP (AJAX) request. + /** Performs an asynchronous HTTP (AJAX) request. * @returns {void} */ doAjaxPost(): void; + + /** Re-renders the control with the data source bound to the pivot control at that instant. + * @returns {void} + */ + refreshControl(): void; } export module PivotSchemaDesigner{ @@ -24454,7 +24949,7 @@ export interface Model { */ customObject?: any; - /** For ASP.NET and MVC Wrapper, Pivots Schema Designer will be initialized and rendered empty initially. Once PivotGrid widget is rendered completely, Pivots Schema Designer will just be populated with data source by setting this property to “true”. + /** For ASP.NET and MVC Wrapper, PivotSchemaDesigner will be initialized and rendered empty initially. Once the connected pivot control widget is rendered completely, PivotSchemaDesigner will just be populated with data source by setting this property to “true”. * @Default {false} */ enableWrapper?: boolean; @@ -24464,26 +24959,16 @@ export interface Model { */ enableRTL?: boolean; - /** Allows the user to view the KPI elements in tree-view inside PivotTable Field List. This is only applicable for OLAP datasource. - * @Default {false} + /** Sets the visibility of OLAP elements in PivotTable Field List. This is only applicable for OLAP datasource. + * @Default {null} */ - showKPI?: boolean; + olap?: Olap; - /** Allows the user to view the named sets in tree-view inside PivotTable Field List. This is only applicable for OLAP datasource. - * @Default {false} - */ - showNamedSets?: boolean; - - /** Allows the user to restrict drag and drop operation within the PivotTable Field List. + /** Allows the user to enable/disable drag and drop operations within the PivotTable Field List. * @Default {true} */ enableDragDrop?: boolean; - /** Allows the user to set the list of filters in filter section. - * @Default {newArray()} - */ - filters?: Array; - /** Sets the height for PivotSchemaDesigner. * @Default {“”} */ @@ -24494,31 +24979,11 @@ export interface Model { */ locale?: string; - /** Allows the user to set list of PivotCalculations in values section. - * @Default {newArray()} - */ - pivotCalculations?: Array; - - /** Allows the user to set the list of PivotItems in column section. - * @Default {newArray()} - */ - pivotColumns?: Array; - /** Sets the Pivot control bound with this PivotSchemaDesigner. * @Default {null} */ pivotControl?: any; - /** Allows the user to set the list of PivotItems in row section. - * @Default {newArray()} - */ - pivotRows?: Array; - - /** Allows the user to arrange the fields inside Field List of PivotSchemaDesigner. - * @Default {newArray()} - */ - pivotTableFields?: Array; - /** Allows the user to set custom name for the methods at service-end, communicated during AJAX post. * @Default {{}} */ @@ -24534,6 +24999,11 @@ export interface Model { */ width?: string; + /** Sets the layout for PivotSchemaDesigner. + * @Default {ej.PivotSchemaDesigner.Layouts.Excel} + */ + layout?: ej.PivotSchemaDesigner.Layouts|string; + /** Triggers when it reaches client-side after any AJAX request. */ afterServiceInvoke? (e: AfterServiceInvokeEventArgs): void; @@ -24546,61 +25016,37 @@ export interface Model { export interface AfterServiceInvokeEventArgs { - /** return the current action of PivotSchemaDesigner control. + /** returns the current action of PivotSchemaDesigner control. */ action?: string; - /** return the custom object bounds with PivotSchemaDesigner control. + /** returns the custom object bound with PivotSchemaDesigner control. */ customObject?: any; - /** return the outer HTML of PivotSchemaDesigner control. + /** returns the HTML element of PivotSchemaDesigner control. */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotSchemaDesigner model - */ - model?: ej.PivotSchemaDesigner.Model; - - /** returns the name of the event - */ - type?: string; + element?: any; } export interface BeforeServiceInvokeEventArgs { - /** return the current action of PivotSchemaDesigner control. + /** returns the current action of PivotSchemaDesigner control. */ action?: string; - /** return the custom object bounds with PivotSchemaDesigner control. + /** returns the custom object bound with PivotSchemaDesigner control. */ customObject?: any; - /** return the outer HTML of PivotSchemaDesigner control. + /** returns the HTML element of PivotSchemaDesigner control. */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotSchemaDesigner model - */ - model?: ej.PivotSchemaDesigner.Model; - - /** returns the name of the event - */ - type?: string; + element?: any; } export interface DragMoveEventArgs { - /** return the HTML of the dragged field from PivotSchemaDesigner. + /** returns the HTML element of the dragged field from PivotSchemaDesigner. */ dragTarget?: any; @@ -24614,47 +25060,74 @@ export interface DragMoveEventArgs { /** returns the PivotSchemaDesigner model */ - model?: ej.PivotSchemaDesigner.Model; + model?: any; +} + +export interface Olap { + + /** Allows the user to view the KPI elements in tree-view inside PivotTable Field List. This is only applicable for OLAP datasource. + * @Default {false} + */ + showKPI?: boolean; + + /** Allows the user to view the named sets in tree-view inside PivotTable Field List. This is only applicable for OLAP datasource. + * @Default {false} + */ + showNamedSets?: boolean; } export interface ServiceMethod { - /** Allows the user to set the custom name for the service method that’s responsible for getting the values for the tree-view inside filter dialog. + /** Allows the user to set the custom name for the service method responsible for getting the values for the tree-view inside filter dialog. * @Default {FetchMembers} */ fetchMembers?: string; - /** Allows the user to set the custom name for the service method that’s responsible for filtering operation in Field List. + /** Allows the user to set the custom name for the service method responsible for filtering operation in Field List. * @Default {Filtering} */ filtering?: string; - /** Allows the user to set the custom name for the service method that’s responsible for the server-side action, on expanding members in Field List. + /** Allows the user to set the custom name for the service method responsible for the server-side action, on expanding members in Field List. * @Default {MemberExpanded} */ memberExpand?: string; - /** Allows the user to set the custom name for the service method that’s responsible for the server-side action, on dropping a node into Field List. + /** Allows the user to set the custom name for the service method responsible for the server-side action, on dropping a node into Field List. * @Default {NodeDropped} */ nodeDropped?: string; - /** Allows the user to set the custom name for the service method that’s responsible for the server-side action on changing the checked state of a node in Field List. + /** Allows the user to set the custom name for the service method responsible for the server-side action on changing the checked state of a node in Field List. * @Default {NodeStateModified} */ nodeStateModified?: string; - /** Allows the user to set the custom name for the service method that’s responsible for remove operation in Field List. + /** Allows the user to set the custom name for the service method responsible for button removing operation in Field List. * @Default {RemoveButton} */ removeButton?: string; } + +enum Layouts{ + + ///To set the layout as same in the Excel. + Excel, + + ///To set normal layout for Field List. + Normal, + + ///To set layout with the axes one above the other. + OneByOne +} + } class PivotPager extends ej.Widget { static fn: PivotPager; constructor(element: JQuery, options?: PivotPager.Model); constructor(element: Element, options?: PivotPager.Model); + static Locale: any; model:PivotPager.Model; defaults:PivotPager.Model; @@ -24721,10 +25194,11 @@ class PivotChart extends ej.Widget { static fn: PivotChart; constructor(element: JQuery, options?: PivotChart.Model); constructor(element: Element, options?: PivotChart.Model); + static Locale: any; model:PivotChart.Model; defaults:PivotChart.Model; - /** Perform an asynchronous HTTP (AJAX) request. + /** Performs an asynchronous HTTP (AJAX) request. * @returns {void} */ doAjaxPost(): void; @@ -24734,12 +25208,12 @@ class PivotChart extends ej.Widget { */ doPostBack(): void; - /** Exports the PivotChart to an appropriate format based on the parameter passed. + /** Exports the PivotChart to the format specified in the parameter. * @returns {void} */ exportPivotChart(): void; - /** This function receives the JSON formatted datasource to render the PivotChart control. + /** This function renders the PivotChart control with the JSON formatted datasource. * @returns {void} */ renderChartFromJSON(): void; @@ -24748,15 +25222,60 @@ class PivotChart extends ej.Widget { * @returns {void} */ renderControlSuccess(): void; + + /** Returns the OlapReport string maintained along with the axis elements information. + * @returns {void} + */ + getOlapReport(): void; + + /** Sets the OlapReport string along with the axis information and maintains it in a property. + * @returns {void} + */ + setOlapReport(): void; + + /** Returns the JSON records formed to render the control. + * @returns {void} + */ + getJSONRecords(): void; + + /** Sets the JSON records to render the control. + * @returns {void} + */ + setJSONRecords(): void; + + /** Returns the PivotEngine formed to render the control. + * @returns {void} + */ + getPivotEngine(): void; + + /** Sets the PivotEngine required to render the control. + * @returns {void} + */ + setPivotEngine(): void; + + /** Re-renders the control with the data source at the instant. + * @returns {void} + */ + refreshControl(): void; + + /** Renders the control with the pivot engine obtained from olap cube. + * @returns {void} + */ + generateJSON(): void; + + /** Navigates to the specified page number in specified axis. + * @returns {void} + */ + refreshPagedPivotChart(): void; } export module PivotChart{ export interface Model { /** Sets the mode for the PivotChart widget for binding either OLAP or Relational data source. - * @Default {ej.PivotChart.AnalysisMode.Olap} + * @Default {ej.Pivot.AnalysisMode.Pivot} */ - analysisMode?: any; + analysisMode?: ej.Pivot.AnalysisMode|string; /** Specifies the CSS class to PivotChart to achieve custom theme. * @Default {“”} @@ -24766,19 +25285,14 @@ export interface Model { /** Options available to configure the properties of entire series. You can also override the options for specific series by using series collection. * @Default {{}} */ - commonSeriesOptions?: any; - - /** Contains the serialized OlapReport at that instant, that is, current OlapReport. - * @Default {“”} - */ - currentReport?: string; + commonSeriesOptions?: CommonSeriesOptions; /** Initializes the data source for the PivotChart widget, when it functions completely on client-side. * @Default {{}} */ dataSource?: DataSource; - /** Object utilized to pass additional information between client-end and service-end. + /** Object utilized to pass additional information between client-end and service-end on operating the control in server mode. * @Default {{}} */ customObject?: any; @@ -24798,7 +25312,7 @@ export interface Model { */ isResponsive?: boolean; - /** Options available to customize the legend items and its title. + /** Lets the user to customize the legend items and their labels. * @Default {{}} */ legend?: any; @@ -24809,9 +25323,9 @@ export interface Model { locale?: string; /** Sets the mode for the PivotChart widget for binding data source either in server-side or client-side. - * @Default {ej.PivotChart.OperationalMode.ClientMode} + * @Default {ej.Pivot.OperationalMode.ClientMode} */ - operationalMode?: any; + operationalMode?: ej.Pivot.OperationalMode|string; /** This is a horizontal axis that contains options to configure axis and it is the primary x axis for all the series in series array. To override x axis for particular series, create an axis object by providing unique name by using name property and add it to axes array. Then, assign the name to the series’s xAxisName property to link both axis and series. * @Default {{}} @@ -24833,12 +25347,12 @@ export interface Model { */ serviceMethodSettings?: ServiceMethodSettings; - /** Options to customize the Chart size. + /** Options to customize the size of the PivotChart control. * @Default {{}} */ size?: any; - /** Connects the service using the specified URL for any server updates. + /** Connects the service using the specified URL for any server updates on operating the control in server mode. * @Default {“”} */ url?: string; @@ -24852,7 +25366,7 @@ export interface Model { /** Triggers before any AJAX request is passed from PivotChart to service methods. */ beforeServiceInvoke? (e: BeforeServiceInvokeEventArgs): void; - /** Triggers when drill up/down happens in PivotChart control. */ + /** Triggers on performing drill up/down in PivotChart control. */ drillSuccess? (e: DrillSuccessEventArgs): void; /** Triggers when PivotChart widget completes all operations at client-side after any AJAX request. */ @@ -24867,183 +25381,128 @@ export interface Model { export interface LoadEventArgs { - /** return the current action of PivotChart control. + /** returns the current action of PivotChart control. */ action?: string; - /** return the custom object bounds with PivotChart control. + /** returns the custom object bound with PivotChart control. */ customObject?: any; - /** return the outer HTML of PivotChart control. + /** returns the HTML element of PivotChart control. */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotChart model. - */ - model?: ej.PivotChart.Model; - - /** returns the name of the event. - */ - type?: string; + element?: any; } export interface AfterServiceInvokeEventArgs { - /** return the current action of PivotChart control. + /** returns the current action of PivotChart control. */ action?: string; - /** return the custom object bounds with PivotChart control. + /** returns the custom object bound with PivotChart control. */ customObject?: any; - /** return the outer HTML of PivotChart control. + /** returns the HTML element of PivotChart control. */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotChart model. - */ - model?: ej.PivotChart.Model; - - /** returns the name of the event. - */ - type?: string; + element?: any; } export interface BeforeServiceInvokeEventArgs { - /** return the current action of PivotChart control. + /** returns the current action of PivotChart control. */ action?: string; - /** return the custom object bounds with PivotChart control. + /** returns the custom object bound with PivotChart control. */ customObject?: any; - /** return the outer HTML of PivotChart control. + /** returns the HTML element of PivotChart control. */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotChart model. - */ - model?: ej.PivotChart.Model; - - /** returns the name of the event. - */ - type?: string; + element?: any; } export interface DrillSuccessEventArgs { - /** if the event should be canceled; otherwise, false. + /** returns the current instance of PivotChart. */ - cancel?: boolean; + chartObj?: any; - /** returns the PivotChart model. + /** returns the drill action of PivotChart. */ - model?: ej.PivotChart.Model; + drillAction?: string; - /** returns the name of the event. + /** contains the name of the member drilled. */ - type?: string; + drilledMember?: string; + + /** returns the event object. + */ + event?: any; } export interface RenderCompleteEventArgs { - /** return the current action of PivotChart control. + /** returns the current action of PivotChart control. */ action?: string; - /** return the custom object bounds with PivotChart control. + /** returns the custom object bound with PivotChart control. */ customObject?: any; - /** return the outer HTML of PivotChart control. + /** returns the HTML element of PivotChart control. */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotChart model. - */ - model?: ej.PivotChart.Model; - - /** returns the name of the event. - */ - type?: string; + element?: any; } export interface RenderFailureEventArgs { - /** return the current action of PivotChart control. + /** returns the current action of PivotChart control. */ action?: string; - /** return the custom object bounds with PivotChart control. + /** returns the custom object bound with PivotChart control. */ customObject?: any; - /** return the error stack trace of the original exception. + /** returns the HTML element of PivotChart control. */ - message?: any; + element?: any; - /** return the outer HTML of PivotChart control. + /** returns the error stack trace of the original exception. */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotChart model. - */ - model?: ej.PivotChart.Model; - - /** returns the name of the event. - */ - type?: string; + message?: string; } export interface RenderSuccessEventArgs { - /** return the current action of PivotChart control. + /** returns the current instance of PivotChart. */ - action?: string; + args?: any; +} - /** return the custom object bounds with PivotChart control. - */ - customObject?: any; +export interface CommonSeriesOptions { - /** return the outer HTML of PivotChart control. + /** Allows the user to set the specific chart type for PivotChart widget. + * @Default {ej.PivotChart.ChartTypes.Column} */ - element?: string; + type?: ej.PivotChart.ChartTypes|string; +} - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; +export interface DataSourceColumnsFilterItems { - /** returns the PivotChart model. + /** Sets the type of filter whether to include/exclude the mentioned values. + * @Default {ej.PivotAnalysis.FilterType.Exclude} */ - model?: ej.PivotChart.Model; + filterType?: ej.PivotAnalysis.FilterType|string; - /** returns the name of the event. + /** Contains the collection of items to be included/excluded among the field members. + * @Default {[]} */ - type?: string; + values?: Array; } export interface DataSourceColumn { @@ -25052,14 +25511,37 @@ export interface DataSourceColumn { */ fieldName?: string; - /** Allows the user to set the display name for an item. + /** Allows the user to set the display caption for an item. */ fieldCaption?: string; - /** Allows the user to enable the usage of named set items in respective axis. This is only applicable for OLAP datasource. + /** Allows the user to indicate whether the added item is a named set or not. * @Default {false} */ isNamedSets?: boolean; + + /** Allows the user to set the sorting order of the members of the field. + * @Default {ej.PivotAnalysis.SortOrder.Ascending} + */ + sortOrder?: ej.PivotAnalysis.SortOrder|string; + + /** Applies filter to the field members. + * @Default {null} + */ + filterItems?: DataSourceColumnsFilterItems; +} + +export interface DataSourceRowsFilterItems { + + /** Sets the type of filter whether to include/exclude the mentioned values. + * @Default {ej.PivotAnalysis.FilterType.Exclude} + */ + filterType?: ej.PivotAnalysis.FilterType|string; + + /** Contains the collection of items to be included/excluded among the field members. + * @Default {[]} + */ + values?: Array; } export interface DataSourceRow { @@ -25068,35 +25550,792 @@ export interface DataSourceRow { */ fieldName?: string; - /** Allows the user to set the display name for an item. + /** Allows the user to set the display caption for an item. */ fieldCaption?: string; - /** Allows the user to enable the usage of named set items in respective axis. This is only applicable for OLAP datasource. + /** Allows the user to indicate whether the added item is a named set or not. * @Default {false} */ isNamedSets?: boolean; + + /** Allows the user to set the sorting order of the members of the field. + * @Default {ej.PivotAnalysis.SortOrder.Ascending} + */ + sortOrder?: ej.PivotAnalysis.SortOrder|string; + + /** Applies filter to the field members. + * @Default {null} + */ + filterItems?: DataSourceRowsFilterItems; +} + +export interface DataSourceValuesMeasure { + + /** Allows the user to bind the measure from OLAP datasource by using its unique name as field name. + */ + fieldName?: string; } export interface DataSourceValue { - /** This holds the measures unique name to bind them from the Cube. + /** Allows the user to bind the item by using its unique name as field name for Relational datasource. + */ + fieldName?: string; + + /** Allows the user to set the display caption for an item for Relational datasource. + */ + fieldCaption?: string; + + /** This holds the list of unique names of measures to bind them from the OLAP cube. * @Default {[]} */ - measures?: Array; + measures?: Array; /** Allows to set the axis name to place the measures items. - * @Default {“”} + * @Default {rows} */ axis?: string; + /** Indicates whether the field is a calculated field or not with Relational datasource. + * @Default {false} + */ + isCalculatedField?: boolean; + + /** Allows to set the formula for calculation of values for calculated members in Relational datasource. + */ + formula?: string; +} + +export interface DataSourceFiltersFilterItems { + + /** Sets the type of filter whether to include/exclude the mentioned values. + * @Default {ej.PivotAnalysis.FilterType.Exclude} + */ + filterType?: ej.PivotAnalysis.FilterType|string; + + /** Contains the collection of items to be included/excluded among the field members. + * @Default {[]} + */ + values?: Array; +} + +export interface DataSourceFilter { + /** Allows the user to bind the item by using its unique name as field name. */ fieldName?: string; - /** Allows the user to set the display name for an item. + /** Applies filter to the field members. + * @Default {null} + */ + filterItems?: DataSourceFiltersFilterItems; +} + +export interface DataSource { + + /** Contains the respective cube name from OLAP database as string type. + * @Default {“”} + */ + cube?: string; + + /** Provides the raw data source for the PivotChart. + * @Default {null} + */ + data?: any; + + /** In connection with an OLAP database, this property contains the database name as string to fetch the data from the given connection string. + * @Default {“”} + */ + catalog?: string; + + /** Lists out the items to be displayed as series of PivotChart. + * @Default {[]} + */ + columns?: Array; + + /** Lists out the items to be displayed as segments of PivotChart. + * @Default {[]} + */ + rows?: Array; + + /** Lists out the items supports calculation in PivotChart. + * @Default {[]} + */ + values?: Array; + + /** Lists out the items which supports filtering of values without displaying the members in UI in PivotChart. + * @Default {[]} + */ + filters?: Array; +} + +export interface ServiceMethodSettings { + + /** Allows the user to set the custom name for the service method responsible for drilling up/down operation in PivotChart. + * @Default {DrillChart} + */ + drillDown?: string; + + /** Allows the user to set the custom name for the service method responsible for exporting. + * @Default {Export} + */ + exportPivotChart?: string; + + /** Allows the user to set the custom name for the service method responsible for initializing PivotChart. + * @Default {InitializeChart} + */ + initialize?: string; + + /** Allows the user to set the custom name for the service method responsible for navigating between pages in paged PivotChart. + * @Default {Paging} + */ + paging?: string; +} + +enum ChartTypes{ + + ///To render a Line type PivotChart. + Line, + + ///To render a Spline type PivotChart. + Spline, + + ///To render a Column type PivotChart. + Column, + + ///To render an Area type PivotChart. + Area, + + ///To render a SplineArea type PivotChart. + SplineArea, + + ///To render a StepLine type PivotChart. + StepLine, + + ///To render a StepArea type PivotChart. + StepArea, + + ///To render a Pie type PivotChart. + Pie, + + ///To render a Bar type PivotChart. + Bar, + + ///To render a StackingArea type PivotChart. + StackingArea, + + ///To render a StackingColumn type PivotChart. + StackingColumn, + + ///To render a StackingBar type PivotChart. + StackingBar, + + ///To render a Pyramid type PivotChart. + Pyramid, + + ///To render a Funnel type PivotChart. + Funnel, + + ///To render a Doughnut type PivotChart. + Doughnut, + + ///To render a Scatter type PivotChart. + Scatter, + + ///To render a Bubble type PivotChart. + Bubble +} + +} + +class PivotClient extends ej.Widget { + static fn: PivotClient; + constructor(element: JQuery, options?: PivotClient.Model); + constructor(element: Element, options?: PivotClient.Model); + static Locale: any; + model:PivotClient.Model; + defaults:PivotClient.Model; + + /** Performs an asynchronous HTTP (AJAX) request. + * @returns {void} + */ + doAjaxPost(): void; + + /** Performs an asynchronous HTTP (FullPost) submit. + * @returns {void} + */ + doPostBack(): void; + + /** Navigates to the specified page in specified axis. + * @returns {void} + */ + refreshPagedPivotClient(): void; + + /** Updates the PivotClient component with the JSON data fetched from the service on navigating between pages. + * @returns {void} + */ + refreshPagedPivotClientSuccess(): void; + + /** Renders the PivotChart and PivotGrid with the JSON data provided. + * @returns {void} + */ + generateJSON(): void; + + /** Re-renders the control with the report at that instant. + * @returns {void} + */ + refreshControl(): void; + + /** Returns the OlapReport string maintained along with the axis elements information. + * @returns {void} + */ + getOlapReport(): void; + + /** Sets the OlapReport string along with the axis information and maintains it in a property. + * @returns {void} + */ + setOlapReport(): void; + + /** Returns the JSON records formed to render the control. + * @returns {void} + */ + getJSONRecords(): void; + + /** Sets the JSON records formed to render the control to a property. + * @returns {void} + */ + setJSONRecords(): void; +} +export module PivotClient{ + +export interface Model { + + /** Sets the mode for the PivotClient widget for binding either OLAP or Relational data source. + * @Default {ej.Pivot.AnalysisMode.Pivot} + */ + analysisMode?: ej.Pivot.AnalysisMode|string; + + /** Allows the user to set the specific chart type for PivotChart inside PivotClient widget. + * @Default {ej.PivotChart.ChartTypes.Column} + */ + chartType?: ej.PivotChart.ChartTypes|string; + + /** Allows the user to set the content on exporting the PivotClient widget. + * @Default {ej.PivotClient.ClientExportMode.ChartAndGrid} + */ + clientExportMode?: ej.PivotClient.ClientExportMode|string; + + /** Specifies the CSS class to PivotClient to achieve custom theme. + * @Default {“”} + */ + cssClass?: string; + + /** Object utilized to pass additional information between client-end and service-end when the control functions in server-mode. + * @Default {{}} + */ + customObject?: any; + + /** Initializes the data source for the PivotClient widget, when it functions completely on client-side. + * @Default {{}} + */ + dataSource?: DataSource; + + /** Allows the user to customize the widget's layout and appearance. + * @Default {{}} + */ + displaySettings?: DisplaySettings; + + /** Enables the advanced filtering options Value Filtering, Label Filtering and Sorting for each dimensions on binding OLAP data in server mode. + * @Default {false} + */ + enableAdvancedFilter?: boolean; + + /** Allows the user to refresh the control on-demand and not during every UI operation. + * @Default {false} + */ + enableDeferUpdate?: boolean; + + /** Lets the user to save and load reports in a customized way with the help of events. + * @Default {false} + */ + enableLocalStorage?: boolean; + + /** Allows the user to enable paging for both the PivotChart and PivotGrid components for the ease of viewing large data. + * @Default {false} + */ + enablePaging?: boolean; + + /** Allows the user to include the PivotTreeMap component as one of the chart types. + * @Default {false} + */ + enablePivotTreeMap?: boolean; + + /** Allows the user to view the layout of PivotClient from right to left. + * @Default {false} + */ + enableRTL?: boolean; + + /** Enables/disables the visibility of measure group selector drop-down in Cube Browser. + * @Default {false} + */ + enableMeasureGroups?: boolean; + + /** Allows the user to enable virtual scrolling for both the PivotChart and PivotGrid components for the ease of viewing large data. + * @Default {false} + */ + enableVirtualScrolling?: boolean; + + /** Enables/Disables paging in Member Editor for viewing the large count of members in pages. + * @Default {false} + */ + enableMemberEditorPaging?: boolean; + + /** Allows the user to set the number of members to be displayed in each page of Member Editor on applying paging in it. + * @Default {100} + */ + memberEditorPageSize?: number; + + /** Sets the summary layout for PivotGrid. Following are the ways in which summary can be positioned: normal summary (bottom), top summary, no summary and excel-like summary. + * @Default {ej.PivotGrid.Layout.Normal} + */ + gridLayout?: ej.PivotGrid.Layout|string; + + /** Allows the user to set the localized language for the widget. + * @Default {en-US} + */ + locale?: string; + + /** Sets the mode for the PivotClient widget for binding data source either in server-side or client-side. + * @Default {ej.Pivot.OperationalMode.ClientMode} + */ + operationalMode?: ej.Pivot.OperationalMode|string; + + /** Allows the user to set custom name for the methods at service-end, communicated during AJAX post. + * @Default {{}} + */ + serviceMethodSettings?: ServiceMethodSettings; + + /** Sets the title for PivotClient widget. + */ + title?: string; + + /** Connects the service using the specified URL for any server updates. + */ + url?: string; + + /** Triggers when it reaches client-side after any AJAX request. */ + afterServiceInvoke? (e: AfterServiceInvokeEventArgs): void; + + /** Triggers before any AJAX request is passed from client-side to service methods. */ + beforeServiceInvoke? (e: BeforeServiceInvokeEventArgs): void; + + /** Triggers before saving the current collection of reports. */ + saveReport? (e: SaveReportEventArgs): void; + + /** Triggers before loading a saved collection of reports. */ + loadReport? (e: LoadReportEventArgs): void; + + /** Triggers before fetching the report collection from storage. */ + fetchReport? (e: FetchReportEventArgs): void; + + /** Triggers before exporting the control. */ + beforeExport? (e: BeforeExportEventArgs): void; + + /** Triggers before rendering the PivotChart. */ + chartLoad? (e: ChartLoadEventArgs): void; + + /** Triggers before rendering the PivotTreeMap. */ + treeMapLoad? (e: TreeMapLoadEventArgs): void; + + /** Triggers while we initiate loading of the widget. */ + load? (e: LoadEventArgs): void; + + /** Triggers when PivotClient widget completes all operations at client-end after any AJAX request. */ + renderComplete? (e: RenderCompleteEventArgs): void; + + /** Triggers when any error occurred during AJAX request. */ + renderFailure? (e: RenderFailureEventArgs): void; + + /** Triggers when PivotClient successfully completes rendering. */ + renderSuccess? (e: RenderSuccessEventArgs): void; +} + +export interface AfterServiceInvokeEventArgs { + + /** returns the current action of PivotClient control. + */ + action?: string; + + /** returns the custom object bounds with PivotClient control. + */ + customObject?: any; + + /** returns the HTML element of PivotClient control. + */ + element?: any; +} + +export interface BeforeServiceInvokeEventArgs { + + /** returns the current action of PivotClient control. + */ + action?: string; + + /** returns the custom object bounds with PivotClient control. + */ + customObject?: any; + + /** returns the HTML element of PivotClient control. + */ + element?: any; +} + +export interface SaveReportEventArgs { + + /** returns the current instance of PivotClient control. + */ + targetControl?: any; + + /** returns the object which holds the necessary parameters required for saving the report collection. + */ + saveReportSetting?: any; +} + +export interface LoadReportEventArgs { + + /** returns the current instance of PivotClient control. + */ + targetControl?: any; + + /** returns the object which holds the necessary parameters required for loading a report collection from database. + */ + loadReportSetting?: any; +} + +export interface FetchReportEventArgs { + + /** returns the current instance of PivotClient control. + */ + targetControl?: any; + + /** returns the object which holds the necessary parameters required for fetching the report names stored in database. + */ + fetchReportSetting?: any; +} + +export interface BeforeExportEventArgs { + + /** holds the url of the service method responsible for exporting the PivotClient control. + */ + url?: string; + + /** holds the name of the file to be exported. + */ + fileName?: string; +} + +export interface ChartLoadEventArgs { + + /** returns the current action of PivotChart control. + */ + action?: string; + + /** returns the custom object bound with PivotChart control. + */ + customObject?: any; + + /** returns the HTML element of PivotChart control. + */ + element?: any; +} + +export interface TreeMapLoadEventArgs { + + /** returns the current action of PivotTreeMap control. + */ + action?: string; + + /** returns the custom object bound with PivotTreeMap control. + */ + customObject?: any; + + /** returns the HTML element of PivotTreeMap control. + */ + element?: any; +} + +export interface LoadEventArgs { + + /** returns the HTML element of PivotClient component. + */ + element?: any; + + /** returns the custom object bound with PivotTreeMap control. + */ + customObject?: any; +} + +export interface RenderCompleteEventArgs { + + /** returns the HTML element of PivotClient component. + */ + element?: any; + + /** returns the custom object bound with PivotTreeMap control. + */ + customObject?: any; +} + +export interface RenderFailureEventArgs { + + /** returns the custom object bound with the control. + */ + customObject?: any; + + /** returns the HTML element of PivotClient control. + */ + element?: any; + + /** returns the error message with error code. + */ + message?: string; +} + +export interface RenderSuccessEventArgs { + + /** returns the object of PivotClient control at that instant. + */ + args?: any; +} + +export interface DataSourceColumnsAdvancedFilter { + + /** Allows the user to provide level unique name to perform advanced filtering. + */ + name?: string; + + /** Allows the user to set the operator to perform Label Filtering. + * @Default {none} + */ + labelFilterOperator?: string; + + /** Allows the user to set the operator to perform Value Filtering. + * @Default {none} + */ + valueFilterOperator?: string; + + /** Allows the user to set the filtering type while performing advanced filtering. + */ + advancedFilterType?: string; + + /** In case of value filtering, this property contains the measure name to which the filter is applied. + */ + measure?: string; + + /** Allows the user to hold the filter operand values in advanced filtering. + */ + values?: Array; +} + +export interface DataSourceColumnsFilterItems { + + /** Sets the type of filter whether to include/exclude the mentioned values. + * @Default {ej.PivotAnalysis.FilterType.Exclude} + */ + filterType?: ej.PivotAnalysis.FilterType|string; + + /** Contains the collection of items to be included/excluded among the field members. + * @Default {[]} + */ + values?: Array; +} + +export interface DataSourceColumn { + + /** Allows the user to bind the item by using its unique name as field name. + */ + fieldName?: string; + + /** Allows the user to set the display caption for an item. */ fieldCaption?: string; + + /** Allows the user to filter the report by default using advanced filtering (excel-like) option for OLAP data source in client-mode. + * @Default {[]} + */ + advancedFilter?: Array; + + /** Allows the user to indicate whether the added item is a named set or not. + * @Default {false} + */ + isNamedSets?: boolean; + + /** Shows/Hides the sub-total of the field in PivotGrid. + * @Default {true} + */ + showSubTotal?: boolean; + + /** Allows the user to set the sorting order of the members of the field. + * @Default {ej.PivotAnalysis.SortOrder.Ascending} + */ + sortOrder?: ej.PivotAnalysis.SortOrder|string; + + /** Contains the list of members need to be drilled down by default in the field. + * @Default {[]} + */ + drilledItems?: Array; + + /** Applies filter to the field members. + * @Default {null} + */ + filterItems?: DataSourceColumnsFilterItems; +} + +export interface DataSourceRowsAdvancedFilter { + + /** Allows the user to provide level unique name to perform advanced filtering. + */ + name?: string; + + /** Allows the user to set the operator to perform Label Filtering. + * @Default {none} + */ + labelFilterOperator?: string; + + /** Allows the user to set the operator to perform Value Filtering. + * @Default {none} + */ + valueFilterOperator?: string; + + /** Allows the user to set the filtering type while performing advanced filtering. + */ + advancedFilterType?: string; + + /** In case of value filtering, this property contains the measure name to which the filter is applied. + */ + measure?: string; + + /** Allows the user to hold the filter operand values in advanced filtering. + */ + values?: Array; +} + +export interface DataSourceRowsFilterItems { + + /** Sets the type of filter whether to include/exclude the mentioned values. + * @Default {ej.PivotAnalysis.FilterType.Exclude} + */ + filterType?: ej.PivotAnalysis.FilterType|string; + + /** Contains the collection of items to be included/excluded among the field members. + * @Default {[]} + */ + values?: Array; +} + +export interface DataSourceRow { + + /** Allows the user to bind the item by using its unique name as field name. + */ + fieldName?: string; + + /** Allows the user to set the display caption for an item. + */ + fieldCaption?: string; + + /** Allows the user to filter the report by default using advanced filtering (excel-like) option for OLAP data source in client-mode. + * @Default {[]} + */ + advancedFilter?: Array; + + /** Allows the user to indicate whether the added item is a named set or not. + * @Default {false} + */ + isNamedSets?: boolean; + + /** Shows/Hides the sub-total of the field. + * @Default {true} + */ + showSubTotal?: boolean; + + /** Allows the user to set the sorting order of the members of the field. + * @Default {ej.PivotAnalysis.SortOrder.Ascending} + */ + sortOrder?: ej.PivotAnalysis.SortOrder|string; + + /** Contains the list of members need to be drilled down by default in the field. + * @Default {[]} + */ + drilledItems?: Array; + + /** Applies filter to the field members. + * @Default {null} + */ + filterItems?: DataSourceRowsFilterItems; +} + +export interface DataSourceValuesMeasure { + + /** Allows the user to bind the measure from OLAP datasource by using its unique name as field name. + */ + fieldName?: string; +} + +export interface DataSourceValue { + + /** Allows the user to bind the item by using its unique name as field name for Relational datasource. + */ + fieldName?: string; + + /** Allows the user to set the display caption for an item for Relational datasource. + */ + fieldCaption?: string; + + /** This holds the list of unique names of measures to bind them from the OLAP cube. + * @Default {[]} + */ + measures?: Array; + + /** Allows to set the axis name to place the measures items. + * @Default {rows} + */ + axis?: string; + + /** Indicates whether the field is a calculated field or not with Relational datasource. + * @Default {false} + */ + isCalculatedField?: boolean; + + /** Allows to set the type of PivotGrid summary calculation for the value field with Relational datasource. + * @Default {ej.PivotAnalysis.SummaryType.Sum} + */ + summaryType?: ej.PivotAnalysis.SummaryType|string; + + /** Allows to set the format of the values. + */ + format?: string; + + /** This property sets type of display of date. + */ + formatString?: string; + + /** Allows to set the formula for calculation of values for calculated members in Relational datasource. + */ + formula?: string; +} + +export interface DataSourceFiltersFilterItems { + + /** Sets the type of filter whether to include/exclude the mentioned values. + * @Default {ej.PivotAnalysis.FilterType.Exclude} + */ + filterType?: ej.PivotAnalysis.FilterType|string; + + /** Contains the collection of items to be included/excluded among the field members. + * @Default {[]} + */ + values?: Array; } export interface DataSourceFilter { @@ -25109,368 +26348,105 @@ export interface DataSourceFilter { */ fieldCaption?: string; - /** Allows the user to enable the usage of named set items in respective axis. This is only applicable for OLAP datasource. - * @Default {false} + /** Applies filter to the field members. + * @Default {null} */ - isNamedSets?: boolean; + filterItems?: DataSourceFiltersFilterItems; +} + +export interface DataSourcePagerOptions { + + /** Allows to set the number of categorical columns to be displayed in each page on applying paging. + * @Default {0} + */ + categoricalPageSize?: number; + + /** Allows to set the number of series rows to be displayed in each page on applying paging. + * @Default {0} + */ + seriesPageSize?: number; + + /** Allows to set the page number in categorical axis to be loaded by default. + * @Default {1} + */ + categoricalCurrentPage?: number; + + /** Allows to set the page number in series axis to be loaded by default. + * @Default {1} + */ + seriesCurrentPage?: number; } export interface DataSource { - /** Contains the database name as string type to fetch the data from the given connection string. - * @Default {“”} - */ - catalog?: string; - - /** Lists out the items to be arranged in column section of PivotChart. + /** Lists out the items to be arranged in columns section of PivotClient. * @Default {[]} */ columns?: Array; - /** Contains the respective Cube name from database as string type. - * @Default {“”} - */ - cube?: string; - - /** Provides the raw data source for the PivotChart. - * @Default {null} - */ - data?: any; - - /** Lists out the items to be arranged in row section of PivotChart. + /** Lists out the items to be arranged in rows section of PivotClient. * @Default {[]} */ rows?: Array; - /** Lists out the items which supports calculation in PivotChart. + /** Lists out the items which supports calculation in PivotClient. * @Default {[]} */ values?: Array; - /** Lists out the items which supports filtering of values in PivotChart. + /** Lists out the items which supports filtering of values without displaying the members in UI in PivotClient. * @Default {[]} */ filters?: Array; -} -export interface ServiceMethodSettings { - - /** Allows the user to set the custom name for the service method that’s responsible for drilling up/down operation in PivotChart. - * @Default {DrillChart} - */ - drillDown?: string; - - /** Allows the user to set the custom name for the service method that’s responsible for exporting. - * @Default {Export} - */ - exportPivotChart?: string; - - /** Allows the user to set the custom name for the service method that’s responsible for initializing PivotChart. - * @Default {InitializeChart} - */ - initialize?: string; -} -} - -class PivotClient extends ej.Widget { - static fn: PivotClient; - constructor(element: JQuery, options?: PivotClient.Model); - constructor(element: Element, options?: PivotClient.Model); - model:PivotClient.Model; - defaults:PivotClient.Model; - - /** Perform an asynchronous HTTP (AJAX) request. - * @returns {void} - */ - doAjaxPost(): void; - - /** Perform an asynchronous HTTP (FullPost) submit. - * @returns {void} - */ - doPostBack(): void; -} -export module PivotClient{ - -export interface Model { - - /** Allows the user to set the specific chart type for PivotChart. - * @Default {ej.PivotChart.ChartTypes.Column} - */ - chartType?: ej.PivotChart.ChartTypes|string; - - /** Sets the mode to export the OLAP visualization components such as PivotChart and PivotGrid in PivotClient. Based on the option, either Chart or Grid or both gets exported. - * @Default {ej.PivotClient.ClientExportMode.ChartAndGrid} - */ - clientExportMode?: string; - - /** Specifies the CSS class to PivotClient to achieve custom theme. + /** Contains the respective cube name from OLAP database as string type. * @Default {“”} */ - cssClass?: string; + cube?: string; - /** Object utilized to pass additional information between client-end and service-end. - * @Default {{}} - */ - customObject?: any; - - /** Allows the user to customize the widgets layout and appearance. - * @Default {{}} - */ - displaySettings?: DisplaySettings; - - /** Allows the user to refresh the control on-demand and not during every UI operation. - * @Default {false} - */ - enableDeferUpdate?: boolean; - - /** Allows the user to view the layout of PivotClient from right to left. - * @Default {false} - */ - enableRTL?: boolean; - - /** Enables/disables the visibility of measure group selector drop-down in Cube Browser. - * @Default {false} - */ - enableMeasureGroups?: boolean; - - /** Sets the summary layout for PivotGrid. Following are the ways in which summary can be positioned: normal summary (bottom), top summary, no summary and excel-like summary. - * @Default {ej.PivotGrid.Layout.Normal} - */ - gridLayout?: ej.PivotGrid.Layout|string; - - /** Allows the user to set the localized language for the widget. - * @Default {en-US} - */ - locale?: string; - - /** Allows the user to set custom name for the methods at service-end, communicated during AJAX post. - * @Default {{}} - */ - serviceMethodSettings?: ServiceMethodSettings; - - /** Sets the title for PivotClient widget. + /** Provides the raw data source for the PivotClient. * @Default {null} */ - title?: string; + data?: any; - /** Connects the service using the specified URL for any server updates. - * @Default {null} + /** In connection with an OLAP database, this property contains the database name as string to fetch the data from the given connection string. + * @Default {“”} */ - url?: string; + catalog?: string; - /** Triggers when it reaches client-side after any AJAX request. */ - afterServiceInvoke? (e: AfterServiceInvokeEventArgs): void; - - /** Triggers before any AJAX request is passed from PivotClient to service methods. */ - beforeServiceInvoke? (e: BeforeServiceInvokeEventArgs): void; - - /** Triggers before rendering the PivotChart. */ - chartLoad? (e: ChartLoadEventArgs): void; - - /** Triggers while we initiate loading of the widget. */ - load? (e: LoadEventArgs): void; - - /** Triggers when PivotClient widget completes all operations at client-end after any AJAX request. */ - renderComplete? (e: RenderCompleteEventArgs): void; - - /** Triggers when any error occurred during AJAX request. */ - renderFailure? (e: RenderFailureEventArgs): void; - - /** Triggers when PivotClient successfully reaches client-side after any AJAX request. */ - renderSuccess? (e: RenderSuccessEventArgs): void; -} - -export interface AfterServiceInvokeEventArgs { - - /** return the current action of PivotClient control. + /** Allows user to filter the members (by its name and values) through advanced filtering (excel-like) option for OLAP data source in client-mode. + * @Default {false} */ - action?: string; + enableAdvancedFilter?: boolean; - /** return the custom object bounds with PivotClient control. + /** Sets a name to the report bound to the control. */ - customObject?: any; + reportName?: string; - /** return the outer HTML of PivotClient control. + /** Allows to set the page size and current page number for each axis on applying paging. + * @Default {{}} */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotClient model. - */ - model?: ej.PivotClient.Model; - - /** returns the name of the event. - */ - type?: string; -} - -export interface BeforeServiceInvokeEventArgs { - - /** return the current action of PivotClient control. - */ - action?: string; - - /** return the custom object bounds with PivotClient control. - */ - customObject?: any; - - /** return the outer HTML of PivotClient control. - */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotClient model. - */ - model?: ej.PivotClient.Model; - - /** returns the name of the event. - */ - type?: string; -} - -export interface ChartLoadEventArgs { - - /** return the current action of PivotChart control. - */ - action?: string; - - /** return the custom object bounds with PivotChart control. - */ - customObject?: any; - - /** return the outer HTML of PivotChart control. - */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotChart model. - */ - model?: ej.PivotClient.Model; - - /** returns the name of the event. - */ - type?: string; -} - -export interface LoadEventArgs { - - /** returns the outer HTML of PivotClient component. - */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotClient model. - */ - model?: ej.PivotClient.Model; - - /** returns the name of the event. - */ - type?: string; -} - -export interface RenderCompleteEventArgs { - - /** returns the custom object bounded with the control. - */ - customObject?: any; - - /** returns the outer HTML of PivotClient control. - */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotClient model. - */ - model?: ej.PivotClient.Model; - - /** returns the name of the event. - */ - type?: string; -} - -export interface RenderFailureEventArgs { - - /** returns the custom object bounded with the control. - */ - customObject?: any; - - /** returns the outer HTML of PivotClient control. - */ - element?: string; - - /** returns the error message with error code. - */ - message?: any; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotClient model. - */ - model?: ej.PivotClient.Model; - - /** returns the name of the event. - */ - type?: string; -} - -export interface RenderSuccessEventArgs { - - /** returns the custom object bounded with the control. - */ - customObject?: any; - - /** returns the outer HTML of PivotClient control. - */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotClient model. - */ - model?: ej.PivotClient.Model; - - /** returns the name of the event. - */ - type?: string; + pagerOptions?: DataSourcePagerOptions; } export interface DisplaySettings { - /** Let’s the user to customize the display of PivotChart and PivotGrid widgets, either in tab view or in tile view. + /** Lets the user to customize the display of PivotChart and PivotGrid widgets, either in tabs or tiles. * @Default {ej.PivotClient.ControlPlacement.Tab} */ controlPlacement?: ej.PivotClient.ControlPlacement|string; - /** Let’s the user to set either Chart or Grid as the start-up widget. + /** Lets the user to set either Chart or Grid as the start-up widget. * @Default {ej.PivotClient.DefaultView.Grid} */ defaultView?: ej.PivotClient.DefaultView|string; - /** Enables/disables the full screen view of PivotChart and PivotGrid in PivotClient. + /** Lets the user to have an option for switching to full screen view of PivotChart and PivotGrid from default view in PivotClient. * @Default {false} */ enableFullScreen?: boolean; - /** Enhances the space for PivotGrid and PivotChart, by hiding Cube Browser and Axis Element Builder. + /** Enables an option to enhance the space for PivotGrid and PivotChart by hiding Cube Browser and Axis Element Builder. * @Default {false} */ enableTogglePanel?: boolean; @@ -25488,103 +26464,121 @@ export interface DisplaySettings { export interface ServiceMethodSettings { - /** Allows the user to set the custom name for the service method that’s responsible for updating the entire report and widget, while changing the Cube. + /** Allows the user to set the custom name for the service method responsible for updating the entire report and widget, while changing the Cube. * @Default {CubeChanged} */ cubeChanged?: string; - /** Allows the user to set the custom name for the service method that’s responsible for exporting. + /** Allows the user to set the custom name for the service method responsible for exporting. * @Default {Export} */ exportPivotClient?: string; - /** Allows the user to set the custom name for the service method that’s responsible to get the members, for the tree-view inside member-editor dialog. + /** Allows the user to set the custom name for the service method responsible to get the members for the tree-view, inside member-editor dialog. * @Default {FetchMemberTreeNodes} */ fetchMemberTreeNodes?: string; - /** Allows the user to set the custom name for the service method that’s responsible for fetching the report names from the database. + /** Allows the user to set the custom name for the service method responsible for fetching the report names from the database. * @Default {FetchReportListFromDB} */ fetchReportList?: string; - /** Allows the user to set the custom name for the service method that’s responsible for updating report while filtering members. + /** Allows the user to set the custom name for the service method responsible for updating report while filtering members. * @Default {FilterElement} */ filterElement?: string; - /** Allows the user to set the custom name for the service method that’s responsible for initializing PivotClient. + /** Allows the user to set the custom name for the service method responsible for initializing PivotClient. * @Default {InitializeClient} */ initialize?: string; - /** Allows the user to set the custom name for the service method that’s responsible for loading the report collection from the database. + /** Allows the user to set the custom name for the service method responsible for loading a report collection from the database. * @Default {LoadReportFromDB} */ loadReport?: string; - /** Allows the user to set the custom name for the service method that’s responsible for retrieving the MDX query for the current report. + /** Allows the user to set the custom name for the service method responsible for retrieving the MDX query for the current report. * @Default {GetMDXQuery} */ mdxQuery?: string; - /** Allows the user to set the custom name for the service method that’s responsible for updating the tree-view inside Cube Browser, while changing the measure group. + /** Allows the user to set the custom name for the service method responsible for updating the tree-view inside Cube Browser, while changing the measure group. * @Default {MeasureGroupChanged} */ measureGroupChanged?: string; - /** Allows the user to set the custom name for the service method that’s responsible to get the child members, on tree-view node expansion. + /** Allows the user to set the custom name for the service method responsible to get the child members, on tree-view node expansion. * @Default {MemberExpanded} */ memberExpand?: string; - /** Allows the user to set the custom name for the service method that’s responsible for updating report while dropping a node/SplitButton inside Axis Element Builder. + /** Allows the user to set the custom name for the service method responsible for updating report while dropping a node/SplitButton inside Axis Element Builder. * @Default {NodeDropped} */ nodeDropped?: string; - /** Allows the user to set the custom name for the service method that’s responsible for updating report while removing SplitButton from Axis Element Builder. + /** Allows the user to set the custom name for the service method responsible for updating report while removing SplitButton from Axis Element Builder. * @Default {RemoveSplitButton} */ removeSplitButton?: string; - /** Allows the user to set the custom name for the service method that’s responsible for saving the report collection to database. + /** Allows the user to set the custom name for the service method responsible for saving the report collection to database. * @Default {SaveReportToDB} */ saveReport?: string; - /** Allows the user to set the custom name for the service method that’s responsible for toggling the elements in row and column axes. + /** Allows the user to set the custom name for the service method responsible for toggling the elements in row and column axes. * @Default {ToggleAxis} */ toggleAxis?: string; - /** Allows the user to set the custom name for the service method that’s responsible for any toolbar operation. + /** Allows the user to set the custom name for the service method responsible for all the toolbar operations. * @Default {ToolbarOperations} */ toolbarServices?: string; - /** Allows the user to set the custom name for the service method that’s responsible for updating report collection. + /** Allows the user to set the custom name for the service method responsible for updating report collection. * @Default {UpdateReport} */ updateReport?: string; + + /** Allows the user to set the custom name for the service method responsible on navigating between pages in paged PivotClient. + * @Default {Paging} + */ + paging?: string; } +enum ClientExportMode{ + + ///Exports both the PivotChart and PivotGrid on exporting. + ChartAndGrid, + + ///Exports the PivotChart control alone on exporting. + ChartOnly, + + ///Exports the PivotGrid control alone on exporting. + GridOnly +} + + enum ControlPlacement{ - ///To display PivotChart and PivotGrid widgets in tab view. + ///Displays PivotChart and PivotGrid widgets in separate tabs. Tab, - ///To display PivotChart and PivotGrid widgets within the same view, one below the other. + ///Displays PivotChart and PivotGrid widgets one above the other. Tile } enum DefaultView{ - ///To set PivotChart as a default control in view when the PivotClient widget is loaded for the first time. + ///To set PivotChart as a default control in view. Chart, - ///To set PivotGrid as a default control in view when the PivotClient widget is loaded for the first time. + ///To set PivotGrid as a default control in view. Grid } @@ -25601,56 +26595,17 @@ enum DisplayMode{ ChartAndGrid } -} -module PivotChart -{ -enum ChartTypes -{ -//To render a Line type for PivotChart. -Line, -//To render a Spline type for PivotChart. -Spline, -//To render a Column type for PivotChart. -Column, -//To render a Area type for PivotChart. -Area, -//To render a SplineArea type for PivotChart. -SplineArea, -//To render a StepLine type for PivotChart. -StepLine, -//To render a StepArea type for PivotChart. -StepArea, -//To render a Pie type for PivotChart. -Pie, -//To render a Bar type for PivotChart. -Bar, -//To render a StackingArea type for PivotChart. -StackingArea, -//To render a StackingColumn type for PivotChart. -StackingColumn, -//To render a StackingBar type for PivotChart. -StackingBar, -//To render a Pyramid type for PivotChart. -Pyramid, -//To render a Funnel type for PivotChart. -Funnel, -//To render a Doughnut type for PivotChart. -Doughnut, -//To render a Scatter type for PivotChart. -Scatter, -//To render a Bubble type for PivotChart. -Bubble, -} } class PivotGauge extends ej.Widget { static fn: PivotGauge; constructor(element: JQuery, options?: PivotGauge.Model); constructor(element: Element, options?: PivotGauge.Model); + static Locale: any; model:PivotGauge.Model; defaults:PivotGauge.Model; - /** Perform an asynchronous HTTP (AJAX) request. + /** Performs an asynchronous HTTP (AJAX) request. * @returns {void} */ doAjaxPost(): void; @@ -25660,36 +26615,56 @@ class PivotGauge extends ej.Widget { */ refresh(): void; - /** This function removes the KPI related images from PivotGauge. + /** This function removes the KPI related images from PivotGauge on binding OLAP datasource. * @returns {void} */ removeImg(): void; - /** This function receives the JSON formatted datasource to render the PivotGauge control. + /** This function receives the JSON formatted datasource and renders the PivotGauge control. * @returns {void} */ renderControlFromJSON(): void; + + /** Returns the OlapReport string maintained along with the axis elements information. + * @returns {void} + */ + getOlapReport(): void; + + /** Sets the OlapReport string along with the axis information and maintains it in a property. + * @returns {void} + */ + setOlapReport(): void; + + /** Returns the JSON records formed to render the control. + * @returns {void} + */ + getJSONRecords(): void; + + /** Sets the JSON records to render the control. + * @returns {void} + */ + setJSONRecords(): void; + + /** Returns the JSON records required to render the PivotGauge on performing any action with OLAP data source. + * @returns {void} + */ + getJSONData(): void; } export module PivotGauge{ export interface Model { - /** Specifies the background color of pivot gauge. - * @Default {null} - */ - backgroundColor?: string; - - /** Sets the number of column count to arrange the PivotGauge's. + /** Sets the number of columns to arrange the Pivot Gauges. * @Default {0} */ columnsCount?: number; - /** Specify the CSS class to PivotGauge to achieve custom theme. + /** Specifies the CSS class to PivotGauge to achieve custom theme. * @Default {“”} */ cssClass?: string; - /** Object utilized to pass additional information between client-end and service-end. + /** Object utilized to pass additional information between client-end and service-end on operating in server mode. * @Default {{}} */ customObject?: any; @@ -25699,6 +26674,11 @@ export interface Model { */ dataSource?: DataSource; + /** Enables/disables the animation of pointer in PivotGauge. + * @Default {false} + */ + enableAnimation?: boolean; + /** Enables/disables tooltip visibility in PivotGauge. * @Default {false} */ @@ -25724,7 +26704,7 @@ export interface Model { */ locale?: string; - /** Sets the number of row count to arrange the PivotGauge's. + /** Sets the number of rows to arrange the Pivot Gauges. * @Default {0} */ rowsCount?: number; @@ -25744,17 +26724,30 @@ export interface Model { */ showHeaderLabel?: boolean; - /** Connects the service using the specified URL for any server updates. + /** Connects the service using the specified URL for any server updates on server mode operation. * @Default {“”} */ url?: string; + /** Sets the mode for the PivotGauge widget for binding either OLAP or Relational data source. + * @Default {ej.Pivot.AnalysisMode.Pivot} + */ + analysisMode?: ej.Pivot.AnalysisMode|string; + + /** Sets the mode for the PivotGauge widget for binding data source either in server-side or client-side. + * @Default {ej.Pivot.OperationalMode.ClientMode} + */ + operationalMode?: ej.Pivot.OperationalMode|string; + /** Triggers when it reaches client-side after any AJAX request. */ afterServiceInvoke? (e: AfterServiceInvokeEventArgs): void; /** Triggers before any AJAX request is passed from PivotGauge to service methods. */ beforeServiceInvoke? (e: BeforeServiceInvokeEventArgs): void; + /** Triggers before populating the pivot engine on operating in client mode. */ + beforePivotEnginePopulate? (e: BeforePivotEnginePopulateEventArgs): void; + /** Triggers when PivotGauge started loading at client-side. */ load? (e: LoadEventArgs): void; @@ -25770,148 +26763,100 @@ export interface Model { export interface AfterServiceInvokeEventArgs { - /** return the current action of PivotGauge control. - */ - action?: string; - - /** return the custom object bounds with PivotGauge control. + /** returns the custom object bound with PivotGauge control. */ customObject?: any; - /** return the outer HTML of PivotGauge control. + /** returns the HTML element of PivotGauge control. */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotGauge model. - */ - model?: ej.PivotGauge.Model; - - /** returns the name of the event. - */ - type?: string; + element?: any; } export interface BeforeServiceInvokeEventArgs { - /** return the current action of PivotGauge control. - */ - action?: string; - - /** return the custom object bounds with PivotGauge control. + /** returns the custom object bound with PivotGauge control. */ customObject?: any; - /** return the outer HTML of PivotGauge control. + /** returns the HTML element of PivotGauge control. */ - element?: string; + element?: any; +} - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; +export interface BeforePivotEnginePopulateEventArgs { - /** returns the PivotGauge model. + /** returns the current instance of PivotGauge control. */ - model?: ej.PivotGauge.Model; - - /** returns the name of the event. - */ - type?: string; + gaugeObject?: any; } export interface LoadEventArgs { - /** if the event should be canceled; otherwise, false. + /** returns the current action of PivotGauge control. */ - cancel?: boolean; + action?: string; - /** returns the PivotGauge model. + /** returns the model of PivotGauge control. */ - model?: ej.PivotGauge.Model; + model?: any; - /** returns the name of the event. + /** returns the HTML element of the widget. */ - type?: string; + element?: any; + + /** returns the custom object bound to the control. + */ + customObject?: any; } export interface RenderCompleteEventArgs { - /** returns the outer HTML of PivotGauge control. - */ - element?: string; - - /** returns the custom object bounded with the control. + /** returns the custom object bound with PivotGauge control. */ customObject?: any; - /** if the event should be canceled; otherwise, false. + /** returns the HTML element of PivotGauge control. */ - cancel?: boolean; - - /** returns the PivotGauge model. - */ - model?: ej.PivotGauge.Model; - - /** returns the name of the event. - */ - type?: string; + element?: any; } export interface RenderFailureEventArgs { - /** returns the outer HTML of PivotGauge control. + /** returns the HTML element of PivotGauge control. */ - element?: string; + element?: any; - /** returns the custom object bounded with the control. + /** returns the custom object bound with the control. */ customObject?: any; /** returns the error message with error code. */ - message?: any; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotGauge model. - */ - model?: ej.PivotGauge.Model; - - /** returns the name of the event. - */ - type?: string; - - /** returns the JSON formatted response while error occurs. - */ - responseJSON?: any; + message?: string; } export interface RenderSuccessEventArgs { - /** returns the outer HTML of PivotGauge control. + /** returns the HTML element of PivotGauge control. */ - element?: string; + element?: any; - /** returns the custom object bounded with the control. + /** returns the custom object bound with the control. */ customObject?: any; +} - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; +export interface DataSourceColumnsFilterItems { - /** returns the PivotGauge model. + /** Sets the type of filter whether to include/exclude the mentioned values. + * @Default {ej.PivotAnalysis.FilterType.Exclude} */ - model?: ej.PivotGauge.Model; + filterType?: ej.PivotAnalysis.FilterType|string; - /** returns the name of the event. + /** Contains the collection of items to be included/excluded among the field members. + * @Default {[]} */ - type?: string; + values?: Array; } export interface DataSourceColumn { @@ -25920,24 +26865,20 @@ export interface DataSourceColumn { */ fieldName?: string; - /** Allows the user to set the display name for an item. + /** Applies filter to the field members. + * @Default {null} */ - fieldCaption?: string; - - /** Allows the user to enable the usage of named set items in respective axis. This is only applicable for OLAP datasource. - * @Default {false} - */ - isNamedSets?: boolean; + filterItems?: DataSourceColumnsFilterItems; } export interface DataSourceRowsFilterItems { - /** Allows the user to set the type of filtering for an item. - * @Default {exclude} + /** Sets the type of filter whether to include/exclude the mentioned values. + * @Default {ej.PivotAnalysis.FilterType.Exclude} */ - filterType?: string; + filterType?: ej.PivotAnalysis.FilterType|string; - /** Allows the user to set the values for filtering an item. + /** Contains the collection of items to be included/excluded among the field members. * @Default {[]} */ values?: Array; @@ -25949,40 +26890,60 @@ export interface DataSourceRow { */ fieldName?: string; - /** Allows the user to set the display name for an item. - */ - fieldCaption?: string; - - /** Allows the user to set the filtering values name for an item. + /** Applies filter to the field members. * @Default {null} */ filterItems?: DataSourceRowsFilterItems; +} - /** Allows the user to enable the usage of named set items in respective axis. This is only applicable for OLAP datasource. - * @Default {false} +export interface DataSourceValuesMeasure { + + /** Allows the user to bind the measure from OLAP datasource by using its unique name as field name. */ - isNamedSets?: boolean; + fieldName?: string; } export interface DataSourceValue { - /** This holds the measures unique name to bind them from the Cube. - * @Default {[]} - */ - measures?: Array; - - /** Allows to set the axis name to place the measures items. - * @Default {“”} - */ - axis?: string; - - /** Allows the user to bind the item by using its unique name as field name. + /** Allows the user to bind the item by using its unique name as field name for Relational datasource. */ fieldName?: string; - /** Allows the user to set the display name for an item. + /** Allows the user to set the display caption for an item for Relational datasource. */ fieldCaption?: string; + + /** This holds the list of unique names of measures to bind them from the OLAP cube. + * @Default {[]} + */ + measures?: Array; + + /** Allows to set the axis name to place the measures items. + * @Default {rows} + */ + axis?: string; + + /** Indicates whether the field is a calculated field or not with Relational datasource. + * @Default {false} + */ + isCalculatedField?: boolean; + + /** Allows to set the formula for calculation of values for calculated members in Relational datasource. + */ + formula?: string; +} + +export interface DataSourceFiltersFilterItems { + + /** Sets the type of filter whether to include/exclude the mentioned values. + * @Default {ej.PivotAnalysis.FilterType.Exclude} + */ + filterType?: ej.PivotAnalysis.FilterType|string; + + /** Contains the collection of items to be included/excluded among the field members. + * @Default {[]} + */ + values?: Array; } export interface DataSourceFilter { @@ -25991,29 +26952,15 @@ export interface DataSourceFilter { */ fieldName?: string; - /** Allows the user to set the display name for an item. + /** Applies filter to the field members. + * @Default {null} */ - fieldCaption?: string; - - /** Allows the user to enable the usage of named set items in respective axis. This is only applicable for OLAP datasource. - * @Default {false} - */ - isNamedSets?: boolean; + filterItems?: DataSourceFiltersFilterItems; } export interface DataSource { - /** Contains the database name as string type to fetch the data from the given connection string. - * @Default {“”} - */ - catalog?: string; - - /** Lists out the items to be arranged in column section of PivotGauge. - * @Default {[]} - */ - columns?: Array; - - /** Contains the respective Cube name from database as string type. + /** Contains the respective cube name from OLAP database as string type. * @Default {“”} */ cube?: string; @@ -26023,17 +26970,27 @@ export interface DataSource { */ data?: any; - /** Lists out the items to be arranged in row section of PivotGauge. + /** In connection with an OLAP database, this property contains the database name as string to fetch the data from the given connection string. + * @Default {“”} + */ + catalog?: string; + + /** Lists out the items to bind in columns section. + * @Default {[]} + */ + columns?: Array; + + /** Lists out the items to bind in rows section. * @Default {[]} */ rows?: Array; - /** Lists out the items which supports calculation in PivotGauge. + /** Lists out the items supports calculation in PivotGauge. * @Default {[]} */ values?: Array; - /** Lists out the items which supports filtering of values in PivotGauge. + /** Lists out the items which supports filtering of values without displaying the members in UI in PivotGauge. * @Default {[]} */ filters?: Array; @@ -26046,7 +27003,7 @@ export interface LabelFormatSettings { */ numberFormat?: ej.PivotGauge.NumberFormat|string; - /** Allows you to change the position of a digit on the right-hand side of the decimal point for label value. + /** Allows you to set the number of digits displayed after decimal point. * @Default {5} */ decimalPlaces?: number; @@ -26062,7 +27019,7 @@ export interface LabelFormatSettings { export interface ServiceMethodSettings { - /** Allows the user to set the custom name for the service method that’s responsible for initializing PivotGauge. + /** Allows the user to set the custom name for the service method responsible for initializing PivotGauge. * @Default {InitializeGauge} */ initialize?: string; @@ -26098,18 +27055,39 @@ class PivotTreeMap extends ej.Widget { static fn: PivotTreeMap; constructor(element: JQuery, options?: PivotTreeMap.Model); constructor(element: Element, options?: PivotTreeMap.Model); + static Locale: any; model:PivotTreeMap.Model; defaults:PivotTreeMap.Model; - /** Perform an asynchronous HTTP (AJAX) request. + /** Performs an asynchronous HTTP (AJAX) request. * @returns {void} */ doAjaxPost(): void; - /** Perform an asynchronous HTTP (FullPost) submit. + /** Returns the OlapReport string maintained along with the axis elements information. * @returns {void} */ - doPostBack(): void; + getOlapReport(): void; + + /** Sets the OlapReport string along with the axis information and maintains it in a property. + * @returns {void} + */ + setOlapReport(): void; + + /** Returns the JSON records formed to render the control. + * @returns {void} + */ + getJSONRecords(): void; + + /** Sets the JSON records to render the control. + * @returns {void} + */ + setJSONRecords(): void; + + /** Renders the control with the pivot engine obtained from OLAP cube. + * @returns {void} + */ + generateJSON(): void; /** This function receives the JSON formatted datasource to render the PivotTreeMap control. * @returns {void} @@ -26130,11 +27108,6 @@ export interface Model { */ cssClass?: string; - /** Contains the serialized Report at that instant, that is, current Report. - * @Default {“”} - */ - currentReport?: string; - /** Initializes the data source for the PivotTreeMap widget, when it functions completely on client-side. * @Default {{}} */ @@ -26145,11 +27118,6 @@ export interface Model { */ customObject?: any; - /** Allows the user to view the layout of PivotTreeMap from right to left. - * @Default {false} - */ - enableRTL?: boolean; - /** Allows the user to enable PivotTreeMap’s responsiveness in the browser layout. * @Default {false} */ @@ -26161,9 +27129,9 @@ export interface Model { locale?: string; /** Sets the mode for the PivotTreeMap widget for binding data source either in server-side or client-side. - * @Default {ej.PivotTreeMap.OperationalMode.ClientMode} + * @Default {ej.Pivot.OperationalMode.ClientMode} */ - operationalMode?: any; + operationalMode?: ej.Pivot.OperationalMode|string; /** Allows the user to set custom name for the methods at service-end, communicated on AJAX post. * @Default {{}} @@ -26181,6 +27149,12 @@ export interface Model { /** Triggers before any AJAX request is passed from PivotTreeMap to service methods. */ beforeServiceInvoke? (e: BeforeServiceInvokeEventArgs): void; + /** Triggers when PivotTreeMap starts to render. */ + load? (e: LoadEventArgs): void; + + /** Triggers before populating the pivot engine from datasource. */ + beforePivotEnginePopulate? (e: BeforePivotEnginePopulateEventArgs): void; + /** Triggers when drill up/down happens in PivotTreeMap control. And it returns the outer HTML of PivotTreeMap control. */ drillSuccess? (e: DrillSuccessEventArgs): void; @@ -26196,144 +27170,118 @@ export interface Model { export interface AfterServiceInvokeEventArgs { - /** return the current action of PivotTreeMap control. + /** returns the current action of PivotTreeMap control. */ action?: string; - /** return the custom object bounds with PivotTreeMap control. + /** returns the custom object bound with PivotTreeMap control. */ customObject?: any; - /** return the outer HTML of PivotTreeMap control. + /** returns the HTML element of PivotTreeMap control. */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotTreeMap model. - */ - model?: ej.PivotTreeMap.Model; - - /** returns the name of the event. - */ - type?: string; + element?: any; } export interface BeforeServiceInvokeEventArgs { - /** return the current action of PivotTreeMap control. + /** returns the current action of PivotTreeMap control. */ action?: string; - /** return the custom object bounds with PivotTreeMap control. + /** returns the custom object bound with PivotTreeMap control. */ customObject?: any; - /** return the outer HTML of PivotTreeMap control. + /** returns the HTML element of PivotTreeMap control. */ - element?: string; + element?: any; +} - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; +export interface LoadEventArgs { - /** returns the PivotTreeMap model. + /** returns the current action of PivotTreeMap control. */ - model?: ej.PivotTreeMap.Model; + action?: string; - /** returns the name of the event. + /** returns the custom object bound with PivotTreeMap control. */ - type?: string; + customObject?: any; + + /** returns the HTML element of PivotTreeMap control. + */ + element?: any; +} + +export interface BeforePivotEnginePopulateEventArgs { + + /** returns the current instance of PivotTreeMap control. + */ + treeMapObject?: any; } export interface DrillSuccessEventArgs { + + /** return the HTML element of PivotTreeMap control. + */ + element?: any; } export interface RenderCompleteEventArgs { - /** return the current action of PivotTreeMap control. + /** returns the current action of PivotTreeMap control. */ action?: string; - /** return the custom object bounds with PivotTreeMap control. + /** returns the custom object bound with PivotTreeMap control. */ customObject?: any; - /** return the outer HTML of PivotTreeMap control. + /** returns the HTML element of PivotTreeMap control. */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotTreeMap model. - */ - model?: ej.PivotTreeMap.Model; - - /** returns the name of the event. - */ - type?: string; + element?: any; } export interface RenderFailureEventArgs { - /** return the current action of PivotTreeMap control. + /** returns the current action of PivotTreeMap control. */ action?: string; - /** return the custom object bounds with PivotTreeMap control. + /** returns the custom object bound with PivotTreeMap control. */ customObject?: any; - /** return the error stack trace of the original exception. + /** returns the HTML element of PivotTreeMap control. */ - message?: any; + element?: any; - /** return the outer HTML of PivotTreeMap control. + /** returns the error stack trace of the original exception. */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotTreeMap model. - */ - model?: ej.PivotTreeMap.Model; - - /** returns the name of the event. - */ - type?: string; + message?: string; } export interface RenderSuccessEventArgs { - /** return the current action of PivotTreeMap control. + /** returns the current action of PivotTreeMap control. */ action?: string; - /** return the custom object bounds with PivotTreeMap control. + /** returns the custom object bound with PivotTreeMap control. */ customObject?: any; - /** return the outer HTML of PivotTreeMap control. + /** returns the HTML element of PivotTreeMap control. */ - element?: string; + element?: any; +} - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; +export interface DataSourceColumnsFilterItems { - /** returns the PivotTreeMap model. + /** Contains the collection of items to be excluded among the field members. + * @Default {[]} */ - model?: ej.PivotTreeMap.Model; - - /** returns the name of the event. - */ - type?: string; + values?: Array; } export interface DataSourceColumn { @@ -26342,14 +27290,23 @@ export interface DataSourceColumn { */ fieldName?: string; - /** Allows the user to set the display name for an item. - */ - fieldCaption?: string; - - /** Allows the user to enable the usage of named set items in respective axis. This is only applicable for OLAP datasource. + /** Allows the user to indicate whether the added item is a named set or not. * @Default {false} */ isNamedSets?: boolean; + + /** Applies filter to the field members. + * @Default {null} + */ + filterItems?: DataSourceColumnsFilterItems; +} + +export interface DataSourceRowsFilterItems { + + /** Contains the collection of items to be excluded among the field members. + * @Default {[]} + */ + values?: Array; } export interface DataSourceRow { @@ -26358,35 +27315,43 @@ export interface DataSourceRow { */ fieldName?: string; - /** Allows the user to set the display name for an item. - */ - fieldCaption?: string; - - /** Allows the user to enable the usage of named set items in respective axis. This is only applicable for OLAP datasource. + /** Allows the user to indicate whether the added item is a named set or not. * @Default {false} */ isNamedSets?: boolean; + + /** Applies filter to the field members. + * @Default {null} + */ + filterItems?: DataSourceRowsFilterItems; +} + +export interface DataSourceValuesMeasure { + + /** Allows the user to bind the measure from OLAP datasource by using its unique name as field name. + */ + fieldName?: string; } export interface DataSourceValue { - /** This holds the measures unique name to bind them from the Cube. + /** This holds the list of unique names of measures to bind them from the OLAP cube. * @Default {[]} */ - measures?: Array; + measures?: Array; /** Allows to set the axis name to place the measures items. - * @Default {“”} + * @Default {rows} */ axis?: string; +} - /** Allows the user to bind the item by using its unique name as field name. - */ - fieldName?: string; +export interface DataSourceFiltersFilterItems { - /** Allows the user to set the display name for an item. + /** Contains the collection of items to be excluded among the field members. + * @Default {[]} */ - fieldCaption?: string; + values?: Array; } export interface DataSourceFilter { @@ -26395,49 +27360,45 @@ export interface DataSourceFilter { */ fieldName?: string; - /** Allows the user to set the display name for an item. + /** Applies filter to the field members. + * @Default {null} */ - fieldCaption?: string; - - /** Allows the user to enable the usage of named set items in respective axis. This is only applicable for OLAP datasource. - * @Default {false} - */ - isNamedSets?: boolean; + filterItems?: DataSourceFiltersFilterItems; } export interface DataSource { - /** Contains the database name as string type to fetch the data from the given connection string. - * @Default {“”} - */ - catalog?: string; - - /** Lists out the items to be arranged in column section of PivotTreeMap. - * @Default {[]} - */ - columns?: Array; - - /** Contains the respective Cube name from database as string type. - * @Default {“”} - */ - cube?: string; - /** Provides the raw data source for the PivotTreeMap. * @Default {null} */ data?: any; - /** Lists out the items to be arranged in row section of PivotTreeMap. + /** Contains the respective cube name from OLAP database as string type. + * @Default {“”} + */ + cube?: string; + + /** In connection with an OLAP database, this property contains the database name as string to fetch the data from the given connection string. + * @Default {“”} + */ + catalog?: string; + + /** Lists out the items to be displayed as series of PivotTreeMap. + * @Default {[]} + */ + columns?: Array; + + /** Lists out the items to be displayed as segments of PivotTreeMap. * @Default {[]} */ rows?: Array; - /** Lists out the items which supports calculation in PivotTreeMap. + /** Lists out the items supports calculation in PivotTreeMap. * @Default {[]} */ values?: Array; - /** Lists out the items which supports filtering of values in PivotTreeMap. + /** Lists out the items which supports filtering of values without displaying the members in UI in PivotTreeMap. * @Default {[]} */ filters?: Array; @@ -26445,12 +27406,12 @@ export interface DataSource { export interface ServiceMethodSettings { - /** Allows the user to set the custom name for the service method that’s responsible for initializing PivotTreeMap. + /** Allows the user to set the custom name for the service method responsible for initializing PivotTreeMap. * @Default {InitializeTreemap} */ initialize?: string; - /** Allows the user to set the custom name for the service method that’s responsible for drilling up/down operation in PivotTreeMap. + /** Allows the user to set the custom name for the service method responsible for drilling up/down operation in PivotTreeMap. * @Default {DrillTreeMap} */ drillDown?: string; @@ -26461,6 +27422,7 @@ class Schedule extends ej.Widget { static fn: Schedule; constructor(element: JQuery, options?: Schedule.Model); constructor(element: Element, options?: Schedule.Model); + static Locale: any; model:Schedule.Model; defaults:Schedule.Model; @@ -26540,6 +27502,11 @@ class Schedule extends ej.Widget { * @returns {void} */ refreshAppointments(): void; + + /** Passes the server-side action and data to the client-side for rendering the modified appointment list on the Schedule control. + * @returns {void} + */ + notifyChanges(): void; } export module Schedule{ @@ -28176,6 +29143,7 @@ class RecurrenceEditor extends ej.Widget { static fn: RecurrenceEditor; constructor(element: JQuery, options?: RecurrenceEditor.Model); constructor(element: Element, options?: RecurrenceEditor.Model); + static Locale: any; model:RecurrenceEditor.Model; defaults:RecurrenceEditor.Model; @@ -28283,6 +29251,7 @@ class Gantt extends ej.Widget { static fn: Gantt; constructor(element: JQuery, options?: Gantt.Model); constructor(element: Element, options?: Gantt.Model); + static Locale: any; model:Gantt.Model; defaults:Gantt.Model; @@ -28301,10 +29270,10 @@ class Gantt extends ej.Widget { selectCells(Indexes: Array, preservePreviousSelectedCell: boolean): void; /** Positions the splitter by the specified column index. - * @param {number} Set the splitter position based on column index. + * @param {Number} Set the splitter position based on column index. * @returns {void} */ - setSplitterIndex(index: number): void; + setSplitterIndex(index: Number): void; /** To cancel the edited state of an item in Gantt * @returns {void} @@ -28332,10 +29301,10 @@ class Gantt extends ej.Widget { expandAllItems(): void; /** To expand and collapse an item in Gantt using item's ID - * @param {number} Expand or Collapse a record based on task id. + * @param {Number} Expand or Collapse a record based on task id. * @returns {void} */ - expandCollapseRecord(taskId: number): void; + expandCollapseRecord(taskId: Number): void; /** To hide the column by using header text * @param {string} you can pass a header text of a column to hide @@ -28619,6 +29588,21 @@ export interface Model { */ parentTaskbarTemplate?: string; + /** Specifies the nature of a task for caluculating the work, and it can fixed duration, fixed work and fixed resource unit + * @Default {ej.Gantt.TaskType.FixedUnit} + */ + taskType?: ej.Gantt.TaskType|string; + + /** Specifies the unit for the work involved in a task and it can be day, hour or minute + * @Default {ej.Gantt.WorkUnit.Hour} + */ + workUnit?: ej.Gantt.WorkUnit|string; + + /** Specifies the task scheduling mode for a project and this will be set to all the tasks available in the project + * @Default {ej.Gantt.TaskSchedulingMode.Auto} + */ + taskSchedulingMode?: ej.Gantt.TaskSchedulingMode|string; + /** Specifies the row selection type. * @Default {ej.Gantt.SelectionType.Single} */ @@ -28628,6 +29612,23 @@ export interface Model { */ parentProgressbarBackground?: string; + /** Specifies the mapping property path for resource's percent effort involved in a task in datasource + */ + resourceUnitMapping?: string; + + /** Specifies the mapping property path for the task description in datasource + */ + notesMapping?: string; + + /** Specifies the mapping property path for the task scheuling mode for a task in datasource + * @Default {auto} + */ + taskSchedulingModeMapping?: string; + + /** Specifies the mapping property path for task duration unit in datasoruce + */ + durationUnitMapping?: string; + /** Specifies the background of parent taskbar in Gantt */ parentTaskbarBackground?: string; @@ -28673,6 +29674,11 @@ export interface Model { */ renderBaseline?: boolean; + /** Enables or disables the schedule date validation while connecting a manually scheduled task with predecessor + * @Default {false} + */ + validateManaulTasksOnLinking?: boolean; + /** Specifies the mapping property name for resource ID in resource Collection in Gantt */ resourceIdMapping?: string; @@ -29205,7 +30211,7 @@ export interface CollapsedEventArgs { /** Returns the row index of collapsed record. */ - recordIndex?: number; + recordIndex?: Number; /** Returns the data of collapsed record. */ @@ -29228,7 +30234,7 @@ export interface CollapsingEventArgs { /** Returns the row index of collapsing record. */ - recordIndex?: number; + recordIndex?: Number; /** Returns the data of edited cell record.. */ @@ -29753,6 +30759,45 @@ enum BeginEditAction{ } +enum TaskType{ + + ///Resource unit reamins constant while editing the work and duration values. + FixedUnit, + + ///Work value of a task remains constant while editing duration and resoruce unit values. + FixedWork, + + ///Duration value remains constant while editing work and resoruce unit values. + FixedDuration +} + + +enum WorkUnit{ + + ///Dislays the work involved in a task in days. + Day, + + ///Dislays the work involved in a task in hours. + Hour, + + ///Dislays the work involved in a task in minutes + Minute +} + + +enum TaskSchedulingMode{ + + ///All the tasks in the project will be displayed in auto scheduled mode, where the tasks are scheduled automatically over non-working days and holidays. + Auto, + + ///All the tasks in the project will be displayed in manually scheduled mode. + Manual, + + ///Project consists of tasks with both auto and manually scheduled modes, based on the datasource values + Custom +} + + enum SelectionType{ ///you can select a single row. @@ -29842,6 +30887,7 @@ class ReportViewer extends ej.Widget { static fn: ReportViewer; constructor(element: JQuery, options?: ReportViewer.Model); constructor(element: Element, options?: ReportViewer.Model); + static Locale: any; model:ReportViewer.Model; defaults:ReportViewer.Model; @@ -29927,7 +30973,7 @@ export interface Model { /** Enables or disables the page cache of report. * @Default {false} */ - enablePageCache?: boolean; + enablePageCache?: Boolean; /** Specifies the export settings. */ @@ -29936,12 +30982,12 @@ export interface Model { /** When set to true, adapts the report layout to fit the screen size of devices on which it renders. * @Default {true} */ - isResponsive?: boolean; + isResponsive?: Boolean; /** Specifies the locale for report viewer. * @Default {en-US} */ - locale?: string; + locale?: String; /** Specifies the page settings. */ @@ -29955,7 +31001,7 @@ export interface Model { /** Enables and disables the print mode. * @Default {false} */ - printMode?: boolean; + printMode?: Boolean; /** Specifies the print option of the report. * @Default {ej.ReportViewer.PrintOptions.Default} @@ -29975,17 +31021,17 @@ export interface Model { /** Gets or sets the path of the report file. * @Default {empty} */ - reportPath?: string; + reportPath?: String; /** Gets or sets the reports server URL. * @Default {empty} */ - reportServerUrl?: string; + reportServerUrl?: String; /** Specifies the report Web API service URL. * @Default {empty} */ - reportServiceUrl?: string; + reportServiceUrl?: String; /** Specifies the toolbar settings. */ @@ -29994,7 +31040,7 @@ export interface Model { /** Gets or sets the zoom factor for report viewer. * @Default {1} */ - zoomFactor?: number; + zoomFactor?: Number; /** Fires when the report viewer is destroyed successfully.If you want to perform any operation after destroying the reportviewer control,you can make use of the destroy event. */ destroy? (e: DestroyEventArgs): void; @@ -30162,7 +31208,7 @@ export interface DataSource { /** Gets or sets the name of the data source. * @Default {empty} */ - name?: string; + name?: String; /** Gets or sets the values of data source. * @Default {[]} @@ -30211,17 +31257,17 @@ export interface Parameter { /** Gets or sets the name of the parameter. * @Default {empty} */ - name?: string; + name?: String; /** Gets or sets whether the parameter allows nullable value or not. * @Default {false} */ - nullable?: boolean; + nullable?: Boolean; /** Gets or sets the prompt message associated with the specified parameter. * @Default {empty} */ - prompt?: string; + prompt?: String; /** Gets or sets the parameter values. * @Default {[]} @@ -30234,7 +31280,7 @@ export interface ToolbarSettings { /** Fires when user click on toolbar item in the toolbar. * @Default {empty} */ - click?: string; + click?: String; /** Specifies the toolbar items. * @Default {ej.ReportViewer.ToolbarItems.All} @@ -30244,17 +31290,17 @@ export interface ToolbarSettings { /** Shows or hides the toolbar. * @Default {true} */ - showToolbar?: boolean; + showToolbar?: Boolean; /** Shows or hides the tooltip of toolbar items. * @Default {true} */ - showTooltip?: boolean; + showTooltip?: Boolean; /** Specifies the toolbar template ID. * @Default {empty} */ - templateId?: string; + templateId?: String; } enum ExportOptions{ @@ -30478,6 +31524,7 @@ class TreeGrid extends ej.Widget { static fn: TreeGrid; constructor(element: JQuery, options?: TreeGrid.Model); constructor(element: Element, options?: TreeGrid.Model); + static Locale: any; model:TreeGrid.Model; defaults:TreeGrid.Model; @@ -30706,7 +31753,7 @@ export interface Model { */ isResponsive?: boolean; - /** Specifies the name of the field in the dataSource, which contains the parent’s id. This is necessary to form a parent-child hierarchy, if the dataSource contains self-referential data. + /** Specifies the name of the field in the dataSource, which contains the parent's id. This is necessary to form a parent-child hierarchy, if the dataSource contains self-referential data. */ parentIdMapping?: string; @@ -30738,22 +31785,16 @@ export interface Model { */ selectedRowIndex?: number; - /** Specifies the type of selection whether to select row or cell. - * @Default {ej.TreeGrid.SelectionMode.Row} + /** Specifies the settings for row and cell selection. */ - selectionMode?: ej.TreeGrid.SelectionMode|string; - - /** Specifies the type of selection whether to select single row or multiple rows. - * @Default {ej.TreeGrid.SelectionType.Single} - */ - selectionType?: ej.TreeGrid.SelectionType|string; + selectionSettings?: SelectionSettings; /** Enables/disables the options for inserting , deleting and renaming columns. * @Default {false} */ showColumnOptions?: boolean; - /** Controls the visibility of the menu button, which is displayed on the column header. Clicking on this button will show a popup menu. When you choose “Columns” item from this popup, a list box with column names will be shown, from which you can select/deselect a column name to control the visibility of the respective columns. + /** Controls the visibility of the menu button, which is displayed on the column header. Clicking on this button will show a popup menu. When you choose Columns item from this popup, a list box with column names will be shown, from which you can select/deselect a column name to control the visibility of the respective columns. * @Default {false} */ showColumnChooser?: boolean; @@ -31604,6 +32645,11 @@ export interface Column { */ headerText?: string; + /** Enables or disables the checkbox visibility in a column to make it as a checkbox column + * @Default {false} + */ + showCheckbox?: boolean; + /** Controls the visibility of the column. * @Default {true} */ @@ -31611,7 +32657,7 @@ export interface Column { /** Specifies the header template value for the column header */ - headerTemplateID?: string; + headerTemplateID?: String; /** Specifies the display format of a column * @Default {null} @@ -31640,7 +32686,7 @@ export interface Column { /** Specifies the template for the TreeGrid column */ - templateID?: string; + templateID?: String; /** Enables or disables the ability to edit a row or cell. * @Default {false} @@ -31763,6 +32809,29 @@ export interface PageSettings { template?: string; } +export interface SelectionSettings { + + /** Specifies the type of selection whether to select row or cell. + * @Default {ej.TreeGrid.SelectionMode.Row} + */ + selectionMode?: ej.TreeGrid.SelectionMode|string; + + /** Specifies the type of selection whether single, multiple or checkbox. + * @Default {ej.TreeGrid.SelectionType.Single} + */ + selectionType?: ej.TreeGrid.SelectionType|string; + + /** Enables or disables the selection by hierarchy in check box selection + * @Default {true} + */ + enableHierarchySelection?: boolean; + + /** Toggles the visibility of the checkbox in column header, using which all the check boxes can be selected or unselected. + * @Default {true} + */ + enableSelectAll?: boolean; +} + export interface SizeSettings { /** Height of the TreeGrid. @@ -31887,7 +32956,10 @@ enum SelectionType{ Single, ///you can select a multiple row. - Multiple + Multiple, + + ///you can select rows using checkbox. + Checkbox } } @@ -31896,6 +32968,7 @@ class GroupButton extends ej.Widget { static fn: GroupButton; constructor(element: JQuery, options?: GroupButton.Model); constructor(element: Element, options?: GroupButton.Model); + static Locale: any; model:GroupButton.Model; defaults:GroupButton.Model; @@ -31956,14 +33029,14 @@ class GroupButton extends ej.Widget { hideItem(element: JQuery): void; /** Returns the disabled state of the specified element button element in GroupButton as Boolean. - * @returns {boolean} + * @returns {Boolean} */ - isDisabled(): boolean; + isDisabled(): Boolean; /** Returns the state of the specified button element as Boolean. - * @returns {boolean} + * @returns {Boolean} */ - isSelected(): boolean; + isSelected(): Boolean; /** Public method used to select the specified button element from the ejGroupButton control. * @param {JQuery} Specific button element @@ -32229,6 +33302,7 @@ class NavigationDrawer extends ej.Widget { static fn: NavigationDrawer; constructor(element: JQuery, options?: NavigationDrawer.Model); constructor(element: Element, options?: NavigationDrawer.Model); + static Locale: any; model:NavigationDrawer.Model; defaults:NavigationDrawer.Model; @@ -32358,6 +33432,7 @@ class RadialMenu extends ej.Widget { static fn: RadialMenu; constructor(element: JQuery, options?: RadialMenu.Model); constructor(element: Element, options?: RadialMenu.Model); + static Locale: any; model:RadialMenu.Model; defaults:RadialMenu.Model; @@ -32506,7 +33581,7 @@ export interface ClickEventArgs { /** returns the name of item */ - itemName?: string; + itemName?: String; } export interface OpenEventArgs { @@ -32605,6 +33680,7 @@ class Tile extends ej.Widget { static fn: Tile; constructor(element: JQuery, options?: Tile.Model); constructor(element: Element, options?: Tile.Model); + static Locale: any; model:Tile.Model; defaults:Tile.Model; @@ -32945,10 +34021,227 @@ enum TileSize{ } +class Signature extends ej.Widget { + static fn: Signature; + constructor(element: JQuery, options?: Signature.Model); + constructor(element: Element, options?: Signature.Model); + static Locale: any; + model:Signature.Model; + defaults:Signature.Model; + + /** Clears the strokes in the signature. + * @returns {void} + */ + clear(): void; + + /** Destroys the signature widget. + * @returns {void} + */ + destroy(): void; + + /** Disables the signature widget. + * @returns {void} + */ + disable(): void; + + /** Enables the signature widget. + * @returns {void} + */ + enable(): void; + + /** Hides the signature widget. + * @returns {void} + */ + hide(): void; + + /** redo the last drawn stroke of the signature + * @returns {void} + */ + redo(): void; + + /** used to save the drawn image. + * @returns {void} + */ + save(): void; + + /** Used to Show the signature widget, if it is already hided. + * @returns {void} + */ + show(): void; + + /** undo the last drawn stroke of the signature. + * @returns {void} + */ + undo(): void; +} +export module Signature{ + +export interface Model { + + /** This property is used to set the background color for the signature. + * @Default {#ffffff} + */ + backgroundColor?: string; + + /** This property is used to set the background image for the signature. + */ + backgroundImage?: string; + + /** Enables or disables the Signature textbox widget. + * @Default {true} + */ + enabled?: Boolean; + + /** Sets the height of the Signature control. + * @Default {100%} + */ + height?: string; + + /** Enables/disables responsive support for the signature control (i.e) maintain the signature drawing during the window resizing time. + * @Default {false} + */ + isResponsive?: Boolean; + + /** Allows the type of the image format to be saved when the signature image is saved. + */ + saveImageFormat?: ej.Signature.SaveImageFormat|string; + + /** Allows the signature image to be saved along with its background. + * @Default {false} + */ + saveWithBackground?: Boolean; + + /** Enables or disables rounded corner. + * @Default {true} + */ + showRoundedCorner?: Boolean; + + /** Sets the stroke color for the stroke of the signature. + * @Default {#000000} + */ + strokeColor?: string; + + /** Sets the stroke width for the stroke of the signature. + * @Default {2} + */ + strokeWidth?: Number; + + /** Sets the width of the Signature control. + * @Default {100%} + */ + width?: string; + + /** Triggers when the stroke is changed. */ + change? (e: ChangeEventArgs): void; + + /** Triggered when the pointer is clicked or touched in the signature canvas. */ + mouseDown? (e: MouseDownEventArgs): void; + + /** Triggered when the pointer is moved in the signature canvas. */ + mouseMove? (e: MouseMoveEventArgs): void; + + /** Triggered when the pointer is released after click or touch in the signature canvas. */ + mouseUp? (e: MouseUpEventArgs): void; +} + +export interface ChangeEventArgs { + + /** Set this option to true to cancel the event. + */ + cancel?: Boolean; + + /** Instance of the signature model object. + */ + model?: any; + + /** Name of the event. + */ + type?: String; + + /** Gives the last stored image + */ + lastImage?: String; +} + +export interface MouseDownEventArgs { + + /** Set this option to true to cancel the event. + */ + cancel?: Boolean; + + /** Instance of the signature model object. + */ + model?: any; + + /** Name of the event. + */ + type?: String; + + /** returns all the event values + */ + value?: any; +} + +export interface MouseMoveEventArgs { + + /** Set this option to true to cancel the event. + */ + cancel?: Boolean; + + /** Instance of the signature model object. + */ + model?: any; + + /** Name of the event. + */ + type?: String; + + /** returns all the event values + */ + value?: any; +} + +export interface MouseUpEventArgs { + + /** Set this option to true to cancel the event. + */ + cancel?: Boolean; + + /** Instance of the signature model object. + */ + model?: any; + + /** Name of the event. + */ + type?: String; + + /** returns all the event values + */ + value?: any; +} + +enum SaveImageFormat{ + + ///To save the signature image with PNG format only. + PNG, + + ///To save the signature image with JPG format only. + JPG, + + ///To save the signature image with BMP format only. + BMP, + + ///To save the signature image with TIFF format only. + TIFF +} + +} + class RadialSlider extends ej.Widget { static fn: RadialSlider; constructor(element: JQuery, options?: RadialSlider.Model); constructor(element: Element, options?: RadialSlider.Model); + static Locale: any; model:RadialSlider.Model; defaults:RadialSlider.Model; @@ -32969,66 +34262,66 @@ export interface Model { /** To show the RadialSlider in initial render. * @Default {false} */ - autoOpen?: boolean; + autoOpen?: Boolean; /** Sets the root class for RadialSlider theme. This cssClass API helps to use custom skinning option for RadialSlider control. By defining the root class using this API, we need to include this root class in CSS. */ - cssClass?: string; + cssClass?: String; /** To enable Animation for Radial Slider. * @Default {true} */ - enableAnimation?: boolean; + enableAnimation?: Boolean; /** Enable/Disable the Roundoff property of RadialSlider * @Default {true} */ - enableRoundOff?: boolean; + enableRoundOff?: Boolean; /** Specifies the endAngle value for radial slider circle. * @Default {360} */ - endAngle?: number; + endAngle?: Number; /** Specifies the inline for label show or not on given radius. * @Default {false} */ - inline?: boolean; + inline?: Boolean; /** Specifies innerCircleImageClass, using this property we can give images for center radial circle through CSS classes. * @Default {null} */ - innerCircleImageClass?: string; + innerCircleImageClass?: String; /** Specifies the file name of center circle icon * @Default {null} */ - innerCircleImageUrl?: string; + innerCircleImageUrl?: String; /** Specifies the Space between the radial slider element and the label. * @Default {30} */ - labelSpace?: number; + labelSpace?: Number; /** Specifies the radius of radial slider * @Default {200} */ - radius?: number; + radius?: Number; /** To show the RadialSlider inner circle. * @Default {true} */ - showInnerCircle?: boolean; + showInnerCircle?: Boolean; /** Specifies the endAngle value for radial slider circle. * @Default {0} */ - startAngle?: number; + startAngle?: Number; /** Specifies the strokeWidth for customize the needle, outer circle and inner circle. * @Default {2} */ - strokeWidth?: number; + strokeWidth?: Number; /** Specifies the ticks value of radial slider */ @@ -33037,7 +34330,7 @@ export interface Model { /** Specifies the value of radial slider * @Default {10} */ - value?: number; + value?: Number; /** Event triggers when the change occurs. */ change? (e: ChangeEventArgs): void; @@ -33070,7 +34363,7 @@ export interface ChangeEventArgs { /** returns the initial value of Radial slider */ - oldValue?: number; + oldValue?: Number; /** returns the name of the event */ @@ -33078,7 +34371,7 @@ export interface ChangeEventArgs { /** returns the current value of the Radial slider */ - value?: number; + value?: Number; } export interface CreateEventArgs { @@ -33108,7 +34401,7 @@ export interface MouseoverEventArgs { /** returns the value selected */ - selectedValue?: number; + selectedValue?: Number; /** returns the name of the event */ @@ -33116,7 +34409,7 @@ export interface MouseoverEventArgs { /** returns the current value selected in Radial slider */ - value?: number; + value?: Number; } export interface SlideEventArgs { @@ -33131,7 +34424,7 @@ export interface SlideEventArgs { /** returns the value selected in Radial slider */ - selectedValue?: number; + selectedValue?: Number; /** returns the name of the event */ @@ -33139,7 +34432,7 @@ export interface SlideEventArgs { /** returns the currently selected value */ - value?: number; + value?: Number; } export interface StartEventArgs { @@ -33158,7 +34451,7 @@ export interface StartEventArgs { /** returns the current value selected in Radial slider */ - value?: number; + value?: Number; } export interface StopEventArgs { @@ -33177,7 +34470,7 @@ export interface StopEventArgs { /** returns the current value selected in Radial slider */ - value?: number; + value?: Number; } } @@ -33185,15 +34478,16 @@ class Spreadsheet extends ej.Widget { static fn: Spreadsheet; constructor(element: JQuery, options?: Spreadsheet.Model); constructor(element: Element, options?: Spreadsheet.Model); + static Locale: any; model:Spreadsheet.Model; defaults:Spreadsheet.Model; /** This method is used to add custom formulas in Spreadsheet. - * @param {string} Pass the name of the formula. - * @param {string} Pass the name of the function. + * @param {String} Pass the name of the formula. + * @param {String} Pass the name of the function. * @returns {void} */ - addCustomFormula(formulaName: string, functionName: string): void; + addCustomFormula(formulaName: String, functionName: String): void; /** This method is used to add a new sheet in the last position of the sheet container. * @returns {void} @@ -33308,9 +34602,9 @@ class Spreadsheet extends ej.Widget { getActiveCellElem(sheetIdx?: number): HTMLElement; /** This method is used to get the current active sheet index in Spreadsheet. - * @returns {number} + * @returns {Number} */ - getActiveSheetIndex(): number; + getActiveSheetIndex(): Number; /** This method is used to get the auto fill element in Spreadsheet. * @returns {HTMLElement} @@ -33327,21 +34621,21 @@ class Spreadsheet extends ej.Widget { /** This method is used to get the data settings in the Spreadsheet. * @param {number} Pass the sheet index. - * @returns {number} + * @returns {Number} */ - getDataSettings(sheetIdx: number): number; + getDataSettings(sheetIdx: number): Number; /** This method is used to get the frozen columns index in the Spreadsheet. * @param {number} Pass the sheet index. - * @returns {number} + * @returns {Number} */ - getFrozenColumns(sheetIdx: number): number; + getFrozenColumns(sheetIdx: number): Number; /** This method is used to get the frozen row index in Spreadsheet. * @param {number} Pass the sheet index. - * @returns {number} + * @returns {Number} */ - getFrozenRows(sheetIdx: number): number; + getFrozenRows(sheetIdx: number): Number; /** This method is used to get the hyperlink data as object from the specified cell in Spreadsheet. * @param {HTMLElement} Pass the DOM element to get hyperlink @@ -33498,11 +34792,11 @@ class Spreadsheet extends ej.Widget { refreshSpreadsheet(): void; /** This method is used to remove custom formulae in Spreadsheet. - * @param {string} Pass the name of the formula. - * @param {string} Pass the name of the function. + * @param {String} Pass the name of the formula. + * @param {String} Pass the name of the function. * @returns {void} */ - removeCustomFormula(formulaName: string, functionName: string): void; + removeCustomFormula(formulaName: String, functionName: String): void; /** This method is used to remove the hyperlink from selected cells of current sheet. * @param {string} Hyperlink remove from the specified range. @@ -33817,14 +35111,14 @@ export interface XLComment { editComment(targetCell: any): void; /** This method is used to find the next comment from the active cell in Spreadsheet. - * @returns {boolean} + * @returns {Boolean} */ - findNextComment(): boolean; + findNextComment(): Boolean; /** This method is used to find the previous comment from the active cell in Spreadsheet. - * @returns {boolean} + * @returns {Boolean} */ - findPrevComment(): boolean; + findPrevComment(): Boolean; /** This method is used to get comment data for the specified cell. * @param {HTMLElement} Pass the DOM element to get comment data as object. @@ -33908,9 +35202,9 @@ export interface XLEdit { * @param {number} Pass the column index to get the property value. * @param {string} Optional. Pass the property name that you want("value", "value2", "type", "cFormatRule", "range", "thousandSeparator", "rule", "format", "border", "picture", "chart", "calcValue", "align", "hyperlink", "formats", "borders", "tformats", "tborders", "isFilterHeader", "filterState", "tableName", "comment", "formatStr", "decimalPlaces", "cellType"). * @param {number} Optional. Pass the index of the sheet. - * @returns {any|string|Array} + * @returns {any|String|Array} */ - getPropertyValue(rowIdx: number,colIdx: number,prop: string,sheetIdx: number): any|string|Array; + getPropertyValue(rowIdx: number,colIdx: number,prop: string,sheetIdx: number): any|String|Array; /** This method is used to get the property value in specified cell in Spreadsheet. * @param {HTMLElement} Pass the cell element to get property value. @@ -34071,10 +35365,10 @@ export interface XLPivot { createPivotTable(range: string,location: string,name: string,settings: any,pvt: any): void; /** This method is used to delete the pivot table which is selected. - * @param {string} Pass the name of the pivot table. + * @param {String} Pass the name of the pivot table. * @returns {void} */ - deletePivotTable(pivotName: string): void; + deletePivotTable(pivotName: String): void; /** This method is used to refresh data in pivot table. * @param {string} Optional. Pass the name of the pivot table. @@ -34101,15 +35395,15 @@ export interface XLResize { /** This method is used to get the column width of the specified column index in the Spreadsheet. * @param {number} Pass the column index. - * @returns {number} + * @returns {Number} */ - getColWidth(colIdx: number): number; + getColWidth(colIdx: number): Number; /** This method is used to get the row height of the specified row index in the Spreadsheet. * @param {number} Pass the row index which you want to find its height. - * @returns {number} + * @returns {Number} */ - getRowHeight(rowIdx: number): number; + getRowHeight(rowIdx: number): Number; /** This method is used to set the column width of the specified column index in the Spreadsheet. * @param {number} Pass the column index. @@ -34278,162 +35572,162 @@ export interface Model { /** Gets or sets an active sheet index in the Spreadsheet. By defining this value, you can specify which sheet should be active in workbook. * @Default {1} */ - activeSheetIndex?: number; + activeSheetIndex?: Number; /** Gets or sets a value that indicates whether to enable or disable auto rendering of cell type in the Spreadsheet. * @Default {false} */ - allowAutoCellType?: boolean; + allowAutoCellType?: Boolean; /** Gets or sets a value that indicates whether to enable or disable auto fill feature in the Spreadsheet. * @Default {true} */ - allowAutoFill?: boolean; + allowAutoFill?: Boolean; /** Gets or sets a value that indicates whether to enable or disable auto sum feature in the Spreadsheet. * @Default {true} */ - allowAutoSum?: boolean; + allowAutoSum?: Boolean; /** Gets or sets a value that indicates whether to enable or disable cell format feature in the Spreadsheet. By enabling this, you can customize styles and number formats. * @Default {true} */ - allowCellFormatting?: boolean; + allowCellFormatting?: Boolean; /** Gets or sets a value that indicates whether to enable or disable cell type feature in the Spreadsheet. * @Default {false} */ - allowCellType?: boolean; + allowCellType?: Boolean; /** Gets or sets a value that indicates whether to enable or disable chart feature in the Spreadsheet. By enabling this feature, you can create and customize charts in Spreadsheet. * @Default {true} */ - allowCharts?: boolean; + allowCharts?: Boolean; /** Gets or sets a value that indicates whether to enable or disable clipboard feature in the Spreadsheet. By enabling this feature, you can perform cut/copy and paste operations in Spreadsheet. * @Default {true} */ - allowClipboard?: boolean; + allowClipboard?: Boolean; /** Gets or sets a value that indicates whether to enable or disable comment feature in the Spreadsheet. By enabling this, you can add/delete/modify comments in Spreadsheet. * @Default {true} */ - allowComments?: boolean; + allowComments?: Boolean; /** Gets or sets a value that indicates whether to enable or disable Conditional Format feature in the Spreadsheet. By enabling this, you can apply formatting to the selected range of cells based on the provided conditions (Greater than, Less than, Equal, Between, Contains, etc.). * @Default {true} */ - allowConditionalFormats?: boolean; + allowConditionalFormats?: Boolean; /** Gets or sets a value that indicates whether to enable or disable data validation feature in the Spreadsheet. * @Default {true} */ - allowDataValidation?: boolean; + allowDataValidation?: Boolean; /** Gets or sets a value that indicates whether to enable or disable the delete action in the Spreadsheet. By enabling this feature, you can delete existing rows, columns, cells and sheet. * @Default {true} */ - allowDelete?: boolean; + allowDelete?: Boolean; /** Gets or sets a value that indicates whether to enable or disable drag and drop feature in the Spreadsheet. * @Default {true} */ - allowDragAndDrop?: boolean; + allowDragAndDrop?: Boolean; /** Gets or sets a value that indicates whether to enable or disable the edit action in the Spreadsheet. * @Default {true} */ - allowEditing?: boolean; + allowEditing?: Boolean; /** Gets or sets a value that indicates whether to enable or disable filtering feature in the Spreadsheet. Filtering can be used to limit the data displayed using required criteria. * @Default {true} */ - allowFiltering?: boolean; + allowFiltering?: Boolean; /** Gets or sets a value that indicates whether to enable or disable table feature in the Spreadsheet. By enabling this, you can render table in selected range. * @Default {true} */ - allowFormatAsTable?: boolean; + allowFormatAsTable?: Boolean; /** Get or sets a value that indicates whether to enable or disable format painter feature in the Spreadsheet. By enabling this feature, you can copy the format from the selected range and apply it to another range. * @Default {true} */ - allowFormatPainter?: boolean; + allowFormatPainter?: Boolean; /** Gets or sets a value that indicates whether to enable or disable formula bar in the Spreadsheet. * @Default {true} */ - allowFormulaBar?: boolean; + allowFormulaBar?: Boolean; /** Gets or sets a value that indicates whether to enable or disable freeze pane support in Spreadsheet. After enabling this feature, you can use freeze top row, freeze first column and freeze panes options. * @Default {true} */ - allowFreezing?: boolean; + allowFreezing?: Boolean; /** Gets or sets a value that indicates whether to enable or disable hyperlink feature in the Spreadsheet. By enabling this feature, you can add hyperlink which is used to easily navigate to the cell reference from one sheet to another or a web page. * @Default {true} */ - allowHyperlink?: boolean; + allowHyperlink?: Boolean; /** Gets or sets a value that indicates whether to enable or disable import feature in the Spreadsheet. By enabling this feature, you can open existing Spreadsheet documents. * @Default {true} */ - allowImport?: boolean; + allowImport?: Boolean; /** Gets or sets a value that indicates whether to enable or disable the insert action in the Spreadsheet. By enabling this feature, you can insert new rows, columns, cells and sheet. * @Default {true} */ - allowInsert?: boolean; + allowInsert?: Boolean; /** Gets or sets a value that indicates whether to enable or disable keyboard navigation feature in the Spreadsheet. * @Default {true} */ - allowKeyboardNavigation?: boolean; + allowKeyboardNavigation?: Boolean; /** Gets or sets a value that indicates whether to enable or disable lock cell feature in the Spreadsheet. * @Default {true} */ - allowLockCell?: boolean; + allowLockCell?: Boolean; /** Gets or sets a value that indicates whether to enable or disable merge feature in the Spreadsheet. * @Default {true} */ - allowMerging?: boolean; + allowMerging?: Boolean; /** Gets or sets a value that indicates whether to enable or disable resizing feature in the Spreadsheet. By enabling this feature, you can change the column width and row height by dragging its header boundaries. * @Default {true} */ - allowResizing?: boolean; + allowResizing?: Boolean; /** Gets or sets a value that indicates whether to enable or disable find and replace feature in the Spreadsheet. By enabling this, you can easily find and replace a specific value in the sheet or workbook. By using goto behavior, you can select and highlight all cells that contains specific data or data types. * @Default {true} */ - allowSearching?: boolean; + allowSearching?: Boolean; /** Gets or sets a value that indicates whether to enable or disable selection in the Spreadsheet. By enabling this feature, selected items will be highlighted. * @Default {true} */ - allowSelection?: boolean; + allowSelection?: Boolean; /** Gets or sets a value that indicates whether to enable the sorting feature in the Spreadsheet. * @Default {true} */ - allowSorting?: boolean; + allowSorting?: Boolean; /** Gets or sets a value that indicates whether to enable or disable undo and redo feature in the Spreadsheet. * @Default {true} */ - allowUndoRedo?: boolean; + allowUndoRedo?: Boolean; /** Gets or sets a value that indicates whether to enable or disable wrap text feature in the Spreadsheet. By enabling this, cell content can wrap to the next line, if the cell content exceeds the boundary of the cell. * @Default {true} */ - allowWrap?: boolean; + allowWrap?: Boolean; /** Gets or sets a value that indicates to define the width of the activation panel in Spreadsheet. * @Default {300} */ - apWidth?: number; + apWidth?: Number; /** Gets or sets an object that indicates to customize the auto fill behavior in the Spreadsheet. */ @@ -34446,16 +35740,16 @@ export interface Model { /** Gets or sets a value that defines the number of columns displayed in the sheet. * @Default {21} */ - columnCount?: number; + columnCount?: Number; /** Gets or sets a value that indicates to define the common width for each column in the Spreadsheet. * @Default {64} */ - columnWidth?: number; + columnWidth?: Number; - /** Gets or sets a value to add root css class for customizing Spreadsheet skins. + /** Gets or sets a value to add root CSS class for customizing Spreadsheet skins. */ - cssClass?: string; + cssClass?: String; /** Gets or sets a value that indicates custom formulas in Spreadsheet. * @Default {[]} @@ -34465,17 +35759,17 @@ export interface Model { /** Gets or sets a value that indicates whether to enable or disable context menu in the Spreadsheet. * @Default {true} */ - enableContextMenu?: boolean; + enableContextMenu?: Boolean; /** Gets or sets a value that indicates whether to enable or disable pivot table in the Spreadsheet. * @Default {false} */ - enablePivotTable?: boolean; + enablePivotTable?: Boolean; /** Gets or sets a value that indicates whether to enable or disable touch support in the Spreadsheet. * @Default {true} */ - enableTouch?: boolean; + enableTouch?: Boolean; /** Gets or sets an object that indicates to customize the exporting behavior in Spreadsheet. */ @@ -34492,7 +35786,7 @@ export interface Model { /** Gets or sets a value that indicates whether to customizing the user interface (UI) as locale-specific in order to display regional data (i.e.) in a language and culture specific to a particular country or region. * @Default {en-US} */ - locale?: string; + locale?: String; /** Gets or sets an object that indicates to customize the picture behavior in the Spreadsheet. */ @@ -34509,12 +35803,12 @@ export interface Model { /** Gets or sets a value that indicates whether to define the number of rows to be displayed in the sheet. * @Default {20} */ - rowCount?: number; + rowCount?: Number; /** Gets or sets a value that indicates to define the common height for each row in the sheet. * @Default {20} */ - rowHeight?: number; + rowHeight?: Number; /** Gets or sets an object that indicates to customize the scroll options in the Spreadsheet. */ @@ -34527,7 +35821,7 @@ export interface Model { /** Gets or sets a value that indicates to define the number of sheets to be created at the initial load. * @Default {1} */ - sheetCount?: number; + sheetCount?: Number; /** Gets or sets an object that indicates to customize the sheet behavior in Spreadsheet. */ @@ -34536,22 +35830,22 @@ export interface Model { /** Gets or sets a value that indicates whether to show or hide pager in the Spreadsheet. * @Default {true} */ - showPager?: boolean; + showPager?: Boolean; /** Gets or sets a value that indicates whether to show or hide ribbon in the Spreadsheet. * @Default {true} */ - showRibbon?: boolean; + showRibbon?: Boolean; /** This is used to set the number of undo-redo steps in the Spreadsheet. * @Default {20} */ - undoRedoStep?: number; + undoRedoStep?: Number; /** Define the username for the Spreadsheet which is displayed in comment. * @Default {User Name} */ - userName?: string; + userName?: String; /** Triggered for every action before its starts. */ actionBegin? (e: ActionBeginEventArgs): void; @@ -34794,7 +36088,7 @@ export interface BeforeBatchSaveEventArgs { /** Returns the sheet index. */ - sheetIdx?: number; + sheetIdx?: Number; /** Returns the query, primary key,batch changes for the data Source. */ @@ -35024,7 +36318,7 @@ export interface CellFormattingEventArgs { */ Cell?: number; - /** Returns the name of the css theme. + /** Returns the name of the CSS theme. */ cssClass?: string; @@ -35076,11 +36370,11 @@ export interface CellSaveEventArgs { /** Returns the index of the row. */ - rowIndex?: number; + rowIndex?: Number; /** Returns the index of the column. */ - colIndex?: number; + colIndex?: Number; /** Returns the Spreadsheet model. */ @@ -35111,7 +36405,7 @@ export interface CellSelectedEventArgs { /** Returns the active sheet index. */ - sheetIdx?: number; + sheetIdx?: Number; /** Returns the selected range. */ @@ -35596,7 +36890,7 @@ export interface AutoFillSettings { /** Gets or sets a value that indicates to enable or disable auto fill options in the Spreadsheet. * @Default {true} */ - showFillOptions?: boolean; + showFillOptions?: Boolean; } export interface ChartSettings { @@ -35604,12 +36898,12 @@ export interface ChartSettings { /** Gets or sets a value that defines the chart height in Spreadsheet. * @Default {220} */ - height?: number; + height?: Number; /** Gets or sets a value that defines the chart width in the Spreadsheet. * @Default {440} */ - width?: number; + width?: Number; } export interface ExportSettings { @@ -35617,27 +36911,27 @@ export interface ExportSettings { /** Gets or sets a value that indicates whether to enable or disable save feature in Spreadsheet. By enabling this feature, you can save existing Spreadsheet. * @Default {true} */ - allowExporting?: boolean; + allowExporting?: Boolean; /** Gets or sets a value that indicates to define csvUrl for export to CSV format. * @Default {null} */ - csvUrl?: string; + csvUrl?: String; /** Gets or sets a value that indicates to define excelUrl for export to excel format. * @Default {null} */ - excelUrl?: string; + excelUrl?: String; /** Gets or sets a value that indicates to define password while export to excel format. * @Default {null} */ - password?: string; + password?: String; - /** Gets or sets a value that indicates to define pdfUrl for export to pdf format. + /** Gets or sets a value that indicates to define pdfUrl for export to PDF format. * @Default {null} */ - pdfUrl?: string; + pdfUrl?: String; } export interface FormatSettings { @@ -35645,37 +36939,37 @@ export interface FormatSettings { /** Gets or sets a value that indicates whether to enable or disable cell border feature in the Spreadsheet. * @Default {true} */ - allowCellBorder?: boolean; + allowCellBorder?: Boolean; /** Gets or sets a value that indicates whether to enable or disable decimal places in the Spreadsheet. * @Default {true} */ - allowDecimalPlaces?: boolean; + allowDecimalPlaces?: Boolean; /** Gets or sets a value that indicates whether to enable or disable font family feature in Spreadsheet. * @Default {true} */ - allowFontFamily?: boolean; + allowFontFamily?: Boolean; } export interface ImportSettings { /** Sets import mapper to perform import feature in Spreadsheet. */ - importMapper?: string; + importMapper?: String; /** Gets or sets a value that indicates whether to enable or disable import while initial loading. * @Default {false} */ - importOnLoad?: boolean; + importOnLoad?: Boolean; /** Sets import URL to access the online files in the Spreadsheet. */ - importUrl?: string; + importUrl?: String; /** Gets or sets a value that indicates to define password while importing in the Spreadsheet. */ - password?: string; + password?: String; } export interface PictureSettings { @@ -35683,17 +36977,17 @@ export interface PictureSettings { /** Gets or sets a value that indicates whether to enable or disable picture feature in Spreadsheet. By enabling this, you can add pictures in Spreadsheet. * @Default {true} */ - allowPictures?: boolean; + allowPictures?: Boolean; /** Gets or sets a value that indicates to define height to picture in the Spreadsheet. * @Default {220} */ - height?: number; + height?: Number; /** Gets or sets a value that indicates to define width to picture in the Spreadsheet. * @Default {440} */ - width?: number; + width?: Number; } export interface PrintSettings { @@ -35701,17 +36995,17 @@ export interface PrintSettings { /** Gets or sets a value that indicates whether to enable or disable page setup support for printing in Spreadsheet. * @Default {true} */ - allowPageSetup?: boolean; + allowPageSetup?: Boolean; /** Gets or sets a value that indicates whether to enable or disable page size support for printing in Spreadsheet. * @Default {false} */ - allowPageSize?: boolean; + allowPageSize?: Boolean; /** Gets or sets a value that indicates whether to enable or disable print feature in the Spreadsheet. * @Default {true} */ - allowPrinting?: boolean; + allowPrinting?: Boolean; } export interface RibbonSettingsApplicationTabMenuSettings { @@ -35719,9 +37013,9 @@ export interface RibbonSettingsApplicationTabMenuSettings { /** Gets or sets a value that indicates whether to enable or disable isAppend property in ribbon settings. * @Default {false} */ - isAppend?: boolean; + isAppend?: Boolean; - /** Specifies the data source to append in applicationtab. + /** Specifies the data source to append in application tab. * @Default {[]} */ dataSource?: Array; @@ -35751,27 +37045,27 @@ export interface ScrollSettings { /** Gets or sets a value that indicates whether to enable or disable scrolling in Spreadsheet. * @Default {true} */ - allowScrolling?: boolean; + allowScrolling?: Boolean; /** Gets or sets a value that indicates whether to enable or disable sheet on demand. By enabling this, it render only the active sheet element while paging remaining sheets are created one by one. * @Default {false} */ - allowSheetOnDemand?: boolean; + allowSheetOnDemand?: Boolean; /** Gets or sets a value that indicates whether to enable or disable virtual scrolling feature in the Spreadsheet. * @Default {true} */ - allowVirtualScrolling?: boolean; + allowVirtualScrolling?: Boolean; /** Gets or sets the value that indicates to define the height of spreadsheet. * @Default {100%} */ - height?: number|string; + height?: Number|String; /** Gets or sets the value that indicates whether to enable or disable responsive mode in the Spreadsheet. * @Default {true} */ - isResponsive?: boolean; + isResponsive?: Boolean; /** Gets or sets a value that indicates to set scroll mode in Spreadsheet. It has two scroll modes, Normal and Infinite. * @Default {ej.Spreadsheet.scrollMode.Infinite} @@ -35781,24 +37075,24 @@ export interface ScrollSettings { /** Gets or sets the value that indicates to define the height of the spreadsheet. * @Default {100%} */ - width?: number|string; + width?: Number|String; } export interface SelectionSettings { /** Gets or sets a value that indicates to define active cell in spreadsheet. */ - activeCell?: string; + activeCell?: String; /** Gets or sets a value that indicates to define animation time while selection in the Spreadsheet. * @Default {0.001} */ - animationTime?: number; + animationTime?: Number; /** Gets or sets a value that indicates to enable or disable animation while selection. * @Default {false} */ - enableAnimation?: boolean; + enableAnimation?: Boolean; /** Gets or sets a value that indicates to set selection type in Spreadsheet. It has three types which are Column, Row and Default. * @Default {ej.Spreadsheet.SelectionType.Default} @@ -35819,11 +37113,11 @@ export interface SheetsBorder { /** Specifies border color for range of cells in Spreadsheet. */ - color?: string; + color?: String; /** To apply border for the specified range of cell. */ - range?: string; + range?: String; } export interface SheetsCFormatRule { @@ -35843,7 +37137,7 @@ export interface SheetsCFormatRule { /** Specifies the range for conditional formatting in Spreadsheet. */ - range?: string; + range?: String; } export interface SheetsRangeSetting { @@ -35860,7 +37154,7 @@ export interface SheetsRangeSetting { /** Specifies the primary key for the datasource in Spreadsheet. */ - primaryKey?: string; + primaryKey?: String; /** Specifies the query for the datasource in Spreadsheet. * @Default {null} @@ -35870,12 +37164,12 @@ export interface SheetsRangeSetting { /** Gets or sets a value that indicates whether to enable or disable the datasource header in Spreadsheet. * @Default {false} */ - showHeader?: boolean; + showHeader?: Boolean; /** Specifies the start cell for the datasource range in Spreadsheet. * @Default {A1} */ - startCell?: string; + startCell?: String; } export interface SheetsRowsCellsComment { @@ -35883,49 +37177,49 @@ export interface SheetsRowsCellsComment { /** Get or sets the value that indicates whether to show or hide comments in Spreadsheet. * @Default {false} */ - isVisible?: boolean; + isVisible?: Boolean; /** Specifies the value for the comment in Spreadsheet. */ - value?: string; + value?: String; } export interface SheetsRowsCellsFormat { /** Specifies the type of the format in Spreadsheet. */ - type?: string; + type?: String; } export interface SheetsRowsCellsHyperlink { /** Specifies the web address for the hyperlink of a cell. */ - webAddr?: string; + webAddr?: String; /** Specifies the cell address for the hyperlink of a cell. */ - cellAddr?: string; + cellAddr?: String; /** Specifies the sheet index to which the cell is referred. * @Default {1} */ - sheetIndex?: number; + sheetIndex?: Number; } export interface SheetsRowsCellsStyle { /** Specifies the background color of a cell in the Spreadsheet. */ - backgroundColor?: string; + backgroundColor?: String; /** Specifies the font color of a cell in the Spreadsheet. */ - color?: string; + color?: String; /** Specifies the font weight of a cell in the Spreadsheet. */ - fontWeight?: string; + fontWeight?: String; } export interface SheetsRowsCell { @@ -35948,7 +37242,7 @@ export interface SheetsRowsCell { /** Specifies the index of a cell in Spreadsheet. * @Default {0} */ - index?: number; + index?: Number; /** Specifies the styles of a cell in Spreadsheet. * @Default {null} @@ -35957,7 +37251,7 @@ export interface SheetsRowsCell { /** Specifies the value for a cell in Spreadsheet. */ - value?: string; + value?: String; } export interface SheetsRow { @@ -35965,7 +37259,7 @@ export interface SheetsRow { /** Gets or sets the height of a row in Spreadsheet. * @Default {20} */ - height?: number; + height?: Number; /** Specifies the cells of a row in Spreadsheet. * @Default {[]} @@ -35975,7 +37269,7 @@ export interface SheetsRow { /** Gets or sets the index of a row in Spreadsheet. * @Default {0} */ - index?: number; + index?: Number; } export interface Sheet { @@ -35993,12 +37287,12 @@ export interface Sheet { /** Gets or sets a value that indicates to define column count in the Spreadsheet. * @Default {21} */ - colCount?: number; + colCount?: Number; /** Gets or sets a value that indicates to define column width in the Spreadsheet. * @Default {64} */ - columnWidth?: number; + columnWidth?: Number; /** Gets or sets the data to render the Spreadsheet. * @Default {null} @@ -36008,7 +37302,7 @@ export interface Sheet { /** Gets or sets a value that indicates whether to enable or disable field as column header in the Spreadsheet. * @Default {false} */ - fieldAsColumnHeader?: boolean; + fieldAsColumnHeader?: Boolean; /** Specifies the header styles for the headers in datasource range. * @Default {null} @@ -36032,7 +37326,7 @@ export interface Sheet { /** Specifies the primary key for the datasource in Spreadsheet. */ - primaryKey?: string; + primaryKey?: String; /** Specifies the query for the dataSource in Spreadsheet. * @Default {null} @@ -36047,7 +37341,7 @@ export interface Sheet { /** Gets or sets a value that indicates to define row count in the Spreadsheet. * @Default {20} */ - rowCount?: number; + rowCount?: Number; /** Specifies the rows for a sheet in Spreadsheet. * @Default {[]} @@ -36057,22 +37351,22 @@ export interface Sheet { /** Gets or sets a value that indicates whether to show or hide grid lines in the Spreadsheet. * @Default {true} */ - showGridlines?: boolean; + showGridlines?: Boolean; /** Gets or sets a value that indicates whether to enable or disable the datasource header in Spreadsheet. * @Default {false} */ - showHeader?: boolean; + showHeader?: Boolean; /** Gets or sets a value that indicates whether to show or hide headings in the Spreadsheet. * @Default {true} */ - showHeadings?: boolean; + showHeadings?: Boolean; /** Specifies the start cell for the datasource range in Spreadsheet. * @Default {A1} */ - startCell?: string; + startCell?: String; } enum AutoFillOptions{ @@ -36210,6 +37504,7 @@ class PdfViewer extends ej.Widget { static fn: PdfViewer; constructor(element: JQuery, options?: PdfViewer.Model); constructor(element: Element, options?: PdfViewer.Model); + static Locale: any; model:PdfViewer.Model; defaults:PdfViewer.Model; @@ -36294,7 +37589,7 @@ export interface Model { /** Specifies the locale information of the PDF viewer. */ - locale?: string; + locale?: String; /** Specifies the toolbar settings. */ @@ -36306,19 +37601,19 @@ export interface Model { /** Sets the PDF Web API service URL */ - serviceUrl?: string; + serviceUrl?: String; /** Gets the total number of pages in PDF document. */ - pageCount?: number; + pageCount?: Number; /** Gets the number of the page being displayed in the PDF Viewer. */ - currentPageNumber?: number; + currentPageNumber?: Number; /** Gets the current zoom percentage of the PDF document in viewer. */ - zoomPercentage?: number; + zoomPercentage?: Number; /** Specifies the location of the supporting PDF service */ @@ -36330,7 +37625,7 @@ export interface Model { /** Enables or disables the responsive support for PDF Viewer control during the window resizing time. */ - isResponsive?: boolean; + isResponsive?: Boolean; /** Gets the name of the PDF document which loaded in the ejPdfViewer control for downloading. */ @@ -36483,7 +37778,7 @@ export interface ToolbarSettings { /** Shows or hides the tooltip of the toolbar items. */ - showToolTip?: boolean; + showToolTip?: Boolean; } enum ToolbarItems{ @@ -36529,6 +37824,490 @@ enum LinkTarget{ } +class SpellCheck extends ej.Widget { + static fn: SpellCheck; + constructor(element: JQuery, options?: SpellCheck.Model); + constructor(element: Element, options?: SpellCheck.Model); + static Locale: any; + model:SpellCheck.Model; + defaults:SpellCheck.Model; + + /** Open the dialog to correct the spelling of the target content. + * @returns {void} + */ + showInDialog(): void; + + /** Highlighting the error word in the target area itself and correct the spelling using the context menu. + * @returns {void} + */ + validate(): void; + + /** To get the error word highlighted string by passing the given input sentence. + * @param {string} Content to be spell check + * @param {string} Class name that contains style value to highlight the error word + * @returns {void} + */ + spellCheck(targetSentence: string, misspellWordCss: string): void; + + /** To ignore all the error word occurrences from the given input sentence. + * @param {string} Error word to ignore from the target content + * @param {string} Content to perform the ignore all operation + * @returns {void} + */ + ignoreAll(word: string, targetSentence: string): void; + + /** To ignore the error word once from the given input sentence. + * @param {string} Error word to ignore from the target content + * @param {string} Content to perform the ignore operation + * @param {number} Index of the error word present in the target content + * @returns {void} + */ + ignore(word: string, targetSentence: string, index: number): void; + + /** To change the error word once from the given input sentence. + * @param {string} Error word to change from the target content + * @param {string} Content to perform the change operation + * @param {string} Word to replace with the error word + * @param {number} Index of the error word present in the target content + * @returns {void} + */ + change(word: string, targetSentence: string, changeWord: string, index: number): void; + + /** To change all the error word occurrences from the given input sentence. + * @param {string} Error word to change from the target content + * @param {string} Content to perform the change all operation + * @param {string} Word to replace with the error word + * @returns {void} + */ + changeAll(word: string, targetSentence: string, changeWord: string): void; + + /** To add the words into the custom dictionary. + * @param {string} Word to add into the dictionary file + * @returns {void} + */ + addToDictionary(customWord: string): void; +} +export module SpellCheck{ + +export interface Model { + + /** It includes the service method path to find the error words and its suggestions also adding the custom word into the custom dictionary. + */ + dictionarySettings?: DictionarySettings; + + /** To display the error word in a customized style. + * @Default {e-errorword} + */ + misspellWordCss?: string; + + /** Sets the specific culture to the SpellCheck. + * @Default {en-US} + */ + locale?: string; + + /** To set the maximum suggestion display count. + * @Default {6} + */ + maxSuggestionCount?: number; + + /** To ignore the words from the error word consideration. + * @Default {[]} + */ + ignoreWords?: Array; + + /** Holds all options related to the context menu settings of SpellCheck. + */ + contextMenuSettings?: ContextMenuSettings; + + /** It helps to ignore the uppercase, mixed case words, alpha numeric words, file path and email addresses based on the property values. + */ + ignoreSettings?: IgnoreSettings; + + /** Triggers on the success of AJAX call request. */ + actionSuccess? (e: ActionSuccessEventArgs): void; + + /** Triggers on the AJAX call request beginning. */ + actionBegin? (e: ActionBeginEventArgs): void; + + /** Triggers when the AJAX call request failure. */ + actionFailure? (e: ActionFailureEventArgs): void; + + /** Triggers when the dialog mode spell check starting. */ + start? (e: StartEventArgs): void; + + /** Triggers when the spell check operations completed through dialog mode. */ + complete? (e: CompleteEventArgs): void; + + /** Triggers before context menu opening. */ + contextOpen? (e: ContextOpenEventArgs): void; + + /** Triggers when the context menu item clicked. */ + contextClick? (e: ContextClickEventArgs): void; + + /** Triggers before the spell check dialog opens. */ + dialogBeforeOpen? (e: DialogBeforeOpenEventArgs): void; + + /** Triggers after the spell check dialog opens. */ + dialogOpen? (e: DialogOpenEventArgs): void; + + /** Triggers when the spell check dialog closed. */ + dialogClose? (e: DialogCloseEventArgs): void; + + /** Triggers when the spell check control performing the spell check operations such as ignore, ignoreAll, change, changeAll and addToDictionary. */ + validating? (e: ValidatingEventArgs): void; +} + +export interface ActionSuccessEventArgs { + + /** Returns the error word highlighted string. + */ + resultHTML?: string; + + /** Returns the error word details of the given input. + */ + errorWordDetails?: any; + + /** Returns the request type value. + */ + requestType?: string; + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns the SpellCheck model. + */ + model?: ej.SpellCheck.Model; + + /** Returns the name of the event. + */ + type?: string; +} + +export interface ActionBeginEventArgs { + + /** Returns the input string. + */ + targetSentence?: string; + + /** Returns the misspellWordCss class name. + */ + misspellWordCss?: string; + + /** Returns the request type value. + */ + requestType?: string; + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns the SpellCheck model. + */ + model?: ej.SpellCheck.Model; + + /** Returns the name of the event. + */ + type?: string; +} + +export interface ActionFailureEventArgs { + + /** Returns AJAX request failure error message. + */ + errorMessage?: string; + + /** Returns the request type value. + */ + requestType?: string; + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns the SpellCheck model. + */ + model?: ej.SpellCheck.Model; + + /** Returns the name of the event. + */ + type?: string; +} + +export interface StartEventArgs { + + /** Returns the input string. + */ + targetSentence?: string; + + /** Returns the error words details. + */ + errorWords?: any; + + /** Returns the request type value. + */ + requestType?: string; + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns the SpellCheck model. + */ + model?: ej.SpellCheck.Model; + + /** Returns the name of the event. + */ + type?: string; +} + +export interface CompleteEventArgs { + + /** Returns the error word highlighted string. + */ + resultHTML?: string; + + /** Returns the request type value. + */ + requestType?: string; + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns the SpellCheck model. + */ + model?: ej.SpellCheck.Model; + + /** Returns the name of the event. + */ + type?: string; +} + +export interface ContextOpenEventArgs { + + /** Returns the selected error word. + */ + selectedErrorWord?: string; + + /** Returns the request type value. + */ + requestType?: string; + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns the SpellCheck model. + */ + model?: ej.SpellCheck.Model; + + /** Returns the name of the event. + */ + type?: string; +} + +export interface ContextClickEventArgs { + + /** Returns the selected error word. + */ + selectedValue?: string; + + /** Returns the selected option in the context menu. + */ + selectedOption?: string; + + /** Returns the input string. + */ + targetContent?: string; + + /** Returns the request type value. + */ + requestType?: string; + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns the SpellCheck model. + */ + model?: ej.SpellCheck.Model; + + /** Returns the name of the event. + */ + type?: string; +} + +export interface DialogBeforeOpenEventArgs { + + /** Returns the spell check window details. + */ + spellCheckDialog?: any; + + /** Returns the request type value. + */ + requestType?: string; + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns the SpellCheck model. + */ + model?: ej.SpellCheck.Model; + + /** Returns the name of the event. + */ + type?: string; +} + +export interface DialogOpenEventArgs { + + /** Returns the target input. + */ + targetText?: string; + + /** Returns the request type value. + */ + requestType?: string; + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns the SpellCheck model. + */ + model?: ej.SpellCheck.Model; + + /** Returns the name of the event. + */ + type?: string; +} + +export interface DialogCloseEventArgs { + + /** Returns the error corrected string. + */ + updatedText?: string; + + /** Returns the request type value. + */ + requestType?: string; + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns the SpellCheck model. + */ + model?: ej.SpellCheck.Model; + + /** Returns the name of the event. + */ + type?: string; +} + +export interface ValidatingEventArgs { + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns the error word to ignore. + */ + ignoreWord?: string; + + /** Returns the target content. + */ + targetContent?: string; + + /** Returns the index of an error word. + */ + index?: number; + + /** Returns the SpellCheck model. + */ + model?: ej.SpellCheck.Model; + + /** Returns the validating request type. + */ + requestType?: string; + + /** Returns the name of the event. + */ + type?: string; + + /** Returns the error word to change. + */ + changeableWord?: string; + + /** Returns the change word to replace the error word. + */ + changeWord?: string; + + /** Returns the custom word to add into dictionary file. + */ + customWord?: string; +} + +export interface DictionarySettings { + + /** The dictionaryUrl option accepts string, which is the method path to find the error words and get the suggestions to correct the errors. + */ + dictionaryUrl?: string; + + /** The customDictionaryUrl option accepts string, which is the method path to add the error word into the custom dictionary. + */ + customDictionaryUrl?: string; +} + +export interface ContextMenuSettings { + + /** When set to true, enables the context menu options available for the SpellCheck. + * @Default {true} + */ + enable?: boolean; + + /** Contains all the default context menu options that are applicable for SpellCheck. It also supports adding custom menu items. All the SpellCheck related context menu items are grouped under this menu collection. + * @Default {{% highlight javascript %}[{ id: IgnoreAll, text: Ignore All },{ id: AddToDictionary, text: Add To Dictionary }]{% endhighlight %}} + */ + menuItems?: Array; +} + +export interface IgnoreSettings { + + /** When set to true, ignoring the alphanumeric words from the error word consideration. + * @Default {true} + */ + ignoreAlphaNumericWords?: string; + + /** When set to true, ignoring the Email address from the error word consideration. + * @Default {true} + */ + ignoreEmailAddress?: boolean; + + /** When set to true, ignoring the MixedCase words from the error word consideration. + * @Default {true} + */ + ignoreMixedCaseWords?: boolean; + + /** When set to true, ignoring the UpperCase words from the error word consideration. + * @Default {true} + */ + ignoreUpperCase?: boolean; + + /** When set to true, ignoring the Url from the error word consideration. + * @Default {true} + */ + ignoreUrl?: boolean; + + /** When set to true, ignoring the file address path from the error word consideration. + * @Default {true} + */ + ignoreFileNames?: boolean; +} +} + } declare module ej.datavisualization { @@ -36536,6 +38315,7 @@ class SymbolPalette extends ej.Widget { static fn: SymbolPalette; constructor(element: JQuery, options?: SymbolPalette.Model); constructor(element: Element, options?: SymbolPalette.Model); + static Locale: any; model:SymbolPalette.Model; defaults:SymbolPalette.Model; } @@ -36546,12 +38326,12 @@ export interface Model { /** Defines whether the symbols can be dragged from palette or not * @Default {true} */ - allowDrag?: boolean; + allowDrag?: Boolean; /** Customizes the style of the symbol palette * @Default {e-symbolpalette} */ - cssClass?: string; + cssClass?: String; /** Defines the default properties of nodes and connectors */ @@ -36560,27 +38340,27 @@ export interface Model { /** Sets the Id of the diagram, over which the symbols will be dropped * @Default {null} */ - diagramId?: string; + diagramId?: String; /** Sets the height of the palette headers * @Default {30} */ - headerHeight?: number; + headerHeight?: Number; /** Defines the height of the symbol palette * @Default {400} */ - height?: number; + height?: Number; /** Defines the height of the palette items * @Default {50} */ - paletteItemHeight?: number; + paletteItemHeight?: Number; /** Defines the width of the palette items * @Default {50} */ - paletteItemWidth?: number; + paletteItemWidth?: Number; /** An array of JSON objects, where each object represents a node/connector * @Default {[]} @@ -36590,7 +38370,7 @@ export interface Model { /** Defines the preview height of the symbols * @Default {100} */ - previewHeight?: number; + previewHeight?: Number; /** Defines the offset value to be left between the mouse cursor and symbol previews * @Default {(110, 110)} @@ -36600,17 +38380,17 @@ export interface Model { /** Defines the width of the symbol previews * @Default {100} */ - previewWidth?: number; + previewWidth?: Number; /** Enable or disable the palette item text * @Default {true} */ - showPaletteItemText?: boolean; + showPaletteItemText?: Boolean; /** The width of the palette * @Default {250} */ - width?: number; + width?: Number; /** Triggers when a palette item is selected or unselected */ selectionChange? (e: SelectionChangeEventArgs): void; @@ -36620,7 +38400,7 @@ export interface SelectionChangeEventArgs { /** returns whether an element is selected or unselected */ - changeType?: string; + changeType?: String; /** returns the node or connector that is selected or unselected */ @@ -36663,6 +38443,7 @@ class LinearGauge extends ej.Widget { static fn: LinearGauge; constructor(element: JQuery, options?: LinearGauge.Model); constructor(element: Element, options?: LinearGauge.Model); + static Locale: any; model:LinearGauge.Model; defaults:LinearGauge.Model; @@ -37168,7 +38949,7 @@ export interface Model { /** Specifies the scales * @Default {null} */ - scales?: Scales; + scales?: Array; /** Specifies the theme for Linear gauge. See LinearGauge.Themes * @Default {flatlight} @@ -38402,7 +40183,7 @@ export interface ScalesTick { width?: number; } -export interface Scales { +export interface Scale { /** Specifies the backgroundColor of the Scale. * @Default {null} @@ -38699,6 +40480,7 @@ class CircularGauge extends ej.Widget { static fn: CircularGauge; constructor(element: JQuery, options?: CircularGauge.Model); constructor(element: Element, options?: CircularGauge.Model); + static Locale: any; model:CircularGauge.Model; defaults:CircularGauge.Model; @@ -39204,7 +40986,7 @@ export interface Model { /** Specify the pointers, ticks, labels, indicators, ranges of circular gauge * @Default {null} */ - scales?: Scales; + scales?: Array; /** Specify the theme of circular gauge. * @Default {flatlight} @@ -40389,7 +42171,7 @@ export interface ScalesTick { width?: number; } -export interface Scales { +export interface Scale { /** Specify backgroundColor for the scale of circular gauge * @Default {null} @@ -40710,6 +42492,7 @@ class DigitalGauge extends ej.Widget { static fn: DigitalGauge; constructor(element: JQuery, options?: DigitalGauge.Model); constructor(element: Element, options?: DigitalGauge.Model); + static Locale: any; model:DigitalGauge.Model; defaults:DigitalGauge.Model; @@ -40778,7 +42561,7 @@ export interface Model { /** Specifies the items for the DigitalGauge. * @Default {null} */ - items?: Items; + items?: Array; /** Specifies the matrixSegmentData for the DigitalGauge. */ @@ -40840,7 +42623,7 @@ export interface InitEventArgs { /** returns the name of the event */ - type?: string; + type?: String; } export interface ItemRenderingEventArgs { @@ -40867,7 +42650,7 @@ export interface ItemRenderingEventArgs { /** returns the name of the event */ - type?: string; + type?: String; } export interface LoadEventArgs { @@ -40894,7 +42677,7 @@ export interface LoadEventArgs { /** returns the name of the event */ - type?: string; + type?: String; } export interface RenderCompleteEventArgs { @@ -40921,7 +42704,7 @@ export interface RenderCompleteEventArgs { /** returns the name of the event */ - type?: string; + type?: String; } export interface Frame { @@ -41029,7 +42812,7 @@ export interface ItemsSegmentSettings { width?: number; } -export interface Items { +export interface Item { /** Specifies the Character settings for the DigitalGauge. * @Default {null} @@ -41129,6 +42912,7 @@ class Chart extends ej.Widget { static fn: Chart; constructor(element: JQuery, options?: Chart.Model); constructor(element: Element, options?: Chart.Model); + static Locale: any; model:Chart.Model; defaults:Chart.Model; @@ -41429,11 +43213,11 @@ export interface AxesLabelRenderingEventArgs { /** Formatted text of the respective label. You can also add custom text to the label. */ - LabelText?: string; + LabelText?: String; /** Actual value of the label. */ - LabelValue?: string; + LabelValue?: String; /** Set this option to true to cancel the event. */ @@ -42735,6 +44519,11 @@ export interface CommonSeriesOptionsMarkerDataLabelFont { */ opacity?: number; + /** Font color of the data label text. + * @Default {null} + */ + color?: string; + /** Font size of the data label. * @Default {12px} */ @@ -42771,6 +44560,16 @@ export interface CommonSeriesOptionsMarkerDataLabel { */ angle?: number; + /** Maximum label width of the data label. + * @Default {null} + */ + maximumLabelWidth?: number; + + /** Enable the wrap option to the data label. + * @Default {false} + */ + enableWrap?: boolean; + /** Options for customizing the border of the data label. */ border?: CommonSeriesOptionsMarkerDataLabelBorder; @@ -42879,6 +44678,29 @@ export interface CommonSeriesOptionsMarker { visible?: boolean; } +export interface CommonSeriesOptionsCornerRadius { + + /** Specifies the radius for the top left corner. + * @Default {0} + */ + topLeft?: number; + + /** Specifies the radius for the top right corner. + * @Default {0} + */ + topRight?: number; + + /** Specifies the radius for the bottom left corner. + * @Default {0} + */ + bottomLeft?: number; + + /** Specifies the radius for the bottom right corner. + * @Default {0} + */ + bottomRight?: number; +} + export interface CommonSeriesOptionsTooltipBorder { /** Border color of the tooltip. @@ -43263,6 +45085,11 @@ export interface CommonSeriesOptions { */ border?: CommonSeriesOptionsBorder; + /** To render the column and bar type series in rectangle/cylinder shape. See ColumnFacet + * @Default {rectangle} + */ + columnFacet?: ej.datavisualization.Chart.ColumnFacet|string; + /** Relative width of the columns in column type series. Value ranges from 0 to 1. Width also depends upon columnSpacing property. * @Default {0.7} */ @@ -43424,6 +45251,10 @@ export interface CommonSeriesOptions { */ startAngle?: number; + /** Options for customizing the corner radius. cornerRadius property also takes the numeric input and applies it for all the four corners of the column. + */ + cornerRadius?: CommonSeriesOptionsCornerRadius; + /** Options for customizing the tooltip of chart. */ tooltip?: CommonSeriesOptionsTooltip; @@ -43473,7 +45304,7 @@ export interface CommonSeriesOptions { */ close?: string; - /** zOrder of the series. + /** Z-order of the series. * @Default {0} */ zOrder?: number; @@ -43513,6 +45344,51 @@ export interface CommonSeriesOptions { selectionSettings?: CommonSeriesOptionsSelectionSettings; } +export interface CrosshairTrackballTooltipSettingsBorder { + + /** Border width of the trackball tooltip. + * @Default {null} + */ + width?: number; + + /** Border color of the trackball tooltip. + * @Default {null} + */ + color?: string; +} + +export interface CrosshairTrackballTooltipSettings { + + /** Options for customizing the trackball tooltip border. + */ + border?: CrosshairTrackballTooltipSettingsBorder; + + /** Background color of the trackball tooltip. + * @Default {null} + */ + fill?: string; + + /** Rounded corner x value of the trackball tooltip. + * @Default {3} + */ + rx?: number; + + /** Rounded corner y value of the trackball tooltip. + * @Default {3} + */ + ry?: number; + + /** Opacity value of the trackball tooltip. + * @Default {1} + */ + opacity?: number; + + /** Specifies the mode of the trackball tooltip. + * @Default {float. See CrosshairMode} + */ + mode?: ej.datavisualization.Chart.CrosshairMode|string; +} + export interface CrosshairMarkerBorder { /** Border width of the marker. @@ -43570,6 +45446,10 @@ export interface CrosshairLine { export interface Crosshair { + /** Options for customizing the trackball tooltip. + */ + trackballTooltipSettings?: CrosshairTrackballTooltipSettings; + /** Options for customizing the marker in crosshair. */ marker?: CrosshairMarker; @@ -44243,6 +46123,107 @@ export interface PrimaryXAxisRange { interval?: number; } +export interface PrimaryXAxisMultiLevelLabelsFont { + + /** Font color of the multi level labels text. + * @Default {null} + */ + color?: string; + + /** Font family of the multi level labels text. + * @Default {Segoe UI} + */ + fontFamily?: string; + + /** Font style of the multi level labels text. + * @Default {Normal} + */ + fontStyle?: ej.datavisualization.Chart.FontStyle|string; + + /** Font weight of the multi level label text. + * @Default {regular} + */ + fontWeight?: string; + + /** Opacity of the multi level label text. + * @Default {1} + */ + opacity?: number; + + /** Font size of the multi level label text. + * @Default {12px} + */ + size?: string; +} + +export interface PrimaryXAxisMultiLevelLabelsBorder { + + /** Border color of the multi level labels. + * @Default {null} + */ + color?: string; + + /** Border width of the multi level labels. + * @Default {1} + */ + width?: number; + + /** Border type of the multi level labels. + * @Default {rectangle. See Type} + */ + type?: ej.datavisualization.Chart.MultiLevelLabelsBorderType|string; +} + +export interface PrimaryXAxisMultiLevelLabel { + + /** Visibility of the multi level labels. + * @Default {false} + */ + visible?: boolean; + + /** Text of the multi level labels. + */ + text?: string; + + /** Starting value of the multi level labels. + * @Default {null} + */ + start?: number; + + /** Ending value of the multi level labels. + * @Default {null} + */ + end?: number; + + /** Specifies the level of multi level labels. + * @Default {0} + */ + level?: number; + + /** Specifies the maximum width of the text in multi level labels. + * @Default {null} + */ + maximumTextWidth?: number; + + /** Specifies the alignment of the text in multi level labels. + * @Default {center. See TextAlignment} + */ + textAlignment?: ej.datavisualization.Chart.TextAlignment|string; + + /** Specifies the handling of text over flow in multi level labels. + * @Default {center. See TextOverflow} + */ + textOverflow?: ej.datavisualization.Chart.TextOverflow|string; + + /** Options for customizing the font of the text. + */ + font?: PrimaryXAxisMultiLevelLabelsFont; + + /** Options for customizing the border of the series. + */ + border?: PrimaryXAxisMultiLevelLabelsBorder; +} + export interface PrimaryXAxisStripLineFont { /** Font color of the strip line text. @@ -44333,6 +46314,19 @@ export interface PrimaryXAxisStripLine { zIndex?: ej.datavisualization.Chart.ZIndex|string; } +export interface PrimaryXAxisLabelBorder { + + /** Specifies the color of the label border. + * @Default {null} + */ + color?: string; + + /** Specifies the width of the label border. + * @Default {1} + */ + width?: number; +} + export interface PrimaryXAxisTitleFont { /** Font family of the title text. @@ -44385,6 +46379,21 @@ export interface PrimaryXAxisTitle { * @Default {true} */ visible?: boolean; + + /** offset value for axis title. + * @Default {0} + */ + offset?: number; + + /** Specifies the position of the axis title. + * @Default {outside. See Position} + */ + position?: ej.datavisualization.Chart.LabelPosition|string; + + /** Specifies the position of the axis title. + * @Default {center. See Alignment} + */ + alignment?: ej.datavisualization.Chart.TextAlignment|string; } export interface PrimaryXAxis { @@ -44431,6 +46440,11 @@ export interface PrimaryXAxis { */ desiredIntervals?: number; + /** Specifies the placement of labels. + * @Default {ej.datavisualization.Chart.LabelPlacement.BetweenTicks. See LabelPlacement} + */ + labelPlacement?: ej.datavisualization.Chart.LabelPlacement|string; + /** Specifies the position of labels at the edge of the axis. * @Default {ej.datavisualization.Chart.EdgeLabelPlacement.None. See EdgeLabelPlacement} */ @@ -44470,6 +46484,11 @@ export interface PrimaryXAxis { */ labelPosition?: ej.datavisualization.Chart.LabelPosition|string; + /** Specifies the position of the axis labels. + * @Default {center. See Alignment} + */ + alignment?: ej.datavisualization.Chart.LabelAlignment|string; + /** Angle in degrees to rotate the axis labels. * @Default {null} */ @@ -44540,6 +46559,11 @@ export interface PrimaryXAxis { */ roundingPlaces?: number; + /** Options for customizing the multi level labels. + * @Default {[ ]} + */ + multiLevelLabels?: Array; + /** Options for customizing the strip lines. * @Default {[ ]} */ @@ -44550,6 +46574,10 @@ export interface PrimaryXAxis { */ tickLinesPosition?: ej.datavisualization.Chart.TickLinesPosition|string; + /** Options for customizing the border of the labels. + */ + labelBorder?: PrimaryXAxisLabelBorder; + /** Options for customizing the axis title. */ title?: PrimaryXAxisTitle; @@ -44771,6 +46799,107 @@ export interface PrimaryYAxisRange { interval?: number; } +export interface PrimaryYAxisMultiLevelLabelsFont { + + /** Font color of the multi level labels text. + * @Default {null} + */ + color?: string; + + /** Font family of the multi level labels text. + * @Default {Segoe UI} + */ + fontFamily?: string; + + /** Font style of the multi level labels text. + * @Default {Normal} + */ + fontStyle?: ej.datavisualization.Chart.FontStyle|string; + + /** Font weight of the multi level label text. + * @Default {regular} + */ + fontWeight?: string; + + /** Opacity of the multi level label text. + * @Default {1} + */ + opacity?: number; + + /** Font size of the multi level label text. + * @Default {12px} + */ + size?: string; +} + +export interface PrimaryYAxisMultiLevelLabelsBorder { + + /** Border color of the multi level labels. + * @Default {null} + */ + color?: string; + + /** Border width of the multi level labels. + * @Default {1} + */ + width?: number; + + /** Border type of the multi level labels. + * @Default {rectangle. See Type} + */ + type?: ej.datavisualization.Chart.MultiLevelLabelsBorderType|string; +} + +export interface PrimaryYAxisMultiLevelLabel { + + /** Visibility of the multi level labels. + * @Default {false} + */ + visible?: boolean; + + /** Text of the multi level labels. + */ + text?: string; + + /** Starting value of the multi level labels. + * @Default {null} + */ + start?: number; + + /** Ending value of the multi level labels. + * @Default {null} + */ + end?: number; + + /** Specifies the level of multi level labels. + * @Default {0} + */ + level?: number; + + /** Specifies the maximum width of the text in multi level labels. + * @Default {null} + */ + maximumTextWidth?: number; + + /** Specifies the alignment of the text in multi level labels. + * @Default {center. See TextAlignment} + */ + textAlignment?: ej.datavisualization.Chart.TextAlignment|string; + + /** Specifies the handling of text over flow in multi level labels. + * @Default {center. See TextOverflow} + */ + textOverflow?: ej.datavisualization.Chart.TextOverflow|string; + + /** Options for customizing the font of the text. + */ + font?: PrimaryYAxisMultiLevelLabelsFont; + + /** Options for customizing the border of the series. + */ + border?: PrimaryYAxisMultiLevelLabelsBorder; +} + export interface PrimaryYAxisStripLineFont { /** Font color of the strip line text. @@ -44861,6 +46990,19 @@ export interface PrimaryYAxisStripLine { zIndex?: ej.datavisualization.Chart.ZIndex|string; } +export interface PrimaryYAxisLabelBorder { + + /** Specifies the color of the label border. + * @Default {null} + */ + color?: string; + + /** Specifies the width of the label border. + * @Default {1} + */ + width?: number; +} + export interface PrimaryYAxisTitleFont { /** Font family of the title text. @@ -44913,6 +47055,21 @@ export interface PrimaryYAxisTitle { * @Default {true} */ visible?: boolean; + + /** offset value for axis title. + * @Default {0} + */ + offset?: number; + + /** Specifies the position of the axis title. + * @Default {outside. See Position} + */ + position?: ej.datavisualization.Chart.LabelPosition|string; + + /** Specifies the position of the axis title. + * @Default {center. See Alignment} + */ + alignment?: ej.datavisualization.Chart.TextAlignment|string; } export interface PrimaryYAxis { @@ -44944,6 +47101,11 @@ export interface PrimaryYAxis { */ desiredIntervals?: number; + /** Specifies the placement of labels. + * @Default {ej.datavisualization.Chart.LabelPlacement.BetweenTicks. See LabelPlacement} + */ + labelPlacement?: ej.datavisualization.Chart.LabelPlacement|string; + /** Specifies the position of labels at the edge of the axis. * @Default {ej.datavisualization.Chart.EdgeLabelPlacement.None. See EdgeLabelPlacement} */ @@ -44983,6 +47145,11 @@ export interface PrimaryYAxis { */ labelPosition?: ej.datavisualization.Chart.LabelPosition|string; + /** Specifies the position of the axis labels. + * @Default {center. See Alignment} + */ + alignment?: ej.datavisualization.Chart.LabelAlignment|string; + /** Logarithmic base value. This is applicable only for logarithmic axis. * @Default {10} */ @@ -45058,6 +47225,11 @@ export interface PrimaryYAxis { */ rowSpan?: number; + /** Options for customizing the multi level labels. + * @Default {[ ]} + */ + multiLevelLabels?: Array; + /** Options for customizing the strip lines. * @Default {[ ]} */ @@ -45068,6 +47240,10 @@ export interface PrimaryYAxis { */ tickLinesPosition?: ej.datavisualization.Chart.TickLinesPosition|string; + /** Options for customizing the border of the labels. + */ + labelBorder?: PrimaryYAxisLabelBorder; + /** Options for customizing the axis title. */ title?: PrimaryYAxisTitle; @@ -45223,6 +47399,11 @@ export interface SeriesMarkerDataLabelFont { */ fontFamily?: string; + /** Font color of the data label text. + * @Default {null} + */ + color?: string; + /** Font style of the data label. * @Default {normal. See FontStyle} */ @@ -45274,6 +47455,16 @@ export interface SeriesMarkerDataLabel { */ angle?: number; + /** Maximum label width of the data label. + * @Default {null} + */ + maximumLabelWidth?: number; + + /** Enable the wrap option to the data label. + * @Default {false} + */ + enableWrap?: boolean; + /** Options for customizing the border of the data label. */ border?: SeriesMarkerDataLabelBorder; @@ -45838,6 +48029,29 @@ export interface SeriesPoint { y?: number; } +export interface SeriesCornerRadius { + + /** Specifies the radius for the top left corner. + * @Default {0} + */ + topLeft?: number; + + /** Specifies the radius for the top right corner. + * @Default {0} + */ + topRight?: number; + + /** Specifies the radius for the bottom left corner. + * @Default {0} + */ + bottomLeft?: number; + + /** Specifies the radius for the bottom right corner. + * @Default {0} + */ + bottomRight?: number; +} + export interface SeriesTooltipBorder { /** Border Color of the tooltip. @@ -46079,6 +48293,11 @@ export interface Series { */ bullFillColor?: string; + /** To render the column and bar type series in rectangle/cylinder shape. See ColumnFacet + * @Default {rectangle} + */ + columnFacet?: ej.datavisualization.Chart.ColumnFacet|string; + /** Relative width of the columns in column type series. Value ranges from 0 to 1. Width also depends upon columnSpacing property. * @Default {0.7} */ @@ -46111,7 +48330,7 @@ export interface Series { /** Type of series to be drawn in radar or polar series. * @Default {line. See DrawType} */ - drawType?: boolean; + drawType?: ej.datavisualization.Chart.DrawType|string; /** Enable/disable the animation of series. * @Default {false} @@ -46261,6 +48480,10 @@ export interface Series { */ startAngle?: number; + /** Options for customizing the corner radius. cornerRadius property also takes the numeric input and applies it for all the four corners of the column. + */ + cornerRadius?: SeriesCornerRadius; + /** Options for customizing the tooltip of chart. */ tooltip?: SeriesTooltip; @@ -46325,7 +48548,7 @@ export interface Series { */ pointColorMappingName?: string; - /** zOrder of the series. + /** Z-order of the series. * @Default {0} */ zOrder?: number; @@ -46646,6 +48869,16 @@ Pixel, } module Chart { +enum ColumnFacet +{ +//string +Rectangle, +//string +Cylinder, +} +} +module Chart +{ enum DrawType { //string @@ -46962,6 +49195,16 @@ Y, } module Chart { +enum CrosshairMode +{ +//string +Float, +//string +Grouping, +} +} +module Chart +{ enum CrosshairType { //string @@ -47012,6 +49255,16 @@ WrapAndTrim, } module Chart { +enum LabelPlacement +{ +//string +OnTicks, +//string +BetweenTicks, +} +} +module Chart +{ enum EdgeLabelPlacement { //string @@ -47066,6 +49319,18 @@ MultipleRows, } module Chart { +enum LabelAlignment +{ +//string +Near, +//string +Far, +//string +Center, +} +} +module Chart +{ enum RangePadding { //string @@ -47080,6 +49345,22 @@ Round, } module Chart { +enum MultiLevelLabelsBorderType +{ +//string +Rectangle, +//string +None, +//string +WithoutTopAndBottom, +//string +Brace, +//string +CurlyBrace, +} +} +module Chart +{ enum TextAlignment { //string @@ -47155,6 +49436,7 @@ class RangeNavigator extends ej.Widget { static fn: RangeNavigator; constructor(element: JQuery, options?: RangeNavigator.Model); constructor(element: Element, options?: RangeNavigator.Model); + static Locale: any; model:RangeNavigator.Model; defaults:RangeNavigator.Model; @@ -48269,6 +50551,7 @@ class BulletGraph extends ej.Widget { static fn: BulletGraph; constructor(element: JQuery, options?: BulletGraph.Model); constructor(element: Element, options?: BulletGraph.Model); + static Locale: any; model:BulletGraph.Model; defaults:BulletGraph.Model; @@ -49308,6 +51591,7 @@ class Barcode extends ej.Widget { static fn: Barcode; constructor(element: JQuery, options?: Barcode.Model); constructor(element: Element, options?: Barcode.Model); + static Locale: any; model:Barcode.Model; defaults:Barcode.Model; @@ -49462,6 +51746,7 @@ class Map extends ej.Widget { static fn: Map; constructor(element: JQuery, options?: Map.Model); constructor(element: Element, options?: Map.Model); + static Locale: any; model:Map.Model; defaults:Map.Model; @@ -49703,6 +51988,36 @@ export interface NavigationControl { orientation?: ej.datavisualization.Map.LabelOrientation|string; } +export interface LayersBubbleSettingsColorMappingsRangeColorMapping { + + /** Start range colorMappings in the bubble layer. + * @Default {null} + */ + from?: number; + + /** End range colorMappings in the bubble layer. + * @Default {null} + */ + to?: number; + + /** GradientColors in the bubble layer of map. + */ + gradientColors?: Array; + + /** Color of the bubble layer. + * @Default {null} + */ + color?: string; +} + +export interface LayersBubbleSettingsColorMappings { + + /** Specifies the range colorMappings in the bubble layer. + * @Default {null} + */ + rangeColorMapping?: Array; +} + export interface LayersBubbleSettings { /** Specifies the bubble Opacity value of bubbles for shape layer in map @@ -49718,7 +52033,7 @@ export interface LayersBubbleSettings { /** Specifies the colorMappings of the shape layer in map * @Default {null} */ - colorMappings?: any; + colorMappings?: LayersBubbleSettingsColorMappings; /** Specifies the bubble color valuePath of the shape layer in map * @Default {null} @@ -49761,7 +52076,7 @@ export interface LayersLabelSettings { /** enable or disable the enableSmartLabel property * @Default {false} */ - enableSmartLabel?: boolean; + enableSmartLabel?: Boolean; /** set the labelLength property * @Default {'2'} @@ -50245,6 +52560,7 @@ class TreeMap extends ej.Widget { static fn: TreeMap; constructor(element: JQuery, options?: TreeMap.Model); constructor(element: Element, options?: TreeMap.Model); + static Locale: any; model:TreeMap.Model; defaults:TreeMap.Model; @@ -50516,7 +52832,7 @@ export interface LegendSettings { */ template?: string; - /** Specifies the mode for legendSettings whether defaul or interactive mode + /** Specifies the mode for legendSettings whether default or interactive mode * @Default {default} */ mode?: string; @@ -50776,6 +53092,7 @@ class Diagram extends ej.Widget { static fn: Diagram; constructor(element: JQuery, options?: Diagram.Model); constructor(element: Element, options?: Diagram.Model); + static Locale: any; model:Diagram.Model; defaults:Diagram.Model; @@ -50841,6 +53158,11 @@ class Diagram extends ej.Widget { */ clear(): void; + /** Clears the actions which is recorded to perform undo/redo operation in the diagram. + * @returns {void} + */ + clearHistory(): void; + /** Remove the current selection in diagram * @returns {void} */ @@ -50857,10 +53179,10 @@ class Diagram extends ej.Widget { cut(): void; /** Export the diagram as downloadable files or as data - * @param {Diagram.Options} options to export the desired region of diagram to the desired formats.NameTypeDescriptionfileNamestringname of the file to be downloaded.formatstringformat of the exported file/data. See [File Formats](/js/api/global#fileformats).modestringto set whether to export diagram as a file or as raw data. See [Export Modes](/js/api/global#exportmodes).regionstringto set the region of the diagram to be exported. See [Region](/js/api/global#region).boundsobjectto export any custom region of diagram.marginobjectto set margin to the exported data. - * @returns {string} + * @param {Diagram.Options} options to export the desired region of diagram to the desired formats.NameTypeDescriptionfileNamestringname of the file to be downloaded.formatstringformat of the exported file/data. See [File Formats](/api/js/global#fileformats).modestringto set whether to export diagram as a file or as raw data. See [Export Modes](/api/js/global#exportmodes).regionstringto set the region of the diagram to be exported. See [Region](/api/js/global#region).boundsobjectto export any custom region of diagram.marginobjectto set margin to the exported data. + * @returns {String} */ - exportDiagram(options?: Diagram.Options): string; + exportDiagram(options?: Diagram.Options): String; /** Read a node/connector object by its name * @param {string} name of the node/connector that is to be identified @@ -50869,8 +53191,8 @@ class Diagram extends ej.Widget { findNode(name: string): any; /** Fit the diagram content into diagram viewport - * @param {string} to set the mode of fit to command. See [Fit Mode](/js/api/global#fitmode) - * @param {string} to set whether the region to be fit will be based on diagram elements or page settings [Region](/js/api/global#region) + * @param {string} to set the mode of fit to command. See [Fit Mode](/api/js/global#fitmode) + * @param {string} to set whether the region to be fit will be based on diagram elements or page settings [Region](/api/js/global#region) * @param {any} to set the required margin * @returns {void} */ @@ -51093,15 +53415,15 @@ export interface Options { */ fileName?: string; - /** format of the exported file/data. See [File Formats](/js/api/global#fileformats). + /** format of the exported file/data. See [File Formats](/api/js/global#fileformats). */ format?: string; - /** to set whether to export diagram as a file or as raw data. See [Export Modes](/js/api/global#exportmodes). + /** to set whether to export diagram as a file or as raw data. See [Export Modes](/api/js/global#exportmodes). */ mode?: string; - /** to set the region of the diagram to be exported. See [Region](/js/api/global#region). + /** to set the region of the diagram to be exported. See [Region](/api/js/global#region). */ region?: string; @@ -51119,11 +53441,11 @@ export interface Model { /** Defines the background color of diagram elements * @Default {transparent} */ - backgroundColor?: string; + backgroundColor?: String; /** Defines the path of the background image of diagram elements */ - backgroundImage?: string; + backgroundImage?: String; /** Sets the direction of line bridges. * @Default {ej.datavisualization.Diagram.BridgeDirection.Top} @@ -51170,17 +53492,17 @@ export interface Model { /** Enables or disables auto scroll in diagram * @Default {true} */ - enableAutoScroll?: boolean; + enableAutoScroll?: Boolean; /** Enables or disables diagram context menu * @Default {true} */ - enableContextMenu?: boolean; + enableContextMenu?: Boolean; /** Specifies the height of the diagram * @Default {null} */ - height?: string; + height?: String; /** Customizes the undo redo functionality */ @@ -51193,7 +53515,7 @@ export interface Model { /** Defines the current culture of diagram * @Default {en-US} */ - locale?: string; + locale?: String; /** Array of JSON objects where each object represents a node * @Default {[]} @@ -51220,7 +53542,7 @@ export interface Model { /** Enables or disables tooltip of diagram * @Default {true} */ - showTooltip?: boolean; + showTooltip?: Boolean; /** Defines the gridlines and defines how and when the objects have to be snapped */ @@ -51239,12 +53561,12 @@ export interface Model { /** Specifies the width of the diagram * @Default {null} */ - width?: string; + width?: String; /** Sets the factor by which we can zoom in or zoom out * @Default {0.2} */ - zoomFactor?: number; + zoomFactor?: Number; /** Triggers When auto scroll is changed */ autoScrollChange? (e: AutoScrollChangeEventArgs): void; @@ -51288,6 +53610,9 @@ export interface Model { /** Triggers when a symbol is dragged and dropped from symbol palette to drawing area */ drop? (e: DropEventArgs): void; + /** Triggers when editor got focus at the time of node's label or text node editing. */ + editorFocusChange? (e: EditorFocusChangeEventArgs): void; + /** Triggers when a child is added to or removed from a group */ groupChange? (e: GroupChangeEventArgs): void; @@ -51339,6 +53664,10 @@ export interface AutoScrollChangeEventArgs { /** Returns the delay between subsequent auto scrolls */ delay?: string; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface ClickEventArgs { @@ -51366,6 +53695,10 @@ export interface ClickEventArgs { /** parameter returns the actual click event arguments that explains which button is clicked */ event?: any; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface ConnectionChangeEventArgs { @@ -51385,6 +53718,10 @@ export interface ConnectionChangeEventArgs { /** parameter defines whether to cancel the change or not */ cancel?: boolean; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface ConnectorCollectionChangeEventArgs { @@ -51400,6 +53737,14 @@ export interface ConnectorCollectionChangeEventArgs { /** parameter defines whether to cancel the collection change or not */ cancel?: boolean; + + /** triggers before and after adding the connector in the diagram which can be differentiated through `state` argument. We can cancel the event only before adding the connector. + */ + state?: string; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface ConnectorSourceChangeEventArgs { @@ -51427,6 +53772,10 @@ export interface ConnectorSourceChangeEventArgs { /** parameter defines whether to cancel the change or not */ cancel?: boolean; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface ConnectorTargetChangeEventArgs { @@ -51454,6 +53803,10 @@ export interface ConnectorTargetChangeEventArgs { /** parameter defines whether to cancel the change or not */ cancel?: boolean; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface ContextMenuBeforeOpenEventArgs { @@ -51469,6 +53822,10 @@ export interface ContextMenuBeforeOpenEventArgs { /** parameter returns the object that was clicked */ target?: any; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface ContextMenuClickEventArgs { @@ -51496,6 +53853,10 @@ export interface ContextMenuClickEventArgs { /** parameter defines whether to execute the click event or not */ canExecute?: boolean; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface DoubleClickEventArgs { @@ -51507,6 +53868,10 @@ export interface DoubleClickEventArgs { /** parameter returns the selected object */ element?: any; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface DragEventArgs { @@ -51530,6 +53895,10 @@ export interface DragEventArgs { /** parameter returns whether or not to cancel the drag event */ cancel?: boolean; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface DragEnterEventArgs { @@ -51541,6 +53910,10 @@ export interface DragEnterEventArgs { /** parameter returns whether to add or remove the symbol from diagram */ cancel?: boolean; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface DragLeaveEventArgs { @@ -51548,6 +53921,10 @@ export interface DragLeaveEventArgs { /** parameter returns the node or connector that is dragged outside of the diagram */ element?: any; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface DragOverEventArgs { @@ -51575,6 +53952,10 @@ export interface DragOverEventArgs { /** parameter returns whether or not to cancel the dragOver event */ cancel?: boolean; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface DropEventArgs { @@ -51597,7 +53978,14 @@ export interface DropEventArgs { /** parameter returns the enum which defines the type of the source */ - sourceType?: string; + sourceType?: String; + + /** parameter returns the id of the diagram + */ + diagramId?: string; +} + +export interface EditorFocusChangeEventArgs { } export interface GroupChangeEventArgs { @@ -51617,6 +54005,10 @@ export interface GroupChangeEventArgs { /** parameter returns the cause of group change("group", unGroup") */ cause?: string; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface HistoryChangeEventArgs { @@ -51628,6 +54020,10 @@ export interface HistoryChangeEventArgs { /** A collection of objects that are changed in the last undo/redo */ Source?: Array; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface ItemClickEventArgs { @@ -51647,6 +54043,10 @@ export interface ItemClickEventArgs { /** parameter returns the actual click event arguments that explains which button is clicked */ event?: any; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface MouseEnterEventArgs { @@ -51662,6 +54062,10 @@ export interface MouseEnterEventArgs { /** parameter returns the target object over which the selected object is dragged */ target?: any; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface MouseLeaveEventArgs { @@ -51677,6 +54081,10 @@ export interface MouseLeaveEventArgs { /** parameter returns the target object over which the selected object is dragged */ target?: any; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface MouseOverEventArgs { @@ -51692,6 +54100,10 @@ export interface MouseOverEventArgs { /** parameter returns the object over which the element is being dragged. */ target?: any; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface NodeCollectionChangeEventArgs { @@ -51707,6 +54119,14 @@ export interface NodeCollectionChangeEventArgs { /** parameter defines whether to cancel the collection change or not */ cancel?: boolean; + + /** triggers before and after adding the node in the diagram which can be differentiated through `state` argument. We can cancel the event only before adding the node + */ + state?: string; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface PropertyChangeEventArgs { @@ -51717,7 +54137,7 @@ export interface PropertyChangeEventArgs { /** parameter returns the action is nudge or not */ - cause?: string; + cause?: String; /** parameter returns the new value of the node property that is being changed */ @@ -51730,6 +54150,10 @@ export interface PropertyChangeEventArgs { /** parameter returns the name of the property that is changed */ propertyName?: string; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface RotationChangeEventArgs { @@ -51749,6 +54173,10 @@ export interface RotationChangeEventArgs { /** parameter to specify whether or not to cancel the event */ cancel?: boolean; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface ScrollChangeEventArgs { @@ -51760,6 +54188,10 @@ export interface ScrollChangeEventArgs { /** parameter returns the previous zoom value, horizontal and vertical scroll offsets. */ oldValues?: any; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface SegmentChangeEventArgs { @@ -51779,6 +54211,10 @@ export interface SegmentChangeEventArgs { /** parameter to specify whether or not to cancel the event */ cancel?: boolean; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface SelectionChangeEventArgs { @@ -51806,6 +54242,14 @@ export interface SelectionChangeEventArgs { /** parameter to specify whether or not to cancel the selection change event */ cancel?: boolean; + + /** triggers before and after adding the selection to the object in the diagram which can be differentiated through `state` argument. We can cancel the event only before the selection of the object. + */ + state?: string; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface SizeChangeEventArgs { @@ -51833,6 +54277,10 @@ export interface SizeChangeEventArgs { /** parameter returns the difference between new and old value */ offset?: any; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface TextChangeEventArgs { @@ -51848,6 +54296,10 @@ export interface TextChangeEventArgs { /** parameter returns the keyCode of the key entered */ keyCode?: string; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface CreateEventArgs { @@ -51859,6 +54311,10 @@ export interface CreateEventArgs { /** Returns the name of the event */ type?: string; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface BackgroundImage { @@ -51867,16 +54323,6 @@ export interface BackgroundImage { * @Default {ej.datavisualization.Diagram.ImageAlignment.XMidYMid} */ alignment?: ej.datavisualization.Diagram.ImageAlignment |string; - - /** Defines how the background image should be scaled/stretched - * @Default {ej.datavisualization.Diagram.ScaleConstraints.Meet} - */ - scale?: ej.datavisualization.Diagram.ScaleConstraints |string; - - /** Sets the source path of the background image - * @Default {null} - */ - source?: string; } export interface CommandManagerCommandsGesture { @@ -51953,42 +54399,42 @@ export interface ConnectorsLabel { /** Enables/disables the bold style * @Default {false} */ - bold?: boolean; + bold?: Boolean; /** Sets the border color of the label * @Default {transparent} */ - borderColor?: string; + borderColor?: String; /** Sets the border width of the label * @Default {0} */ - borderWidth?: number; + borderWidth?: Number; /** Defines whether the label should be aligned within the connector boundaries * @Default {true} */ - boundaryConstraints?: boolean; + boundaryConstraints?: Boolean; /** Sets the fill color of the text area * @Default {transparent} */ - fillColor?: string; + fillColor?: String; /** Sets the font color of the text * @Default {black} */ - fontColor?: string; + fontColor?: String; /** Sets the font family of the text * @Default {Arial} */ - fontFamily?: string; + fontFamily?: String; /** Defines the font size of the text * @Default {12} */ - fontSize?: number; + fontSize?: Number; /** Sets the horizontal alignment of the label. * @Default {ej.datavisualization.Diagram.HorizontalAlignment.Center} @@ -51998,7 +54444,7 @@ export interface ConnectorsLabel { /** Enables/disables the italic style * @Default {false} */ - italic?: boolean; + italic?: Boolean; /** Gets whether the label is currently being edited or not. * @Default {ej.datavisualization.Diagram.LabelEditMode.Edit} @@ -52007,7 +54453,7 @@ export interface ConnectorsLabel { /** Sets the unique identifier of the label */ - name?: string; + name?: String; /** Sets the fraction/ratio(relative to connector) that defines the position of the label * @Default {ej.datavisualization.Diagram.Point(0.5, 0.5)} @@ -52022,12 +54468,12 @@ export interface ConnectorsLabel { /** Defines the transparency of labels * @Default {1} */ - opacity?: number; + opacity?: Number; /** Defines whether the label is editable or not * @Default {false} */ - readOnly?: boolean; + readOnly?: Boolean; /** Defines whether the label should be positioned whether relative to segments or connector boundaries * @Default {ej.datavisualization.Diagram.LabelRelativeMode.SegmentPath} @@ -52037,16 +54483,16 @@ export interface ConnectorsLabel { /** Defines the angle to which the label needs to be rotated * @Default {0} */ - rotateAngle?: number; + rotateAngle?: Number; /** Sets the position of the label with respect to the total segment length * @Default {0.5} */ - segmentOffset?: string; + segmentOffset?: String; /** Defines the label text */ - text?: string; + text?: String; /** Defines how to align the text inside the label. * @Default {ej.datavisualization.Diagram.TextAlign.Center} @@ -52066,12 +54512,12 @@ export interface ConnectorsLabel { /** Enables or disables the visibility of the label * @Default {true} */ - visible?: boolean; + visible?: Boolean; /** Sets the width of the label(the maximum value of label width and the connector width will be considered as label width) * @Default {50} */ - width?: number; + width?: Number; /** Defines how the label text needs to be wrapped. * @Default {ej.datavisualization.Diagram.TextWrapping.WrapWithOverflow} @@ -52083,12 +54529,12 @@ export interface ConnectorsSegment { /** Sets the direction of orthogonal segment */ - direction?: string; + direction?: String; /** Describes the length of orthogonal segment * @Default {undefined} */ - length?: number; + length?: Number; /** Describes the end point of bezier/straight segment * @Default {Diagram.Point()} @@ -52121,6 +54567,41 @@ export interface ConnectorsSegment { vector2?: any; } +export interface ConnectorsShapeMultiplicitySource { + + /** Defines the source label to connector. Applicable, if the connector is of type "UML" + * @Default {true} + */ + optional?: boolean; + + /** Defines the source label to connector. Applicable, if the connector is of type "UML" + * @Default {null} + */ + lowerBounds?: Number; + + /** Defines the source label to connector. Applicable, if the connector is of type "UML" + * @Default {null} + */ + upperBounds?: Number; +} + +export interface ConnectorsShapeMultiplicity { + + /** Sets the type of the multiplicity. Applicable, if the connector is of type "classifier" + * @Default {ej.datavisualization.Diagram.Multiplicity.OneToOne} + */ + type?: ej.datavisualization.Diagram.Multiplicity|string; + + /** Defines the source label to connector. Applicable, if the connector is of type "UML" + */ + source?: ConnectorsShapeMultiplicitySource; + + /** Defines the target label to connector. Applicable, if the connector is of type "UML" + * @Default {true} + */ + target?: ej.datavisualization.Diagram.ConnectorsShapeMultiplicitySource|string; +} + export interface ConnectorsShape { /** Sets the type of the connector @@ -52151,11 +54632,12 @@ export interface ConnectorsShape { /** Defines the role of the connector in a UML Class Diagram. Applicable, if the type of the connector is "classifier". * @Default {ej.datavisualization.Diagram.ClassifierShapes.Association} */ - relationship?: string; + relationship?: ej.datavisualization.Diagram.ClassifierShapes|string; - /** Defines the multiplicity of a relationship in UML class diagram + /** Defines the multiplicity option of the connector + * @Default {null} */ - multiplicity?: string; + multiplicity?: ConnectorsShapeMultiplicity; } export interface ConnectorsSourceDecorator { @@ -52163,26 +54645,26 @@ export interface ConnectorsSourceDecorator { /** Sets the border color of the source decorator * @Default {black} */ - borderColor?: string; + borderColor?: String; /** Sets the border width of the decorator * @Default {1} */ - borderWidth?: number; + borderWidth?: Number; /** Sets the fill color of the source decorator * @Default {black} */ - fillColor?: string; + fillColor?: String; /** Sets the height of the source decorator * @Default {8} */ - height?: number; + height?: Number; /** Defines the custom shape of the source decorator */ - pathData?: string; + pathData?: String; /** Defines the shape of the source decorator. * @Default {ej.datavisualization.Diagram.DecoratorShapes.Arrow} @@ -52192,7 +54674,7 @@ export interface ConnectorsSourceDecorator { /** Defines the width of the source decorator * @Default {8} */ - width?: number; + width?: Number; } export interface ConnectorsSourcePoint { @@ -52200,12 +54682,12 @@ export interface ConnectorsSourcePoint { /** Defines the x-coordinate of a position * @Default {0} */ - x?: number; + x?: Number; /** Defines the y-coordinate of a position * @Default {0} */ - y?: number; + y?: Number; } export interface ConnectorsTargetDecorator { @@ -52213,21 +54695,21 @@ export interface ConnectorsTargetDecorator { /** Sets the border color of the decorator * @Default {black} */ - borderColor?: string; + borderColor?: String; /** Sets the color with which the decorator will be filled * @Default {black} */ - fillColor?: string; + fillColor?: String; /** Defines the height of the target decorator * @Default {8} */ - height?: number; + height?: Number; /** Defines the custom shape of the target decorator */ - pathData?: string; + pathData?: String; /** Defines the shape of the target decorator. * @Default {ej.datavisualization.Diagram.DecoratorShapes.Arrow} @@ -52237,7 +54719,7 @@ export interface ConnectorsTargetDecorator { /** Defines the width of the target decorator * @Default {8} */ - width?: number; + width?: Number; } export interface Connector { @@ -52250,7 +54732,7 @@ export interface Connector { /** Defines the width of the line bridges * @Default {10} */ - bridgeSpace?: number; + bridgeSpace?: Number; /** Enables or disables the behaviors of connectors. * @Default {ej.datavisualization.Diagram.ConnectorConstraints.Default} @@ -52260,11 +54742,11 @@ export interface Connector { /** Defines the radius of the rounded corner * @Default {0} */ - cornerRadius?: number; + cornerRadius?: Number; /** Configures the styles of shapes */ - cssClass?: string; + cssClass?: String; /** Sets the horizontal alignment of the connector. Applicable, if the parent of the connector is a container. * @Default {ej.datavisualization.Diagram.HorizontalAlignment.Left} @@ -52279,50 +54761,50 @@ export interface Connector { /** Sets the stroke color of the connector * @Default {black} */ - lineColor?: string; + lineColor?: String; /** Sets the pattern of dashes and gaps used to stroke the path of the connector */ - lineDashArray?: string; + lineDashArray?: String; /** Defines the padding value to ease the interaction with connectors * @Default {10} */ - lineHitPadding?: number; + lineHitPadding?: Number; /** Sets the width of the line * @Default {1} */ - lineWidth?: number; + lineWidth?: Number; /** Defines the minimum space to be left between the bottom of parent bounds and the connector. Applicable, if the parent is a container. * @Default {0} */ - marginBottom?: number; + marginBottom?: Number; /** Defines the minimum space to be left between the left of parent bounds and the connector. Applicable, if the parent is a container. * @Default {0} */ - marginLeft?: number; + marginLeft?: Number; /** Defines the minimum space to be left between the right of parent bounds and the connector. Applicable, if the parent is a container. * @Default {0} */ - marginRight?: number; + marginRight?: Number; /** Defines the minimum space to be left between the top of parent bounds and the connector. Applicable, if the parent is a container. * @Default {0} */ - marginTop?: number; + marginTop?: Number; /** Sets a unique name for the connector */ - name?: string; + name?: String; /** Defines the transparency of the connector * @Default {1} */ - opacity?: number; + opacity?: Number; /** Defines the size and preview size of the node to add that to symbol palette. To explore palette item, refer Palette Item * @Default {null} @@ -52331,7 +54813,7 @@ export interface Connector { /** Sets the parent name of the connector. */ - parent?: string; + parent?: String; /** An array of JSON objects where each object represents a segment * @Default {[ { type:straight } ]} @@ -52350,12 +54832,12 @@ export interface Connector { /** Sets the source node of the connector */ - sourceNode?: string; + sourceNode?: String; /** Defines the space to be left between the source node and the source point of a connector * @Default {0} */ - sourcePadding?: number; + sourcePadding?: Number; /** Describes the start point of the connector * @Default {ej.datavisualization.Diagram.Point()} @@ -52364,7 +54846,7 @@ export interface Connector { /** Sets the source port of the connector */ - sourcePort?: string; + sourcePort?: String; /** Defines the target decorator of the connector * @Default {{ shape:arrow, width: 8, height:8, borderColor:black, fillColor:black }} @@ -52373,12 +54855,12 @@ export interface Connector { /** Sets the target node of the connector */ - targetNode?: string; + targetNode?: String; /** Defines the space to be left between the target node and the target point of the connector * @Default {0} */ - targetPadding?: number; + targetPadding?: Number; /** Describes the end point of the connector * @Default {ej.datavisualization.Diagram.Point()} @@ -52387,7 +54869,7 @@ export interface Connector { /** Sets the targetPort of the connector */ - targetPort?: string; + targetPort?: String; /** Defines the tooltip that should be shown when the mouse hovers over connector. For tooltip properties, refer Tooltip * @Default {null} @@ -52402,12 +54884,12 @@ export interface Connector { /** Enables or disables the visibility of connector * @Default {true} */ - visible?: boolean; + visible?: Boolean; /** Sets the z-index of the connector * @Default {0} */ - zOrder?: number; + zOrder?: Number; } export interface ContextMenu { @@ -52420,7 +54902,7 @@ export interface ContextMenu { /** To set whether to display the default context menu items or not * @Default {false} */ - showCustomMenuItemsOnly?: boolean; + showCustomMenuItemsOnly?: Boolean; } export interface DataSourceSettings { @@ -52432,26 +54914,26 @@ export interface DataSourceSettings { /** Sets the unique id of the data source items */ - id?: string; + id?: String; /** Defines the parent id of the data source item * @Default {''} */ - parent?: string; + parent?: String; /** Describes query to retrieve a set of data from the specified datasource * @Default {null} */ - query?: string; + query?: String; /** Sets the unique id of the root data source item */ - root?: string; + root?: String; /** Describes the name of the table on which the specified query has to be executed * @Default {null} */ - tableName?: string; + tableName?: String; } export interface DefaultSettings { @@ -52495,6 +54977,16 @@ export interface HistoryManager { */ redo?: Function; + /** The redoStack property is used to get the number of redo actions to be stored on the history manager. Its an read-only property and the collection should not be modified. + * @Default {[]} + */ + redoStack?: Array; + + /** The stackLimit property used to restrict the undo and redo actions to a certain limit. + * @Default {null} + */ + stackLimit?: Number; + /** A method that starts to group the changes to revert/restore them in a single undo or redo */ startGroupAction?: Function; @@ -52502,6 +54994,11 @@ export interface HistoryManager { /** Defines what should be happened while trying to revert a custom change */ undo?: Function; + + /** The undoStack property is used to get the number of undo actions to be stored on the history manager. Its an read-only property and the collection should not be modified. + * @Default {[]} + */ + undoStack?: Array; } export interface Layout { @@ -52513,7 +55010,7 @@ export interface Layout { /** Defines the fixed node with reference to which, the layout will be arranged and fixed node will not be repositioned */ - fixedNode?: string; + fixedNode?: String; /** Customizes the orientation of trees/sub trees. For orientations, see Chart Orientations. For chart types, see Chart Types * @Default {null} @@ -52523,7 +55020,7 @@ export interface Layout { /** Sets the space to be horizontally left between nodes * @Default {30} */ - horizontalSpacing?: number; + horizontalSpacing?: Number; /** Defines the space to be left between layout bounds and layout. * @Default {ej.datavisualization.Diagram.Margin()} @@ -52553,7 +55050,7 @@ export interface Layout { /** Sets the space to be vertically left between nodes * @Default {30} */ - verticalSpacing?: number; + verticalSpacing?: Number; } export interface NodesAnnotation { @@ -52561,7 +55058,7 @@ export interface NodesAnnotation { /** Sets the angle between the BPMN shape and the annotation * @Default {0} */ - angle?: number; + angle?: Number; /** Sets the direction of the text annotation * @Default {ej.datavisualization.Diagram.BPMNAnnotationDirections.Left} @@ -52571,37 +55068,37 @@ export interface NodesAnnotation { /** Sets the height of the text annotation * @Default {20} */ - height?: number; + height?: Number; /** Sets the distance between the BPMN shape and the annotation * @Default {0} */ - length?: number; + length?: Number; /** Defines the additional information about the flow object in a BPMN Process */ - text?: string; + text?: String; /** Sets the width of the text annotation * @Default {20} */ - width?: number; + width?: Number; } export interface NodesClassAttribute { /** Sets the name of the attribute */ - name?: string; + name?: String; /** Sets the data type of attribute */ - type?: string; + type?: String; /** Defines the visibility of the attribute * @Default {ej.datavisualization.Diagram.ScopeValueDefaults.Public} */ - scope?: string; + scope?: String; } export interface NodesClassMethod { @@ -52609,14 +55106,14 @@ export interface NodesClassMethod { /** Sets the visibility of the method. * @Default {ej.datavisualization.Diagram.ScopeValueDefaults.Public} */ - scope?: string; + scope?: String; } export interface NodesClass { /** Sets the name of class. */ - name?: string; + name?: String; /** Defines the collection of attributes * @Default {[]} @@ -52629,12 +55126,60 @@ export interface NodesClass { methods?: Array; } +export interface NodesCollapseIcon { + + /** Sets the border color for collapse icon of node + * @Default {black} + */ + borderColor?: String; + + /** Sets the border width for collapse icon of node + * @Default {1} + */ + borderWidth?: Number; + + /** Sets the fill color for collapse icon of node + * @Default {white} + */ + fillColor?: String; + + /** Defines the height for collapse icon of node + * @Default {15} + */ + height?: Number; + + /** Sets the horizontal alignment of the icon. + * @Default {ej.datavisualization.Diagram.HorizontalAlignment.Center} + */ + horizontalAlignment?: ej.datavisualization.Diagram.HorizontalAlignment|string; + + /** To set the margin for the collapse icon of node + * @Default {ej.datavisualization.Diagram.Margin()} + */ + margin?: any; + + /** Sets the fraction/ratio(relative to node) that defines the position of the icon + * @Default {ej.datavisualization.Diagram.Point(0.5, 1)} + */ + offset?: any; + + /** Defines the shape of the collapsed state of the node. + * @Default {ej.datavisualization.Diagram.IconShapes.None} + */ + shape?: ej.datavisualization.Diagram.IconShapes|string; + + /** Sets the vertical alignment of the icon. + * @Default {ej.datavisualization.Diagram.VerticalAlignment.Center} + */ + verticalAlignment?: ej.datavisualization.Diagram.VerticalAlignment|string; +} + export interface NodesContainer { /** Defines the orientation of the container. Applicable, if the group is a container. * @Default {vertical} */ - orientation?: string; + orientation?: String; /** Sets the type of the container. Applicable if the group is a container. * @Default {ej.datavisualization.Diagram.ContainerType.Canvas} @@ -52652,21 +55197,21 @@ export interface NodesData { /** Defines whether the BPMN data object is a collection or not * @Default {false} */ - collection?: boolean; + collection?: Boolean; } export interface NodesEnumerationMember { /** Sets the name of the enumeration member */ - name?: string; + name?: String; } export interface NodesEnumeration { /** Sets the name of the Enumeration */ - name?: string; + name?: String; /** Defines the collection of enumeration members * @Default {[]} @@ -52674,6 +55219,54 @@ export interface NodesEnumeration { members?: Array; } +export interface NodesExpandIcon { + + /** Sets the border color for expand icon of node + * @Default {black} + */ + borderColor?: String; + + /** Sets the border width for expand icon of node + * @Default {1} + */ + borderWidth?: Number; + + /** Sets the fill color for expand icon of node + * @Default {white} + */ + fillColor?: String; + + /** Defines the height for expand icon of node + * @Default {15} + */ + height?: Number; + + /** Sets the horizontal alignment of the icon. + * @Default {ej.datavisualization.Diagram.HorizontalAlignment.Center} + */ + horizontalAlignment?: ej.datavisualization.Diagram.HorizontalAlignment|string; + + /** To set the margin for the expand icon of node + * @Default {ej.datavisualization.Diagram.Margin()} + */ + margin?: any; + + /** Sets the fraction/ratio(relative to node) that defines the position of the icon + * @Default {ej.datavisualization.Diagram.Point(0.5, 1)} + */ + offset?: any; + + /** Defines the shape of the expanded state of the node. + * @Default {ej.datavisualization.Diagram.IconShapes.None} + */ + shape?: ej.datavisualization.Diagram.IconShapes|string; + + /** Sets the vertical alignment of the icon. + * @Default {ej.datavisualization.Diagram.VerticalAlignment.Center} + */ + verticalAlignment?: ej.datavisualization.Diagram.VerticalAlignment|string; +} + export interface NodesGradientLinearGradient { /** Defines the different colors and the region of color transitions @@ -52684,22 +55277,22 @@ export interface NodesGradientLinearGradient { /** Defines the left most position(relative to node) of the rectangular region that needs to be painted * @Default {0} */ - x1?: number; + x1?: Number; /** Defines the right most position(relative to node) of the rectangular region that needs to be painted * @Default {0} */ - x2?: number; + x2?: Number; /** Defines the top most position(relative to node) of the rectangular region that needs to be painted * @Default {0} */ - y1?: number; + y1?: Number; /** Defines the bottom most position(relative to node) of the rectangular region that needs to be painted * @Default {0} */ - y2?: number; + y2?: Number; } export interface NodesGradientRadialGradient { @@ -52707,22 +55300,22 @@ export interface NodesGradientRadialGradient { /** Defines the position of the outermost circle * @Default {0} */ - cx?: number; + cx?: Number; /** Defines the outer most circle of the radial gradient * @Default {0} */ - cy?: number; + cy?: Number; /** Defines the innermost circle of the radial gradient * @Default {0} */ - fx?: number; + fx?: Number; /** Defines the innermost circle of the radial gradient * @Default {0} */ - fy?: number; + fy?: Number; /** Defines the different colors and the region of color transitions. * @Default {[]} @@ -52734,17 +55327,17 @@ export interface NodesGradientStop { /** Sets the color to be filled over the specified region */ - color?: string; + color?: String; /** Sets the position where the previous color transition ends and a new color transition starts * @Default {0} */ - offset?: number; + offset?: Number; /** Describes the transparency level of the region * @Default {1} */ - opacity?: number; + opacity?: Number; } export interface NodesGradient { @@ -52766,29 +55359,29 @@ export interface NodesInterfaceAttribute { /** Sets the name of the attribute */ - name?: string; + name?: String; /** Sets the type of the attribute */ - type?: string; + type?: String; /** Sets the visibility of the attribute */ - scope?: string; + scope?: String; } export interface NodesInterfaceMethod { /** Sets the visibility of the method */ - scope?: string; + scope?: String; } export interface NodesInterface { /** Sets the name of the interface */ - name?: string; + name?: String; /** Defines a collection of attributes of the interface * @Default {[]} @@ -52806,37 +55399,37 @@ export interface NodesLabel { /** Enables/disables the bold style * @Default {false} */ - bold?: boolean; + bold?: Boolean; /** Sets the border color of the label * @Default {transparent} */ - borderColor?: string; + borderColor?: String; /** Sets the border width of the label * @Default {0} */ - borderWidth?: number; + borderWidth?: Number; /** Sets the fill color of the text area * @Default {transparent} */ - fillColor?: string; + fillColor?: String; /** Sets the font color of the text * @Default {black} */ - fontColor?: string; + fontColor?: String; /** Sets the font family of the text * @Default {Arial} */ - fontFamily?: string; + fontFamily?: String; /** Defines the font size of the text * @Default {12} */ - fontSize?: number; + fontSize?: Number; /** Sets the horizontal alignment of the label. * @Default {ej.datavisualization.Diagram.HorizontalAlignment.Center} @@ -52846,7 +55439,7 @@ export interface NodesLabel { /** Enables/disables the italic style * @Default {false} */ - italic?: boolean; + italic?: Boolean; /** To set the margin of the label * @Default {ej.datavisualization.Diagram.Margin()} @@ -52860,7 +55453,7 @@ export interface NodesLabel { /** Sets the unique identifier of the label */ - name?: string; + name?: String; /** Sets the fraction/ratio(relative to node) that defines the position of the label * @Default {ej.datavisualization.Diagram.Point(0.5, 0.5)} @@ -52870,21 +55463,21 @@ export interface NodesLabel { /** Defines the transparency of the labels * @Default {1} */ - opacity?: number; + opacity?: Number; /** Defines whether the label is editable or not * @Default {false} */ - readOnly?: boolean; + readOnly?: Boolean; /** Defines the angle to which the label needs to be rotated * @Default {0} */ - rotateAngle?: number; + rotateAngle?: Number; /** Defines the label text */ - text?: string; + text?: String; /** Defines how to align the text inside the label. * @Default {ej.datavisualization.Diagram.TextAlign.Center} @@ -52904,12 +55497,12 @@ export interface NodesLabel { /** Enables or disables the visibility of the label * @Default {true} */ - visible?: boolean; + visible?: Boolean; /** Sets the width of the label(the maximum value of label width and the node width will be considered as label width) * @Default {50} */ - width?: number; + width?: Number; /** Defines how the label text needs to be wrapped. * @Default {ej.datavisualization.Diagram.TextWrapping.WrapWithOverflow} @@ -52947,7 +55540,7 @@ export interface NodesLane { /** Defines the fill color of the lane * @Default {white} */ - fillColor?: string; + fillColor?: String; /** Defines the header of the lane * @Default {{ text: Function, fontSize: 11 }} @@ -52957,16 +55550,16 @@ export interface NodesLane { /** Defines the object as a lane * @Default {false} */ - isLane?: boolean; + isLane?: Boolean; /** Sets the unique identifier of the lane */ - name?: string; + name?: String; /** Sets the orientation of the lane. * @Default {vertical} */ - orientation?: string; + orientation?: String; } export interface NodesPaletteItem { @@ -52974,12 +55567,12 @@ export interface NodesPaletteItem { /** Defines whether the symbol should be drawn at its actual size regardless of precedence factors or not * @Default {true} */ - enableScale?: boolean; + enableScale?: Boolean; /** Defines the height of the symbol * @Default {0} */ - height?: number; + height?: Number; /** Defines the margin of the symbol item * @Default {{ left: 4, right: 4, top: 4, bottom: 4 }} @@ -52989,17 +55582,17 @@ export interface NodesPaletteItem { /** Defines the preview height of the symbol * @Default {undefined} */ - previewHeight?: number; + previewHeight?: Number; /** Defines the preview width of the symbol * @Default {undefined} */ - previewWidth?: number; + previewWidth?: Number; /** Defines the width of the symbol * @Default {0} */ - width?: number; + width?: Number; } export interface NodesPhase { @@ -53012,36 +55605,36 @@ export interface NodesPhase { /** Defines the line color of the splitter that splits adjacent phases. * @Default {#606060} */ - lineColor?: string; + lineColor?: String; /** Sets the dash array that used to stroke the phase splitter * @Default {3,3} */ - lineDashArray?: string; + lineDashArray?: String; /** Sets the lineWidth of the phase * @Default {1} */ - lineWidth?: number; + lineWidth?: Number; /** Sets the unique identifier of the phase */ - name?: string; + name?: String; /** Sets the length of the smaller region(phase) of a swimlane * @Default {100} */ - offset?: number; + offset?: Number; /** Sets the orientation of the phase * @Default {horizontal} */ - orientation?: string; + orientation?: String; /** Sets the type of the object as phase * @Default {phase} */ - type?: string; + type?: String; } export interface NodesPort { @@ -53049,17 +55642,17 @@ export interface NodesPort { /** Sets the border color of the port * @Default {#1a1a1a} */ - borderColor?: string; + borderColor?: String; /** Sets the stroke width of the port * @Default {1} */ - borderWidth?: number; + borderWidth?: Number; /** Defines the space to be left between the port bounds and its incoming and outgoing connections. * @Default {0} */ - connectorPadding?: number; + connectorPadding?: Number; /** Defines whether connections can be created with the port * @Default {ej.datavisualization.Diagram.PortConstraints.Connect} @@ -53069,11 +55662,11 @@ export interface NodesPort { /** Sets the fill color of the port * @Default {white} */ - fillColor?: string; + fillColor?: String; /** Sets the unique identifier of the port */ - name?: string; + name?: String; /** Defines the position of the port as fraction/ ratio relative to node * @Default {ej.datavisualization.Diagram.Point(0, 0)} @@ -53082,7 +55675,7 @@ export interface NodesPort { /** Defines the path data to draw the port. Applicable, if the port shape is path. */ - pathData?: string; + pathData?: String; /** Defines the shape of the port. * @Default {ej.datavisualization.Diagram.PortShapes.Square} @@ -53092,7 +55685,7 @@ export interface NodesPort { /** Defines the size of the port * @Default {8} */ - size?: number; + size?: Number; /** Defines when the port should be visible. * @Default {ej.datavisualization.Diagram.PortVisibility.Default} @@ -53105,17 +55698,17 @@ export interface NodesShadow { /** Defines the angle of the shadow relative to node * @Default {45} */ - angle?: number; + angle?: Number; /** Sets the distance to move the shadow relative to node * @Default {5} */ - distance?: number; + distance?: Number; /** Defines the opaque of the shadow * @Default {0.7} */ - opacity?: number; + opacity?: Number; } export interface NodesSubProcess { @@ -53123,7 +55716,7 @@ export interface NodesSubProcess { /** Defines whether the BPMN sub process is without any prescribed order or not * @Default {false} */ - adhoc?: boolean; + adhoc?: Boolean; /** Sets the boundary of the BPMN process * @Default {ej.datavisualization.Diagram.BPMNBoundary.Default} @@ -53133,12 +55726,12 @@ export interface NodesSubProcess { /** Sets whether the BPMN subprocess is triggered as a compensation of a specific activity * @Default {false} */ - compensation?: boolean; + compensation?: Boolean; /** Sets whether the BPMN subprocess is triggered as a collapsed of a specific activity * @Default {true} */ - collapsed?: boolean; + collapsed?: Boolean; /** Sets the type of the event by which the sub-process will be triggered * @Default {ej.datavisualization.Diagram.BPMNEvents.Start} @@ -53154,6 +55747,11 @@ export interface NodesSubProcess { */ loop?: ej.datavisualization.Diagram.BPMNLoops|string; + /** Defines the children for BPMN's SubProcess + * @Default {[]} + */ + Processes?: Array; + /** Defines the type of the event trigger * @Default {ej.datavisualization.Diagram.BPMNTriggers.Message} */ @@ -53170,12 +55768,12 @@ export interface NodesTask { /** To set whether the task is a global task or not * @Default {false} */ - call?: boolean; + call?: Boolean; /** Sets whether the task is triggered as a compensation of another specific activity * @Default {false} */ - compensation?: boolean; + compensation?: Boolean; /** Sets the loop type of a BPMN task. * @Default {ej.datavisualization.Diagram.BPMNLoops.None} @@ -53208,21 +55806,21 @@ export interface Node { /** Sets the border color of node * @Default {black} */ - borderColor?: string; + borderColor?: String; /** Sets the pattern of dashes and gaps to stroke the border */ - borderDashArray?: string; + borderDashArray?: String; /** Sets the border width of the node * @Default {1} */ - borderWidth?: number; + borderWidth?: Number; /** Defines whether the group can be ungrouped or not * @Default {true} */ - canUngroup?: boolean; + canUngroup?: Boolean; /** Array of JSON objects where each object represents a child node/connector * @Default {[]} @@ -53239,10 +55837,14 @@ export interface Node { */ class?: NodesClass; + /** Defines the state of the node is collapsed. + */ + collapseIcon?: NodesCollapseIcon; + /** Defines the distance to be left between a node and its connections(In coming and out going connections). * @Default {0} */ - connectorPadding?: number; + connectorPadding?: Number; /** Enables or disables the default behaviors of the node. * @Default {ej.datavisualization.Diagram.NodeConstraints.Default} @@ -53257,11 +55859,11 @@ export interface Node { /** Defines the corner radius of rectangular shapes. * @Default {0} */ - cornerRadius?: number; + cornerRadius?: Number; /** Configures the styles of shapes */ - cssClass?: string; + cssClass?: String; /** Defines the BPMN data object */ @@ -53280,12 +55882,16 @@ export interface Node { /** Defines whether the node can be automatically arranged using layout or not * @Default {false} */ - excludeFromLayout?: boolean; + excludeFromLayout?: Boolean; + + /** Defines the state of the node is expanded or collapsed. + */ + expandIcon?: NodesExpandIcon; /** Defines the fill color of the node * @Default {white} */ - fillColor?: string; + fillColor?: String; /** Sets the type of the BPMN Gateway. Applicable, if the node is a BPMN gateway. * @Default {ej.datavisualization.Diagram.BPMNGateways.None} @@ -53309,7 +55915,7 @@ export interface Node { /** Defines the height of the node * @Default {0} */ - height?: number; + height?: Number; /** Sets the horizontal alignment of the node. Applicable, if the parent of the node is a container. * @Default {ej.datavisualization.Diagram.HorizontalAlignment.Left} @@ -53329,12 +55935,12 @@ export interface Node { /** Defines whether the sub tree of the node is expanded or collapsed * @Default {true} */ - isExpanded?: boolean; + isExpanded?: Boolean; /** Sets the node as a swimlane * @Default {false} */ - isSwimlane?: boolean; + isSwimlane?: Boolean; /** A collection of objects where each object represents a label * @Default {[]} @@ -53349,66 +55955,66 @@ export interface Node { /** Defines the minimum space to be left between the bottom of parent bounds and the node. Applicable, if the parent is a container. * @Default {0} */ - marginBottom?: number; + marginBottom?: Number; /** Defines the minimum space to be left between the left of parent bounds and the node. Applicable, if the parent is a container. * @Default {0} */ - marginLeft?: number; + marginLeft?: Number; /** Defines the minimum space to be left between the right of the parent bounds and the node. Applicable, if the parent is a container. * @Default {0} */ - marginRight?: number; + marginRight?: Number; /** Defines the minimum space to be left between the top of parent bounds and the node. Applicable, if the parent is a container. * @Default {0} */ - marginTop?: number; + marginTop?: Number; /** Defines the maximum height limit of the node * @Default {0} */ - maxHeight?: number; + maxHeight?: Number; /** Defines the maximum width limit of the node * @Default {0} */ - maxWidth?: number; + maxWidth?: Number; /** Defines the minimum height limit of the node * @Default {0} */ - minHeight?: number; + minHeight?: Number; /** Defines the minimum width limit of the node * @Default {0} */ - minWidth?: number; + minWidth?: Number; /** Sets the unique identifier of the node */ - name?: string; + name?: String; /** Defines the position of the node on X-Axis * @Default {0} */ - offsetX?: number; + offsetX?: Number; /** Defines the position of the node on Y-Axis * @Default {0} */ - offsetY?: number; + offsetY?: Number; /** Defines the opaque of the node * @Default {1} */ - opacity?: number; + opacity?: Number; /** Defines the orientation of nodes. Applicable, if the node is a swimlane. * @Default {vertical} */ - orientation?: string; + orientation?: String; /** A read only collection of outgoing connectors/edges of the node * @Default {[]} @@ -53418,22 +56024,22 @@ export interface Node { /** Defines the minimum padding value to be left between the bottom most position of a group and its children. Applicable, if the group is a container. * @Default {0} */ - paddingBottom?: number; + paddingBottom?: Number; /** Defines the minimum padding value to be left between the left most position of a group and its children. Applicable, if the group is a container. * @Default {0} */ - paddingLeft?: number; + paddingLeft?: Number; /** Defines the minimum padding value to be left between the right most position of a group and its children. Applicable, if the group is a container. * @Default {0} */ - paddingRight?: number; + paddingRight?: Number; /** Defines the minimum padding value to be left between the top most position of a group and its children. Applicable, if the group is a container. * @Default {0} */ - paddingTop?: number; + paddingTop?: Number; /** Defines the size and preview size of the node to add that to symbol palette * @Default {null} @@ -53442,11 +56048,11 @@ export interface Node { /** Sets the name of the parent group */ - parent?: string; + parent?: String; /** Sets the path geometry that defines the shape of a path node */ - pathData?: string; + pathData?: String; /** An array of objects, where each object represents a smaller region(phase) of a swimlane. * @Default {[]} @@ -53456,7 +56062,7 @@ export interface Node { /** Sets the height of the phase headers * @Default {0} */ - phaseSize?: number; + phaseSize?: Number; /** Sets the ratio/ fractional value relative to node, based on which the node will be transformed(positioning, scaling and rotation) * @Default {ej.datavisualization.Diagram.Points(0.5,0.5)} @@ -53476,12 +56082,7 @@ export interface Node { /** Sets the angle to which the node should be rotated * @Default {0} */ - rotateAngle?: number; - - /** Defines how the node should be scaled/stretched - * @Default {ej.datavisualization.Diagram.ScaleConstraints.Meet} - */ - scale?: ej.datavisualization.Diagram.ScaleConstraints |string; + rotateAngle?: Number; /** Defines the opacity and the position of shadow * @Default {ej.datavisualization.Diagram.Shadow()} @@ -53495,7 +56096,7 @@ export interface Node { /** Sets the source path of the image. Applicable, if the type of the node is image. */ - source?: string; + source?: String; /** Defines the sub process of a BPMN Activity. Applicable, if the type of the BPMN activity is sub process. * @Default {ej.datavisualization.Diagram.BPMNSubProcess()} @@ -53509,7 +56110,7 @@ export interface Node { /** Sets the id of svg/html templates. Applicable, if the node is HTML or native. */ - templateId?: string; + templateId?: String; /** Defines the textBlock of a text node * @Default {null} @@ -53539,17 +56140,17 @@ export interface Node { /** Defines the visibility of the node * @Default {true} */ - visible?: boolean; + visible?: Boolean; /** Defines the width of the node * @Default {0} */ - width?: number; + width?: Number; /** Defines the z-index of the node * @Default {0} */ - zOrder?: number; + zOrder?: Number; } export interface PageSettings { @@ -53562,32 +56163,32 @@ export interface PageSettings { /** Sets whether multiple pages can be created to fit all nodes and connectors * @Default {false} */ - multiplePage?: boolean; + multiplePage?: Boolean; /** Defines the background color of diagram pages * @Default {#ffffff} */ - pageBackgroundColor?: string; + pageBackgroundColor?: String; /** Defines the page border color * @Default {#565656} */ - pageBorderColor?: string; + pageBorderColor?: String; /** Sets the border width of diagram pages * @Default {0} */ - pageBorderWidth?: number; + pageBorderWidth?: Number; /** Defines the height of a page * @Default {null} */ - pageHeight?: number; + pageHeight?: Number; /** Defines the page margin * @Default {24} */ - pageMargin?: number; + pageMargin?: Number; /** Sets the orientation of the page. * @Default {ej.datavisualization.Diagram.PageOrientations.Portrait} @@ -53597,7 +56198,7 @@ export interface PageSettings { /** Defines the height of a diagram page * @Default {null} */ - pageWidth?: number; + pageWidth?: Number; /** Defines the scrollable area of diagram. Applicable, if the scroll limit is "limited". * @Default {null} @@ -53617,7 +56218,7 @@ export interface PageSettings { /** Enables or disables the page breaks * @Default {false} */ - showPageBreak?: boolean; + showPageBreak?: Boolean; } export interface ScrollSettings { @@ -53625,12 +56226,12 @@ export interface ScrollSettings { /** Allows to read the zoom value of diagram * @Default {0} */ - currentZoom?: number; + currentZoom?: Number; /** Sets the horizontal scroll offset * @Default {0} */ - horizontalOffset?: number; + horizontalOffset?: Number; /** Allows to extend the scrollable region that is based on the scroll limit * @Default {{left: 0, right: 0, top:0, bottom: 0}} @@ -53640,17 +56241,17 @@ export interface ScrollSettings { /** Sets the vertical scroll offset * @Default {0} */ - verticalOffset?: number; + verticalOffset?: Number; /** Allows to read the view port height of the diagram * @Default {0} */ - viewPortHeight?: number; + viewPortHeight?: Number; /** Allows to read the view port width of the diagram * @Default {0} */ - viewPortWidth?: number; + viewPortWidth?: Number; } export interface SelectedItemsUserHandle { @@ -53658,26 +56259,26 @@ export interface SelectedItemsUserHandle { /** Defines the background color of the user handle * @Default {#2382c3} */ - backgroundColor?: string; + backgroundColor?: String; /** Sets the border color of the user handle * @Default {transparent} */ - borderColor?: string; + borderColor?: String; /** Defines whether the user handle should be added, when more than one element is selected * @Default {false} */ - enableMultiSelection?: boolean; + enableMultiSelection?: Boolean; /** Sets the stroke color of the user handle * @Default {transparent} */ - pathColor?: string; + pathColor?: String; /** Defines the custom shape of the user handle */ - pathData?: string; + pathData?: String; /** Defines the position of the user handle * @Default {ej.datavisualization.Diagram.UserHandlePositions.BottomCenter} @@ -53687,7 +56288,7 @@ export interface SelectedItemsUserHandle { /** Defines the size of the user handle * @Default {8} */ - size?: number; + size?: Number; /** Defines the interactive behaviors of the user handle */ @@ -53696,7 +56297,7 @@ export interface SelectedItemsUserHandle { /** Defines the visibility of the user handle * @Default {true} */ - visible?: boolean; + visible?: Boolean; } export interface SelectedItems { @@ -53719,22 +56320,22 @@ export interface SelectedItems { /** Sets the height of the selected items * @Default {0} */ - height?: number; + height?: Number; /** Sets the x position of the selector * @Default {0} */ - offsetX?: number; + offsetX?: Number; /** Sets the y position of the selector * @Default {0} */ - offsetY?: number; + offsetY?: Number; /** Sets the angle to rotate the selected items * @Default {0} */ - rotateAngle?: number; + rotateAngle?: Number; /** Sets the angle to rotate the selected items. For tooltip properties, refer Tooltip * @Default {ej.datavisualization.Diagram.Tooltip()} @@ -53749,7 +56350,7 @@ export interface SelectedItems { /** Sets the width of the selected items * @Default {0} */ - width?: number; + width?: Number; } export interface SnapSettingsHorizontalGridLines { @@ -53757,11 +56358,11 @@ export interface SnapSettingsHorizontalGridLines { /** Defines the line color of horizontal grid lines * @Default {lightgray} */ - lineColor?: string; + lineColor?: String; /** Specifies the pattern of dashes and gaps used to stroke horizontal grid lines */ - lineDashArray?: string; + lineDashArray?: String; /** A pattern of lines and gaps that defines a set of horizontal gridlines * @Default {[1.25, 18.75, 0.25, 19.75, 0.25, 19.75, 0.25, 19.75, 0.25, 19.75]} @@ -53779,11 +56380,11 @@ export interface SnapSettingsVerticalGridLines { /** Defines the line color of horizontal grid lines * @Default {lightgray} */ - lineColor?: string; + lineColor?: String; /** Specifies the pattern of dashes and gaps used to stroke horizontal grid lines */ - lineDashArray?: string; + lineDashArray?: String; /** A pattern of lines and gaps that defines a set of horizontal gridlines * @Default {[1.25, 18.75, 0.25, 19.75, 0.25, 19.75, 0.25, 19.75, 0.25, 19.75]} @@ -53801,7 +56402,7 @@ export interface SnapSettings { /** Enables or disables snapping nodes/connectors to objects * @Default {true} */ - enableSnapToObject?: boolean; + enableSnapToObject?: Boolean; /** Defines the appearance of horizontal gridlines */ @@ -53810,7 +56411,7 @@ export interface SnapSettings { /** Defines the angle by which the object needs to be snapped * @Default {5} */ - snapAngle?: number; + snapAngle?: Number; /** Defines and sets the snapConstraints */ @@ -53819,7 +56420,7 @@ export interface SnapSettings { /** Defines the minimum distance between the selected object and the nearest object * @Default {5} */ - snapObjectDistance?: number; + snapObjectDistance?: Number; /** Defines the appearance of horizontal gridlines */ @@ -53857,7 +56458,7 @@ export interface Tooltip { /** Sets the svg/html template to be bound with tooltip */ - templateId?: string; + templateId?: String; } } module Diagram @@ -53888,18 +56489,6 @@ XMaxYMax, } module Diagram { -enum ScaleConstraints -{ -//Used to scale the image non-uniformly to the given width/height -None, -//Used to scale the image uniformly so that it fits the viewport -Meet, -//Used to scale the image uniformly to the maximum -Slice, -} -} -module Diagram -{ enum BridgeDirection { //Used to set the direction of line bridges as left @@ -54048,6 +56637,8 @@ DragLabel, InheritBridging, //Enables user interaction to the connector PointerEvents, +//Enables the contrast between clean edges of connector over rendering speed and geometric precision +CrispEdges, //Enables all constraints Default, } @@ -54158,6 +56749,42 @@ Default, } module Diagram { +enum ClassifierShapes +{ +//Used to define a Class +Class, +//Used to define an Interface +Interface, +//Used to define an Enumeration +Enumeration, +//Used to notate association in UML Class Diagram +Association, +//Used to notate aggregation in a UML Class Diagram +Aggregation, +//Used to notate composition in a UML Class Diagram +Composition, +//Used to notate dependency in a UML Class Diagram +Dependency, +//Used to notate inheritance in a UML Class Diagram +Inheritance, +} +} +module Diagram +{ +enum Multiplicity +{ +//Each entity instance is related to a single instance of another entity +OneToOne, +//An entity instance can be related to multiple instances of the other entities +OneToMany, +//Multiple instances of an entity can be related to a single instance of the other entity +ManyToOne, +//The entity instances can be related to multiple instances of each other +ManyToMany, +} +} +module Diagram +{ enum DecoratorShapes { //Used to set decorator shape as none @@ -54206,6 +56833,8 @@ PannableY, Pannable, //Enables/Disables undo actions Undoable, +//Enables/Disables the sharp edges +CrispEdges, //Enables all Constraints Default, } @@ -54264,14 +56893,22 @@ Bottom, } module Diagram { -enum ClassifierShapes +enum IconShapes { -//Used to define a Class -Class, -//Used to define an Interface -Interface, -//Used to define an Enumeration -Enumeration, +//Used to set collapse icon shape as none +None, +//Used to set collapse icon shape as Arrow(Up/Down) +Arrow, +//Used to set collapse icon shape as Plus +Plus, +//Used to set collapse icon shape as Minus +Minus, +//Used to set collapse icon shape as path +Path, +//Used to set icon shape as template +Template, +//Used to set icon shape as image +Image, } } module Diagram @@ -54318,6 +56955,8 @@ AllowPan, AspectRatio, //Enables the user interaction with the node PointerEvents, +//Enables contrast between clean edges for the node over rendering speed and geometric precision +CrispEdges, //Enables all node constraints Default, } @@ -54440,6 +57079,8 @@ enum PortConstraints None, //Enables connections with connector Connect, +//Enables to create the connection when mouse hover on the port. +ConnectOnDrag, } } module Diagram @@ -54747,6 +57388,7 @@ class HeatMap extends ej.Widget { static fn: HeatMap; constructor(element: JQuery, options?: HeatMap.Model); constructor(element: Element, options?: HeatMap.Model); + static Locale: any; model:HeatMap.Model; defaults:HeatMap.Model; } @@ -54767,7 +57409,7 @@ export interface Model { /** Specifies the name of the heat map. * @Default {null} */ - id?: number; + id?: Number; /** Specifies the source data of the heat map. * @Default {[]} @@ -54782,12 +57424,12 @@ export interface Model { /** Specifies can enable responsive mode or not for heat map. * @Default {false} */ - isResponsive?: boolean; + isResponsive?: Boolean; /** Specifies whether the virtualization can be enable or not. * @Default {false} */ - enableVirtualization?: boolean; + enableVirtualization?: Boolean; /** Specifies the default column properties for all the column style not specified in column properties. * @Default {[]} @@ -54892,7 +57534,7 @@ export interface HeatMapCell { /** Specifies whether the cell color can be visible or not. * @Default {true} */ - showColor?: boolean; + showColor?: Boolean; } export interface DefaultColumnStyle { @@ -54904,11 +57546,11 @@ export interface DefaultColumnStyle { /** Specifies the template id of the heat map column header. */ - headerTemplateID?: string; + headerTemplateID?: String; /** Specifies the template id of all individual cell data of the heat map. */ - templateID?: string; + templateID?: String; } export interface ItemsMappingColumnStyle { @@ -54916,7 +57558,7 @@ export interface ItemsMappingColumnStyle { /** Specifies the width of the heat map column. * @Default {0} */ - width?: number; + width?: Number; /** Specifies the text align mode of the heat map column. * @Default {ej.HeatMap.TextAlign.Center} @@ -55019,16 +57661,16 @@ export interface ColorMappingCollectionLabel { /** Enables/disables the bold style of the heat map label. * @Default {false} */ - bold?: boolean; + bold?: Boolean; /** Enables/disables the italic style of the heat map label. * @Default {false} */ - italic?: boolean; + italic?: Boolean; /** specifies the text value of the heat map label. */ - text?: string; + text?: String; /** Specifies the text style of the heat map label. * @Default {ej.HeatMap.TextDecoration.None} @@ -55038,17 +57680,17 @@ export interface ColorMappingCollectionLabel { /** Specifies the font size of the heat map label. * @Default {10} */ - fontSize?: number; + fontSize?: Number; /** Specifies the font family of the heat map label. * @Default {Arial} */ - fontFamily?: string; + fontFamily?: String; /** Specifies the font color of the heat map label. * @Default {black} */ - fontColor?: string; + fontColor?: String; } export interface ColorMappingCollection { @@ -55056,12 +57698,12 @@ export interface ColorMappingCollection { /** Specifies the color of the heat map column data. * @Default {white} */ - color?: string; + color?: String; /** Specifies the color values of the heat map column data. * @Default {0} */ - value?: number; + value?: Number; /** Specifies the label properties of the heat map color. * @Default {null} @@ -55098,6 +57740,7 @@ class HeatMapLegend extends ej.Widget { static fn: HeatMapLegend; constructor(element: JQuery, options?: HeatMapLegend.Model); constructor(element: Element, options?: HeatMapLegend.Model); + static Locale: any; model:HeatMapLegend.Model; defaults:HeatMapLegend.Model; } @@ -55118,12 +57761,12 @@ export interface Model { /** Specifies can enable responsive mode or not for heatmap legend. * @Default {false} */ - isResponsive?: boolean; + isResponsive?: Boolean; /** Specifies whether the cell label can be shown or not. * @Default {false} */ - showLabel?: boolean; + showLabel?: Boolean; /** Specifies the color values of the column data. * @Default {[]} @@ -55146,16 +57789,16 @@ export interface ColorMappingCollectionLabel { /** Enables/disables the bold style of the heatmap legend label. * @Default {false} */ - bold?: boolean; + bold?: Boolean; /** Enables/disables the italic style of the heatmap legend label. * @Default {false} */ - italic?: boolean; + italic?: Boolean; /** specifies the text value of the heatmap legend label. */ - text?: string; + text?: String; /** Specifies the text style of the heatmap legend label. * @Default {ej.HeatMap.TextDecoration.None} @@ -55165,17 +57808,17 @@ export interface ColorMappingCollectionLabel { /** Specifies the font size of the heatmap legend label. * @Default {10} */ - fontSize?: number; + fontSize?: Number; /** Specifies the font family of the heatmap legend label. * @Default {Arial} */ - fontFamily?: string; + fontFamily?: String; /** Specifies the font color of the heatmap legend label. * @Default {black} */ - fontColor?: string; + fontColor?: String; } export interface ColorMappingCollection { @@ -55183,12 +57826,12 @@ export interface ColorMappingCollection { /** Specifies the color of the heatmap legend data. * @Default {white} */ - color?: string; + color?: String; /** Specifies the color values of the heatmap legend column data. * @Default {0} */ - value?: number; + value?: Number; /** Specifies the label properties of the heatmap legend color. * @Default {null} @@ -55221,6 +57864,7 @@ class Sparkline extends ej.Widget { static fn: Sparkline; constructor(element: JQuery, options?: Sparkline.Model); constructor(element: Element, options?: Sparkline.Model); + static Locale: any; model:Sparkline.Model; defaults:Sparkline.Model; @@ -55817,6 +58461,7 @@ class Overview extends ej.Widget { static fn: Overview; constructor(element: JQuery, options?: Overview.Model); constructor(element: Element, options?: Overview.Model); + static Locale: any; model:Overview.Model; defaults:Overview.Model; } @@ -55827,17 +58472,17 @@ export interface Model { /** The sourceId property of overview should be set with the corresponding Diagram ID for you need the overall view. * @Default {null} */ - sourceID?: string; + sourceID?: String; /** Defines the height of the overview * @Default {400} */ - height?: number; + height?: Number; /** Defines the width of the overview * @Default {250} */ - width?: number; + width?: Number; } } @@ -55934,6 +58579,11 @@ ejDigitalGauge(options?: ej.datavisualization.DigitalGauge.Model): JQuery; ejDigitalGauge(memberName: any, value?: any, param?: any): any; data(key: "ejDigitalGauge"): ej.datavisualization.DigitalGauge; +ejDocumentEditor(): JQuery; +ejDocumentEditor(options?: ej.DocumentEditor.Model): JQuery; +ejDocumentEditor(memberName: any, value?: any, param?: any): any; +data(key: "ejDocumentEditor"): ej.DocumentEditor; + ejDraggable(): JQuery; ejDraggable(options?: ej.Draggable.Model): JQuery; ejDraggable(memberName: any, value?: any, param?: any): any; @@ -56139,6 +58789,11 @@ ejScroller(options?: ej.Scroller.Model): JQuery; ejScroller(memberName: any, value?: any, param?: any): any; data(key: "ejScroller"): ej.Scroller; +ejSignature(): JQuery; +ejSignature(options?: ej.Signature.Model): JQuery; +ejSignature(memberName: any, value?: any, param?: any): any; +data(key: "ejSignature"): ej.Signature; + ejSlider(): JQuery; ejSlider(options?: ej.Slider.Model): JQuery; ejSlider(memberName: any, value?: any, param?: any): any; @@ -56149,6 +58804,11 @@ ejSparkline(options?: ej.datavisualization.Sparkline.Model): JQuery; ejSparkline(memberName: any, value?: any, param?: any): any; data(key: "ejSparkline"): ej.datavisualization.Sparkline; +ejSpellCheck(): JQuery; +ejSpellCheck(options?: ej.SpellCheck.Model): JQuery; +ejSpellCheck(memberName: any, value?: any, param?: any): any; +data(key: "ejSpellCheck"): ej.SpellCheck; + ejSplitButton(): JQuery; ejSplitButton(options?: ej.SplitButton.Model): JQuery; ejSplitButton(memberName: any, value?: any, param?: any): any; @@ -56234,3 +58894,4 @@ ejWaitingPopup(options?: ej.WaitingPopup.Model): JQuery; ejWaitingPopup(memberName: any, value?: any, param?: any): any; data(key: "ejWaitingPopup"): ej.WaitingPopup; } + From 901da6fac0622d023da253de1b4451125fb83770 Mon Sep 17 00:00:00 2001 From: Dan Homola Date: Mon, 7 Nov 2016 14:51:05 +0100 Subject: [PATCH 147/246] Add typings for jsonminify (#12447) * Add typings for jsonminify * Fix test string * Strip declare module * Simplify declaration * Fix declaration bug * Change test import syntax, revert the declaration --- jsonminify/index.d.ts | 8 ++++++++ jsonminify/jsonminify-tests.ts | 3 +++ jsonminify/tsconfig.json | 19 +++++++++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 jsonminify/index.d.ts create mode 100644 jsonminify/jsonminify-tests.ts create mode 100644 jsonminify/tsconfig.json diff --git a/jsonminify/index.d.ts b/jsonminify/index.d.ts new file mode 100644 index 0000000000..613ac9a9ab --- /dev/null +++ b/jsonminify/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for jsonminify 0.4.1 +// Project: https://github.com/fkei/JSON.minify +// Definitions by: Dan Homola +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function minify(json: string): string; + +export = minify; diff --git a/jsonminify/jsonminify-tests.ts b/jsonminify/jsonminify-tests.ts new file mode 100644 index 0000000000..fdb6150768 --- /dev/null +++ b/jsonminify/jsonminify-tests.ts @@ -0,0 +1,3 @@ +import jsonminify = require("jsonminify"); + +const minified: string = jsonminify('{ "foo": "bar" }'); diff --git a/jsonminify/tsconfig.json b/jsonminify/tsconfig.json new file mode 100644 index 0000000000..3fe847d334 --- /dev/null +++ b/jsonminify/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "jsonminify-tests.ts" + ] +} From e9270215e972987ef766a5e59db8ba181379f702 Mon Sep 17 00:00:00 2001 From: sousarka Date: Mon, 7 Nov 2016 07:03:31 -0700 Subject: [PATCH 148/246] Update index.d.ts (#12324) add following options to the bootstrap-datepicker/DatepickerOptions. Also update the options url to point to the correct URL. templates?: any; zIndexOffset?: number; showOnFocus?: boolean; immediateUpdates?: boolean; title?: string; --- bootstrap-datepicker/index.d.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bootstrap-datepicker/index.d.ts b/bootstrap-datepicker/index.d.ts index 1f9fd065d2..a692b663bb 100644 --- a/bootstrap-datepicker/index.d.ts +++ b/bootstrap-datepicker/index.d.ts @@ -12,7 +12,7 @@ * “w” (week), “m” (month), and “y” (year). * * See online docs for more info: - * http://bootstrap-datepicker.readthedocs.org/en/release/options.html + * https://bootstrap-datepicker.readthedocs.io/en/latest/options.html */ interface DatepickerOptions { format?: string | DatepickerCustomFormatOptions; @@ -37,6 +37,11 @@ interface DatepickerOptions { orientation?: string; assumeNearbyYear?: any; viewMode?: string; + templates?: any; + zIndexOffset?: number; + showOnFocus?: boolean; + immediateUpdates?: boolean; + title?: string; } interface DatepickerCustomFormatOptions { From b006daa1c668e286da8ba12362d534d1fec5f5ec Mon Sep 17 00:00:00 2001 From: Rogier Schouten Date: Mon, 7 Nov 2016 15:24:21 +0100 Subject: [PATCH 149/246] Add typings for object-diff. (#11984) * Add typings for object-diff. * review comment * review comment - tsconfig.json * fix tsc errors --- object-diff/index.d.ts | 7 +++++++ object-diff/object-diff-tests.ts | 18 ++++++++++++++++++ object-diff/tsconfig.json | 19 +++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 object-diff/index.d.ts create mode 100644 object-diff/object-diff-tests.ts create mode 100644 object-diff/tsconfig.json diff --git a/object-diff/index.d.ts b/object-diff/index.d.ts new file mode 100644 index 0000000000..b7dc3664ed --- /dev/null +++ b/object-diff/index.d.ts @@ -0,0 +1,7 @@ +// Type definitions for object-diff v0.0 +// Project: https://github.com/srcagency/object-diff +// Definitions by: Rogier Schouten +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare function diff(a: any, b: any): any; +export = diff; diff --git a/object-diff/object-diff-tests.ts b/object-diff/object-diff-tests.ts new file mode 100644 index 0000000000..b9e4a5675a --- /dev/null +++ b/object-diff/object-diff-tests.ts @@ -0,0 +1,18 @@ + +import diff = require('object-diff'); + +// from the package README.md, typescriptified: + +var a = { + speed: 4, + power: 54, + level: 1, +}; + +var b = { + speed: 4, // unchanged + power: 22, // changed + weight: 10, // added +}; + +var d: any = diff(a, b); diff --git a/object-diff/tsconfig.json b/object-diff/tsconfig.json new file mode 100644 index 0000000000..e55b704301 --- /dev/null +++ b/object-diff/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "object-diff-tests.ts" + ] +} \ No newline at end of file From f555feb4fc7fc1874dff8c31503159beca11da26 Mon Sep 17 00:00:00 2001 From: TonyYang Date: Mon, 7 Nov 2016 22:35:21 +0800 Subject: [PATCH 150/246] Add "toString()" for ObjectID (#12463) --- mongodb/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mongodb/index.d.ts b/mongodb/index.d.ts index f16d5cce0d..49f092a0f1 100644 --- a/mongodb/index.d.ts +++ b/mongodb/index.d.ts @@ -426,6 +426,8 @@ export class ObjectID { getTimestamp(): Date; // Returns the ObjectID id as a 24 byte hex string representation toHexString(): string; + // Returns the ObjectID id as a 24 byte hex string representation + toString(): string; } // Class documentation : http://mongodb.github.io/node-mongodb-native/2.1/api/Binary.html From 393ada1ee2ef48a4bf99bac38dc11742bbd090d6 Mon Sep 17 00:00:00 2001 From: TonyYang Date: Mon, 7 Nov 2016 22:35:49 +0800 Subject: [PATCH 151/246] [@types/mongoose] Declare a right type for _id (#12462) * Declare a right type for _id * Delete the error definition --- mongoose/index.d.ts | 2 +- passport-local-mongoose/passport-local-mongoose-tests.ts | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/mongoose/index.d.ts b/mongoose/index.d.ts index 150d94b2df..12c92571b5 100644 --- a/mongoose/index.d.ts +++ b/mongoose/index.d.ts @@ -871,7 +871,7 @@ declare module "mongoose" { /** Hash containing current validation errors. */ errors: Object; /** This documents _id. */ - _id: any; + _id: mongodb.ObjectID; /** Boolean flag specifying if the document is new. */ isNew: boolean; /** The documents schema. */ diff --git a/passport-local-mongoose/passport-local-mongoose-tests.ts b/passport-local-mongoose/passport-local-mongoose-tests.ts index 7b428561fe..21a928a8d7 100644 --- a/passport-local-mongoose/passport-local-mongoose-tests.ts +++ b/passport-local-mongoose/passport-local-mongoose-tests.ts @@ -23,7 +23,6 @@ import { Strategy as LocalStrategy } from 'passport-local'; //#region Test Models interface User extends PassportLocalDocument { - _id: string; username: string; hash: string; salt: string; From a2ba29a47afdf748894c2493d23802197f3d6907 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Guillot?= Date: Mon, 7 Nov 2016 16:13:35 +0100 Subject: [PATCH 152/246] Missing prop 'shouldUpdatePosition' on Overlay component (#11606) --- react-bootstrap/react-bootstrap.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/react-bootstrap/react-bootstrap.d.ts b/react-bootstrap/react-bootstrap.d.ts index c39efed388..6b8dd29784 100644 --- a/react-bootstrap/react-bootstrap.d.ts +++ b/react-bootstrap/react-bootstrap.d.ts @@ -423,6 +423,7 @@ declare namespace ReactBootstrap { rootClose?: boolean; show?: boolean; target?: Function; + shouldUpdatePosition?: boolean; } class Overlay extends React.Component { } From b8f50c92ee4fea580477d82f32472140543b2d7c Mon Sep 17 00:00:00 2001 From: XQ Kuang Date: Mon, 7 Nov 2016 23:14:52 +0800 Subject: [PATCH 153/246] + Navbar.Link and Navbar.Text to react-bootstrap (#12294) --- react-bootstrap/index.d.ts | 17 +++++++++++++++++ react-bootstrap/react-bootstrap-tests.tsx | 6 ++++++ 2 files changed, 23 insertions(+) diff --git a/react-bootstrap/index.d.ts b/react-bootstrap/index.d.ts index 4ca0b85023..9780efb443 100644 --- a/react-bootstrap/index.d.ts +++ b/react-bootstrap/index.d.ts @@ -520,6 +520,21 @@ declare namespace ReactBootstrap { type NavbarToggle = React.ClassicComponent; var NavbarToggle: React.ClassicComponentClass; + // + interface NavbarLinkProps { + href: string; + onClick?: React.MouseEventHandler<{}>; + } + type NavbarLink = React.ClassicComponent; + const NavbarLink: React.ClassicComponentClass; + + // + interface NavbarTextProps { + pullRight?: boolean; + } + type NavbarText = React.ClassicComponent; + const NavbarText: React.ClassicComponentClass; + // interface NavbarProps extends React.HTMLProps { brand?: any; // TODO: Add more specific type @@ -542,6 +557,8 @@ declare namespace ReactBootstrap { Collapse: typeof NavbarCollapse; Header: typeof NavbarHeader; Toggle: typeof NavbarToggle; + Link: typeof NavbarLink; + Text: typeof NavbarText; } type Navbar = React.ClassicComponent; var Navbar: NavbarClass; diff --git a/react-bootstrap/react-bootstrap-tests.tsx b/react-bootstrap/react-bootstrap-tests.tsx index 592bb7eafb..65ecbca247 100644 --- a/react-bootstrap/react-bootstrap-tests.tsx +++ b/react-bootstrap/react-bootstrap-tests.tsx @@ -519,6 +519,12 @@ export class ReactBootstrapTest extends Component { Separated link + + Signed in as: Mark Otto + + + Have a great day! + From e32ebf0ee4c0bf122b752f55666a54fc7ab96144 Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 7 Nov 2016 07:16:58 -0800 Subject: [PATCH 154/246] Update angular-ui-router-default for types-2.0 (#12479) --- .../angular-ui-router-default-tests.ts | 5 +++-- .../angular-ui-router-default.d.ts | 17 ----------------- angular-ui-router-default/index.d.ts | 19 +++++++++++++++++++ angular-ui-router-default/tsconfig.json | 19 +++++++++++++++++++ 4 files changed, 41 insertions(+), 19 deletions(-) delete mode 100644 angular-ui-router-default/angular-ui-router-default.d.ts create mode 100644 angular-ui-router-default/index.d.ts create mode 100644 angular-ui-router-default/tsconfig.json diff --git a/angular-ui-router-default/angular-ui-router-default-tests.ts b/angular-ui-router-default/angular-ui-router-default-tests.ts index 2b6bfbe61e..95229f68cd 100644 --- a/angular-ui-router-default/angular-ui-router-default-tests.ts +++ b/angular-ui-router-default/angular-ui-router-default-tests.ts @@ -1,10 +1,11 @@ -/// +import * as angular from "angular"; +import { ui } from "angular"; angular.module("test", [ "ui.router", "ui.router.default" ]) - .config(function($stateProvider: angular.ui.IStateProvider) { + .config(function($stateProvider: ui.IStateProvider) { $stateProvider .state('concrete', { // no abstract or default diff --git a/angular-ui-router-default/angular-ui-router-default.d.ts b/angular-ui-router-default/angular-ui-router-default.d.ts deleted file mode 100644 index 9d102681cf..0000000000 --- a/angular-ui-router-default/angular-ui-router-default.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -// Type definitions for angular-ui-router-default 0.5+ -// Project: https://github.com/nonplus/angular-ui-router-default -// Definitions by: Stepan Riha -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - -declare namespace angular.ui { - export type StateDefaultSpecifier = string - | ((...args: any[]) => string) - | ((...args: any[]) => ng.IPromise) - | (string | ((...args: any[]) => string))[] - | (string | ((...args: any[]) => ng.IPromise))[]; - interface IState { - default?: StateDefaultSpecifier - } -} diff --git a/angular-ui-router-default/index.d.ts b/angular-ui-router-default/index.d.ts new file mode 100644 index 0000000000..76e4db23e0 --- /dev/null +++ b/angular-ui-router-default/index.d.ts @@ -0,0 +1,19 @@ +// Type definitions for angular-ui-router-default 0.5+ +// Project: https://github.com/nonplus/angular-ui-router-default +// Definitions by: Stepan Riha +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import * as aur from "angular-ui-router"; + +declare module "angular" { + namespace ui { + export type StateDefaultSpecifier = string + | ((...args: any[]) => string) + | ((...args: any[]) => ng.IPromise) + | (string | ((...args: any[]) => string))[] + | (string | ((...args: any[]) => ng.IPromise))[]; + interface IState { + default?: StateDefaultSpecifier + } + } +} diff --git a/angular-ui-router-default/tsconfig.json b/angular-ui-router-default/tsconfig.json new file mode 100644 index 0000000000..b4a462b3c9 --- /dev/null +++ b/angular-ui-router-default/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "angular-ui-router-default-tests.ts" + ] +} \ No newline at end of file From 39bfded109a5514bcfa674502c3aa5a5eafc5fa3 Mon Sep 17 00:00:00 2001 From: Tom Wanzek Date: Mon, 7 Nov 2016 10:24:50 -0500 Subject: [PATCH 155/246] [types-2.0] d3-geo Update to 1.3.1 (#12492) * (d3-geo): Update to 1.3.1 and JSDoc * [Chore] Updated definitions to conform to version 1.3.1 * [Feature] Added `geoIdentity()` and removed `geoClipExtent()` * [Feature ] Added geoGraticule10() * [Update] Changed API for `geoPath(...)` * [Enhancement] Complete overhaul of JSDoc comments * [Chore] Some changes to sequencing of definitions * [Fix]: Fixed GeoPath pointRadius() Accessor (getter may return constant number or accessor function. * [Fix] GeoPath generator may return string (SVG path string) or undefined (when called with rendering context) * * (d3-geo) Test Updates * Add test for `geoGraticule10()` * Remove tests for `geoClipExtent()` * Add tests for `geoIdentity()` * Fixed clipExtent tests to include explicit union with `null` type for return value of getter * Fixed pointRadius getter test on geoPath to allow for accessor or number to be returned by getter * (d3-geo) Tests Additional * Add some more tests for new geoPath(...) API --- d3-geo/d3-geo-tests.ts | 121 ++-- d3-geo/index.d.ts | 1223 +++++++++++++++++++++++++++++++++++++--- 2 files changed, 1236 insertions(+), 108 deletions(-) diff --git a/d3-geo/d3-geo-tests.ts b/d3-geo/d3-geo-tests.ts index 2e9f3e8719..b0c2adbb79 100644 --- a/d3-geo/d3-geo-tests.ts +++ b/d3-geo/d3-geo-tests.ts @@ -293,6 +293,12 @@ let multiString: GeoJSON.MultiLineString = graticuleGenerator(); let lines: GeoJSON.LineString[] = graticuleGenerator.lines(); let polygon2: GeoJSON.Polygon = graticuleGenerator.outline(); +// geoGraticule10() ===================================================== + +// test convenience function: + +multiString = d3Geo.geoGraticule10(); + // ---------------------------------------------------------------------- // Raw Projections // ---------------------------------------------------------------------- @@ -360,7 +366,7 @@ let clipAngle: number = constructedProjection.clipAngle(); constructedProjection = constructedProjection.clipAngle(null); constructedProjection = constructedProjection.clipAngle(45); -let clipExtent: [[number, number], [number, number]] = constructedProjection.clipExtent(); +let clipExtent: [[number, number], [number, number]] | null = constructedProjection.clipExtent(); constructedProjection = constructedProjection.clipExtent(null); constructedProjection = constructedProjection.clipExtent([[0, 0], [1, 1]]); @@ -416,14 +422,27 @@ conicConformal = conicConformal.fitSize([960, 500], samplePolygon); // inherited // GeoPath Generator // ---------------------------------------------------------------------- +let minimalRenderingContextMockUp: d3Geo.GeoContext = { + beginPath: () => { return; }, + moveTo: (x: number, y: number) => { return; }, + lineTo: (x: number, y: number) => { return; }, + arc: (x, y, radius, startAngle, endAngle) => { return; }, + closePath: () => { return; } +}; + // Create geoPath Generator ============================================= let geoPathCanvas: d3Geo.GeoPath; geoPathCanvas = d3Geo.geoPath(); +geoPathCanvas = d3Geo.geoPath(null); +geoPathCanvas = d3Geo.geoPath(null, null); +geoPathCanvas = d3Geo.geoPath(d3Geo.geoAzimuthalEqualArea()); +geoPathCanvas = d3Geo.geoPath(d3Geo.geoAzimuthalEqualArea(), minimalRenderingContextMockUp); let geoPathSVG: d3Geo.GeoPath>; geoPathSVG = d3Geo.geoPath>(); - +geoPathSVG = d3Geo.geoPath>(d3Geo.geoAzimuthalEqualArea()); +geoPathSVG = d3Geo.geoPath>(d3Geo.geoAzimuthalEqualArea(), null); // Configure geoPath Generator ========================================== // projection(...) ------------------------------------------------------ @@ -440,14 +459,8 @@ let geoPathConicProjection: d3Geo.GeoConicProjection = geoPathSVG.projection { return; }, - moveTo: (x: number, y: number) => { return; }, - lineTo: (x: number, y: number) => { return; }, - arc: (x, y, radius, startAngle, endAngle) => { return; }, - closePath: () => { return; } -}); +// minimal context interface (mockup) +geoPathCanvas = geoPathCanvas.context(minimalRenderingContextMockUp); let geoPathContext: d3Geo.GeoContext = geoPathCanvas.context(); @@ -461,13 +474,13 @@ let canvasContext: CanvasRenderingContext2D; geoPathCanvas = geoPathCanvas.context(canvasContext); canvasContext = geoPathCanvas.context(); -// canvasContext = geoPathSimple.context(); // fails without casting to CanvasRenderingContext2D -// canvasContext = geoPathSimple.context(); // fails as SampleProperties does not extend GeoCanvas +// canvasContext = geoPathCanvas.context(); // fails without casting to CanvasRenderingContext2D +// canvasContext = geoPathCanvas.context(); // fails as SampleProperties does not extend GeoCanvas // pointRadius(...) ------------------------------------------------------ geoPathCanvas = geoPathCanvas.pointRadius(5); -let geoPathCanvasPointRadiusAccessor: (this: any, d: d3Geo.GeoPermissibleObjects, ...args: any[]) => number = geoPathCanvas.pointRadius(); +let geoPathCanvasPointRadiusAccessor: ((this: any, d: d3Geo.GeoPermissibleObjects, ...args: any[]) => number) | number = geoPathCanvas.pointRadius(); geoPathSVG = geoPathSVG.pointRadius(function (datum) { let that: SVGPathElement = this; @@ -475,9 +488,9 @@ geoPathSVG = geoPathSVG.pointRadius(function (datum) { return datum.properties.name === 'Alabama' ? 10 : 15; }); -let geoPathSVGPointRadiusAccessor: (this: SVGPathElement, d: d3Geo.ExtendedFeature, ...args: any[]) => number = geoPathSVG.pointRadius(); -// let geoPathSVGPointRadiusAccessorWrong1: (this: SVGCircleElement, d: d3Geo.ExtendedFeature, ...args: any[]) => number = geoPathSVG.pointRadius(); // fails, mismatch in this context -// let geoPathSVGPointRadiusAccessorWrong2: (this: SVGPathElement, d: d3Geo.GeoGeometryObjects, ...args: any[]) => number = geoPathSVG.pointRadius(); // fails, mismatch in object datum type +let geoPathSVGPointRadiusAccessor: number | ((this: SVGPathElement, d: d3Geo.ExtendedFeature, ...args: any[]) => number) = geoPathSVG.pointRadius(); +// let geoPathSVGPointRadiusAccessorWrong1: number | ((this: SVGCircleElement, d: d3Geo.ExtendedFeature, ...args: any[]) => number) = geoPathSVG.pointRadius(); // fails, mismatch in this context +// let geoPathSVGPointRadiusAccessorWrong2: number | ((this: SVGPathElement, d: d3Geo.GeoGeometryObjects, ...args: any[]) => number) = geoPathSVG.pointRadius(); // fails, mismatch in object datum type // Use geoPath Generator ================================================ @@ -549,33 +562,8 @@ let svgCircleWrong: Selection; // svgPathWrong.attr('d', geoPathSVG); // fails, mismatch in datum type -// ---------------------------------------------------------------------- -// geoClipExtent -// ---------------------------------------------------------------------- -let geoClipExtent: d3Geo.GeoExtent = d3Geo.geoClipExtent(); -// extent(...) ---------------------------------------------------------- - -let extent2: [[number, number], [number, number]] = geoClipExtent.extent(); -geoClipExtent = geoClipExtent.extent([[0, 0], [960, 500]]); - -// stream(...) ---------------------------------------------------------- - -let stream: d3Geo.GeoStream; -stream = geoClipExtent.stream(stream); - -// ---------------------------------------------------------------------- -// Stream interface -// ---------------------------------------------------------------------- - -stream.point(0, 0); -stream.point(0, 0, 0); -stream.lineStart(); -stream.lineEnd(); -stream.polygonStart(); -stream.polygonEnd(); -stream.sphere(); // ---------------------------------------------------------------------- // Context interface @@ -611,6 +599,57 @@ customTransformProto = { let t: { stream: (s: d3Geo.GeoStream) => (CustomTranformProto & d3Geo.GeoStream) } = d3Geo.geoTransform(customTransformProto); + +// geoIdentity() ======================================================== + +let identityTransform: d3Geo.GeoIdentityTranform; + +identityTransform = d3Geo.geoIdentity(); + +scale = identityTransform.scale(); +identityTransform = identityTransform.scale(2); + +translate = identityTransform.translate(); +identityTransform = identityTransform.translate([10, 10]); + +clipExtent = identityTransform.clipExtent(); +identityTransform = identityTransform.clipExtent(null); +identityTransform = identityTransform.clipExtent([[0, 0], [100, 100]]); + +identityTransform = identityTransform.fitExtent([[0, 0], [960, 500]], samplePolygon); +identityTransform = identityTransform.fitExtent([[0, 0], [960, 500]], sampleSphere); +identityTransform = identityTransform.fitExtent([[0, 0], [960, 500]], sampleGeometryCollection); +identityTransform = identityTransform.fitExtent([[0, 0], [960, 500]], sampleExtendedGeometryCollection); +identityTransform = identityTransform.fitExtent([[0, 0], [960, 500]], sampleFeature); +identityTransform = identityTransform.fitExtent([[0, 0], [960, 500]], sampleExtendedFeature1); +identityTransform = identityTransform.fitExtent([[0, 0], [960, 500]], sampleExtendedFeature2); +identityTransform = identityTransform.fitExtent([[0, 0], [960, 500]], sampleFeatureCollection); +identityTransform = identityTransform.fitExtent([[0, 0], [960, 500]], sampleExtendedFeatureCollection); + +identityTransform = identityTransform.fitSize([960, 500], samplePolygon); +identityTransform = identityTransform.fitSize([960, 500], sampleSphere); +identityTransform = identityTransform.fitSize([960, 500], sampleGeometryCollection); +identityTransform = identityTransform.fitSize([960, 500], sampleExtendedGeometryCollection); +identityTransform = identityTransform.fitSize([960, 500], sampleFeature); +identityTransform = identityTransform.fitSize([960, 500], sampleExtendedFeature1); +identityTransform = identityTransform.fitSize([960, 500], sampleExtendedFeature2); +identityTransform = identityTransform.fitSize([960, 500], sampleFeatureCollection); +identityTransform = identityTransform.fitSize([960, 500], sampleExtendedFeatureCollection); + + +// ---------------------------------------------------------------------- +// Stream interface +// ---------------------------------------------------------------------- +let stream: d3Geo.GeoStream; + +stream.point(0, 0); +stream.point(0, 0, 0); +stream.lineStart(); +stream.lineEnd(); +stream.polygonStart(); +stream.polygonEnd(); +stream.sphere(); + // geoStream(...) ======================================================== d3Geo.geoStream(samplePolygon, stream); diff --git a/d3-geo/index.d.ts b/d3-geo/index.d.ts index 94e48bd810..f3222ce20e 100644 --- a/d3-geo/index.d.ts +++ b/d3-geo/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for D3JS d3-geo module v1.2.4 +// Type definitions for D3JS d3-geo module v1.3.1 // Project: https://github.com/d3/d3-geo/ // Definitions by: Hugues Stefanski , Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -14,6 +14,9 @@ * beyond the GeoJSON geometries. */ export interface GeoSphere { + /** + * Sphere geometry type + */ type: 'Sphere'; } @@ -62,43 +65,165 @@ export type GeoPermissibleObjects = GeoGeometryObjects | ExtendedGeometryCollect // Spherical Math // ---------------------------------------------------------------------- -/**Returns the spherical area of the specified GeoJSON feature in steradians. */ +/** + * Returns the spherical area of the specified feature in steradians. + * (See also path.area, which computes the projected planar area.) + * + * @param feature A geographic feature supported by d3-geo (An extension of GeoJSON feature). + */ export function geoArea(feature: ExtendedFeature): number; +/** + * Returns the spherical area of the specified feature collection in steradians. + * (See also path.area, which computes the projected planar area.) + * + * @param feature A geographic feature collection supported by d3-geo (An extension of GeoJSON feature). + */ export function geoArea(feature: ExtendedFeatureCollection>): number; +/** + * Returns the spherical area of the specified GeoJson Geometry Object or GeoSphere object in steradians. + * (See also path.area, which computes the projected planar area.) + * + * @param feature A GeoJson Geometry Object or GeoSphere object supported by d3-geo (An extension of GeoJSON). + */ export function geoArea(feature: GeoGeometryObjects): number; +/** + * Returns the spherical area of the specified geographic geometry collection in steradians. + * (See also path.area, which computes the projected planar area.) + * + * @param feature A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection). + */ export function geoArea(feature: ExtendedGeometryCollection): number; -/**Returns the spherical bounding box for the specified GeoJSON feature. The bounding box is represented by a two-dimensional array: [[left, bottom], [right, top]], where left is the minimum longitude, bottom is the minimum latitude, right is maximum longitude, and top is the maximum latitude. All coordinates are given in degrees. */ +/** + * Returns the spherical bounding box for the specified feature. The bounding box is represented by a two-dimensional array: [[left, bottom], [right, top]], + * where left is the minimum longitude, bottom is the minimum latitude, right is maximum longitude, and top is the maximum latitude. All coordinates are given in degrees. + * (Note that in projected planar coordinates, the minimum latitude is typically the maximum y-value, and the maximum latitude is typically the minimum y-value.) + * + * @param feature A geographic feature supported by d3-geo (An extension of GeoJSON feature). + */ export function geoBounds(feature: ExtendedFeature): [[number, number], [number, number]]; +/** + * Returns the spherical bounding box for the specified feature collection. The bounding box is represented by a two-dimensional array: [[left, bottom], [right, top]], + * where left is the minimum longitude, bottom is the minimum latitude, right is maximum longitude, and top is the maximum latitude. All coordinates are given in degrees. + * (Note that in projected planar coordinates, the minimum latitude is typically the maximum y-value, and the maximum latitude is typically the minimum y-value.) + * + * @param feature A geographic feature collection supported by d3-geo (An extension of GeoJSON feature). + */ export function geoBounds(feature: ExtendedFeatureCollection>): [[number, number], [number, number]]; +/** + * Returns the spherical bounding box for the specified GeoJson Geometry Object or GeoSphere object. The bounding box is represented by a two-dimensional array: [[left, bottom], [right, top]], + * where left is the minimum longitude, bottom is the minimum latitude, right is maximum longitude, and top is the maximum latitude. All coordinates are given in degrees. + * (Note that in projected planar coordinates, the minimum latitude is typically the maximum y-value, and the maximum latitude is typically the minimum y-value.) + * + * @param feature A GeoJson Geometry Object or GeoSphere object supported by d3-geo (An extension of GeoJSON). + */ export function geoBounds(feature: GeoGeometryObjects): [[number, number], [number, number]]; +/** + * Returns the spherical bounding box for the specified geometry collection. The bounding box is represented by a two-dimensional array: [[left, bottom], [right, top]], + * where left is the minimum longitude, bottom is the minimum latitude, right is maximum longitude, and top is the maximum latitude. All coordinates are given in degrees. + * (Note that in projected planar coordinates, the minimum latitude is typically the maximum y-value, and the maximum latitude is typically the minimum y-value.) + * + * @param feature A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection). + */ export function geoBounds(feature: ExtendedGeometryCollection): [[number, number], [number, number]]; -/**Returns the spherical centroid of the specified GeoJSON feature. See also path.centroid, which computes the projected planar centroid.*/ +/** + * Returns the spherical centroid of the specified feature in steradians. + * (See also path.centroid, which computes the projected planar centroid.) + * + * @param feature A geographic feature supported by d3-geo (An extension of GeoJSON feature). + */ export function geoCentroid(feature: ExtendedFeature): [number, number]; +/** + * Returns the spherical centroid of the specified feature collection in steradians. + * (See also path.centroid, which computes the projected planar centroid.) + * + * @param feature A geographic feature collection supported by d3-geo (An extension of GeoJSON feature). + */ export function geoCentroid(feature: ExtendedFeatureCollection>): [number, number]; +/** + * Returns the spherical centroid of the specified GeoJson Geometry Object or GeoSphere object in steradians. + * (See also path.centroid, which computes the projected planar centroid.) + * + * @param feature A GeoJson Geometry Object or GeoSphere object supported by d3-geo (An extension of GeoJSON). + */ export function geoCentroid(feature: GeoGeometryObjects): [number, number]; +/** + * Returns the spherical centroid of the specified geographic geometry collection in steradians. + * (See also path.centroid, which computes the projected planar centroid.) + * + * @param feature A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection). + */ export function geoCentroid(feature: ExtendedGeometryCollection): [number, number]; -/**Returns the great-arc distance in radians between the two points a and b. Each point must be specified as a two-element array [longitude, latitude] in degrees. */ +/** + * Returns the great-arc distance in radians between the two points a and b. + * Each point must be specified as a two-element array [longitude, latitude] in degrees. + * + * @param a Point specified as a two-element array [longitude, latitude] in degrees. + * @param b Point specified as a two-element array [longitude, latitude] in degrees. + */ export function geoDistance(a: [number, number], b: [number, number]): number; -/**Returns the great-arc length of the specified GeoJSON feature in radians.*/ +/** + * Returns the great-arc length of the specified feature in radians. + * + * @param feature A geographic feature supported by d3-geo (An extension of GeoJSON feature). + */ export function geoLength(feature: ExtendedFeature): number; +/** + * Returns the great-arc length of the specified feature collection in radians. + * + * @param feature A geographic feature collection supported by d3-geo (An extension of GeoJSON feature). + */ export function geoLength(feature: ExtendedFeatureCollection>): number; +/** + * Returns the great-arc length of the specified GeoJson Geometry Object or GeoSphere object in radians. + * +* @param feature A GeoJson Geometry Object or GeoSphere object supported by d3-geo (An extension of GeoJSON). + */ export function geoLength(feature: GeoGeometryObjects): number; +/** + * Returns the great-arc length of the specified geographic geometry collection in radians. + * + * @param feature A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection). + */ export function geoLength(feature: ExtendedGeometryCollection): number; -/**Returns an interpolator function given two points a and b. Each point must be specified as a two-element array [longitude, latitude] in degrees. */ +/** + * Returns an interpolator function given two points a and b. + * Each point must be specified as a two-element array [longitude, latitude] in degrees. + * + * @param a Point specified as a two-element array [longitude, latitude] in degrees. + * @param b Point specified as a two-element array [longitude, latitude] in degrees. + */ export function geoInterpolate(a: [number, number], b: [number, number]): (t: number) => [number, number]; - +/** + * A Geo Rotation + */ export interface GeoRotation { + /** + * Returns a new array [longitude, latitude] in degrees representing the rotated point of the given point. + * + * @param point The point must be specified as a two-element array [longitude, latitude] in degrees. + */ (point: [number, number]): [number, number]; + + /** + * Returns a new array [longitude, latitude] in degrees representing the point of the given rotated point; the inverse of rotation. + * + * @param point The rotated point must be specified as a two-element array [longitude, latitude] in degrees. + */ invert(point: [number, number]): [number, number]; } -/**Returns a rotation function for the given angles, which must be a two- or three-element array of numbers [lambda, phi, gamma] specifying the rotation angles in degrees about each spherical axis. */ +/** + * Returns a rotation function for the given angles. + * + * @param angles A two- or three-element array of numbers [lambda, phi, gamma] specifying the rotation angles in degrees about each spherical axis. + * (These correspond to yaw, pitch and roll.) If the rotation angle gamma is omitted, it defaults to 0. + */ export function geoRotation(angles: [number, number] | [number, number, number]): GeoRotation; @@ -108,251 +233,1215 @@ export function geoRotation(angles: [number, number] | [number, number, number]) // geoCircle ============================================================ +/** + * A new circle generator + * + * The first generic corresponds to the "this"-context within which the geo circle generator will be invoked. + * + * The second generic corresponds to the type of the Datum which will be passed into the geo circle generator. + */ export interface GeoCircleGenerator { - /**Returns a new GeoJSON geometry object of type “Polygon” approximating a circle on the surface of a sphere, with the current center, radius and precision. */ + /** + * Returns a new GeoJSON geometry object of type “Polygon” approximating a circle on the surface of a sphere, + * with the current center, radius and precision. Any arguments are passed to the accessors. + */ (this: This, d?: Datum, ...args: any[]): GeoJSON.Polygon; + + /** + * Returns the current center accessor, which defaults to a function returning [0, 0]. + */ center(): ((this: This, d: Datum, ...args: any[]) => [number, number]); + /** + * Sets the circle center to the specified point [longitude, latitude] in degrees, and returns this circle generator. + * + * @param center Center point specified as [longitude, latitude] in degrees. + */ center(center: [number, number]): this; + /** + * Sets the circle center to the specified center point accessor function, and returns this circle generator. + * + * @param center An accessor function which will be invoked whenever a circle is generated, being passed any arguments passed to the circle generator. + * It returns the center point specified as [longitude, latitude] in degrees. + */ center(center: ((this: This, d: Datum, ...args: any[]) => [number, number])): this; + /** + * Returns the current radius accessor, which defaults to a function returning 90. + */ radius(): ((this: This, d: Datum, ...args: any[]) => number); + /** + * Sets the circle radius to the specified angle in degrees, and returns this circle generator. + * + * @param radius Circle radius as the specified angle in degrees. + */ radius(radius: number): this; + /** + * Sets the circle radius to the specified radius accessor function, and returns this circle generator. + * + * @param radius An accessor function which will be invoked whenever a circle is generated, being passed any arguments passed to the circle generator. + * It returns the radius as the specified angle in degrees. + */ radius(radius: ((this: This, d: Datum, ...args: any[]) => number)): this; + /** + * Returns the current precision accessor, which defaults to a function returning 6. + */ precision(): ((this: This, d: Datum, ...args: any[]) => number); + /** + * Sets the circle precision to the specified angle in degrees, and returns this circle generator. + * + * Small circles do not follow great arcs and thus the generated polygon is only an approximation. + * Specifying a smaller precision angle improves the accuracy of the approximate polygon, but also increase the cost to generate and render it. + * + * @param precision Precision as specified angle in degrees. + */ precision(precision: number): this; + /** + * Sets the circle precision to the precision accessor function, and returns this circle generator. + * + * Small circles do not follow great arcs and thus the generated polygon is only an approximation. + * Specifying a smaller precision angle improves the accuracy of the approximate polygon, but also increase the cost to generate and render it. + * + * @param precision An accessor function which will be invoked whenever a circle is generated, being passed any arguments passed to the circle generator. + * It returns the precision as the specified angle in degrees. + */ precision(precision: (this: This, d: Datum, ...args: any[]) => number): this; } +/** + * Returns a new geo circle generator + */ export function geoCircle(): GeoCircleGenerator; +/** + * Returns a new geo circle generator + * + * The generic corresponds to the data type of the first argument passed into the geo circle generator and its accessor functions. + */ export function geoCircle(): GeoCircleGenerator; +/** + * Returns a new geo circle generator + * + * The first generic corresponds to the "this" context within which the geo circle generator and its accessors will be invoked. + * + * The second generic corresponds to the data type of the first argument passed into the geo circle generator and its accessor functions. + */ export function geoCircle(): GeoCircleGenerator; // geoGraticule ============================================================ +/** + * A Feature generator for graticules: a uniform grid of meridians and parallels for showing projection distortion. + * The default graticule has meridians and parallels every 10° between ±80° latitude; for the polar regions, there are meridians every 90°. + */ export interface GeoGraticuleGenerator { - /**Returns a GeoJSON MultiLineString geometry object representing all meridians and parallels for this graticule. */ + /** + * Returns a GeoJSON MultiLineString geometry object representing all meridians and parallels for this graticule. + */ (): GeoJSON.MultiLineString; + /** + * Returns an array of GeoJSON LineString geometry objects, one for each meridian or parallel for this graticule. + */ lines(): GeoJSON.LineString[]; + + /** + * Returns a GeoJSON Polygon geometry object representing the outline of this graticule, i.e. along the meridians and parallels defining its extent. + */ outline(): GeoJSON.Polygon; + + /** + * Returns the current minor extent, which defaults to ⟨⟨-180°, -80° - ε⟩, ⟨180°, 80° + ε⟩⟩. + */ extent(): [[number, number], [number, number]]; + /** + * Sets the major and minor extents of this graticule. + * + * @param extent Extent to use for major and minor extent of graticule. + */ extent(extent: [[number, number], [number, number]]): this; + + /** + * Returns the current major extent, which defaults to ⟨⟨-180°, -90° + ε⟩, ⟨180°, 90° - ε⟩⟩. + */ extentMajor(): [[number, number], [number, number]]; + /** + * Sets the major extent of this graticule. + * + * @param extent Major extent of graticule. + */ extentMajor(extent: [[number, number], [number, number]]): this; + + /** + * Returns the current minor extent, which defaults to ⟨⟨-180°, -80° - ε⟩, ⟨180°, 80° + ε⟩⟩. + */ extentMinor(): [[number, number], [number, number]]; + /** + * Sets the minor extent of this graticule. + * + * @param extent Minor extent of graticule. + */ extentMinor(extent: [[number, number], [number, number]]): this; + + /** + * Returns the current minor step, which defaults to ⟨10°, 10°⟩. + */ step(): [number, number]; + /** + * Sets the major and minor step for this graticule + * + * @param step Major and minor step to use for this graticule. + */ step(step: [number, number]): this; + + /** + * Returns the current major step, which defaults to ⟨90°, 360°⟩. + */ stepMajor(): [number, number]; + /** + * Sets the major step for this graticule. + * + * @param step Major step. + */ stepMajor(step: [number, number]): this; + + /** + * Returns the current major step, which defaults to ⟨10°, 10°⟩. + */ stepMinor(): [number, number]; + /** + * Sets the minor step for this graticule. + * + * @param step Minor step. + */ stepMinor(step: [number, number]): this; + + /** + * Returns the current precision, which defaults to 2.5°. + */ precision(): number; + /** + * Sets the precision for this graticule, in degrees. + * + * @param angle Precision in degrees. + */ precision(angle: number): this; } +/** + * Constructs a feature generator for creating graticules: a uniform grid of meridians and parallels for showing projection distortion. + * The default graticule has meridians and parallels every 10° between ±80° latitude; for the polar regions, there are meridians every 90°. + */ export function geoGraticule(): GeoGraticuleGenerator; +/** + * A convenience method for directly generating the default 10° global graticule as a GeoJSON MultiLineString geometry object. + */ +export function geoGraticule10(): GeoJSON.MultiLineString; + // ---------------------------------------------------------------------- // Projections // ---------------------------------------------------------------------- +/** + * A D3 geo stream. D3 transforms geometry using a sequence of function calls, rather than materializing intermediate representations, to minimize overhead. + * Streams must implement several methods to receive input geometry. Streams are inherently stateful; the meaning of a point depends on whether the point is inside of a line, + * and likewise a line is distinguished from a ring by a polygon. Despite the name “stream”, these method calls are currently synchronous. + */ export interface GeoStream { + /** + * Indicates the end of a line or ring. Within a polygon, indicates the end of a ring. + * Unlike GeoJSON, the redundant closing coordinate of a ring is not indicated via point, and instead is implied via lineEnd within a polygon. + */ lineEnd(): void; + + /** + * Indicates the start of a line or ring. Within a polygon, indicates the start of a ring. The first ring of a polygon is the exterior ring, and is typically clockwise. + * Any subsequent rings indicate holes in the polygon, and are typically counterclockwise. + */ lineStart(): void; + + /** + * Indicates a point with the specified coordinates x and y (and optionally z). The coordinate system is unspecified and implementation-dependent; + * for example, projection streams require spherical coordinates in degrees as input. Outside the context of a polygon or line, + * a point indicates a point geometry object (Point or MultiPoint). Within a line or polygon ring, the point indicates a control point. + * + * @param x x-coordinate of point. + * @param y y-coordinate of point. + * @param z Optional z-coordinate of point. + */ point(x: number, y: number, z?: number): void; + + /** + * Indicates the end of a polygon. + */ polygonEnd(): void; + + /** + * Indicates the start of a polygon. The first line of a polygon indicates the exterior ring, and any subsequent lines indicate interior holes. + */ polygonStart(): void; + + /** + * Indicates the sphere (the globe; the unit sphere centered at ⟨0,0,0⟩). + */ sphere?(): void; } -export interface GeoStreamWrapper { - stream(stream: GeoStream): GeoStream; -} +// geoStream(...) ======================================================= + +/** + * Streams the specified GeoJSON object to the specified projection stream. While both features and geometry objects are supported as input, + * the stream interface only describes the geometry, and thus additional feature properties are not visible to streams. + * + * @param object + * @param stream A projection stream. + */ +export function geoStream(object: ExtendedFeature, stream: GeoStream): void; + +/** + * Streams the specified GeoJSON object to the specified projection stream. While both features and geometry objects are supported as input, + * the stream interface only describes the geometry, and thus additional feature properties are not visible to streams. + * + * @param object + * @param stream A projection stream. + */ +export function geoStream(object: ExtendedFeatureCollection>, stream: GeoStream): void; + +/** + * Streams the specified GeoJSON object to the specified projection stream. While both features and geometry objects are supported as input, + * the stream interface only describes the geometry, and thus additional feature properties are not visible to streams. + * + * @param object + * @param stream A projection stream. + */ +export function geoStream(object: GeoGeometryObjects, stream: GeoStream): void; + +/** + * Streams the specified GeoJSON object to the specified projection stream. While both features and geometry objects are supported as input, + * the stream interface only describes the geometry, and thus additional feature properties are not visible to streams. + * + * @param object + * @param stream A projection stream. + */ +export function geoStream(object: ExtendedGeometryCollection, stream: GeoStream): void; + + + +// ---------------------------------------------------------------------- +// Projections +// ---------------------------------------------------------------------- + + + + +/** + * Raw projections are point transformation functions that are used to implement custom projections; they typically passed to d3.geoProjection or d3.geoProjectionMutator. + * They are exposed here to facilitate the derivation of related projections. + * Raw projections take spherical coordinates [lambda, phi] in radians (not degrees!) and return a point [x, y], typically in the unit square centered around the origin. + */ export interface GeoRawProjection { - (longitude: number, latitude: number): [number, number]; + /** + * Projects the specified point [lambda, phi] in radians, returning a new point [x, y] in unitless coordinates. + * @param lambda Spherical lambda coordinate in radians. + * @param phi Spherical phi coordinate in radians. + */ + (lambda: number, phi: number): [number, number]; + + /** + * Inverts the projected point [x, y] in unitless coordinates, returning an unprojected point in spherical coordinates [lambda, phi] in radians. + * @param x x-coordinate (unitless). + * @param y y-coordinate (unitless). + */ invert?(x: number, y: number): [number, number]; } +/** + * An object implementing a stream method + */ +export interface GeoStreamWrapper { + /** + * Returns a projection stream for the specified output stream. Any input geometry is projected before being streamed to the output stream. + * A typical projection involves several geometry transformations: the input geometry is first converted to radians, rotated on three axes, + * clipped to the small circle or cut along the antimeridian, and lastly projected to the plane with adaptive resampling, scale and translation. + * + * @param stream An input stream + */ + stream(stream: GeoStream): GeoStream; +} +/** + * A Geographic Projection to transform spherical polygonal geometry to planar polygonal geometry. + * D3 provides implementations of several classes of standard projections: + * + * - Azimuthal + * - Composite + * - Conic + * - Cylindrical + * + * For many more projections, see d3-geo-projection. You can implement custom projections using d3.geoProjection or d3.geoProjectionMutator. + */ export interface GeoProjection extends GeoStreamWrapper { - /**Returns a new array x, y representing the projected point of the given point. The point must be specified as a two-element array [longitude, latitude] in degrees. */ + /** + * Returns a new array [x, y] (typically in pixels) representing the projected point of the given point. + * The point must be specified as a two-element array [longitude, latitude] in degrees. + * May return null if the specified point has no defined projected position, such as when the point is outside the clipping bounds of the projection. + * + * @param point A point specified as a two-dimensional array [longitude, latitude] in degrees. + */ (point: [number, number]): [number, number] | null; + /** + * Returns the current center of the projection, which defaults to ⟨0°,0°⟩. + */ center(): [number, number]; + /** + * Sets the projection’s center to the specified center, + * a two-element array of longitude and latitude in degrees and returns the projection. + * The default is ⟨0°,0°⟩. + * + * @param point A point specified as a two-dimensional array [longitude, latitude] in degrees. + */ center(point: [number, number]): this; + /** + * Returns the current clip angle which defaults to null. + * + * null switches to antimeridian cutting rather than small-circle clipping. + */ clipAngle(): number | null; + /** + * Switches to antimeridian cutting rather than small-circle clipping. + * + * @param angle Set to null to switch to antimeridian cutting. + */ clipAngle(angle: null): this; + /** + * Sets the projection’s clipping circle radius to the specified angle in degrees and returns the projection. + * Small-circle clipping is independent of viewport clipping via projection.clipExtent. + * + * @param angle Angle in degrees. + */ clipAngle(angle: number): this; + /** + * Returns the current viewport clip extent which defaults to null. + */ clipExtent(): [[number, number], [number, number]] | null; + /** + * Sets the clip extent to null and returns the projection. + * With a clip extent of null, no viewport clipping is performed. + * + * Viewport clipping is independent of small-circle clipping via projection.clipAngle. + * + * @param extent Set to null to disable viewport clipping. + */ clipExtent(extent: null): this; + /** + * Sets the projection’s viewport clip extent to the specified bounds in pixels and returns the projection. + * The extent bounds are specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left-side of the viewport, y₀ is the top, x₁ is the right and y₁ is the bottom. + * + * Viewport clipping is independent of small-circle clipping via projection.clipAngle. + * + * @param extent The extent bounds are specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left-side of the viewport, y₀ is the top, x₁ is the right and y₁ is the bottom. + */ clipExtent(extent: [[number, number], [number, number]]): this; - /**Sets the projection’s scale and translate to fit the specified GeoJSON object in the center of the given extent. */ + /** + * Sets the projection’s scale and translate to fit the specified geographic feature in the center of the given extent. + * Returns the projection. + * + * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150. + * + * @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom. + * @param object A geographic feature supported by d3-geo (An extension of GeoJSON feature). + */ fitExtent(extent: [[number, number], [number, number]], object: ExtendedFeature): this; + /** + * Sets the projection’s scale and translate to fit the specified geographic feature collection in the center of the given extent. + * Returns the projection. + * + * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150. + * + * @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom. + * @param object A geographic feature collection supported by d3-geo (An extension of GeoJSON feature collection). + */ fitExtent(extent: [[number, number], [number, number]], object: ExtendedFeatureCollection>): this; + /** + * Sets the projection’s scale and translate to fit the specified geographic geometry object in the center of the given extent. + * Returns the projection. + * + * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150. + * + * @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom. + * @param object A GeoJson Geometry Object or GeoSphere object supported by d3-geo (An extension of GeoJSON). + */ fitExtent(extent: [[number, number], [number, number]], object: GeoGeometryObjects): this; + /** + * Sets the projection’s scale and translate to fit the specified geographic geometry collection in the center of the given extent. + * Returns the projection. + * + * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150. + * + * @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom. + * @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection). + */ fitExtent(extent: [[number, number], [number, number]], object: ExtendedGeometryCollection): this; - /**A convenience method for projection.fitExtent where the top-left corner of the extent is [0,0]. */ + /** + * Sets the projection’s scale and translate to fit the specified geographic feature in the center of an extent with the given size and top-left corner of [0, 0]. + * Returns the projection. + * + * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150. + * + * @param size The size of the extent, specified as an array [width, height]. + * @param object A geographic feature supported by d3-geo (An extension of GeoJSON feature). + */ fitSize(size: [number, number], object: ExtendedFeature): this; + /** + * Sets the projection’s scale and translate to fit the specified geographic feature collection in the center of an extent with the given size and top-left corner of [0, 0]. + * Returns the projection. + * + * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150. + * + * @param size The size of the extent, specified as an array [width, height]. + * @param object A geographic feature collection supported by d3-geo (An extension of GeoJSON feature collection). + */ fitSize(size: [number, number], object: ExtendedFeatureCollection>): this; + /** + * Sets the projection’s scale and translate to fit the specified geographic geometry object in the center of an extent with the given size and top-left corner of [0, 0]. + * Returns the projection. + * + * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150. + * + * @param size The size of the extent, specified as an array [width, height]. + * @param object A GeoJson Geometry Object or GeoSphere object supported by d3-geo (An extension of GeoJSON). + */ fitSize(size: [number, number], object: GeoGeometryObjects): this; + /** + * Sets the projection’s scale and translate to fit the specified geographic geometry collection in the center of an extent with the given size and top-left corner of [0, 0]. + * Returns the projection. + * + * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150. + * + * @param size The size of the extent, specified as an array [width, height]. + * @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection). + */ fitSize(size: [number, number], object: ExtendedGeometryCollection): this; - /**Returns a new array [longitude, latitude] in degrees representing the unprojected point of the given projected point. */ + /** + * Returns a new array [longitude, latitude] in degrees representing the unprojected point of the given projected point. + * May return null if the specified point has no defined projected position, such as when the point is outside the clipping bounds of the projection. + * + * @param point The projected point, specified as a two-element array [x, y] (typically in pixels). + */ invert?(point: [number, number]): [number, number] | null; + /** + * Returns the projection’s current resampling precision which defaults to square root of 0.5. + * This value corresponds to the Douglas–Peucker distance. + */ precision(): number; + /** + * Sets the threshold for the projection’s adaptive resampling to the specified value in pixels and returns the projection. + * This value corresponds to the Douglas–Peucker distance. + * + * @param precision A numeric value in pixels to use as the threshold for the projection’s adaptive resampling. + */ precision(precision: number): this; + /** + * Returns the current rotation [lambda, phi, gamma] specifying the rotation angles in degrees about each spherical axis. + * (These correspond to yaw, pitch and roll.) which defaults [0, 0, 0]. + */ rotate(): [number, number, number]; + /** + * Sets the projection’s three-axis rotation to the specified angles, which must be a two- or three-element array of numbers. + * + * @param angles A two- or three-element array of numbers [lambda, phi, gamma] specifying the rotation angles in degrees about each spherical axis. + * (These correspond to yaw, pitch and roll.) If the rotation angle gamma is omitted, it defaults to 0. + */ rotate(angles: [number, number] | [number, number, number]): this; + /** + * Returns the current scale factor; the default scale is projection-specific. + * + * The scale factor corresponds linearly to the distance between projected points; however, absolute scale factors are not equivalent across projections. + */ scale(): number; + /** + * Sets the projection’s scale factor to the specified value and returns the projection. + * The scale factor corresponds linearly to the distance between projected points; however, absolute scale factors are not equivalent across projections. + * + * @param scale Scale factor to be used for the projection; the default scale is projection-specific. + */ scale(scale: number): this; + /** + * Returns the current translation offset which defaults to [480, 250] and places ⟨0°,0°⟩ at the center of a 960×500 area. + * The translation offset determines the pixel coordinates of the projection’s center. + */ translate(): [number, number]; + /** + * Sets the projection’s translation offset to the specified two-element array [tx, ty] and returns the projection. + * The translation offset determines the pixel coordinates of the projection’s center. The default translation offset places ⟨0°,0°⟩ at the center of a 960×500 area. + * + * @param point A two-element array [tx, ty] specifying the translation offset. The default translation offset of defaults to [480, 250] places ⟨0°,0°⟩ at the center of a 960×500 area. + */ translate(point: [number, number]): this; } +/** + * A Conic Projection + */ export interface GeoConicProjection extends GeoProjection { - parallels(value: [number, number]): this; + + /** + * Return the standard parallels for the conic projection in degrees. + */ parallels(): [number, number]; + /** + * Set the standard parallels for the conic projection in degrees and return the projection. + * + * @param value A two-dimensional array representing the standard parallels in degrees. + */ + parallels(value: [number, number]): this; + } // geoPath ============================================================== +/** + * A minimal rendering context for a GeoPath generator. The minimum implemented + * methods are a subset of the CanvasRenderingContext2D API. + * + * For reference to the CanvasRenderingContext2D see https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D + */ export interface GeoContext { + + /** + * Adds an arc to the path with center point (x, y) and radius r starting at startAngle and ending at endAngle. + * The arc is drawn in clockwise directio by default. + * + * @param x x-coordinate of arc center point. + * @param y y-coordinate of arc center point. + * @param radius Radius of arc. + * @param startAngle The starting angle of the arc, measured clockwise from the positive x axis and expressed in radians. + * @param endAngle The end angle of the arc, measured clockwise from the positive x axis and expressed in radians. + * @param anticlockwise Optional boolean flag, if true the arc is drawn counter-clockwise between the two angles. + */ arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; + + /** + * Start a new path by emptying the list of sub-paths. + */ beginPath(): void; + + /** + * Causes the point of the pen to move back to the start of the current sub-path. + * It tries to draw a straight line from the current point to the start. + * If the shape has already been closed or has only one point, this function does nothing. + */ closePath(): void; + + /** + * Connects the last point in the sub-path to the x, y coordinates with a straight line (but does not actually draw it). + * + * @param x The x-coordinate for the end of the line. + * @param y The y-coordinate for the end of the line. + */ lineTo(x: number, y: number): void; + + /** + * Move the starting point of a new sub-path to the (x, y) coordinates. + * + * @param x The x-coordinate for the new starting point. + * @param y The y-coordinate for the new starting point. + */ moveTo(x: number, y: number): void; } +/** + * A Geo Path generator + * + * The first generic corresponds to the "this"-context within which the geo path generator will be invoked. This could be e.g. the DOMElement bound to "this" when using selection.attr("d", ...) with the path generator. + * + * The second generic corresponds to the type of the DatumObject which will be passed into the geo path generator for rendering. + */ export interface GeoPath { - (this: This, object: DatumObject, ...args: any[]): string; + /** + * Renders the given object, which may be any GeoJSON feature or geometry object: + * + * + Point - a single position. + * + MultiPoint - an array of positions. + * + LineString - an array of positions forming a continuous line. + * + MultiLineString - an array of arrays of positions forming several lines. + * + Polygon - an array of arrays of positions forming a polygon (possibly with holes). + * + MultiPolygon - a multidimensional array of positions forming multiple polygons. + * + GeometryCollection - an array of geometry objects. + * + Feature - a feature containing one of the above geometry objects. + * + FeatureCollection - an array of feature objects. + * + * The type Sphere is also supported, which is useful for rendering the outline of the globe; a sphere has no coordinates. + * + * + * Any additional arguments are passed along to the pointRadius accessor. + * + * If the rendering context is null, the function returns an SVG Path string, otherwise the function renders to the current context. + * + * Separate path elements are typically slower than a single path element. However, distinct path elements are useful for styling and interation (e.g., click or mouseover). + * Canvas rendering (see path.context) is typically faster than SVG, but requires more effort to implement styling and interaction. + * + * The first generic type of the GeoPath generator used, must correspond to the "this" context bound to the function upon invocation. + * + * @param object An object to be rendered. + */ + (this: This, object: DatumObject, ...args: any[]): string | undefined; + /** + * Returns the projected planar area (typically in square pixels) for the specified GeoJSON object. + * Point, MultiPoint, LineString and MultiLineString features have zero area. For Polygon and MultiPolygon features, + * this method first computes the area of the exterior ring, and then subtracts the area of any interior holes. + * This method observes any clipping performed by the projection; see projection.clipAngle and projection.clipExtent. + * + * @param An object for which the area is to be calculated. + */ area(object: DatumObject): number; + + /** + * Returns the projected planar bounding box (typically in pixels) for the specified GeoJSON object. + * The bounding box is represented by a two-dimensional array: [[x₀, y₀], [x₁, y₁]], where x₀ is the minimum x-coordinate, y₀ is the minimum y-coordinate, + * x₁ is maximum x-coordinate, and y₁ is the maximum y-coordinate. + * + * This is handy for, say, zooming in to a particular feature. (Note that in projected planar coordinates, + * the minimum latitude is typically the maximum y-value, and the maximum latitude is typically the minimum y-value.) + * This method observes any clipping performed by the projection; see projection.clipAngle and projection.clipExtent. + * + * @param An object for which the bounds are to be calculated. + */ bounds(object: DatumObject): [[number, number], [number, number]]; + + /** + * Returns the projected planar centroid (typically in pixels) for the specified GeoJSON object. + * This is handy for, say, labeling state or county boundaries, or displaying a symbol map. + * For example, a noncontiguous cartogram might scale each state around its centroid. + * This method observes any clipping performed by the projection; see projection.clipAngle and projection.clipExtent. + * + * @param An object for which the centroid is to be calculated. + */ centroid(object: DatumObject): [number, number]; - context(): C | null; - context(context: GeoContext | null): this; + + /** + * Returns the current render context which defaults to null. + * + * Use the generic to cast the return type of the rendering context, if it is known for a specific application. + */ + context(): C; + + /** + * Set the current rendering context to null and return the path generator. + * The path generator will return an SVG path string; + * + * @param context Null to remove the current rendering context, if any. + */ + context(context: null): this; + + /** + * Set the current rendering context and return the path generator. + * The path generator will render to the specified context. + * + * @param context Rendering context to be used by the path generator. + * The context must at least implement GeoContext, a subset of the CanvasRenderingContext2D API. + */ + context(context: GeoContext): this; /** * Get the current projection. The generic parameter can be used to cast the result to the * correct, known type of the projection, e.g. GeoProjection or GeoConicProjection. Otherwise, * the return type defaults to the minimum type requirement for a projection which * can be passed into a GeoPath. + * + * Use the generic to cast the return type of the projection, if it is known for a specific application. */ - projection

(): P | null; + projection

(): P; /** - * Set the projection to the identity projection + * Set the projection to the identity projection. + * + * @param projection Use null to set the identity projection. */ projection(projection: null): this; /** - * Set the projection to be used with the geo path generator. + * Set the current projection to be used with the geo path generator. + * + * The given projection is typically one of D3’s built-in geographic projections; + * however, any object that exposes a projection.stream function can be used, enabling the use of custom projections. + * See D3’s transforms for more examples of arbitrary geometric transformations. + * + * @param projection A projection. */ projection(projection: GeoProjection): this; /** * Set the projection to be used with the geo path generator to a custom projection. * Custom projections must minimally contain a stream method. + * + * The given projection is typically one of D3’s built-in geographic projections; + * however, any object that exposes a projection.stream function can be used, enabling the use of custom projections. + * See D3’s transforms for more examples of arbitrary geometric transformations. + * + * @param projection A wrapper object exposing, at a minimum a "stream" method to be used for custom projections. */ projection(projection: GeoStreamWrapper): this; - pointRadius(): (this: This, object: DatumObject, ...args: any[]) => number; + /** + * Returns the current radius or radius accessor used to determine the radius for the display of Point and MultiPoint features. + * The default is a constant radius of 4.5. + */ + pointRadius(): ((this: This, object: DatumObject, ...args: any[]) => number) | number; + + /** + * Sets the radius used to display Point and MultiPoint features to the specified number and return the geo path generator. + * + * @param value Fixed radius value. + */ pointRadius(value: number): this; + + /** + * Sets the radius used to display Point and MultiPoint features to use the specified radius accessor function. + * + * While the radius is commonly specified as a number constant, it may also be specified as a function which is computed per feature, + * being passed the any arguments passed to the path generator. For example, if your GeoJSON data has additional properties, + * you might access those properties inside the radius function to vary the point size; + * alternatively, you could d3.symbol and a projection for greater flexibility. + * + * @param value A value accessor function for the radius which is evaluated for each path to be rendered. The value accessor function is invoked within the "this" context in which the path generator is used. + * It is passed the object to be rendered, and any additional arguments which have been passed into the call to the render function of the path generator. + */ pointRadius(value: (this: This, object: DatumObject, ...args: any[]) => number): this; } -export function geoPath(): GeoPath; -export function geoPath(): GeoPath; -export function geoPath(): GeoPath; +/** + * Creates a new geographic path generator. + * + * The default projection is the null projection. The null projection represents the identity transformation, i.e. + * the input geometry is not projected and is instead rendered directly in raw coordinates. + * This can be useful for fast rendering of pre-projected geometry, or for fast rendering of the equirectangular projection. + * + * The default context is null, which implies that the path generator will return an SVG path string. + * + * @param projection An (optional) current projection to be used. Typically this is one of D3’s built-in geographic projections; + * however, any object that exposes a projection.stream function can be used, enabling the use of custom projections. + * See D3’s transforms for more examples of arbitrary geometric transformations. Setting the projection to "null" uses the identity projection. The default value is "null", the identity projection. + * @param context An (optional) rendering context to be used. If a context is provided, it must at least implement the interface described by GeoContext, a subset of the CanvasRenderingContext2D API. + * Setting the context to "null" means that the path generator will return an SVG path string representing the to be rendered object. The default is "null". + */ +export function geoPath(projection?: GeoProjection | GeoStreamWrapper | null, context?: GeoContext | null): GeoPath; +/** + * Creates a new geographic path generator with the default settings. + * + * The default projection is the null projection. The null projection represents the identity transformation: + * the input geometry is not projected and is instead rendered directly in raw coordinates. + * This can be useful for fast rendering of pre-projected geometry, or for fast rendering of the equirectangular projection. + * + * The default context is null, which implies that the path generator will return an SVG path string. + * + * The generic corresponds to the type of the DatumObject which will be passed into the geo path generator for rendering + * + * @param projection An (optional) current projection to be used. Typically this is one of D3’s built-in geographic projections; + * however, any object that exposes a projection.stream function can be used, enabling the use of custom projections. + * See D3’s transforms for more examples of arbitrary geometric transformations. Setting the projection to "null" uses the identity projection. The default value is "null", the identity projection. + * @param context An (optional) rendering context to be used. If a context is provided, it must at least implement the interface described by GeoContext, a subset of the CanvasRenderingContext2D API. + * Setting the context to "null" means that the path generator will return an SVG path string representing the to be rendered object. The default is "null". + */ +export function geoPath(projection?: GeoProjection | GeoStreamWrapper | null, context?: GeoContext | null): GeoPath; +/** + * Creates a new geographic path generator with the default settings. + * + * The default projection is the null projection. The null projection represents the identity transformation: + * the input geometry is not projected and is instead rendered directly in raw coordinates. + * This can be useful for fast rendering of pre-projected geometry, or for fast rendering of the equirectangular projection. + * + * The default context is null, which implies that the path generator will return an SVG path string. + * + * The first generic corresponds to the "this"-context within which the geo path generator will be invoked. This could be e.g. the DOMElement bound to "this" when using selection.attr("d", ...) with the path generator. + * + * The second generic corresponds to the type of the DatumObject which will be passed into the geo path generator for rendering. + * + * @param projection An (optional) current projection to be used. Typically this is one of D3’s built-in geographic projections; + * however, any object that exposes a projection.stream function can be used, enabling the use of custom projections. + * See D3’s transforms for more examples of arbitrary geometric transformations. Setting the projection to "null" uses the identity projection. The default value is "null", the identity projection. + * @param context An (optional) rendering context to be used. If a context is provided, it must at least implement the interface described by GeoContext, a subset of the CanvasRenderingContext2D API. + * Setting the context to "null" means that the path generator will return an SVG path string representing the to be rendered object. The default is "null". + */ +export function geoPath(projection?: GeoProjection | GeoStreamWrapper | null, context?: GeoContext | null): GeoPath; + -// Raw Projections ======================================================== -export function geoAzimuthalEqualAreaRaw(): GeoRawProjection; -export function geoAzimuthalEquidistantRaw(): GeoRawProjection; -export function geoConicConformalRaw(phi0: number, phi1: number): GeoRawProjection; -export function geoConicEqualAreaRaw(phi0: number, phi1: number): GeoRawProjection; -export function geoConicEquidistantRaw(phi0: number, phi1: number): GeoRawProjection; -export function geoEquirectangularRaw(): GeoRawProjection; -export function geoGnomonicRaw(): GeoRawProjection; -export function geoMercatorRaw(): GeoRawProjection; -export function geoOrthographicRaw(): GeoRawProjection; -export function geoStereographicRaw(): GeoRawProjection; -export function geoTransverseMercatorRaw(): GeoRawProjection; // geoProjection ========================================================== +/** + * Constructs a new projection from the specified raw projection, project. + * The project function takes the longitude and latitude of a given point in radians, + * often referred to as lambda (λ) and phi (φ), and returns a two-element array [x, y] representing its unit projection. + * The project function does not need to scale or translate the point, as these are applied automatically by projection.scale, projection.translate, and projection.center. + * Likewise, the project function does not need to perform any spherical rotation, as projection.rotate is applied prior to projection. + * + * If the project function exposes an invert method, the returned projection will also expose projection.invert. + */ export function geoProjection(project: GeoRawProjection): GeoProjection; // geoProjectionMutator ==================================================== +/** + * Constructs a new projection from the specified raw projection factory and returns a mutate function to call whenever the raw projection changes. + * The factory must return a raw projection. The returned mutate function returns the wrapped projection. + * + * When creating a mutable projection, the mutate function is typically not exposed. + */ export function geoProjectionMutator(factory: (...args: any[]) => GeoRawProjection): () => GeoProjection; -// Pre-Defined Projections ================================================= +// Pre-Defined Projections and Raw Projections ============================= -export function geoAlbers(): GeoConicProjection; -export function geoAlbersUsa(): GeoProjection; +// Azimuthal Projections --------------------------------------------------- + +/** + * The azimuthal equal-area projection. + */ export function geoAzimuthalEqualArea(): GeoProjection; + +/** + * The raw azimuthal equal-area projection. + */ +export function geoAzimuthalEqualAreaRaw(): GeoRawProjection; + +/** + * The azimuthal equidistant projection. + */ export function geoAzimuthalEquidistant(): GeoProjection; -export function geoConicConformal(): GeoConicProjection; -export function geoConicEqualArea(): GeoConicProjection; -export function geoConicEquidistant(): GeoConicProjection; -export function geoEquirectangular(): GeoProjection; +/** + * The raw azimuthal equidistant projection. + */ +export function geoAzimuthalEquidistantRaw(): GeoRawProjection; + +/** + * The gnomonic projection. + */ export function geoGnomonic(): GeoProjection; -export function geoMercator(): GeoProjection; + +/** + * The raw gnomonic projection. + */ +export function geoGnomonicRaw(): GeoRawProjection; + +/** + * The orthographic projection. + */ export function geoOrthographic(): GeoProjection; + +/** + * The raw orthographic projection. + */ +export function geoOrthographicRaw(): GeoRawProjection; + +/** + * The stereographic projection. + */ export function geoStereographic(): GeoProjection; +/** + * The raw stereographic projection. + */ +export function geoStereographicRaw(): GeoRawProjection; + +// Composite Projections --------------------------------------------------- + +/** + * A U.S.-centric composite projection of three d3.geoConicEqualArea projections: d3.geoAlbers is used for the lower forty-eight states, + * and separate conic equal-area projections are used for Alaska and Hawaii. Note that the scale for Alaska is diminished: it is projected at 0.35× its true relative area. + * + * Composite consist of several projections that are composed into a single display. The constituent projections have fixed clip, center and rotation, + * and thus composite projections do not support projection.center, projection.rotate, projection.clipAngle, or projection.clipExtent. + */ +export function geoAlbersUsa(): GeoProjection; + +// Conic Projections ------------------------------------------------------- + +/** + * The Albers’ equal area-conic projection. This is a U.S.-centric configuration of d3.geoConicEqualArea. + */ +export function geoAlbers(): GeoConicProjection; + +/** + * The conic conformal projection. The parallels default to [30°, 30°] resulting in flat top. + */ +export function geoConicConformal(): GeoConicProjection; + +/** + * The raw conic conformal projection. + */ +export function geoConicConformalRaw(phi0: number, phi1: number): GeoRawProjection; + +/** + * The Albers’ equal-area conic projection. + */ +export function geoConicEqualArea(): GeoConicProjection; + +/** + * The raw Albers’ equal-area conic projection. + */ +export function geoConicEqualAreaRaw(phi0: number, phi1: number): GeoRawProjection; + +/** + * The conic equidistant projection. + */ +export function geoConicEquidistant(): GeoConicProjection; + +/** + * The raw conic equidistant projection. + */ +export function geoConicEquidistantRaw(phi0: number, phi1: number): GeoRawProjection; + +// Cylindrical Projections ------------------------------------------------ + +/** + * The equirectangular (plate carrée) projection. + */ +export function geoEquirectangular(): GeoProjection; + +/** + * The raw equirectangular (plate carrée) projection. + */ +export function geoEquirectangularRaw(): GeoRawProjection; + +/** + * The spherical Mercator projection. + * Defines a default projection.clipExtent such that the world is projected to a square, clipped to approximately ±85° latitude. + */ +export function geoMercator(): GeoProjection; +/** + * The raw spherical Mercator projection. + */ +export function geoMercatorRaw(): GeoRawProjection; + +/** + * The transverse spherical Mercator projection. + * Defines a default projection.clipExtent such that the world is projected to a square, clipped to approximately ±85° latitude. + */ export function geoTransverseMercator(): GeoProjection; -// geoClipExtent ============================================================= - -export interface GeoExtent { - extent(): [[number, number], [number, number]]; - extent(extent: [[number, number], [number, number]]): this; - stream(stream: GeoStream): GeoStream; -} - - -export function geoClipExtent(): GeoExtent; +/** + * The raw transverse spherical Mercator projection. + */ +export function geoTransverseMercatorRaw(): GeoRawProjection; // ---------------------------------------------------------------------- -// Projection Streams +// Projection Transforms // ---------------------------------------------------------------------- // geoTransform(...) ==================================================== +/** + * A Prototype interface which serves as a template for the implementation of a geometric transform using geoTransform(...) + * It serves as a reference for the custom methods which can be passed into geoTransform as argument to crete a generalized + * transform projection. + */ export interface GeoTransformPrototype { + /** + * Indicates the end of a line or ring. Within a polygon, indicates the end of a ring. + * Unlike GeoJSON, the redundant closing coordinate of a ring is not indicated via point, and instead is implied via lineEnd within a polygon. + */ lineEnd?(this: this & { stream: GeoStream }): void; + /** + * Indicates the start of a line or ring. Within a polygon, indicates the start of a ring. The first ring of a polygon is the exterior ring, and is typically clockwise. + * Any subsequent rings indicate holes in the polygon, and are typically counterclockwise. + */ lineStart?(this: this & { stream: GeoStream }): void; + /** + * Indicates a point with the specified coordinates x and y (and optionally z). The coordinate system is unspecified and implementation-dependent; + * for example, projection streams require spherical coordinates in degrees as input. Outside the context of a polygon or line, + * a point indicates a point geometry object (Point or MultiPoint). Within a line or polygon ring, the point indicates a control point. + * + * @param x x-coordinate of point. + * @param y y-coordinate of point. + * @param z Optional z-coordinate of point. + */ point?(this: this & { stream: GeoStream }, x: number, y: number, z?: number): void; + /** + * Indicates the end of a polygon. + */ polygonEnd?(this: this & { stream: GeoStream }): void; + /** + * Indicates the start of a polygon. The first line of a polygon indicates the exterior ring, and any subsequent lines indicate interior holes. + */ polygonStart?(this: this & { stream: GeoStream }): void; + /** + * Indicates the sphere (the globe; the unit sphere centered at ⟨0,0,0⟩). + */ sphere?(this: this & { stream: GeoStream }): void; } + // TODO: Review whether GeoStreamWrapper should be included into return value union type, i.e. ({ stream: (s: GeoStream) => (T & GeoStream & GeoStreamWrapper)})? // It probably should be omitted for purposes of this API. The stream method added to (T & GeoStream) is more of a private member used internally to // implement the Transform factory -export function geoTransform(prototype: T): { stream: (s: GeoStream) => (T & GeoStream) }; -// geoStream(...) ======================================================= +/** + * Defines an arbitrary transform using the methods defined on the specified methods object. + * Any undefined methods will use pass-through methods that propagate inputs to the output stream. + * + * @param methods An object with custom method implementations, which are used to create a transform projection. + */ +export function geoTransform(methods: T): { stream: (s: GeoStream) => (T & GeoStream) }; -export function geoStream(object: ExtendedFeature, stream: GeoStream): void; -export function geoStream(object: ExtendedFeatureCollection>, stream: GeoStream): void; -export function geoStream(object: GeoGeometryObjects, stream: GeoStream): void; -export function geoStream(object: ExtendedGeometryCollection, stream: GeoStream): void; +// geoIdentity() ================================================================= + +/** + * Geo Identity Transform + */ +export interface GeoIdentityTranform extends GeoStreamWrapper { + + /** + * Returns the current viewport clip extent which defaults to null. + */ + clipExtent(): [[number, number], [number, number]] | null; + /** + * Sets the clip extent to null and returns the projection. + * With a clip extent of null, no viewport clipping is performed. + * + * Viewport clipping is independent of small-circle clipping via projection.clipAngle. + * + * @param extent Set to null to disable viewport clipping. + */ + clipExtent(extent: null): this; + /** + * Sets the projection’s viewport clip extent to the specified bounds in pixels and returns the projection. + * The extent bounds are specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left-side of the viewport, y₀ is the top, x₁ is the right and y₁ is the bottom. + * + * Viewport clipping is independent of small-circle clipping via projection.clipAngle. + * + * @param extent The extent bounds are specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left-side of the viewport, y₀ is the top, x₁ is the right and y₁ is the bottom. + */ + clipExtent(extent: [[number, number], [number, number]]): this; + + /** + * Sets the projection’s scale and translate to fit the specified geographic feature in the center of the given extent. + * Returns the projection. + * + * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150. + * + * @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom. + * @param object A geographic feature supported by d3-geo (An extension of GeoJSON feature). + */ + fitExtent(extent: [[number, number], [number, number]], object: ExtendedFeature): this; + /** + * Sets the projection’s scale and translate to fit the specified geographic feature collection in the center of the given extent. + * Returns the projection. + * + * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150. + * + * @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom. + * @param object A geographic feature collection supported by d3-geo (An extension of GeoJSON feature collection). + */ + fitExtent(extent: [[number, number], [number, number]], object: ExtendedFeatureCollection>): this; + /** + * Sets the projection’s scale and translate to fit the specified geographic geometry object in the center of the given extent. + * Returns the projection. + * + * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150. + * + * @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom. + * @param object A GeoJson Geometry Object or GeoSphere object supported by d3-geo (An extension of GeoJSON). + */ + fitExtent(extent: [[number, number], [number, number]], object: GeoGeometryObjects): this; + /** + * Sets the projection’s scale and translate to fit the specified geographic geometry collection in the center of the given extent. + * Returns the projection. + * + * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150. + * + * @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom. + * @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection). + */ + fitExtent(extent: [[number, number], [number, number]], object: ExtendedGeometryCollection): this; + + + /** + * Sets the projection’s scale and translate to fit the specified geographic feature in the center of an extent with the given size and top-left corner of [0, 0]. + * Returns the projection. + * + * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150. + * + * @param size The size of the extent, specified as an array [width, height]. + * @param object A geographic feature supported by d3-geo (An extension of GeoJSON feature). + */ + fitSize(size: [number, number], object: ExtendedFeature): this; + /** + * Sets the projection’s scale and translate to fit the specified geographic feature collection in the center of an extent with the given size and top-left corner of [0, 0]. + * Returns the projection. + * + * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150. + * + * @param size The size of the extent, specified as an array [width, height]. + * @param object A geographic feature collection supported by d3-geo (An extension of GeoJSON feature collection). + */ + fitSize(size: [number, number], object: ExtendedFeatureCollection>): this; + /** + * Sets the projection’s scale and translate to fit the specified geographic geometry object in the center of an extent with the given size and top-left corner of [0, 0]. + * Returns the projection. + * + * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150. + * + * @param size The size of the extent, specified as an array [width, height]. + * @param object A GeoJson Geometry Object or GeoSphere object supported by d3-geo (An extension of GeoJSON). + */ + fitSize(size: [number, number], object: GeoGeometryObjects): this; + /** + * Sets the projection’s scale and translate to fit the specified geographic geometry collection in the center of an extent with the given size and top-left corner of [0, 0]. + * Returns the projection. + * + * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150. + * + * @param size The size of the extent, specified as an array [width, height]. + * @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection). + */ + fitSize(size: [number, number], object: ExtendedGeometryCollection): this; + + + /** + * Returns the current scale factor. + * + * The scale factor corresponds linearly to the distance between projected points; however, absolute scale factors are not equivalent across projections. + */ + scale(): number; + /** + * Sets the projection’s scale factor to the specified value and returns the projection. + * The scale factor corresponds linearly to the distance between projected points; however, absolute scale factors are not equivalent across projections. + * + * @param scale Scale factor to be used for the projection. + */ + scale(scale: number): this; + + /** + * Returns the current translation offset. + * The translation offset determines the pixel coordinates of the projection’s center. + */ + translate(): [number, number]; + /** + * Sets the projection’s translation offset to the specified two-element array [tx, ty] and returns the projection. + * The translation offset determines the pixel coordinates of the projection’s center. + * + * @param point A two-element array [tx, ty] specifying the translation offset. + */ + translate(point: [number, number]): this; +} + +/** + * Returns the identity transform which can be used to scale, translate and clip planar geometry. + */ +export function geoIdentity(): GeoIdentityTranform; From ad11ed23f2c2b4b0b0ef947120e336eca93aa176 Mon Sep 17 00:00:00 2001 From: "Scott(JuJiang)" Date: Tue, 8 Nov 2016 00:29:51 +0800 Subject: [PATCH 156/246] Types/webpack sources (#12484) * feat: add definition for webpack-sources * fix: enable strictNullChecks --- webpack-sources/index.d.ts | 198 +++++++++++++++++++++++ webpack-sources/tsconfig.json | 19 +++ webpack-sources/webpack-sources-tests.ts | 26 +++ 3 files changed, 243 insertions(+) create mode 100644 webpack-sources/index.d.ts create mode 100644 webpack-sources/tsconfig.json create mode 100644 webpack-sources/webpack-sources-tests.ts diff --git a/webpack-sources/index.d.ts b/webpack-sources/index.d.ts new file mode 100644 index 0000000000..c87a29d464 --- /dev/null +++ b/webpack-sources/index.d.ts @@ -0,0 +1,198 @@ +// Type definitions for webpack-sources v0.1.2 +// Project: https://github.com/webpack/webpack-sources +// Definitions by: e-cloud +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// + +import { SourceNode } from 'source-map' +import { SourceListMap } from 'source-list-map' + +export abstract class Source { + size(): number; + + map(options?: any): any; + + sourceAndMap(options?: any): { + source: string; + map: string; + }; + + updateHash(hash: any): void; + + source(options?: any): string; + + node(options?: any): any; + + listNode(options?: any): any; + + listMap(options?: any): any; +} + +interface SourceAndMapMixin { + map(options: { columns?: boolean }): string + sourceAndMap(options: { columns?: boolean }): { + source: string, + map: string + } +} + +export class CachedSource { + _source: Source; + _cachedSource: string; + _cachedSize: number; + _cachedMaps: any; + node: (options: any) => any; + listMap: (options: any) => any; + + constructor(source: Source); + + source(): string; + + size(): number; + + sourceAndMap(options: any): { + source: string; + map: any; + }; + + map(options: any): any; + + updateHash(hash: any): void; +} + +export class ConcatSource extends Source implements SourceAndMapMixin { + children: (string | Source)[]; + + constructor(...args: (string | Source)[]); + + add(item: string | Source): void; + + source(): string; + + size(): number; + + node(options: any): SourceNode; + + listMap(options: any): SourceListMap; + + updateHash(hash: any): void; +} + +export class LineToLineMappedSource extends Source implements SourceAndMapMixin { + _value: string; + _name: string; + _originalSource: string; + + constructor(value: string, name: string, originalSource: string); + + source(): string; + + node(options: any): SourceNode; + + listMap(options: any): SourceListMap; + + updateHash(hash: any): void; +} + +export class OriginalSource extends Source implements SourceAndMapMixin { + _value: string; + _name: string; + + constructor(value: string, name: string); + + source(): string; + + node( + options?: { + columns?: boolean; + } + ): SourceNode; + + listMap(options: any): SourceListMap; + + updateHash(hash: any): void; +} + +export class PrefixSource extends Source implements SourceAndMapMixin { + _source: Source | string; + _prefix: Source | string; + + constructor(prefix: Source | string, source: Source | string); + + source(): string; + + node(options: any): SourceNode; + + listMap(options: any): any; + + updateHash(hash: any): void; +} + +export class RawSource extends Source { + _value: string; + + constructor(value: string); + + source(): string; + + map(options: any): any; + + node(options: any): SourceNode; + + listMap(options: any): SourceListMap; + + updateHash(hash: any): void; +} + +export class ReplaceSource extends Source implements SourceAndMapMixin { + _source: Source; + _name: string; + replacements: any[][]; + + constructor(source: Source, name: string); + + replace(start: number, end: number, newValue: string): void; + + insert(pos: number, newValue: string): void; + + source(): string; + + _sortReplacements(): void; + + _replaceString(str: string): string; + + node(options: any): SourceNode; + + listMap(options: any): any; + + _replacementToSourceNode(oldNode: SourceNode, newString: string): string | SourceNode; + + _splitSourceNode(node: SourceNode, position: SourceNode[]): SourceNode[]; + _splitSourceNode(node: string, position: number): number; + + _splitString(str: string, position: number): string[]; +} + +export class SourceMapSource extends Source implements SourceAndMapMixin { + _value: string; + _name: string; + _sourceMap: any; + _originalSource: Source; + _innerSourceMap: any; + + constructor(value: string, name: string, sourceMap: any, originalSource: Source, innerSourceMap?: any); + + source(): string; + + node(): SourceNode; + + listMap( + options: { + module?: boolean; + } + ): SourceListMap; + + updateHash(hash: any): void; +} diff --git a/webpack-sources/tsconfig.json b/webpack-sources/tsconfig.json new file mode 100644 index 0000000000..cfffc3587a --- /dev/null +++ b/webpack-sources/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "webpack-sources-tests.ts" + ] +} diff --git a/webpack-sources/webpack-sources-tests.ts b/webpack-sources/webpack-sources-tests.ts new file mode 100644 index 0000000000..4c4dc6afab --- /dev/null +++ b/webpack-sources/webpack-sources-tests.ts @@ -0,0 +1,26 @@ +/// + +import { + CachedSource, + ConcatSource, + RawSource, + LineToLineMappedSource, + PrefixSource, + ReplaceSource, + OriginalSource, + SourceMapSource, + +} from 'webpack-sources'; + +const s1 = new OriginalSource('a', 'b'); + +const s2 = new CachedSource(s1); + +const s3 = new ConcatSource('a', 'b', s1); + +const s4 = new RawSource('hey'); + +const s5 = new LineToLineMappedSource('a', 'v', 'c'); +const s6 = new PrefixSource(s4, s5); +const s7 = new ReplaceSource(s3, 'ha'); +const s8 = new SourceMapSource('va', 'vb', 'vc', s6, 'good'); From ba5d738c52510da3b8c776f8239ff4803e3348ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Fantone?= Date: Mon, 7 Nov 2016 16:45:08 +0000 Subject: [PATCH 157/246] Update amqplib definitions to v0.5.0 (#12427) * Update amqplib definitions to v0.5.0 * Remove unused import * Restore previous 0.3.x amqplib definitions --- amqplib/amqplib-0.3.d.ts | 219 +++++++++++++++++++++++++++++++++++++++ amqplib/amqplib-tests.ts | 42 ++++---- amqplib/index.d.ts | 161 ++++++++++++++-------------- 3 files changed, 323 insertions(+), 99 deletions(-) create mode 100644 amqplib/amqplib-0.3.d.ts diff --git a/amqplib/amqplib-0.3.d.ts b/amqplib/amqplib-0.3.d.ts new file mode 100644 index 0000000000..3138f7494e --- /dev/null +++ b/amqplib/amqplib-0.3.d.ts @@ -0,0 +1,219 @@ +// Type definitions for amqplib 0.3.x +// Project: https://github.com/squaremo/amqp.node +// Definitions by: Michael Nahkies , Ab Reitsma +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// + +declare module "amqplib/properties" { + namespace Replies { + interface Empty { + } + interface AssertQueue { + queue: string; + messageCount: number; + consumerCount: number; + } + interface PurgeQueue { + messageCount: number; + } + interface DeleteQueue { + messageCount: number; + } + interface AssertExchange { + exchange: string; + } + interface Consume { + consumerTag: string; + } + } + + namespace Options { + interface AssertQueue { + exclusive?: boolean; + durable?: boolean; + autoDelete?: boolean; + arguments?: any; + messageTtl?: number; + expires?: number; + deadLetterExchange?: string; + deadLetterRoutingKey?: string; + maxLength?: number; + } + interface DeleteQueue { + ifUnused?: boolean; + ifEmpty?: boolean; + } + interface AssertExchange { + durable?: boolean; + internal?: boolean; + autoDelete?: boolean; + alternateExchange?: string; + arguments?: any; + } + interface DeleteExchange { + ifUnused?: boolean; + } + interface Publish { + expiration?: string; + userId?: string; + CC?: string | string[]; + + mandatory?: boolean; + persistent?: boolean; + deliveryMode?: boolean | number; + BCC?: string | string[]; + + contentType?: string; + contentEncoding?: string; + headers?: any; + priority?: number; + correlationId?: string; + replyTo?: string; + messageId?: string; + timestamp?: number; + type?: string; + appId?: string; + } + interface Consume { + consumerTag?: string; + noLocal?: boolean; + noAck?: boolean; + exclusive?: boolean; + priority?: number; + arguments?: any; + } + interface Get { + noAck?: boolean; + } + } + + interface Message { + content: Buffer; + fields: any; + properties: any; + } +} + +declare module "amqplib" { + + import events = require("events"); + import when = require("when"); + import shared = require("amqplib/properties") + export import Replies = shared.Replies; + export import Options = shared.Options; + export import Message = shared.Message; + + interface Connection extends events.EventEmitter { + close(): when.Promise; + createChannel(): when.Promise; + createConfirmChannel(): when.Promise; + } + + interface Channel extends events.EventEmitter { + close(): when.Promise; + + assertQueue(queue: string, options?: Options.AssertQueue): when.Promise; + checkQueue(queue: string): when.Promise; + + deleteQueue(queue: string, options?: Options.DeleteQueue): when.Promise; + purgeQueue(queue: string): when.Promise; + + bindQueue(queue: string, source: string, pattern: string, args?: any): when.Promise; + unbindQueue(queue: string, source: string, pattern: string, args?: any): when.Promise; + + assertExchange(exchange: string, type: string, options?: Options.AssertExchange): when.Promise; + checkExchange(exchange: string): when.Promise; + + deleteExchange(exchange: string, options?: Options.DeleteExchange): when.Promise; + + bindExchange(destination: string, source: string, pattern: string, args?: any): when.Promise; + unbindExchange(destination: string, source: string, pattern: string, args?: any): when.Promise; + + publish(exchange: string, routingKey: string, content: Buffer, options?: Options.Publish): boolean; + sendToQueue(queue: string, content: Buffer, options?: Options.Publish): boolean; + + consume(queue: string, onMessage: (msg: Message) => any, options?: Options.Consume): when.Promise; + + cancel(consumerTag: string): when.Promise; + get(queue: string, options?: Options.Get): when.Promise; + + ack(message: Message, allUpTo?: boolean): void; + ackAll(): void; + + nack(message: Message, allUpTo?: boolean, requeue?: boolean): void; + nackAll(requeue?: boolean): void; + reject(message: Message, requeue?: boolean): void; + + prefetch(count: number, global?: boolean): when.Promise; + recover(): when.Promise; + } + + function connect(url: string, socketOptions?: any): when.Promise; +} + +declare module "amqplib/callback_api" { + + import events = require("events"); + import shared = require("amqplib/properties") + export import Replies = shared.Replies; + export import Options = shared.Options; + export import Message = shared.Message; + + interface Connection extends events.EventEmitter { + close(callback?: (err: any) => void): void; + createChannel(callback: (err: any, channel: Channel) => void): void; + createConfirmChannel(callback: (err: any, confirmChannel: ConfirmChannel) => void): void; + } + + interface Channel extends events.EventEmitter { + close(callback: (err: any) => void): void; + + assertQueue(queue?: string, options?: Options.AssertQueue, callback?: (err:any, ok: Replies.AssertQueue) => void): void; + checkQueue(queue: string, callback?: (err: any, ok: Replies.AssertQueue) => void): void; + + deleteQueue(queue: string, options?: Options.DeleteQueue, callback?: (err:any, ok: Replies.DeleteQueue) => void): void; + purgeQueue(queue: string, callback?: (err:any, ok: Replies.PurgeQueue) => void): void; + + bindQueue(queue: string, source: string, pattern: string, args?: any, callback?: (err: any, ok: Replies.Empty) => void): void; + unbindQueue(queue: string, source: string, pattern: string, args?: any, callback?: (err: any, ok: Replies.Empty) => void): void; + + assertExchange(exchange: string, type: string, options?: Options.AssertExchange, callback?: (err: any, ok: Replies.AssertExchange) => void): void; + checkExchange(exchange: string, callback?: (err: any, ok: Replies.Empty) => void): void; + + deleteExchange(exchange: string, options?: Options.DeleteExchange, callback?: (err: any, ok: Replies.Empty) => void): void; + + bindExchange(destination: string, source: string, pattern: string, args?: any, callback?: (err: any, ok: Replies.Empty) => void): void; + unbindExchange(destination: string, source: string, pattern: string, args?: any, callback?: (err: any, ok: Replies.Empty) => void): void; + + publish(exchange: string, routingKey: string, content: Buffer, options?: Options.Publish): boolean; + sendToQueue(queue: string, content: Buffer, options?: Options.Publish): boolean; + + consume(queue: string, onMessage: (msg: Message) => any, options?: Options.Consume, callback?: (err: any, ok: Replies.Consume) => void): void; + + cancel(consumerTag: string, callback?: (err: any, ok: Replies.Empty) => void): void; + get(queue: string, options?: Options.Get, callback?: (err: any, ok: Message | boolean) => void): void; + + ack(message: Message, allUpTo?: boolean): void; + ackAll(): void; + + nack(message: Message, allUpTo?: boolean, requeue?: boolean): void; + nackAll(requeue?: boolean): void; + reject(message: Message, requeue?: boolean): void; + + prefetch(count: number, global?: boolean): void; + recover(callback?: (err: any, ok: Replies.Empty) => void): void; + } + + interface ConfirmChannel extends Channel { + publish(exchange: string, routingKey: string, content: Buffer, options?: Options.Publish, callback?: (err: any, ok: Replies.Empty) => void): boolean; + sendToQueue(queue: string, content: Buffer, options?: Options.Publish, callback?: (err: any, ok: Replies.Empty) => void): boolean; + + waitForConfirms(callback?: (err: any) => void): void; + } + + function connect(callback: (err: any, connection: Connection) => void): void; + function connect(url: string, callback: (err: any, connection: Connection) => void): void; + function connect(url: string, socketOptions: any, callback: (err: any, connection: Connection) => void): void; +} diff --git a/amqplib/amqplib-tests.ts b/amqplib/amqplib-tests.ts index 07b9ec5402..b17128653a 100644 --- a/amqplib/amqplib-tests.ts +++ b/amqplib/amqplib-tests.ts @@ -1,44 +1,42 @@ - - // promise api tests -import amqp = require("amqplib"); +import amqp = require('amqplib'); -var msg = "Hello World"; +var msg = 'Hello World'; // test promise api -amqp.connect("amqp://localhost") +amqp.connect('amqp://localhost') .then(connection => { return connection.createChannel() - .tap(channel => channel.checkQueue("myQueue")) - .then(channel => channel.sendToQueue("myQueue", new Buffer(msg))) - .ensure(() => connection.close()); + .tap(channel => channel.checkQueue('myQueue')) + .then(channel => channel.sendToQueue('myQueue', new Buffer(msg))) + .finally(() => connection.close()); }); -amqp.connect("amqp://localhost") +amqp.connect('amqp://localhost') .then(connection => { return connection.createChannel() - .tap(channel => channel.checkQueue("myQueue")) - .then(channel => channel.consume("myQueue", newMsg => console.log("New Message: " + newMsg.content.toString()))) - .ensure(() => connection.close()); + .tap(channel => channel.checkQueue('myQueue')) + .then(channel => channel.consume('myQueue', newMsg => console.log('New Message: ' + newMsg.content.toString()))) + .finally(() => connection.close()); }); // test promise api properties var amqpMessage: amqp.Message; -amqpMessage.properties.contentType = "application/json"; +amqpMessage.properties.contentType = 'application/json'; var amqpAssertExchangeOptions: amqp.Options.AssertExchange; var anqpAssertExchangeReplies: amqp.Replies.AssertExchange; // callback api tests -import amqpcb = require("amqplib/callback_api"); +import amqpcb = require('amqplib/callback_api'); -amqpcb.connect("amqp://localhost", (err, connection) => { +amqpcb.connect('amqp://localhost', (err, connection) => { if(!err) { connection.createChannel((err, channel) => { if (!err) { - channel.assertQueue("myQueue", {}, (err, ok) => { + channel.assertQueue('myQueue', {}, (err, ok) => { if(!err) { - channel.sendToQueue("myQueue", new Buffer(msg)); + channel.sendToQueue('myQueue', new Buffer(msg)); } }); } @@ -46,13 +44,13 @@ amqpcb.connect("amqp://localhost", (err, connection) => { } }); -amqpcb.connect("amqp://localhost", (err, connection) => { +amqpcb.connect('amqp://localhost', (err, connection) => { if(!err) { connection.createChannel((err, channel) => { if (!err) { - channel.assertQueue("myQueue", {}, (err, ok) => { + channel.assertQueue('myQueue', {}, (err, ok) => { if(!err) { - channel.consume("myQueue", newMsg => console.log("New Message: " + newMsg.content.toString())); + channel.consume('myQueue', newMsg => console.log('New Message: ' + newMsg.content.toString())); } }); } @@ -62,6 +60,6 @@ amqpcb.connect("amqp://localhost", (err, connection) => { // test callback api properties var amqpcbMessage: amqpcb.Message; -amqpcbMessage.properties.contentType = "application/json"; +amqpcbMessage.properties.contentType = 'application/json'; var amqpcbAssertExchangeOptions: amqpcb.Options.AssertExchange; -var anqpcbAssertExchangeReplies: amqpcb.Replies.AssertExchange; \ No newline at end of file +var anqpcbAssertExchangeReplies: amqpcb.Replies.AssertExchange; diff --git a/amqplib/index.d.ts b/amqplib/index.d.ts index 3138f7494e..b406e00ac0 100644 --- a/amqplib/index.d.ts +++ b/amqplib/index.d.ts @@ -1,13 +1,76 @@ -// Type definitions for amqplib 0.3.x +// Type definitions for amqplib 0.5.x // Project: https://github.com/squaremo/amqp.node -// Definitions by: Michael Nahkies , Ab Reitsma +// Definitions by: Michael Nahkies , Ab Reitsma , Nicolás Fantone // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// /// -declare module "amqplib/properties" { - namespace Replies { +declare module 'amqplib' { + import * as Promise from 'bluebird'; + import * as events from 'events'; + import shared = require('amqplib/properties'); + + export import Replies = shared.Replies; + export import Options = shared.Options; + export import Message = shared.Message; + + export interface Connection extends events.EventEmitter { + close(): Promise; + createChannel(): Promise; + createConfirmChannel(): Promise; + } + + export interface Channel extends events.EventEmitter { + close(): Promise; + + assertQueue(queue: string, options?: Options.AssertQueue): Promise; + checkQueue(queue: string): Promise; + + deleteQueue(queue: string, options?: Options.DeleteQueue): Promise; + purgeQueue(queue: string): Promise; + + bindQueue(queue: string, source: string, pattern: string, args?: any): Promise; + unbindQueue(queue: string, source: string, pattern: string, args?: any): Promise; + + assertExchange(exchange: string, type: string, options?: Options.AssertExchange): Promise; + checkExchange(exchange: string): Promise; + + deleteExchange(exchange: string, options?: Options.DeleteExchange): Promise; + + bindExchange(destination: string, source: string, pattern: string, args?: any): Promise; + unbindExchange(destination: string, source: string, pattern: string, args?: any): Promise; + + publish(exchange: string, routingKey: string, content: Buffer, options?: Options.Publish): boolean; + sendToQueue(queue: string, content: Buffer, options?: Options.Publish): boolean; + + consume(queue: string, onMessage: (msg: Message) => any, options?: Options.Consume): Promise; + + cancel(consumerTag: string): Promise; + get(queue: string, options?: Options.Get): Promise; + + ack(message: Message, allUpTo?: boolean): void; + ackAll(): void; + + nack(message: Message, allUpTo?: boolean, requeue?: boolean): void; + nackAll(requeue?: boolean): void; + reject(message: Message, requeue?: boolean): void; + + prefetch(count: number, global?: boolean): Promise; + recover(): Promise; + } + + export interface ConfirmChannel extends Channel { + publish(exchange:string, routingKey:string, content:Buffer, options?:Options.Publish, callback?:(err:any, ok:Replies.Empty) => void):boolean; + sendToQueue(queue:string, content:Buffer, options?:Options.Publish, callback?:(err:any, ok:Replies.Empty) => void):boolean; + + waitForConfirms(): Promise; + } + + export function connect(url: string, socketOptions?: any): Promise; +} + +declare module 'amqplib/properties' { + export namespace Replies { interface Empty { } interface AssertQueue { @@ -29,7 +92,7 @@ declare module "amqplib/properties" { } } - namespace Options { + export namespace Options { interface AssertQueue { exclusive?: boolean; durable?: boolean; @@ -40,6 +103,7 @@ declare module "amqplib/properties" { deadLetterExchange?: string; deadLetterRoutingKey?: string; maxLength?: number; + maxPriority?: number; } interface DeleteQueue { ifUnused?: boolean; @@ -56,7 +120,7 @@ declare module "amqplib/properties" { ifUnused?: boolean; } interface Publish { - expiration?: string; + expiration?: string | number; userId?: string; CC?: string | string[]; @@ -89,92 +153,35 @@ declare module "amqplib/properties" { } } - interface Message { + export interface Message { content: Buffer; fields: any; properties: any; } } -declare module "amqplib" { +declare module 'amqplib/callback_api' { + import events = require('events'); + import shared = require('amqplib/properties') - import events = require("events"); - import when = require("when"); - import shared = require("amqplib/properties") export import Replies = shared.Replies; export import Options = shared.Options; export import Message = shared.Message; - interface Connection extends events.EventEmitter { - close(): when.Promise; - createChannel(): when.Promise; - createConfirmChannel(): when.Promise; - } - - interface Channel extends events.EventEmitter { - close(): when.Promise; - - assertQueue(queue: string, options?: Options.AssertQueue): when.Promise; - checkQueue(queue: string): when.Promise; - - deleteQueue(queue: string, options?: Options.DeleteQueue): when.Promise; - purgeQueue(queue: string): when.Promise; - - bindQueue(queue: string, source: string, pattern: string, args?: any): when.Promise; - unbindQueue(queue: string, source: string, pattern: string, args?: any): when.Promise; - - assertExchange(exchange: string, type: string, options?: Options.AssertExchange): when.Promise; - checkExchange(exchange: string): when.Promise; - - deleteExchange(exchange: string, options?: Options.DeleteExchange): when.Promise; - - bindExchange(destination: string, source: string, pattern: string, args?: any): when.Promise; - unbindExchange(destination: string, source: string, pattern: string, args?: any): when.Promise; - - publish(exchange: string, routingKey: string, content: Buffer, options?: Options.Publish): boolean; - sendToQueue(queue: string, content: Buffer, options?: Options.Publish): boolean; - - consume(queue: string, onMessage: (msg: Message) => any, options?: Options.Consume): when.Promise; - - cancel(consumerTag: string): when.Promise; - get(queue: string, options?: Options.Get): when.Promise; - - ack(message: Message, allUpTo?: boolean): void; - ackAll(): void; - - nack(message: Message, allUpTo?: boolean, requeue?: boolean): void; - nackAll(requeue?: boolean): void; - reject(message: Message, requeue?: boolean): void; - - prefetch(count: number, global?: boolean): when.Promise; - recover(): when.Promise; - } - - function connect(url: string, socketOptions?: any): when.Promise; -} - -declare module "amqplib/callback_api" { - - import events = require("events"); - import shared = require("amqplib/properties") - export import Replies = shared.Replies; - export import Options = shared.Options; - export import Message = shared.Message; - - interface Connection extends events.EventEmitter { + export interface Connection extends events.EventEmitter { close(callback?: (err: any) => void): void; createChannel(callback: (err: any, channel: Channel) => void): void; createConfirmChannel(callback: (err: any, confirmChannel: ConfirmChannel) => void): void; } - interface Channel extends events.EventEmitter { + export interface Channel extends events.EventEmitter { close(callback: (err: any) => void): void; - assertQueue(queue?: string, options?: Options.AssertQueue, callback?: (err:any, ok: Replies.AssertQueue) => void): void; + assertQueue(queue?: string, options?: Options.AssertQueue, callback?: (err: any, ok: Replies.AssertQueue) => void): void; checkQueue(queue: string, callback?: (err: any, ok: Replies.AssertQueue) => void): void; - deleteQueue(queue: string, options?: Options.DeleteQueue, callback?: (err:any, ok: Replies.DeleteQueue) => void): void; - purgeQueue(queue: string, callback?: (err:any, ok: Replies.PurgeQueue) => void): void; + deleteQueue(queue: string, options?: Options.DeleteQueue, callback?: (err: any, ok: Replies.DeleteQueue) => void): void; + purgeQueue(queue: string, callback?: (err: any, ok: Replies.PurgeQueue) => void): void; bindQueue(queue: string, source: string, pattern: string, args?: any, callback?: (err: any, ok: Replies.Empty) => void): void; unbindQueue(queue: string, source: string, pattern: string, args?: any, callback?: (err: any, ok: Replies.Empty) => void): void; @@ -206,14 +213,14 @@ declare module "amqplib/callback_api" { recover(callback?: (err: any, ok: Replies.Empty) => void): void; } - interface ConfirmChannel extends Channel { + export interface ConfirmChannel extends Channel { publish(exchange: string, routingKey: string, content: Buffer, options?: Options.Publish, callback?: (err: any, ok: Replies.Empty) => void): boolean; sendToQueue(queue: string, content: Buffer, options?: Options.Publish, callback?: (err: any, ok: Replies.Empty) => void): boolean; waitForConfirms(callback?: (err: any) => void): void; } - function connect(callback: (err: any, connection: Connection) => void): void; - function connect(url: string, callback: (err: any, connection: Connection) => void): void; - function connect(url: string, socketOptions: any, callback: (err: any, connection: Connection) => void): void; + export function connect(callback: (err: any, connection: Connection) => void): void; + export function connect(url: string, callback: (err: any, connection: Connection) => void): void; + export function connect(url: string, socketOptions: any, callback: (err: any, connection: Connection) => void): void; } From 28b5b2683ccb98d3bc398a1bc548a270fc39b1de Mon Sep 17 00:00:00 2001 From: goleon Date: Mon, 7 Nov 2016 21:29:11 +0400 Subject: [PATCH 158/246] leaflet.d.ts: split signature DomUtil#get to 2 overloaded --- leaflet/leaflet.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/leaflet/leaflet.d.ts b/leaflet/leaflet.d.ts index f9fb91d4c9..ee2483b752 100644 --- a/leaflet/leaflet.d.ts +++ b/leaflet/leaflet.d.ts @@ -16,7 +16,8 @@ declare namespace L { } export class DomUtil { - static get(id: string|HTMLElement): HTMLElement; + static get(id: string): HTMLElement; + static get(id: HTMLElement): HTMLElement; static getStyle(el: HTMLElement, styleAttrib: string): string; static create(tagName: String, className?: String, container?: HTMLElement): HTMLElement; static remove(el: HTMLElement):void; From 44f2662e49cb2109e58744bde31f6d7df740d038 Mon Sep 17 00:00:00 2001 From: Georgii Dolzhykov Date: Mon, 7 Nov 2016 20:43:45 +0200 Subject: [PATCH 159/246] Remove the typings for Protractor as it provides its own typings (#12482) --- notNeededPackages.json | 6 + protractor/angular-protractor-tests.ts | 483 ----- protractor/index.d.ts | 1849 ----------------- protractor/package.json | 5 - protractor/tsconfig.json | 16 - selenium-webdriver/index.d.ts | 3 +- .../selenium-webdriver-tests.ts | 18 +- 7 files changed, 17 insertions(+), 2363 deletions(-) delete mode 100644 protractor/angular-protractor-tests.ts delete mode 100644 protractor/index.d.ts delete mode 100644 protractor/package.json delete mode 100644 protractor/tsconfig.json diff --git a/notNeededPackages.json b/notNeededPackages.json index de0866ffd3..0f32a6dcad 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -28,6 +28,12 @@ "typingsPackageName": "linq", "sourceRepoURL": "https://linqjs.codeplex.com/", "asOfVersion": "2.2.33" + }, + { + "libraryName": "Protractor", + "typingsPackageName": "protractor", + "sourceRepoURL": "https://github.com/angular/protractor", + "asOfVersion": "4.0.0" } ] } diff --git a/protractor/angular-protractor-tests.ts b/protractor/angular-protractor-tests.ts deleted file mode 100644 index 0a7ae85357..0000000000 --- a/protractor/angular-protractor-tests.ts +++ /dev/null @@ -1,483 +0,0 @@ - - -function TestWebDriverExports() { - var button: number = protractor.Button.LEFT; - - var key: string = protractor.Key.ADD; - var chord: string = protractor.Key.chord(protractor.Key.NUMPAD0, protractor.Key.NUMPAD1); - - var driver: protractor.WebDriver = new protractor.Builder(). - withCapabilities(protractor.Capabilities.chrome()). - build(); - var baseDriver: webdriver.WebDriver = driver; - - var action: protractor.ActionSequence = new protractor.ActionSequence(driver); - var baseAction: webdriver.ActionSequence = action; - - var browser: string = protractor.Browser.ANDROID; - - var builder: protractor.Builder = new protractor.Builder(); - var baseBuilder: webdriver.Builder = builder; - - var capability: string = protractor.Capability.BROWSER_NAME; - - var capabilities: protractor.Capabilities = protractor.Capabilities.chrome(); - var baseCapabilities: webdriver.Capabilities = capabilities; - - var commandName: string = protractor.CommandName.CLICK_ELEMENT; - - var command: protractor.Command = new protractor.Command(protractor.CommandName.CLICK); - var baseCommand: webdriver.Command = command; - - var eventEmitter: protractor.EventEmitter = new protractor.EventEmitter(); - var baseEventEmitter: webdriver.EventEmitter = eventEmitter; - - var webElement: protractor.WebElement = new protractor.WebElement(driver, new protractor.promise.Promise()); - var baseWebElement: webdriver.WebElement = webElement; - - var locator: webdriver.Locator = by.id('abc'); - - var session: protractor.Session = new protractor.Session('ABC', webdriver.Capabilities.android()); - var baseSession: webdriver.Session = session; - - locator = protractor.By.name('name'); - - var driver: protractor.WebDriver = new protractor.WebDriver(session, {}); - driver = new protractor.WebDriver(session, {}, new webdriver.promise.ControlFlow()); - var baseDriver: webdriver.WebDriver = driver; - - var webElement: protractor.WebElement = new protractor.WebElement(driver, { ELEMENT: 'abc' }); - var baseWebElement: webdriver.WebElement = webElement; - - var webElementPromise: protractor.WebElementPromise = new protractor.WebElementPromise(driver, { ELEMENT: 'abc' }); - var baseWebElementPromise: webdriver.WebElementPromise = webElementPromise; -} - -function TestWebDriverErrorModule() { - var errorCode: number = protractor.error.ErrorCode.ELEMENT_NOT_VISIBLE; - var error: protractor.error.Error = new protractor.error.Error(protractor.error.ErrorCode.ELEMENT_NOT_VISIBLE); - var baseError: webdriver.error.Error = error; -} - -function TestWebDriverLoggingModule() { - var levelName: string = protractor.logging.Level.ALL.name; - var loggingType: string = protractor.logging.Type.CLIENT; - - var level: webdriver.logging.ILevel = protractor.logging.Level.ALL; - - var entry: protractor.logging.Entry = new protractor.logging.Entry(protractor.logging.Level.ALL, 'Message'); - var baseEntry: webdriver.logging.Entry = entry; - - level = protractor.logging.getLevel('DEBUG'); - - var prefs: protractor.logging.Preferences = new protractor.logging.Preferences(); -} - -function TestWebDriverPromiseModule() { - var cancelError: protractor.promise.CancellationError = new protractor.promise.CancellationError(); - cancelError = new protractor.promise.CancellationError('message'); - var baseCancelError: webdriver.promise.CancellationError = cancelError; - - var thenable: protractor.promise.Thenable = new protractor.promise.Thenable(); - var baseThenable: webdriver.promise.Thenable = thenable; - - var promise: protractor.promise.Promise = new protractor.promise.Promise(); - var basePromise: webdriver.promise.Promise = promise; - - var deferred: protractor.promise.Deferred = new protractor.promise.Deferred(); - var baseDeferred: webdriver.promise.Deferred = deferred; - - var flow: protractor.promise.ControlFlow = new protractor.promise.ControlFlow(); - var baseFlow: webdriver.promise.ControlFlow = flow; - - var arrayPromise: protractor.promise.Promise = protractor.promise.all([new protractor.promise.Promise(), new protractor.promise.Promise()]); - - protractor.promise.asap(promise, function (value: any) { return true; }); - protractor.promise.asap(promise, function (value: any) { }, function (err: any) { return 'ABC'; }); - - promise = protractor.promise.checkedNodeCall(function (err: any, value: any) { return 123; }); - - promise = protractor.promise.consume(function () { - return 5; - }); - promise = protractor.promise.consume(function () { - return 5; - }, this); - promise = protractor.promise.consume(function () { - return 5; - }, this, 1, 2, 3); - - flow = protractor.promise.controlFlow(); - - promise = protractor.promise.createFlow(function (newFlow: webdriver.promise.ControlFlow) { }); - - deferred = protractor.promise.defer(); - - promise = protractor.promise.delayed(123); - - var numbersPromise: protractor.promise.Promise = protractor.promise.filter([1, 2, 3], function (el: number, index: number, arr: number[]) { - return true; - }); - numbersPromise = protractor.promise.filter([1, 2, 3], function (el: number, index: number, arr: number[]) { - return true; - }, this); - numbersPromise = protractor.promise.filter(numbersPromise, function (el: number, index: number, arr: number[]) { - return true; - }); - numbersPromise = protractor.promise.filter(numbersPromise, function (el: number, index: number, arr: number[]) { - return true; - }, this); - - numbersPromise = protractor.promise.map([1, 2, 3], function (el: number, index: number, arr: number[]) { - return true; - }); - numbersPromise = protractor.promise.map([1, 2, 3], function (el: number, index: number, arr: number[]) { - return true; - }, this); - numbersPromise = protractor.promise.map(numbersPromise, function (el: number, index: number, arr: number[]) { - return true; - }); - numbersPromise = protractor.promise.map(numbersPromise, function (el: number, index: number, arr: number[]) { - return true; - }, this); - - promise = protractor.promise.fulfilled(); - promise = protractor.promise.fulfilled({ a: 123 }); - - promise = protractor.promise.fullyResolved({ a: 123 }); - - var bool: boolean = protractor.promise.isGenerator(function () { }); - var bool: boolean = protractor.promise.isPromise('ABC'); - - promise = protractor.promise.rejected({ a: 123 }); - - protractor.promise.setDefaultFlow(new webdriver.promise.ControlFlow()); - - promise = protractor.promise.when(promise, function (value: any) { return 123; }, function (err: Error) { return 123; }); -} - -function TestWebDriverStacktraceModule() { - var bool: boolean = protractor.stacktrace.BROWSER_SUPPORTED; - - var frame: protractor.stacktrace.Frame = new protractor.stacktrace.Frame(); - var baseFrame: webdriver.stacktrace.Frame = frame; - - var snapshot: protractor.stacktrace.Snapshot = new protractor.stacktrace.Snapshot(); - var baseSnapshot: webdriver.stacktrace.Snapshot = snapshot; - - var err: Error = protractor.stacktrace.format(new Error("Error")); - var frames: protractor.stacktrace.Frame[] = protractor.stacktrace.get(); -} - -function TestWebDriverUntilModule() { - var conditionB: protractor.until.Condition = new protractor.until.Condition('message', function (driver: webdriver.WebDriver) { return true; }); - var conditionBBase: webdriver.until.Condition = conditionB; - var conditionWebElement: protractor.until.Condition; - var conditionWebElements: protractor.until.Condition; - - conditionB = protractor.until.ableToSwitchToFrame(5); - var conditionAlert: protractor.until.Condition = protractor.until.alertIsPresent(); - var el: protractor.ElementFinder = element(by.id('id')); - conditionB = protractor.until.elementIsDisabled(el); - conditionB = protractor.until.elementIsEnabled(el); - conditionB = protractor.until.elementIsNotSelected(el); - conditionB = protractor.until.elementIsNotVisible(el); - conditionB = protractor.until.elementIsSelected(el); - conditionB = protractor.until.elementIsVisible(el); - conditionB = protractor.until.elementTextContains(el, 'text'); - conditionB = protractor.until.elementTextIs(el, 'text'); - conditionB = protractor.until.elementTextMatches(el, /text/); - conditionB = protractor.until.stalenessOf(el); - conditionB = protractor.until.titleContains('text'); - conditionB = protractor.until.titleIs('text'); - conditionB = protractor.until.titleMatches(/text/); - - conditionWebElement = protractor.until.elementLocated(by.id('id')); - conditionWebElements = protractor.until.elementsLocated(by.className('class')); -} - -function TestWebDriverExpectedConditionsModule() { - var conditionB: protractor.until.Condition; - var el: protractor.ElementFinder = element(by.id('id')); - - conditionB = protractor.ExpectedConditions.alertIsPresent(); - conditionB = protractor.ExpectedConditions.elementToBeClickable(el); - conditionB = protractor.ExpectedConditions.textToBePresentInElement(el, 'text'); - conditionB = protractor.ExpectedConditions.textToBePresentInElementValue(el, 'text'); - conditionB = protractor.ExpectedConditions.titleContains('text'); - conditionB = protractor.ExpectedConditions.titleIs('text'); - conditionB = protractor.ExpectedConditions.presenceOf(el); - conditionB = protractor.ExpectedConditions.stalenessOf(el); - conditionB = protractor.ExpectedConditions.visibilityOf(el); - conditionB = protractor.ExpectedConditions.invisibilityOf(el); - conditionB = protractor.ExpectedConditions.elementToBeSelected(el); - - conditionB = protractor.ExpectedConditions.not(protractor.ExpectedConditions.alertIsPresent()); - conditionB = protractor.ExpectedConditions.and(protractor.ExpectedConditions.alertIsPresent(), protractor.ExpectedConditions.elementToBeClickable(el)); - conditionB = protractor.ExpectedConditions.or(protractor.ExpectedConditions.alertIsPresent(), protractor.ExpectedConditions.elementToBeClickable(el)); -} - -function TestProtractor() { - var ptor: protractor.Protractor; - var driver: webdriver.WebDriver = new webdriver.Builder(). - withCapabilities(webdriver.Capabilities.chrome()). - build(); - - ptor = protractor.wrapDriver(driver); - ptor = protractor.wrapDriver(driver, 'baseUrl'); - ptor = protractor.wrapDriver(driver, 'baseUrl', 'rootElement'); - - ptor = browser; - - var actions: protractor.ActionSequence = ptor.actions(); - - var promise: protractor.promise.Promise = ptor.call(function () { }); - var promise: protractor.promise.Promise = ptor.call(function () { }, this); - var promise: protractor.promise.Promise = ptor.call(function (a: number, b: number, c:number) { }, this, 1, 2,3); - - promise = ptor.executeAsyncScript('SomeScript'); - promise = ptor.executeAsyncScript('SomeScript', 1, 2, 3); - promise = ptor.executeAsyncScript(function () { }); - promise = ptor.executeAsyncScript(function (a: number, b: number, c: number) { }, 1, 2, 3); - - promise = ptor.executeScript('SomeScript'); - promise = ptor.executeScript('SomeScript', 1, 2, 3); - promise = ptor.executeScript(function () { }); - promise = ptor.executeScript(function (a: number, b: number, c: number) { }, 1, 2, 3); - - ptor = browser.forkNewDriverInstance(); - ptor = browser.forkNewDriverInstance(true); - ptor = browser.forkNewDriverInstance(true, false); - - driver = ptor.driver; - var baseUrl: string = ptor.baseUrl; - var rootEl: string = ptor.rootEl; - var ignoreSynchronization: boolean = ptor.ignoreSynchronization; - var params: any = ptor.params; - ptor.resetUrl = "url"; - - ptor.debugger(); - ptor.close(); - var controlFlow: protractor.promise.ControlFlow = ptor.controlFlow(); - - var webElement: protractor.WebElement = ptor.findElement(by.css('.class')); - ptor.findElements(by.css('.class')).then(function (elements: webdriver.WebElement[]) { }); - ptor.isElementPresent(by.css('.class')).then(function (present: boolean) { }); - ptor.isElementPresent(webElement).then(function (present: boolean) { }); - - ptor.clearMockModules(); - ptor.addMockModule('name', 'script'); - ptor.addMockModule('name', function() {}); - ptor.removeMockModule('name'); - ptor.waitForAngular(); - - var elementFinder: protractor.ElementFinder; - var elementArrayFinder: protractor.ElementArrayFinder; - - elementFinder = ptor.element(by.id('ABC')); - elementFinder = ptor.$('.class'); - - elementArrayFinder = ptor.$$('.class'); - - var locationAbsUrl: webdriver.promise.Promise = ptor.getLocationAbsUrl(); - ptor.setLocation('webaddress.com'); - - var voidPromise: webdriver.promise.Promise = ptor.get('webaddress.com'); - voidPromise = ptor.get('webdaddress.com', 45); - voidPromise = ptor.quit(); - voidPromise = ptor.sleep(5000); - - ptor.refresh(); - ptor.refresh(45); - var navigation: webdriver.WebDriverNavigation = ptor.navigate(); - ptor.pause(); - ptor.pause(8080); - - ptor.getAllWindowHandles().then(function (handles: string[]) { }); - - var capabilities: protractor.promise.Promise = ptor.getCapabilities(); - - var stringPromise: webdriver.promise.Promise; - stringPromise = ptor.getCurrentUrl(); - stringPromise = ptor.getPageSource(); - stringPromise = ptor.getTitle(); - stringPromise = ptor.getWindowHandle(); - stringPromise = ptor.takeScreenshot(); - - ptor.getPageTimeout = 5000; - - var session: protractor.promise.Promise = ptor.getSession(); - - var options: webdriver.WebDriverOptions = ptor.manage(); - - promise = ptor.schedule(new protractor.Command(protractor.CommandName.ACCEPT_ALERT), 'asdf'); - - var targetLocator: webdriver.WebDriverTargetLocator = ptor.switchTo(); - - ptor.wait(protractor.until.elementLocated(by.id('id')), 5000).then(function (el: webdriver.IWebElement) { });; - ptor.wait(protractor.until.elementLocated(by.id('id')), 5000, 'message').then(function (el: webdriver.IWebElement) { });; -} - -function TestElement() { - var elementFinder: protractor.ElementFinder = element(by.id('id')); - var elementArrayFinder: protractor.ElementArrayFinder = element.all(by.className('class')); -} - -function TestElementFinder() { - var elementFinder: protractor.ElementFinder = element(by.id('id')); - var voidPromise: webdriver.promise.Promise; - var stringPromise: webdriver.promise.Promise; - var booleanPromise: webdriver.promise.Promise; - - elementFinder.getId().then(function (id: webdriver.IWebElementId) { }); - voidPromise = elementFinder.click(); - elementFinder = elementFinder.allowAnimations('string'); - voidPromise = elementFinder.sendKeys(protractor.Key.UP, protractor.Key.DOWN); - stringPromise = elementFinder.getTagName(); - stringPromise = elementFinder.getCssValue('display'); - stringPromise = elementFinder.getAttribute('atribute'); - stringPromise = elementFinder.getText(); - elementFinder.getSize().then(function (size: webdriver.ISize) { }); - elementFinder.getLocation().then(function (location: webdriver.ILocation) { }); - booleanPromise = elementFinder.isEnabled(); - booleanPromise = elementFinder.isSelected(); - voidPromise = elementFinder.submit(); - voidPromise = elementFinder.clear(); - booleanPromise = elementFinder.isDisplayed(); - stringPromise = elementFinder.getOuterHtml(); - stringPromise = elementFinder.getInnerHtml(); - booleanPromise = elementFinder.isElementPresent(by.id('id')); - elementFinder = elementFinder.$('.class'); - var finders: protractor.ElementArrayFinder = elementFinder.$$('.class'); - elementFinder = elementFinder.evaluate('expression'); - booleanPromise = elementFinder.isPresent(); - - var webElement: webdriver.WebElement = elementFinder.getWebElement(); - finders = elementFinder.all(by.className('class')); - elementFinder = elementFinder.allowAnimations('abc'); - elementFinder = elementFinder.clone(); - elementFinder = elementFinder.element(by.id('id')); - - var b: boolean = elementFinder.isPending(); - var locator: webdriver.Locator = elementFinder.locator(); -} - -function TestElementArrayFinder() { - var elementArrayFinder: protractor.ElementArrayFinder = element.all(by.id('id')); - - var voidPromise: webdriver.promise.Promise; - var stringPromise: webdriver.promise.Promise; - var booleanPromise: webdriver.promise.Promise; - - elementArrayFinder.getId().then(function (id: webdriver.IWebElementId[]) { }); - voidPromise = elementArrayFinder.click(); - elementArrayFinder = elementArrayFinder.allowAnimations(true); - voidPromise = elementArrayFinder.sendKeys(protractor.Key.UP, protractor.Key.DOWN); - stringPromise = elementArrayFinder.getTagName(); - stringPromise = elementArrayFinder.getCssValue('display'); - stringPromise = elementArrayFinder.getAttribute('atribute'); - stringPromise = elementArrayFinder.getText(); - elementArrayFinder.getSize().then(function (size: webdriver.ISize[]) { }); - elementArrayFinder.getLocation().then(function (location: webdriver.ILocation[]) { }); - booleanPromise = elementArrayFinder.isEnabled(); - booleanPromise = elementArrayFinder.isSelected(); - voidPromise = elementArrayFinder.submit(); - voidPromise = elementArrayFinder.clear(); - booleanPromise = elementArrayFinder.isDisplayed(); - stringPromise = elementArrayFinder.getOuterHtml(); - stringPromise = elementArrayFinder.getInnerHtml(); - var finders: protractor.ElementArrayFinder = elementArrayFinder.$$('.class'); - elementArrayFinder = elementArrayFinder.evaluate('expression'); - - finders = elementArrayFinder.all(by.className('class')); - elementArrayFinder = elementArrayFinder.clone(); - - var b: boolean = elementArrayFinder.isPending(); - var locator: webdriver.Locator = elementArrayFinder.locator(); - - var findersArrayPromise: protractor.promise.Promise = elementArrayFinder.asElementFinders_(); - - var driverElementArray: webdriver.WebElement[] = elementArrayFinder.getWebElements(); - var elementFinder: protractor.ElementFinder = elementArrayFinder.get(42); - elementFinder = elementArrayFinder.first(); - elementFinder = elementArrayFinder.last(); - elementFinder = elementArrayFinder.toElementFinder_() - var numberPromise: protractor.promise.Promise = elementArrayFinder.count(); - elementArrayFinder.each(function(element: protractor.ElementFinder){ - // nothing - }); - - stringPromise = elementArrayFinder.map(function(element: protractor.ElementFinder, index: number){ - return 'abc'; - }); - - stringPromise = elementArrayFinder.map(function(element: protractor.ElementFinder, index: number): string { - return 'abc'; - }); - - stringPromise = elementArrayFinder.map>(function(element: protractor.ElementFinder, index: number): webdriver.promise.Promise { - return element.getText(); - }); - - elementArrayFinder = elementArrayFinder.filter(function(element: protractor.ElementFinder, index: number){ - return element.getText().then((text: string) => { - return text === "foo"; - }); - }); - elementArrayFinder.reduce(function (accumulator: string, element: protractor.ElementFinder) { - return element.getText().then((text: string) => { - return accumulator + ',' + text; - }); - }, '').then(function (result: string) { }); - elementArrayFinder.reduce(function(accumulator: string, element: protractor.ElementFinder, index: number, array: protractor.ElementFinder[]){ - return element.getText().then((text: string) => { - return accumulator + ',' + text; - }); - }, '').then(function (result: string) { }); - elementArrayFinder.then(function(underlyingElementFinders: protractor.ElementFinder[]){ - //nothing - }); -} - -// This function tests the locator strategies. -function TestLocatorStrategies() { - var ptor: protractor.Protractor = browser; - var webElement: webdriver.WebElement; - - protractor.By.addLocator('customLocator', 'script'); - protractor.By.addLocator('customLocator2', function(){ - // nothing - }); - - // Angular specific locators. - webElement = ptor.findElement(protractor.By.binding('binding')); - webElement = ptor.findElement(protractor.By.exactBinding('exactBinding')); - webElement = ptor.findElement(protractor.By.model('model')); - webElement = ptor.findElement(protractor.By.repeater('repeater')); - webElement = ptor.findElement(protractor.By.repeater('repeater').column(0)); - webElement = ptor.findElement(protractor.By.repeater('repeater').row(0)); - webElement = ptor.findElement(protractor.By.repeater('repeater').row(0).column(0)); - webElement = ptor.findElement(protractor.By.buttonText('buttonText')); - webElement = ptor.findElement(protractor.By.partialButtonText('partialButtonText')); - webElement = ptor.findElement(protractor.By.cssContainingText('cssSelector', 'search text')); - webElement = ptor.findElement(protractor.By.options('options')); - // One standard locator for good measure. - webElement = ptor.findElement(protractor.By.id('id')); - - var el: protractor.ElementFinder; - - // Angular specific locators. - el = element(by.binding('binding')); - el = element(by.exactBinding('exactBinding')); - el = element(by.model('model')); - el = element(by.repeater('repeater')); - el = element(by.repeater('repeater').column(0)); - el = element(by.repeater('repeater').row(0)); - el = element(by.repeater('repeater').row(0).column(0)); - el = element(by.buttonText('buttonText')); - el = element(by.partialButtonText('partialButtonText')); - el = element(by.cssContainingText('cssSelector', 'search text')); - el = element(by.options('options')); - // One standard locator for good measure. - el = element(by.id('id')); -} diff --git a/protractor/index.d.ts b/protractor/index.d.ts deleted file mode 100644 index 86f00898a1..0000000000 --- a/protractor/index.d.ts +++ /dev/null @@ -1,1849 +0,0 @@ -// Type definitions for Angular Protractor 1.5.0 -// Project: https://github.com/angular/protractor -// Definitions by: Bill Armstrong -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - -declare namespace protractor { - //region Wrapped webdriver Items - - class ActionSequence extends webdriver.ActionSequence {} - class Builder extends webdriver.Builder {} - class Capabilities extends webdriver.Capabilities {} - class Command extends webdriver.Command {} - class EventEmitter extends webdriver.EventEmitter {} - class Session extends webdriver.Session {} - class WebDriver extends webdriver.WebDriver {} - class WebElement extends webdriver.WebElement {} - class WebElementPromise extends webdriver.WebElementPromise { } - - var Browser: webdriver.IBrowser; - var Button: webdriver.IButton; - var Capability: webdriver.ICapability; - var CommandName: webdriver.ICommandName; - var Key: webdriver.IKey; - - namespace error { - class Error extends webdriver.error.Error {} - var ErrorCode: webdriver.error.IErrorCode; - } - - namespace logging { - class Preferences extends webdriver.logging.Preferences { } - class Entry extends webdriver.logging.Entry { } - - var Type: webdriver.logging.IType; - var Level: webdriver.logging.ILevelValues; - - function getLevel(nameOrValue: string): webdriver.logging.ILevel; - function getLevel(nameOrValue: number): webdriver.logging.ILevel; - } - - namespace promise { - class Thenable extends webdriver.promise.Thenable { } - class Promise extends webdriver.promise.Promise { } - class Deferred extends webdriver.promise.Deferred { } - class ControlFlow extends webdriver.promise.ControlFlow { } - class CancellationError extends webdriver.promise.CancellationError { } - - /** - * Given an array of promises, will return a promise that will be fulfilled - * with the fulfillment values of the input array's values. If any of the - * input array's promises are rejected, the returned promise will be rejected - * with the same reason. - * - * @param {!Array.<(T|!webdriver.promise.Promise.)>} arr An array of - * promises to wait on. - * @return {!webdriver.promise.Promise.>} A promise that is - * fulfilled with an array containing the fulfilled values of the - * input array, or rejected with the same reason as the first - * rejected value. - * @template T - */ - function all(arr: webdriver.promise.Promise[]): webdriver.promise.Promise; - - /** - * Invokes the appropriate callback function as soon as a promised - * {@code value} is resolved. This function is similar to - * {@link webdriver.promise.when}, except it does not return a new promise. - * @param {*} value The value to observe. - * @param {Function} callback The function to call when the value is - * resolved successfully. - * @param {Function=} opt_errback The function to call when the value is - * rejected. - */ - function asap(value: any, callback: Function, opt_errback?: Function): void; - - /** - * @return {!webdriver.promise.ControlFlow} The currently active control flow. - */ - function controlFlow(): webdriver.promise.ControlFlow; - - /** - * Creates a new control flow. The provided callback will be invoked as the - * first task within the new flow, with the flow as its sole argument. Returns - * a promise that resolves to the callback result. - * @param {function(!webdriver.promise.ControlFlow)} callback The entry point - * to the newly created flow. - * @return {!webdriver.promise.Promise} A promise that resolves to the callback - * result. - */ - function createFlow(callback: (flow: webdriver.promise.ControlFlow) => R): webdriver.promise.Promise; - - /** - * Determines whether a {@code value} should be treated as a promise. - * Any object whose "then" property is a function will be considered a promise. - * - * @param {*} value The value to test. - * @return {boolean} Whether the value is a promise. - */ - function isPromise(value: any): boolean; - - /** - * Tests is a function is a generator. - * @param {!Function} fn The function to test. - * @return {boolean} Whether the function is a generator. - */ - function isGenerator(fn: Function): boolean; - - /** - * Creates a promise that will be resolved at a set time in the future. - * @param {number} ms The amount of time, in milliseconds, to wait before - * resolving the promise. - * @return {!webdriver.promise.Promise} The promise. - */ - function delayed(ms: number): webdriver.promise.Promise; - - /** - * Calls a function for each element in an array, and if the function returns - * true adds the element to a new array. - * - *

If the return value of the filter function is a promise, this function - * will wait for it to be fulfilled before determining whether to insert the - * element into the new array. - * - *

If the filter function throws or returns a rejected promise, the promise - * returned by this function will be rejected with the same reason. Only the - * first failure will be reported; all subsequent errors will be silently - * ignored. - * - * @param {!(Array.|webdriver.promise.Promise.>)} arr The - * array to iterator over, or a promise that will resolve to said array. - * @param {function(this: SELF, TYPE, number, !Array.): ( - * boolean|webdriver.promise.Promise.)} fn The function - * to call for each element in the array. - * @param {SELF=} opt_self The object to be used as the value of 'this' within - * {@code fn}. - * @template TYPE, SELF - */ - function filter(arr: T[], fn: (element: T, index: number, array: T[]) => any, opt_self?: any): webdriver.promise.Promise; - function filter(arr: webdriver.promise.Promise, fn: (element: T, index: number, array: T[]) => any, opt_self?: any): webdriver.promise.Promise - - /** - * Creates a new deferred object. - * @return {!webdriver.promise.Deferred} The new deferred object. - */ - function defer(): webdriver.promise.Deferred; - - /** - * Creates a promise that has been resolved with the given value. - * @param {*=} opt_value The resolved value. - * @return {!webdriver.promise.Promise} The resolved promise. - */ - function fulfilled(opt_value?: T): webdriver.promise.Promise; - - /** - * Calls a function for each element in an array and inserts the result into a - * new array, which is used as the fulfillment value of the promise returned - * by this function. - * - *

If the return value of the mapping function is a promise, this function - * will wait for it to be fulfilled before inserting it into the new array. - * - *

If the mapping function throws or returns a rejected promise, the - * promise returned by this function will be rejected with the same reason. - * Only the first failure will be reported; all subsequent errors will be - * silently ignored. - * - * @param {!(Array.|webdriver.promise.Promise.>)} arr The - * array to iterator over, or a promise that will resolve to said array. - * @param {function(this: SELF, TYPE, number, !Array.): ?} fn The - * function to call for each element in the array. This function should - * expect three arguments (the element, the index, and the array itself. - * @param {SELF=} opt_self The object to be used as the value of 'this' within - * {@code fn}. - * @template TYPE, SELF - */ - function map(arr: T[], fn: (element: T, index: number, array: T[]) => any, opt_self?: any): webdriver.promise.Promise - function map(arr: webdriver.promise.Promise, fn: (element: T, index: number, array: T[]) => any, opt_self?: any): webdriver.promise.Promise - - /** - * Creates a promise that has been rejected with the given reason. - * @param {*=} opt_reason The rejection reason; may be any value, but is - * usually an Error or a string. - * @return {!webdriver.promise.Promise} The rejected promise. - */ - function rejected(opt_reason?: any): webdriver.promise.Promise; - - /** - * Wraps a function that is assumed to be a node-style callback as its final - * argument. This callback takes two arguments: an error value (which will be - * null if the call succeeded), and the success value as the second argument. - * If the call fails, the returned promise will be rejected, otherwise it will - * be resolved with the result. - * @param {!Function} fn The function to wrap. - * @return {!webdriver.promise.Promise} A promise that will be resolved with the - * result of the provided function's callback. - */ - function checkedNodeCall(fn: Function, ...var_args: any[]): webdriver.promise.Promise; - - /** - * Consumes a {@code GeneratorFunction}. Each time the generator yields a - * promise, this function will wait for it to be fulfilled before feeding the - * fulfilled value back into {@code next}. Likewise, if a yielded promise is - * rejected, the rejection error will be passed to {@code throw}. - * - *

Example 1: the Fibonacci Sequence. - *


-         * webdriver.promise.consume(function* fibonacci() {
-         *   var n1 = 1, n2 = 1;
-         *   for (var i = 0; i < 4; ++i) {
-         *     var tmp = yield n1 + n2;
-         *     n1 = n2;
-         *     n2 = tmp;
-         *   }
-         *   return n1 + n2;
-         * }).then(function(result) {
-         *   console.log(result);  // 13
-         * });
-         * 
- * - *

Example 2: a generator that throws. - *


-         * webdriver.promise.consume(function* () {
-         *   yield webdriver.promise.delayed(250).then(function() {
-         *     throw Error('boom');
-         *   });
-         * }).thenCatch(function(e) {
-         *   console.log(e.toString());  // Error: boom
-         * });
-         * 
- * - * @param {!Function} generatorFn The generator function to execute. - * @param {Object=} opt_self The object to use as "this" when invoking the - * initial generator. - * @param {...*} var_args Any arguments to pass to the initial generator. - * @return {!webdriver.promise.Promise.} A promise that will resolve to the - * generator's final result. - * @throws {TypeError} If the given function is not a generator. - */ - function consume(generatorFn: Function, opt_self?: any, ...var_args: any[]): webdriver.promise.Promise; - - /** - * Registers an observer on a promised {@code value}, returning a new promise - * that will be resolved when the value is. If {@code value} is not a promise, - * then the return promise will be immediately resolved. - * @param {*} value The value to observe. - * @param {Function=} opt_callback The function to call when the value is - * resolved successfully. - * @param {Function=} opt_errback The function to call when the value is - * rejected. - * @return {!webdriver.promise.Promise} A new promise. - */ - function when(value: T, opt_callback?: (value: T) => any, opt_errback?: (error: any) => any): webdriver.promise.Promise; - function when(value: webdriver.promise.Promise, opt_callback?: (value: T) => any, opt_errback?: (error: any) => any): webdriver.promise.Promise; - - /** - * Returns a promise that will be resolved with the input value in a - * fully-resolved state. If the value is an array, each element will be fully - * resolved. Likewise, if the value is an object, all keys will be fully - * resolved. In both cases, all nested arrays and objects will also be - * fully resolved. All fields are resolved in place; the returned promise will - * resolve on {@code value} and not a copy. - * - * Warning: This function makes no checks against objects that contain - * cyclical references: - * - * var value = {}; - * value['self'] = value; - * webdriver.promise.fullyResolved(value); // Stack overflow. - * - * @param {*} value The value to fully resolve. - * @return {!webdriver.promise.Promise} A promise for a fully resolved version - * of the input value. - */ - function fullyResolved(value: any): webdriver.promise.Promise; - - /** - * Changes the default flow to use when no others are active. - * @param {!webdriver.promise.ControlFlow} flow The new default flow. - * @throws {Error} If the default flow is not currently active. - */ - function setDefaultFlow(flow: webdriver.promise.ControlFlow): void; - } - - namespace stacktrace { - class Frame extends webdriver.stacktrace.Frame { } - class Snapshot extends webdriver.stacktrace.Snapshot { } - - /** - * Formats an error's stack trace. - * @param {!(Error|goog.testing.JsUnitException)} error The error to format. - * @return {!(Error|goog.testing.JsUnitException)} The formatted error. - */ - function format(error: any): any; - - /** - * Gets the native stack trace if available otherwise follows the call chain. - * The generated trace will exclude all frames up to and including the call to - * this function. - * @return {!Array.} The frames of the stack trace. - */ - function get(): webdriver.stacktrace.Frame[]; - - /** - * Whether the current browser supports stack traces. - * - * @type {boolean} - * @const - */ - var BROWSER_SUPPORTED: boolean; - } - - namespace until { - class Condition extends webdriver.until.Condition { } - - /** - * Creates a condition that will wait until the input driver is able to switch - * to the designated frame. The target frame may be specified as: - *
    - *
  1. A numeric index into {@code window.frames} for the currently selected - * frame. - *
  2. A {@link webdriver.WebElement}, which must reference a FRAME or IFRAME - * element on the current page. - *
  3. A locator which may be used to first locate a FRAME or IFRAME on the - * current page before attempting to switch to it. - *
- * - *

Upon successful resolution of this condition, the driver will be left - * focused on the new frame. - * - * @param {!(number|webdriver.WebElement| - * webdriver.Locator|webdriver.By.Hash| - * function(!webdriver.WebDriver): !webdriver.WebElement)} frame - * The frame identifier. - * @return {!until.Condition.} A new condition. - */ - function ableToSwitchToFrame(frame: number): webdriver.until.Condition; - function ableToSwitchToFrame(frame: webdriver.IWebElement): webdriver.until.Condition; - function ableToSwitchToFrame(frame: webdriver.Locator): webdriver.until.Condition; - function ableToSwitchToFrame(frame: (webdriver: webdriver.WebDriver) => webdriver.IWebElement): webdriver.until.Condition; - function ableToSwitchToFrame(frame: any): webdriver.until.Condition; - - /** - * Creates a condition that waits for an alert to be opened. Upon success, the - * returned promise will be fulfilled with the handle for the opened alert. - * - * @return {!until.Condition.} The new condition. - */ - function alertIsPresent(): webdriver.until.Condition; - - /** - * Creates a condition that will wait for the given element to be disabled. - * - * @param {!webdriver.WebElement} element The element to test. - * @return {!until.Condition.} The new condition. - * @see webdriver.WebDriver#isEnabled - */ - function elementIsDisabled(element: webdriver.IWebElement): webdriver.until.Condition; - - /** - * Creates a condition that will wait for the given element to be enabled. - * - * @param {!webdriver.WebElement} element The element to test. - * @return {!until.Condition.} The new condition. - * @see webdriver.WebDriver#isEnabled - */ - function elementIsEnabled(element: webdriver.IWebElement): webdriver.until.Condition; - - /** - * Creates a condition that will wait for the given element to be deselected. - * - * @param {!webdriver.WebElement} element The element to test. - * @return {!until.Condition.} The new condition. - * @see webdriver.WebDriver#isSelected - */ - function elementIsNotSelected(element: webdriver.IWebElement): webdriver.until.Condition; - - /** - * Creates a condition that will wait for the given element to be in the DOM, - * yet not visible to the user. - * - * @param {!webdriver.WebElement} element The element to test. - * @return {!until.Condition.} The new condition. - * @see webdriver.WebDriver#isDisplayed - */ - function elementIsNotVisible(element: webdriver.IWebElement): webdriver.until.Condition; - - /** - * Creates a condition that will wait for the given element to be selected. - * @param {!webdriver.WebElement} element The element to test. - * @return {!until.Condition.} The new condition. - * @see webdriver.WebDriver#isSelected - */ - function elementIsSelected(element: webdriver.IWebElement): webdriver.until.Condition; - - /** - * Creates a condition that will wait for the given element to become visible. - * - * @param {!webdriver.WebElement} element The element to test. - * @return {!until.Condition.} The new condition. - * @see webdriver.WebDriver#isDisplayed - */ - function elementIsVisible(element: webdriver.IWebElement): webdriver.until.Condition; - - /** - * Creates a condition that will loop until an element is - * {@link webdriver.WebDriver#findElement found} with the given locator. - * - * @param {!(webdriver.Locator|webdriver.By.Hash|Function)} locator The locator - * to use. - * @return {!until.Condition.} The new condition. - */ - function elementLocated(locator: webdriver.Locator): webdriver.until.Condition; - function elementLocated(locator: any): webdriver.until.Condition; - - /** - * Creates a condition that will wait for the given element's - * {@link webdriver.WebDriver#getText visible text} to contain the given - * substring. - * - * @param {!webdriver.WebElement} element The element to test. - * @param {string} substr The substring to search for. - * @return {!until.Condition.} The new condition. - * @see webdriver.WebDriver#getText - */ - function elementTextContains(element: webdriver.IWebElement, substr: string): webdriver.until.Condition; - - /** - * Creates a condition that will wait for the given element's - * {@link webdriver.WebDriver#getText visible text} to match the given - * {@code text} exactly. - * - * @param {!webdriver.WebElement} element The element to test. - * @param {string} text The expected text. - * @return {!until.Condition.} The new condition. - * @see webdriver.WebDriver#getText - */ - function elementTextIs(element: webdriver.IWebElement, text: string): webdriver.until.Condition; - - /** - * Creates a condition that will wait for the given element's - * {@link webdriver.WebDriver#getText visible text} to match a regular - * expression. - * - * @param {!webdriver.WebElement} element The element to test. - * @param {!RegExp} regex The regular expression to test against. - * @return {!until.Condition.} The new condition. - * @see webdriver.WebDriver#getText - */ - function elementTextMatches(element: webdriver.IWebElement, regex: RegExp): webdriver.until.Condition; - - /** - * Creates a condition that will loop until at least one element is - * {@link webdriver.WebDriver#findElement found} with the given locator. - * - * @param {!(webdriver.Locator|webdriver.By.Hash|Function)} locator The locator - * to use. - * @return {!until.Condition.>} The new - * condition. - */ - function elementsLocated(locator: webdriver.Locator): webdriver.until.Condition; - function elementsLocated(locator: any): webdriver.until.Condition; - - /** - * Creates a condition that will wait for the given element to become stale. An - * element is considered stale once it is removed from the DOM, or a new page - * has loaded. - * - * @param {!webdriver.WebElement} element The element that should become stale. - * @return {!until.Condition.} The new condition. - */ - function stalenessOf(element: webdriver.IWebElement): webdriver.until.Condition; - - /** - * Creates a condition that will wait for the current page's title to contain - * the given substring. - * - * @param {string} substr The substring that should be present in the page - * title. - * @return {!until.Condition.} The new condition. - */ - function titleContains(substr: string): webdriver.until.Condition; - - /** - * Creates a condition that will wait for the current page's title to match the - * given value. - * - * @param {string} title The expected page title. - * @return {!until.Condition.} The new condition. - */ - function titleIs(title: string): webdriver.until.Condition; - - /** - * Creates a condition that will wait for the current page's title to match the - * given regular expression. - * - * @param {!RegExp} regex The regular expression to test against. - * @return {!until.Condition.} The new condition. - */ - function titleMatches(regex: RegExp): webdriver.until.Condition; - } - - namespace ExpectedConditions { - /** - * Negates the result of a promise. - * - * @param {webdriver.until.Condition} expectedCondition - * @return {!webdriver.until.Condition} An expected condition that returns the negated value. - */ - function not(expectedCondition: webdriver.until.Condition): webdriver.until.Condition; - - /** - * Chain a number of expected conditions using logical_and, short circuiting at the - * first expected condition that evaluates to false. - * - * @param {...webdriver.until.Condition[]} fns An array of expected conditions to 'and' together. - * @return {!webdriver.until.Condition} An expected condition that returns a promise which evaluates - * to the result of the logical and. - */ - function and(...fns: webdriver.until.Condition[]): webdriver.until.Condition; - - /** - * Chain a number of expected conditions using logical_or, short circuiting at the - * first expected condition that evaluates to true. - * - * @param {...webdriver.until.Condition[]} fns An array of expected conditions to 'or' together. - * @return {!webdriver.until.Condition} An expected condition that returns a promise which - * evaluates to the result of the logical or. - */ - function or(...fns: webdriver.until.Condition[]): webdriver.until.Condition; - - /** - * Expect an alert to be present. - * - * @return {!webdriver.until.Condition} An expected condition that returns a promise representing - * whether an alert is present. - */ - function alertIsPresent(): webdriver.until.Condition; - - /** - * An Expectation for checking an element is visible and enabled such that you can click it. - * - * @param {ElementFinder} element The element to check - * @return {!webdriver.until.Condition} An expected condition that returns a promise representing - * whether the element is clickable. - */ - function elementToBeClickable(element: ElementFinder): webdriver.until.Condition; - - /** - * An expectation for checking if the given text is present in the element. - * Returns false if the elementFinder does not find an element. - * - * @param {ElementFinder} element The element to check - * @param {string} text The text to verify against - * @return {!webdriver.until.Condition} An expected condition that returns a promise representing - * whether the text is present in the element. - */ - function textToBePresentInElement(element: ElementFinder, text: string): webdriver.until.Condition; - - /** - * An expectation for checking if the given text is present in the element’s value. - * Returns false if the elementFinder does not find an element. - * - * @param {ElementFinder} element The element to check - * @param {string} text The text to verify against - * @return {!webdriver.until.Condition} An expected condition that returns a promise representing - * whether the text is present in the element's value. - */ - function textToBePresentInElementValue( - element: ElementFinder, text: string - ): webdriver.until.Condition; - - /** - * An expectation for checking that the title contains a case-sensitive substring. - * - * @param {string} title The fragment of title expected - * @return {!webdriver.until.Condition} An expected condition that returns a promise representing - * whether the title contains the string. - */ - function titleContains(title: string): webdriver.until.Condition; - - /** - * An expectation for checking the title of a page. - * - * @param {string} title The expected title, which must be an exact match. - * @return {!webdriver.until.Condition} An expected condition that returns a promise representing - * whether the title equals the string. - */ - function titleIs(title: string): webdriver.until.Condition; - - /** - * An expectation for checking that an element is present on the DOM of a page. This does not necessarily - * mean that the element is visible. This is the opposite of 'stalenessOf'. - * - * @param {ElementFinder} elementFinder The element to check - * @return {!webdriver.until.Condition} An expected condition that returns a promise - * representing whether the element is present. - */ - function presenceOf(element: ElementFinder): webdriver.until.Condition; - - /** - * An expectation for checking that an element is not attached to the DOM of a page. - * This is the opposite of 'presenceOf'. - * - * @param {ElementFinder} elementFinder The element to check - * @return {!webdriver.until.Condition} An expected condition that returns a promise representing - * whether the element is stale. - */ - function stalenessOf(element: ElementFinder): webdriver.until.Condition; - - /** - * An expectation for checking that an element is present on the DOM of a page and visible. - * Visibility means that the element is not only displayed but also has a height and width that is - * greater than 0. This is the opposite of 'invisibilityOf'. - * - * @param {ElementFinder} elementFinder The element to check - * @return {!webdriver.until.Condition} An expected condition that returns a promise representing - * whether the element is visible. - */ - function visibilityOf(element: ElementFinder): webdriver.until.Condition; - - /** - * An expectation for checking that an element is present on the DOM of a page. This does not necessarily - * mean that the element is visible. This is the opposite of 'stalenessOf'. - * - * @param {ElementFinder} elementFinder The element to check - * @return {!webdriver.until.Condition} An expected condition that returns a promise representing - * whether the element is invisible. - */ - function invisibilityOf(element: ElementFinder): webdriver.until.Condition; - - /** - * An expectation for checking the selection is selected. - * - * @param {ElementFinder} elementFinder The element to check - * @return {!webdriver.until.Condition} An expected condition that returns a promise representing - * whether the element is selected. - */ - function elementToBeSelected(element: ElementFinder): webdriver.until.Condition; - } - - //endregion - - /** - * Use as: element(locator) - * - * The ElementFinder can be treated as a WebElement for most purposes, in - * particular, you may perform actions (i.e. click, getText) on them as you - * would a WebElement. ElementFinders extend Promise, and once an action - * is performed on an ElementFinder, the latest result from the chain can be - * accessed using then. Unlike a WebElement, an ElementFinder will wait for - * angular to settle before performing finds or actions. - * - * ElementFinder can be used to build a chain of locators that is used to find - * an element. An ElementFinder does not actually attempt to find the element - * until an action is called, which means they can be set up in helper files - * before the page is available. - * - * @param {webdriver.Locator} locator An element locator. - * @return {ElementFinder} - */ - interface Element { - (locator: webdriver.Locator): ElementFinder; - - /** - * ElementArrayFinder is used for operations on an array of elements (as opposed - * to a single element). - * - * @param {webdriver.Locator} locator An element locator. - * @return {ElementArrayFinder} - */ - all(locator: webdriver.Locator): ElementArrayFinder; - } - - interface ElementFinder extends webdriver.IWebElement, webdriver.promise.IThenable { - /** - * Calls to element may be chained to find elements within a parent. - * - * @alias element(locator).element(locator) - * @view - *

- *
- * Child text - *
{{person.phone}}
- *
- *
- * - * @example - * // Chain 2 element calls. - * var child = element(by.css('.parent')). - * element(by.css('.child')); - * expect(child.getText()).toBe('Child text\n555-123-4567'); - * - * // Chain 3 element calls. - * var triple = element(by.css('.parent')). - * element(by.css('.child')). - * element(by.binding('person.phone')); - * expect(triple.getText()).toBe('555-123-4567'); - * - * @param {webdriver.Locator} subLocator - * @return {ElementFinder} - */ - element(subLocator: webdriver.Locator): ElementFinder; - - /** - * Calls to element may be chained to find an array of elements within a parent. - * - * @alias element(locator).all(locator) - * @view - *
- *
    - *
  • First
  • - *
  • Second
  • - *
  • Third
  • - *
- *
- * - * @example - * var items = element(by.css('.parent')).all(by.tagName('li')) - * - * @param {webdriver.Locator} subLocator - * @return {ElementArrayFinder} - */ - all(subLocator: webdriver.Locator): ElementArrayFinder; - - /** - * Shortcut for querying the document directly with css. - * - * @alias $(cssSelector) - * @view - *
- * First - * Second - *
- * - * @example - * var item = $('.count .two'); - * expect(item.getText()).toBe('Second'); - * - * @param {string} selector A css selector - * @return {ElementFinder} which identifies the located - * {@link webdriver.WebElement} - */ - $(selector: string): ElementFinder; - - /** - * Shortcut for querying the document directly with css. - * - * @alias $$(cssSelector) - * @view - *
- * First - * Second - *
- * - * @example - * // The following protractor expressions are equivalent. - * var list = element.all(by.css('.count span')); - * expect(list.count()).toBe(2); - * - * list = $$('.count span'); - * expect(list.count()).toBe(2); - * expect(list.get(0).getText()).toBe('First'); - * expect(list.get(1).getText()).toBe('Second'); - * - * @param {string} selector a css selector - * @return {ElementArrayFinder} which identifies the - * array of the located {@link webdriver.WebElement}s. - */ - $$(selector: string): ElementArrayFinder; - - /** - * Determine whether the element is present on the page. - * - * @view - * {{person.name}} - * - * @example - * // Element exists. - * expect(element(by.binding('person.name')).isPresent()).toBe(true); - * - * // Element not present. - * expect(element(by.binding('notPresent')).isPresent()).toBe(false); - * - * @return {ElementFinder} which resolves to whether - * the element is present on the page. - */ - isPresent(): webdriver.promise.Promise; - - /** - * Override for WebElement.prototype.isElementPresent so that protractor waits - * for Angular to settle before making the check. - * - * @see ElementFinder.isPresent - * - * @param {webdriver.Locator} subLocator Locator for element to look for. - * @return {ElementFinder} which resolves to whether - * the element is present on the page. - */ - isElementPresent(subLocator: webdriver.Locator): webdriver.promise.Promise; - - /** - * @see ElementArrayFinder.prototype.locator - * - * @return {webdriver.Locator} - */ - locator(): webdriver.Locator; - - /** - * Returns the WebElement represented by this ElementFinder. - * Throws the WebDriver error if the element doesn't exist. - * - * @example - * The following three expressions are equivalent. - * element(by.css('.parent')).getWebElement(); - * browser.waitForAngular(); browser.driver.findElement(by.css('.parent')); - * browser.findElement(by.css('.parent')); - * - * @alias element(locator).getWebElement() - * @return {webdriver.WebElement} - */ - getWebElement(): webdriver.WebElement; - - /** - * Evaluates the input as if it were on the scope of the current element. - * @see ElementArrayFinder.evaluate - * - * @param {string} expression - * - * @return {ElementFinder} which resolves to the evaluated expression. - */ - evaluate(expression: string): ElementFinder; - - /** - * @see ElementArrayFinder.prototype.allowAnimations. - * @param {string} value - * - * @return {ElementFinder} which resolves to whether animation is allowed. - */ - allowAnimations(value: string): ElementFinder; - - /** - * Create a shallow copy of ElementFinder. - * - * @return {!ElementFinder} A shallow copy of this. - */ - clone(): ElementFinder; - } - - interface ElementArrayFinder extends webdriver.promise.IThenable { - /** - * Returns the elements as an array of WebElements. - */ - getWebElements(): webdriver.WebElement[]; - - - /** - * Get an element within the ElementArrayFinder by index. The index starts at 0. - * Negative indices are wrapped (i.e. -i means ith element from last) - * This does not actually retrieve the underlying element. - * - * @alias element.all(locator).get(index) - * @view - *
    - *
  • First
  • - *
  • Second
  • - *
  • Third
  • - *
- * - * @example - * var list = element.all(by.css('.items li')); - * expect(list.get(0).getText()).toBe('First'); - * expect(list.get(1).getText()).toBe('Second'); - * - * @param {number} index Element index. - * @return {ElementFinder} finder representing element at the given index. - */ - get(index: number): ElementFinder; - - /** - * Get the first matching element for the ElementArrayFinder. This does not - * actually retrieve the underlying element. - * - * @alias element.all(locator).first() - * @view - *
    - *
  • First
  • - *
  • Second
  • - *
  • Third
  • - *
- * - * @example - * var first = element.all(by.css('.items li')).first(); - * expect(first.getText()).toBe('First'); - * - * @return {ElementFinder} finder representing the first matching element - */ - first(): ElementFinder; - - /** - * Get the last matching element for the ElementArrayFinder. This does not - * actually retrieve the underlying element. - * - * @alias element.all(locator).last() - * @view - *
    - *
  • First
  • - *
  • Second
  • - *
  • Third
  • - *
- * - * @example - * var last = element.all(by.css('.items li')).last(); - * expect(last.getText()).toBe('Third'); - * - * @return {ElementFinder} finder representing the last matching element - */ - last(): ElementFinder; - - /** - * Count the number of elements represented by the ElementArrayFinder. - * - * @alias element.all(locator).count() - * @view - *
    - *
  • First
  • - *
  • Second
  • - *
  • Third
  • - *
- * - * @example - * var list = element.all(by.css('.items li')); - * expect(list.count()).toBe(3); - * - * @return {!webdriver.promise.Promise} A promise which resolves to the - * number of elements matching the locator. - */ - count(): webdriver.promise.Promise; - - /** - * Calls the input function on each ElementFinder represented by the ElementArrayFinder. - * - * @alias element.all(locator).each(eachFunction) - * @view - *
    - *
  • First
  • - *
  • Second
  • - *
  • Third
  • - *
- * - * @example - * element.all(by.css('.items li')).each(function(element) { - * // Will print First, Second, Third. - * element.getText().then(console.log); - * }); - * - * @param {function(ElementFinder)} fn Input function - */ - each(fn: (element: ElementFinder, index: number) => void): void; - - /** - * Apply a map function to each element within the ElementArrayFinder. The - * callback receives the ElementFinder as the first argument and the index as - * a second arg. - * - * @alias element.all(locator).map(mapFunction) - * @view - *
    - *
  • First
  • - *
  • Second
  • - *
  • Third
  • - *
- * - * @example - * var items = element.all(by.css('.items li')).map(function(elm, index) { - * return { - * index: index, - * text: elm.getText(), - * class: elm.getAttribute('class') - * }; - * }); - * expect(items).toEqual([ - * {index: 0, text: 'First', class: 'one'}, - * {index: 1, text: 'Second', class: 'two'}, - * {index: 2, text: 'Third', class: 'three'} - * ]); - * - * @param {function(ElementFinder, number)} mapFn Map function that - * will be applied to each element. - * @return {!webdriver.promise.Promise} A promise that resolves to an array - * of values returned by the map function. - */ - map(mapFn: (element: ElementFinder, index: number) => T): webdriver.promise.Promise; - map(mapFn: (element: ElementFinder, index: number) => T2): webdriver.promise.Promise; - - /** - * Apply a filter function to each element within the ElementArrayFinder. Returns - * a new ElementArrayFinder with all elements that pass the filter function. The - * filter function receives the ElementFinder as the first argument - * and the index as a second arg. - * This does not actually retrieve the underlying list of elements, so it can - * be used in page objects. - * - * @alias element.all(locator).filter(filterFn) - * @view - *
    - *
  • First
  • - *
  • Second
  • - *
  • Third
  • - *
- * - * @example - * element.all(by.css('.items li')).filter(function(elem, index) { - * return elem.getText().then(function(text) { - * return text === 'Third'; - * }); - * }).then(function(filteredElements) { - * filteredElements[0].click(); - * }); - * - * @param {function(ElementFinder, number): webdriver.WebElement.Promise} filterFn - * Filter function that will test if an element should be returned. - * filterFn can either return a boolean or a promise that resolves to a boolean. - * @return {!ElementArrayFinder} A ElementArrayFinder that represents an array - * of element that satisfy the filter function. - */ - filter(filterFn: (element: ElementFinder, index: number) => any): ElementArrayFinder; - - /** - * Apply a reduce function against an accumulator and every element found - * using the locator (from left-to-right). The reduce function has to reduce - * every element into a single value (the accumulator). Returns promise of - * the accumulator. The reduce function receives the accumulator, current - * ElementFinder, the index, and the entire array of ElementFinders, - * respectively. - * - * @alias element.all(locator).reduce(reduceFn) - * @view - *
    - *
  • First
  • - *
  • Second
  • - *
  • Third
  • - *
- * - * @example - * var value = element.all(by.css('.items li')).reduce(function(acc, elem) { - * return elem.getText().then(function(text) { - * return acc + text + ' '; - * }); - * }); - * - * expect(value).toEqual('First Second Third '); - * - * @param {function(number, ElementFinder, number, Array.)} - * reduceFn Reduce function that reduces every element into a single value. - * @param {*} initialValue Initial value of the accumulator. - * @return {!webdriver.promise.Promise} A promise that resolves to the final - * value of the accumulator. - */ - reduce(reduceFn: (acc: T, element: ElementFinder, index: number, arr: ElementFinder[]) => webdriver.promise.Promise, initialValue: T): webdriver.promise.Promise; - reduce(reduceFn: (acc: T, element: ElementFinder, index: number, arr: ElementFinder[]) => T, initialValue: T): webdriver.promise.Promise; - - /** - * Represents the ElementArrayFinder as an array of ElementFinders. - * - * @return {Array.} Return a promise, which resolves to a list - * of ElementFinders specified by the locator. - */ - asElementFinders_(): webdriver.promise.Promise; - - /** - * Create a shallow copy of ElementArrayFinder. - * - * @return {!ElementArrayFinder} A shallow copy of this. - */ - clone(): ElementArrayFinder; - - /** - * Calls to ElementArrayFinder may be chained to find an array of elements - * using the current elements in this ElementArrayFinder as the starting point. - * This function returns a new ElementArrayFinder which would contain the - * children elements found (and could also be empty). - * - * @alias element.all(locator).all(locator) - * @view - *
- *
    - *
  • 1a
  • - *
  • 1b
  • - *
- *
- *
- *
    - *
  • 2a
  • - *
  • 2b
  • - *
- *
- * - * @example - * var foo = element.all(by.css('.parent')).all(by.css('.foo')) - * expect(foo.getText()).toEqual(['1a', '2a']) - * var baz = element.all(by.css('.parent')).all(by.css('.baz')) - * expect(baz.getText()).toEqual(['1b']) - * var nonexistent = element.all(by.css('.parent')).all(by.css('.NONEXISTENT')) - * expect(nonexistent.getText()).toEqual(['']) - * - * @param {webdriver.Locator} subLocator - * @return {ElementArrayFinder} - */ - all(locator: webdriver.Locator): ElementArrayFinder; - - /** - * Shorthand function for finding arrays of elements by css. - * - * @type {function(string): ElementArrayFinder} - */ - $$(selector: string): ElementArrayFinder; - - /** - * Returns an ElementFinder representation of ElementArrayFinder. It ensures - * that the ElementArrayFinder resolves to one and only one underlying element. - * - * @return {ElementFinder} An ElementFinder representation - * @private - */ - toElementFinder_(): ElementFinder; - - /** - * Returns the most relevant locator. - * - * @example - * $('#ID1').locator() // returns by.css('#ID1') - * $('#ID1').$('#ID2').locator() // returns by.css('#ID2') - * $$('#ID1').filter(filterFn).get(0).click().locator() // returns by.css('#ID1') - * - * @return {webdriver.Locator} - */ - locator(): webdriver.Locator; - - /** - * Evaluates the input as if it were on the scope of the current underlying - * elements. - * - * @view - * {{variableInScope}} - * - * @example - * var value = element(by.id('foo')).evaluate('variableInScope'); - * - * @param {string} expression - * - * @return {ElementArrayFinder} which resolves to the - * evaluated expression for each underlying element. - * The result will be resolved as in - * {@link webdriver.WebDriver.executeScript}. In summary - primitives will - * be resolved as is, functions will be converted to string, and elements - * will be returned as a WebElement. - */ - evaluate(expression: string): ElementArrayFinder; - - /** - * Determine if animation is allowed on the current underlying elements. - * @param {string} value - * - * @example - * // Turns off ng-animate animations for all elements in the - * element(by.css('body')).allowAnimations(false); - * - * @return {ElementArrayFinder} which resolves to whether animation is allowed. - */ - allowAnimations(value: boolean): ElementArrayFinder; - - /** - * Schedules a command to click on this element. - * @return {!webdriver.promise.Promise} A promise that will be resolved when - * the click command has completed. - */ - click(): webdriver.promise.Promise; - - /** - * Schedules a command to type a sequence on the DOM element represented by this - * instance. - *

- * Modifier keys (SHIFT, CONTROL, ALT, META) are stateful; once a modifier is - * processed in the keysequence, that key state is toggled until one of the - * following occurs: - *

    - *
  • The modifier key is encountered again in the sequence. At this point the - * state of the key is toggled (along with the appropriate keyup/down events). - *
  • - *
  • The {@code webdriver.Key.NULL} key is encountered in the sequence. When - * this key is encountered, all modifier keys current in the down state are - * released (with accompanying keyup events). The NULL key can be used to - * simulate common keyboard shortcuts: - * - * element.sendKeys("text was", - * webdriver.Key.CONTROL, "a", webdriver.Key.NULL, - * "now text is"); - * // Alternatively: - * element.sendKeys("text was", - * webdriver.Key.chord(webdriver.Key.CONTROL, "a"), - * "now text is"); - *
  • - *
  • The end of the keysequence is encountered. When there are no more keys - * to type, all depressed modifier keys are released (with accompanying keyup - * events). - *
  • - *
- * Note: On browsers where native keyboard events are not yet - * supported (e.g. Firefox on OS X), key events will be synthesized. Special - * punctionation keys will be synthesized according to a standard QWERTY en-us - * keyboard layout. - * - * @param {...string} var_args The sequence of keys to - * type. All arguments will be joined into a single sequence (var_args is - * permitted for convenience). - * @return {!webdriver.promise.Promise} A promise that will be resolved when all - * keys have been typed. - */ - sendKeys(...var_args: string[]): webdriver.promise.Promise; - - /** - * Schedules a command to query for the tag/node name of this element. - * @return {!webdriver.promise.Promise} A promise that will be resolved with the - * element's tag name. - */ - getTagName(): webdriver.promise.Promise; - - /** - * Schedules a command to query for the computed style of the element - * represented by this instance. If the element inherits the named style from - * its parent, the parent will be queried for its value. Where possible, color - * values will be converted to their hex representation (e.g. #00ff00 instead of - * rgb(0, 255, 0)). - *

- * Warning: the value returned will be as the browser interprets it, so - * it may be tricky to form a proper assertion. - * - * @param {string} cssStyleProperty The name of the CSS style property to look - * up. - * @return {!webdriver.promise.Promise} A promise that will be resolved with the - * requested CSS value. - */ - getCssValue(cssStyleProperty: string): webdriver.promise.Promise; - - /** - * Schedules a command to query for the value of the given attribute of the - * element. Will return the current value even if it has been modified after the - * page has been loaded. More exactly, this method will return the value of the - * given attribute, unless that attribute is not present, in which case the - * value of the property with the same name is returned. If neither value is - * set, null is returned. The "style" attribute is converted as best can be to a - * text representation with a trailing semi-colon. The following are deemed to - * be "boolean" attributes and will be returned as thus: - * - *

async, autofocus, autoplay, checked, compact, complete, controls, declare, - * defaultchecked, defaultselected, defer, disabled, draggable, ended, - * formnovalidate, hidden, indeterminate, iscontenteditable, ismap, itemscope, - * loop, multiple, muted, nohref, noresize, noshade, novalidate, nowrap, open, - * paused, pubdate, readonly, required, reversed, scoped, seamless, seeking, - * selected, spellcheck, truespeed, willvalidate - * - *

Finally, the following commonly mis-capitalized attribute/property names - * are evaluated as expected: - *

    - *
  • "class" - *
  • "readonly" - *
- * @param {string} attributeName The name of the attribute to query. - * @return {!webdriver.promise.Promise} A promise that will be resolved with the - * attribute's value. - */ - getAttribute(attributeName: string): webdriver.promise.Promise; - - /** - * Get the visible (i.e. not hidden by CSS) innerText of this element, including - * sub-elements, without any leading or trailing whitespace. - * @return {!webdriver.promise.Promise} A promise that will be resolved with the - * element's visible text. - */ - getText(): webdriver.promise.Promise; - - /** - * Schedules a command to compute the size of this element's bounding box, in - * pixels. - * @return {!webdriver.promise.Promise} A promise that will be resolved with the - * element's size as a {@code {width:number, height:number}} object. - */ - getSize(): webdriver.promise.Promise; - - /** - * Schedules a command to compute the location of this element in page space. - * @return {!webdriver.promise.Promise} A promise that will be resolved to the - * element's location as a {@code {x:number, y:number}} object. - */ - getLocation(): webdriver.promise.Promise; - - /** - * Schedules a command to query whether the DOM element represented by this - * instance is enabled, as dicted by the {@code disabled} attribute. - * @return {!webdriver.promise.Promise} A promise that will be resolved with - * whether this element is currently enabled. - */ - isEnabled(): webdriver.promise.Promise; - - /** - * Schedules a command to query whether this element is selected. - * @return {!webdriver.promise.Promise} A promise that will be resolved with - * whether this element is currently selected. - */ - isSelected(): webdriver.promise.Promise; - - /** - * Schedules a command to submit the form containing this element (or this - * element if it is a FORM element). This command is a no-op if the element is - * not contained in a form. - * @return {!webdriver.promise.Promise} A promise that will be resolved when - * the form has been submitted. - */ - submit(): webdriver.promise.Promise; - - /** - * Schedules a command to clear the {@code value} of this element. This command - * has no effect if the underlying DOM element is neither a text INPUT element - * nor a TEXTAREA element. - * @return {!webdriver.promise.Promise} A promise that will be resolved when - * the element has been cleared. - */ - clear(): webdriver.promise.Promise; - - /** - * Schedules a command to test whether this element is currently displayed. - * @return {!webdriver.promise.Promise} A promise that will be resolved with - * whether this element is currently visible on the page. - */ - isDisplayed(): webdriver.promise.Promise; - - /** - * Schedules a command to retrieve the outer HTML of this element. - * @return {!webdriver.promise.Promise} A promise that will be resolved with - * the element's outer HTML. - */ - getOuterHtml(): webdriver.promise.Promise; - - /** - * @return {!webdriver.promise.Promise.} A promise - * that resolves to this element's JSON representation as defined by the - * WebDriver wire protocol. - * @see http://code.google.com/p/selenium/wiki/JsonWireProtocol - */ - getId(): webdriver.promise.Promise - - /** - * Schedules a command to retrieve the inner HTML of this element. - * @return {!webdriver.promise.Promise} A promise that will be resolved with the - * element's inner HTML. - */ - getInnerHtml(): webdriver.promise.Promise; - } - - interface LocatorWithColumn extends webdriver.Locator { - column(index: number): webdriver.Locator; - column(name: string): webdriver.Locator; - } - - interface RepeaterLocator extends LocatorWithColumn { - row(index: number): LocatorWithColumn; - } - - interface IProtractorLocatorStrategy { - /** - * webdriver's By is an enum of locator functions, so we must set it to - * a prototype before inheriting from it. - */ - className: typeof webdriver.By.className; - css: typeof webdriver.By.css; - id: typeof webdriver.By.id; - linkText: typeof webdriver.By.linkText; - js: typeof webdriver.By.js; - name: typeof webdriver.By.name; - partialLinkText: typeof webdriver.By.partialLinkText; - tagName: typeof webdriver.By.tagName; - xpath: typeof webdriver.By.xpath; - - /** - * Add a locator to this instance of ProtractorBy. This locator can then be - * used with element(by.locatorName(args)). - * - * @view - * - * - * @example - * // Add the custom locator. - * by.addLocator('buttonTextSimple', - * function(buttonText, opt_parentElement, opt_rootSelector) { - * // This function will be serialized as a string and will execute in the - * // browser. The first argument is the text for the button. The second - * // argument is the parent element, if any. - * var using = opt_parentElement, - * buttons = using.querySelectorAll('button'); - * - * // Return an array of buttons with the text. - * return Array.prototype.filter.call(buttons, function(button) { - * return button.textContent === buttonText; - * }); - * }); - * - * // Use the custom locator. - * element(by.buttonTextSimple('Go!')).click(); - * - * @alias by.addLocator(locatorName, functionOrScript) - * @param {string} name The name of the new locator. - * @param {Function|string} script A script to be run in the context of - * the browser. This script will be passed an array of arguments - * that contains any args passed into the locator followed by the - * element scoping the search and the css selector for the root angular - * element. It should return an array of elements. - */ - addLocator(name: string, script: string): void; - addLocator(name: string, script: Function): void; - - /** - * Find an element by binding. - * - * @view - * {{person.name}} - * - * - * @example - * var span1 = element(by.binding('person.name')); - * expect(span1.getText()).toBe('Foo'); - * - * var span2 = element(by.binding('person.email')); - * expect(span2.getText()).toBe('foo@bar.com'); - * - * @param {string} bindingDescriptor - * @return {{findElementsOverride: findElementsOverride, toString: Function|string}} - */ - binding(bindingDescriptor: string): webdriver.Locator; - - /** - * Find an element by exact binding. - * - * @view - * {{ person.name }} - * - * {{person_phone|uppercase}} - * - * @example - * expect(element(by.exactBinding('person.name')).isPresent()).toBe(true); - * expect(element(by.exactBinding('person-email')).isPresent()).toBe(true); - * expect(element(by.exactBinding('person')).isPresent()).toBe(false); - * expect(element(by.exactBinding('person_phone')).isPresent()).toBe(true); - * expect(element(by.exactBinding('person_phone|uppercase')).isPresent()).toBe(true); - * expect(element(by.exactBinding('phone')).isPresent()).toBe(false); - * - * @param {string} bindingDescriptor - * @return {{findElementsOverride: findElementsOverride, toString: Function|string}} - */ - exactBinding(bindingDescriptor: string): webdriver.Locator; - - /** - * Find an element by ng-model expression. - * - * @alias by.model(modelName) - * @view - * - * - * @example - * var input = element(by.model('person.name')); - * input.sendKeys('123'); - * expect(input.getAttribute('value')).toBe('Foo123'); - * - * @param {string} model ng-model expression. - */ - model(model: string): webdriver.Locator; - - /** - * Find a button by text. - * - * @view - * - * - * @example - * element(by.buttonText('Save')); - * - * @param {string} searchText - * @return {{findElementsOverride: findElementsOverride, toString: Function|string}} - */ - buttonText(searchText: string): webdriver.Locator; - - /** - * Find a button by partial text. - * - * @view - * - * - * @example - * element(by.partialButtonText('Save')); - * - * @param {string} searchText - * @return {{findElementsOverride: findElementsOverride, toString: Function|string}} - */ - partialButtonText(searchText: string): webdriver.Locator; - - - /** - * Find elements inside an ng-repeat. - * - * @view - *
- * {{cat.name}} - * {{cat.age}} - *
- * - *
- * {{$index}} - *
- *
- *

{{book.name}}

- *

{{book.blurb}}

- *
- * - * @example - * // Returns the DIV for the second cat. - * var secondCat = element(by.repeater('cat in pets').row(1)); - * - * // Returns the SPAN for the first cat's name. - * var firstCatName = element(by.repeater('cat in pets'). - * row(0).column('{{cat.name}}')); - * - * // Returns a promise that resolves to an array of WebElements from a column - * var ages = element.all( - * by.repeater('cat in pets').column('{{cat.age}}')); - * - * // Returns a promise that resolves to an array of WebElements containing - * // all top level elements repeated by the repeater. For 2 pets rows resolves - * // to an array of 2 elements. - * var rows = element.all(by.repeater('cat in pets')); - * - * // Returns a promise that resolves to an array of WebElements containing all - * // the elements with a binding to the book's name. - * var divs = element.all(by.repeater('book in library').column('book.name')); - * - * // Returns a promise that resolves to an array of WebElements containing - * // the DIVs for the second book. - * var bookInfo = element.all(by.repeater('book in library').row(1)); - * - * // Returns the H4 for the first book's name. - * var firstBookName = element(by.repeater('book in library'). - * row(0).column('{{book.name}}')); - * - * // Returns a promise that resolves to an array of WebElements containing - * // all top level elements repeated by the repeater. For 2 books divs - * // resolves to an array of 4 elements. - * var divs = element.all(by.repeater('book in library')); - */ - repeater(repeatDescriptor: string): RepeaterLocator; - - /** - * Find elements by CSS which contain a certain string. - * - * @view - *
    - *
  • Dog
  • - *
  • Cat
  • - *
- * - * @example - * // Returns the DIV for the dog, but not cat. - * var dog = element(by.cssContainingText('.pet', 'Dog')); - */ - cssContainingText(cssSelector: string, searchText: string): webdriver.Locator; - - /** - * Find an element by ng-options expression. - * - * @alias by.options(optionsDescriptor) - * @view - * - * - * @example - * var allOptions = element.all(by.options('c for c in colors')); - * expect(allOptions.count()).toEqual(2); - * var firstOption = allOptions.first(); - * expect(firstOption.getText()).toEqual('red'); - * - * @param {string} optionsDescriptor ng-options expression. - */ - options(optionsDescriptor: string): webdriver.Locator; - } - - var By: IProtractorLocatorStrategy; - - interface Protractor extends webdriver.WebDriver { - - /** - * The wrapped webdriver instance. Use this to interact with pages that do - * not contain Angular (such as a log-in screen). - * - * @type {webdriver.WebDriver} - */ - driver: webdriver.WebDriver; - - /** - * Helper function for finding elements. - * - * @type {function(webdriver.Locator): ElementFinder} - */ - element(locator: webdriver.Locator): ElementFinder; - - /** - * Shorthand function for finding elements by css. - * - * @type {function(string): ElementFinder} - */ - $(selector: string): ElementFinder; - - /** - * Shorthand function for finding arrays of elements by css. - * - * @type {function(string): ElementArrayFinder} - */ - $$(selector: string): ElementArrayFinder; - - /** - * All get methods will be resolved against this base URL. Relative URLs are = - * resolved the way anchor tags resolve. - * - * @type {string} - */ - baseUrl: string; - - /** - * The css selector for an element on which to find Angular. This is usually - * 'body' but if your ng-app is on a subsection of the page it may be - * a subelement. - * - * @type {string} - */ - rootEl: string; - - /** - * If true, Protractor will not attempt to synchronize with the page before - * performing actions. This can be harmful because Protractor will not wait - * until $timeouts and $http calls have been processed, which can cause - * tests to become flaky. This should be used only when necessary, such as - * when a page continuously polls an API using $timeout. - * - * @type {boolean} - */ - ignoreSynchronization: boolean; - - /** - * Timeout in milliseconds to wait for pages to load when calling `get`. - * - * @type {number} - */ - getPageTimeout: number; - - /** - * An object that holds custom test parameters. - * - * @type {Object} - */ - params: any; - - /** - * The reset URL to use between page loads. - * - * @type {string} - */ - resetUrl: string; - - /** - * Instruct webdriver to wait until Angular has finished rendering and has - * no outstanding $http calls before continuing. - * - * @return {!webdriver.promise.Promise} A promise that will resolve to the - * scripts return value. - */ - waitForAngular(): webdriver.promise.Promise; - - /** - * Add a module to load before Angular whenever Protractor.get is called. - * Modules will be registered after existing modules already on the page, - * so any module registered here will override preexisting modules with the same - * name. - * - * @example - * browser.addMockModule('modName', function() { - * angular.module('modName', []).value('foo', 'bar'); - * }); - * - * @param {!string} name The name of the module to load or override. - * @param {!string|Function} script The JavaScript to load the module. - * @param {...*} varArgs Any additional arguments will be provided to - * the script and may be referenced using the `arguments` object. - */ - addMockModule(name: string, script: string, ...varArgs: any[]): void; - addMockModule(name: string, script: Function, ...varArgs: any[]): void; - - /** - * Clear the list of registered mock modules. - */ - clearMockModules(): void; - - /** - * Remove a registered mock module. - * - * @example - * browser.removeMockModule('modName'); - * - * @param {!string} name The name of the module to remove. - */ - removeMockModule(name: string): void; - - /** - * @see webdriver.WebDriver.get - * - * Navigate to the given destination and loads mock modules before - * Angular. Assumes that the page being loaded uses Angular. - * If you need to access a page which does not have Angular on load, use - * the wrapped webdriver directly. - * - * @param {string} destination Destination URL. - * @param {number=} opt_timeout Number of milliseconds to wait for Angular to - * start. - */ - get(destination: string, opt_timeout?: number): webdriver.promise.Promise; - - /** - * See webdriver.WebDriver.refresh - * - * Makes a full reload of the current page and loads mock modules before - * Angular. Assumes that the page being loaded uses Angular. - * If you need to access a page which does not have Angular on load, use - * the wrapped webdriver directly. - * - * @param {number=} opt_timeout Number of seconds to wait for Angular to start. - */ - refresh(opt_timeout?: number): webdriver.promise.Promise; - - /** - * Browse to another page using in-page navigation. - * - * @param {string} url In page URL using the same syntax as $location.url() - * @returns {!webdriver.promise.Promise} A promise that will resolve once - * page has been changed. - */ - setLocation(url: string): webdriver.promise.Promise; - - /** - * Returns the current absolute url from AngularJS. - */ - getLocationAbsUrl(): webdriver.promise.Promise; - - /** - * Pauses the test and injects some helper functions into the browser, so that - * debugging may be done in the browser console. - * - * This should be used under node in debug mode, i.e. with - * protractor debug - * - * @example - * While in the debugger, commands can be scheduled through webdriver by - * entering the repl: - * debug> repl - * Press Ctrl + C to leave rdebug repl - * > ptor.findElement(protractor.By.input('user').sendKeys('Laura')); - * > ptor.debugger(); - * debug> c - * - * This will run the sendKeys command as the next task, then re-enter the - * debugger. - */ - debugger(): void; - - /** - * Beta (unstable) pause function for debugging webdriver tests. Use - * browser.pause() in your test to enter the protractor debugger from that - * point in the control flow. - * Does not require changes to the command line (no need to add 'debug'). - * - * @example - * element(by.id('foo')).click(); - * browser.pause(); - * // Execution will stop before the next click action. - * element(by.id('bar')).click(); - * - * @param {number=} opt_debugPort Optional port to use for the debugging process - */ - pause(opt_debugPort?: number): void; - } - - // Interface for the global browser object. - interface IBrowser extends Protractor { - /** - * Fork another instance of protractor for use in interactive tests. - * - * @param {boolean} opt_useSameUrl Whether to navigate to current url on creation - * @param {boolean} opt_copyMockModules Whether to apply same mock modules on creation - * @return {Protractor} a protractor instance. - */ - forkNewDriverInstance(opt_useSameUrl?: boolean, opt_copyMockModules?: boolean): Protractor; - - /** - * Get the processed configuration object that is currently being run. This will contain - * the specs and capabilities properties of the current runner instance. - * - * Set by the runner. - * - * @return {webdriver.promise.Promise} A promise which resolves to the capabilities object. - */ - getProcessedConfig(): webdriver.promise.Promise; - } - - /** - * Create a new instance of Protractor by wrapping a webdriver instance. - * - * @param {webdriver.WebDriver} webdriver The configured webdriver instance. - * @param {string=} opt_baseUrl A URL to prepend to relative gets. - * @return {Protractor} - */ - function wrapDriver(webdriver: webdriver.WebDriver, opt_baseUrl?: string, opt_rootElement?: string): Protractor; -} - -interface cssSelectorHelper { - (cssLocator: string): protractor.ElementFinder; -} - -interface cssArraySelectorHelper { - (cssLocator: string): protractor.ElementArrayFinder; -} - -declare var browser: protractor.IBrowser; -declare var by: protractor.IProtractorLocatorStrategy; -declare var By: protractor.IProtractorLocatorStrategy; -declare var element: protractor.Element; -declare var $: cssSelectorHelper; -declare var $$: cssArraySelectorHelper; - -declare module 'protractor' { - export = protractor; -} diff --git a/protractor/package.json b/protractor/package.json deleted file mode 100644 index 55eddeb1c7..0000000000 --- a/protractor/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "@types/selenium-webdriver": "~2.44.28" - } -} diff --git a/protractor/tsconfig.json b/protractor/tsconfig.json deleted file mode 100644 index 46e32cb409..0000000000 --- a/protractor/tsconfig.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "noImplicitAny": true, - "strictNullChecks": false, - "baseUrl": "../", - "types": ["selenium-webdriver"], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "angular-protractor-tests.ts" - ] -} diff --git a/selenium-webdriver/index.d.ts b/selenium-webdriver/index.d.ts index bda0820ab5..b585ac5b0d 100644 --- a/selenium-webdriver/index.d.ts +++ b/selenium-webdriver/index.d.ts @@ -2496,8 +2496,7 @@ declare namespace webdriver { * @param {ControlFlow=} opt_flow The control flow * this instance was created under. Defaults to the currently active flow. */ - constructor(resolver: (onFulfilled: IFulfilledCallback, onRejected: IRejectedCallback)=>void, opt_flow?: ControlFlow); - constructor(); // For angular-protractor/angular-protractor-tests.ts + constructor(resolver: (resolve: IFulfilledCallback, reject: IRejectedCallback)=>void, opt_flow?: ControlFlow); //region Methods diff --git a/selenium-webdriver/selenium-webdriver-tests.ts b/selenium-webdriver/selenium-webdriver-tests.ts index fa0b0a386e..d2e94c6b42 100644 --- a/selenium-webdriver/selenium-webdriver-tests.ts +++ b/selenium-webdriver/selenium-webdriver-tests.ts @@ -1047,14 +1047,14 @@ function TestPromiseClass() { var controlFlow: webdriver.promise.ControlFlow; var promise: webdriver.promise.Promise; promise = new webdriver.promise.Promise(function( - onFulfilled: (value: string)=>void, - onRejected: ()=>void) { }); + resolve: (value: string)=>void, + reject: ()=>void) { }); promise = new webdriver.promise.Promise(function( - onFulfilled: (value: webdriver.promise.Promise)=>void, - onRejected: ()=>void) { }); + resolve: (value: webdriver.promise.Promise)=>void, + reject: ()=>void) { }); promise = new webdriver.promise.Promise(function( - onFulfilled: (value: string)=>void, - onRejected: ()=>void) { }, controlFlow); + resolve: (value: string)=>void, + reject: ()=>void) { }, controlFlow); promise.cancel('Abort'); @@ -1071,7 +1071,9 @@ function TestPromiseClass() { } function TestThenableClass() { - var thenable: webdriver.promise.Promise = new webdriver.promise.Promise(); + var thenable: webdriver.promise.Promise = new webdriver.promise.Promise((resolve, reject) => { + resolve("a"); + }); thenable.cancel('Abort'); @@ -1115,7 +1117,7 @@ function TestErrorCode() { errorCode = new webdriver.error.UnsupportedOperationError().code(); } async function TestAsyncAwaitable() { - var thenable: webdriver.promise.Promise = new webdriver.promise.Promise(); + var thenable: webdriver.promise.Promise = new webdriver.promise.Promise((resolve, reject) => resolve('foo')); var str: string = await thenable; } From fae5774ce688d310c5b3311a0eeae67bed48e47d Mon Sep 17 00:00:00 2001 From: Tom Wanzek Date: Mon, 7 Nov 2016 15:26:51 -0500 Subject: [PATCH 160/246] Upgrade d3 to version 4.3 (#12534) * [Chore]: Bump minor version number in definitons header * [Chore]: Bump minor version of `@types/d3-geo` dependency in package.json to 1.3 * [Chore]: Bump minor version of `@types/d3-voronoi` dependency in package.json to 1.1 --- d3/index.d.ts | 2 +- d3/package.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/d3/index.d.ts b/d3/index.d.ts index 0fb15d3a76..bb5fb17b96 100644 --- a/d3/index.d.ts +++ b/d3/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for D3JS d3 standard bundle v4.2 +// Type definitions for D3JS d3 standard bundle v4.3 // Project: https://github.com/d3/d3 // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/d3/package.json b/d3/package.json index 2eeba93e38..e06dc77245 100644 --- a/d3/package.json +++ b/d3/package.json @@ -12,7 +12,7 @@ "@types/d3-ease": "1.0", "@types/d3-force": "1.0", "@types/d3-format": "1.0", - "@types/d3-geo": "1.2", + "@types/d3-geo": "1.3", "@types/d3-hierarchy": "1.0", "@types/d3-interpolate": "1.1", "@types/d3-path": "1.0", @@ -28,7 +28,7 @@ "@types/d3-time-format": "2.0", "@types/d3-timer": "1.0", "@types/d3-transition": "1.0", - "@types/d3-voronoi": "1.0", + "@types/d3-voronoi": "1.1", "@types/d3-zoom": "1.0" } } From 8b403021835240c203d323f848b5fb104fd1d20f Mon Sep 17 00:00:00 2001 From: e-cloud Date: Fri, 4 Nov 2016 09:34:46 +0800 Subject: [PATCH 161/246] fix: update version number for source-map --- source-map/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source-map/index.d.ts b/source-map/index.d.ts index dfddb63e27..d7da94ff75 100644 --- a/source-map/index.d.ts +++ b/source-map/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for source-map v0.1.38 +// Type definitions for source-map v0.5.6 // Project: https://github.com/mozilla/source-map // Definitions by: Morten Houston Ludvigsen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 78098d48dfe83939979f1d8b9d3f310f68335460 Mon Sep 17 00:00:00 2001 From: e-cloud Date: Tue, 8 Nov 2016 11:07:53 +0800 Subject: [PATCH 162/246] fix: more accurate types and corresponding tests --- source-map/index.d.ts | 6 +++--- source-map/source-map-tests.ts | 13 +++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/source-map/index.d.ts b/source-map/index.d.ts index d7da94ff75..8b8f800c85 100644 --- a/source-map/index.d.ts +++ b/source-map/index.d.ts @@ -58,7 +58,7 @@ declare namespace SourceMap { public static GENERATED_ORDER: number; public static ORIGINAL_ORDER: number; - constructor(rawSourceMap: RawSourceMap); + constructor(rawSourceMap: RawSourceMap | string); public computeColumnSpans(): void; @@ -115,9 +115,9 @@ declare namespace SourceMap { relativePath?: string ): SourceNode; - public add(chunk: any): SourceNode; + public add(chunk: (string | SourceNode)[] | SourceNode | string): SourceNode; - public prepend(chunk: any): SourceNode; + public prepend(chunk: (string | SourceNode)[] | SourceNode | string): SourceNode; public setSourceContent(sourceFile: string, sourceContent: string): void; diff --git a/source-map/source-map-tests.ts b/source-map/source-map-tests.ts index 23722d8179..4e584d2338 100644 --- a/source-map/source-map-tests.ts +++ b/source-map/source-map-tests.ts @@ -14,6 +14,15 @@ function testSourceMapConsumer() { file: 'sdf' }); + scm = new SourceMap.SourceMapConsumer(JSON.stringify({ + version: 3, + sources: ['foo', 'bar'], + names: ['foo', 'bar'], + sourcesContent: ['foo'], + mappings: 'foo', + file: 'sdf' + })); + // create with partial RawSourceMap scm = new SourceMap.SourceMapConsumer({ version: 3, @@ -129,10 +138,14 @@ function testSourceNode() { function testAdd(node: SourceMap.SourceNode) { node.add('foo'); + node.add(new SourceMap.SourceNode()); + node.add([new SourceMap.SourceNode(), 'bar']); } function testPrepend(node: SourceMap.SourceNode) { node.prepend('foo'); + node.prepend(new SourceMap.SourceNode()); + node.prepend([new SourceMap.SourceNode(), 'bar']); } function testSetSourceContent(node: SourceMap.SourceNode) { From d59071ff079c895986b4b761421a53874e0c3085 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Mon, 7 Nov 2016 21:09:10 -0800 Subject: [PATCH 163/246] Decomposed 'winston' into a var/namespace/type so it can export a member named 'default'. --- winston/index.d.ts | 590 +++++++++++++++++++++++---------------------- 1 file changed, 298 insertions(+), 292 deletions(-) diff --git a/winston/index.d.ts b/winston/index.d.ts index 1db5b33c32..67c37f1352 100644 --- a/winston/index.d.ts +++ b/winston/index.d.ts @@ -11,330 +11,336 @@ /// Winston v2.2.x ///****************** +declare var winston: Winston; +export = winston; -export declare var transports: Transports; -export declare var Transport: TransportStatic; -export declare var Logger: LoggerStatic; -export declare var Container: ContainerStatic; -export declare var loggers: ContainerInstance; -export declare var defaultLogger: LoggerInstance; +interface Winston { + transports: winston.Transports; + Transport: winston.TransportStatic; + Logger: winston.LoggerStatic; + Container: winston.ContainerStatic; + loggers: winston.ContainerInstance; + defaultLogger: winston.LoggerInstance; -export declare var exception: Exception; + exception: winston.Exception; -export declare var exitOnError: boolean; -export declare var level: string; + exitOnError: boolean; + level: string; -export declare var log: LogMethod; + log: winston.LogMethod; -export declare var debug: LeveledLogMethod; -export declare var info: LeveledLogMethod; -export declare var warn: LeveledLogMethod; -export declare var error: LeveledLogMethod; + debug: winston.LeveledLogMethod; + info: winston.LeveledLogMethod; + warn: winston.LeveledLogMethod; + error: winston.LeveledLogMethod; -export declare function query(options: QueryOptions, callback?: (err: Error, results: any) => void): any; -export declare function query(callback: (err: Error, results: any) => void): any; -export declare function stream(options?: any): NodeJS.ReadableStream; -export declare function handleExceptions(...transports: TransportInstance[]): void; -export declare function unhandleExceptions(...transports: TransportInstance[]): void; -export declare function add(transport: TransportInstance, options?: TransportOptions, created?: boolean): LoggerInstance; -export declare function clear(): void; -export declare function remove(transport: string): LoggerInstance; -export declare function remove(transport: TransportInstance): LoggerInstance; -export declare function startTimer(): ProfileHandler; -export declare function profile(id: string, msg?: string, meta?: any, callback?: (err: Error, level: string, msg: string, meta: any) => void): LoggerInstance; -export declare function addColors(target: any): any; -export declare function setLevels(target: any): any; -export declare function cli(): LoggerInstance; -export declare function close(): void; - export function configure(options: LoggerOptions): void; - -export interface ExceptionProcessInfo { - pid: number; - uid?: number; - gid?: number; - cwd: string; - execPath: string; - version: string; - argv: string; - memoryUsage: NodeJS.MemoryUsage; -} - -export interface ExceptionOsInfo { - loadavg: [number, number, number]; - uptime: number; -} - -export interface ExceptionTrace { - column: number; - file: string; - "function": string; - line: number; - method: string; - native: boolean; -} - -export interface ExceptionAllInfo { - date: Date; - process: ExceptionProcessInfo; - os: ExceptionOsInfo; - trace: Array; - stack: Array; -} - -export interface Exception { - getAllInfo(err: Error): ExceptionAllInfo; - getProcessInfo(): ExceptionProcessInfo; - getOsInfo(): ExceptionOsInfo; - getTrace(err: Error): Array; -} - -export interface MetadataRewriter { - (level: string, msg: string, meta: any): any; -} - -export interface MetadataFilter { - (level: string, msg: string, meta: any): string | { msg: any; meta: any; }; -} - -export interface LoggerStatic { - new (options?: LoggerOptions): LoggerInstance; -} - -export interface LoggerInstance extends NodeJS.EventEmitter { - rewriters: Array; - filters: Array; - transports: Array; - - extend(target: any): LoggerInstance; - - log: LogMethod; - - debug: LeveledLogMethod; - info: LeveledLogMethod; - warn: LeveledLogMethod; - error: LeveledLogMethod; - - query(options: QueryOptions, callback?: (err: Error, results: any) => void): any; + query(options: winston.QueryOptions, callback?: (err: Error, results: any) => void): any; query(callback: (err: Error, results: any) => void): any; stream(options?: any): NodeJS.ReadableStream; - close(): void; - handleExceptions(...transports: TransportInstance[]): void; - unhandleExceptions(...transports: TransportInstance[]): void; - add(transport: TransportInstance, options?: TransportOptions, created?: boolean): LoggerInstance; + handleExceptions(...transports: winston.TransportInstance[]): void; + unhandleExceptions(...transports: winston.TransportInstance[]): void; + add(transport: winston.TransportInstance, options?: winston.TransportOptions, created?: boolean): winston.LoggerInstance; clear(): void; - remove(transport: TransportInstance): LoggerInstance; - startTimer(): ProfileHandler; - profile(id: string, msg?: string, meta?: any, callback?: (err: Error, level: string, msg: string, meta: any) => void): LoggerInstance; - configure(options: LoggerOptions): void; + remove(transport: string): winston.LoggerInstance; + remove(transport: winston.TransportInstance): winston.LoggerInstance; + startTimer(): winston.ProfileHandler; + profile(id: string, msg?: string, meta?: any, callback?: (err: Error, level: string, msg: string, meta: any) => void): winston.LoggerInstance; + addColors(target: any): any; setLevels(target: any): any; - cli(): LoggerInstance; - - level: string; -} - -export interface LoggerOptions { - transports?: TransportInstance[]; - rewriters?: TransportInstance[]; - exceptionHandlers?: TransportInstance[]; - handleExceptions?: boolean; - - /** - * @type {(boolean|(err: Error) => void)} - */ - exitOnError?: any; - - // TODO: Need to make instances specific, - // and need to get options for each instance. - // Unfortunately, the documentation is unhelpful. - [optionName: string]: any; -} - -export interface TransportStatic { - new (options?: TransportOptions): TransportInstance; -} - -export interface TransportInstance extends TransportStatic, NodeJS.EventEmitter { - formatQuery(query: (string | Object)): (string | Object); - normalizeQuery(options: QueryOptions): QueryOptions; - formatResults(results: (Object | Array), options?: Object): (Object | Array); - logException(msg: string, meta: Object, callback: () => void): void; -} - -export interface ConsoleTransportInstance extends TransportInstance { - new (options?: ConsoleTransportOptions): ConsoleTransportInstance; -} - -export interface DailyRotateFileTransportInstance extends TransportInstance { - new (options?: DailyRotateFileTransportOptions): DailyRotateFileTransportInstance; -} - -export interface FileTransportInstance extends TransportInstance { - new (options?: FileTransportOptions): FileTransportInstance; + cli(): winston.LoggerInstance; close(): void; + configure(options: winston.LoggerOptions): void; } -export interface HttpTransportInstance extends TransportInstance { - new (options?: HttpTransportOptions): HttpTransportInstance; -} +declare namespace winston { + export interface ExceptionProcessInfo { + pid: number; + uid?: number; + gid?: number; + cwd: string; + execPath: string; + version: string; + argv: string; + memoryUsage: NodeJS.MemoryUsage; + } -export interface MemoryTransportInstance extends TransportInstance { - new (options?: MemoryTransportOptions): MemoryTransportInstance; -} + export interface ExceptionOsInfo { + loadavg: [number, number, number]; + uptime: number; + } -export interface WebhookTransportInstance extends TransportInstance { - new (options?: WebhookTransportOptions): WebhookTransportInstance; -} + export interface ExceptionTrace { + column: number; + file: string; + "function": string; + line: number; + method: string; + native: boolean; + } -export interface WinstonModuleTrasportInstance extends TransportInstance { - new (options?: WinstonModuleTransportOptions): WinstonModuleTrasportInstance; -} + export interface ExceptionAllInfo { + date: Date; + process: ExceptionProcessInfo; + os: ExceptionOsInfo; + trace: Array; + stack: Array; + } -export interface ContainerStatic { - new (options: LoggerOptions): ContainerInstance; -} + export interface Exception { + getAllInfo(err: Error): ExceptionAllInfo; + getProcessInfo(): ExceptionProcessInfo; + getOsInfo(): ExceptionOsInfo; + getTrace(err: Error): Array; + } -export interface ContainerInstance extends ContainerStatic { - get(id: string, options?: LoggerOptions): LoggerInstance; - add(id: string, options: LoggerOptions): LoggerInstance; - has(id: string): boolean; - close(id: string): void; - options: LoggerOptions; - loggers: any; - default: LoggerOptions; -} + export interface MetadataRewriter { + (level: string, msg: string, meta: any): any; + } -export interface Transports { - File: FileTransportInstance; - Console: ConsoleTransportInstance; - Loggly: WinstonModuleTrasportInstance; - DailyRotateFile: DailyRotateFileTransportInstance; - Http: HttpTransportInstance; - Memory: MemoryTransportInstance; - Webhook: WebhookTransportInstance; -} + export interface MetadataFilter { + (level: string, msg: string, meta: any): string | { msg: any; meta: any; }; + } -export type TransportOptions = ConsoleTransportOptions | DailyRotateFileTransportOptions | FileTransportOptions | HttpTransportOptions | MemoryTransportOptions | WebhookTransportOptions | WinstonModuleTransportOptions; + export interface LoggerStatic { + new (options?: LoggerOptions): LoggerInstance; + } -export interface GenericTransportOptions { - level?: string; - silent?: boolean; - raw?: boolean; - name?: string; - formatter?: Function; - handleExceptions?: boolean; - exceptionsLevel?: string; - humanReadableUnhandledException?: boolean; -} + export interface LoggerInstance extends NodeJS.EventEmitter { + rewriters: Array; + filters: Array; + transports: Array; -export interface GenericTextTransportOptions { - json?: boolean; - colorize?: boolean; - colors?: any; - prettyPrint?: boolean; - timestamp?: (Function | boolean); - showLevel?: boolean; - label?: string; - depth?: number; - stringify?: Function; -} + extend(target: any): LoggerInstance; -export interface GenericNetworkTransportOptions { - host?: string; - port?: number; - auth?: { - username: string; - password: string; - }; - path?: string; -} + log: LogMethod; -export interface ConsoleTransportOptions extends GenericTransportOptions, GenericTextTransportOptions { - logstash?: boolean; - debugStdout?: boolean; -} + debug: LeveledLogMethod; + info: LeveledLogMethod; + warn: LeveledLogMethod; + error: LeveledLogMethod; -export interface DailyRotateFileTransportOptions extends GenericTransportOptions, GenericTextTransportOptions { - logstash?: boolean; - maxsize?: number; - maxFiles?: number; - eol?: string; - maxRetries?: number; - datePattern?: string; - filename?: string; - dirname?: string; - options?: { - flags?: string; - highWaterMark?: number; - }; - stream?: NodeJS.WritableStream; -} + query(options: QueryOptions, callback?: (err: Error, results: any) => void): any; + query(callback: (err: Error, results: any) => void): any; + stream(options?: any): NodeJS.ReadableStream; + close(): void; + handleExceptions(...transports: TransportInstance[]): void; + unhandleExceptions(...transports: TransportInstance[]): void; + add(transport: TransportInstance, options?: TransportOptions, created?: boolean): LoggerInstance; + clear(): void; + remove(transport: TransportInstance): LoggerInstance; + startTimer(): ProfileHandler; + profile(id: string, msg?: string, meta?: any, callback?: (err: Error, level: string, msg: string, meta: any) => void): LoggerInstance; + configure(options: LoggerOptions): void; + setLevels(target: any): any; + cli(): LoggerInstance; -export interface FileTransportOptions extends GenericTransportOptions, GenericTextTransportOptions { - logstash?: boolean; - maxsize?: number; - rotationFormat?: boolean; - zippedArchive?: boolean; - maxFiles?: number; - eol?: string; - tailable?: boolean; - maxRetries?: number; - filename?: string; - dirname?: string; - options?: { - flags?: string; - highWaterMark?: number; - }; - stream?: NodeJS.WritableStream; -} + level: string; + } -export interface HttpTransportOptions extends GenericTransportOptions, GenericNetworkTransportOptions { - ssl?: boolean; -} + export interface LoggerOptions { + transports?: TransportInstance[]; + rewriters?: TransportInstance[]; + exceptionHandlers?: TransportInstance[]; + handleExceptions?: boolean; -export interface MemoryTransportOptions extends GenericTransportOptions, GenericTextTransportOptions { -} + /** + * @type {(boolean|(err: Error) => void)} + */ + exitOnError?: any; -export interface WebhookTransportOptions extends GenericTransportOptions, GenericNetworkTransportOptions { - method?: string; - ssl?: { - key?: any; - cert?: any; - ca: any; - }; -} + // TODO: Need to make instances specific, + // and need to get options for each instance. + // Unfortunately, the documentation is unhelpful. + [optionName: string]: any; + } -export interface WinstonModuleTransportOptions extends GenericTransportOptions { - [optionName: string]: any; -} + export interface TransportStatic { + new (options?: TransportOptions): TransportInstance; + } -export interface QueryOptions { - rows?: number; - limit?: number; - start?: number; - from?: Date; - until?: Date; - order?: "asc" | "desc"; - fields: any; -} + export interface TransportInstance extends TransportStatic, NodeJS.EventEmitter { + formatQuery(query: (string | Object)): (string | Object); + normalizeQuery(options: QueryOptions): QueryOptions; + formatResults(results: (Object | Array), options?: Object): (Object | Array); + logException(msg: string, meta: Object, callback: () => void): void; + } -export interface ProfileHandler { - logger: LoggerInstance; - start: Date; - done: (msg: string) => LoggerInstance; -} + export interface ConsoleTransportInstance extends TransportInstance { + new (options?: ConsoleTransportOptions): ConsoleTransportInstance; + } -interface LogMethod { - (level: string, msg: string, callback: LogCallback): LoggerInstance; - (level: string, msg: string, meta: any, callback: LogCallback): LoggerInstance; - (level: string, msg: string, ...meta: any[]): LoggerInstance; -} + export interface DailyRotateFileTransportInstance extends TransportInstance { + new (options?: DailyRotateFileTransportOptions): DailyRotateFileTransportInstance; + } -interface LeveledLogMethod { - (msg: string, callback: LogCallback): LoggerInstance; - (msg: string, meta: any, callback: LogCallback): LoggerInstance; - (msg: string, ...meta: any[]): LoggerInstance; -} + export interface FileTransportInstance extends TransportInstance { + new (options?: FileTransportOptions): FileTransportInstance; + close(): void; + } -interface LogCallback { - (error?: any, level?: string, msg?: string, meta?: any): void; -} + export interface HttpTransportInstance extends TransportInstance { + new (options?: HttpTransportOptions): HttpTransportInstance; + } + + export interface MemoryTransportInstance extends TransportInstance { + new (options?: MemoryTransportOptions): MemoryTransportInstance; + } + + export interface WebhookTransportInstance extends TransportInstance { + new (options?: WebhookTransportOptions): WebhookTransportInstance; + } + + export interface WinstonModuleTrasportInstance extends TransportInstance { + new (options?: WinstonModuleTransportOptions): WinstonModuleTrasportInstance; + } + + export interface ContainerStatic { + new (options: LoggerOptions): ContainerInstance; + } + + export interface ContainerInstance extends ContainerStatic { + get(id: string, options?: LoggerOptions): LoggerInstance; + add(id: string, options: LoggerOptions): LoggerInstance; + has(id: string): boolean; + close(id: string): void; + options: LoggerOptions; + loggers: any; + default: LoggerOptions; + } + + export interface Transports { + File: FileTransportInstance; + Console: ConsoleTransportInstance; + Loggly: WinstonModuleTrasportInstance; + DailyRotateFile: DailyRotateFileTransportInstance; + Http: HttpTransportInstance; + Memory: MemoryTransportInstance; + Webhook: WebhookTransportInstance; + } + + export type TransportOptions = ConsoleTransportOptions | DailyRotateFileTransportOptions | FileTransportOptions | HttpTransportOptions | MemoryTransportOptions | WebhookTransportOptions | WinstonModuleTransportOptions; + + export interface GenericTransportOptions { + level?: string; + silent?: boolean; + raw?: boolean; + name?: string; + formatter?: Function; + handleExceptions?: boolean; + exceptionsLevel?: string; + humanReadableUnhandledException?: boolean; + } + + export interface GenericTextTransportOptions { + json?: boolean; + colorize?: boolean; + colors?: any; + prettyPrint?: boolean; + timestamp?: (Function | boolean); + showLevel?: boolean; + label?: string; + depth?: number; + stringify?: Function; + } + + export interface GenericNetworkTransportOptions { + host?: string; + port?: number; + auth?: { + username: string; + password: string; + }; + path?: string; + } + + export interface ConsoleTransportOptions extends GenericTransportOptions, GenericTextTransportOptions { + logstash?: boolean; + debugStdout?: boolean; + } + + export interface DailyRotateFileTransportOptions extends GenericTransportOptions, GenericTextTransportOptions { + logstash?: boolean; + maxsize?: number; + maxFiles?: number; + eol?: string; + maxRetries?: number; + datePattern?: string; + filename?: string; + dirname?: string; + options?: { + flags?: string; + highWaterMark?: number; + }; + stream?: NodeJS.WritableStream; + } + + export interface FileTransportOptions extends GenericTransportOptions, GenericTextTransportOptions { + logstash?: boolean; + maxsize?: number; + rotationFormat?: boolean; + zippedArchive?: boolean; + maxFiles?: number; + eol?: string; + tailable?: boolean; + maxRetries?: number; + filename?: string; + dirname?: string; + options?: { + flags?: string; + highWaterMark?: number; + }; + stream?: NodeJS.WritableStream; + } + + export interface HttpTransportOptions extends GenericTransportOptions, GenericNetworkTransportOptions { + ssl?: boolean; + } + + export interface MemoryTransportOptions extends GenericTransportOptions, GenericTextTransportOptions { + } + + export interface WebhookTransportOptions extends GenericTransportOptions, GenericNetworkTransportOptions { + method?: string; + ssl?: { + key?: any; + cert?: any; + ca: any; + }; + } + + export interface WinstonModuleTransportOptions extends GenericTransportOptions { + [optionName: string]: any; + } + + export interface QueryOptions { + rows?: number; + limit?: number; + start?: number; + from?: Date; + until?: Date; + order?: "asc" | "desc"; + fields: any; + } + + export interface ProfileHandler { + logger: LoggerInstance; + start: Date; + done: (msg: string) => LoggerInstance; + } + + interface LogMethod { + (level: string, msg: string, callback: LogCallback): LoggerInstance; + (level: string, msg: string, meta: any, callback: LogCallback): LoggerInstance; + (level: string, msg: string, ...meta: any[]): LoggerInstance; + } + + interface LeveledLogMethod { + (msg: string, callback: LogCallback): LoggerInstance; + (msg: string, meta: any, callback: LogCallback): LoggerInstance; + (msg: string, ...meta: any[]): LoggerInstance; + } + + interface LogCallback { + (error?: any, level?: string, msg?: string, meta?: any): void; + } +} \ No newline at end of file From a32d7bf9563ddbddde1aeb28eda1597206b0f9fb Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Mon, 7 Nov 2016 21:13:30 -0800 Subject: [PATCH 164/246] Fixed 'winston' to expose a member named 'default'. --- winston/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/winston/index.d.ts b/winston/index.d.ts index 67c37f1352..8a5ef6a687 100644 --- a/winston/index.d.ts +++ b/winston/index.d.ts @@ -20,7 +20,7 @@ interface Winston { Logger: winston.LoggerStatic; Container: winston.ContainerStatic; loggers: winston.ContainerInstance; - defaultLogger: winston.LoggerInstance; + default: winston.LoggerInstance; exception: winston.Exception; From ce87f73b3e87cd86f69945246be26f5dd741db0c Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Mon, 7 Nov 2016 21:13:52 -0800 Subject: [PATCH 165/246] Added a test for the default logger in 'winston'. --- winston/winston-tests.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/winston/winston-tests.ts b/winston/winston-tests.ts index 0b3c9f916b..dae649d1f9 100644 --- a/winston/winston-tests.ts +++ b/winston/winston-tests.ts @@ -265,3 +265,5 @@ var logger: winston.LoggerInstance = new (winston.Logger)({ /* Reconfigure logger */ logger.configure({ level: 'silly' }); + +winston.default.warn("Don't export reserved words in JavaScript!"); From e1a436489d1d8b13d6b2d7e17be5e2cf71f9307b Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Mon, 7 Nov 2016 21:22:42 -0800 Subject: [PATCH 166/246] Moved the 'Winston' interface to the namespace so that it can be augmented. --- winston/index.d.ts | 78 +++++++++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/winston/index.d.ts b/winston/index.d.ts index 8a5ef6a687..6fccfe514c 100644 --- a/winston/index.d.ts +++ b/winston/index.d.ts @@ -11,48 +11,48 @@ /// Winston v2.2.x ///****************** -declare var winston: Winston; +declare var winston: winston.Winston; export = winston; -interface Winston { - transports: winston.Transports; - Transport: winston.TransportStatic; - Logger: winston.LoggerStatic; - Container: winston.ContainerStatic; - loggers: winston.ContainerInstance; - default: winston.LoggerInstance; - - exception: winston.Exception; - - exitOnError: boolean; - level: string; - - log: winston.LogMethod; - - debug: winston.LeveledLogMethod; - info: winston.LeveledLogMethod; - warn: winston.LeveledLogMethod; - error: winston.LeveledLogMethod; - - query(options: winston.QueryOptions, callback?: (err: Error, results: any) => void): any; - query(callback: (err: Error, results: any) => void): any; - stream(options?: any): NodeJS.ReadableStream; - handleExceptions(...transports: winston.TransportInstance[]): void; - unhandleExceptions(...transports: winston.TransportInstance[]): void; - add(transport: winston.TransportInstance, options?: winston.TransportOptions, created?: boolean): winston.LoggerInstance; - clear(): void; - remove(transport: string): winston.LoggerInstance; - remove(transport: winston.TransportInstance): winston.LoggerInstance; - startTimer(): winston.ProfileHandler; - profile(id: string, msg?: string, meta?: any, callback?: (err: Error, level: string, msg: string, meta: any) => void): winston.LoggerInstance; - addColors(target: any): any; - setLevels(target: any): any; - cli(): winston.LoggerInstance; - close(): void; - configure(options: winston.LoggerOptions): void; -} - declare namespace winston { + export interface Winston { + transports: winston.Transports; + Transport: winston.TransportStatic; + Logger: winston.LoggerStatic; + Container: winston.ContainerStatic; + loggers: winston.ContainerInstance; + default: winston.LoggerInstance; + + exception: winston.Exception; + + exitOnError: boolean; + level: string; + + log: winston.LogMethod; + + debug: winston.LeveledLogMethod; + info: winston.LeveledLogMethod; + warn: winston.LeveledLogMethod; + error: winston.LeveledLogMethod; + + query(options: winston.QueryOptions, callback?: (err: Error, results: any) => void): any; + query(callback: (err: Error, results: any) => void): any; + stream(options?: any): NodeJS.ReadableStream; + handleExceptions(...transports: winston.TransportInstance[]): void; + unhandleExceptions(...transports: winston.TransportInstance[]): void; + add(transport: winston.TransportInstance, options?: winston.TransportOptions, created?: boolean): winston.LoggerInstance; + clear(): void; + remove(transport: string): winston.LoggerInstance; + remove(transport: winston.TransportInstance): winston.LoggerInstance; + startTimer(): winston.ProfileHandler; + profile(id: string, msg?: string, meta?: any, callback?: (err: Error, level: string, msg: string, meta: any) => void): winston.LoggerInstance; + addColors(target: any): any; + setLevels(target: any): any; + cli(): winston.LoggerInstance; + close(): void; + configure(options: winston.LoggerOptions): void; + } + export interface ExceptionProcessInfo { pid: number; uid?: number; From 732b0378d8bdef1ce564b38705631f655cb2e3dc Mon Sep 17 00:00:00 2001 From: David Zearing Date: Tue, 8 Nov 2016 05:25:07 -0800 Subject: [PATCH 167/246] Updating capture events + test. (#12327) * Updating capture events + test. * Updating Capture methods to be inlined. * Removing mouse enter/leave captures. --- react/index.d.ts | 65 ++++++++++++++++++++++++++++++++++++++++++++ react/react-tests.ts | 4 +++ 2 files changed, 69 insertions(+) diff --git a/react/index.d.ts b/react/index.d.ts index 5f2477d678..92aa3a03fc 100644 --- a/react/index.d.ts +++ b/react/index.d.ts @@ -436,98 +436,163 @@ declare namespace React { // Clipboard Events onCopy?: ClipboardEventHandler; + onCopyCapture?: ClipboardEventHandler; onCut?: ClipboardEventHandler; + onCutCapture?: ClipboardEventHandler; onPaste?: ClipboardEventHandler; + onPasteCapture?: ClipboardEventHandler; // Composition Events onCompositionEnd?: CompositionEventHandler; + onCompositionEndCapture?: CompositionEventHandler; onCompositionStart?: CompositionEventHandler; + onCompositionStartCapture?: CompositionEventHandler; onCompositionUpdate?: CompositionEventHandler; + onCompositionUpdateCapture?: CompositionEventHandler; // Focus Events onFocus?: FocusEventHandler; + onFocusCapture?: FocusEventHandler; onBlur?: FocusEventHandler; + onBlurCapture?: FocusEventHandler; // Form Events onChange?: FormEventHandler; + onChangeCapture?: FormEventHandler; onInput?: FormEventHandler; + onInputCapture?: FormEventHandler; onSubmit?: FormEventHandler; + onSubmitCapture?: FormEventHandler; // Image Events onLoad?: ReactEventHandler; + onLoadCapture?: ReactEventHandler; onError?: ReactEventHandler; // also a Media Event + onErrorCapture?: ReactEventHandler; // also a Media Event // Keyboard Events onKeyDown?: KeyboardEventHandler; + onKeyDownCapture?: KeyboardEventHandler; onKeyPress?: KeyboardEventHandler; + onKeyPressCapture?: KeyboardEventHandler; onKeyUp?: KeyboardEventHandler; + onKeyUpCapture?: KeyboardEventHandler; // Media Events onAbort?: ReactEventHandler; + onAbortCapture?: ReactEventHandler; onCanPlay?: ReactEventHandler; + onCanPlayCapture?: ReactEventHandler; onCanPlayThrough?: ReactEventHandler; + onCanPlayThroughCapture?: ReactEventHandler; onDurationChange?: ReactEventHandler; + onDurationChangeCapture?: ReactEventHandler; onEmptied?: ReactEventHandler; + onEmptiedCapture?: ReactEventHandler; onEncrypted?: ReactEventHandler; + onEncryptedCapture?: ReactEventHandler; onEnded?: ReactEventHandler; + onEndedCapture?: ReactEventHandler; onLoadedData?: ReactEventHandler; + onLoadedDataCapture?: ReactEventHandler; onLoadedMetadata?: ReactEventHandler; + onLoadedMetadataCapture?: ReactEventHandler; onLoadStart?: ReactEventHandler; + onLoadStartCapture?: ReactEventHandler; onPause?: ReactEventHandler; + onPauseCapture?: ReactEventHandler; onPlay?: ReactEventHandler; + onPlayCapture?: ReactEventHandler; onPlaying?: ReactEventHandler; + onPlayingCapture?: ReactEventHandler; onProgress?: ReactEventHandler; + onProgressCapture?: ReactEventHandler; onRateChange?: ReactEventHandler; + onRateChangeCapture?: ReactEventHandler; onSeeked?: ReactEventHandler; + onSeekedCapture?: ReactEventHandler; onSeeking?: ReactEventHandler; + onSeekingCapture?: ReactEventHandler; onStalled?: ReactEventHandler; + onStalledCapture?: ReactEventHandler; onSuspend?: ReactEventHandler; + onSuspendCapture?: ReactEventHandler; onTimeUpdate?: ReactEventHandler; + onTimeUpdateCapture?: ReactEventHandler; onVolumeChange?: ReactEventHandler; + onVolumeChangeCapture?: ReactEventHandler; onWaiting?: ReactEventHandler; + onWaitingCapture?: ReactEventHandler; // MouseEvents onClick?: MouseEventHandler; + onClickCapture?: MouseEventHandler; onContextMenu?: MouseEventHandler; + onContextMenuCapture?: MouseEventHandler; onDoubleClick?: MouseEventHandler; + onDoubleClickCapture?: MouseEventHandler; onDrag?: DragEventHandler; + onDragCapture?: DragEventHandler; onDragEnd?: DragEventHandler; + onDragEndCapture?: DragEventHandler; onDragEnter?: DragEventHandler; + onDragEnterCapture?: DragEventHandler; onDragExit?: DragEventHandler; + onDragExitCapture?: DragEventHandler; onDragLeave?: DragEventHandler; + onDragLeaveCapture?: DragEventHandler; onDragOver?: DragEventHandler; + onDragOverCapture?: DragEventHandler; onDragStart?: DragEventHandler; + onDragStartCapture?: DragEventHandler; onDrop?: DragEventHandler; + onDropCapture?: DragEventHandler; onMouseDown?: MouseEventHandler; + onMouseDownCapture?: MouseEventHandler; onMouseEnter?: MouseEventHandler; onMouseLeave?: MouseEventHandler; onMouseMove?: MouseEventHandler; + onMouseMoveCapture?: MouseEventHandler; onMouseOut?: MouseEventHandler; + onMouseOutCapture?: MouseEventHandler; onMouseOver?: MouseEventHandler; + onMouseOverCapture?: MouseEventHandler; onMouseUp?: MouseEventHandler; + onMouseUpCapture?: MouseEventHandler; // Selection Events onSelect?: ReactEventHandler; + onSelectCapture?: ReactEventHandler; // Touch Events onTouchCancel?: TouchEventHandler; + onTouchCancelCapture?: TouchEventHandler; onTouchEnd?: TouchEventHandler; + onTouchEndCapture?: TouchEventHandler; onTouchMove?: TouchEventHandler; + onTouchMoveCapture?: TouchEventHandler; onTouchStart?: TouchEventHandler; + onTouchStartCapture?: TouchEventHandler; // UI Events onScroll?: UIEventHandler; + onScrollCapture?: UIEventHandler; // Wheel Events onWheel?: WheelEventHandler; + onWheelCapture?: WheelEventHandler; // Animation Events onAnimationStart?: AnimationEventHandler; + onAnimationStartCapture?: AnimationEventHandler; onAnimationEnd?: AnimationEventHandler; + onAnimationEndCapture?: AnimationEventHandler; onAnimationIteration?: AnimationEventHandler; + onAnimationIterationCapture?: AnimationEventHandler; // Transition Events onTransitionEnd?: TransitionEventHandler; + onTransitionEndCapture?: TransitionEventHandler; } // This interface is not complete. Only properties accepting diff --git a/react/react-tests.ts b/react/react-tests.ts index b033907a79..85bc4c0704 100644 --- a/react/react-tests.ts +++ b/react/react-tests.ts @@ -315,6 +315,10 @@ var htmlAttr: React.HTMLProps = { event.preventDefault(); event.stopPropagation(); }, + onClickCapture: (event: React.MouseEvent<{}>) => { + event.preventDefault(); + event.stopPropagation(); + }, dangerouslySetInnerHTML: { __html: "STRONG" } From 9fbf2bbcd8b64789e3004a83e569a9fb4c0170aa Mon Sep 17 00:00:00 2001 From: Rand Scullard Date: Tue, 8 Nov 2016 08:35:23 -0500 Subject: [PATCH 168/246] node-schedule: Add support for object literal syntax. (#12445) --- node-schedule/index.d.ts | 79 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 74 insertions(+), 5 deletions(-) diff --git a/node-schedule/index.d.ts b/node-schedule/index.d.ts index b4cf431e64..d21f46715d 100644 --- a/node-schedule/index.d.ts +++ b/node-schedule/index.d.ts @@ -214,6 +214,67 @@ export class RecurrenceRule { nextInvocationDate(base:Date):Date; } +/** + * Recurrence rule specification. + */ +export interface RecurrenceSpec { + /** + * Day of the month. + * + * @public + * @type {RecurrenceSegment} + */ + date?: RecurrenceSegment; + + /** + * Day of the week. + * + * @public + * @type {RecurrenceSegment} + */ + dayOfWeek?: RecurrenceSegment; + + /** + * Hour. + * + * @public + * @type {RecurrenceSegment} + */ + hour?: RecurrenceSegment; + + /** + * Minute. + * + * @public + * @type {RecurrenceSegment} + */ + minute?: RecurrenceSegment; + + /** + * Month. + * + * @public + * @type {RecurrenceSegment} + */ + month?: RecurrenceSegment; + + /** + * Second. + * + * @public + * @type {RecurrenceSegment} + */ + second?: RecurrenceSegment; + + /** + * Year. + * + * @public + * @type {RecurrenceSegment} + */ + year?: RecurrenceSegment; +} + /** * Invocation. * @@ -266,11 +327,19 @@ export class Invocation { /** * Create a schedule job. * - * @param {string|RecurrenceRule|Date} name either an optional name for the new Job or scheduling information - * @param {RecurrenceRule|Date|string} rule either the scheduling info or the JobCallback - * @param {JobCallback} callback The callback to be executed on each invocation. + * @param {string} name name for the new Job + * @param {RecurrenceRule|RecurrenceSpec|Date|string} rule scheduling info + * @param {JobCallback} callback callback to be executed on each invocation */ - export function scheduleJob(name:string|RecurrenceRule|Date, rule: RecurrenceRule|Date|string|JobCallback, callback?: JobCallback): Job; + export function scheduleJob(name: string, rule: RecurrenceRule | RecurrenceSpec | Date | string, callback: JobCallback): Job; + +/** + * Create a schedule job. + * + * @param {RecurrenceRule|RecurrenceSpec|Date|string} rule scheduling info + * @param {JobCallback} callback callback to be executed on each invocation + */ + export function scheduleJob(rule: RecurrenceRule | RecurrenceSpec | Date | string, callback: JobCallback): Job; /** * Changes the timing of a Job, canceling all pending invocations. @@ -279,7 +348,7 @@ export class Invocation { * @param spec {JobCallback} the new timing for this Job * @return {Job} if the job could be rescheduled, {null} otherwise. */ - export function rescheduleJob(job:Job|string, spec:RecurrenceRule|Date|string):Job; + export function rescheduleJob(job: Job | string, spec: RecurrenceRule | RecurrenceSpec | Date | string): Job; /** * Dictionary of all Jobs, accessible by name. From b4cd313a9a5cfa016fb8cacebb957c6e41473ce1 Mon Sep 17 00:00:00 2001 From: Stephan Date: Tue, 8 Nov 2016 14:43:32 +0100 Subject: [PATCH 169/246] constructor of Chart also accepts HTMLCanvasElement (#12526) According to http://www.chartjs.org/docs/#getting-started-creating-a-chart the constructor also accepts a HTMLCanvasElement as first argument. --- chart.js/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chart.js/index.d.ts b/chart.js/index.d.ts index 9bf41eeaae..e9186035c7 100644 --- a/chart.js/index.d.ts +++ b/chart.js/index.d.ts @@ -392,7 +392,7 @@ interface RadialLinearScale { } declare class Chart { - constructor (context: CanvasRenderingContext2D, options: ChartConfiguration); + constructor (context: CanvasRenderingContext2D | HTMLCanvasElement, options: ChartConfiguration); config: ChartConfiguration; destroy: () => {}; update: (duration?: any, lazy?: any) => {}; From fd7d42b3f171b183fa86edf3316f56cd87a2d5b2 Mon Sep 17 00:00:00 2001 From: SONIC3D Date: Tue, 8 Nov 2016 21:43:58 +0800 Subject: [PATCH 170/246] [dat-gui]Updated definitions to dat.gui 0.6.1 (#12370) --- dat-gui/index.d.ts | 68 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 54 insertions(+), 14 deletions(-) diff --git a/dat-gui/index.d.ts b/dat-gui/index.d.ts index 5a902b228b..7d1e2147d7 100644 --- a/dat-gui/index.d.ts +++ b/dat-gui/index.d.ts @@ -1,7 +1,7 @@ -// Type definitions for dat.GUI v0.5 +// Type definitions for dat.GUI v0.6.1 // Project: https://github.com/dataarts/dat.gui -// Definitions by: Satoru Kimura -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Definitions by: Satoru Kimura , ZongJing Lu +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace dat { export class GUI { @@ -23,11 +23,40 @@ declare namespace dat { addColor(target: Object, propName:string, rgba: number[]): GUIController; // rgb or rgba addColor(target: Object, propName:string, hsv:{h:number; s:number; v:number}): GUIController; + remove(controller: GUIController): void; + destroy(): void; + addFolder(propName:string): GUI; - close(): void; open(): void; - remember(target: Object): void; + close(): void; + + remember(target: Object, ...additionalTargets: Object[]): void; + getRoot(): GUI; + + getSaveObject(): Object; + save(): void; + saveAs(presetName:string): void; + revert(gui:GUI): void; + + listen(controller: GUIController): void; + updateDisplay(): void; + + // gui properties in dat/gui/GUI.js + parent(): GUI; + scrollable(): boolean; + autoPlace(): boolean; + preset(): string; + preset(s: string): void; + width(): number; + width(n: number): void; + name(): string; + name(s: string): void; + closed(): boolean; + closed(b: boolean): void; + load(): Object; + useLocalStorage(): boolean; + useLocalStorage(b: boolean): void; } export interface GUIParams{ @@ -41,17 +70,28 @@ declare namespace dat { export class GUIController { destroy(): void; - fire(): GUIController; - getValue(): any; - isModified(): boolean; - listen(): GUIController; - min(n: number): GUIController; - remove(target: GUIController): void; - setValue(value: any): GUIController; - step(n: number): GUIController; - updateDisplay(): void; + // Controller onChange: (value?: any) => void; onFinishChange: (value?: any) => void; + + setValue(value: any): GUIController; + getValue(): any; + updateDisplay(): void; + isModified(): boolean; + + // NumberController + min(n: number): GUIController; + max(n: number): GUIController; + step(n: number): GUIController; + + // FunctionController + fire(): GUIController; + + // augmentController in dat/gui/GUI.js + options(option:any):GUIController; + name(s: string): GUIController; + listen(): GUIController; + remove(): GUIController; } } From 374978e36aec5e8f263ed2944cda8f0bfe3801de Mon Sep 17 00:00:00 2001 From: Steve Date: Tue, 8 Nov 2016 13:58:24 +0000 Subject: [PATCH 171/246] Add definitions for trim (#12292) * Add definitions for trim * comments from PR --- trim/index.d.ts | 12 ++++++++++++ trim/trim-tests.ts | 9 +++++++++ trim/tsconfig.json | 19 +++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 trim/index.d.ts create mode 100644 trim/trim-tests.ts create mode 100644 trim/tsconfig.json diff --git a/trim/index.d.ts b/trim/index.d.ts new file mode 100644 index 0000000000..4d9981052e --- /dev/null +++ b/trim/index.d.ts @@ -0,0 +1,12 @@ +// Type definitions for trim 0.01 +// Project: https://www.npmjs.com/package/trim +// Definitions by: Steve Jenkins +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function Trim(str: string): string; +declare namespace Trim { + function left(str: string): string; + function right(str: string): string; +} + +export = Trim; \ No newline at end of file diff --git a/trim/trim-tests.ts b/trim/trim-tests.ts new file mode 100644 index 0000000000..906d2a7b03 --- /dev/null +++ b/trim/trim-tests.ts @@ -0,0 +1,9 @@ +import trim = require("trim"); + +var original: string = " padded string "; + +trim(original); + +trim.left(original); + +trim.right(original); diff --git a/trim/tsconfig.json b/trim/tsconfig.json new file mode 100644 index 0000000000..b063e69e5f --- /dev/null +++ b/trim/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "trim-tests.ts" + ] +} \ No newline at end of file From 1a5687cdc6dddcd436088208d358a655723c4bec Mon Sep 17 00:00:00 2001 From: Endel Dreyer Date: Tue, 8 Nov 2016 14:59:16 +0100 Subject: [PATCH 172/246] EaselJS: add relatedTarget to MouseEvent (#12533) * EaselJS: add propagationStopped and relatedTarget to MouseEvent * remove propagationStopped from MouseEvent it should rather be in createjs-lib.d.ts Event definition --- easeljs/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/easeljs/index.d.ts b/easeljs/index.d.ts index a0dc7b566f..a5916a56f2 100644 --- a/easeljs/index.d.ts +++ b/easeljs/index.d.ts @@ -623,6 +623,7 @@ declare namespace createjs { primary: boolean; rawX: number; rawY: number; + relatedTarget: DisplayObject; stageX: number; stageY: number; mouseMoveOutside: boolean; From 93bb233648560505c01abf9b370e81ae637a0a0f Mon Sep 17 00:00:00 2001 From: Rasmus Prentow Date: Tue, 8 Nov 2016 14:59:28 +0100 Subject: [PATCH 173/246] Added missing method and missing param (#12403) --- google-libphonenumber/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/google-libphonenumber/index.d.ts b/google-libphonenumber/index.d.ts index 937a0d9623..4a0f865373 100644 --- a/google-libphonenumber/index.d.ts +++ b/google-libphonenumber/index.d.ts @@ -20,10 +20,11 @@ declare namespace libphonenumber { parse(number: string, region: string): PhoneNumber; isValidNumber(phoneNumber: PhoneNumber): boolean; isPossibleNumber(phoneNumber: PhoneNumber): boolean; - isValidNumberForRegion(phoneNumber: PhoneNumber): boolean; + isValidNumberForRegion(phoneNumber: PhoneNumber, region: string): boolean; getRegionCodeForNumber(phoneNumber: PhoneNumber): string; isNANPACountry(regionCode: string): boolean; format(phoneNumber: PhoneNumber, format: PhoneNumberFormat): string; + parseAndKeepRawInput(number: string, regionCode: string): PhoneNumber; } export class AsYouTypeFormatter { From 67213581f3e3cf0785e5f1b3703613d17dedeca0 Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 8 Nov 2016 06:05:52 -0800 Subject: [PATCH 174/246] Upgrade packages for types-2.0 (#12539) --- cookiejs/tsconfig.json | 4 ++-- jstimezonedetect/jstimezonedetect-tests.ts | 2 -- jstimezonedetect/tsconfig.json | 19 +++++++++++++++++++ leadfoot/tsconfig.json | 2 +- mz/tsconfig.json | 3 ++- react-json-tree/tsconfig.json | 2 +- 6 files changed, 25 insertions(+), 7 deletions(-) create mode 100644 jstimezonedetect/tsconfig.json diff --git a/cookiejs/tsconfig.json b/cookiejs/tsconfig.json index 49aa749ae4..76d537c57c 100644 --- a/cookiejs/tsconfig.json +++ b/cookiejs/tsconfig.json @@ -5,11 +5,11 @@ "noImplicitAny": true, "strictNullChecks": false, "baseUrl": "../", - "typesSearchPaths": [ + "typeRoots": [ "../" ], + "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true }, "files": [ diff --git a/jstimezonedetect/jstimezonedetect-tests.ts b/jstimezonedetect/jstimezonedetect-tests.ts index c4907aa6b0..9baf0f4aa5 100644 --- a/jstimezonedetect/jstimezonedetect-tests.ts +++ b/jstimezonedetect/jstimezonedetect-tests.ts @@ -1,5 +1,3 @@ -/// - import * as jstz from 'jstimezonedetect'; jstz.determine().name() === 'America/Montreal'; diff --git a/jstimezonedetect/tsconfig.json b/jstimezonedetect/tsconfig.json new file mode 100644 index 0000000000..d036a843d1 --- /dev/null +++ b/jstimezonedetect/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "jstimezonedetect-tests.ts" + ] +} \ No newline at end of file diff --git a/leadfoot/tsconfig.json b/leadfoot/tsconfig.json index cdd1c4b81c..b09d84c423 100644 --- a/leadfoot/tsconfig.json +++ b/leadfoot/tsconfig.json @@ -5,7 +5,7 @@ ], "compilerOptions": { "module": "commonjs", - "target": "es5", + "target": "es6", "noImplicitAny": true, "strictNullChecks": false, "baseUrl": "../", diff --git a/mz/tsconfig.json b/mz/tsconfig.json index 83fafa87ea..7622a546f2 100644 --- a/mz/tsconfig.json +++ b/mz/tsconfig.json @@ -9,7 +9,8 @@ "../" ], "types": [], - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "fs.d.ts", diff --git a/react-json-tree/tsconfig.json b/react-json-tree/tsconfig.json index 3076bbca2e..b1145acf81 100644 --- a/react-json-tree/tsconfig.json +++ b/react-json-tree/tsconfig.json @@ -15,6 +15,6 @@ }, "files": [ "index.d.ts", - "react-json-tree-tests.ts" + "react-json-tree-tests.tsx" ] } From 8f06c382f041b87acc1f6516ed0b9d908ede9658 Mon Sep 17 00:00:00 2001 From: Dan Manastireanu Date: Tue, 8 Nov 2016 16:13:47 +0200 Subject: [PATCH 175/246] Update ChartAnnotations in google.visualization. Closes #11828 (#12362) --- .../google.visualization-tests.ts | 85 ++++++++++++++++++- google.visualization/index.d.ts | 24 +++++- 2 files changed, 105 insertions(+), 4 deletions(-) diff --git a/google.visualization/google.visualization-tests.ts b/google.visualization/google.visualization-tests.ts index 2cbd8220f2..129b0dd971 100644 --- a/google.visualization/google.visualization-tests.ts +++ b/google.visualization/google.visualization-tests.ts @@ -156,10 +156,17 @@ function test_areaChart() { ['2016', 1030, 540] ]); - var options = { + var options:google.visualization.AreaChartOptions = { title: 'Company Performance', hAxis: {title: 'Year', titleTextStyle: {color: '#333'}}, - vAxis: {minValue: 0} + vAxis: {minValue: 0}, + annotations: { + textStyle: { + bold: true, + italic: true, + color: "black" + } + } }; var chart = new google.visualization.AreaChart(document.getElementById('chart_div')); @@ -510,3 +517,77 @@ function test_ChartsLoad() { google.charts.setOnLoadCallback(drawChart); } + + +function test_ChartAnnotations() { + var annotations:google.visualization.ChartAnnotations = { + boxStyle: { + // Color of the box outline. + stroke: '#888', + // Thickness of the box outline. + strokeWidth: 1, + // x-radius of the corner curvature. + rx: 10, + // y-radius of the corner curvature. + ry: 10, + // Attributes for linear gradient fill. + gradient: { + // Start color for gradient. + color1: '#fbf6a7', + // Finish color for gradient. + color2: '#33b679', + // Where on the boundary to start and + // end the color1/color2 gradient, + // relative to the upper left corner + // of the boundary. + x1: '0%', y1: '0%', + x2: '100%', y2: '100%', + // If true, the boundary for x1, + // y1, x2, and y2 is the box. If + // false, it's the entire chart. + useObjectBoundingBoxUnits: true + } + }, + datum: { + stem: { + color: 'black', + length: 12 + }, + style: 'point' + }, + domain: { + stem: { + color: 'black', + length: 5 + }, + style: 'point' + }, + highContrast: true, + stem: { + color: 'black', + length: 5 + }, + style: 'line', + textStyle: { + fontName: 'Times-Roman', + fontSize: 18, + bold: true, + italic: true, + // The color of the text. + color: '#871b47', + // The color of the text outline. + auraColor: '#d799ae', + // The transparency of the text. + opacity: 0.8 + } + }; + + var barAnnotations:google.visualization.ChartBarColumnAnnotations = { + alwaysOutside: true, + textStyle: { + fontName: 'Times-Roman', + fontSize: 18, + bold: true + } + }; +} diff --git a/google.visualization/index.d.ts b/google.visualization/index.d.ts index a4dc1b7b1a..e315ec8cb1 100644 --- a/google.visualization/index.d.ts +++ b/google.visualization/index.d.ts @@ -331,6 +331,25 @@ declare namespace google { export interface ChartAnnotations { boxStyle?: ChartBoxStyle; textStyle?: ChartTextStyle; + datum?: ChartStemAndStyle; + domain?: ChartStemAndStyle; + highContrast?: boolean; + stem?: ChartStem; + style?: string; // 'line' or 'point' + } + + export interface ChartBarColumnAnnotations extends ChartAnnotations { + alwaysOutside?: boolean; + } + + export interface ChartStemAndStyle { + stem?: ChartStem; + style?: string; + } + + export interface ChartStem { + color?: string; + length?: number; } export interface ChartBoxStyle { @@ -565,7 +584,7 @@ declare namespace google { export interface ColumnChartOptions { aggregationTarget?: string; animation?: TransitionAnimation; - annotations?: ChartAnnotations; + annotations?: ChartBarColumnAnnotations; axisTitlesPosition?: string; // in, out, none backgroundColor?: any; bar?: GroupWidth; @@ -645,7 +664,7 @@ declare namespace google { export interface BarChartOptions { aggregationTarget?: string; animation?: TransitionAnimation; - annotations?: ChartAnnotations; + annotations?: ChartBarColumnAnnotations; axisTitlesPosition?: string; // in, out, none backgroundColor?: any; bar?: GroupWidth; @@ -739,6 +758,7 @@ declare namespace google { export interface AreaChartOptions { aggregationTarget?: string; animation?: TransitionAnimation; + annotations?: ChartAnnotations; areaOpacity?: number; axisTitlesPosition?: string; backgroundColor?: any; From 2f38649769efde0468be5ef4e0b5aba56da2b844 Mon Sep 17 00:00:00 2001 From: Adam Cmiel Date: Tue, 8 Nov 2016 06:15:49 -0800 Subject: [PATCH 176/246] Types 2.0 (#12429) * add missing members for token creation add `createToken: (StripeTokenData) => Promise` overload to StripeStatic add `type: string` in StripeTokenResponse * [FIX] response interfaces * add apple pay * [FIX] tests --- stripe/index.d.ts | 74 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 67 insertions(+), 7 deletions(-) diff --git a/stripe/index.d.ts b/stripe/index.d.ts index 8a03ee3f33..2f8c895298 100644 --- a/stripe/index.d.ts +++ b/stripe/index.d.ts @@ -1,9 +1,10 @@ // Type definitions for stripe // Project: https://stripe.com/ -// Definitions by: Andy Hawkins , Eric J. Smith , Amrit Kahlon +// Definitions by: Andy Hawkins , Eric J. Smith , Amrit Kahlon , Adam Cmiel // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped interface StripeStatic { + applePay: StripeApplePay; setPublishableKey(key: string): void; validateCardNumber(cardNumber: string): boolean; validateExpiry(month: string, year: string): boolean; @@ -34,11 +35,11 @@ interface StripeTokenResponse { id: string; card: StripeCardData; created: number; - currency: string; livemode: boolean; object: string; + type: string; used: boolean; - error: StripeError; + error?: StripeError; } interface StripeError { @@ -51,10 +52,8 @@ interface StripeError { interface StripeCardData { object: string; last4: string; - type: string; exp_month: number; exp_year: number; - fingerprint: string; country?: string; name?: string; address_line1?: string; @@ -87,7 +86,6 @@ interface StripeBankTokenResponse { id: string; bank_account: { - id: string; country: string; bank_name: string; last4: number; @@ -99,10 +97,72 @@ interface StripeBankTokenResponse type: string; object: string; used: boolean; - error: StripeError; + error?: StripeError; } declare var Stripe: StripeStatic; declare module "Stripe" { export = StripeStatic; } + +interface StripeApplePay +{ + checkAvailability(resopnseHandler: (result: boolean) => void): void; + buildSession(data: StripeApplePayPaymentRequest, + onSuccessHandler: (result: StripeApplePaySessionResult, completion: ((value: any) => void)) => void, + onErrorHanlder: (error: { message: string }) => void): any; +} + +type StripeApplePayBillingContactField = 'postalAddress' | 'name'; +type StripeApplePayShippingContactField = StripeApplePayBillingContactField | 'phone' | 'email'; +type StripeApplePayShipping = 'shipping' | 'delivery' | 'storePickup' | 'servicePickup'; + +interface StripeApplePayPaymentRequest +{ + billingContact: StripeApplePayPaymentContact; + countryCode: string; + currencyCode: string; + total: StripeApplePayLineItem; + lineItems?: StripeApplePayLineItem[]; + requiredBillingContactFields?: StripeApplePayBillingContactField[]; + requiredShippingContactFields?: StripeApplePayShippingContactField[]; + shippingContact?: StripeApplePayPaymentContact; + shippingMethods?: StripeApplePayShippingMethod[]; + shippingType?: StripeApplePayShipping[]; +} + +// https://developer.apple.com/reference/applepayjs/1916082-applepay_js_data_types +interface StripeApplePayLineItem +{ + type: 'pending' | 'final'; + label: string; + amount: number; +} + +interface StripeApplePaySessionResult +{ + token: StripeTokenResponse; + shippingContact?: StripeApplePayPaymentContact; + shippingMethod?: StripeApplePayShippingMethod; +} + +interface StripeApplePayShippingMethod +{ + label: string; + detail: string; + amount: number; + identifier: string; +} + +interface StripeApplePayPaymentContact +{ + emailAddress: string; + phoneNumber: string; + givenName: string; + familyName: string; + addressLines: string[]; + locality: string; + administrativeArea: string; + postalCode: string; + countryCode: string; +} From ded43c0126962de20c6478289d82242369654d0b Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 8 Nov 2016 06:39:26 -0800 Subject: [PATCH 177/246] Make test files lowercase so they compile on linux (#12549) --- .../{jquery.ajaxFile-tests.ts => jquery.ajaxfile-tests.ts} | 0 .../{jquery.SlimScroll-tests.ts => jquery.slimscroll-tests.ts} | 0 jquery.slimscroll/tsconfig.json | 2 +- 3 files changed, 1 insertion(+), 1 deletion(-) rename jquery.ajaxfile/{jquery.ajaxFile-tests.ts => jquery.ajaxfile-tests.ts} (100%) rename jquery.slimscroll/{jquery.SlimScroll-tests.ts => jquery.slimscroll-tests.ts} (100%) diff --git a/jquery.ajaxfile/jquery.ajaxFile-tests.ts b/jquery.ajaxfile/jquery.ajaxfile-tests.ts similarity index 100% rename from jquery.ajaxfile/jquery.ajaxFile-tests.ts rename to jquery.ajaxfile/jquery.ajaxfile-tests.ts diff --git a/jquery.slimscroll/jquery.SlimScroll-tests.ts b/jquery.slimscroll/jquery.slimscroll-tests.ts similarity index 100% rename from jquery.slimscroll/jquery.SlimScroll-tests.ts rename to jquery.slimscroll/jquery.slimscroll-tests.ts diff --git a/jquery.slimscroll/tsconfig.json b/jquery.slimscroll/tsconfig.json index 910f07039e..524b9a8740 100644 --- a/jquery.slimscroll/tsconfig.json +++ b/jquery.slimscroll/tsconfig.json @@ -14,6 +14,6 @@ }, "files": [ "index.d.ts", - "jquery.slimScroll-tests.ts" + "jquery.slimscroll-tests.ts" ] } \ No newline at end of file From 7f9ddef9b85e2ef3661a62bd3d4ad01d2452b3d8 Mon Sep 17 00:00:00 2001 From: Linken Dinh Date: Tue, 8 Nov 2016 15:53:49 +0100 Subject: [PATCH 178/246] [types-2.0] react - better strict mode compatibility (#11935) * strict mode compatible * include 11931 * vsiao - code review * vsiao - code review - revert complex cloneelement case * validator to accept null * remove double tests * test use Error | null * code reviews * code reviews --- react/index.d.ts | 12 +++++----- react/react-tests.ts | 57 ++++++++++++++++++++++++-------------------- react/tsconfig.json | 2 +- 3 files changed, 38 insertions(+), 33 deletions(-) diff --git a/react/index.d.ts b/react/index.d.ts index 92aa3a03fc..8d5edbab51 100644 --- a/react/index.d.ts +++ b/react/index.d.ts @@ -28,7 +28,7 @@ declare namespace React { interface ReactElement

{ type: string | ComponentClass

| SFC

; props: P; - key?: Key; + key: Key | null; } interface SFCElement

extends ReactElement

{ @@ -74,7 +74,7 @@ declare namespace React { type ClassicFactory

= CFactory>; interface DOMFactory

, T extends Element> { - (props?: P & ClassAttributes, ...children: ReactNode[]): DOMElement; + (props?: P & ClassAttributes | null, ...children: ReactNode[]): DOMElement; } interface HTMLFactory extends DOMFactory, T> { @@ -93,7 +93,7 @@ declare namespace React { // Should be Array but type aliases cannot be recursive type ReactFragment = {} | Array; - type ReactNode = ReactChild | ReactFragment | boolean; + type ReactNode = ReactChild | ReactFragment | boolean | null | undefined; // // Top Level API @@ -201,7 +201,7 @@ declare namespace React { type SFC

= StatelessComponent

; interface StatelessComponent

{ - (props: P, context?: any): ReactElement | null; + (props: P, context?: any): ReactElement; propTypes?: ValidationMap

; contextTypes?: ValidationMap; defaultProps?: P; @@ -262,7 +262,7 @@ declare namespace React { } interface ComponentSpec extends Mixin { - render(): ReactElement; + render(): ReactElement | null; [propertyName: string]: any; } @@ -2354,7 +2354,7 @@ declare namespace React { // ---------------------------------------------------------------------- interface Validator { - (object: T, key: string, componentName: string, ...rest: any[]): Error; + (object: T, key: string, componentName: string, ...rest: any[]): Error | null; } interface Requireable extends Validator { diff --git a/react/react-tests.ts b/react/react-tests.ts index 85bc4c0704..7cdecd9e86 100644 --- a/react/react-tests.ts +++ b/react/react-tests.ts @@ -41,7 +41,7 @@ var props: Props & React.ClassAttributes<{}> = { foo: 42 }; -var container: Element; +var container: Element = document.createElement("div"); // // Top-Level API @@ -49,11 +49,12 @@ var container: Element; var ClassicComponent: React.ClassicComponentClass = React.createClass({ + displayName: "ClassicComponent", getDefaultProps() { return { - hello: undefined, + hello: "hello", world: "peace", - foo: undefined + foo: 0, }; }, getInitialState() { @@ -187,6 +188,10 @@ var domElement: React.ReactHTMLElement = // React.cloneElement var clonedElement: React.CElement = React.cloneElement(element, { foo: 43 }); + +React.cloneElement(element, {}); +React.cloneElement(element, {}, null); + var clonedElement2: React.CElement = // known problem: cloning with key or ref requires cast React.cloneElement(element, >{ @@ -240,18 +245,15 @@ domNode = ReactDOM.findDOMNode(domNode); var type: React.ComponentClass = element.type; var elementProps: Props = element.props; -var key: React.Key = element.key; - -var t: React.ReactType; -var name = typeof t === "string" ? t : t.displayName; +var key = element.key; // // React Components // -------------------------------------------------------------------------- -var displayName: string = ClassicComponent.displayName; -var defaultProps: Props = ClassicComponent.getDefaultProps(); -var propTypes: React.ValidationMap = ClassicComponent.propTypes; +var displayName: string | undefined = ClassicComponent.displayName; +var defaultProps: Props = ClassicComponent.getDefaultProps ? ClassicComponent.getDefaultProps() : {}; +var propTypes: React.ValidationMap | undefined = ClassicComponent.propTypes; // // Component API @@ -282,7 +284,7 @@ class RefComponent extends React.Component { } } -var componentRef: RefComponent; +var componentRef: RefComponent = new RefComponent(); RefComponent.create({ ref: "componentRef" }); // type of c should be inferred RefComponent.create({ ref: c => componentRef = c }); @@ -377,14 +379,14 @@ var PropTypesSpecification: React.ComponentSpec = { }), requiredFunc: React.PropTypes.func.isRequired, requiredAny: React.PropTypes.any.isRequired, - customProp: function(props: any, propName: string, componentName: string) { + customProp: function(props: any, propName: string, componentName: string): Error | null { if (!/matchme/.test(props[propName])) { return new Error("Validation failed!"); } return null; }, // https://facebook.github.io/react/warnings/dont-call-proptypes.html#fixing-the-false-positive-in-third-party-proptypes - percentage: (object: any, key: string, componentName: string, ...rest: any[]): Error => { + percentage: (object: any, key: string, componentName: string, ...rest: any[]): Error | null => { const error = React.PropTypes.number(object, key, componentName, ...rest); if (error) { return error; @@ -395,7 +397,7 @@ var PropTypesSpecification: React.ComponentSpec = { return null; } }, - render: (): React.ReactElement => { + render: (): React.ReactElement | null => { return null; } }; @@ -429,14 +431,14 @@ var ContextTypesSpecification: React.ComponentSpec = { }), requiredFunc: React.PropTypes.func.isRequired, requiredAny: React.PropTypes.any.isRequired, - customProp: function(props: any, propName: string, componentName: string) { + customProp: function(props: any, propName: string, componentName: string): Error | null { if (!/matchme/.test(props[propName])) { return new Error("Validation failed!"); } return null; } }, - render: (): React.ReactElement => { + render: (): null => { return null; } }; @@ -499,7 +501,7 @@ createFragment({ // -------------------------------------------------------------------------- React.createFactory(CSSTransitionGroup)({ component: React.createClass({ - render: (): React.ReactElement => null + render: (): null => null }), childFactory: (c) => c, transitionName: "transition", @@ -605,16 +607,19 @@ var foundComponents: ModernComponent[] = TestUtils.scryRenderedComponentsWithTyp // ReactTestUtils custom type guards -var emptyElement: React.ReactElement<{}>; -if (TestUtils.isElementOfType(emptyElement, StatelessComponent)) { - emptyElement.props.foo; +var emptyElement1: React.ReactElement<{}> = React.createElement(ModernComponent); +if (TestUtils.isElementOfType(emptyElement1, StatelessComponent)) { + emptyElement1.props.foo; +} +var emptyElement2: React.ReactElement<{}> = React.createElement(StatelessComponent); +if (TestUtils.isElementOfType(emptyElement2, StatelessComponent)) { + emptyElement2.props.foo; } -var anyInstance: Element | React.Component; -if (TestUtils.isDOMComponent(anyInstance)) { - anyInstance.getAttribute("className"); -} else if (TestUtils.isCompositeComponent(anyInstance)) { - anyInstance.props; +if (TestUtils.isDOMComponent(container)) { + container.getAttribute("className"); +} else if (TestUtils.isCompositeComponent(new ModernComponent())) { + new ModernComponent().props; } // @@ -655,4 +660,4 @@ class ConstructorSpreadArgsPureComponent extends React.PureComponent<{}, {}> { constructor(...args: any[]) { super(...args); } -} \ No newline at end of file +} diff --git a/react/tsconfig.json b/react/tsconfig.json index 55fd2537d4..d89fd3bdf7 100644 --- a/react/tsconfig.json +++ b/react/tsconfig.json @@ -8,7 +8,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" From 0052449e2933524dc66132a751cb82754755ecb1 Mon Sep 17 00:00:00 2001 From: Jan Michael Alonzo Date: Wed, 9 Nov 2016 02:03:45 +1100 Subject: [PATCH 179/246] [Yargs] Allow Command modules to be passed into command fn (#12524) * [Yargs] Allow Command modules to be passed into command fn * [yargs] Remove I prefix in CommandModule * [Yargs] Replace Array<> with string[] * Make builder, command, describe optional; Handle (c, d, m) command signature --- yargs/index.d.ts | 11 +++++++++++ yargs/yargs-tests.ts | 17 +++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/yargs/index.d.ts b/yargs/index.d.ts index 238f5d1edd..97c68f07cd 100644 --- a/yargs/index.d.ts +++ b/yargs/index.d.ts @@ -70,6 +70,8 @@ declare namespace yargs { command(command: string, description: string, builder: { [optionName: string]: Options }): Argv; command(command: string, description: string, builder: { [optionName: string]: Options }, handler: (args: Argv) => void): Argv; command(command: string, description: string, builder: (args: Argv) => Options, handler: (args: Argv) => void): Argv; + command(command: string, description: string, module: CommandModule): Argv; + command(module: CommandModule): Argv; commandDir(dir: string, opts?: RequireDirectoryOptions): Argv; @@ -199,6 +201,15 @@ declare namespace yargs { nargs?: number; } + interface CommandModule { + aliases?: string[] | string; + builder?: CommandBuilder; + command?: string[] | string; + describe?: string | false; + handler: (args: any) => void; + } + + type CommandBuilder = {[key: string]: Options} | ((args: Argv) => Argv); type SyncCompletionFunction = (current: string, argv: any) => string[]; type AsyncCompletionFunction = (current: string, argv: any, done: (completion: string[]) => void) => void; } diff --git a/yargs/yargs-tests.ts b/yargs/yargs-tests.ts index 011d305621..5770f9dd9c 100644 --- a/yargs/yargs-tests.ts +++ b/yargs/yargs-tests.ts @@ -207,6 +207,23 @@ function command() { description:"Should i publish?" } }) + .command({ + command: "test", + describe: "test package", + builder: { + mateys: { + demand: false + } + }, + handler: (args: any) => { + /* handle me mateys! */ + } + }) + .command("test", "test mateys", { + handler: (args: any) => { + /* handle me mateys! */ + } + }) .help('help') .argv; } From 5f1b0991303a64bcadc754b71708ffae05a4ddba Mon Sep 17 00:00:00 2001 From: Ilya Kuznetsov Date: Tue, 8 Nov 2016 18:06:35 +0300 Subject: [PATCH 180/246] [Types 2.0] Add Chai-spies (#12489) * Types for chai-spies * References for external dependencies were added * chai-spies: reference to 'chai' typings was added --- chai-spies/chai-spies-tests.ts | 135 +++++++++++ chai-spies/index.d.ts | 411 +++++++++++++++++++++++++++++++++ chai-spies/tsconfig.json | 19 ++ 3 files changed, 565 insertions(+) create mode 100644 chai-spies/chai-spies-tests.ts create mode 100644 chai-spies/index.d.ts create mode 100644 chai-spies/tsconfig.json diff --git a/chai-spies/chai-spies-tests.ts b/chai-spies/chai-spies-tests.ts new file mode 100644 index 0000000000..7ac0610e4d --- /dev/null +++ b/chai-spies/chai-spies-tests.ts @@ -0,0 +1,135 @@ +/// +/// + +import * as chai from 'chai'; +import * as spies from 'chai-spies'; +import * as Mocha from 'mocha'; + +function original(): void { + // do something cool +} + +let ee = { + on(name: string, fn: () => void) { + } +}; + +let spiedFn = chai.spy(original); + +// then use in place of original +ee.on('some event', spiedFn); + +// or use without original +let spy_again = chai.spy(); +ee.on('some other event', spy_again); + +// or you can track an object's method +let array = [ 1, 2, 3 ]; +chai.spy.on(array, 'push'); + +// or you can track multiple object's methods +chai.spy.on(array, 'push', 'pop'); + +array.push(5); + +// and you can reset the object calls +// array.push.reset(); + +// or you can create spy object +let object = chai.spy.object([ 'push', 'pop' ]); +object.push(5); + +// or you create spy which returns static value +spiedFn = chai.spy.returns(true); + +spiedFn(); // true + + +let should = chai.should() + , expect = chai.expect; + +const spy = chai.spy(); + +// .spy + +expect(spy).to.be.spy; +spy.should.be.spy; + +// .called + +expect(spy).to.have.been.called(); +spy.should.have.been.called(); + +// .with +const spyStringArg = chai.spy((arg: string) => arg); +spyStringArg('foo'); +expect(spyStringArg).to.have.been.called.with('foo'); +spyStringArg.should.have.been.called.with('foo'); + +const spyTwoStringArgsAndOneNumber = chai.spy((arg1: string, arg2: string, arg3: number) => arg3); +spyTwoStringArgsAndOneNumber('foo', 'bar', 1); +expect(spyTwoStringArgsAndOneNumber).to.have.been.called.with('bar', 'foo'); +spyTwoStringArgsAndOneNumber.should.have.been.called.with('bar', 'foo'); + +// .with.exactly +const spyTwoStringArgs = chai.spy((arg1: string, arg2: string) => arg1); +spyTwoStringArgs('', ''); +spyTwoStringArgs('foo', 'bar'); +expect(spyTwoStringArgs).to.have.been.called.with.exactly('foo', 'bar'); +spyTwoStringArgs.should.have.been.called.with.exactly('foo', 'bar'); + +// .always.with +const spyThreeAnyArgs = chai.spy((arg1: any, arg2: any, arg3: any) => arg1); +spyThreeAnyArgs('foo', null, null); +spyThreeAnyArgs('foo', 'bar', null); +spyThreeAnyArgs(1, 2, 'foo'); +expect(spy).to.have.been.called.always.with('foo'); +spy.should.have.been.called.always.with('foo'); + +// .always.with.exactly +spyStringArg('foo'); +spyStringArg('foo'); +expect(spyStringArg).to.have.been.called.always.with.exactly('foo'); +spyStringArg.should.have.been.called.always.with.exactly('foo'); + +// .once +expect(spy).to.have.been.called.once; +expect(spy).to.not.have.been.called.once; +spy.should.have.been.called.once; +spy.should.not.have.been.called.once; + +// .twice +expect(spy).to.have.been.called.twice; +expect(spy).to.not.have.been.called.twice; +spy.should.have.been.called.twice; +spy.should.not.have.been.called.twice; + +// .exactly(n) +expect(spy).to.have.been.called.exactly(3); +expect(spy).to.not.have.been.called.exactly(3); +spy.should.have.been.called.exactly(3); +spy.should.not.have.been.called.exactly(3); + +// .min(n) / .at.least(n) +expect(spy).to.have.been.called.min(3); +expect(spy).to.not.have.been.called.at.least(3); +spy.should.have.been.called.at.least(3); +spy.should.not.have.been.called.min(3); + +// .max(n) / .at.most(n) +expect(spy).to.have.been.called.max(3); +expect(spy).to.not.have.been.called.at.most(3); +spy.should.have.been.called.at.most(3); +spy.should.not.have.been.called.max(3); + +// .above(n) / .gt(n) +expect(spy).to.have.been.called.above(3); +expect(spy).to.not.have.been.called.gt(3); +spy.should.have.been.called.gt(3); +spy.should.not.have.been.called.above(3); + +// .below(n) / .lt(n) +expect(spy).to.have.been.called.below(3); +expect(spy).to.not.have.been.called.lt(3); +spy.should.have.been.called.lt(3); +spy.should.not.have.been.called.below(3); \ No newline at end of file diff --git a/chai-spies/index.d.ts b/chai-spies/index.d.ts new file mode 100644 index 0000000000..ffed6e594b --- /dev/null +++ b/chai-spies/index.d.ts @@ -0,0 +1,411 @@ +// Type definitions for chai-spies +// Project: https://github.com/chaijs/chai-spies +// Definitions by: Ilya Kuznetsov +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace Chai { + interface ChaiStatic { + spy: ChaiSpies.Spy; + } + + interface Assertion { + /** + * ####.spy + * Asserts that object is a spy. + * ```ts + * expect(spy).to.be.spy; + * spy.should.be.spy; + * ``` + */ + spy: Assertion; + + /** + * ####.called + * Assert that a spy has been called. Negation passes through. + * ```ts + * expect(spy).to.have.been.called(); + * spy.should.have.been.called(); + * ``` + * Note that ```called``` can be used as a chainable method. + */ + called: ChaiSpies.Called; + } +} + +declare namespace ChaiSpies { + + interface Spy { + /** + * #### chai.spy (function) + * + * Wraps a function in a proxy function. All calls will pass through to the original function. + * ```ts + * function original() {} + * var spy = chai.spy(original) + * , e_spy = chai.spy(); + * ``` + * @param fn function to spy on. @default ```function () {}``` + * @returns function to actually call + */ + (): SpyFunc0Proxy; + (fn: SpyFunc0): SpyFunc0Proxy; + (fn: SpyFunc1): SpyFunc1Proxy; + (fn: SpyFunc2): SpyFunc2Proxy; + (fn: SpyFunc3): SpyFunc3Proxy; + (fn: SpyFunc4): SpyFunc4Proxy; + (fn: SpyFunc5): SpyFunc5Proxy; + (fn: SpyFunc6): SpyFunc6Proxy; + (fn: SpyFunc7): SpyFunc7Proxy; + (fn: SpyFunc8): SpyFunc8Proxy; + (fn: SpyFunc9): SpyFunc9Proxy; + (fn: SpyFunc10): SpyFunc10Proxy; + (name: string, fn: SpyFunc0): SpyFunc0Proxy; + (name: string, fn: SpyFunc1): SpyFunc1Proxy; + (name: string, fn: SpyFunc2): SpyFunc2Proxy; + (name: string, fn: SpyFunc3): SpyFunc3Proxy; + (name: string, fn: SpyFunc4): SpyFunc4Proxy; + (name: string, fn: SpyFunc5): SpyFunc5Proxy; + (name: string, fn: SpyFunc6): SpyFunc6Proxy; + (name: string, fn: SpyFunc7): SpyFunc7Proxy; + (name: string, fn: SpyFunc8): SpyFunc8Proxy; + (name: string, fn: SpyFunc9): SpyFunc9Proxy; + (name: string, fn: SpyFunc10): SpyFunc10Proxy; + + /** + * #### chai.spy.on (function) + * + * Wraps an object method into spy. All calls will pass through to the original function. + * ```ts + * var spy = chai.spy.on(Array, 'isArray'); + * ``` + * @param {Object} object + * @param {String} method name to spy on + * @returns function to actually call + */ + on(object: Object, ...methodNames: string[]): any; + + /** + * #### chai.spy.object (function) + * + * Creates an object with spied methods. + * ```ts + * var object = chai.spy.object('Array', [ 'push', 'pop' ]); + * ``` + * @param {String} [name] object name + * @param {String[]|Object} method names or method definitions + * @returns object with spied methods + */ + object(name: string, methods: string[]): any; + object(methods: string[]): any; + object(name: string, methods: T): T; + object(methods: T): T; + + /** + * #### chai.spy.returns (function) + * + * Creates a spy which returns static value. + *```ts + * var method = chai.spy.returns(true); + *``` + * @param {*} value static value which is returned by spy + * @returns new spy function which returns static value + * @api public + */ + + returns(value: T): SpyFunc0Proxy; + } + + interface Called { + (): Chai.Assertion; + with: With; + always: Always; + + /** + * ####.once + * Assert that a spy has been called exactly once. + * ```ts + * expect(spy).to.have.been.called.once; + * expect(spy).to.not.have.been.called.once; + * spy.should.have.been.called.once; + * spy.should.not.have.been.called.once; + * ``` + */ + once: Chai.Assertion; + + /** + * ####.twice + * Assert that a spy has been called exactly twice. + * ```ts + * expect(spy).to.have.been.called.twice; + * expect(spy).to.not.have.been.called.twice; + * spy.should.have.been.called.twice; + * spy.should.not.have.been.called.twice; + * ``` + */ + twice: Chai.Assertion; + + /** + * ####.exactly(n) + * Assert that a spy has been called exactly ```n``` times. + * ```ts + * expect(spy).to.have.been.called.exactly(3); + * expect(spy).to.not.have.been.called.exactly(3); + * spy.should.have.been.called.exactly(3); + * spy.should.not.have.been.called.exactly(3); + * ``` + */ + exactly(n: number): Chai.Assertion; + + /** + * ####.min(n) / .at.least(n) + * Assert that a spy has been called minimum of ```n``` times. + * ```ts + * expect(spy).to.have.been.called.min(3); + * expect(spy).to.not.have.been.called.at.least(3); + * spy.should.have.been.called.at.least(3); + * spy.should.not.have.been.called.min(3); + * ``` + */ + min(n: number): Chai.Assertion; + + /** + * ####.max(n) / .at.most(n) + * Assert that a spy has been called maximum of ```n``` times. + * ```ts + * expect(spy).to.have.been.called.max(3); + * expect(spy).to.not.have.been.called.at.most(3); + * spy.should.have.been.called.at.most(3); + * spy.should.not.have.been.called.max(3); + * ``` + */ + max(n: number): Chai.Assertion; + + at: At; + /** + * ####.above(n) / .gt(n) + * Assert that a spy has been called more than ```n``` times. + * ```ts + * expect(spy).to.have.been.called.above(3); + * spy.should.not.have.been.called.above(3); + * ``` + */ + above(n: number): Chai.Assertion; + + /** + * ####.above(n) / .gt(n) + * Assert that a spy has been called more than ```n``` times. + * ```ts + * expect(spy).to.have.been.called.gt(3); + * spy.should.not.have.been.called.gt(3); + * ``` + */ + gt(n: number): Chai.Assertion; + + /** + * ####.below(n) / .lt(n) + * Assert that a spy has been called fewer than ```n``` times. + * ```ts + * expect(spy).to.have.been.called.below(3); + * spy.should.not.have.been.called.below(3); + * ``` + */ + below(n: number): Chai.Assertion; + + /** + * ####.below(n) / .lt(n) + * Assert that a spy has been called fewer than ```n``` times. + * ```ts + * expect(spy).to.have.been.called.lt(3); + * spy.should.not.have.been.called.lt(3); + * ``` + */ + lt(n: number): Chai.Assertion; + } + + interface With { + /** + * ####.with + * Assert that a spy has been called with a given argument at least once, even if more arguments were provided. + * ```ts + * spy('foo'); + * expect(spy).to.have.been.called.with('foo'); + * spy.should.have.been.called.with('foo'); + * ``` + * Will also pass for ```spy('foo', 'bar')``` and ```spy(); spy('foo')```. + * If used with multiple arguments, assert that a spy has been called with all the given arguments at least once. + * ```ts + * spy('foo', 'bar', 1); + * expect(spy).to.have.been.called.with('bar', 'foo'); + * spy.should.have.been.called.with('bar', 'foo'); + * ``` + */ + (a: any, b?: any, c?: any, d?: any, e?: any, f?: any, g?: any, h?: any, i?: any, j?: any): Chai.Assertion; + + /** + * ####.with.exactly + * Similar to .with, but will pass only if the list of arguments is exactly the same as the one provided. + * ```ts + * spy(); + * spy('foo', 'bar'); + * expect(spy).to.have.been.called.with.exactly('foo', 'bar'); + * spy.should.have.been.called.with.exactly('foo', 'bar'); + * ``` + * Will not pass for ```spy('foo')```, ```spy('bar')```, ```spy('bar'); spy('foo')```, ```spy('foo'); spy('bar')```, ```spy('bar', 'foo')``` or ```spy('foo', 'bar', 1)```. + * Can be used for calls with a single argument too. + */ + + exactly(a?: any, b?: any, c?: any, d?: any, e?: any, f?: any, g?: any, h?: any, i?: any, j?: any): Chai.Assertion; + } + + interface Always { + with: AlwaysWith; + } + + interface AlwaysWith { + /** + * ####.always.with + * Assert that every time the spy has been called the argument list contained the given arguments. + * ```ts + * spy('foo'); + * spy('foo', 'bar'); + * spy(1, 2, 'foo'); + * expect(spy).to.have.been.called.always.with('foo'); + * spy.should.have.been.called.always.with('foo'); + * ``` + */ + (a: any, b?: any, c?: any, d?: any, e?: any, f?: any, g?: any, h?: any, i?: any, j?: any): Chai.Assertion; + + /** + * ####.always.with.exactly + * Assert that the spy has never been called with a different list of arguments than the one provided. + * ```ts + * spy('foo'); + * spy('foo'); + * expect(spy).to.have.been.called.always.with.exactly('foo'); + * spy.should.have.been.called.always.with.exactly('foo'); + * ``` + */ + exactly(a?: any, b?: any, c?: any, d?: any, e?: any, f?: any, g?: any, h?: any, i?: any, j?: any): Chai.Assertion; + } + + interface At { + /** + * ####.min(n) / .at.least(n) + * Assert that a spy has been called minimum of ```n``` times. + * ```ts + * expect(spy).to.have.been.called.min(3); + * expect(spy).to.not.have.been.called.at.least(3); + * spy.should.have.been.called.at.least(3); + * spy.should.not.have.been.called.min(3); + * ``` + */ + least(n: number): Chai.Assertion; + + /** + * ####.max(n) / .at.most(n) + * Assert that a spy has been called maximum of ```n``` times. + * ```ts + * expect(spy).to.have.been.called.max(3); + * expect(spy).to.not.have.been.called.at.most(3); + * spy.should.have.been.called.at.most(3); + * spy.should.not.have.been.called.max(3); + * ``` + */ + most(n: number): Chai.Assertion; + } + + interface Resetable { + /** + * #### proxy.reset (function) + * + * Resets __spy object parameters for instantiation and reuse + * @returns proxy spy object + */ + reset(): this; + } + + interface SpyFunc0 { + (): R; + } + + interface SpyFunc1 { + (a: A1): R; + } + + interface SpyFunc2 { + (a: A1, b: A2): R; + } + + interface SpyFunc3 { + (a: A1, b: A2, c: A3): R; + } + + interface SpyFunc4 { + (a: A1, b: A2, c: A3, d: A4): R; + } + + interface SpyFunc5 { + (a: A1, b: A2, c: A3, d: A4, e: A5): R; + } + + interface SpyFunc6 { + (a: A1, b: A2, c: A3, d: A4, e: A5, f: A6): R; + } + + interface SpyFunc7 { + (a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7): R; + } + + interface SpyFunc8 { + (a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7, h: A8): R; + } + + interface SpyFunc9 { + (a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7, h: A8, i: A9): R; + } + + interface SpyFunc10 { + (a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7, h: A8, i: A9, j: A10): R; + } + + interface SpyFunc0Proxy extends SpyFunc0, Resetable { + } + + interface SpyFunc1Proxy extends SpyFunc1, Resetable { + } + + interface SpyFunc2Proxy extends SpyFunc2, Resetable { + } + + interface SpyFunc3Proxy extends SpyFunc3, Resetable { + } + + interface SpyFunc4Proxy extends SpyFunc4, Resetable { + } + + interface SpyFunc5Proxy extends SpyFunc5, Resetable { + } + + interface SpyFunc6Proxy extends SpyFunc6, Resetable { + } + + interface SpyFunc7Proxy extends SpyFunc7, Resetable { + } + + interface SpyFunc8Proxy extends SpyFunc8, Resetable { + } + + interface SpyFunc9Proxy extends SpyFunc9, Resetable { + } + + interface SpyFunc10Proxy extends SpyFunc10, Resetable { + } +} + +declare var spies: ChaiSpies.Spy; + +declare module "chai-spies" { + export = spies; +} diff --git a/chai-spies/tsconfig.json b/chai-spies/tsconfig.json new file mode 100644 index 0000000000..91c115a7a5 --- /dev/null +++ b/chai-spies/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "chai-spies-tests.ts" + ] +} \ No newline at end of file From 4bb4da03933c76e1ddf2d8707749faecaaa600ab Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Tue, 8 Nov 2016 09:12:49 -0600 Subject: [PATCH 181/246] line argument is an object, not a primitive (#12393) --- codemirror/index.d.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/codemirror/index.d.ts b/codemirror/index.d.ts index 708b32812e..83c45e93ab 100644 --- a/codemirror/index.d.ts +++ b/codemirror/index.d.ts @@ -393,8 +393,8 @@ declare namespace CodeMirror { /** Fired whenever a line is (re-)rendered to the DOM. Fired right after the DOM element is built, before it is added to the document. 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; + on(eventName: 'renderLine', handler: (instance: CodeMirror.Editor, line: CodeMirror.LineHandle, element: HTMLElement) => void ): void; + off(eventName: 'renderLine', handler: (instance: CodeMirror.Editor, line: CodeMirror.LineHandle, element: HTMLElement) => void ): void; /** Expose the state object, so that the Editor.state.completionActive property is reachable*/ state: any; @@ -1240,4 +1240,3 @@ declare namespace CodeMirror { } } } - From 9d945fb562a16a1166291dbb775ba6b35ce554cd Mon Sep 17 00:00:00 2001 From: Martin Sikora Date: Tue, 8 Nov 2016 16:15:41 +0100 Subject: [PATCH 182/246] Added missing onStop() method. (#12558) --- tween.js/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tween.js/index.d.ts b/tween.js/index.d.ts index 7091b5a05b..c2c5a22297 100644 --- a/tween.js/index.d.ts +++ b/tween.js/index.d.ts @@ -21,6 +21,7 @@ declare namespace TWEEN { interpolation(interpolation: (v:number[], k:number) => number): Tween; chain(...tweens:Tween[]): Tween; onStart(callback: (object?: any) => void): Tween; + onStop(callback: (object?: any) => void): Tween; onUpdate(callback: (object?: any) => void): Tween; onComplete(callback: (object?: any) => void): Tween; update(time: number): boolean; @@ -101,4 +102,4 @@ interface TweenInterpolation { declare module 'tween.js' { export = TWEEN; -} \ No newline at end of file +} From 8b21b7adde51faa74d8cfd611d21fee868361a34 Mon Sep 17 00:00:00 2001 From: Philipp A Date: Tue, 8 Nov 2016 16:16:00 +0100 Subject: [PATCH 183/246] Fixed StringProtocolCallback call signature (#12522) --- electron/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/electron/index.d.ts b/electron/index.d.ts index d39710189b..c0797775a2 100644 --- a/electron/index.d.ts +++ b/electron/index.d.ts @@ -2850,7 +2850,7 @@ declare namespace Electron { interface StringProtocolCallback extends ProtocolCallback { (str: string): void; (obj: { - data: Buffer, + data: string, mimeType: string, charset?: string }): void; From 988774a261086d762ed27b302bddf027fc38af8a Mon Sep 17 00:00:00 2001 From: Steve Date: Tue, 8 Nov 2016 15:17:25 +0000 Subject: [PATCH 184/246] bind ponyfill type def (#12559) --- bind-ponyfill/bind-ponyfill-tests.ts | 8 ++++++++ bind-ponyfill/index.d.ts | 7 +++++++ bind-ponyfill/tsconfig.json | 19 +++++++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 bind-ponyfill/bind-ponyfill-tests.ts create mode 100644 bind-ponyfill/index.d.ts create mode 100644 bind-ponyfill/tsconfig.json diff --git a/bind-ponyfill/bind-ponyfill-tests.ts b/bind-ponyfill/bind-ponyfill-tests.ts new file mode 100644 index 0000000000..8c5ba7ec05 --- /dev/null +++ b/bind-ponyfill/bind-ponyfill-tests.ts @@ -0,0 +1,8 @@ +import ponyBind = require('bind-ponyfill'); + +let boundFn: Function; + +boundFn = ponyBind(() => { console.log(this); }, 'Hello world!'); +boundFn = ponyBind((...args: Array) => { console.log(this, ...args); }, 'Hello world!', 'arg1'); +boundFn = ponyBind((...args: Array) => { console.log(this, ...args); }, 'Hello world!', 'arg1', 'arg2'); +boundFn = ponyBind((arg1: string, arg2: number) => { console.log(this, arg1, arg2); }, 'Hello world!', 'arg1', 2); \ No newline at end of file diff --git a/bind-ponyfill/index.d.ts b/bind-ponyfill/index.d.ts new file mode 100644 index 0000000000..8fb2227627 --- /dev/null +++ b/bind-ponyfill/index.d.ts @@ -0,0 +1,7 @@ +// Type definitions for bind-ponyfill 0.1.0 +// Project: https://www.npmjs.com/package/bind-ponyfill +// Definitions by: Steve Jenkins +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function ponyBind(fn: Function, that: any, ...args: Array): Function; +export = ponyBind; \ No newline at end of file diff --git a/bind-ponyfill/tsconfig.json b/bind-ponyfill/tsconfig.json new file mode 100644 index 0000000000..44c1eca54a --- /dev/null +++ b/bind-ponyfill/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "bind-ponyfill-tests.ts" + ] +} From 77b51c349b535f80c541f670c4c43abcb21ff716 Mon Sep 17 00:00:00 2001 From: Steve Date: Tue, 8 Nov 2016 15:17:47 +0000 Subject: [PATCH 185/246] updated typings (#12532) * updated typings * fix comments from PR --- lz-string/index.d.ts | 32 +++++++++++++++++++++++++++++++- lz-string/lz-string-tests.ts | 7 ++++++- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/lz-string/index.d.ts b/lz-string/index.d.ts index 499c9cf50c..19c97c419f 100644 --- a/lz-string/index.d.ts +++ b/lz-string/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for lz-string v1.3.3 +// Type definitions for lz-string v1.3.5 // Project: https://github.com/pieroxy/lz-string // Definitions by: Roman Nikitin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -57,5 +57,35 @@ declare namespace LZString { * @param compressed A string obtained from a call to compressToBase64(). */ decompressFromBase64(compressed: string): string; + + /** + * produces ASCII strings representing the original string encoded in Base64 with a few + * tweaks to make these URI safe. Hence, you can send them to the server without thinking + * about URL encoding them. This saves bandwidth and CPU + * + * @param uncompressed A string which should be compressed. + */ + compressToEncodedURIComponent(uncompressed: string): string; + + /** + * Decompresses "valid" input string created by the method compressToEncodedURIComponent(). + * + * @param compressed A string obtained from a call to compressToEncodedURIComponent(). + */ + decompressFromEncodedURIComponent(compressed: string): string; + + /** + * produces an uint8Array + * + * @param uncompressed A string which should be compressed. + */ + compressToUint8Array(uncompressed: string): Uint8Array; + + /** + * Decompresses "valid" array created by the method compressToUint8Array(). + * + * @param compressed A string obtained from a call to compressToUint8Array(). + */ + decompressFromUint8Array(compressed: Uint8Array): string; } } diff --git a/lz-string/lz-string-tests.ts b/lz-string/lz-string-tests.ts index e26160f5f4..131bce2105 100644 --- a/lz-string/lz-string-tests.ts +++ b/lz-string/lz-string-tests.ts @@ -3,10 +3,15 @@ var input = "Someting to compress"; var encoded: string; var decoded: string; +var encodedU8: Uint8Array; encoded = LZString.compress(input); decoded = LZString.decompress(encoded); encoded = LZString.compressToUTF16(input); decoded = LZString.decompressFromUTF16(encoded); encoded = LZString.compressToBase64(input); -decoded = LZString.decompressFromBase64(encoded); \ No newline at end of file +decoded = LZString.decompressFromBase64(encoded); +encoded = LZString.compressToEncodedURIComponent(input); +decoded = LZString.compressToEncodedURIComponent(encoded); +encodedU8 = LZString.compressToUint8Array(input); +decoded = LZString.decompressFromUint8Array(encodedU8); \ No newline at end of file From 215055b6c6ae3898b031529c4af278678873d677 Mon Sep 17 00:00:00 2001 From: Bradford Wagner Date: Tue, 8 Nov 2016 10:20:32 -0500 Subject: [PATCH 186/246] adding angular clipboard (#12458) * adding angular clipboard * adding tests * fixing unit tests * Update angular-clipboard-tests.ts triggering build * adhering to the no interface I convention * just using a module now * strictNullChecks: true, and removing declare module --- angular-clipboard/angular-clipboard-tests.ts | 14 ++++++++++++++ angular-clipboard/index.d.ts | 20 ++++++++++++++++++++ angular-clipboard/tsconfig.json | 19 +++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 angular-clipboard/angular-clipboard-tests.ts create mode 100644 angular-clipboard/index.d.ts create mode 100644 angular-clipboard/tsconfig.json diff --git a/angular-clipboard/angular-clipboard-tests.ts b/angular-clipboard/angular-clipboard-tests.ts new file mode 100644 index 0000000000..ccb1c7ce9a --- /dev/null +++ b/angular-clipboard/angular-clipboard-tests.ts @@ -0,0 +1,14 @@ +/// +/// + +import * as angular from "angular"; +import {ClipboardService} from "angular-clipboard"; + +const app = angular.module('testModule', ['angular-clipboard']); +app.controller('TestController', ($scope: ng.IScope, clipboard: ClipboardService) => { + $scope['testCopy'] = () => { + if (clipboard.supported) { + clipboard.copyText('hiiiiiii'); + } + }; +}); diff --git a/angular-clipboard/index.d.ts b/angular-clipboard/index.d.ts new file mode 100644 index 0000000000..bb2d93ce49 --- /dev/null +++ b/angular-clipboard/index.d.ts @@ -0,0 +1,20 @@ +// Type definitions for angular-clipboard v1.5 +// Project: https://github.com/omichelsen/angular-clipboard +// Definitions by: Bradford Wagner +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * Definition of the Clipboard Service + */ +export interface ClipboardService { + /** + * tells us whether or not angular-clipboard is supported + */ + supported: boolean; + + /** + * copies text to a clipboard + * @param text the text to be copied to the clipboard + */ + copyText(text: string): void; +} diff --git a/angular-clipboard/tsconfig.json b/angular-clipboard/tsconfig.json new file mode 100644 index 0000000000..df3b091b93 --- /dev/null +++ b/angular-clipboard/tsconfig.json @@ -0,0 +1,19 @@ +{ + "files": [ + "index.d.ts", + "angular-clipboard-tests.ts" + ], + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": false + } +} From 2b4f52b1eb19cd849d40240bed5dde2e3c016a98 Mon Sep 17 00:00:00 2001 From: valorize Date: Tue, 8 Nov 2016 20:43:26 +0100 Subject: [PATCH 187/246] Added collapseOnSelect --- react-bootstrap/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/react-bootstrap/index.d.ts b/react-bootstrap/index.d.ts index 9780efb443..d23874c246 100644 --- a/react-bootstrap/index.d.ts +++ b/react-bootstrap/index.d.ts @@ -551,6 +551,7 @@ declare namespace ReactBootstrap { staticTop?: boolean; toggleButton?: any; // TODO: Add more specific type toggleNavKey?: string | number; + collapseOnSelect?: boolean; } interface NavbarClass extends React.ClassicComponentClass { Brand: typeof NavbarBrand; From b8c6cce44415475000bf3a712112978f958fe5ee Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 8 Nov 2016 12:59:26 -0800 Subject: [PATCH 188/246] Prefer es6 target and forceConsistentCasingInFileNames (#12537) --- browser-resolve/tsconfig.json | 2 +- cassandra-driver/tsconfig.json | 4 ++-- cordova-plugin-battery-status/tsconfig.json | 3 ++- cordova-plugin-camera/tsconfig.json | 3 ++- cordova-plugin-contacts/tsconfig.json | 3 ++- cordova-plugin-device-motion/tsconfig.json | 3 ++- cordova-plugin-device/tsconfig.json | 3 ++- cordova-plugin-dialogs/tsconfig.json | 3 ++- cordova-plugin-file/tsconfig.json | 3 ++- cordova-plugin-globalization/tsconfig.json | 3 ++- cordova-plugin-inappbrowser/tsconfig.json | 3 ++- cordova-plugin-keyboard/tsconfig.json | 3 ++- cordova-plugin-media/tsconfig.json | 3 ++- cordova-plugin-splashscreen/tsconfig.json | 3 ++- cordova-plugin-statusbar/tsconfig.json | 3 ++- cordova-plugin-vibration/tsconfig.json | 3 ++- cordova-plugin-websql/tsconfig.json | 3 ++- cordova/tsconfig.json | 3 ++- ids/tsconfig.json | 2 +- lodash/tsconfig.json | 2 +- object-refs/tsconfig.json | 2 +- resolve/tsconfig.json | 2 +- ssh2-streams/tsconfig.json | 3 ++- ssh2/tsconfig.json | 3 ++- winrt-uwp/tsconfig.json | 2 +- winrt/tsconfig.json | 2 +- yayson/tsconfig.json | 2 +- 27 files changed, 46 insertions(+), 28 deletions(-) diff --git a/browser-resolve/tsconfig.json b/browser-resolve/tsconfig.json index 937a2406b8..d708711572 100644 --- a/browser-resolve/tsconfig.json +++ b/browser-resolve/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "module": "commonjs", - "target": "es5", + "target": "es6", "noImplicitAny": true, "strictNullChecks": false, "baseUrl": "../", diff --git a/cassandra-driver/tsconfig.json b/cassandra-driver/tsconfig.json index 0dec57214f..10b7ab8253 100644 --- a/cassandra-driver/tsconfig.json +++ b/cassandra-driver/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "module": "commonjs", - "target": "es5", + "target": "es6", "noImplicitAny": true, "strictNullChecks": false, "baseUrl": "../", @@ -14,6 +14,6 @@ }, "files": [ "index.d.ts", - "cassandra-driver.tests.ts" + "cassandra-driver-tests.ts" ] } \ No newline at end of file diff --git a/cordova-plugin-battery-status/tsconfig.json b/cordova-plugin-battery-status/tsconfig.json index b781800488..0ba34b4eaf 100644 --- a/cordova-plugin-battery-status/tsconfig.json +++ b/cordova-plugin-battery-status/tsconfig.json @@ -4,7 +4,8 @@ "target": "es6", "noImplicitAny": false, "strictNullChecks": false, - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordova-plugin-camera/tsconfig.json b/cordova-plugin-camera/tsconfig.json index fd82d2283c..4bcb17e701 100644 --- a/cordova-plugin-camera/tsconfig.json +++ b/cordova-plugin-camera/tsconfig.json @@ -4,7 +4,8 @@ "target": "es6", "noImplicitAny": false, "strictNullChecks": false, - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordova-plugin-contacts/tsconfig.json b/cordova-plugin-contacts/tsconfig.json index 150cbbc01b..e7622317a1 100644 --- a/cordova-plugin-contacts/tsconfig.json +++ b/cordova-plugin-contacts/tsconfig.json @@ -4,7 +4,8 @@ "target": "es6", "noImplicitAny": false, "strictNullChecks": false, - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordova-plugin-device-motion/tsconfig.json b/cordova-plugin-device-motion/tsconfig.json index 38d054da74..8fdea1bb00 100644 --- a/cordova-plugin-device-motion/tsconfig.json +++ b/cordova-plugin-device-motion/tsconfig.json @@ -4,7 +4,8 @@ "target": "es6", "noImplicitAny": false, "strictNullChecks": false, - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordova-plugin-device/tsconfig.json b/cordova-plugin-device/tsconfig.json index 2382a3c48b..a7004ed713 100644 --- a/cordova-plugin-device/tsconfig.json +++ b/cordova-plugin-device/tsconfig.json @@ -4,7 +4,8 @@ "target": "es6", "noImplicitAny": false, "strictNullChecks": false, - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordova-plugin-dialogs/tsconfig.json b/cordova-plugin-dialogs/tsconfig.json index 8a06fc75a3..66e676d30c 100644 --- a/cordova-plugin-dialogs/tsconfig.json +++ b/cordova-plugin-dialogs/tsconfig.json @@ -4,7 +4,8 @@ "target": "es6", "noImplicitAny": false, "strictNullChecks": false, - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordova-plugin-file/tsconfig.json b/cordova-plugin-file/tsconfig.json index 62e93d809e..52446e1912 100644 --- a/cordova-plugin-file/tsconfig.json +++ b/cordova-plugin-file/tsconfig.json @@ -9,7 +9,8 @@ "../" ], "types": [], - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordova-plugin-globalization/tsconfig.json b/cordova-plugin-globalization/tsconfig.json index c743a2a3ee..1f61009199 100644 --- a/cordova-plugin-globalization/tsconfig.json +++ b/cordova-plugin-globalization/tsconfig.json @@ -4,7 +4,8 @@ "target": "es6", "noImplicitAny": false, "strictNullChecks": false, - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordova-plugin-inappbrowser/tsconfig.json b/cordova-plugin-inappbrowser/tsconfig.json index 171d99407e..d26ba0222f 100644 --- a/cordova-plugin-inappbrowser/tsconfig.json +++ b/cordova-plugin-inappbrowser/tsconfig.json @@ -4,7 +4,8 @@ "target": "es6", "noImplicitAny": false, "strictNullChecks": false, - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordova-plugin-keyboard/tsconfig.json b/cordova-plugin-keyboard/tsconfig.json index 00a8c3f7c5..d2f26294bc 100644 --- a/cordova-plugin-keyboard/tsconfig.json +++ b/cordova-plugin-keyboard/tsconfig.json @@ -4,7 +4,8 @@ "target": "es6", "noImplicitAny": false, "strictNullChecks": false, - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordova-plugin-media/tsconfig.json b/cordova-plugin-media/tsconfig.json index 7875dd04a0..d9fc3553b5 100644 --- a/cordova-plugin-media/tsconfig.json +++ b/cordova-plugin-media/tsconfig.json @@ -4,7 +4,8 @@ "target": "es6", "noImplicitAny": false, "strictNullChecks": false, - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordova-plugin-splashscreen/tsconfig.json b/cordova-plugin-splashscreen/tsconfig.json index 032aed70bc..43e60dcd63 100644 --- a/cordova-plugin-splashscreen/tsconfig.json +++ b/cordova-plugin-splashscreen/tsconfig.json @@ -4,7 +4,8 @@ "target": "es6", "noImplicitAny": false, "strictNullChecks": false, - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordova-plugin-statusbar/tsconfig.json b/cordova-plugin-statusbar/tsconfig.json index c464e89096..99f1b831a0 100644 --- a/cordova-plugin-statusbar/tsconfig.json +++ b/cordova-plugin-statusbar/tsconfig.json @@ -4,7 +4,8 @@ "target": "es6", "noImplicitAny": false, "strictNullChecks": false, - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordova-plugin-vibration/tsconfig.json b/cordova-plugin-vibration/tsconfig.json index 8835563a00..65aa81393a 100644 --- a/cordova-plugin-vibration/tsconfig.json +++ b/cordova-plugin-vibration/tsconfig.json @@ -4,7 +4,8 @@ "target": "es6", "noImplicitAny": false, "strictNullChecks": false, - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordova-plugin-websql/tsconfig.json b/cordova-plugin-websql/tsconfig.json index 36e7e41481..7bace33807 100644 --- a/cordova-plugin-websql/tsconfig.json +++ b/cordova-plugin-websql/tsconfig.json @@ -4,7 +4,8 @@ "target": "es6", "noImplicitAny": false, "strictNullChecks": false, - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordova/tsconfig.json b/cordova/tsconfig.json index 417dadb8b6..afe8d4ba45 100644 --- a/cordova/tsconfig.json +++ b/cordova/tsconfig.json @@ -9,7 +9,8 @@ "../" ], "types": [], - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/ids/tsconfig.json b/ids/tsconfig.json index 822ef6cd32..85fbd7f361 100644 --- a/ids/tsconfig.json +++ b/ids/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "module": "commonjs", - "target": "es5", + "target": "es6", "noImplicitAny": true, "strictNullChecks": false, "baseUrl": "../", diff --git a/lodash/tsconfig.json b/lodash/tsconfig.json index dd337af9c4..0a0d666d66 100644 --- a/lodash/tsconfig.json +++ b/lodash/tsconfig.json @@ -290,7 +290,7 @@ ], "compilerOptions": { "module": "commonjs", - "target": "es5", + "target": "es6", "noImplicitAny": true, "strictNullChecks": false, "baseUrl": "../", diff --git a/object-refs/tsconfig.json b/object-refs/tsconfig.json index 472dc47723..6b81d1c07d 100644 --- a/object-refs/tsconfig.json +++ b/object-refs/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "module": "commonjs", - "target": "es5", + "target": "es6", "noImplicitAny": true, "strictNullChecks": false, "baseUrl": "../", diff --git a/resolve/tsconfig.json b/resolve/tsconfig.json index 3327aff4ab..61c58f56db 100644 --- a/resolve/tsconfig.json +++ b/resolve/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "module": "commonjs", - "target": "es5", + "target": "es6", "noImplicitAny": true, "strictNullChecks": false, "baseUrl": "../", diff --git a/ssh2-streams/tsconfig.json b/ssh2-streams/tsconfig.json index 476b06feb6..78441a6fbf 100644 --- a/ssh2-streams/tsconfig.json +++ b/ssh2-streams/tsconfig.json @@ -9,7 +9,8 @@ "../" ], "types": [], - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/ssh2/tsconfig.json b/ssh2/tsconfig.json index 4ab8f30918..a89361b4db 100644 --- a/ssh2/tsconfig.json +++ b/ssh2/tsconfig.json @@ -9,7 +9,8 @@ "../" ], "types": [], - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/winrt-uwp/tsconfig.json b/winrt-uwp/tsconfig.json index e8f51c4af5..79b9eb6b27 100644 --- a/winrt-uwp/tsconfig.json +++ b/winrt-uwp/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "module": "commonjs", - "target": "es5", + "target": "es6", "noImplicitAny": true, "strictNullChecks": false, "baseUrl": "../", diff --git a/winrt/tsconfig.json b/winrt/tsconfig.json index e8f51c4af5..79b9eb6b27 100644 --- a/winrt/tsconfig.json +++ b/winrt/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "module": "commonjs", - "target": "es5", + "target": "es6", "noImplicitAny": true, "strictNullChecks": false, "baseUrl": "../", diff --git a/yayson/tsconfig.json b/yayson/tsconfig.json index dc04b6dd8c..33d32555f9 100644 --- a/yayson/tsconfig.json +++ b/yayson/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "module": "commonjs", - "target": "es5", + "target": "es6", "noImplicitAny": true, "strictNullChecks": false, "baseUrl": "../", From c1b6039500e6f37d3a88af7ef8c026014efb72c7 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Tue, 8 Nov 2016 13:18:44 -0800 Subject: [PATCH 189/246] Upgrade angular-ui-router-uib-modal for types-2.0 --- angular-clipboard/tsconfig.json | 2 +- .../angular-ui-router-uib-modal-tests.ts | 2 -- ...ar-ui-router-uib-modal.d.ts => index.d.ts} | 10 ++++++---- angular-ui-router-uib-modal/tsconfig.json | 19 +++++++++++++++++++ 4 files changed, 26 insertions(+), 7 deletions(-) rename angular-ui-router-uib-modal/{angular-ui-router-uib-modal.d.ts => index.d.ts} (64%) create mode 100644 angular-ui-router-uib-modal/tsconfig.json diff --git a/angular-clipboard/tsconfig.json b/angular-clipboard/tsconfig.json index df3b091b93..1f69b1e8fa 100644 --- a/angular-clipboard/tsconfig.json +++ b/angular-clipboard/tsconfig.json @@ -14,6 +14,6 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": false + "forceConsistentCasingInFileNames": true } } diff --git a/angular-ui-router-uib-modal/angular-ui-router-uib-modal-tests.ts b/angular-ui-router-uib-modal/angular-ui-router-uib-modal-tests.ts index 3f14b2a40f..2ca6e18806 100644 --- a/angular-ui-router-uib-modal/angular-ui-router-uib-modal-tests.ts +++ b/angular-ui-router-uib-modal/angular-ui-router-uib-modal-tests.ts @@ -1,5 +1,3 @@ -/// - angular.module("test", [ "ui.bootstrap", "ui.router", diff --git a/angular-ui-router-uib-modal/angular-ui-router-uib-modal.d.ts b/angular-ui-router-uib-modal/index.d.ts similarity index 64% rename from angular-ui-router-uib-modal/angular-ui-router-uib-modal.d.ts rename to angular-ui-router-uib-modal/index.d.ts index 598fe964fe..29e963fc6e 100644 --- a/angular-ui-router-uib-modal/angular-ui-router-uib-modal.d.ts +++ b/angular-ui-router-uib-modal/index.d.ts @@ -3,10 +3,12 @@ // Definitions by: Stepan Riha // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +import * as auir from "angular-ui-router"; -declare namespace angular.ui { - interface IState { - modal?: boolean | string[]; +declare module "angular" { + namespace ui { + interface IState { + modal?: boolean | string[]; + } } } diff --git a/angular-ui-router-uib-modal/tsconfig.json b/angular-ui-router-uib-modal/tsconfig.json new file mode 100644 index 0000000000..08dbd4d4cf --- /dev/null +++ b/angular-ui-router-uib-modal/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "angular-ui-router-uib-modal-tests.ts" + ] +} \ No newline at end of file From 559095e6e29b571cae70fd6a7afc4ce4fd750ed8 Mon Sep 17 00:00:00 2001 From: thevtm Date: Tue, 8 Nov 2016 19:49:40 -0200 Subject: [PATCH 190/246] Revert "[@types/mongoose] Declare a right type for _id" --- mongoose/index.d.ts | 2 +- passport-local-mongoose/passport-local-mongoose-tests.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/mongoose/index.d.ts b/mongoose/index.d.ts index 12c92571b5..150d94b2df 100644 --- a/mongoose/index.d.ts +++ b/mongoose/index.d.ts @@ -871,7 +871,7 @@ declare module "mongoose" { /** Hash containing current validation errors. */ errors: Object; /** This documents _id. */ - _id: mongodb.ObjectID; + _id: any; /** Boolean flag specifying if the document is new. */ isNew: boolean; /** The documents schema. */ diff --git a/passport-local-mongoose/passport-local-mongoose-tests.ts b/passport-local-mongoose/passport-local-mongoose-tests.ts index 21a928a8d7..7b428561fe 100644 --- a/passport-local-mongoose/passport-local-mongoose-tests.ts +++ b/passport-local-mongoose/passport-local-mongoose-tests.ts @@ -23,6 +23,7 @@ import { Strategy as LocalStrategy } from 'passport-local'; //#region Test Models interface User extends PassportLocalDocument { + _id: string; username: string; hash: string; salt: string; From 5257be31cc94a912aaf88812f1e474543319e203 Mon Sep 17 00:00:00 2001 From: haoliangyu Date: Tue, 8 Nov 2016 22:47:52 -0500 Subject: [PATCH 191/246] update --- leaflet/index.d.ts | 32 ++++++++++++++++++++++++++++++++ leaflet/leaflet-tests.ts | 20 ++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/leaflet/index.d.ts b/leaflet/index.d.ts index feb9694126..d43a2303da 100644 --- a/leaflet/index.d.ts +++ b/leaflet/index.d.ts @@ -1185,6 +1185,38 @@ declare namespace L { distance: number; } + export namespace DomEvent { + export function on(el: HTMLElement, types: string, fn: (ev: Event) => any, context?: Object): typeof DomEvent; + + export function on(el: HTMLElement, eventMap: {[eventName: string]: Function}, context?: Object): typeof DomEvent; + + export function off(el: HTMLElement, types: string, fn: (ev: Event) => any, context?: Object): typeof DomEvent; + + export function off(el: HTMLElement, eventMap: {[eventName: string]: Function}, context?: Object): typeof DomEvent; + + export function stopPropagation(ev: Event): typeof DomEvent; + + export function disableScrollPropagation(el: HTMLElement): typeof DomEvent; + + export function disableClickPropagation(el: HTMLElement): typeof DomEvent; + + export function preventDefault(ev: Event): typeof DomEvent; + + export function stop(ev: Event): typeof DomEvent; + + export function getMousePosition(ev: Event, container?: HTMLElement): Point; + + export function getWheelDelta(ev: Event): number; + + export function addListener(el: HTMLElement, types: string, fn: (ev: Event) => any, context?: Object): typeof DomEvent; + + export function addListener(el: HTMLElement, eventMap: {[eventName: string]: Function}, context?: Object): typeof DomEvent; + + export function removeListener(el: HTMLElement, types: string, fn: (ev: Event) => any, context?: Object): typeof DomEvent; + + export function removeListener(el: HTMLElement, eventMap: {[eventName: string]: Function}, context?: Object): typeof DomEvent; + } + interface DefaultMapPanes { mapPane: HTMLElement; tilePane: HTMLElement; diff --git a/leaflet/leaflet-tests.ts b/leaflet/leaflet-tests.ts index 0551118cee..34a5fa245f 100644 --- a/leaflet/leaflet-tests.ts +++ b/leaflet/leaflet-tests.ts @@ -207,6 +207,26 @@ tileLayer = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png'); tileLayer = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', tileLayerOptions); tileLayer = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png?{foo}&{bar}&{abc}', {foo: 'bar', bar: (data: any) => 'foo', abc: () => ''}); +let eventHandler = () => {}; +let domEvent: Event = {} as Event; +L.DomEvent + .on(htmlElement, 'click', eventHandler) + .addListener(htmlElement, 'click', eventHandler) + .off(htmlElement, 'click', eventHandler) + .removeListener(htmlElement, 'click', eventHandler) + .on(htmlElement, {'click': eventHandler}) + .addListener(htmlElement, {'click': eventHandler}) + .off(htmlElement, {'click': eventHandler}, eventHandler) + .removeListener(htmlElement, {'click': eventHandler}, eventHandler) + .stopPropagation(domEvent) + .disableScrollPropagation(htmlElement) + .disableClickPropagation(htmlElement) + .preventDefault(domEvent) + .stop(domEvent); +point = L.DomEvent.getMousePosition(domEvent); +point = L.DomEvent.getMousePosition(domEvent, htmlElement); +const wheelDelta: number = L.DomEvent.getWheelDelta(domEvent); + map = map // addControl // removeControl From 64aaaba714c81bc5fbd761cc465bf29da6ec2609 Mon Sep 17 00:00:00 2001 From: maylukas Date: Wed, 9 Nov 2016 10:17:00 +0100 Subject: [PATCH 192/246] Added ui5 typescript definitions Added definitions for SAPUI5 / OpenUI5 --- ui5/jquery.sap.d.ts | 187 + ui5/sap.m.d.ts | 43301 ++++++++++++++++++++++++++++++++++++++++++ ui5/sap.ui.d.ts | 36396 +++++++++++++++++++++++++++++++++++ ui5/ui5-tests.ts | 111 + 4 files changed, 79995 insertions(+) create mode 100644 ui5/jquery.sap.d.ts create mode 100644 ui5/sap.m.d.ts create mode 100644 ui5/sap.ui.d.ts create mode 100644 ui5/ui5-tests.ts diff --git a/ui5/jquery.sap.d.ts b/ui5/jquery.sap.d.ts new file mode 100644 index 0000000000..a6450638b8 --- /dev/null +++ b/ui5/jquery.sap.d.ts @@ -0,0 +1,187 @@ +// Type definitions for OpenUI5 +// Project: http://openui5.org/ +// Definitions by: Lukas May +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +interface Ui5Logger { + //Allows to add a new LogListener that will be notified for new log entries. + addLogListener(oListener: any): void; + //Creates a new debug-level entry in the log with the given message, details and calling component. + debug(sMessage: string, sDetails?: string, sComponent?: string): void; + //Creates a new error-level entry in the log with the given message, details and calling component. + error(sMessage: string, sDetails?: string, sComponent?: string): void; + //Creates a new fatal-level entry in the log with the given message, details and calling component. + fatal(sMessage: string, sDetails?: string, sComponent?: string): void; + //Returns the log level currently effective for the given component. + getLevel(sComponent?: string): void; + //Returns the logged entries recorded so far as an array. + getLogEntries(): void; + //Returns a jQuery.sap.log.Logger for the given component. + getLogger(sComponent: string, iDefaultLogLevel?: any): void; + //Creates a new info-level entry in the log with the given message, details and calling component. + info(sMessage: string, sDetails?: string, sComponent?: string): void; + //Checks whether logging is enabled for the given log level, depending on the currently effective log level for the given component. + isLoggable(iLevel?: any, sComponent?: string): void; + //Allows to remove a registered LogListener. + removeLogListener(oListener: any): void; + //Defines the maximum jQuery.sap.log.Level of log entries that will be recorded. + setLevel(iLogLevel: any, sComponent?: string): void; + //Creates a new trace-level entry in the log with the given message, details and calling component. + trace(sMessage: string, sDetails?: string, sComponent?: string): void; + //Creates a new warning-level entry in the log with the given message, details and calling component. + warning(sMessage: string, sDetails?: string, sComponent?: string): void; +} +interface JquerySap { + log: Ui5Logger + // Adds a whitelist entry for URL valiadtion + addUrlWhitelist(protocol: any, host: any, port: any, path: any): void; + // Calculate delta of old list and new list This implements the algorithm described in "A Technique for Isolating Differences Between Files" (Commun. + arrayDiff(aOld: any, aNew: any, fnCompare?: any, bUniqueEntries?: any): void; + // A simple assertion mechanism that logs a message when a given condition is not met. + assert(bResult: any, sMessage: any): void; + // Binds all events for listening with the given callback function. + bindAnyEvent(fnCallback: any): void; + // Shortcut for jQuery("#" + id) with additionally the id being escaped properly. + byId(sId: any, oContext: any): void; + // Transforms a hyphen separated string to an camel case string. + camelCase(sString: any): void; + // Converts a character of the string to upper case. + charToUpperCase(sString: any, iPos: any): void; + // Checks a given mouseover or mouseout event whether it is equivalent to a mouseenter or mousleave event regarding the given DOM reference. + checkMouseEnterOrLeave(oEvent: any, oDomRef: any): void; + // Stops the delayed call. + clearDelayedCall(sDelayedCallId: any): void; + // Stops the interval call. + clearIntervalCall(sIntervalCallId: any): void; + // clears the whitelist for URL valiadtion + clearUrlWhitelist(): void; + // Returns whether oDomRefChild is oDomRefContainer or is contained in oDomRefContainer. + containsOrEquals(oDomRefContainer: any, oDomRefChild: any): void; + // Declares a module as existing. + declare(sModuleName: any, bCreateNamespace?: any): void; + // Calls a method after a given delay and returns an id for this timer + delayedCall(iDelay: any, oObject: any, method: any, aParameters?: any): void; + // For the given scroll position measured from the "beginning" of a container (the right edge in RTL mode) this method returns the scrollLeft value as understood by the current browser in RTL mode. + denormalizeScrollBeginRTL(iNormalizedScrollBegin: any, oDomRef: any): void; + // For the given scrollLeft value this method returns the scrollLeft value as understood by the current browser in RTL mode. + denormalizeScrollLeftRTL(iNormalizedScrollLeft: any, oDomRef: any): void; + // Disable touch to mouse handling + disableTouchToMouseHandling(): void; + // Shortcut for document.getElementById(), including a bug fix for older IE versions. + domById(sId: any, oWindow?: any): void; + // Encode the string for inclusion into CSS string literals or identifiers + encodeCSS(sString: any): void; + // Encode the string for inclusion into HTML content/attribute + encodeHTML(sString: any): void; + // Encode the string for inclusion into a JS string literal + encodeJS(sString: any): void; + // Encode the string for inclusion into an URL parameter + encodeURL(sString: any): void; + // Encode a map of parameters into a combined URL parameter string + encodeURLParameters(mParams: any): void; + // Encode the string for inclusion into XML content/attribute + encodeXML(sString: any): void; + // Checks whether a given sString ends with sEndString respecting the case of the strings. + endsWith(sString: any, sEndString: any): void; + // Checks whether a given sString ends with sEndString ignoring the case of the strings. + endsWithIgnoreCase(sString: any, sEndString: any): void; + // Compares the two given values for equality, especially takes care not to compare arrays and objects by reference: any, but compares their content. + equal(a: any, b: any, maxDepth?: any, contains?: any): void; + // This function escapes the reserved letters in Regular Expression + escapeRegExp(sString: any): void; + // Returns a new constructor function that creates objects with the given prototype. + factory(oPrototype: any): void; + // Calls focus() on the given DOM element, but catches and ignores any errors that occur when doing so. + focus(oDomRef: any): void; + // Creates a string from a pattern by replacing placeholders with concrete values. + formatMessage(sPattern: any, aValues?: any): void; + // Returns the names of all declared modules. + getAllDeclaredModules(): void; + // Constructs an URL to load the module with the given name and file type (suffix). + getModulePath(sModuleName: any, sSuffix: any): void; + // Returns a JavaScript object which is identified by a sequence of names. + getObject(sName: any, iNoCreates?: any, oContext?: any): void; + // Determines the URL for a resource given its unified resource name. + getResourcePath(sResourceName: any): void; + // Returns a new function that returns the given oValue (using its closure). + getter(oValue: any): void; + // Creates and returns a new instance of jQuery.sap.util.UriParameters. + getUriParameters(sUri: any): void; + // Gets the whitelist for URL valiadtion + getUrlWhitelist(): void; + // Executes an 'eval' for its arguments in the global context (without closure variables). + globalEval(): void; + // Transforms a camel case string into a hyphen separated string. + hyphen(sString: any): void; + // Includes the script (via