-
Notifications
You must be signed in to change notification settings - Fork 591
Expand file tree
/
Copy pathindex.d.ts
More file actions
146 lines (115 loc) · 3.57 KB
/
Copy pathindex.d.ts
File metadata and controls
146 lines (115 loc) · 3.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
// Type definitions for dagre-d3.js 0.6
// Project: https://github.com/dagrejs/dagre-d3
// Definitions by: Matthew Simmons <https://github.com/simmonmt>
// Mark Wong Siang Kai <https://github.com/markwongsk>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import {
BaseType,
Selection,
SelectionOrTransition,
ValueFn,
} from "d3";
import * as dagre from "dagre";
import * as graphlib from "graphlib";
export as namespace dagreD3;
export {
dagre as dagre,
graphlib as graphlib,
};
export interface Point {
x: number;
y: number;
}
export const intersect: {
node: (node: dagre.Node, point: any) => any;
circle: (
node: dagre.Node,
rx: number,
point: Point,
) => Point;
ellipse: (
node: dagre.Node,
rx: number,
ry: number,
point: Point,
) => Point;
polygon: (
node: dagre.Node,
polyPoints: Point[],
point: Point,
) => Point;
rect: (
node: dagre.Node,
point: Point,
) => Point;
};
export const render: { new(): Render };
export const util: {
isSubgraph: (g: dagre.graphlib.Graph<any>, v: string) => boolean,
edgeToId: (e: {v: string, w: string, name: string}) => string,
applyStyle: <GElement extends BaseType, Datum>(
dom: Selection<GElement, Datum, any, any>,
styleFn: ValueFn<GElement, Datum, string | number | boolean | null>,
) => void,
applyClass: <GElement extends BaseType, Datum>(
dom: Selection<GElement, Datum, any, any>,
classFn: ValueFn<GElement, Datum, string | number | boolean | null>,
otherClasses: string,
) => void,
applyTransition: <GElement extends BaseType, Datum, PElement extends BaseType, PDatum>(
selection: Selection<GElement, Datum, PElement, PDatum>,
g: dagre.graphlib.Graph<any>,
) => SelectionOrTransition<GElement, Datum, PElement, PDatum>,
};
export type CreateNodes = (
selection: Selection<SVGGElement, string, any, any>,
g: dagre.graphlib.Graph<any>,
shapes: Shapes,
) => SelectionOrTransition<BaseType, any, any, any>;
export type CreateClusters = (
selection: Selection<SVGGElement, string, any, any>,
g: dagre.graphlib.Graph<any>,
) => SelectionOrTransition<BaseType, any, any, any>;
export type CreateEdgeLabels = (
selection: Selection<SVGGElement, string, any, any>,
g: dagre.graphlib.Graph<any>,
) => SelectionOrTransition<BaseType, any, any, any>;
export type CreateEdgePaths = (
selection: Selection<SVGGElement, string, any, any>,
g: dagre.graphlib.Graph<any>,
arrows: Arrows,
) => SelectionOrTransition<BaseType, any, any, any>;
export type Arrow = (
parent: Selection<any, any, any, any>,
id: string,
edge: dagre.Edge,
type: string,
) => void;
export interface Arrows {
[arrowStyleName: string]: Arrow;
}
export type Shape = (
parent: Selection<any, string, any, any>,
bbox: any,
node: dagre.Node,
) => Selection<any, string, any, any>;
export interface Shapes {
[shapeStyleName: string]: Shape;
}
export interface Render {
// see https://dagrejs.github.io/project/dagre-d3/latest/demo/user-defined.html for example usage
(selection: Selection<any, any, any, any>, g: dagre.graphlib.Graph<any>): void;
createNodes(): CreateNodes;
createNodes(value: CreateNodes): Render;
createClusters(): CreateClusters;
createClusters(value: CreateClusters): Render;
createEdgeLabels(): CreateEdgeLabels;
createEdgeLabels(value: CreateEdgeLabels): Render;
createEdgePaths(): CreateEdgePaths;
createEdgePaths(value: CreateEdgePaths): Render;
arrows(): Arrows;
arrows(value: Arrows): Render;
shapes(): Shapes;
shapes(value: Shapes): Render;
}