@backstage/core-components 0.18.11-next.1 → 0.18.11-next.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/CHANGELOG.md +6 -0
- package/dist/components/CodeSnippet/CodeSnippet.esm.js +6 -40
- package/dist/components/CodeSnippet/CodeSnippet.esm.js.map +1 -1
- package/dist/components/CodeSnippet/CodeSnippetContent.esm.js +46 -0
- package/dist/components/CodeSnippet/CodeSnippetContent.esm.js.map +1 -0
- package/dist/components/DependencyGraph/DependencyGraph.esm.js +8 -336
- package/dist/components/DependencyGraph/DependencyGraph.esm.js.map +1 -1
- package/dist/components/DependencyGraph/DependencyGraphContent.esm.js +342 -0
- package/dist/components/DependencyGraph/DependencyGraphContent.esm.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @backstage/core-components
|
|
2
2
|
|
|
3
|
+
## 0.18.11-next.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- c161e1c: Lazy-load `react-syntax-highlighter` and `@dagrejs/dagre` so they are no longer pulled in eagerly through the barrel export. This reduces the upfront module cost of importing from `@backstage/core-components` by roughly 10 MB. The public API is unchanged.
|
|
8
|
+
|
|
3
9
|
## 0.18.11-next.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -1,45 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import { useTheme } from '@material-ui/core/styles';
|
|
4
|
-
import LightAsync from 'react-syntax-highlighter/dist/esm/light-async';
|
|
5
|
-
import dark from 'react-syntax-highlighter/dist/esm/styles/hljs/dark';
|
|
6
|
-
import docco from 'react-syntax-highlighter/dist/esm/styles/hljs/docco';
|
|
7
|
-
import { CopyTextButton } from '../CopyTextButton/CopyTextButton.esm.js';
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { lazy, Suspense } from 'react';
|
|
8
3
|
|
|
4
|
+
const LazyCodeSnippetContent = lazy(
|
|
5
|
+
() => import('./CodeSnippetContent.esm.js').then((m) => ({ default: m.CodeSnippet }))
|
|
6
|
+
);
|
|
9
7
|
function CodeSnippet(props) {
|
|
10
|
-
|
|
11
|
-
text,
|
|
12
|
-
language,
|
|
13
|
-
showLineNumbers = false,
|
|
14
|
-
highlightedNumbers,
|
|
15
|
-
wrapLongLines,
|
|
16
|
-
customStyle,
|
|
17
|
-
showCopyCodeButton = false
|
|
18
|
-
} = props;
|
|
19
|
-
const theme = useTheme();
|
|
20
|
-
const mode = theme.palette.type === "dark" ? dark : docco;
|
|
21
|
-
const highlightColor = theme.palette.type === "dark" ? "#256bf3" : "#e6ffed";
|
|
22
|
-
return /* @__PURE__ */ jsxs(Box, { position: "relative", children: [
|
|
23
|
-
/* @__PURE__ */ jsx(
|
|
24
|
-
LightAsync,
|
|
25
|
-
{
|
|
26
|
-
customStyle,
|
|
27
|
-
language,
|
|
28
|
-
style: mode,
|
|
29
|
-
showLineNumbers,
|
|
30
|
-
wrapLines: true,
|
|
31
|
-
wrapLongLines,
|
|
32
|
-
lineNumberStyle: { color: theme.palette.textVerySubtle },
|
|
33
|
-
lineProps: (lineNumber) => highlightedNumbers?.includes(lineNumber) ? {
|
|
34
|
-
style: {
|
|
35
|
-
backgroundColor: highlightColor
|
|
36
|
-
}
|
|
37
|
-
} : {},
|
|
38
|
-
children: text
|
|
39
|
-
}
|
|
40
|
-
),
|
|
41
|
-
showCopyCodeButton && /* @__PURE__ */ jsx(Box, { position: "absolute", top: 0, right: 0, children: /* @__PURE__ */ jsx(CopyTextButton, { text }) })
|
|
42
|
-
] });
|
|
8
|
+
return /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", {}), children: /* @__PURE__ */ jsx(LazyCodeSnippetContent, { ...props }) });
|
|
43
9
|
}
|
|
44
10
|
|
|
45
11
|
export { CodeSnippet };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeSnippet.esm.js","sources":["../../../src/components/CodeSnippet/CodeSnippet.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport
|
|
1
|
+
{"version":3,"file":"CodeSnippet.esm.js","sources":["../../../src/components/CodeSnippet/CodeSnippet.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Suspense, lazy } from 'react';\nimport type { CodeSnippetProps } from './CodeSnippetContent';\n\nexport type { CodeSnippetProps } from './CodeSnippetContent';\n\nconst LazyCodeSnippetContent = lazy(() =>\n import('./CodeSnippetContent').then(m => ({ default: m.CodeSnippet })),\n);\n\n/**\n * Thin wrapper on top of {@link https://react-syntax-highlighter.github.io/react-syntax-highlighter/ | react-syntax-highlighter}\n * providing consistent theming and copy code button\n *\n * @public\n */\nexport function CodeSnippet(props: CodeSnippetProps) {\n return (\n <Suspense fallback={<div />}>\n <LazyCodeSnippetContent {...props} />\n </Suspense>\n );\n}\n"],"names":[],"mappings":";;;AAqBA,MAAM,sBAAA,GAAyB,IAAA;AAAA,EAAK,MAClC,OAAO,6BAAsB,CAAA,CAAE,IAAA,CAAK,QAAM,EAAE,OAAA,EAAS,CAAA,CAAE,WAAA,EAAY,CAAE;AACvE,CAAA;AAQO,SAAS,YAAY,KAAA,EAAyB;AACnD,EAAA,uBACE,GAAA,CAAC,QAAA,EAAA,EAAS,QAAA,kBAAU,GAAA,CAAC,KAAA,EAAA,EAAI,GACvB,QAAA,kBAAA,GAAA,CAAC,sBAAA,EAAA,EAAwB,GAAG,KAAA,EAAO,CAAA,EACrC,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import Box from '@material-ui/core/Box';
|
|
3
|
+
import { useTheme } from '@material-ui/core/styles';
|
|
4
|
+
import LightAsync from 'react-syntax-highlighter/dist/esm/light-async';
|
|
5
|
+
import dark from 'react-syntax-highlighter/dist/esm/styles/hljs/dark';
|
|
6
|
+
import docco from 'react-syntax-highlighter/dist/esm/styles/hljs/docco';
|
|
7
|
+
import { CopyTextButton } from '../CopyTextButton/CopyTextButton.esm.js';
|
|
8
|
+
|
|
9
|
+
function CodeSnippet(props) {
|
|
10
|
+
const {
|
|
11
|
+
text,
|
|
12
|
+
language,
|
|
13
|
+
showLineNumbers = false,
|
|
14
|
+
highlightedNumbers,
|
|
15
|
+
wrapLongLines,
|
|
16
|
+
customStyle,
|
|
17
|
+
showCopyCodeButton = false
|
|
18
|
+
} = props;
|
|
19
|
+
const theme = useTheme();
|
|
20
|
+
const mode = theme.palette.type === "dark" ? dark : docco;
|
|
21
|
+
const highlightColor = theme.palette.type === "dark" ? "#256bf3" : "#e6ffed";
|
|
22
|
+
return /* @__PURE__ */ jsxs(Box, { position: "relative", children: [
|
|
23
|
+
/* @__PURE__ */ jsx(
|
|
24
|
+
LightAsync,
|
|
25
|
+
{
|
|
26
|
+
customStyle,
|
|
27
|
+
language,
|
|
28
|
+
style: mode,
|
|
29
|
+
showLineNumbers,
|
|
30
|
+
wrapLines: true,
|
|
31
|
+
wrapLongLines,
|
|
32
|
+
lineNumberStyle: { color: theme.palette.textVerySubtle },
|
|
33
|
+
lineProps: (lineNumber) => highlightedNumbers?.includes(lineNumber) ? {
|
|
34
|
+
style: {
|
|
35
|
+
backgroundColor: highlightColor
|
|
36
|
+
}
|
|
37
|
+
} : {},
|
|
38
|
+
children: text
|
|
39
|
+
}
|
|
40
|
+
),
|
|
41
|
+
showCopyCodeButton && /* @__PURE__ */ jsx(Box, { position: "absolute", top: 0, right: 0, children: /* @__PURE__ */ jsx(CopyTextButton, { text }) })
|
|
42
|
+
] });
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export { CodeSnippet };
|
|
46
|
+
//# sourceMappingURL=CodeSnippetContent.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodeSnippetContent.esm.js","sources":["../../../src/components/CodeSnippet/CodeSnippetContent.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Box from '@material-ui/core/Box';\nimport { useTheme } from '@material-ui/core/styles';\nimport type {} from 'react-syntax-highlighter';\nimport LightAsync from 'react-syntax-highlighter/dist/esm/light-async';\nimport dark from 'react-syntax-highlighter/dist/esm/styles/hljs/dark';\nimport docco from 'react-syntax-highlighter/dist/esm/styles/hljs/docco';\n\nimport { CopyTextButton } from '../CopyTextButton';\n\n/**\n * Properties for {@link CodeSnippet}\n *\n * @public\n */\nexport interface CodeSnippetProps {\n /**\n * Code Snippet text\n */\n text: string;\n /**\n * Language used by {@link CodeSnippetProps.text}\n */\n language: string;\n /**\n * Whether to show line number\n *\n * @remarks\n *\n * Default: false\n */\n showLineNumbers?: boolean;\n /**\n * Whether to show button to copy code snippet\n *\n * @remarks\n *\n * Default: false\n */\n showCopyCodeButton?: boolean;\n /**\n * Array of line numbers to highlight\n */\n highlightedNumbers?: number[];\n /**\n * Whether to style the `<code>` block with `white-space: pre-wrap` or `white-space: pre`\n *\n * @remarks\n *\n * Default: false (`white-space: pre`)\n */\n wrapLongLines?: boolean;\n /**\n * Custom styles applied to code\n *\n * @remarks\n *\n * Passed to {@link https://react-syntax-highlighter.github.io/react-syntax-highlighter/ | react-syntax-highlighter}\n */\n customStyle?: any;\n}\n\n/**\n * Thin wrapper on top of {@link https://react-syntax-highlighter.github.io/react-syntax-highlighter/ | react-syntax-highlighter}\n * providing consistent theming and copy code button\n *\n * @public\n */\nexport function CodeSnippet(props: CodeSnippetProps) {\n const {\n text,\n language,\n showLineNumbers = false,\n highlightedNumbers,\n wrapLongLines,\n customStyle,\n showCopyCodeButton = false,\n } = props;\n const theme = useTheme();\n const mode = theme.palette.type === 'dark' ? dark : docco;\n const highlightColor = theme.palette.type === 'dark' ? '#256bf3' : '#e6ffed';\n\n return (\n <Box position=\"relative\">\n <LightAsync\n customStyle={customStyle}\n language={language}\n style={mode}\n showLineNumbers={showLineNumbers}\n wrapLines\n wrapLongLines={wrapLongLines}\n lineNumberStyle={{ color: theme.palette.textVerySubtle }}\n lineProps={(lineNumber: number) =>\n highlightedNumbers?.includes(lineNumber)\n ? {\n style: {\n backgroundColor: highlightColor,\n },\n }\n : {}\n }\n >\n {text}\n </LightAsync>\n {showCopyCodeButton && (\n <Box position=\"absolute\" top={0} right={0}>\n <CopyTextButton text={text} />\n </Box>\n )}\n </Box>\n );\n}\n"],"names":[],"mappings":";;;;;;;;AAmFO,SAAS,YAAY,KAAA,EAAyB;AACnD,EAAA,MAAM;AAAA,IACJ,IAAA;AAAA,IACA,QAAA;AAAA,IACA,eAAA,GAAkB,KAAA;AAAA,IAClB,kBAAA;AAAA,IACA,aAAA;AAAA,IACA,WAAA;AAAA,IACA,kBAAA,GAAqB;AAAA,GACvB,GAAI,KAAA;AACJ,EAAA,MAAM,QAAQ,QAAA,EAAS;AACvB,EAAA,MAAM,IAAA,GAAO,KAAA,CAAM,OAAA,CAAQ,IAAA,KAAS,SAAS,IAAA,GAAO,KAAA;AACpD,EAAA,MAAM,cAAA,GAAiB,KAAA,CAAM,OAAA,CAAQ,IAAA,KAAS,SAAS,SAAA,GAAY,SAAA;AAEnE,EAAA,uBACE,IAAA,CAAC,GAAA,EAAA,EAAI,QAAA,EAAS,UAAA,EACZ,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,WAAA;AAAA,QACA,QAAA;AAAA,QACA,KAAA,EAAO,IAAA;AAAA,QACP,eAAA;AAAA,QACA,SAAA,EAAS,IAAA;AAAA,QACT,aAAA;AAAA,QACA,eAAA,EAAiB,EAAE,KAAA,EAAO,KAAA,CAAM,QAAQ,cAAA,EAAe;AAAA,QACvD,WAAW,CAAC,UAAA,KACV,kBAAA,EAAoB,QAAA,CAAS,UAAU,CAAA,GACnC;AAAA,UACE,KAAA,EAAO;AAAA,YACL,eAAA,EAAiB;AAAA;AACnB,YAEF,EAAC;AAAA,QAGN,QAAA,EAAA;AAAA;AAAA,KACH;AAAA,IACC,kBAAA,oBACC,GAAA,CAAC,GAAA,EAAA,EAAI,QAAA,EAAS,UAAA,EAAW,GAAA,EAAK,CAAA,EAAG,KAAA,EAAO,CAAA,EACtC,QAAA,kBAAA,GAAA,CAAC,cAAA,EAAA,EAAe,IAAA,EAAY,CAAA,EAC9B;AAAA,GAAA,EAEJ,CAAA;AAEJ;;;;"}
|
|
@@ -1,341 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import useMeasure from 'react-use/esm/useMeasure';
|
|
4
|
-
import classNames from 'classnames';
|
|
5
|
-
import { once } from 'lodash';
|
|
6
|
-
import * as d3Zoom from 'd3-zoom';
|
|
7
|
-
import * as d3Selection from 'd3-selection';
|
|
8
|
-
import useTheme from '@material-ui/core/styles/useTheme';
|
|
9
|
-
import dagre from '@dagrejs/dagre';
|
|
10
|
-
import debounce from 'lodash/debounce';
|
|
11
|
-
import { DependencyGraphTypes } from './types.esm.js';
|
|
12
|
-
import { Node } from './Node.esm.js';
|
|
13
|
-
import { Edge } from './Edge.esm.js';
|
|
14
|
-
import { ARROW_MARKER_ID } from './constants.esm.js';
|
|
15
|
-
import IconButton from '@material-ui/core/IconButton';
|
|
16
|
-
import FullscreenIcon from '@material-ui/icons/Fullscreen';
|
|
17
|
-
import FullscreenExitIcon from '@material-ui/icons/FullscreenExit';
|
|
18
|
-
import { useFullScreenHandle, FullScreen } from 'react-full-screen';
|
|
19
|
-
import { makeStyles } from '@material-ui/core/styles';
|
|
20
|
-
import Tooltip from '@material-ui/core/Tooltip';
|
|
21
|
-
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
22
|
-
import { coreComponentsTranslationRef } from '../../translation.esm.js';
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { lazy, Suspense } from 'react';
|
|
23
3
|
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
root: {
|
|
30
|
-
overflow: "hidden",
|
|
31
|
-
minHeight: "100%",
|
|
32
|
-
minWidth: "100%"
|
|
33
|
-
},
|
|
34
|
-
fixedHeight: {
|
|
35
|
-
maxHeight: "100%"
|
|
36
|
-
},
|
|
37
|
-
fullscreen: {
|
|
38
|
-
backgroundColor: theme.palette.background.paper
|
|
39
|
-
}
|
|
40
|
-
}));
|
|
41
|
-
const WORKSPACE_ID = "workspace";
|
|
42
|
-
const DEPENDENCY_GRAPH_SVG = "dependency-graph";
|
|
4
|
+
const LazyDependencyGraphContent = lazy(
|
|
5
|
+
() => import('./DependencyGraphContent.esm.js').then((m) => ({
|
|
6
|
+
default: m.DependencyGraph
|
|
7
|
+
}))
|
|
8
|
+
);
|
|
43
9
|
function DependencyGraph(props) {
|
|
44
|
-
|
|
45
|
-
edges,
|
|
46
|
-
nodes,
|
|
47
|
-
renderNode,
|
|
48
|
-
direction = DependencyGraphTypes.Direction.TOP_BOTTOM,
|
|
49
|
-
align,
|
|
50
|
-
nodeMargin = 50,
|
|
51
|
-
edgeMargin = 10,
|
|
52
|
-
rankMargin = 50,
|
|
53
|
-
paddingX = 0,
|
|
54
|
-
paddingY = 0,
|
|
55
|
-
acyclicer,
|
|
56
|
-
ranker = DependencyGraphTypes.Ranker.NETWORK_SIMPLEX,
|
|
57
|
-
labelPosition = DependencyGraphTypes.LabelPosition.RIGHT,
|
|
58
|
-
labelOffset = 10,
|
|
59
|
-
edgeRanks = 1,
|
|
60
|
-
edgeWeight = 1,
|
|
61
|
-
renderEdge,
|
|
62
|
-
renderLabel,
|
|
63
|
-
defs,
|
|
64
|
-
zoom = "enabled",
|
|
65
|
-
curve = "curveMonotoneX",
|
|
66
|
-
showArrowHeads = false,
|
|
67
|
-
fit = "grow",
|
|
68
|
-
allowFullscreen = true,
|
|
69
|
-
...svgProps
|
|
70
|
-
} = props;
|
|
71
|
-
const theme = useTheme();
|
|
72
|
-
const [containerWidth, setContainerWidth] = useState(100);
|
|
73
|
-
const [containerHeight, setContainerHeight] = useState(100);
|
|
74
|
-
const fullScreenHandle = useFullScreenHandle();
|
|
75
|
-
const styles = useStyles();
|
|
76
|
-
const { t } = useTranslationRef(coreComponentsTranslationRef);
|
|
77
|
-
const graph = useRef(
|
|
78
|
-
new dagre.graphlib.Graph()
|
|
79
|
-
);
|
|
80
|
-
const [graphWidth, setGraphWidth] = useState(
|
|
81
|
-
graph.current.graph()?.width || 0
|
|
82
|
-
);
|
|
83
|
-
const [graphHeight, setGraphHeight] = useState(
|
|
84
|
-
graph.current.graph()?.height || 0
|
|
85
|
-
);
|
|
86
|
-
const [graphNodes, setGraphNodes] = useState([]);
|
|
87
|
-
const [graphEdges, setGraphEdges] = useState([]);
|
|
88
|
-
const maxWidth = Math.max(graphWidth, containerWidth);
|
|
89
|
-
const maxHeight = Math.max(graphHeight, containerHeight);
|
|
90
|
-
const [_measureRef] = useMeasure();
|
|
91
|
-
const measureRef = once(_measureRef);
|
|
92
|
-
const scalableHeight = fit === "grow" && !fullScreenHandle.active ? maxHeight : "100%";
|
|
93
|
-
const containerRef = useMemo(
|
|
94
|
-
() => debounce((root) => {
|
|
95
|
-
if (!root) {
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
measureRef(root);
|
|
99
|
-
const node = root.querySelector(
|
|
100
|
-
`svg#${DEPENDENCY_GRAPH_SVG}`
|
|
101
|
-
);
|
|
102
|
-
if (!node) {
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
const container = d3Selection.select(node);
|
|
106
|
-
const workspace = d3Selection.select(node.getElementById(WORKSPACE_ID));
|
|
107
|
-
function enableZoom() {
|
|
108
|
-
container.call(
|
|
109
|
-
d3Zoom.zoom().scaleExtent([1, Infinity]).on("zoom", (event) => {
|
|
110
|
-
event.transform.x = Math.min(
|
|
111
|
-
0,
|
|
112
|
-
Math.max(
|
|
113
|
-
event.transform.x,
|
|
114
|
-
maxWidth - maxWidth * event.transform.k
|
|
115
|
-
)
|
|
116
|
-
);
|
|
117
|
-
event.transform.y = Math.min(
|
|
118
|
-
0,
|
|
119
|
-
Math.max(
|
|
120
|
-
event.transform.y,
|
|
121
|
-
maxHeight - maxHeight * event.transform.k
|
|
122
|
-
)
|
|
123
|
-
);
|
|
124
|
-
workspace.attr("transform", event.transform);
|
|
125
|
-
})
|
|
126
|
-
);
|
|
127
|
-
}
|
|
128
|
-
if (zoom === "enabled") {
|
|
129
|
-
enableZoom();
|
|
130
|
-
} else if (zoom === "enable-on-click") {
|
|
131
|
-
container.on("click", () => enableZoom());
|
|
132
|
-
}
|
|
133
|
-
const { width: newContainerWidth, height: newContainerHeight } = root.getBoundingClientRect();
|
|
134
|
-
if (containerWidth !== newContainerWidth && newContainerWidth <= maxWidth) {
|
|
135
|
-
setContainerWidth(newContainerWidth);
|
|
136
|
-
}
|
|
137
|
-
if (containerHeight !== newContainerHeight && newContainerHeight <= maxHeight) {
|
|
138
|
-
setContainerHeight(newContainerHeight);
|
|
139
|
-
}
|
|
140
|
-
}, 100),
|
|
141
|
-
[measureRef, containerHeight, containerWidth, maxWidth, maxHeight, zoom]
|
|
142
|
-
);
|
|
143
|
-
const setNodesAndEdges = useCallback(() => {
|
|
144
|
-
const currentGraphNodes = graph.current.nodes();
|
|
145
|
-
const currentGraphEdges = graph.current.edges();
|
|
146
|
-
currentGraphNodes.forEach((nodeId) => {
|
|
147
|
-
const remainingNode = nodes.some((node) => node.id === nodeId);
|
|
148
|
-
if (!remainingNode) {
|
|
149
|
-
graph.current.removeNode(nodeId);
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
currentGraphEdges.forEach((e) => {
|
|
153
|
-
const remainingEdge = edges.some(
|
|
154
|
-
(edge) => edge.from === e.v && edge.to === e.w
|
|
155
|
-
);
|
|
156
|
-
if (!remainingEdge) {
|
|
157
|
-
graph.current.removeEdge(e.v, e.w);
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
nodes.forEach((node) => {
|
|
161
|
-
const existingNode = graph.current.nodes().find((nodeId) => node.id === nodeId);
|
|
162
|
-
if (existingNode && graph.current.node(existingNode)) {
|
|
163
|
-
const { width, height, x, y } = graph.current.node(existingNode);
|
|
164
|
-
graph.current.setNode(existingNode, { ...node, width, height, x, y });
|
|
165
|
-
} else {
|
|
166
|
-
graph.current.setNode(node.id, { ...node, width: 0, height: 0 });
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
edges.forEach((e) => {
|
|
170
|
-
graph.current.setEdge(e.from, e.to, {
|
|
171
|
-
...e,
|
|
172
|
-
label: e.label,
|
|
173
|
-
width: 0,
|
|
174
|
-
height: 0,
|
|
175
|
-
labelpos: labelPosition,
|
|
176
|
-
labeloffset: labelOffset,
|
|
177
|
-
weight: edgeWeight,
|
|
178
|
-
minlen: edgeRanks
|
|
179
|
-
});
|
|
180
|
-
});
|
|
181
|
-
}, [edges, nodes, labelPosition, labelOffset, edgeWeight, edgeRanks]);
|
|
182
|
-
const updateGraph = useMemo(
|
|
183
|
-
() => debounce(
|
|
184
|
-
() => {
|
|
185
|
-
dagre.layout(graph.current);
|
|
186
|
-
const { height, width } = graph.current.graph();
|
|
187
|
-
const newHeight = Math.max(0, height || 0);
|
|
188
|
-
const newWidth = Math.max(0, width || 0);
|
|
189
|
-
setGraphWidth(newWidth);
|
|
190
|
-
setGraphHeight(newHeight);
|
|
191
|
-
setGraphNodes(graph.current.nodes());
|
|
192
|
-
setGraphEdges(graph.current.edges());
|
|
193
|
-
},
|
|
194
|
-
250,
|
|
195
|
-
{ leading: true }
|
|
196
|
-
),
|
|
197
|
-
[]
|
|
198
|
-
);
|
|
199
|
-
useEffect(() => {
|
|
200
|
-
graph.current.setGraph({
|
|
201
|
-
rankdir: direction,
|
|
202
|
-
align,
|
|
203
|
-
nodesep: nodeMargin,
|
|
204
|
-
edgesep: edgeMargin,
|
|
205
|
-
ranksep: rankMargin,
|
|
206
|
-
marginx: paddingX,
|
|
207
|
-
marginy: paddingY,
|
|
208
|
-
acyclicer,
|
|
209
|
-
ranker
|
|
210
|
-
});
|
|
211
|
-
setNodesAndEdges();
|
|
212
|
-
updateGraph();
|
|
213
|
-
return updateGraph.cancel;
|
|
214
|
-
}, [
|
|
215
|
-
acyclicer,
|
|
216
|
-
align,
|
|
217
|
-
direction,
|
|
218
|
-
edgeMargin,
|
|
219
|
-
paddingX,
|
|
220
|
-
paddingY,
|
|
221
|
-
nodeMargin,
|
|
222
|
-
rankMargin,
|
|
223
|
-
ranker,
|
|
224
|
-
setNodesAndEdges,
|
|
225
|
-
updateGraph
|
|
226
|
-
]);
|
|
227
|
-
const setNode = useCallback(
|
|
228
|
-
(id, node) => {
|
|
229
|
-
graph.current.setNode(id, node);
|
|
230
|
-
updateGraph();
|
|
231
|
-
return graph.current;
|
|
232
|
-
},
|
|
233
|
-
[updateGraph]
|
|
234
|
-
);
|
|
235
|
-
const setEdge = useCallback(
|
|
236
|
-
(id, edge) => {
|
|
237
|
-
graph.current.setEdge(id, edge);
|
|
238
|
-
updateGraph();
|
|
239
|
-
return graph.current;
|
|
240
|
-
},
|
|
241
|
-
[updateGraph]
|
|
242
|
-
);
|
|
243
|
-
return /* @__PURE__ */ jsxs(
|
|
244
|
-
FullScreen,
|
|
245
|
-
{
|
|
246
|
-
handle: fullScreenHandle,
|
|
247
|
-
className: classNames(
|
|
248
|
-
fullScreenHandle.active ? styles.fullscreen : styles.root
|
|
249
|
-
),
|
|
250
|
-
children: [
|
|
251
|
-
allowFullscreen && /* @__PURE__ */ jsx(Tooltip, { title: t("dependencyGraph.fullscreenTooltip"), children: /* @__PURE__ */ jsx(
|
|
252
|
-
IconButton,
|
|
253
|
-
{
|
|
254
|
-
className: styles.fullscreenButton,
|
|
255
|
-
onClick: fullScreenHandle.active ? fullScreenHandle.exit : fullScreenHandle.enter,
|
|
256
|
-
children: fullScreenHandle.active ? /* @__PURE__ */ jsx(FullscreenExitIcon, {}) : /* @__PURE__ */ jsx(FullscreenIcon, {})
|
|
257
|
-
}
|
|
258
|
-
) }),
|
|
259
|
-
/* @__PURE__ */ jsx("div", { ref: containerRef, style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ jsxs(
|
|
260
|
-
"svg",
|
|
261
|
-
{
|
|
262
|
-
...svgProps,
|
|
263
|
-
width: "100%",
|
|
264
|
-
height: scalableHeight,
|
|
265
|
-
viewBox: `0 0 ${maxWidth} ${maxHeight}`,
|
|
266
|
-
id: DEPENDENCY_GRAPH_SVG,
|
|
267
|
-
children: [
|
|
268
|
-
/* @__PURE__ */ jsxs("defs", { children: [
|
|
269
|
-
/* @__PURE__ */ jsx(
|
|
270
|
-
"marker",
|
|
271
|
-
{
|
|
272
|
-
id: ARROW_MARKER_ID,
|
|
273
|
-
viewBox: "0 0 24 24",
|
|
274
|
-
markerWidth: "14",
|
|
275
|
-
markerHeight: "14",
|
|
276
|
-
refX: "16",
|
|
277
|
-
refY: "12",
|
|
278
|
-
orient: "auto",
|
|
279
|
-
markerUnits: "strokeWidth",
|
|
280
|
-
children: /* @__PURE__ */ jsx(
|
|
281
|
-
"path",
|
|
282
|
-
{
|
|
283
|
-
fill: theme.palette.textSubtle,
|
|
284
|
-
d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"
|
|
285
|
-
}
|
|
286
|
-
)
|
|
287
|
-
}
|
|
288
|
-
),
|
|
289
|
-
defs
|
|
290
|
-
] }),
|
|
291
|
-
/* @__PURE__ */ jsx("g", { id: WORKSPACE_ID, children: /* @__PURE__ */ jsxs(
|
|
292
|
-
"svg",
|
|
293
|
-
{
|
|
294
|
-
width: graphWidth,
|
|
295
|
-
height: graphHeight,
|
|
296
|
-
y: maxHeight / 2 - graphHeight / 2,
|
|
297
|
-
x: maxWidth / 2 - graphWidth / 2,
|
|
298
|
-
viewBox: `0 0 ${graphWidth} ${graphHeight}`,
|
|
299
|
-
children: [
|
|
300
|
-
graphEdges.map((e) => {
|
|
301
|
-
const edge = graph.current.edge(e);
|
|
302
|
-
if (!edge) return null;
|
|
303
|
-
if (renderEdge) return renderEdge({ edge, id: e });
|
|
304
|
-
return /* @__PURE__ */ jsx(
|
|
305
|
-
Edge,
|
|
306
|
-
{
|
|
307
|
-
id: e,
|
|
308
|
-
setEdge,
|
|
309
|
-
render: renderLabel,
|
|
310
|
-
edge,
|
|
311
|
-
curve,
|
|
312
|
-
showArrowHeads
|
|
313
|
-
},
|
|
314
|
-
`${e.v}-${e.w}`
|
|
315
|
-
);
|
|
316
|
-
}),
|
|
317
|
-
graphNodes.map((id) => {
|
|
318
|
-
const node = graph.current.node(id);
|
|
319
|
-
if (!node) return null;
|
|
320
|
-
return /* @__PURE__ */ jsx(
|
|
321
|
-
Node,
|
|
322
|
-
{
|
|
323
|
-
setNode,
|
|
324
|
-
render: renderNode,
|
|
325
|
-
node
|
|
326
|
-
},
|
|
327
|
-
id
|
|
328
|
-
);
|
|
329
|
-
})
|
|
330
|
-
]
|
|
331
|
-
}
|
|
332
|
-
) })
|
|
333
|
-
]
|
|
334
|
-
}
|
|
335
|
-
) })
|
|
336
|
-
]
|
|
337
|
-
}
|
|
338
|
-
);
|
|
10
|
+
return /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", {}), children: /* @__PURE__ */ jsx(LazyDependencyGraphContent, { ...props }) });
|
|
339
11
|
}
|
|
340
12
|
|
|
341
13
|
export { DependencyGraph };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DependencyGraph.esm.js","sources":["../../../src/components/DependencyGraph/DependencyGraph.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n SVGProps,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport useMeasure from 'react-use/esm/useMeasure';\nimport classNames from 'classnames';\nimport { once } from 'lodash';\nimport * as d3Zoom from 'd3-zoom';\nimport * as d3Selection from 'd3-selection';\nimport useTheme from '@material-ui/core/styles/useTheme';\nimport dagre from '@dagrejs/dagre';\nimport debounce from 'lodash/debounce';\nimport { DependencyGraphTypes as Types } from './types';\nimport { Node } from './Node';\nimport { Edge, GraphEdge } from './Edge';\nimport { ARROW_MARKER_ID } from './constants';\nimport IconButton from '@material-ui/core/IconButton';\nimport FullscreenIcon from '@material-ui/icons/Fullscreen';\nimport FullscreenExitIcon from '@material-ui/icons/FullscreenExit';\nimport { FullScreen, useFullScreenHandle } from 'react-full-screen';\nimport { makeStyles, Theme } from '@material-ui/core/styles';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { coreComponentsTranslationRef } from '../../translation';\n\nconst useStyles = makeStyles((theme: Theme) => ({\n fullscreenButton: {\n position: 'absolute',\n right: 0,\n },\n root: {\n overflow: 'hidden',\n minHeight: '100%',\n minWidth: '100%',\n },\n fixedHeight: {\n maxHeight: '100%',\n },\n fullscreen: {\n backgroundColor: theme.palette.background.paper,\n },\n}));\n\n/**\n * Properties of {@link DependencyGraph}\n *\n * @public\n * @remarks\n * `<NodeData>` and `<EdgeData>` are useful when rendering custom or edge labels\n */\nexport interface DependencyGraphProps<NodeData, EdgeData>\n extends SVGProps<SVGSVGElement> {\n /**\n * Edges of graph\n */\n edges: Types.DependencyEdge<EdgeData>[];\n /**\n * Nodes of Graph\n */\n nodes: Types.DependencyNode<NodeData>[];\n /**\n * Graph {@link DependencyGraphTypes.(Direction:namespace) | direction}\n *\n * @remarks\n *\n * Default: `DependencyGraphTypes.Direction.TOP_BOTTOM`\n */\n direction?: Types.Direction;\n /**\n * Node {@link DependencyGraphTypes.(Alignment:namespace) | alignment}\n */\n align?: Types.Alignment;\n /**\n * Margin between nodes on each rank\n *\n * @remarks\n *\n * Default: 50\n */\n nodeMargin?: number;\n /**\n * Margin between edges\n *\n * @remarks\n *\n * Default: 10\n */\n edgeMargin?: number;\n /**\n * Margin between each rank\n *\n * @remarks\n *\n * Default: 50\n */\n rankMargin?: number;\n /**\n * Margin on left and right of whole graph\n *\n * @remarks\n *\n * Default: 0\n */\n paddingX?: number;\n /**\n * Margin on top and bottom of whole graph\n *\n * @remarks\n *\n * Default: 0\n */\n paddingY?: number;\n /**\n * Heuristic used to find set of edges that will make graph acyclic\n */\n acyclicer?: 'greedy';\n /**\n * {@link DependencyGraphTypes.(Ranker:namespace) | Algorithm} used to rank nodes\n *\n * @remarks\n *\n * Default: `DependencyGraphTypes.Ranker.NETWORK_SIMPLEX`\n */\n ranker?: Types.Ranker;\n /**\n * {@link DependencyGraphTypes.(LabelPosition:namespace) | Position} of label in relation to edge\n *\n * @remarks\n *\n * Default: `DependencyGraphTypes.LabelPosition.RIGHT`\n */\n labelPosition?: Types.LabelPosition;\n /**\n * How much to move label away from edge\n *\n * @remarks\n *\n * Applies only when {@link DependencyGraphProps.labelPosition} is `DependencyGraphTypes.LabelPosition.LEFT` or\n * `DependencyGraphTypes.LabelPosition.RIGHT`\n */\n labelOffset?: number;\n /**\n * Minimum number of ranks to keep between connected nodes\n */\n edgeRanks?: number;\n /**\n * Weight applied to edges in graph\n */\n edgeWeight?: number;\n /**\n * Custom edge rendering component\n */\n renderEdge?: Types.RenderEdgeFunction<EdgeData>;\n /**\n * Custom node rendering component\n */\n renderNode?: Types.RenderNodeFunction<NodeData>;\n /**\n * Custom label rendering component\n */\n renderLabel?: Types.RenderLabelFunction<EdgeData>;\n /**\n * {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Element/defs | Defs} shared by rendered SVG to be used by\n * {@link DependencyGraphProps.renderNode} and/or {@link DependencyGraphProps.renderLabel}\n */\n defs?: JSX.Element | JSX.Element[];\n /**\n * Controls zoom behavior of graph\n *\n * @remarks\n *\n * Default: `enabled`\n */\n zoom?: 'enabled' | 'disabled' | 'enable-on-click';\n /**\n * A factory for curve generators addressing both lines and areas.\n *\n * @remarks\n *\n * Default: 'curveMonotoneX'\n */\n curve?: 'curveStepBefore' | 'curveMonotoneX';\n /**\n * Controls if the arrow heads should be rendered or not.\n *\n * Default: false\n */\n showArrowHeads?: boolean;\n /**\n * Controls if the graph should be contained or grow\n *\n * @remarks\n *\n * Default: 'grow'\n */\n fit?: 'grow' | 'contain';\n /**\n * Controls if user can toggle fullscreen mode\n *\n * @remarks\n *\n * Default: true\n */\n allowFullscreen?: boolean;\n}\n\nconst WORKSPACE_ID = 'workspace';\nconst DEPENDENCY_GRAPH_SVG = 'dependency-graph';\n\n/**\n * Graph component used to visualize relations between entities\n *\n * @public\n */\nexport function DependencyGraph<NodeData, EdgeData>(\n props: DependencyGraphProps<NodeData, EdgeData>,\n) {\n const {\n edges,\n nodes,\n renderNode,\n direction = Types.Direction.TOP_BOTTOM,\n align,\n nodeMargin = 50,\n edgeMargin = 10,\n rankMargin = 50,\n paddingX = 0,\n paddingY = 0,\n acyclicer,\n ranker = Types.Ranker.NETWORK_SIMPLEX,\n labelPosition = Types.LabelPosition.RIGHT,\n labelOffset = 10,\n edgeRanks = 1,\n edgeWeight = 1,\n renderEdge,\n renderLabel,\n defs,\n zoom = 'enabled',\n curve = 'curveMonotoneX',\n showArrowHeads = false,\n fit = 'grow',\n allowFullscreen = true,\n ...svgProps\n } = props;\n const theme = useTheme();\n const [containerWidth, setContainerWidth] = useState<number>(100);\n const [containerHeight, setContainerHeight] = useState<number>(100);\n const fullScreenHandle = useFullScreenHandle();\n const styles = useStyles();\n const { t } = useTranslationRef(coreComponentsTranslationRef);\n\n const graph = useRef<dagre.graphlib.Graph<Types.DependencyNode<NodeData>>>(\n new dagre.graphlib.Graph(),\n );\n const [graphWidth, setGraphWidth] = useState<number>(\n graph.current.graph()?.width || 0,\n );\n const [graphHeight, setGraphHeight] = useState<number>(\n graph.current.graph()?.height || 0,\n );\n const [graphNodes, setGraphNodes] = useState<string[]>([]);\n const [graphEdges, setGraphEdges] = useState<dagre.Edge[]>([]);\n\n const maxWidth = Math.max(graphWidth, containerWidth);\n const maxHeight = Math.max(graphHeight, containerHeight);\n\n const [_measureRef] = useMeasure();\n const measureRef = once(_measureRef);\n\n const scalableHeight =\n fit === 'grow' && !fullScreenHandle.active ? maxHeight : '100%';\n\n const containerRef = useMemo(\n () =>\n debounce((root: HTMLDivElement) => {\n if (!root) {\n return;\n }\n measureRef(root);\n\n // Set up zooming + panning\n const node: SVGSVGElement = root.querySelector(\n `svg#${DEPENDENCY_GRAPH_SVG}`,\n ) as SVGSVGElement;\n if (!node) {\n return;\n }\n const container = d3Selection.select<SVGSVGElement, null>(node);\n const workspace = d3Selection.select(node.getElementById(WORKSPACE_ID));\n\n function enableZoom() {\n container.call(\n d3Zoom\n .zoom<SVGSVGElement, null>()\n .scaleExtent([1, Infinity])\n .on('zoom', event => {\n event.transform.x = Math.min(\n 0,\n Math.max(\n event.transform.x,\n maxWidth - maxWidth * event.transform.k,\n ),\n );\n event.transform.y = Math.min(\n 0,\n Math.max(\n event.transform.y,\n maxHeight - maxHeight * event.transform.k,\n ),\n );\n workspace.attr('transform', event.transform);\n }),\n );\n }\n\n if (zoom === 'enabled') {\n enableZoom();\n } else if (zoom === 'enable-on-click') {\n container.on('click', () => enableZoom());\n }\n\n const { width: newContainerWidth, height: newContainerHeight } =\n root.getBoundingClientRect();\n if (\n containerWidth !== newContainerWidth &&\n newContainerWidth <= maxWidth\n ) {\n setContainerWidth(newContainerWidth);\n }\n if (\n containerHeight !== newContainerHeight &&\n newContainerHeight <= maxHeight\n ) {\n setContainerHeight(newContainerHeight);\n }\n }, 100),\n [measureRef, containerHeight, containerWidth, maxWidth, maxHeight, zoom],\n );\n\n const setNodesAndEdges = useCallback(() => {\n // Cleaning up lingering nodes and edges\n const currentGraphNodes = graph.current.nodes();\n const currentGraphEdges = graph.current.edges();\n\n currentGraphNodes.forEach(nodeId => {\n const remainingNode = nodes.some(node => node.id === nodeId);\n if (!remainingNode) {\n graph.current.removeNode(nodeId);\n }\n });\n\n currentGraphEdges.forEach(e => {\n const remainingEdge = edges.some(\n edge => edge.from === e.v && edge.to === e.w,\n );\n if (!remainingEdge) {\n graph.current.removeEdge(e.v, e.w);\n }\n });\n\n // Adding/updating nodes and edges\n nodes.forEach(node => {\n const existingNode = graph.current\n .nodes()\n .find(nodeId => node.id === nodeId);\n\n if (existingNode && graph.current.node(existingNode)) {\n const { width, height, x, y } = graph.current.node(existingNode);\n graph.current.setNode(existingNode, { ...node, width, height, x, y });\n } else {\n graph.current.setNode(node.id, { ...node, width: 0, height: 0 });\n }\n });\n\n edges.forEach(e => {\n graph.current.setEdge(e.from, e.to, {\n ...e,\n label: e.label,\n width: 0,\n height: 0,\n labelpos: labelPosition,\n labeloffset: labelOffset,\n weight: edgeWeight,\n minlen: edgeRanks,\n });\n });\n }, [edges, nodes, labelPosition, labelOffset, edgeWeight, edgeRanks]);\n\n const updateGraph = useMemo(\n () =>\n debounce(\n () => {\n dagre.layout(graph.current);\n const { height, width } = graph.current.graph();\n const newHeight = Math.max(0, height || 0);\n const newWidth = Math.max(0, width || 0);\n setGraphWidth(newWidth);\n setGraphHeight(newHeight);\n\n setGraphNodes(graph.current.nodes());\n setGraphEdges(graph.current.edges());\n },\n 250,\n { leading: true },\n ),\n [],\n );\n\n useEffect(() => {\n graph.current.setGraph({\n rankdir: direction,\n align,\n nodesep: nodeMargin,\n edgesep: edgeMargin,\n ranksep: rankMargin,\n marginx: paddingX,\n marginy: paddingY,\n acyclicer,\n ranker,\n });\n\n setNodesAndEdges();\n updateGraph();\n\n return updateGraph.cancel;\n }, [\n acyclicer,\n align,\n direction,\n edgeMargin,\n paddingX,\n paddingY,\n nodeMargin,\n rankMargin,\n ranker,\n setNodesAndEdges,\n updateGraph,\n ]);\n\n const setNode = useCallback(\n (id: string, node: Types.DependencyNode<NodeData>) => {\n graph.current.setNode(id, node);\n updateGraph();\n return graph.current;\n },\n [updateGraph],\n );\n\n const setEdge = useCallback(\n (id: dagre.Edge, edge: Types.DependencyEdge<EdgeData>) => {\n graph.current.setEdge(id, edge);\n updateGraph();\n return graph.current;\n },\n [updateGraph],\n );\n\n return (\n <FullScreen\n handle={fullScreenHandle}\n className={classNames(\n fullScreenHandle.active ? styles.fullscreen : styles.root,\n )}\n >\n {allowFullscreen && (\n <Tooltip title={t('dependencyGraph.fullscreenTooltip')}>\n <IconButton\n className={styles.fullscreenButton}\n onClick={\n fullScreenHandle.active\n ? fullScreenHandle.exit\n : fullScreenHandle.enter\n }\n >\n {fullScreenHandle.active ? (\n <FullscreenExitIcon />\n ) : (\n <FullscreenIcon />\n )}\n </IconButton>\n </Tooltip>\n )}\n\n <div ref={containerRef} style={{ width: '100%', height: '100%' }}>\n <svg\n {...svgProps}\n width=\"100%\"\n height={scalableHeight}\n viewBox={`0 0 ${maxWidth} ${maxHeight}`}\n id={DEPENDENCY_GRAPH_SVG}\n >\n <defs>\n <marker\n id={ARROW_MARKER_ID}\n viewBox=\"0 0 24 24\"\n markerWidth=\"14\"\n markerHeight=\"14\"\n refX=\"16\"\n refY=\"12\"\n orient=\"auto\"\n markerUnits=\"strokeWidth\"\n >\n <path\n fill={theme.palette.textSubtle}\n d=\"M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z\"\n />\n </marker>\n {defs}\n </defs>\n <g id={WORKSPACE_ID}>\n <svg\n width={graphWidth}\n height={graphHeight}\n y={maxHeight / 2 - graphHeight / 2}\n x={maxWidth / 2 - graphWidth / 2}\n viewBox={`0 0 ${graphWidth} ${graphHeight}`}\n >\n {graphEdges.map(e => {\n const edge = graph.current.edge(e) as GraphEdge<EdgeData>;\n if (!edge) return null;\n if (renderEdge) return renderEdge({ edge, id: e });\n\n return (\n <Edge\n key={`${e.v}-${e.w}`}\n id={e}\n setEdge={setEdge}\n render={renderLabel}\n edge={edge}\n curve={curve}\n showArrowHeads={showArrowHeads}\n />\n );\n })}\n {graphNodes.map((id: string) => {\n const node = graph.current.node(id);\n if (!node) return null;\n return (\n <Node\n key={id}\n setNode={setNode}\n render={renderNode}\n node={node}\n />\n );\n })}\n </svg>\n </g>\n </svg>\n </div>\n </FullScreen>\n );\n}\n"],"names":["Types"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA6CA,MAAM,SAAA,GAAY,UAAA,CAAW,CAAC,KAAA,MAAkB;AAAA,EAC9C,gBAAA,EAAkB;AAAA,IAChB,QAAA,EAAU,UAAA;AAAA,IACV,KAAA,EAAO;AAAA,GACT;AAAA,EACA,IAAA,EAAM;AAAA,IACJ,QAAA,EAAU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AA;AAAA;AAAA,SACF,EACF;AAAA;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"DependencyGraph.esm.js","sources":["../../../src/components/DependencyGraph/DependencyGraph.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { type ComponentType, Suspense, lazy } from 'react';\nimport type { DependencyGraphProps } from './DependencyGraphContent';\n\nexport type { DependencyGraphProps } from './DependencyGraphContent';\n\nconst LazyDependencyGraphContent = lazy(() =>\n import('./DependencyGraphContent').then(m => ({\n default: m.DependencyGraph as ComponentType<any>,\n })),\n);\n\n/**\n * Graph component used to visualize relations between entities\n *\n * @public\n */\nexport function DependencyGraph<NodeData, EdgeData>(\n props: DependencyGraphProps<NodeData, EdgeData>,\n) {\n return (\n <Suspense fallback={<div />}>\n <LazyDependencyGraphContent {...props} />\n </Suspense>\n );\n}\n"],"names":[],"mappings":";;;AAqBA,MAAM,0BAAA,GAA6B,IAAA;AAAA,EAAK,MACtC,OAAO,iCAA0B,CAAA,CAAE,KAAK,CAAA,CAAA,MAAM;AAAA,IAC5C,SAAS,CAAA,CAAE;AAAA,GACb,CAAE;AACJ,CAAA;AAOO,SAAS,gBACd,KAAA,EACA;AACA,EAAA,uBACE,GAAA,CAAC,QAAA,EAAA,EAAS,QAAA,kBAAU,GAAA,CAAC,KAAA,EAAA,EAAI,GACvB,QAAA,kBAAA,GAAA,CAAC,0BAAA,EAAA,EAA4B,GAAG,KAAA,EAAO,CAAA,EACzC,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, useRef, useMemo, useCallback, useEffect } from 'react';
|
|
3
|
+
import useMeasure from 'react-use/esm/useMeasure';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import { once } from 'lodash';
|
|
6
|
+
import * as d3Zoom from 'd3-zoom';
|
|
7
|
+
import * as d3Selection from 'd3-selection';
|
|
8
|
+
import useTheme from '@material-ui/core/styles/useTheme';
|
|
9
|
+
import dagre from '@dagrejs/dagre';
|
|
10
|
+
import debounce from 'lodash/debounce';
|
|
11
|
+
import { DependencyGraphTypes } from './types.esm.js';
|
|
12
|
+
import { Node } from './Node.esm.js';
|
|
13
|
+
import { Edge } from './Edge.esm.js';
|
|
14
|
+
import { ARROW_MARKER_ID } from './constants.esm.js';
|
|
15
|
+
import IconButton from '@material-ui/core/IconButton';
|
|
16
|
+
import FullscreenIcon from '@material-ui/icons/Fullscreen';
|
|
17
|
+
import FullscreenExitIcon from '@material-ui/icons/FullscreenExit';
|
|
18
|
+
import { useFullScreenHandle, FullScreen } from 'react-full-screen';
|
|
19
|
+
import { makeStyles } from '@material-ui/core/styles';
|
|
20
|
+
import Tooltip from '@material-ui/core/Tooltip';
|
|
21
|
+
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
22
|
+
import { coreComponentsTranslationRef } from '../../translation.esm.js';
|
|
23
|
+
|
|
24
|
+
const useStyles = makeStyles((theme) => ({
|
|
25
|
+
fullscreenButton: {
|
|
26
|
+
position: "absolute",
|
|
27
|
+
right: 0
|
|
28
|
+
},
|
|
29
|
+
root: {
|
|
30
|
+
overflow: "hidden",
|
|
31
|
+
minHeight: "100%",
|
|
32
|
+
minWidth: "100%"
|
|
33
|
+
},
|
|
34
|
+
fixedHeight: {
|
|
35
|
+
maxHeight: "100%"
|
|
36
|
+
},
|
|
37
|
+
fullscreen: {
|
|
38
|
+
backgroundColor: theme.palette.background.paper
|
|
39
|
+
}
|
|
40
|
+
}));
|
|
41
|
+
const WORKSPACE_ID = "workspace";
|
|
42
|
+
const DEPENDENCY_GRAPH_SVG = "dependency-graph";
|
|
43
|
+
function DependencyGraph(props) {
|
|
44
|
+
const {
|
|
45
|
+
edges,
|
|
46
|
+
nodes,
|
|
47
|
+
renderNode,
|
|
48
|
+
direction = DependencyGraphTypes.Direction.TOP_BOTTOM,
|
|
49
|
+
align,
|
|
50
|
+
nodeMargin = 50,
|
|
51
|
+
edgeMargin = 10,
|
|
52
|
+
rankMargin = 50,
|
|
53
|
+
paddingX = 0,
|
|
54
|
+
paddingY = 0,
|
|
55
|
+
acyclicer,
|
|
56
|
+
ranker = DependencyGraphTypes.Ranker.NETWORK_SIMPLEX,
|
|
57
|
+
labelPosition = DependencyGraphTypes.LabelPosition.RIGHT,
|
|
58
|
+
labelOffset = 10,
|
|
59
|
+
edgeRanks = 1,
|
|
60
|
+
edgeWeight = 1,
|
|
61
|
+
renderEdge,
|
|
62
|
+
renderLabel,
|
|
63
|
+
defs,
|
|
64
|
+
zoom = "enabled",
|
|
65
|
+
curve = "curveMonotoneX",
|
|
66
|
+
showArrowHeads = false,
|
|
67
|
+
fit = "grow",
|
|
68
|
+
allowFullscreen = true,
|
|
69
|
+
...svgProps
|
|
70
|
+
} = props;
|
|
71
|
+
const theme = useTheme();
|
|
72
|
+
const [containerWidth, setContainerWidth] = useState(100);
|
|
73
|
+
const [containerHeight, setContainerHeight] = useState(100);
|
|
74
|
+
const fullScreenHandle = useFullScreenHandle();
|
|
75
|
+
const styles = useStyles();
|
|
76
|
+
const { t } = useTranslationRef(coreComponentsTranslationRef);
|
|
77
|
+
const graph = useRef(
|
|
78
|
+
new dagre.graphlib.Graph()
|
|
79
|
+
);
|
|
80
|
+
const [graphWidth, setGraphWidth] = useState(
|
|
81
|
+
graph.current.graph()?.width || 0
|
|
82
|
+
);
|
|
83
|
+
const [graphHeight, setGraphHeight] = useState(
|
|
84
|
+
graph.current.graph()?.height || 0
|
|
85
|
+
);
|
|
86
|
+
const [graphNodes, setGraphNodes] = useState([]);
|
|
87
|
+
const [graphEdges, setGraphEdges] = useState([]);
|
|
88
|
+
const maxWidth = Math.max(graphWidth, containerWidth);
|
|
89
|
+
const maxHeight = Math.max(graphHeight, containerHeight);
|
|
90
|
+
const [_measureRef] = useMeasure();
|
|
91
|
+
const measureRef = once(_measureRef);
|
|
92
|
+
const scalableHeight = fit === "grow" && !fullScreenHandle.active ? maxHeight : "100%";
|
|
93
|
+
const containerRef = useMemo(
|
|
94
|
+
() => debounce((root) => {
|
|
95
|
+
if (!root) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
measureRef(root);
|
|
99
|
+
const node = root.querySelector(
|
|
100
|
+
`svg#${DEPENDENCY_GRAPH_SVG}`
|
|
101
|
+
);
|
|
102
|
+
if (!node) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const container = d3Selection.select(node);
|
|
106
|
+
const workspace = d3Selection.select(node.getElementById(WORKSPACE_ID));
|
|
107
|
+
function enableZoom() {
|
|
108
|
+
container.call(
|
|
109
|
+
d3Zoom.zoom().scaleExtent([1, Infinity]).on("zoom", (event) => {
|
|
110
|
+
event.transform.x = Math.min(
|
|
111
|
+
0,
|
|
112
|
+
Math.max(
|
|
113
|
+
event.transform.x,
|
|
114
|
+
maxWidth - maxWidth * event.transform.k
|
|
115
|
+
)
|
|
116
|
+
);
|
|
117
|
+
event.transform.y = Math.min(
|
|
118
|
+
0,
|
|
119
|
+
Math.max(
|
|
120
|
+
event.transform.y,
|
|
121
|
+
maxHeight - maxHeight * event.transform.k
|
|
122
|
+
)
|
|
123
|
+
);
|
|
124
|
+
workspace.attr("transform", event.transform);
|
|
125
|
+
})
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
if (zoom === "enabled") {
|
|
129
|
+
enableZoom();
|
|
130
|
+
} else if (zoom === "enable-on-click") {
|
|
131
|
+
container.on("click", () => enableZoom());
|
|
132
|
+
}
|
|
133
|
+
const { width: newContainerWidth, height: newContainerHeight } = root.getBoundingClientRect();
|
|
134
|
+
if (containerWidth !== newContainerWidth && newContainerWidth <= maxWidth) {
|
|
135
|
+
setContainerWidth(newContainerWidth);
|
|
136
|
+
}
|
|
137
|
+
if (containerHeight !== newContainerHeight && newContainerHeight <= maxHeight) {
|
|
138
|
+
setContainerHeight(newContainerHeight);
|
|
139
|
+
}
|
|
140
|
+
}, 100),
|
|
141
|
+
[measureRef, containerHeight, containerWidth, maxWidth, maxHeight, zoom]
|
|
142
|
+
);
|
|
143
|
+
const setNodesAndEdges = useCallback(() => {
|
|
144
|
+
const currentGraphNodes = graph.current.nodes();
|
|
145
|
+
const currentGraphEdges = graph.current.edges();
|
|
146
|
+
currentGraphNodes.forEach((nodeId) => {
|
|
147
|
+
const remainingNode = nodes.some((node) => node.id === nodeId);
|
|
148
|
+
if (!remainingNode) {
|
|
149
|
+
graph.current.removeNode(nodeId);
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
currentGraphEdges.forEach((e) => {
|
|
153
|
+
const remainingEdge = edges.some(
|
|
154
|
+
(edge) => edge.from === e.v && edge.to === e.w
|
|
155
|
+
);
|
|
156
|
+
if (!remainingEdge) {
|
|
157
|
+
graph.current.removeEdge(e.v, e.w);
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
nodes.forEach((node) => {
|
|
161
|
+
const existingNode = graph.current.nodes().find((nodeId) => node.id === nodeId);
|
|
162
|
+
if (existingNode && graph.current.node(existingNode)) {
|
|
163
|
+
const { width, height, x, y } = graph.current.node(existingNode);
|
|
164
|
+
graph.current.setNode(existingNode, { ...node, width, height, x, y });
|
|
165
|
+
} else {
|
|
166
|
+
graph.current.setNode(node.id, { ...node, width: 0, height: 0 });
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
edges.forEach((e) => {
|
|
170
|
+
graph.current.setEdge(e.from, e.to, {
|
|
171
|
+
...e,
|
|
172
|
+
label: e.label,
|
|
173
|
+
width: 0,
|
|
174
|
+
height: 0,
|
|
175
|
+
labelpos: labelPosition,
|
|
176
|
+
labeloffset: labelOffset,
|
|
177
|
+
weight: edgeWeight,
|
|
178
|
+
minlen: edgeRanks
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
}, [edges, nodes, labelPosition, labelOffset, edgeWeight, edgeRanks]);
|
|
182
|
+
const updateGraph = useMemo(
|
|
183
|
+
() => debounce(
|
|
184
|
+
() => {
|
|
185
|
+
dagre.layout(graph.current);
|
|
186
|
+
const { height, width } = graph.current.graph();
|
|
187
|
+
const newHeight = Math.max(0, height || 0);
|
|
188
|
+
const newWidth = Math.max(0, width || 0);
|
|
189
|
+
setGraphWidth(newWidth);
|
|
190
|
+
setGraphHeight(newHeight);
|
|
191
|
+
setGraphNodes(graph.current.nodes());
|
|
192
|
+
setGraphEdges(graph.current.edges());
|
|
193
|
+
},
|
|
194
|
+
250,
|
|
195
|
+
{ leading: true }
|
|
196
|
+
),
|
|
197
|
+
[]
|
|
198
|
+
);
|
|
199
|
+
useEffect(() => {
|
|
200
|
+
graph.current.setGraph({
|
|
201
|
+
rankdir: direction,
|
|
202
|
+
align,
|
|
203
|
+
nodesep: nodeMargin,
|
|
204
|
+
edgesep: edgeMargin,
|
|
205
|
+
ranksep: rankMargin,
|
|
206
|
+
marginx: paddingX,
|
|
207
|
+
marginy: paddingY,
|
|
208
|
+
acyclicer,
|
|
209
|
+
ranker
|
|
210
|
+
});
|
|
211
|
+
setNodesAndEdges();
|
|
212
|
+
updateGraph();
|
|
213
|
+
return updateGraph.cancel;
|
|
214
|
+
}, [
|
|
215
|
+
acyclicer,
|
|
216
|
+
align,
|
|
217
|
+
direction,
|
|
218
|
+
edgeMargin,
|
|
219
|
+
paddingX,
|
|
220
|
+
paddingY,
|
|
221
|
+
nodeMargin,
|
|
222
|
+
rankMargin,
|
|
223
|
+
ranker,
|
|
224
|
+
setNodesAndEdges,
|
|
225
|
+
updateGraph
|
|
226
|
+
]);
|
|
227
|
+
const setNode = useCallback(
|
|
228
|
+
(id, node) => {
|
|
229
|
+
graph.current.setNode(id, node);
|
|
230
|
+
updateGraph();
|
|
231
|
+
return graph.current;
|
|
232
|
+
},
|
|
233
|
+
[updateGraph]
|
|
234
|
+
);
|
|
235
|
+
const setEdge = useCallback(
|
|
236
|
+
(id, edge) => {
|
|
237
|
+
graph.current.setEdge(id, edge);
|
|
238
|
+
updateGraph();
|
|
239
|
+
return graph.current;
|
|
240
|
+
},
|
|
241
|
+
[updateGraph]
|
|
242
|
+
);
|
|
243
|
+
return /* @__PURE__ */ jsxs(
|
|
244
|
+
FullScreen,
|
|
245
|
+
{
|
|
246
|
+
handle: fullScreenHandle,
|
|
247
|
+
className: classNames(
|
|
248
|
+
fullScreenHandle.active ? styles.fullscreen : styles.root
|
|
249
|
+
),
|
|
250
|
+
children: [
|
|
251
|
+
allowFullscreen && /* @__PURE__ */ jsx(Tooltip, { title: t("dependencyGraph.fullscreenTooltip"), children: /* @__PURE__ */ jsx(
|
|
252
|
+
IconButton,
|
|
253
|
+
{
|
|
254
|
+
className: styles.fullscreenButton,
|
|
255
|
+
onClick: fullScreenHandle.active ? fullScreenHandle.exit : fullScreenHandle.enter,
|
|
256
|
+
children: fullScreenHandle.active ? /* @__PURE__ */ jsx(FullscreenExitIcon, {}) : /* @__PURE__ */ jsx(FullscreenIcon, {})
|
|
257
|
+
}
|
|
258
|
+
) }),
|
|
259
|
+
/* @__PURE__ */ jsx("div", { ref: containerRef, style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ jsxs(
|
|
260
|
+
"svg",
|
|
261
|
+
{
|
|
262
|
+
...svgProps,
|
|
263
|
+
width: "100%",
|
|
264
|
+
height: scalableHeight,
|
|
265
|
+
viewBox: `0 0 ${maxWidth} ${maxHeight}`,
|
|
266
|
+
id: DEPENDENCY_GRAPH_SVG,
|
|
267
|
+
children: [
|
|
268
|
+
/* @__PURE__ */ jsxs("defs", { children: [
|
|
269
|
+
/* @__PURE__ */ jsx(
|
|
270
|
+
"marker",
|
|
271
|
+
{
|
|
272
|
+
id: ARROW_MARKER_ID,
|
|
273
|
+
viewBox: "0 0 24 24",
|
|
274
|
+
markerWidth: "14",
|
|
275
|
+
markerHeight: "14",
|
|
276
|
+
refX: "16",
|
|
277
|
+
refY: "12",
|
|
278
|
+
orient: "auto",
|
|
279
|
+
markerUnits: "strokeWidth",
|
|
280
|
+
children: /* @__PURE__ */ jsx(
|
|
281
|
+
"path",
|
|
282
|
+
{
|
|
283
|
+
fill: theme.palette.textSubtle,
|
|
284
|
+
d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"
|
|
285
|
+
}
|
|
286
|
+
)
|
|
287
|
+
}
|
|
288
|
+
),
|
|
289
|
+
defs
|
|
290
|
+
] }),
|
|
291
|
+
/* @__PURE__ */ jsx("g", { id: WORKSPACE_ID, children: /* @__PURE__ */ jsxs(
|
|
292
|
+
"svg",
|
|
293
|
+
{
|
|
294
|
+
width: graphWidth,
|
|
295
|
+
height: graphHeight,
|
|
296
|
+
y: maxHeight / 2 - graphHeight / 2,
|
|
297
|
+
x: maxWidth / 2 - graphWidth / 2,
|
|
298
|
+
viewBox: `0 0 ${graphWidth} ${graphHeight}`,
|
|
299
|
+
children: [
|
|
300
|
+
graphEdges.map((e) => {
|
|
301
|
+
const edge = graph.current.edge(e);
|
|
302
|
+
if (!edge) return null;
|
|
303
|
+
if (renderEdge) return renderEdge({ edge, id: e });
|
|
304
|
+
return /* @__PURE__ */ jsx(
|
|
305
|
+
Edge,
|
|
306
|
+
{
|
|
307
|
+
id: e,
|
|
308
|
+
setEdge,
|
|
309
|
+
render: renderLabel,
|
|
310
|
+
edge,
|
|
311
|
+
curve,
|
|
312
|
+
showArrowHeads
|
|
313
|
+
},
|
|
314
|
+
`${e.v}-${e.w}`
|
|
315
|
+
);
|
|
316
|
+
}),
|
|
317
|
+
graphNodes.map((id) => {
|
|
318
|
+
const node = graph.current.node(id);
|
|
319
|
+
if (!node) return null;
|
|
320
|
+
return /* @__PURE__ */ jsx(
|
|
321
|
+
Node,
|
|
322
|
+
{
|
|
323
|
+
setNode,
|
|
324
|
+
render: renderNode,
|
|
325
|
+
node
|
|
326
|
+
},
|
|
327
|
+
id
|
|
328
|
+
);
|
|
329
|
+
})
|
|
330
|
+
]
|
|
331
|
+
}
|
|
332
|
+
) })
|
|
333
|
+
]
|
|
334
|
+
}
|
|
335
|
+
) })
|
|
336
|
+
]
|
|
337
|
+
}
|
|
338
|
+
);
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
export { DependencyGraph };
|
|
342
|
+
//# sourceMappingURL=DependencyGraphContent.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DependencyGraphContent.esm.js","sources":["../../../src/components/DependencyGraph/DependencyGraphContent.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n SVGProps,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport useMeasure from 'react-use/esm/useMeasure';\nimport classNames from 'classnames';\nimport { once } from 'lodash';\nimport * as d3Zoom from 'd3-zoom';\nimport * as d3Selection from 'd3-selection';\nimport useTheme from '@material-ui/core/styles/useTheme';\nimport dagre from '@dagrejs/dagre';\nimport debounce from 'lodash/debounce';\nimport { DependencyGraphTypes as Types } from './types';\nimport { Node } from './Node';\nimport { Edge, GraphEdge } from './Edge';\nimport { ARROW_MARKER_ID } from './constants';\nimport IconButton from '@material-ui/core/IconButton';\nimport FullscreenIcon from '@material-ui/icons/Fullscreen';\nimport FullscreenExitIcon from '@material-ui/icons/FullscreenExit';\nimport { FullScreen, useFullScreenHandle } from 'react-full-screen';\nimport { makeStyles, Theme } from '@material-ui/core/styles';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { coreComponentsTranslationRef } from '../../translation';\n\nconst useStyles = makeStyles((theme: Theme) => ({\n fullscreenButton: {\n position: 'absolute',\n right: 0,\n },\n root: {\n overflow: 'hidden',\n minHeight: '100%',\n minWidth: '100%',\n },\n fixedHeight: {\n maxHeight: '100%',\n },\n fullscreen: {\n backgroundColor: theme.palette.background.paper,\n },\n}));\n\n/**\n * Properties of {@link DependencyGraph}\n *\n * @public\n * @remarks\n * `<NodeData>` and `<EdgeData>` are useful when rendering custom or edge labels\n */\nexport interface DependencyGraphProps<NodeData, EdgeData>\n extends SVGProps<SVGSVGElement> {\n /**\n * Edges of graph\n */\n edges: Types.DependencyEdge<EdgeData>[];\n /**\n * Nodes of Graph\n */\n nodes: Types.DependencyNode<NodeData>[];\n /**\n * Graph {@link DependencyGraphTypes.(Direction:namespace) | direction}\n *\n * @remarks\n *\n * Default: `DependencyGraphTypes.Direction.TOP_BOTTOM`\n */\n direction?: Types.Direction;\n /**\n * Node {@link DependencyGraphTypes.(Alignment:namespace) | alignment}\n */\n align?: Types.Alignment;\n /**\n * Margin between nodes on each rank\n *\n * @remarks\n *\n * Default: 50\n */\n nodeMargin?: number;\n /**\n * Margin between edges\n *\n * @remarks\n *\n * Default: 10\n */\n edgeMargin?: number;\n /**\n * Margin between each rank\n *\n * @remarks\n *\n * Default: 50\n */\n rankMargin?: number;\n /**\n * Margin on left and right of whole graph\n *\n * @remarks\n *\n * Default: 0\n */\n paddingX?: number;\n /**\n * Margin on top and bottom of whole graph\n *\n * @remarks\n *\n * Default: 0\n */\n paddingY?: number;\n /**\n * Heuristic used to find set of edges that will make graph acyclic\n */\n acyclicer?: 'greedy';\n /**\n * {@link DependencyGraphTypes.(Ranker:namespace) | Algorithm} used to rank nodes\n *\n * @remarks\n *\n * Default: `DependencyGraphTypes.Ranker.NETWORK_SIMPLEX`\n */\n ranker?: Types.Ranker;\n /**\n * {@link DependencyGraphTypes.(LabelPosition:namespace) | Position} of label in relation to edge\n *\n * @remarks\n *\n * Default: `DependencyGraphTypes.LabelPosition.RIGHT`\n */\n labelPosition?: Types.LabelPosition;\n /**\n * How much to move label away from edge\n *\n * @remarks\n *\n * Applies only when {@link DependencyGraphProps.labelPosition} is `DependencyGraphTypes.LabelPosition.LEFT` or\n * `DependencyGraphTypes.LabelPosition.RIGHT`\n */\n labelOffset?: number;\n /**\n * Minimum number of ranks to keep between connected nodes\n */\n edgeRanks?: number;\n /**\n * Weight applied to edges in graph\n */\n edgeWeight?: number;\n /**\n * Custom edge rendering component\n */\n renderEdge?: Types.RenderEdgeFunction<EdgeData>;\n /**\n * Custom node rendering component\n */\n renderNode?: Types.RenderNodeFunction<NodeData>;\n /**\n * Custom label rendering component\n */\n renderLabel?: Types.RenderLabelFunction<EdgeData>;\n /**\n * {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Element/defs | Defs} shared by rendered SVG to be used by\n * {@link DependencyGraphProps.renderNode} and/or {@link DependencyGraphProps.renderLabel}\n */\n defs?: JSX.Element | JSX.Element[];\n /**\n * Controls zoom behavior of graph\n *\n * @remarks\n *\n * Default: `enabled`\n */\n zoom?: 'enabled' | 'disabled' | 'enable-on-click';\n /**\n * A factory for curve generators addressing both lines and areas.\n *\n * @remarks\n *\n * Default: 'curveMonotoneX'\n */\n curve?: 'curveStepBefore' | 'curveMonotoneX';\n /**\n * Controls if the arrow heads should be rendered or not.\n *\n * Default: false\n */\n showArrowHeads?: boolean;\n /**\n * Controls if the graph should be contained or grow\n *\n * @remarks\n *\n * Default: 'grow'\n */\n fit?: 'grow' | 'contain';\n /**\n * Controls if user can toggle fullscreen mode\n *\n * @remarks\n *\n * Default: true\n */\n allowFullscreen?: boolean;\n}\n\nconst WORKSPACE_ID = 'workspace';\nconst DEPENDENCY_GRAPH_SVG = 'dependency-graph';\n\n/**\n * Graph component used to visualize relations between entities\n *\n * @public\n */\nexport function DependencyGraph<NodeData, EdgeData>(\n props: DependencyGraphProps<NodeData, EdgeData>,\n) {\n const {\n edges,\n nodes,\n renderNode,\n direction = Types.Direction.TOP_BOTTOM,\n align,\n nodeMargin = 50,\n edgeMargin = 10,\n rankMargin = 50,\n paddingX = 0,\n paddingY = 0,\n acyclicer,\n ranker = Types.Ranker.NETWORK_SIMPLEX,\n labelPosition = Types.LabelPosition.RIGHT,\n labelOffset = 10,\n edgeRanks = 1,\n edgeWeight = 1,\n renderEdge,\n renderLabel,\n defs,\n zoom = 'enabled',\n curve = 'curveMonotoneX',\n showArrowHeads = false,\n fit = 'grow',\n allowFullscreen = true,\n ...svgProps\n } = props;\n const theme = useTheme();\n const [containerWidth, setContainerWidth] = useState<number>(100);\n const [containerHeight, setContainerHeight] = useState<number>(100);\n const fullScreenHandle = useFullScreenHandle();\n const styles = useStyles();\n const { t } = useTranslationRef(coreComponentsTranslationRef);\n\n const graph = useRef<dagre.graphlib.Graph<Types.DependencyNode<NodeData>>>(\n new dagre.graphlib.Graph(),\n );\n const [graphWidth, setGraphWidth] = useState<number>(\n graph.current.graph()?.width || 0,\n );\n const [graphHeight, setGraphHeight] = useState<number>(\n graph.current.graph()?.height || 0,\n );\n const [graphNodes, setGraphNodes] = useState<string[]>([]);\n const [graphEdges, setGraphEdges] = useState<dagre.Edge[]>([]);\n\n const maxWidth = Math.max(graphWidth, containerWidth);\n const maxHeight = Math.max(graphHeight, containerHeight);\n\n const [_measureRef] = useMeasure();\n const measureRef = once(_measureRef);\n\n const scalableHeight =\n fit === 'grow' && !fullScreenHandle.active ? maxHeight : '100%';\n\n const containerRef = useMemo(\n () =>\n debounce((root: HTMLDivElement) => {\n if (!root) {\n return;\n }\n measureRef(root);\n\n // Set up zooming + panning\n const node: SVGSVGElement = root.querySelector(\n `svg#${DEPENDENCY_GRAPH_SVG}`,\n ) as SVGSVGElement;\n if (!node) {\n return;\n }\n const container = d3Selection.select<SVGSVGElement, null>(node);\n const workspace = d3Selection.select(node.getElementById(WORKSPACE_ID));\n\n function enableZoom() {\n container.call(\n d3Zoom\n .zoom<SVGSVGElement, null>()\n .scaleExtent([1, Infinity])\n .on('zoom', event => {\n event.transform.x = Math.min(\n 0,\n Math.max(\n event.transform.x,\n maxWidth - maxWidth * event.transform.k,\n ),\n );\n event.transform.y = Math.min(\n 0,\n Math.max(\n event.transform.y,\n maxHeight - maxHeight * event.transform.k,\n ),\n );\n workspace.attr('transform', event.transform);\n }),\n );\n }\n\n if (zoom === 'enabled') {\n enableZoom();\n } else if (zoom === 'enable-on-click') {\n container.on('click', () => enableZoom());\n }\n\n const { width: newContainerWidth, height: newContainerHeight } =\n root.getBoundingClientRect();\n if (\n containerWidth !== newContainerWidth &&\n newContainerWidth <= maxWidth\n ) {\n setContainerWidth(newContainerWidth);\n }\n if (\n containerHeight !== newContainerHeight &&\n newContainerHeight <= maxHeight\n ) {\n setContainerHeight(newContainerHeight);\n }\n }, 100),\n [measureRef, containerHeight, containerWidth, maxWidth, maxHeight, zoom],\n );\n\n const setNodesAndEdges = useCallback(() => {\n // Cleaning up lingering nodes and edges\n const currentGraphNodes = graph.current.nodes();\n const currentGraphEdges = graph.current.edges();\n\n currentGraphNodes.forEach(nodeId => {\n const remainingNode = nodes.some(node => node.id === nodeId);\n if (!remainingNode) {\n graph.current.removeNode(nodeId);\n }\n });\n\n currentGraphEdges.forEach(e => {\n const remainingEdge = edges.some(\n edge => edge.from === e.v && edge.to === e.w,\n );\n if (!remainingEdge) {\n graph.current.removeEdge(e.v, e.w);\n }\n });\n\n // Adding/updating nodes and edges\n nodes.forEach(node => {\n const existingNode = graph.current\n .nodes()\n .find(nodeId => node.id === nodeId);\n\n if (existingNode && graph.current.node(existingNode)) {\n const { width, height, x, y } = graph.current.node(existingNode);\n graph.current.setNode(existingNode, { ...node, width, height, x, y });\n } else {\n graph.current.setNode(node.id, { ...node, width: 0, height: 0 });\n }\n });\n\n edges.forEach(e => {\n graph.current.setEdge(e.from, e.to, {\n ...e,\n label: e.label,\n width: 0,\n height: 0,\n labelpos: labelPosition,\n labeloffset: labelOffset,\n weight: edgeWeight,\n minlen: edgeRanks,\n });\n });\n }, [edges, nodes, labelPosition, labelOffset, edgeWeight, edgeRanks]);\n\n const updateGraph = useMemo(\n () =>\n debounce(\n () => {\n dagre.layout(graph.current);\n const { height, width } = graph.current.graph();\n const newHeight = Math.max(0, height || 0);\n const newWidth = Math.max(0, width || 0);\n setGraphWidth(newWidth);\n setGraphHeight(newHeight);\n\n setGraphNodes(graph.current.nodes());\n setGraphEdges(graph.current.edges());\n },\n 250,\n { leading: true },\n ),\n [],\n );\n\n useEffect(() => {\n graph.current.setGraph({\n rankdir: direction,\n align,\n nodesep: nodeMargin,\n edgesep: edgeMargin,\n ranksep: rankMargin,\n marginx: paddingX,\n marginy: paddingY,\n acyclicer,\n ranker,\n });\n\n setNodesAndEdges();\n updateGraph();\n\n return updateGraph.cancel;\n }, [\n acyclicer,\n align,\n direction,\n edgeMargin,\n paddingX,\n paddingY,\n nodeMargin,\n rankMargin,\n ranker,\n setNodesAndEdges,\n updateGraph,\n ]);\n\n const setNode = useCallback(\n (id: string, node: Types.DependencyNode<NodeData>) => {\n graph.current.setNode(id, node);\n updateGraph();\n return graph.current;\n },\n [updateGraph],\n );\n\n const setEdge = useCallback(\n (id: dagre.Edge, edge: Types.DependencyEdge<EdgeData>) => {\n graph.current.setEdge(id, edge);\n updateGraph();\n return graph.current;\n },\n [updateGraph],\n );\n\n return (\n <FullScreen\n handle={fullScreenHandle}\n className={classNames(\n fullScreenHandle.active ? styles.fullscreen : styles.root,\n )}\n >\n {allowFullscreen && (\n <Tooltip title={t('dependencyGraph.fullscreenTooltip')}>\n <IconButton\n className={styles.fullscreenButton}\n onClick={\n fullScreenHandle.active\n ? fullScreenHandle.exit\n : fullScreenHandle.enter\n }\n >\n {fullScreenHandle.active ? (\n <FullscreenExitIcon />\n ) : (\n <FullscreenIcon />\n )}\n </IconButton>\n </Tooltip>\n )}\n\n <div ref={containerRef} style={{ width: '100%', height: '100%' }}>\n <svg\n {...svgProps}\n width=\"100%\"\n height={scalableHeight}\n viewBox={`0 0 ${maxWidth} ${maxHeight}`}\n id={DEPENDENCY_GRAPH_SVG}\n >\n <defs>\n <marker\n id={ARROW_MARKER_ID}\n viewBox=\"0 0 24 24\"\n markerWidth=\"14\"\n markerHeight=\"14\"\n refX=\"16\"\n refY=\"12\"\n orient=\"auto\"\n markerUnits=\"strokeWidth\"\n >\n <path\n fill={theme.palette.textSubtle}\n d=\"M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z\"\n />\n </marker>\n {defs}\n </defs>\n <g id={WORKSPACE_ID}>\n <svg\n width={graphWidth}\n height={graphHeight}\n y={maxHeight / 2 - graphHeight / 2}\n x={maxWidth / 2 - graphWidth / 2}\n viewBox={`0 0 ${graphWidth} ${graphHeight}`}\n >\n {graphEdges.map(e => {\n const edge = graph.current.edge(e) as GraphEdge<EdgeData>;\n if (!edge) return null;\n if (renderEdge) return renderEdge({ edge, id: e });\n\n return (\n <Edge\n key={`${e.v}-${e.w}`}\n id={e}\n setEdge={setEdge}\n render={renderLabel}\n edge={edge}\n curve={curve}\n showArrowHeads={showArrowHeads}\n />\n );\n })}\n {graphNodes.map((id: string) => {\n const node = graph.current.node(id);\n if (!node) return null;\n return (\n <Node\n key={id}\n setNode={setNode}\n render={renderNode}\n node={node}\n />\n );\n })}\n </svg>\n </g>\n </svg>\n </div>\n </FullScreen>\n );\n}\n"],"names":["Types"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA6CA,MAAM,SAAA,GAAY,UAAA,CAAW,CAAC,KAAA,MAAkB;AAAA,EAC9C,gBAAA,EAAkB;AAAA,IAChB,QAAA,EAAU,UAAA;AAAA,IACV,KAAA,EAAO;AAAA,GACT;AAAA,EACA,IAAA,EAAM;AAAA,IACJ,QAAA,EAAU,QAAA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AA;AAAA,SACF,EACF;AAAA;AAAA;AAAA,GACF;AAEJ;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -236,6 +236,7 @@ interface CodeSnippetProps {
|
|
|
236
236
|
*/
|
|
237
237
|
customStyle?: any;
|
|
238
238
|
}
|
|
239
|
+
|
|
239
240
|
/**
|
|
240
241
|
* Thin wrapper on top of {@link https://react-syntax-highlighter.github.io/react-syntax-highlighter/ | react-syntax-highlighter}
|
|
241
242
|
* providing consistent theming and copy code button
|
|
@@ -713,6 +714,7 @@ interface DependencyGraphProps<NodeData, EdgeData> extends SVGProps<SVGSVGElemen
|
|
|
713
714
|
*/
|
|
714
715
|
allowFullscreen?: boolean;
|
|
715
716
|
}
|
|
717
|
+
|
|
716
718
|
/**
|
|
717
719
|
* Graph component used to visualize relations between entities
|
|
718
720
|
*
|