@hpcc-js/graph 3.7.4 → 3.7.6

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.
Files changed (78) hide show
  1. package/LICENSE +43 -43
  2. package/README.md +256 -256
  3. package/dist/assets/dagre-B-z4SP0u.js.map +1 -1
  4. package/dist/assets/graphviz-BkFKgQ-y.js.map +1 -0
  5. package/dist/index.js +26 -26
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.umd.cjs +22 -22
  8. package/dist/index.umd.cjs.map +1 -1
  9. package/package.json +12 -10
  10. package/src/AdjacencyGraph.ts +224 -224
  11. package/src/Edge.css +22 -22
  12. package/src/Edge.ts +257 -257
  13. package/src/Graph.css +18 -18
  14. package/src/Graph.ts +1077 -1077
  15. package/src/GraphData.ts +187 -187
  16. package/src/GraphLayouts.ts +214 -214
  17. package/src/Sankey.css +44 -44
  18. package/src/Sankey.ts +304 -304
  19. package/src/Subgraph.css +9 -9
  20. package/src/Subgraph.ts +165 -165
  21. package/src/Vertex.css +2 -2
  22. package/src/Vertex.ts +282 -282
  23. package/src/__package__.ts +3 -3
  24. package/src/__tests__/data.ts +444 -444
  25. package/src/__tests__/index.ts +1 -1
  26. package/src/__tests__/test1.ts +18 -18
  27. package/src/__tests__/test2.ts +80 -80
  28. package/src/__tests__/test3.ts +46 -46
  29. package/src/__tests__/test4.ts +66 -66
  30. package/src/__tests__/test5.ts +85 -85
  31. package/src/common/graphT.css +38 -38
  32. package/src/common/graphT.ts +1363 -1363
  33. package/src/common/index.ts +3 -3
  34. package/src/common/layouts/circle.ts +37 -37
  35. package/src/common/layouts/dagre.ts +145 -145
  36. package/src/common/layouts/dagreWorker.ts +24 -24
  37. package/src/common/layouts/forceDirected.ts +117 -117
  38. package/src/common/layouts/forceDirectedWorker.ts +22 -22
  39. package/src/common/layouts/geoForceDirected.ts +112 -112
  40. package/src/common/layouts/graphviz.ts +137 -137
  41. package/src/common/layouts/graphvizWorker.ts +27 -27
  42. package/src/common/layouts/index.ts +7 -7
  43. package/src/common/layouts/layout.ts +147 -147
  44. package/src/common/layouts/null.ts +39 -39
  45. package/src/common/layouts/placeholders.ts +113 -113
  46. package/src/common/layouts/tree.ts +326 -326
  47. package/src/common/layouts/workers/dagre.ts +46 -46
  48. package/src/common/layouts/workers/dagreOptions.ts +35 -35
  49. package/src/common/layouts/workers/forceDirected.ts +38 -38
  50. package/src/common/layouts/workers/forceDirectedOptions.ts +30 -30
  51. package/src/common/layouts/workers/graphviz.ts +225 -225
  52. package/src/common/layouts/workers/graphvizOptions.ts +70 -70
  53. package/src/common/liteMap.ts +72 -72
  54. package/src/common/liteSVGZooom.ts +61 -61
  55. package/src/common/sankeyGraph.css +44 -44
  56. package/src/common/sankeyGraph.ts +345 -345
  57. package/src/html/annotation.ts +71 -71
  58. package/src/html/component.ts +18 -18
  59. package/src/html/edge.ts +15 -15
  60. package/src/html/graphHtml.ts +11 -11
  61. package/src/html/graphHtmlT.ts +117 -117
  62. package/src/html/icon.ts +64 -64
  63. package/src/html/image.ts +26 -26
  64. package/src/html/imageChar.ts +18 -18
  65. package/src/html/index.ts +8 -8
  66. package/src/html/intersection.ts +110 -110
  67. package/src/html/shape.ts +141 -141
  68. package/src/html/text.ts +59 -59
  69. package/src/html/textBox.ts +45 -45
  70. package/src/html/vertex.ts +67 -67
  71. package/src/index.ts +10 -10
  72. package/src/react/dataGraph.ts +345 -345
  73. package/src/react/graphReact.ts +177 -177
  74. package/src/react/graphReactT.ts +44 -44
  75. package/src/react/index.ts +4 -4
  76. package/src/react/subgraph.tsx +30 -30
  77. package/src/react/vertex.tsx +31 -31
  78. package/dist/assets/graphviz-BK7FEJlA.js.map +0 -1
