-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpackage.d.ts
70 lines (61 loc) · 1.55 KB
/
package.d.ts
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
interface Node {
id: string | number;
label: string;
shape?: 'circle' | 'wye' | 'star' | 'triangle' | 'square' | 'diamond' | 'cross';
color?: string; // Hex
svg?: string; // If given, it will render the given SVG instead of a shape
}
interface Link {
id?: string;
sourceID?: string;
source: string;
sourceLabel?: string;
targetID?: string;
target: string;
targetLabel?: string;
color?: string; // Hex
class?: string;
weight?: number;
}
interface ForceHorseData {
nodes: Array<Node>,
links: Array<Link>;
}
interface ForceHorseConfig {
showButtons: boolean;
showLabels: boolean;
numOfLabelsToShow: number;
showNodeWeight: boolean;
showEdgeWeight: boolean;
hideOrphanNodes: boolean;
showFilterButton: boolean;
showLabelsButton: boolean;
showNodeWeightButton: boolean;
showEdgeWeightButton: boolean;
showOrphanNodesButton: boolean;
forceParameters: {
friction: number;
charge: number;
linkStrength: number;
gravity: number;
linkDistance: number;
}
}
interface EventEmitter {
subscribe: (callback: Function) => void;
}
interface ForceHorseViewer {
element: ForceHorseComponent;
doubleClickEvent: EventEmitter;
hoverEvent: EventEmitter;
selectEvent: EventEmitter;
filterEvent: EventEmitter;
nodeDataArray: Array<Node>;
edgeDataArray: Array<Link>;
}
interface ForceHorseComponent extends HTMLElement {
viewer: ForceHorseViewer;
readyEvent: EventEmitter; // Every time a new viewer is created
setData: (data: ForceHorseData) => void;
setConfig: (config: ForceHorseConfig) => void;
}