From 0d185df10f38811febb9ac73edc61cbaafb2b745 Mon Sep 17 00:00:00 2001 From: lucap86 Date: Sun, 10 Jul 2016 17:09:41 +0200 Subject: [PATCH 0001/1066] refs #9944 --- howlerjs/howler.d.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/howlerjs/howler.d.ts b/howlerjs/howler.d.ts index c52b9c334f..9e245a8058 100644 --- a/howlerjs/howler.d.ts +++ b/howlerjs/howler.d.ts @@ -52,20 +52,20 @@ interface Howl { onpause: Function; onplay: Function; load(): Howl; - play(sprite?: string, callback?: (soundId: number) => void): Howl; - play(callback?: (soundId: number) => void): Howl; - pause(soundId?: number): Howl; - stop(soundId?: number): Howl; - mute(soundId?: number): Howl; - unmute(soundId?: number): Howl; - fade(from: number, to: number, duration: number, callback?: Function, soundId?: number): Howl; + play(sprite?: string, callback?: (soundId: string) => void): Howl; + play(callback?: (soundId: string) => void): Howl; + pause(soundId?: string): Howl; + stop(soundId?: string): Howl; + mute(soundId?: string): Howl; + unmute(soundId?: string): Howl; + fade(from: number, to: number, duration: number, callback?: Function, soundId?: string): Howl; loop(): boolean; loop(loop: boolean): Howl; - pos(position?: number, soundId?: number): number; - pos3d(x: number, y: number, z: number, soundId?: number): any; + pos(position?: number, soundId?: string): number; + pos3d(x: number, y: number, z: number, soundId?: string): any; sprite(definition?: IHowlSoundSpriteDefinition): IHowlSoundSpriteDefinition; volume(): number; - volume(volume?: number, soundId?: number): Howl; + volume(volume?: number, soundId?: string): Howl; urls(): string[]; urls(urls: string[]): Howl; on(event: string, listener?: Function): Howl; From f5fd8fb18064d6a4e17a673b61e0f0f42d1115f0 Mon Sep 17 00:00:00 2001 From: sqwk Date: Thu, 18 Aug 2016 11:48:34 +0200 Subject: [PATCH 0002/1066] 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 0003/1066] 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 0004/1066] 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 0005/1066] 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 0006/1066] 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 0007/1066] 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 0008/1066] 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 499906f96eb5cce3409678ff663b6f59ab4f4fcb Mon Sep 17 00:00:00 2001 From: lucap86 Date: Mon, 19 Sep 2016 10:02:50 +0200 Subject: [PATCH 0009/1066] refs #11265 --- greensock/greensock.d.ts | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/greensock/greensock.d.ts b/greensock/greensock.d.ts index a3b3801775..ec3e1c6eb9 100644 --- a/greensock/greensock.d.ts +++ b/greensock/greensock.d.ts @@ -13,6 +13,37 @@ interface IDispatcher { declare type Tween = TweenLite | TweenMax; declare type Timeline = SimpleTimeline | TimelineLite | TimelineMax; +declare type TweenConfig = { + [tweenProp: string]: any; + delay?: number; + ease?: Ease; + repeat?: number; + repeatDelay?: number; + yoyo?: boolean; + paused?: boolean; + overwrite?: string|number; + onComplete?: Function; + immediateRender?: boolean; + onCompleteParams?: any[]; + onCompleteScope?: Object; + onRepeat?: Function; + onRepeatScope?: Object; + onReverseComplete?: Function; + onReverseCompleteParams?: any[]; + onReverseCompleteScope?: Object; + onStart?: Function; + onStartParams?: any[]; + onStartScope?: Object; + onUpdate?: Function; + onUpdateParams?: any[]; + onUpdateScope?: Object; + startAt?: Object; + useFrames?: boolean; + lazy?: boolean; + onOverwrite?: Function; + autoCSS?: boolean; + callbackScope?: Object; +} //com.greensock.core declare class Animation { @@ -86,7 +117,7 @@ declare class TweenLite extends Animation { static killTweensOf(target: Object, onlyActive?: boolean, vars?: Object): void; static lagSmoothing(threshold: number, adjustedLag: number): void; static set(target: Object, vars: Object): TweenLite; - static to(target: Object, duration: number, vars: Object): TweenLite; + static to(target: Object, duration: number, vars: TweenConfig): TweenLite; } declare class TweenMax extends TweenLite { @@ -112,7 +143,7 @@ declare class TweenMax extends TweenLite { static staggerFrom(targets: any, duration: number, vars: Object, stagger: number, onCompleteAll?: Function, onCompleteAllParams?: any[], onCompleteAllScope?: any): any[]; static staggerFromTo(targets: any, duration: number, fromVars: Object, toVars: Object, stagger: number, onCompleteAll?: Function, onCompleteAllParams?: any[], onCompleteAllScope?: any): any[]; static staggerTo(targets: any, duration: number, vars: Object, stagger: number, onCompleteAll?: Function, onCompleteAllParams?: any[], onCompleteAllScope?: any): any[]; - static to(target:Object, duration:number, vars:Object):TweenMax; + static to(target:Object, duration:number, vars:TweenConfig):TweenMax; updateTo(vars: Object, resetDuration?: boolean): TweenMax; yoyo(): boolean; yoyo(value?: boolean): TweenMax; From 1aac11abc7b85c476a83463d6ac13a17868238cb Mon Sep 17 00:00:00 2001 From: lucap86 Date: Mon, 19 Sep 2016 10:13:51 +0200 Subject: [PATCH 0010/1066] refs #11265 --- greensock/greensock.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/greensock/greensock.d.ts b/greensock/greensock.d.ts index ec3e1c6eb9..004ec79dab 100644 --- a/greensock/greensock.d.ts +++ b/greensock/greensock.d.ts @@ -44,7 +44,7 @@ declare type TweenConfig = { autoCSS?: boolean; callbackScope?: Object; } - + //com.greensock.core declare class Animation { static ticker: IDispatcher; From 32d2d303801d66040da468734c4cd496f38b329f Mon Sep 17 00:00:00 2001 From: Roman Reshetnikov Date: Fri, 23 Sep 2016 13:58:29 +0300 Subject: [PATCH 0011/1066] DevExpress ASP.NET 16.1.6 --- devexpress-web/devexpress-web.d.ts | 599 ++++++++++++++++++++--------- 1 file changed, 417 insertions(+), 182 deletions(-) diff --git a/devexpress-web/devexpress-web.d.ts b/devexpress-web/devexpress-web.d.ts index c2e0014f85..7c3eeda936 100644 --- a/devexpress-web/devexpress-web.d.ts +++ b/devexpress-web/devexpress-web.d.ts @@ -619,7 +619,7 @@ interface ASPxClientDashboardDesigner extends ASPxClientControl { */ DashboardStateChanged: ASPxClientEvent>; /** - * Occurs after a dashboard displayed in the ASPxClientDashboardDesigner is changed. + * Occurs after another dashboard is loaded to the ASPxClientDashboardDesigner. */ DashboardChanged: ASPxClientEvent>; /** @@ -1670,9 +1670,9 @@ interface ASPxClientBinaryImage extends ASPxClientEdit { */ PerformCallback(parameter: string): void; /** - * - * @param parameter - * @param onSuccess + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param parameter A string value that contains any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; } @@ -3407,9 +3407,9 @@ interface ASPxClientGaugeControl extends ASPxClientControl { */ PerformCallback(parameter: string): void; /** - * - * @param parameter - * @param onSuccess + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; } @@ -8023,9 +8023,9 @@ interface ASPxClientPivotGrid extends ASPxClientControl { */ PerformCallback(args: string): void; /** - * - * @param args - * @param onSuccess + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(args: string, onSuccess: (arg1: string) => void): void; } @@ -8304,9 +8304,9 @@ interface ASPxClientRichEdit extends ASPxClientControl { */ PerformCallback(parameter: string): void; /** - * - * @param parameter - * @param onSuccess + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; /** @@ -9358,6 +9358,8 @@ interface AbstractNumberingList { * Exposes the settings providing the information about the essential document functionality. */ interface SubDocument { + id: number; + type: any; /** * Provides information about paragraphs contained in the document. * Value: An array of Paragraph objects storing information about document paragraphs. @@ -9645,6 +9647,12 @@ declare enum HeaderFooterType { Primary=1, Even=2 } +declare enum SubDocumentType { + Main=0, + Header=1, + Footer=2, + TextBox=3 +} /** * Contains a set of methods and properties to work with the document selection. */ @@ -9825,6 +9833,9 @@ interface RichEditSelection { * Selects the editor's entire content. */ selectAll(): void; + setMainSubDocumentAsActive(): void; + setFooterSubDocumentAsActiveByPageIndex(pageIndex: number): void; + setHeaderSubDocumentAsActiveByPageIndex(pageIndex: number): void; } /** * Defines a document's interval. @@ -10199,11 +10210,6 @@ interface FileSaveCommand extends CommandWithSimpleStateBase { * Executes the FileSaveCommand command by imitating the corresponding end-user action made in the RichEdit's UI. May result in taking no action if the command's state does not allow command execution. Use the object's getState method to check the command state. */ execute(): boolean; - /** - * Executes the FileSaveCommand command by applying the specified setting. May result in taking no action if the command's state does not allow command execution. Use the object's getState method to check the command state. - * @param path A string value specifying path to the saving file. - */ - execute(path: string): boolean; } /** * A command to invoke the Save As dialog that prompts for a file name and saves the current document in a file with the specified path. @@ -10657,7 +10663,7 @@ declare enum ListLevelFormat { DecimalEnclosedCircle=12, DecimalEnclosedCircleChinese=13, DecimalEnclosedFullstop=14, - DecimalEnclosedParenthses=15, + DecimalEnclosedParentheses=15, DecimalFullWidth=16, DecimalFullWidth2=17, DecimalHalfWidth=18, @@ -12125,6 +12131,170 @@ declare enum BorderLineStyle { ThreeDEngrave=23, Outset=24, Inset=25, + Apples=26, + ArchedScallops=27, + BabyPacifier=28, + BabyRattle=29, + Balloons3Colors=30, + BalloonsHotAir=31, + BasicBlackDashes=32, + BasicBlackDots=33, + BasicBlackSquares=34, + BasicThinLines=35, + BasicWhiteDashes=36, + BasicWhiteDots=37, + BasicWhiteSquares=38, + BasicWideInline=39, + BasicWideMidline=40, + BasicWideOutline=41, + Bats=42, + Birds=43, + BirdsFlight=44, + Cabins=45, + CakeSlice=46, + CandyCorn=47, + CelticKnotwork=48, + CertificateBanner=49, + ChainLink=50, + ChampagneBottle=51, + CheckedBarBlack=52, + CheckedBarColor=53, + Checkered=54, + ChristmasTree=55, + CirclesLines=56, + CirclesRectangles=57, + ClassicalWave=58, + Clocks=59, + Compass=60, + Confetti=61, + ConfettiGrays=62, + ConfettiOutline=63, + ConfettiStreamers=64, + ConfettiWhite=65, + CornerTriangles=66, + CouponCutoutDashes=67, + CouponCutoutDots=68, + CrazyMaze=69, + CreaturesButterfly=70, + CreaturesFish=71, + CreaturesInsects=72, + CreaturesLadyBug=73, + CrossStitch=74, + Cup=75, + DecoArch=76, + DecoArchColor=77, + DecoBlocks=78, + DiamondsGray=79, + DoubleD=80, + DoubleDiamonds=81, + Earth1=82, + Earth2=83, + EclipsingSquares1=84, + EclipsingSquares2=85, + EggsBlack=86, + Fans=87, + Film=88, + Firecrackers=89, + FlowersBlockPrint=90, + FlowersDaisies=91, + FlowersModern1=92, + FlowersModern2=93, + FlowersPansy=94, + FlowersRedRose=95, + FlowersRoses=96, + FlowersTeacup=97, + FlowersTiny=98, + Gems=99, + GingerbreadMan=100, + Gradient=101, + Handmade1=102, + Handmade2=103, + HeartBalloon=104, + HeartGray=105, + Hearts=106, + HeebieJeebies=107, + Holly=108, + HouseFunky=109, + Hypnotic=110, + IceCreamCones=111, + LightBulb=112, + Lightning1=113, + Lightning2=114, + MapleLeaf=115, + MapleMuffins=116, + MapPins=117, + Marquee=118, + MarqueeToothed=119, + Moons=120, + Mosaic=121, + MusicNotes=122, + Northwest=123, + Ovals=124, + Packages=125, + PalmsBlack=126, + PalmsColor=127, + PaperClips=128, + Papyrus=129, + PartyFavor=130, + PartyGlass=131, + Pencils=132, + People=133, + PeopleHats=134, + PeopleWaving=135, + Poinsettias=136, + PostageStamp=137, + Pumpkin1=138, + PushPinNote1=139, + PushPinNote2=140, + Pyramids=141, + PyramidsAbove=142, + Quadrants=143, + Rings=144, + Safari=145, + Sawtooth=146, + SawtoothGray=147, + ScaredCat=148, + Seattle=149, + ShadowedSquares=150, + SharksTeeth=151, + ShorebirdTracks=152, + Skyrocket=153, + SnowflakeFancy=154, + Snowflakes=155, + Sombrero=156, + Southwest=157, + Stars=158, + Stars3d=159, + StarsBlack=160, + StarsShadowed=161, + StarsTop=162, + Sun=163, + Swirligig=164, + TornPaper=165, + TornPaperBlack=166, + Trees=167, + TriangleParty=168, + Triangles=169, + Tribal1=170, + Tribal2=171, + Tribal3=172, + Tribal4=173, + Tribal5=174, + Tribal6=175, + TwistedLines1=176, + TwistedLines2=177, + Vine=178, + Waveline=179, + WeavingAngles=180, + WeavingBraid=181, + WeavingRibbon=182, + WeavingStrips=183, + WhiteFlowers=184, + Woodwork=185, + XIllusions=186, + ZanyTriangles=187, + ZigZag=188, + ZigZagStitch=189, Nil=-1 } /** @@ -14070,6 +14240,11 @@ interface ASPxClientAppointmentDragEventArgs extends ASPxClientEventArgs { * Value: An ASPxClientAppointmentOperation object providing methods to perform the required operation. */ operation: ASPxClientAppointmentOperation; + /** + * Provides information about dragged appointments. + * Value: An array of ASPxClientAppointmentDragInfo objects storing information about dragged appointments. + */ + dragInformation: ASPxClientAppointmentDragInfo[]; } interface AppointmentResizeEventHandler { /** @@ -14093,6 +14268,51 @@ interface ASPxClientAppointmentResizeEventArgs extends ASPxClientEventArgs { * Value: An ASPxClientAppointmentOperation object providing methods to perform the required operation. */ operation: ASPxClientAppointmentOperation; + /** + * Gets the resized appointment's identifier. + * Value: A string containing an appointment identifier. + */ + appointmentId: string; + /** + * Gets the appointment's interval before resizing. + * Value: An object representing the interval assigned to the appointment. + */ + oldInterval: ASPxClientTimeInterval; + /** + * Gets the appointment's interval after resizing. + * Value: An object representing the interval assigned to the appointment. + */ + newInterval: ASPxClientTimeInterval; +} +/** + * Stores information about an appointment drag operation. + */ +interface ASPxClientAppointmentDragInfo { + /** + * Gets the dragged appointment's identifier. + * Value: A string containing an appointment identifier. + */ + appointmentId: string; + /** + * Gets the appointment's interval before the drag operation. + * Value: An object representing the interval assigned to the appointment. + */ + oldInterval: ASPxClientTimeInterval; + /** + * Gets resources that were associated with the appointment before the drag operation. + * Value: A array of strings containing resource identifiers. + */ + oldResources: string[]; + /** + * Gets the appointment's interval after the drag operation. + * Value: An object representing the interval assigned to the appointment. + */ + newInterval: ASPxClientTimeInterval; + /** + * Gets resources associated with the appointment after the drag operation. + * Value: An array of strings containing resource identifiers. + */ + newResources: string[]; } /** * Contains information about a client tooltip. @@ -14429,9 +14649,9 @@ interface ASPxClientSpreadsheet extends ASPxClientControl { */ PerformCallback(parameter: string): void; /** - * - * @param parameter - * @param onSuccess + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; /** @@ -14580,6 +14800,9 @@ interface ASPxClientTreeList extends ASPxClientControl { * Sets input focus to the ASPxTreeList. */ Focus(): void; + /** + * Gets the Popup Edit Form. + */ GetPopupEditForm(): ASPxClientPopupControl; /** * Returns the focused node's key value. @@ -14638,9 +14861,9 @@ interface ASPxClientTreeList extends ASPxClientControl { */ PerformCallback(args: string): void; /** - * - * @param args - * @param onSuccess + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(args: string, onSuccess: (arg1: string) => void): void; /** @@ -15219,9 +15442,9 @@ interface MVCxClientCallbackPanel extends ASPxClientCallbackPanel { */ PerformCallback(data: Object): void; /** - * - * @param data - * @param onSuccess + * Sends a callback with a parameter to update the Callback Panel by processing the passed information on the server, in an Action specified by the Callback Panel's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** @@ -15230,9 +15453,9 @@ interface MVCxClientCallbackPanel extends ASPxClientCallbackPanel { */ PerformCallback(parameter: string): void; /** - * - * @param parameter - * @param onSuccess + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; } @@ -15250,9 +15473,9 @@ interface MVCxClientCardView extends ASPxClientCardView { */ PerformCallback(data: Object): void; /** - * - * @param data - * @param onSuccess + * Sends a callback with a parameter to update the CardView by processing the passed information on the server, in an Action specified via the CardView's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CardView's CustomActionRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** @@ -15287,9 +15510,9 @@ interface MVCxClientChart extends ASPxClientWebChartControl { */ PerformCallback(data: Object): void; /** - * - * @param data - * @param onSuccess + * Sends a callback with a parameter to update a Chart by processing the passed information on the server, in an Action specified via the Chart's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** @@ -15298,9 +15521,9 @@ interface MVCxClientChart extends ASPxClientWebChartControl { */ PerformCallback(args: string): void; /** - * - * @param args - * @param onSuccess + * Sends a callback to the server and generates the server-side event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(args: string, onSuccess: (arg1: string) => void): void; } @@ -15318,9 +15541,9 @@ interface MVCxClientComboBox extends ASPxClientComboBox { */ PerformCallback(data: Object): void; /** - * - * @param data - * @param onSuccess + * Sends a callback with a parameter to update the ComboBox by processing the passed information on the server, in an Action specified by the ComboBox's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** @@ -15343,9 +15566,9 @@ interface MVCxClientDataView extends ASPxClientDataView { */ PerformCallback(data: Object): void; /** - * - * @param data - * @param onSuccess + * Sends a callback with a parameter to update the DataView by processing the passed information on the server, in an Action specified via the DataView's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** @@ -15354,9 +15577,9 @@ interface MVCxClientDataView extends ASPxClientDataView { */ PerformCallback(parameter: string): void; /** - * - * @param parameter - * @param onSuccess + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; } @@ -15375,9 +15598,9 @@ interface MVCxClientDockManager extends ASPxClientDockManager { */ PerformCallback(data: Object): void; /** - * - * @param data - * @param onSuccess + * Sends a callback with a parameter to update the DockManager by processing the passed information on the server, in an Action specified by the DockManager's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** @@ -15386,9 +15609,9 @@ interface MVCxClientDockManager extends ASPxClientDockManager { */ PerformCallback(parameter: string): void; /** - * - * @param parameter - * @param onSuccess + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that contains any information that needs to be sent to the server-side Callback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; } @@ -15406,9 +15629,9 @@ interface MVCxClientDockPanel extends ASPxClientDockPanel { */ PerformCallback(data: Object): void; /** - * - * @param data - * @param onSuccess + * Sends a callback with a parameter to update the DockPanel by processing the passed information on the server, in an Action specified by the DockPanel's DockPanelSettings.CallbackRouteValues) property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** @@ -15431,9 +15654,9 @@ interface MVCxClientFileManager extends ASPxClientFileManager { */ PerformCallback(data: Object): void; /** - * - * @param data - * @param onSuccess + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param data A string value that specifies any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** @@ -15442,9 +15665,9 @@ interface MVCxClientFileManager extends ASPxClientFileManager { */ PerformCallback(args: string): void; /** - * - * @param args - * @param onSuccess + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that specifies any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(args: string, onSuccess: (arg1: string) => void): void; } @@ -15462,9 +15685,9 @@ interface MVCxClientGridView extends ASPxClientGridView { */ PerformCallback(data: Object): void; /** - * - * @param data - * @param onSuccess + * Sends a callback with a parameter to update the GridView by processing the passed information on the server, in an Action specified via the grid's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the grid's CustomActionRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** @@ -15525,9 +15748,9 @@ interface MVCxClientImageGallery extends ASPxClientImageGallery { */ PerformCallback(data: Object): void; /** - * - * @param data - * @param onSuccess + * Sends a callback with a parameter to update the ImageGallery by processing the passed information on the server, in an Action specified via the ImageGallery's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** @@ -15536,9 +15759,9 @@ interface MVCxClientImageGallery extends ASPxClientImageGallery { */ PerformCallback(parameter: string): void; /** - * - * @param parameter - * @param onSuccess + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; } @@ -15556,9 +15779,9 @@ interface MVCxClientListBox extends ASPxClientListBox { */ PerformCallback(data: Object): void; /** - * - * @param data - * @param onSuccess + * Sends a callback with a parameter to update the ListBox by processing the passed information on the server, in an Action specified by the ListBox's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** @@ -15590,9 +15813,9 @@ interface MVCxClientPivotGrid extends ASPxClientPivotGrid { */ PerformCallback(data: Object): void; /** - * - * @param data - * @param onSuccess + * Sends a callback with a parameter to update the PivotGrid by processing the passed information on the server, in an Action specified via the grid's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the grid's CustomActionRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** @@ -15606,9 +15829,9 @@ interface MVCxClientPivotGrid extends ASPxClientPivotGrid { */ PerformCallback(args: string): void; /** - * - * @param args - * @param onSuccess + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(args: string, onSuccess: (arg1: string) => void): void; } @@ -15626,9 +15849,9 @@ interface MVCxClientPopupControl extends ASPxClientPopupControl { */ PerformCallback(data: Object): void; /** - * - * @param data - * @param onSuccess + * Sends a callback with a parameter to update the PopupControl by processing the passed information on the server, in an Action specified via the PopupControl's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CallbackRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** @@ -15644,10 +15867,10 @@ interface MVCxClientPopupControl extends ASPxClientPopupControl { */ PerformWindowCallback(window: ASPxClientPopupWindow, parameter: string): void; /** - * - * @param window - * @param parameter - * @param onSuccess + * Sends a callback with parameters to update the popup window by processing the related popup window and the passed information on the server. + * @param window A ASPxClientPopupWindow object identifying the processed popup window. + * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformWindowCallback(window: ASPxClientPopupWindow, parameter: string, onSuccess: (arg1: string) => void): void; /** @@ -15721,9 +15944,9 @@ interface MVCxClientReportDesigner extends ASPxClientReportDesigner { */ PerformCallback(arg: Object): void; /** - * - * @param arg - * @param onSuccess + * Sends a callback to the server and generates the server-side event, passing it the specified argument. + * @param arg A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(arg: Object, onSuccess: (arg1: string) => void): void; /** @@ -15732,9 +15955,9 @@ interface MVCxClientReportDesigner extends ASPxClientReportDesigner { */ PerformCallback(arg: string): void; /** - * - * @param arg - * @param onSuccess + * Sends a callback to the server and generates the server-side event, passing it the specified argument. + * @param arg A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(arg: string, onSuccess: (arg1: string) => void): void; } @@ -15773,9 +15996,9 @@ interface MVCxClientRichEdit extends ASPxClientRichEdit { */ PerformCallback(data: Object): void; /** - * - * @param data - * @param onSuccess + * Sends a callback with a parameter to update the RichEdit by processing the passed information on the server, in an Action specified via the CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** @@ -15784,9 +16007,9 @@ interface MVCxClientRichEdit extends ASPxClientRichEdit { */ PerformCallback(parameter: string): void; /** - * - * @param parameter - * @param onSuccess + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; } @@ -15804,9 +16027,9 @@ interface MVCxClientRoundPanel extends ASPxClientRoundPanel { */ PerformCallback(data: Object): void; /** - * - * @param data - * @param onSuccess + * Sends a callback with a parameter to update the Round Panel by processing the passed information on the server, in an Action specified by the Round Panel's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** @@ -15815,9 +16038,9 @@ interface MVCxClientRoundPanel extends ASPxClientRoundPanel { */ PerformCallback(parameter: string): void; /** - * - * @param parameter - * @param onSuccess + * Sends a callback to the server and generates the server-side ContentCallback event, passing it the specified argument. + * @param parameter A string value that is any information that needs to be sent to the server-side ContentCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; } @@ -15836,9 +16059,9 @@ interface MVCxClientScheduler extends ASPxClientScheduler { */ PerformCallback(data: Object): void; /** - * - * @param data - * @param onSuccess + * Sends a callback with a parameter to update the Scheduler by processing the passed information on the server, in an Action specified via the Scheduler's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** @@ -15890,9 +16113,9 @@ interface MVCxClientSpreadsheet extends ASPxClientSpreadsheet { */ PerformCallback(data: Object): void; /** - * - * @param data - * @param onSuccess + * Sends a callback with a parameter to update the Spreadsheet by processing the passed information on the server, in an Action specified via the CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** @@ -15901,9 +16124,9 @@ interface MVCxClientSpreadsheet extends ASPxClientSpreadsheet { */ PerformCallback(parameter: string): void; /** - * - * @param parameter - * @param onSuccess + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; } @@ -15921,9 +16144,9 @@ interface MVCxClientPageControl extends ASPxClientPageControl { */ PerformCallback(data: Object): void; /** - * - * @param data - * @param onSuccess + * Sends a callback with a parameter to update the PageControl by processing the passed information on the server, in an Action specified by the PageControl's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** @@ -15932,9 +16155,9 @@ interface MVCxClientPageControl extends ASPxClientPageControl { */ PerformCallback(parameter: string): void; /** - * - * @param parameter - * @param onSuccess + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; } @@ -15952,9 +16175,9 @@ interface MVCxClientTokenBox extends ASPxClientTokenBox { */ PerformCallback(data: Object): void; /** - * - * @param data - * @param onSuccess + * Sends a callback with a parameter to update the TokenBox by processing the passed information on the server, in an Action specified by the TokenBox's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** @@ -15977,9 +16200,9 @@ interface MVCxClientTreeList extends ASPxClientTreeList { */ PerformCallback(data: Object): void; /** - * - * @param data - * @param onSuccess + * Sends a callback with a parameter to update the TreeList by processing the passed information on the server, in an Action specified via the TreeList's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** @@ -15993,9 +16216,9 @@ interface MVCxClientTreeList extends ASPxClientTreeList { */ PerformCallback(args: string): void; /** - * - * @param args - * @param onSuccess + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(args: string, onSuccess: (arg1: string) => void): void; /** @@ -16095,9 +16318,9 @@ interface MVCxClientVerticalGrid extends ASPxClientVerticalGrid { */ PerformCallback(data: Object): void; /** - * - * @param data - * @param onSuccess + * Sends a callback with a parameter to update the VerticalGrid by processing the passed information on the server in an Action specified via the grid's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the grid's CustomActionRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** @@ -16221,9 +16444,9 @@ interface ASPxClientCallback extends ASPxClientControl { */ PerformCallback(parameter: string): void; /** - * - * @param parameter - * @param onSuccess + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; } @@ -16280,9 +16503,9 @@ interface ASPxClientCallbackPanel extends ASPxClientControl { */ PerformCallback(parameter: string): void; /** - * - * @param parameter - * @param onSuccess + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; /** @@ -16788,9 +17011,9 @@ interface ASPxClientDataView extends ASPxClientControl { */ PerformCallback(parameter: string): void; /** - * - * @param parameter - * @param onSuccess + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; } @@ -16858,9 +17081,9 @@ interface ASPxClientDockManager extends ASPxClientControl { */ PerformCallback(parameter: string): void; /** - * - * @param parameter - * @param onSuccess + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that contains any information that needs to be sent to the server-side Callback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; /** @@ -17604,9 +17827,9 @@ interface ASPxClientFileManager extends ASPxClientControl { */ PerformCallback(args: string): void; /** - * - * @param args - * @param onSuccess + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that specifies any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(args: string, onSuccess: (arg1: string) => void): void; } @@ -18889,6 +19112,9 @@ interface ASPxClientMenuBase extends ASPxClientControl { * Represents a client collection that maintains client menu objects. */ interface ASPxClientMenuCollection extends ASPxClientControlCollection { + /** + * Recalculates the position of visible sub menus. + */ RecalculateAll(): void; /** * Hides all menus maitained by the collection. @@ -19589,10 +19815,10 @@ interface ASPxClientPopupControl extends ASPxClientPopupControlBase { */ PerformWindowCallback(window: ASPxClientPopupWindow, parameter: string): void; /** - * - * @param window - * @param parameter - * @param onSuccess + * Sends a callback with parameters to update the popup window by processing the related popup window and the passed information on the server. + * @param window A ASPxClientPopupWindow object identifying the processed popup window. + * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformWindowCallback(window: ASPxClientPopupWindow, parameter: string, onSuccess: (arg1: string) => void): void; /** @@ -20479,9 +20705,9 @@ interface ASPxClientRoundPanel extends ASPxClientPanelBase { */ PerformCallback(parameter: string): void; /** - * - * @param parameter - * @param onSuccess + * Sends a callback to the server and generates the server-side ContentCallback event, passing it the specified argument. + * @param parameter A string value that is any information that needs to be sent to the server-side ContentCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; /** @@ -20854,9 +21080,9 @@ interface ASPxClientPageControl extends ASPxClientTabControlBase { */ PerformCallback(parameter: string): void; /** - * - * @param parameter - * @param onSuccess + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; } @@ -21712,9 +21938,9 @@ interface ASPxClientChartDesigner extends ASPxClientControl { */ PerformCallback(arg: string): void; /** - * - * @param arg - * @param onSuccess + * Sends a callback to the server and generates the server-side event, passing it the specified argument. + * @param arg A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(arg: string, onSuccess: (arg1: string) => void): void; /** @@ -21871,9 +22097,9 @@ interface ASPxClientWebChartControl extends ASPxClientControl { */ PerformCallback(args: string): void; /** - * - * @param args - * @param onSuccess + * Sends a callback to the server and generates the server-side event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(args: string, onSuccess: (arg1: string) => void): void; /** @@ -22103,7 +22329,7 @@ interface ASPxClientWebChartHitInfo { */ inChartTitle: boolean; /** - * Gets a value indicating whether the test point is within the axis. + * Gets a value indicating whether the test point is within the . * Value: true if the test point is within an axis; otherwise, false. */ inAxis: boolean; @@ -22333,17 +22559,17 @@ interface ASPxClientDiagramCoordinates { */ dateTimeValue: Date; /** - * Gets the X-axis of the diagram point. + * Gets the X- of the diagram point. * Value: An ASPxClientAxisBase descendant, representing the axis of arguments (X-axis). */ axisX: ASPxClientAxisBase; /** - * Gets the Y-axis of the diagram point. + * Gets the Y- of the diagram point. * Value: An ASPxClientAxisBase descendant, representing the axis of values (Y-axis). */ axisY: ASPxClientAxisBase; /** - * Gets the pane of the diagram point. + * Gets the of the diagram point. * Value: An ASPxClientXYDiagramPane descendant, representing the pane. */ pane: ASPxClientXYDiagramPane; @@ -22562,12 +22788,12 @@ interface ASPxClientXYDiagram2D extends ASPxClientXYDiagramBase { */ secondaryAxesY: ASPxClientAxis[]; /** - * Provides access to a default pane object. + * Provides access to a default object. * Value: An ASPxClientXYDiagramPane object which represents the default pane of a chart. */ defaultPane: ASPxClientXYDiagramPane; /** - * Provides access to an array of a diagram's panes. + * Provides access to an array of a diagram's . * Value: An array of ASPxClientXYDiagramPane objects. */ panes: ASPxClientXYDiagramPane[]; @@ -22699,7 +22925,7 @@ interface ASPxClientRadarAxis extends ASPxClientAxisBase { */ interface ASPxClientAxisTitle extends ASPxClientWebChartRequiredElement { /** - * Gets the axis to which the axis title belongs. + * Gets the to which the axis title belongs. * Value: An ASPxClientAxisBase descendant, which identifies the axis. */ axis: ASPxClientAxisBase; @@ -22714,7 +22940,7 @@ interface ASPxClientAxisTitle extends ASPxClientWebChartRequiredElement { */ interface ASPxClientAxisLabelItem extends ASPxClientWebChartRequiredElement { /** - * Gets the axis to which an axis label item belongs. + * Gets the to which an axis label item belongs. * Value: An ASPxClientAxisBase descendant, which identifies the axis. */ axis: ASPxClientAxisBase; @@ -23875,9 +24101,9 @@ interface ASPxClientQueryBuilder extends ASPxClientControl { */ PerformCallback(arg: string): void; /** - * - * @param arg - * @param onSuccess + * Sends a callback to the server and generates the server-side event, passing it the specified argument. + * @param arg A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(arg: string, onSuccess: (arg1: string) => void): void; /** @@ -24036,9 +24262,9 @@ interface ASPxClientReportDesigner extends ASPxClientControl { */ PerformCallback(arg: string): void; /** - * - * @param arg - * @param onSuccess + * Sends a callback to the server and generates the server-side event, passing it the specified argument. + * @param arg A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(arg: string, onSuccess: (arg1: string) => void): void; /** @@ -25128,6 +25354,7 @@ interface ASPxClientButtonEditStatic extends ASPxClientButtonEditBaseStatic { Cast(obj: Object): ASPxClientButtonEdit; } interface ASPxClientTokenBoxStatic extends ASPxClientComboBoxStatic { + Cast(obj: Object): ASPxClientTokenBox; } interface ASPxClientTrackBarStatic extends ASPxClientEditStatic { /** @@ -25909,6 +26136,7 @@ interface ASPxClientPivotGridStatic extends ASPxClientControlStatic { interface ASPxClientPivotCustomizationStatic extends ASPxClientControlStatic { } interface ASPxClientRichEditStatic extends ASPxClientControlStatic { + Cast(obj: Object): ASPxClientRichEdit; } interface ASPxSchedulerDateTimeHelperStatic { /** @@ -25922,10 +26150,11 @@ interface ASPxSchedulerDateTimeHelperStatic { */ ToDayTime(date: Date): any; /** - * Adds the specified number of days to a DateTime object and returns the result. - * @param date A DateTime object to which to add days. + * + * @param date + * @param dayCount */ - AddDays(date: Date): Date; + AddDays(date: Date, dayCount: number): Date; /** * Adds the specified timespan to a DateTime object and returns the result. * @param date A DateTime object to which to add a timespan. @@ -25978,6 +26207,7 @@ interface ASPxClientSpellCheckerStatic extends ASPxClientControlStatic { Cast(obj: Object): ASPxClientSpellChecker; } interface ASPxClientSpreadsheetStatic extends ASPxClientControlStatic { + Cast(obj: Object): ASPxClientSpreadsheet; } interface ASPxClientTreeListStatic extends ASPxClientControlStatic { /** @@ -26393,6 +26623,11 @@ interface ASPxClientFileManagerErrorConstsStatic { AlreadyExists: number; } interface ASPxClientFormLayoutStatic extends ASPxClientControlStatic { + /** + * Converts the specified object to the current object's type. This method is effective when you utilize the Client API IntelliSense feature provided by DevExpress. + * @param obj The client object to be type cast. Represents an instance of a DevExpress web control's client object. + */ + Cast(obj: Object): ASPxClientFormLayout; } interface ASPxClientHiddenFieldStatic extends ASPxClientControlStatic { /** From 6151d69fadae62c9a4636a0736b0820b53f44e44 Mon Sep 17 00:00:00 2001 From: Boriss Nazarovs Date: Sat, 24 Sep 2016 14:37:30 +0300 Subject: [PATCH 0012/1066] 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 0013/1066] 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 27fcabddb24d3cdd2e9d615bfedfe0a932e21e2f Mon Sep 17 00:00:00 2001 From: lucap86 Date: Thu, 29 Sep 2016 10:36:26 +0200 Subject: [PATCH 0014/1066] Fixed ease types --- greensock/greensock.d.ts | 224 ++++++++++++++++++--------------------- 1 file changed, 103 insertions(+), 121 deletions(-) diff --git a/greensock/greensock.d.ts b/greensock/greensock.d.ts index 004ec79dab..1e3ee642ac 100644 --- a/greensock/greensock.d.ts +++ b/greensock/greensock.d.ts @@ -44,7 +44,7 @@ declare type TweenConfig = { autoCSS?: boolean; callbackScope?: Object; } - + //com.greensock.core declare class Animation { static ticker: IDispatcher; @@ -198,109 +198,106 @@ declare class TimelineMax extends TimelineLite { } //com.greensock.easing -interface Back { - easeIn:Ease; - easeInOut:Ease; - easeOut:Ease; +declare class Ease { + constructor(func:Function, extraParams:any[], type:number, power:number); + public getRatio(p: number): number; } -interface Bounce { - easeIn:Ease; - easeInOut:Ease; - easeOut:Ease; -} -interface Circ { - easeIn:Ease; - easeInOut:Ease; - easeOut:Ease; -} -interface Cubic { - easeIn:Ease; - easeInOut:Ease; - easeOut:Ease; -} -interface Ease { - getRatio(p:number):number; -} -interface EaseLookup { - find(name:string):Ease; -} -interface Elastic { - easeIn:Ease; - easeInOut:Ease; - easeOut:Ease; -} -interface Expo { - easeIn:Ease; - easeInOut:Ease; - easeOut:Ease; -} -interface Linear { - ease:Linear; - easeIn:Linear; - easeInOut:Linear; - easeNone:Linear; - easeOut:Linear; -} -interface Power0 { - easeIn:Ease; - easeInOut:Ease; - easeOut:Ease; -} -interface Power1 { - easeIn:Ease; - easeInOut:Ease; - easeOut:Ease; -} -interface Power2 { - easeIn:Ease; - easeInOut:Ease; - easeOut:Ease; -} -interface Power3 { - easeIn:Ease; - easeInOut:Ease; - easeOut:Ease; -} -interface Power4 { - easeIn:Ease; - easeInOut:Ease; - easeOut:Ease; -} -interface Quad { - easeIn:Ease; - easeInOut:Ease; - easeOut:Ease; -} -interface Quart { - easeIn:Ease; - easeInOut:Ease; - easeOut:Ease; -} -interface Quint { - easeIn:Ease; - easeInOut:Ease; - easeOut:Ease; -} -interface Sine { - easeIn:Ease; - easeInOut:Ease; - easeOut:Ease; -} -interface SlowMo { - ease:SlowMo; - new (linearRatio:number, power:number, yoyoMode:boolean):SlowMo; - config(linearRatio:number, power:number, yoyoMode:boolean):SlowMo; - getRatio(p:number):number; +declare class EaseLookup { + public static find(name: string): Ease; } -interface SteppedEase { - config(steps:number):SteppedEase; - getRatio(p:number):number; + +declare class Back extends Ease { + public static easeIn: Back; + public static easeInOut: Back; + public static easeOut: Back; + public config(overshoot: number): Elastic; + } -interface Strong { - easeIn:Ease; - easeInOut:Ease; - easeOut:Ease; +declare class Bounce extends Ease { + public static easeIn: Bounce; + public static easeInOut: Bounce; + public static easeOut: Bounce; +} +declare class Circ extends Ease { + public static easeIn: Circ; + public static easeInOut: Circ; + public static easeOut: Circ; +} +declare class Cubic extends Ease { + public static easeIn: Cubic; + public static easeInOut: Cubic; + public static easeOut: Cubic; +} + +declare class Elastic extends Ease { + public static easeIn: Elastic; + public static easeInOut: Elastic; + public static easeOut: Elastic; + public config(amplitude: number, period: number): Elastic; +} + +declare class Expo extends Ease { + public static easeIn: Expo; + public static easeInOut: Expo; + public static easeOut: Expo; +} + +declare class Linear extends Ease { + public static ease: Linear; + public static easeIn: Linear; + public static easeInOut: Linear; + public static easeNone: Linear; + public static easeOut: Linear; +} + +declare class Quad extends Ease { + public static easeIn: Quad; + public static easeInOut: Quad; + public static easeOut: Quad; +} + +declare class Quart extends Ease { + public static easeIn: Quart; + public static easeInOut: Quart; + public static easeOut: Quart; +} + +declare class Quint extends Ease { + public static easeIn: Quint; + public static easeInOut: Quint; + public static easeOut: Quint; +} + +declare class Sine extends Ease { + public static easeIn: Sine; + public static easeInOut: Sine; + public static easeOut: Sine; +} + +declare class SlowMo extends Ease { + public static ease: SlowMo; + public config(linearRatio: number, power: number, yoyoMode: boolean): SlowMo; +} + +declare class SteppedEase extends Ease { + constructor(staps: number); + public config(steps: number): SteppedEase; +} + +declare type RoughEaseConfig = { + clamp?: boolean; + points?: number; + randomize?: boolean; + strength?: number; + taper?: string; /* one of "in" | "out" | "both" | "none" */ + template?: Ease; +} + +declare class RoughEase extends Ease { + public static ease: RoughEase; + constructor(vars: RoughEaseConfig); + public config(steps: number): SteppedEase; } //com.greensock.plugins @@ -335,27 +332,12 @@ interface TweenPlugin { } //com.greensock.easing -declare var Back:Back; -declare var Bounce:Bounce; -declare var Circ:Circ; -declare var Cubic:Cubic; -declare var Ease:Ease; -declare var EaseLookup:EaseLookup; -declare var Elastic:Elastic; -declare var Expo:Expo; -declare var Linear:Linear; -declare var Power0:Power0; -declare var Power1:Power1; -declare var Power2:Power2; -declare var Power3:Power3; -declare var Power4:Power4; -declare var Quad:Quad; -declare var Quart:Quart; -declare var Quint:Quint; -declare var Sine:Sine; -declare var SlowMo:SlowMo; -declare var SteppedEase:SteppedEase; -declare var Strong:Strong; +declare var Power0: typeof Linear; +declare var Power1: typeof Quad; +declare var Power2: typeof Cubic; +declare var Power3: typeof Quart; +declare var Power4: typeof Quint; +declare var Strong: typeof Quint; //com.greensock.plugins declare var BezierPlugin:BezierPlugin; From 93a4381634e2d4d50e925b5218f63455ce4d9022 Mon Sep 17 00:00:00 2001 From: gatsbimantico Date: Thu, 29 Sep 2016 14:09:42 +0200 Subject: [PATCH 0015/1066] 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 0016/1066] 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 0017/1066] 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 4f1c124243f852aa86942f82bac8b723f47c38d5 Mon Sep 17 00:00:00 2001 From: Alex Kankov Date: Fri, 30 Sep 2016 14:26:12 +0700 Subject: [PATCH 0018/1066] Object with themes --- amcharts/AmCharts.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/amcharts/AmCharts.d.ts b/amcharts/AmCharts.d.ts index 4f5dbe90f7..ae5baad50e 100644 --- a/amcharts/AmCharts.d.ts +++ b/amcharts/AmCharts.d.ts @@ -23,6 +23,9 @@ declare namespace AmCharts { /** Set it to true if you want UTC time to be used instead of local time. */ var useUTC: boolean; + + /** Object with themes */ + var themes: any; /** Clears all the charts on page, removes listeners and intervals. */ function clear(); From 29bf3b2414e2a611ee98fda86b9256016a908fa1 Mon Sep 17 00:00:00 2001 From: Alex Gorbatchev Date: Fri, 30 Sep 2016 09:32:07 -0700 Subject: [PATCH 0019/1066] [rethinkdb] Clean up the listing issues in the test --- rethinkdb/rethinkdb-tests.ts | 48 +++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/rethinkdb/rethinkdb-tests.ts b/rethinkdb/rethinkdb-tests.ts index 4dbd7ab638..1654d182e0 100644 --- a/rethinkdb/rethinkdb-tests.ts +++ b/rethinkdb/rethinkdb-tests.ts @@ -1,17 +1,20 @@ /// -import r = require("rethinkdb") +import r = require("rethinkdb"); -r.connect({host:"localhost", port: 28015}, function(err, conn) { - console.log("HI", err, conn) - var testDb = r.db('test') - testDb.tableCreate('users').run(conn, function(err, stuff) { - var users = testDb.table('users') +r.connect({ host: "localhost", port: 28015 }, function(err, conn) { + console.log("HI", err, conn); - users.insert({name: "bob"}).run(conn, function() {}) + const testDb = r.db("test"); + + testDb.tableCreate("users").run(conn, function(err, stuff) { + const users = testDb.table("users"); + + users.insert({ name: "bob" }).run(conn, function() { + }); users.filter(function(doc?) { - return doc("henry").eq("bob") + return doc("henry").eq("bob"); }) .between("james", "beth") .limit(4) @@ -19,26 +22,27 @@ r.connect({host:"localhost", port: 28015}, function(err, conn) { cursor.toArray().then(rows => { console.log(rows); }); - }) - - }) -}) + }); + }); +}); // use promises instead of callbacks -r.connect({host:"localhost", port: 28015}).then(function(conn) { - console.log("HI", conn) - var testDb = r.db('test') - testDb.tableCreate('users').run(conn).then(function(stuff) { - var users = testDb.table('users') +r.connect({ host: "localhost", port: 28015 }).then(function(conn) { + console.log("HI", conn); - users.insert({name: "bob"}).run(conn, function() {}) + const testDb = r.db("test"); + + testDb.tableCreate("users").run(conn).then(function(stuff) { + const users = testDb.table("users"); + + users.insert({ name: "bob" }).run(conn, function() { + }); users.filter(function(doc?) { - return doc("henry").eq("bob") + return doc("henry").eq("bob"); }) .between("james", "beth") .limit(4) .run(conn); - - }) -}) + }); +}); From 655bd4c93bf6790a75d94625ccef332c47416ea8 Mon Sep 17 00:00:00 2001 From: Alex Gorbatchev Date: Fri, 30 Sep 2016 10:32:33 -0700 Subject: [PATCH 0020/1066] [rethinkdb] Removes Bluebird dependency, adds many missing methods and overloads --- rethinkdb/rethinkdb-tests.ts | 23 ++- rethinkdb/rethinkdb.d.ts | 263 ++++++++++++++++++++++++++++++++--- rethinkdb/tsconfig.json | 9 ++ 3 files changed, 270 insertions(+), 25 deletions(-) create mode 100644 rethinkdb/tsconfig.json diff --git a/rethinkdb/rethinkdb-tests.ts b/rethinkdb/rethinkdb-tests.ts index 1654d182e0..633c82e2ec 100644 --- a/rethinkdb/rethinkdb-tests.ts +++ b/rethinkdb/rethinkdb-tests.ts @@ -1,6 +1,4 @@ -/// - -import r = require("rethinkdb"); +import * as r from "rethinkdb"; r.connect({ host: "localhost", port: 28015 }, function(err, conn) { console.log("HI", err, conn); @@ -19,11 +17,19 @@ r.connect({ host: "localhost", port: 28015 }, function(err, conn) { .between("james", "beth") .limit(4) .run(conn, function(err, cursor) { - cursor.toArray().then(rows => { - console.log(rows); + cursor.toArray((err, strings) => { + console.log(strings); }); }); }); + + r.js("'str1' + 'str2'").run(conn, function (err, value) {}); + r.uuid().run(conn, function (err, uuid) {}); + r.uuid("input value").run(conn, function (err, uuid) {}); + + r.table("games").changes().run(conn, function(err, cursor) { + cursor.each(console.log); + }); }); // use promises instead of callbacks @@ -43,6 +49,11 @@ r.connect({ host: "localhost", port: 28015 }).then(function(conn) { }) .between("james", "beth") .limit(4) - .run(conn); + .run(conn) + .then(cursor => { + cursor.toArray().then(rows => { + console.log(rows); + }); + }); }); }); diff --git a/rethinkdb/rethinkdb.d.ts b/rethinkdb/rethinkdb.d.ts index a34ef1fbce..6d87eccf50 100644 --- a/rethinkdb/rethinkdb.d.ts +++ b/rethinkdb/rethinkdb.d.ts @@ -1,14 +1,34 @@ -// Type definitions for Rethinkdb 1.10.0 +// +// Type definitions for RethinkDB 2.3 // Project: http://rethinkdb.com/ -// Definitions by: Sean Hess +// +// Definitions by: Sean Hess , Alex Gorbatchev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// Reference: http://www.rethinkdb.com/api/#js -// TODO: Document manipulation and below -/// +// +// Reference: https://rethinkdb.com/api/javascript/ +// +// Notes: +// - Currently missing control structures and geospatial commands. Please help out! +// +// Testing: +// $ tsc --noImplicitAny --module commonjs -p rethinkdb/ +// +/// + +/** + * https://rethinkdb.com/api/javascript/ + */ declare module "rethinkdb" { - - export function connect(host: ConnectionOptions, cb?: (err: Error, conn: Connection) => void): Promise; + /** + * Create a new connection to the database server. + * + * See: https://rethinkdb.com/api/javascript/connect/ + */ + export function connect(opts: ConnectionOptions, cb: (err: ReqlDriverError, conn: Connection) => void): void; + export function connect(host: string, cb: (err: ReqlDriverError, conn: Connection) => void): void; + export function connect(opts: ConnectionOptions): Promise; + export function connect(host: string): Promise; export function dbCreate(name: string): Operation; export function dbDrop(name: string): Operation; @@ -32,6 +52,19 @@ declare module "rethinkdb" { // Control Structures export function branch(test: Expression, trueBranch: Expression, falseBranch: Expression): Expression; + /** + * Create a javascript expression. + * + * @param {Number} timeout - The number of seconds before `r.js` times out. The default value is `5` seconds. + */ + export function js(jsString: string, opts?: { timeout: number }): Operation; + + /** + * Return a UUID (universally unique identifier), a string that can be used as a unique ID. If a string is passed to uuid as an argument, the UUID will be deterministic, derived from the string’s SHA-1 hash. + * + * RethinkDB’s UUIDs are standards-compliant. Without the optional argument, a version 4 random UUID will be generated; with that argument, a version 5 UUID will be generated, using a fixed namespace UUID of 91461c99-f89d-49d2-af96-d8e2e14e9b58. + */ + export function uuid(input?: string): Operation; export class Cursor { hasNext(): boolean; @@ -49,19 +82,57 @@ declare module "rethinkdb" { close(): Promise; } + /** + * Connection options. + * + * See: https://rethinkdb.com/api/javascript/connect/ + */ interface ConnectionOptions { - host: string; - port: number; + /** The host to connect to (default `localhost`) */ + host?: string; + + /** The port to connect on (default `28015`) */ + port?: number; + + /** The default database (default `test`) */ db?: string; - authKey?: string; + + /** The user account to connect as (default `admin`) */ + user?: string; + + /** The password for the user account to connect as (default `''`, empty) */ + password?: string; + + /** Timeout period in seconds for the connection to be opened (default `20`) */ + timeout?: number; + + /** + * A hash of options to support SSL connections (default `null`). Currently, + * there is only one option available, and if the `ssl` option is specified, + * this key is required. + */ + ssl?: { + /** A list of Node.js `Buffer` objects containing SSL CA certificates */ + ca: Buffer[]; + }; + } + + interface NoReplyWait { + noreplyWait: boolean; } interface Connection { + open: boolean; + close(cb: (err: Error) => void): void; - close(opts: { noreplyWait: boolean }, cb: (err: Error) => void): void; + close(opts: NoReplyWait, cb: (err: Error) => void): void; close(): Promise; - close(opts: { noreplyWait: boolean }): Promise; - reconnect(cb?: (err: Error, conn: Connection) => void): Promise; + close(opts: NoReplyWait): Promise; + + reconnect(cb: (err: Error, conn: Connection) => void): void; + reconnect(opts: NoReplyWait, cb: (err: Error, conn: Connection) => void): void; + reconnect(opts?: NoReplyWait): Promise; + use(dbName: string): void; addListener(event: string, cb: Function): void; on(event: string, cb: Function): void; @@ -92,6 +163,45 @@ declare module "rethinkdb" { delete(options?: UpdateOptions): Operation; } + /** + * See: https://rethinkdb.com/api/javascript/changes/ + */ + interface ChangesOptions { + /** + * Controls how change notifications are batched. Acceptable values are `true`, `false` and a numeric value: + * + * * `true`: When multiple changes to the same document occur before a batch of notifications is sent, the changes are “squashed†into one change. The client receives a notification that will bring it fully up to date with the server. + * * `false`: All changes will be sent to the client verbatim. This is the default. + * * `n`: A numeric value (floating point). Similar to `true`, but the server will wait `n` seconds to respond in order to squash as many changes together as possible, reducing network traffic. The first batch will always be returned immediately. + */ + squash: boolean | number; + + /** + * The number of changes the server will buffer between client reads before it starts dropping changes and generates an error (default: 100,000). + */ + changefeedQueueSize: number; + + /** + * If `true`, the changefeed stream will begin with the current contents of the table or selection being monitored. These initial results will have `new_val` fields, but no `old_val` fields. The initial results may be intermixed with actual changes, as long as an initial result for the changed document has already been given. If an initial result for a document has been sent and a change is made to that document that would move it to the unsent part of the result set (e.g., a changefeed monitors the top 100 posters, the first 50 have been sent, and poster 48 has become poster 52), an “uninitial†notification will be sent, with an `old_val` field but no `new_val` field. + */ + includeInitial: boolean; + + /** + * If `true`, the changefeed stream will include special status documents consisting of the field `state` and a string indicating a change in the feed’s state. These documents can occur at any point in the feed between the notification documents described below. If `includeStates` is `false` (the default), the status documents will not be sent. + */ + includeStates: boolean; + + /** + * If `true`, a changefeed stream on an `orderBy.limit` changefeed will include `old_offset` and `new_offset` fields in status documents that include `old_val` and `new_val`. This allows applications to maintain ordered lists of the stream’s result set. If `old_offset` is set and not `null`, the element at `old_offset` is being deleted; if `new_offset` is set and not `null`, then `new_val` is being inserted at `new_offset`. Setting `includeOffsets` to `true` on a changefeed that does not support it will raise an error. + */ + includeOffsets: boolean; + + /** + * If `true`, every result on a changefeed will include a `type` field with a string that indicates the kind of change the result represents: `add`, `remove`, `change`, `initial`, `uninitial`, `state`. Defaults to `false`. + */ + includeTypes: boolean; + } + interface Table extends Sequence { indexCreate(name: string, index?: ExpressionFunction): Operation; indexDrop(name: string): Operation; @@ -103,16 +213,27 @@ declare module "rethinkdb" { get(key: string): Sequence; // primary key getAll(key: string, index?: Index): Sequence; // without index defaults to primary key getAll(...keys: string[]): Sequence; + + /** + * Turn a query into a changefeed, an infinite stream of objects representing + * changes to the query’s results as they occur. A changefeed may return changes + * to a table or an individual document (a “point†changefeed). Commands such as + * filter or `map` may be used before the changes command to transform or filter + * the output, and many commands that operate on sequences can be chained after + * `changes`. + * + * See: https://rethinkdb.com/api/javascript/changes/ + */ + changes(opts?: ChangesOptions): Sequence; } interface Sequence extends Operation, Writeable { - between(lower: any, upper: any, index?: Index): Sequence; + filter(rql: ExpressionFunction): Sequence; filter(rql: Expression): Sequence; filter(obj: { [key: string]: any }): Sequence; - // Join // these return left, right innerJoin(sequence: Sequence, join: JoinFunction): Sequence; @@ -231,16 +352,120 @@ declare module "rethinkdb" { default(value: T): Expression; } + interface OperationOptions { + /** + * One of three possible values affecting the consistency guarantee for the query (default: 'single'). + * + * * 'single' (the default) returns values that are in memory (but not necessarily written to disk) on the primary replica. + * * 'majority' will only return values that are safely committed on disk on a majority of replicas. This requires sending a message to every replica on each read, so it is the slowest but most consistent. + * * 'outdated' will return values that are in memory on an arbitrarily-selected replica. This is the fastest but least consistent. + */ + readMode: "single" | "majority" | "outdated"; + + /** + * What format to return times in (default: 'native'). Set this to 'raw' if you want times returned as JSON objects for exporting. + */ + timeFormat: "native" | "raw"; + + /** + * Whether or not to return a profile of the query’s execution (default: false). + */ + profile: boolean; + + /** + * Possible values are 'hard' and 'soft'. In soft durability mode RethinkDB will acknowledge the write immediately after receiving it, but before the write has been committed to disk. + */ + durability: "hard" | "soft"; + + /** + * What format to return `grouped_data` and `grouped_streams` in (default: 'native'). Set this to 'raw' if you want the raw pseudotype. + */ + groupFormat: "native" | "raw"; + + /** + * Set to `true` to not receive the result object or cursor and return immediately. + */ + noreply: boolean; + + /** + * The database to run this query against as a string. The default is the database specified in the db parameter to connect (which defaults to test). The database may also be specified with the db command. + */ + db: string; + + /** + * The maximum numbers of array elements that can be returned by a query (default: 100,000). This affects all ReQL commands that return arrays. Note that it has no effect on the size of arrays being written to the database; those always have an upper limit of 100,000 elements. + */ + arrayLimit: number; + + /** + * What format to return binary data in (default: 'native'). Set this to 'raw' if you want the raw pseudotype. + */ + binaryFormat: "native" | "raw"; + + /** + * Minimum number of rows to wait for before batching a result set (default: 8). This is an integer. + */ + minBatchRows: number; + + /** + * Maximum number of rows to wait for before batching a result set (default: unlimited). This is an integer. + */ + maxBatchRows: number; + + /** + * Maximum number of bytes to wait for before batching a result set (default: 1MB). This is an integer. + */ + maxBatchBytes: number; + + /** + * Maximum number of seconds to wait before batching a result set (default: 0.5). This is a float (not an integer) and may be specified to the microsecond. + */ + maxBatchSeconds: number; + + /** + * Factor to scale the other parameters down by on the first batch (default: 4). For example, with this set to 8 and maxBatchRows set to 80, on the first batch maxBatchRows will be adjusted to 10 (80 / 8). This allows the first batch to return faster. + */ + firstBatchScaledownFactor: number; + } + interface Operation { - run(conn: Connection, cb?: (err: Error, result: T) => void): Promise; + /** + * Run a query on a connection. The callback will get either an error, a single JSON result, or a cursor, depending on the query. + * + * See: https://rethinkdb.com/api/javascript/run/ + */ + run(conn: Connection, opts: OperationOptions, cb: (err: Error, result: T) => void): void; + run(conn: Connection, cb: (err: Error, result: T) => void): void; + run(conn: Connection, opts: OperationOptions): Promise; + run(conn: Connection): Promise; } interface Aggregator { } + interface Sort { } - interface Time { } + interface ReqlType { + $reql_type$: string; + } + interface Time extends ReqlType { + $reql_type$: "TIME"; + epoch_time: number; + timezone: string; + } - // http://www.rethinkdb.com/api/#js - // TODO control structures + interface Binary extends ReqlType { + $reql_type$: "BINARY"; + data: string; + } + + interface ReqlError extends Error {} + + /** + * An error has occurred within the driver. This may be a driver bug, or it may + * be an unfulfillable command, such as an unserializable query. + * + * See https://www.rethinkdb.com/docs/error-types/ + */ + interface ReqlDriverError extends ReqlError {} } diff --git a/rethinkdb/tsconfig.json b/rethinkdb/tsconfig.json new file mode 100644 index 0000000000..a7f2567b9c --- /dev/null +++ b/rethinkdb/tsconfig.json @@ -0,0 +1,9 @@ +{ + "compilerOptions": { + "module": "es6", + "target": "es6" + }, + "include": [ + "*.ts" + ] +} From 724ceafbde3450d4afb3797c6c73141e862e75e0 Mon Sep 17 00:00:00 2001 From: Ian Ker-Seymer Date: Fri, 30 Sep 2016 15:45:41 -0400 Subject: [PATCH 0021/1066] 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 45d59849e7a83c52ccd69fbd648cbceacdbca3f2 Mon Sep 17 00:00:00 2001 From: dennispg Date: Sat, 1 Oct 2016 10:41:44 -0500 Subject: [PATCH 0022/1066] export Handsontable as a module --- handsontable/handsontable.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/handsontable/handsontable.d.ts b/handsontable/handsontable.d.ts index 7a82509baa..49b4a307a5 100644 --- a/handsontable/handsontable.d.ts +++ b/handsontable/handsontable.d.ts @@ -290,3 +290,9 @@ declare namespace ht { declare var Handsontable: { new (element: Element, options: ht.Options): ht.Methods; }; + +declare module "handsontable" { + export var Handsontable: { + new (element: Element, options: ht.Options): ht.Methods; + }; +} From ac05be6eedb8055bdbbfa7d640e854dc7a07d082 Mon Sep 17 00:00:00 2001 From: dennispg Date: Sat, 1 Oct 2016 10:47:22 -0500 Subject: [PATCH 0023/1066] Update handsontable.d.ts --- handsontable/handsontable.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/handsontable/handsontable.d.ts b/handsontable/handsontable.d.ts index 49b4a307a5..e358e32cf9 100644 --- a/handsontable/handsontable.d.ts +++ b/handsontable/handsontable.d.ts @@ -292,7 +292,7 @@ declare var Handsontable: { }; declare module "handsontable" { - export var Handsontable: { - new (element: Element, options: ht.Options): ht.Methods; + export = { + Handsontable: Handsontable }; } From 8a019fe8a28ee142972d908265705514656cd7f3 Mon Sep 17 00:00:00 2001 From: dennispg Date: Sat, 1 Oct 2016 10:49:19 -0500 Subject: [PATCH 0024/1066] Update handsontable.d.ts --- handsontable/handsontable.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/handsontable/handsontable.d.ts b/handsontable/handsontable.d.ts index e358e32cf9..49b4a307a5 100644 --- a/handsontable/handsontable.d.ts +++ b/handsontable/handsontable.d.ts @@ -292,7 +292,7 @@ declare var Handsontable: { }; declare module "handsontable" { - export = { - Handsontable: Handsontable + export var Handsontable: { + new (element: Element, options: ht.Options): ht.Methods; }; } From e1820ba703d3737bffe54703458dfc078d671b82 Mon Sep 17 00:00:00 2001 From: Alex Gorbatchev Date: Sun, 2 Oct 2016 09:00:01 -0700 Subject: [PATCH 0025/1066] [rethinkdb] Fixes r.now() return results --- rethinkdb/rethinkdb-tests.ts | 1 + rethinkdb/rethinkdb.d.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/rethinkdb/rethinkdb-tests.ts b/rethinkdb/rethinkdb-tests.ts index 633c82e2ec..a6bc1caadd 100644 --- a/rethinkdb/rethinkdb-tests.ts +++ b/rethinkdb/rethinkdb-tests.ts @@ -14,6 +14,7 @@ r.connect({ host: "localhost", port: 28015 }, function(err, conn) { users.filter(function(doc?) { return doc("henry").eq("bob"); }) + .filter(r.row("updatedAt").default(0).lt(r.now().sub(1000))) .between("james", "beth") .limit(4) .run(conn, function(err, cursor) { diff --git a/rethinkdb/rethinkdb.d.ts b/rethinkdb/rethinkdb.d.ts index 6d87eccf50..83576c84ac 100644 --- a/rethinkdb/rethinkdb.d.ts +++ b/rethinkdb/rethinkdb.d.ts @@ -47,7 +47,7 @@ declare module "rethinkdb" { export function row(name: string): Expression; export function expr(stuff: any): Expression; - export function now(): Time; + export function now(): Expression