@@ -1,72 +1,72 @@
1
- import { select as d3Select, zoomTransform as d3ZoomTransform } from "@hpcc-js/common";
2
- import { geoMercator as d3GeoMercator } from "d3-geo";
3
- import { tile as d3Tile, tileWrap as d3TileWrap } from "d3-tile";
4
- import { LiteSVGZoomWidget } from "./liteSVGZooom.ts";
5
-
6
- function url(x, y, z) {
7
- return `https://api.mapbox.com/styles/v1/mapbox/streets-v11/tiles/${z}/${x}/${y}${devicePixelRatio > 1 ? "@2x" : ""}?access_token=pk.eyJ1IjoibGVzY2htb28iLCJhIjoiY2psY2FqY3l3MDhqNDN3cDl1MzFmZnkwcCJ9.HRoFwmz1j80gyz18ruggqw`;
8
- }
9
-
10
- export class LiteMapWidget extends LiteSVGZoomWidget {
11
-
12
- protected _mapVisible = false;
13
- private _mapScale = 1 << 15;
14
-
15
- protected _levels: any;
16
-
17
- protected _projection = d3GeoMercator()
18
- .scale(this._mapScale / (2 * Math.PI))
19
- ;
20
-
21
- protected _tile = d3Tile()
22
- .tileSize(512)
23
- .clampX(false)
24
- ;
25
-
26
- project(lat: number, lng: number): [number, number] {
27
- return this._projection([lng, lat]);
28
- }
29
-
30
- enter(domNode, element) {
31
- super.enter(domNode, element);
32
- this._zoom.scaleExtent([0.0078125, 4096]);
33
- const deltas = [-100, -4, -1, 0];
34
- this._levels = this._svgElement.insert("g", "g")
35
- .attr("pointer-events", "none")
36
- .selectAll("g").data(deltas)
37
- .join("g")
38
- ;
39
-
40
- this.mapZoomed(d3ZoomTransform(this._svgElement.node()));
41
- }
42
-
43
- mapZoomed(transform) {
44
- const { width, height } = this.size();
45
-
46
- const context = this;
47
- const mapTransform = transform.translate(width >> 1, height >> 1).scale(this._mapScale);
48
- this._levels.each(function (delta) {
49
- const tiles = context._mapVisible ? context._tile.zoomDelta(delta)(mapTransform) : [];
50
- d3Select(this).selectAll("image").data(tiles, d => d as any)
51
- .join("image")
52
- .attr("xlink:href", d => {
53
- const tmp = d3TileWrap(d) as [number, number, number];
54
- return url(...tmp);
55
- })
56
- .attr("x", ([x]) => (x + tiles.translate[0]) * tiles.scale)
57
- .attr("y", ([, y]) => (y + tiles.translate[1]) * tiles.scale)
58
- .attr("width", tiles.scale)
59
- .attr("height", tiles.scale)
60
- ;
61
- });
62
-
63
- this._projection
64
- .translate([width >> 1, height >> 1])
65
- ;
66
- }
67
-
68
- zoomed(transform) {
69
- super.zoomed(transform);
70
- this.mapZoomed(transform);
71
- }
72
- }
1
+ import { select as d3Select, zoomTransform as d3ZoomTransform } from "@hpcc-js/common";
2
+ import { geoMercator as d3GeoMercator } from "d3-geo";
3
+ import { tile as d3Tile, tileWrap as d3TileWrap } from "d3-tile";
4
+ import { LiteSVGZoomWidget } from "./liteSVGZooom.ts";
5
+
6
+ function url(x, y, z) {
7
+ return `https://api.mapbox.com/styles/v1/mapbox/streets-v11/tiles/${z}/${x}/${y}${devicePixelRatio > 1 ? "@2x" : ""}?access_token=pk.eyJ1IjoibGVzY2htb28iLCJhIjoiY2psY2FqY3l3MDhqNDN3cDl1MzFmZnkwcCJ9.HRoFwmz1j80gyz18ruggqw`;
8
+ }
9
+
10
+ export class LiteMapWidget extends LiteSVGZoomWidget {
11
+
12
+ protected _mapVisible = false;
13
+ private _mapScale = 1 << 15;
14
+
15
+ protected _levels: any;
16
+
17
+ protected _projection = d3GeoMercator()
18
+ .scale(this._mapScale / (2 * Math.PI))
19
+ ;
20
+
21
+ protected _tile = d3Tile()
22
+ .tileSize(512)
23
+ .clampX(false)
24
+ ;
25
+
26
+ project(lat: number, lng: number): [number, number] {
27
+ return this._projection([lng, lat]);
28
+ }
29
+
30
+ enter(domNode, element) {
31
+ super.enter(domNode, element);
32
+ this._zoom.scaleExtent([0.0078125, 4096]);
33
+ const deltas = [-100, -4, -1, 0];
34
+ this._levels = this._svgElement.insert("g", "g")
35
+ .attr("pointer-events", "none")
36
+ .selectAll("g").data(deltas)
37
+ .join("g")
38
+ ;
39
+
40
+ this.mapZoomed(d3ZoomTransform(this._svgElement.node()));
41
+ }
42
+
43
+ mapZoomed(transform) {
44
+ const { width, height } = this.size();
45
+
46
+ const context = this;
47
+ const mapTransform = transform.translate(width >> 1, height >> 1).scale(this._mapScale);
48
+ this._levels.each(function (delta) {
49
+ const tiles = context._mapVisible ? context._tile.zoomDelta(delta)(mapTransform) : [];
50
+ d3Select(this).selectAll("image").data(tiles, d => d as any)
51
+ .join("image")
52
+ .attr("xlink:href", d => {
53
+ const tmp = d3TileWrap(d) as [number, number, number];
54
+ return url(...tmp);
55
+ })
56
+ .attr("x", ([x]) => (x + tiles.translate[0]) * tiles.scale)
57
+ .attr("y", ([, y]) => (y + tiles.translate[1]) * tiles.scale)
58
+ .attr("width", tiles.scale)
59
+ .attr("height", tiles.scale)
60
+ ;
61
+ });
62
+
63
+ this._projection
64
+ .translate([width >> 1, height >> 1])
65
+ ;
66
+ }
67
+
68
+ zoomed(transform) {
69
+ super.zoomed(transform);
70
+ this.mapZoomed(transform);
71
+ }
72
+ }
@@ -1,61 +1,61 @@
1
- import { d3Event, HTMLWidget, zoom as d3Zoom } from "@hpcc-js/common";
2
-
3
- export class LiteSVGZoomWidget extends HTMLWidget {
4
-
5
- protected _svgElement: any;
6
- protected _svgDefs: any;
7
- protected _zoomElement: any;
8
- protected _zoom = d3Zoom();
9
- protected _zoomScale = 1;
10
- protected _zoomTranslate = [0, 0];
11
-
12
- constructor() {
13
- super();
14
- this._tag = "div";
15
- this._drawStartPos = "origin";
16
- }
17
-
18
- resize(size?) {
19
- const retVal = super.resize(size);
20
- if (this._svgElement) {
21
- this._svgElement
22
- .style("width", this._size.width + "px")
23
- .style("height", this._size.height + "px")
24
- ;
25
- }
26
- return retVal;
27
- }
28
-
29
- zoomed(transform) {
30
- this._zoomScale = transform.k;
31
- this._zoomTranslate = [transform.x, transform.y];
32
- this._zoomElement.attr("transform", transform);
33
- }
34
-
35
- enter(domNode, element) {
36
- super.enter(domNode, element);
37
-
38
- element
39
- .style("position", "relative")
40
- ;
41
-
42
- this._svgElement = element.append("svg");
43
- this._svgDefs = this._svgElement.append("defs");
44
- this._zoomElement = this._svgElement.append("g");
45
-
46
- this.resize();
47
-
48
- this._zoom.on("zoom", () => this.zoomed(d3Event().transform));
49
- this._svgElement.call(this._zoom);
50
- }
51
-
52
- update(domNode, element) {
53
- super.update(domNode, element);
54
- }
55
-
56
- exit(domNode, element) {
57
- super.exit(domNode, element);
58
- }
59
-
60
- }
61
- LiteSVGZoomWidget.prototype._class += " graph_SVGZoomLiteWidget";
1
+ import { d3Event, HTMLWidget, zoom as d3Zoom } from "@hpcc-js/common";
2
+
3
+ export class LiteSVGZoomWidget extends HTMLWidget {
4
+
5
+ protected _svgElement: any;
6
+ protected _svgDefs: any;
7
+ protected _zoomElement: any;
8
+ protected _zoom = d3Zoom();
9
+ protected _zoomScale = 1;
10
+ protected _zoomTranslate = [0, 0];
11
+
12
+ constructor() {
13
+ super();
14
+ this._tag = "div";
15
+ this._drawStartPos = "origin";
16
+ }
17
+
18
+ resize(size?) {
19
+ const retVal = super.resize(size);
20
+ if (this._svgElement) {
21
+ this._svgElement
22
+ .style("width", this._size.width + "px")
23
+ .style("height", this._size.height + "px")
24
+ ;
25
+ }
26
+ return retVal;
27
+ }
28
+
29
+ zoomed(transform) {
30
+ this._zoomScale = transform.k;
31
+ this._zoomTranslate = [transform.x, transform.y];
32
+ this._zoomElement.attr("transform", transform);
33
+ }
34
+
35
+ enter(domNode, element) {
36
+ super.enter(domNode, element);
37
+
38
+ element
39
+ .style("position", "relative")
40
+ ;
41
+
42
+ this._svgElement = element.append("svg");
43
+ this._svgDefs = this._svgElement.append("defs");
44
+ this._zoomElement = this._svgElement.append("g");
45
+
46
+ this.resize();
47
+
48
+ this._zoom.on("zoom", () => this.zoomed(d3Event().transform));
49
+ this._svgElement.call(this._zoom);
50
+ }
51
+
52
+ update(domNode, element) {
53
+ super.update(domNode, element);
54
+ }
55
+
56
+ exit(domNode, element) {
57
+ super.exit(domNode, element);
58
+ }
59
+
60
+ }
61
+ LiteSVGZoomWidget.prototype._class += " graph_SVGZoomLiteWidget";
@@ -1,45 +1,45 @@
1
- .graph_SankeyGraph .node rect {
2
- cursor: move;
3
- fill-opacity: .9;
4
- shape-rendering: crispEdges;
5
- stroke: darkgray;
6
- }
7
-
8
- .graph_SankeyGraph .node.selected rect {
9
- stroke: red;
10
- }
11
-
12
- .graph_SankeyGraph .node.over rect {
13
- stroke: orange;
14
- }
15
-
16
- .graph_SankeyGraph .node.selected.over rect {
17
- stroke: red;
18
- }
19
-
20
- .graph_SankeyGraph .node text {
21
- pointer-events: none;
22
- text-shadow: 0 1px 0 #fff;
23
- }
24
-
25
- .graph_SankeyGraph .node.selected text {
26
- fill: red;
27
- }
28
-
29
- .graph_SankeyGraph .node.over text {
30
- fill: orange;
31
- }
32
-
33
- .graph_SankeyGraph .node.selected.over text {
34
- fill: red;
35
- }
36
-
37
- .graph_SankeyGraph .link {
38
- fill: none;
39
- stroke: #000;
40
- stroke-opacity: .2;
41
- }
42
-
43
- .graph_SankeyGraph .link:hover {
44
- stroke-opacity: .5;
1
+ .graph_SankeyGraph .node rect {
2
+ cursor: move;
3
+ fill-opacity: .9;
4
+ shape-rendering: crispEdges;
5
+ stroke: darkgray;
6
+ }
7
+
8
+ .graph_SankeyGraph .node.selected rect {
9
+ stroke: red;
10
+ }
11
+
12
+ .graph_SankeyGraph .node.over rect {
13
+ stroke: orange;
14
+ }
15
+
16
+ .graph_SankeyGraph .node.selected.over rect {
17
+ stroke: red;
18
+ }
19
+
20
+ .graph_SankeyGraph .node text {
21
+ pointer-events: none;
22
+ text-shadow: 0 1px 0 #fff;
23
+ }
24
+
25
+ .graph_SankeyGraph .node.selected text {
26
+ fill: red;
27
+ }
28
+
29
+ .graph_SankeyGraph .node.over text {
30
+ fill: orange;
31
+ }
32
+
33
+ .graph_SankeyGraph .node.selected.over text {
34
+ fill: red;
35
+ }
36
+
37
+ .graph_SankeyGraph .link {
38
+ fill: none;
39
+ stroke: #000;
40
+ stroke-opacity: .2;
41
+ }
42
+
43
+ .graph_SankeyGraph .link:hover {
44
+ stroke-opacity: .5;
45
45
  }