diff --git a/dagre/dagre.d.ts b/dagre/dagre.d.ts index ce389f2d7..fb5bd95d9 100644 --- a/dagre/dagre.d.ts +++ b/dagre/dagre.d.ts @@ -10,20 +10,24 @@ declare module Dagre{ interface Graph { new (): Graph; - edges(): string[]; - edge(id: string): any; + edges(): Edge[]; + edge(id: any): any; nodes(): string[]; - node(id: string): any; + node(id: any): any; setDefaultEdgeLabel(callback: () => void): Graph; setEdge(sourceId: string, targetId: string): Graph; setGraph(options: { [key: string]: any }): Graph; setNode(id: string, node: { [key: string]: any }): Graph; } + interface Edge { + v: string; + w: string; + } + interface GraphLib { Graph: Graph; } } declare var dagre: Dagre.DagreFactory; - diff --git a/sigmajs/sigmajs-tests.ts b/sigmajs/sigmajs-tests.ts index 10c6ce029..f28a9395b 100644 --- a/sigmajs/sigmajs-tests.ts +++ b/sigmajs/sigmajs-tests.ts @@ -23,6 +23,10 @@ module SigmaJsTests { s.refresh(); }); + sigma.canvas.edges['def'] = function() {}; + sigma.svg.nodes['def'] = {create: (obj: SigmaJs.Node) => { return new Element(); }, + update: (obj: SigmaJs.Node) => { return; }}; + var N = 100; var E = 500; // Generate a random graph: diff --git a/sigmajs/sigmajs.d.ts b/sigmajs/sigmajs.d.ts index 62bee1980..d1c19730c 100644 --- a/sigmajs/sigmajs.d.ts +++ b/sigmajs/sigmajs.d.ts @@ -15,10 +15,17 @@ declare module SigmaJs{ graphPosition(x: number, y:number): {x: number; y: number}; ratio: number; readPrefix: string; + settings(setting: string) : any; x: number; y: number; } + interface Canvas { + edges: {[renderType: string]: (edge: Edge, source: Node, target: Node, ...a:any[]) => void}; + labels: {[renderType: string]: (node: Node, ...a:any[]) => void}; + nodes: {[renderType: string]: (node: Node, ...a:any[]) => void}; + } + interface Classes { configurable: Configurable; graph: Graph; @@ -39,6 +46,7 @@ declare module SigmaJs{ } interface Edge { + [key : string] : any; color?: string; id: string; size?: number; @@ -74,6 +82,11 @@ declare module SigmaJs{ nodes(ids: string[]): Node[]; } + interface GraphData { + edges: Edge[]; + nodes: Node[]; + } + interface Image { clip?: number; scale?: number; @@ -87,6 +100,7 @@ declare module SigmaJs{ } interface Node { + [key : string] : any; color?: string; id: string; image?: any; @@ -149,7 +163,7 @@ declare module SigmaJs{ interface SigmaConfigs { container?: Element; - graph?: Graph; + graph?: GraphData; id?: string; renderers?: Renderer[]; settings?: { [index: string]: any }; @@ -160,10 +174,12 @@ declare module SigmaJs{ new(container: string): Sigma; new(container: Element): Sigma; new(configuration: SigmaConfigs): Sigma; + canvas: Canvas; classes:Classes; misc: Miscellaneous; parsers: Parsers; plugins: Plugins; + svg: SVG; } interface Settings { @@ -269,6 +285,17 @@ declare module SigmaJs{ // Animation settings animationsTime?: number; } + + interface SVG { + edges: {[renderType: string]: SVGObject}; + labels: {[renderType: string]: SVGObject}; + nodes: {[renderType: string]: SVGObject}; + } + + interface SVGObject { + create: (object: T, ...a:any[]) => Element; + update: (object: T, ...a:any[]) => void; + } } declare var sigma: SigmaJs.SigmaFactory;