@hpcc-js/graph 3.8.4 → 3.9.1
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/assets/{dagre-D_vAZIQ-.js.map → dagre-Ch4XIoOw.js.map} +1 -1
- package/dist/assets/graphviz-BNpvf_gp.js.map +1 -0
- package/dist/assets/graphvizDot-CfwAsDJC.js.map +1 -0
- package/dist/index.js +366 -89
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +6 -6
- package/dist/index.umd.cjs.map +1 -1
- package/package.json +10 -10
- package/src/common/layouts/graphvizDot.ts +33 -0
- package/src/common/layouts/index.ts +1 -0
- package/src/common/layouts/workers/graphvizDot.ts +25 -0
- package/src/common/layouts/workers/graphvizDotOptions.ts +14 -0
- package/src/graphviz/Widget.css +155 -0
- package/src/graphviz/Widget.ts +448 -0
- package/src/graphviz/index.ts +1 -0
- package/src/index.ts +1 -0
- package/types/common/layouts/graphvizDot.d.ts +8 -0
- package/types/common/layouts/index.d.ts +1 -0
- package/types/common/layouts/workers/graphvizDotOptions.d.ts +11 -0
- package/types/graphviz/Widget.d.ts +50 -0
- package/types/graphviz/index.d.ts +1 -0
- package/types/index.d.ts +1 -0
- package/dist/assets/graphviz-CE2MKOxL.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hpcc-js/graph",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.1",
|
|
4
4
|
"description": "hpcc-js - Viz Graph",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.umd.cjs",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"bundle-workers": "vite build -c ./workers/vite.config.ts",
|
|
27
27
|
"bundle-watch": "vite build --watch",
|
|
28
28
|
"bundle-serve": "vite --port 5509",
|
|
29
|
-
"gen-types": "
|
|
29
|
+
"gen-types": "tsc --project tsconfig.json",
|
|
30
30
|
"gen-types-watch": "npm run gen-types -- --watch",
|
|
31
31
|
"build": "run-p gen-types bundle",
|
|
32
32
|
"watch": "run-p gen-types-watch bundle-watch",
|
|
@@ -40,18 +40,18 @@
|
|
|
40
40
|
"update-major": "npx --yes npm-check-updates -u"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@hpcc-js/api": "^3.5.
|
|
44
|
-
"@hpcc-js/common": "^3.
|
|
45
|
-
"@hpcc-js/html": "^3.4.
|
|
46
|
-
"@hpcc-js/react": "^3.5.
|
|
47
|
-
"@hpcc-js/util": "^3.6.
|
|
43
|
+
"@hpcc-js/api": "^3.5.6",
|
|
44
|
+
"@hpcc-js/common": "^3.9.1",
|
|
45
|
+
"@hpcc-js/html": "^3.4.6",
|
|
46
|
+
"@hpcc-js/react": "^3.5.6",
|
|
47
|
+
"@hpcc-js/util": "^3.6.6"
|
|
48
48
|
},
|
|
49
49
|
"optionalPeerDependencies": {
|
|
50
50
|
"react": ">=17.0.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@hpcc-js/esbuild-plugins": "^1.9.
|
|
54
|
-
"@hpcc-js/wasm-graphviz": "1.
|
|
53
|
+
"@hpcc-js/esbuild-plugins": "^1.9.6",
|
|
54
|
+
"@hpcc-js/wasm-graphviz": "1.27.3",
|
|
55
55
|
"@types/d3-transition": "1.3.6",
|
|
56
56
|
"@types/dagre": "0.7.54",
|
|
57
57
|
"d3-force": "^1",
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"url": "https://github.com/hpcc-systems/Visualization/issues"
|
|
77
77
|
},
|
|
78
78
|
"homepage": "https://github.com/hpcc-systems/Visualization",
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "0128487e97c3ca56f55697c40c340de2c5c61ff2"
|
|
80
80
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type Engine } from "@hpcc-js/wasm-graphviz";
|
|
2
|
+
import { isLayoutSuccess, type LayoutSVG } from "./workers/graphvizDotOptions.ts";
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import GraphvizDotWorker from "./workers/graphvizDot.ts?worker&inline";
|
|
5
|
+
|
|
6
|
+
export {
|
|
7
|
+
isLayoutSuccess,
|
|
8
|
+
type LayoutSVG
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export interface GraphvizDotResponse {
|
|
12
|
+
response: Promise<string>;
|
|
13
|
+
terminate: () => void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function graphvizDot(dot: string, layout: Engine = "dot"): GraphvizDotResponse {
|
|
17
|
+
const worker = new GraphvizDotWorker();
|
|
18
|
+
const response = new Promise<string>((resolve, reject) => {
|
|
19
|
+
worker.onmessage = event => {
|
|
20
|
+
if (isLayoutSuccess(event.data)) {
|
|
21
|
+
resolve(event.data.svg);
|
|
22
|
+
} else {
|
|
23
|
+
reject(new Error(event.data.error));
|
|
24
|
+
}
|
|
25
|
+
worker.terminate();
|
|
26
|
+
};
|
|
27
|
+
worker.postMessage({ dot, layout });
|
|
28
|
+
});
|
|
29
|
+
return {
|
|
30
|
+
terminate: (): void => worker.terminate(),
|
|
31
|
+
response
|
|
32
|
+
};
|
|
33
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Graphviz, type Engine } from "@hpcc-js/wasm-graphviz";
|
|
2
|
+
import { LayoutSVG } from "./graphvizDotOptions.js";
|
|
3
|
+
|
|
4
|
+
async function graphvizDot(dot: string, layout: Engine): Promise<LayoutSVG> {
|
|
5
|
+
const graphviz = await Graphviz.load();
|
|
6
|
+
try {
|
|
7
|
+
return {
|
|
8
|
+
svg: graphviz.layout(dot, "svg", layout)
|
|
9
|
+
};
|
|
10
|
+
} catch (e: any) {
|
|
11
|
+
if (e instanceof Error) {
|
|
12
|
+
return {
|
|
13
|
+
error: e.message,
|
|
14
|
+
errorDot: dot
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
throw e;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
self.onmessage = event => {
|
|
22
|
+
graphvizDot(event.data.dot, event.data.layout).then(result => {
|
|
23
|
+
self.postMessage(result);
|
|
24
|
+
});
|
|
25
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface LayoutError {
|
|
2
|
+
error?: string;
|
|
3
|
+
errorDot?: string;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface LayoutSVG extends LayoutError {
|
|
7
|
+
svg?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type LayoutSuccess = { svg: string };
|
|
11
|
+
|
|
12
|
+
export function isLayoutSuccess(item: any): item is LayoutSuccess {
|
|
13
|
+
return (item as LayoutSuccess)?.svg !== undefined;
|
|
14
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
.graph_GraphvizWidget {
|
|
2
|
+
--gv-bg: light-dark(#ffffff, #1a1a2e);
|
|
3
|
+
--gv-shadow: light-dark(#e6e6e6, #0d0d18);
|
|
4
|
+
--gv-fg: light-dark(#242424, #e0e0e0);
|
|
5
|
+
--gv-select-stroke: light-dark(#0078d4, #4cc2ff);
|
|
6
|
+
--gv-select-fill: light-dark(#deecf9, #1b3a5c);
|
|
7
|
+
|
|
8
|
+
--gv-unknown-stroke: light-dark(#616161, #9e9e9e);
|
|
9
|
+
--gv-unknown-fill: light-dark(#e0e0e020, #2a2a3e20);
|
|
10
|
+
--gv-complete-stroke: light-dark(#2e7d32, #66bb6a);
|
|
11
|
+
--gv-complete-fill: light-dark(#e8f5e920, #1b3a1e20);
|
|
12
|
+
--gv-failed-stroke: light-dark(#c62828, #ef5350);
|
|
13
|
+
--gv-failed-fill: light-dark(#ffebee20, #3a1b1b20);
|
|
14
|
+
--gv-running-stroke: light-dark(#e65100, #ffa726);
|
|
15
|
+
--gv-running-fill: light-dark(#fff3e020, #3a2a1b20);
|
|
16
|
+
|
|
17
|
+
background-color: var(--gv-shadow);
|
|
18
|
+
stroke: var(--gv-fg);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.graph_GraphvizWidget > g > rect.zoomBackground {
|
|
22
|
+
fill: var(--gv-shadow) !important;
|
|
23
|
+
stroke: none;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* Selection rules */
|
|
27
|
+
.graph_GraphvizWidget .node>path,
|
|
28
|
+
.graph_GraphvizWidget .node>polygon,
|
|
29
|
+
.graph_GraphvizWidget .node>ellipse,
|
|
30
|
+
.graph_GraphvizWidget .node>polyline,
|
|
31
|
+
.graph_GraphvizWidget .node>rect,
|
|
32
|
+
.graph_GraphvizWidget .cluster>path,
|
|
33
|
+
.graph_GraphvizWidget .cluster>polygon,
|
|
34
|
+
.graph_GraphvizWidget .cluster>ellipse,
|
|
35
|
+
.graph_GraphvizWidget .cluster>polyline,
|
|
36
|
+
.graph_GraphvizWidget .cluster>rect {
|
|
37
|
+
pointer-events: all;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.graph_GraphvizWidget .node.selected>path,
|
|
41
|
+
.graph_GraphvizWidget .node.selected>polygon,
|
|
42
|
+
.graph_GraphvizWidget .node.selected>ellipse,
|
|
43
|
+
.graph_GraphvizWidget .node.selected>polyline,
|
|
44
|
+
.graph_GraphvizWidget .node.selected>rect,
|
|
45
|
+
.graph_GraphvizWidget .cluster.selected>:is(path, polygon, ellipse, polyline, rect):first-of-type {
|
|
46
|
+
stroke: var(--gv-select-stroke);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.graph_GraphvizWidget .node>path:first-of-type,
|
|
50
|
+
.graph_GraphvizWidget .node>polygon:first-of-type,
|
|
51
|
+
.graph_GraphvizWidget .node>ellipse:first-of-type,
|
|
52
|
+
.graph_GraphvizWidget .node>polyline:first-of-type,
|
|
53
|
+
.graph_GraphvizWidget .cluster>path:first-of-type,
|
|
54
|
+
.graph_GraphvizWidget .cluster>polygon:first-of-type,
|
|
55
|
+
.graph_GraphvizWidget .cluster>ellipse:first-of-type,
|
|
56
|
+
.graph_GraphvizWidget .cluster>polyline:first-of-type {
|
|
57
|
+
fill: var(--gv-bg);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.graph_GraphvizWidget .node.selected>path:first-of-type,
|
|
61
|
+
.graph_GraphvizWidget .node.selected>polygon:first-of-type,
|
|
62
|
+
.graph_GraphvizWidget .node.selected>ellipse:first-of-type,
|
|
63
|
+
.graph_GraphvizWidget .node.selected>polyline:first-of-type,
|
|
64
|
+
.graph_GraphvizWidget .cluster.selected>path:first-of-type,
|
|
65
|
+
.graph_GraphvizWidget .cluster.selected>polygon:first-of-type,
|
|
66
|
+
.graph_GraphvizWidget .cluster.selected>ellipse:first-of-type,
|
|
67
|
+
.graph_GraphvizWidget .cluster.selected>polyline:first-of-type {
|
|
68
|
+
fill: var(--gv-select-fill);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.graph_GraphvizWidget .edge.selected path,
|
|
72
|
+
.graph_GraphvizWidget .edge.selected polygon,
|
|
73
|
+
.graph_GraphvizWidget .edge.selected ellipse,
|
|
74
|
+
.graph_GraphvizWidget .edge.selected polyline {
|
|
75
|
+
stroke: var(--gv-select-stroke);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.graph_GraphvizWidget .edge.selected polygon,
|
|
79
|
+
.graph_GraphvizWidget .edge.selected ellipse,
|
|
80
|
+
.graph_GraphvizWidget .edge.selected polyline {
|
|
81
|
+
fill: var(--gv-select-stroke);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.graph_GraphvizWidget text {
|
|
85
|
+
stroke: none;
|
|
86
|
+
fill: var(--gv-fg);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.graph_GraphvizWidget .selected text {
|
|
90
|
+
font-weight: bold;
|
|
91
|
+
stroke: none;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/* Generic state rules */
|
|
95
|
+
.graph_GraphvizWidget :is(.unknown, .complete, .failed, .running)>:is(path, polygon, ellipse, polyline) {
|
|
96
|
+
stroke: var(--_stroke);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.graph_GraphvizWidget :is(.unknown, .complete, .failed, .running):is(.node, .cluster)>:is(path, polygon, ellipse, polyline):first-of-type {
|
|
100
|
+
fill: var(--_fill);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.graph_GraphvizWidget :is(.unknown, .complete, .failed, .running).edge>:is(polygon, ellipse, polyline) {
|
|
104
|
+
fill: var(--_stroke);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.graph_GraphvizWidget .unknown {
|
|
108
|
+
--_stroke: var(--gv-unknown-stroke);
|
|
109
|
+
--_fill: var(--gv-unknown-fill);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.graph_GraphvizWidget .complete {
|
|
113
|
+
--_stroke: var(--gv-complete-stroke);
|
|
114
|
+
--_fill: var(--gv-complete-fill);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.graph_GraphvizWidget .failed {
|
|
118
|
+
--_stroke: var(--gv-failed-stroke);
|
|
119
|
+
--_fill: var(--gv-failed-fill);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.graph_GraphvizWidget .running {
|
|
123
|
+
--_stroke: var(--gv-running-stroke);
|
|
124
|
+
--_fill: var(--gv-running-fill);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/* When selected and stateful, keep state color on border but selected color on fill. */
|
|
128
|
+
.graph_GraphvizWidget :is(.unknown, .complete, .failed, .running).selected>:is(path, polygon, ellipse, polyline, rect) {
|
|
129
|
+
stroke: var(--_stroke);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.graph_GraphvizWidget :is(.unknown, .complete, .failed, .running).cluster.selected>:is(path, polygon, ellipse, polyline, rect) {
|
|
133
|
+
stroke: var(--_stroke);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.graph_GraphvizWidget :is(.unknown, .complete, .failed, .running):is(.node, .cluster).selected>:is(path, polygon, ellipse, polyline, rect):first-of-type {
|
|
137
|
+
fill: var(--gv-select-fill);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.graph_GraphvizWidget :is(.unknown, .complete, .failed, .running).edge.selected>:is(polygon, ellipse, polyline) {
|
|
141
|
+
fill: var(--gv-select-stroke);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/* Keep node and cluster outlines visible when zoomed out */
|
|
145
|
+
.graph_GraphvizWidget .node>path,
|
|
146
|
+
.graph_GraphvizWidget .node>polygon,
|
|
147
|
+
.graph_GraphvizWidget .node>ellipse,
|
|
148
|
+
.graph_GraphvizWidget .node>polyline,
|
|
149
|
+
.graph_GraphvizWidget .cluster>path,
|
|
150
|
+
.graph_GraphvizWidget .cluster>polygon,
|
|
151
|
+
.graph_GraphvizWidget .cluster>ellipse,
|
|
152
|
+
.graph_GraphvizWidget .cluster>polyline {
|
|
153
|
+
vector-effect: non-scaling-stroke;
|
|
154
|
+
stroke-width: 0.75px;
|
|
155
|
+
}
|