diff --git a/jointjs/jointjs.d.ts b/jointjs/jointjs.d.ts index 9e6a2f0cc3..19e2394458 100644 --- a/jointjs/jointjs.d.ts +++ b/jointjs/jointjs.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Joint JS 0.6 +// Type definitions for Joint JS 0.9.3 // Project: http://www.jointjs.com/ -// Definitions by: Aidan Reel , David Durman +// Definitions by: Aidan Reel , David Durman , Ewout Van Gossum // Definitions: https://github.com/borisyankov/DefinitelyTyped /// @@ -16,34 +16,36 @@ declare module joint { } class Graph extends Backbone.Model { - initialize(); - fromJSON(json: any); - clear(); - addCell(cell: Cell); - addCells(cells: Cell[]); - getConnectedLinks(cell: Cell, opt?: any): Link[]; - disconnectLinks(cell: Cell); - removeLinks(cell: Cell); + addCell(cell:Cell) : void; + addCells(cells:Cell[]) : void; + initialize() : void; + fromJSON(json:any) : void; + toJSON() : Object; + clear() : void; + getConnectedLinks(cell:Cell, opt?:any):Link[]; + disconnectLinks(cell:Cell) : void; + removeLinks(cell:Cell) : void; findModelsFromPoint(point:{x : number; y: number}):Element[]; } class Cell extends Backbone.Model { - toJSON(); - remove(options?: any); - toFront(); - toBack(); - embed(cell: Cell); - unembed(cell: Cell); - getEmbeddedCells(): Cell[]; - clone(opt?: any): Backbone.Model; // @todo: return can either be Cell or Cell[]. - attr(attrs: any): Cell; + toJSON() : Object; + remove(options?:any) : void; + toFront() : void; + toBack() : void; + embed(cell:Cell) : void; + unembed(cell:Cell) : void; + getEmbeddedCells():Cell[]; + clone(opt?:any):Backbone.Model; // @todo: return can either be Cell or Cell[]. + attr(attrs:any):Cell; } class Element extends Cell { - position(x: number, y: number): Element; - translate(tx: number, ty?: number): Element; - resize(width: number, height: number): Element; - rotate(angle: number, absolute): Element; + position(x:number, y:number):Element; + translate(tx:number, ty?:number):Element; + resize(width:number, height:number):Element; + rotate(angle:number, options : {absolute : boolean; origin: {x:number;y:number}}):Element; + remove(): void; } interface IDefaults { @@ -51,9 +53,10 @@ declare module joint { } class Link extends Cell { - defaults(): IDefaults; - disconnect(): Link; - label(idx?: number, value?: any): any; // @todo: returns either a label under idx or Link if both idx and value were passed + defaults():IDefaults; + disconnect():Link; + label(idx?:number, value?:any):any; // @todo: returns either a label under idx or Link if both idx and value were passed + remove(): void; } interface IOptions { @@ -66,82 +69,66 @@ declare module joint { } class Paper extends Backbone.View { - options: IOptions; - setDimensions(width: number, height: number); - scale(sx: number, sy?: number, ox?: number, oy?: number): Paper; - rotate(deg: number, ox?: number, oy?: number): Paper; // @todo not released yet though it's in the source code already - findView(el: any): CellView; - findViewByModel(modelOrId: any): CellView; - findViewsFromPoint(p: { x: number; y: number; }): CellView[]; - findViewsInArea(r: { x: number; y: number; width: number; height: number; }): CellView[]; - snapToGrid(p): { x: number; y: number; }; + options:IOptions; + + setDimensions(width:number, height:number) : void; + scale(sx:number, sy?:number, ox?:number, oy?:number):Paper; + rotate(deg:number, ox?:number, oy?:number):Paper; // @todo not released yet though it's in the source code already + findView(el:any):CellView; + findViewByModel(modelOrId:any):CellView; + findViewsFromPoint(p:{ x: number; y: number; }):CellView[]; + findViewsInArea(r:{ x: number; y: number; width: number; height: number; }):CellView[]; } - class ElementView extends CellView { - scale(sx: number, sy: number); + class ElementView extends CellView { + scale(sx:number, sy:number) : void; } class CellView extends Backbone.View { - getBBox(): { x: number; y: number; width: number; height: number; }; - highlight(el?: any); - unhighlight(el?: any); - findMagnet(el: any); - getSelector(el: any); + getBBox():{ x: number; y: number; width: number; height: number; }; + highlight(el?:any): void; + unhighlight(el?:any): void; + findMagnet(el:any): void; + getSelector(el:any): void; + + pointerdblclick(evt:any, x:number, y:number):void; + pointerclick(evt:any, x:number, y:number):void; + pointerdown(evt:any, x:number, y:number):void; + pointermove(evt:any, x:number, y:number):void; + pointerup(evt:any, x:number, y:number):void; } class LinkView extends CellView { - getConnectionLength(): number; - getPointAtLength(length: number): { x: number; y: number; }; + getConnectionLength():number; + getPointAtLength(length:number):{ x: number; y: number; }; } - + } - module ui { - interface Handle { - name : string; - position : string; - icon: string; - } - - class SelectionView extends Backbone.Model { - paper:joint.dia.Paper; - graph:joint.dia.Graph; - model:Backbone.Collection; - - constructor(opt:{ - paper : joint.dia.Paper; - graph : joint.dia.Graph; - model : Backbone.Collection - }); - - createSelectionBox(cellView:joint.dia.CellView); - destroySelectionBox(cellView:joint.dia.CellView); - startSelecting(evt:any); - cancelSelection(); - - addHandle(handle:Handle); - removeHandle(name:string); - changeHandle(name:string, handle:Handle); - } - } + module ui {} module shapes { module basic { - class Generic extends joint.dia.Element { } - class Rect extends Generic { } - class Text extends Generic { } - class Circle extends Generic { } - class Image extends Generic { } + class Generic extends joint.dia.Element { + } + class Rect extends Generic { + } + class Text extends Generic { + } + class Circle extends Generic { + } + class Image extends Generic { + } } } module util { - function uuid(): string; - function guid(obj: any): string; - function mixin(objects: any[]): any; - function supplement(objects: any[]): any; - function deepMixin(objects: any[]): any; - function deepSupplement(objects: any[], defaultIndicator?: any): any; + function uuid():string; + function guid(obj:any):string; + function mixin(objects:any[]):any; + function supplement(objects:any[]):any; + function deepMixin(objects:any[]):any; + function deepSupplement(objects:any[], defaultIndicator?:any):any; } } diff --git a/rappid/README.md b/rappid/README.md new file mode 100644 index 0000000000..1119a7e6b8 --- /dev/null +++ b/rappid/README.md @@ -0,0 +1 @@ +These definitions are far from complete. \ No newline at end of file diff --git a/rappid/rappid.d.ts b/rappid/rappid.d.ts new file mode 100644 index 0000000000..9cc438884f --- /dev/null +++ b/rappid/rappid.d.ts @@ -0,0 +1,38 @@ +// Type definitions for Rappid 1.5 +// Project: http://jointjs.com/about-rappid +// Definitions by: Ewout Van Gossum +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare module joint{ + module ui{ + interface Handle { + name : string; + position : string; + icon: string; + } + + class SelectionView extends Backbone.Model { + paper:joint.dia.Paper; + graph:joint.dia.Graph; + model:Backbone.Collection; + + constructor(opt:{ + paper : joint.dia.Paper; + graph : joint.dia.Graph; + model : Backbone.Collection + }); + + createSelectionBox(cellView:joint.dia.CellView) : void; + destroySelectionBox(cellView:joint.dia.CellView) : void; + startSelecting(evt:any) : void; + cancelSelection() : void; + + addHandle(handle:Handle) : void; + removeHandle(name:string) : void; + changeHandle(name:string, handle:Handle) : void; + } + } +} \ No newline at end of file