@dagrejs/dagre 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dagre.js CHANGED
@@ -2950,7 +2950,7 @@ function zipObject(props, values) {
2950
2950
  }
2951
2951
 
2952
2952
  },{"@dagrejs/graphlib":29}],28:[function(require,module,exports){
2953
- module.exports = "1.0.1";
2953
+ module.exports = "1.0.2";
2954
2954
 
2955
2955
  },{}],29:[function(require,module,exports){
2956
2956
  /**
package/dist/dagre.min.js CHANGED
@@ -495,7 +495,7 @@ var offset=Math.min(...g.nodes().map(v=>g.node(v).rank));var layers=[];g.nodes()
495
495
  /*
496
496
  * Returns a new function that wraps `fn` with a timer. The wrapper logs the
497
497
  * time it takes to execute the function.
498
- */function time(name,fn){var start=Date.now();try{return fn()}finally{console.log(name+" time: "+(Date.now()-start)+"ms")}}function notime(name,fn){return fn()}let idCounter=0;function uniqueId(prefix){var id=++idCounter;return toString(prefix)+id}function range(start,limit,step=1){if(limit==null){limit=start;start=0}let endCon=i=>i<limit;if(step<0){endCon=i=>limit<i}const range=[];for(let i=start;endCon(i);i+=step){range.push(i)}return range}function pick(source,keys){const dest={};for(const key of keys){if(source[key]!==undefined){dest[key]=source[key]}}return dest}function mapValues(obj,funcOrProp){let func=funcOrProp;if(typeof funcOrProp==="string"){func=val=>val[funcOrProp]}return Object.entries(obj).reduce((acc,[k,v])=>{acc[k]=func(v,k);return acc},{})}function zipObject(props,values){return props.reduce((acc,key,i)=>{acc[key]=values[i];return acc},{})}},{"@dagrejs/graphlib":29}],28:[function(require,module,exports){module.exports="1.0.1"},{}],29:[function(require,module,exports){
498
+ */function time(name,fn){var start=Date.now();try{return fn()}finally{console.log(name+" time: "+(Date.now()-start)+"ms")}}function notime(name,fn){return fn()}let idCounter=0;function uniqueId(prefix){var id=++idCounter;return toString(prefix)+id}function range(start,limit,step=1){if(limit==null){limit=start;start=0}let endCon=i=>i<limit;if(step<0){endCon=i=>limit<i}const range=[];for(let i=start;endCon(i);i+=step){range.push(i)}return range}function pick(source,keys){const dest={};for(const key of keys){if(source[key]!==undefined){dest[key]=source[key]}}return dest}function mapValues(obj,funcOrProp){let func=funcOrProp;if(typeof funcOrProp==="string"){func=val=>val[funcOrProp]}return Object.entries(obj).reduce((acc,[k,v])=>{acc[k]=func(v,k);return acc},{})}function zipObject(props,values){return props.reduce((acc,key,i)=>{acc[key]=values[i];return acc},{})}},{"@dagrejs/graphlib":29}],28:[function(require,module,exports){module.exports="1.0.2"},{}],29:[function(require,module,exports){
499
499
  /**
500
500
  * Copyright (c) 2014, Chris Pettitt
501
501
  * All rights reserved.
package/index.d.ts ADDED
@@ -0,0 +1,132 @@
1
+ // Type definitions for dagre 1.0.1
2
+ // Project: https://github.com/dagrejs/dagre
3
+ // Definitions by: Qinfeng Chen <https://github.com/qinfchen>
4
+ // Pete Vilter <https://github.com/vilterp>
5
+ // David Newell <https://github.com/rustedgrail>
6
+ // Graham Lea <https://github.com/GrahamLea>
7
+ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
8
+
9
+ declare module '@dagrejs/dagre' {
10
+ export namespace graphlib {
11
+ class Graph<T = {}> {
12
+ constructor(opt?: { directed?: boolean | undefined; multigraph?: boolean | undefined; compound?: boolean | undefined });
13
+
14
+ graph(): GraphLabel;
15
+ isDirected(): boolean;
16
+ isMultiGraph(): boolean;
17
+ setGraph(label: GraphLabel): Graph<T>;
18
+
19
+ edge(edgeObj: Edge): GraphEdge;
20
+ edge(outNodeName: string, inNodeName: string, name?: string): GraphEdge;
21
+ edgeCount(): number;
22
+ edges(): Edge[];
23
+ hasEdge(edgeObj: Edge): boolean;
24
+ hasEdge(outNodeName: string, inNodeName: string, name?: string): boolean;
25
+ inEdges(inNodeName: string, outNodeName?: string): Edge[] | undefined;
26
+ outEdges(outNodeName: string, inNodeName?: string): Edge[] | undefined;
27
+ removeEdge(outNodeName: string, inNodeName: string, name?: string): Graph<T>;
28
+ setDefaultEdgeLabel(callback: string | ((v: string, w: string, name?: string) => string | Label)): Graph<T>;
29
+ setEdge(params: Edge, value?: string | { [key: string]: any }): Graph<T>;
30
+ setEdge(sourceId: string, targetId: string, value?: string | Label, name?: string): Graph<T>;
31
+
32
+ children(parentName: string): string | undefined;
33
+ hasNode(name: string): boolean;
34
+ neighbors(name: string): Array<Node<T>> | undefined;
35
+ node(id: string | Label): Node<T>;
36
+ nodeCount(): number;
37
+ nodes(): string[];
38
+ parent(childName: string): string | undefined;
39
+ predecessors(name: string): Array<Node<T>> | undefined;
40
+ removeNode(name: string): Graph<T>;
41
+ filterNodes(callback: (nodeId: string) => boolean): Graph<T>;
42
+ setDefaultNodeLabel(callback: string | ((nodeId: string) => string | Label)): Graph<T>;
43
+ setNode(name: string, label: string | Label): Graph<T>;
44
+ setParent(childName: string, parentName: string): void;
45
+ sinks(): Array<Node<T>>;
46
+ sources(): Array<Node<T>>;
47
+ successors(name: string): Array<Node<T>> | undefined;
48
+ }
49
+
50
+ namespace json {
51
+ function read(graph: any): Graph;
52
+ function write(graph: Graph): any;
53
+ }
54
+
55
+ namespace alg {
56
+ function components(graph: Graph): string[][];
57
+ function dijkstra(graph: Graph, source: string, weightFn?: WeightFn, edgeFn?: EdgeFn): any;
58
+ function dijkstraAll(graph: Graph, weightFn?: WeightFn, edgeFn?: EdgeFn): any;
59
+ function findCycles(graph: Graph): string[][];
60
+ function floydWarchall(graph: Graph, weightFn?: WeightFn, edgeFn?: EdgeFn): any;
61
+ function isAcyclic(graph: Graph): boolean;
62
+ function postorder(graph: Graph, nodeNames: string | string[]): string[];
63
+ function preorder(graph: Graph, nodeNames: string | string[]): string[];
64
+ function prim<T>(graph: Graph<T>, weightFn?: WeightFn): Graph<T>;
65
+ function tarjam(graph: Graph): string[][];
66
+ function topsort(graph: Graph): string[];
67
+ }
68
+ }
69
+
70
+ export interface Label {
71
+ [key: string]: any;
72
+ }
73
+ export type WeightFn = (edge: Edge) => number;
74
+ export type EdgeFn = (outNodeName: string) => GraphEdge[];
75
+
76
+ export interface GraphLabel {
77
+ width?: number | undefined;
78
+ height?: number | undefined;
79
+ compound?: boolean | undefined;
80
+ rankdir?: string | undefined;
81
+ align?: string | undefined;
82
+ nodesep?: number | undefined;
83
+ edgesep?: number | undefined;
84
+ ranksep?: number | undefined;
85
+ marginx?: number | undefined;
86
+ marginy?: number | undefined;
87
+ acyclicer?: string | undefined;
88
+ ranker?: string | undefined;
89
+ }
90
+
91
+ export interface NodeConfig {
92
+ width?: number | undefined;
93
+ height?: number | undefined;
94
+ }
95
+
96
+ export interface EdgeConfig {
97
+ minlen?: number | undefined;
98
+ weight?: number | undefined;
99
+ width?: number | undefined;
100
+ height?: number | undefined;
101
+ lablepos?: 'l' | 'c' | 'r' | undefined;
102
+ labeloffest?: number | undefined;
103
+ }
104
+
105
+ export function layout(graph: graphlib.Graph, layout?: GraphLabel & NodeConfig & EdgeConfig): void;
106
+
107
+ export interface Edge {
108
+ v: string;
109
+ w: string;
110
+ name?: string | undefined;
111
+ }
112
+
113
+ export interface GraphEdge {
114
+ points: Array<{ x: number; y: number }>;
115
+ [key: string]: any;
116
+ }
117
+
118
+ export type Node<T = {}> = T & {
119
+ x: number;
120
+ y: number;
121
+ width: number;
122
+ height: number;
123
+ class?: string | undefined;
124
+ label?: string | undefined;
125
+ padding?: number | undefined;
126
+ paddingX?: number | undefined;
127
+ paddingY?: number | undefined;
128
+ rx?: number | undefined;
129
+ ry?: number | undefined;
130
+ shape?: string | undefined;
131
+ };
132
+ }
package/lib/version.js CHANGED
@@ -1 +1 @@
1
- module.exports = "1.0.1";
1
+ module.exports = "1.0.2";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dagrejs/dagre",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Graph layout for JavaScript",
5
5
  "author": "Chris Pettitt <cpettitt@gmail.com>",
6
6
  "contributors": [
@@ -14,9 +14,11 @@
14
14
  },
15
15
  "files": [
16
16
  "index.js",
17
+ "index.d.ts",
17
18
  "dist/",
18
19
  "lib/"
19
20
  ],
21
+ "types": "index.d.ts",
20
22
  "keywords": [
21
23
  "graph",
22
24
  "layout"