From 2e2ebbf75b12784ac664d864865f01729b3eb8c4 Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Thu, 24 Aug 2023 00:06:37 +0200 Subject: refactor(web): clean up graphviz visualization --- .../d3-graphviz-npm-5.1.0-ba6bed3fec.patch.license | 14 + .../d3-zoom-npm-3.0.0-18f706a421.patch.license | 11 + LICENSES/BSD-3-Clause.txt | 11 + LICENSES/ISC.txt | 8 + .../frontend/config/graphvizUMDVitePlugin.ts | 6 + subprojects/frontend/index.html | 2 +- subprojects/frontend/package.json | 3 +- subprojects/frontend/src/TopBar.tsx | 11 +- subprojects/frontend/src/editor/EditorTheme.ts | 3 +- .../frontend/src/graph/DotGraphVisualizer.tsx | 142 ++++++++ subprojects/frontend/src/graph/GraphArea.tsx | 380 +-------------------- subprojects/frontend/src/graph/GraphPane.tsx | 2 +- subprojects/frontend/src/graph/GraphTheme.tsx | 64 ++++ subprojects/frontend/src/graph/ZoomButtons.tsx | 43 +++ subprojects/frontend/src/graph/ZoomCanvas.tsx | 177 ++++++++++ subprojects/frontend/src/graph/parseBBox.ts | 68 ++++ subprojects/frontend/src/graph/postProcessSVG.ts | 79 +++++ subprojects/frontend/src/theme/ThemeProvider.tsx | 10 +- subprojects/frontend/vite.config.ts | 2 +- yarn.lock | 24 +- 20 files changed, 659 insertions(+), 401 deletions(-) create mode 100644 .yarn/patches/d3-graphviz-npm-5.1.0-ba6bed3fec.patch.license create mode 100644 .yarn/patches/d3-zoom-npm-3.0.0-18f706a421.patch.license create mode 100644 LICENSES/BSD-3-Clause.txt create mode 100644 LICENSES/ISC.txt create mode 100644 subprojects/frontend/src/graph/DotGraphVisualizer.tsx create mode 100644 subprojects/frontend/src/graph/GraphTheme.tsx create mode 100644 subprojects/frontend/src/graph/ZoomButtons.tsx create mode 100644 subprojects/frontend/src/graph/ZoomCanvas.tsx create mode 100644 subprojects/frontend/src/graph/parseBBox.ts create mode 100644 subprojects/frontend/src/graph/postProcessSVG.ts diff --git a/.yarn/patches/d3-graphviz-npm-5.1.0-ba6bed3fec.patch.license b/.yarn/patches/d3-graphviz-npm-5.1.0-ba6bed3fec.patch.license new file mode 100644 index 00000000..0c7bddfb --- /dev/null +++ b/.yarn/patches/d3-graphviz-npm-5.1.0-ba6bed3fec.patch.license @@ -0,0 +1,14 @@ +Copyright 2017, Magnus Jacobsson +Copyright 2023, The Refinery Authors + +SPDX-License-Identifier: BSD-3-Clause + +This file Incorporates patches from the Refinery authors. + +However, but redistribution and use is only permitted if neither +the name of the copyright holder Magnus Jacobsson nor the names of other +contributors to the d3-graphviz project are used to endorse or promote +products derived from this software as per the 3rd clause of the +3-clause BSD license. + +See LICENSES/BSD-3-Clause.txt for more details. diff --git a/.yarn/patches/d3-zoom-npm-3.0.0-18f706a421.patch.license b/.yarn/patches/d3-zoom-npm-3.0.0-18f706a421.patch.license new file mode 100644 index 00000000..d95053c1 --- /dev/null +++ b/.yarn/patches/d3-zoom-npm-3.0.0-18f706a421.patch.license @@ -0,0 +1,11 @@ +Copyright 2010-2021 Mike Bostock +Copyright 2020-2023 Philippe Rivière +Copyright 2023 The Refinery Authors + +SPDX-License-Identifier: ISC OR EPL-2.0 + +This file ncorporates patches from +https://github.com/d3/d3-zoom/tree/3afbe2ae2dfb3129231c5567db56dafb2d6a56a6 +by Philippe Rivière. + +Morevoer, it includes other modifications by the Refinery authors. diff --git a/LICENSES/BSD-3-Clause.txt b/LICENSES/BSD-3-Clause.txt new file mode 100644 index 00000000..ea890afb --- /dev/null +++ b/LICENSES/BSD-3-Clause.txt @@ -0,0 +1,11 @@ +Copyright (c) . + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/LICENSES/ISC.txt b/LICENSES/ISC.txt new file mode 100644 index 00000000..b9c199c9 --- /dev/null +++ b/LICENSES/ISC.txt @@ -0,0 +1,8 @@ +ISC License: + +Copyright (c) 2004-2010 by Internet Systems Consortium, Inc. ("ISC") +Copyright (c) 1995-2003 by Internet Software Consortium + +Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/subprojects/frontend/config/graphvizUMDVitePlugin.ts b/subprojects/frontend/config/graphvizUMDVitePlugin.ts index 7a42560b..9c60a84e 100644 --- a/subprojects/frontend/config/graphvizUMDVitePlugin.ts +++ b/subprojects/frontend/config/graphvizUMDVitePlugin.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import { readFile } from 'node:fs/promises'; import path from 'node:path'; diff --git a/subprojects/frontend/index.html b/subprojects/frontend/index.html index 1bf3472e..f4b46da2 100644 --- a/subprojects/frontend/index.html +++ b/subprojects/frontend/index.html @@ -18,7 +18,7 @@ diff --git a/subprojects/frontend/package.json b/subprojects/frontend/package.json index 97f6baf6..3ebb1542 100644 --- a/subprojects/frontend/package.json +++ b/subprojects/frontend/package.json @@ -37,8 +37,8 @@ "@codemirror/view": "^6.16.0", "@emotion/react": "^11.11.1", "@emotion/styled": "^11.11.0", - "@fontsource-variable/inter": "^5.0.8", "@fontsource-variable/jetbrains-mono": "^5.0.9", + "@fontsource-variable/open-sans": "^5.0.9", "@hpcc-js/wasm": "^2.13.1", "@lezer/common": "^1.0.3", "@lezer/highlight": "^1.1.6", @@ -53,7 +53,6 @@ "d3-selection": "^3.0.0", "d3-zoom": "patch:d3-zoom@npm%3A3.0.0#~/.yarn/patches/d3-zoom-npm-3.0.0-18f706a421.patch", "escape-string-regexp": "^5.0.0", - "json-stringify-pretty-compact": "^4.0.0", "lodash-es": "^4.17.21", "loglevel": "^1.8.1", "loglevel-plugin-prefix": "^0.8.4", diff --git a/subprojects/frontend/src/TopBar.tsx b/subprojects/frontend/src/TopBar.tsx index f2542b14..c722c203 100644 --- a/subprojects/frontend/src/TopBar.tsx +++ b/subprojects/frontend/src/TopBar.tsx @@ -124,7 +124,16 @@ export default observer(function TopBar(): JSX.Element { href="https://www.mcgill.ca/ece/daniel-varro" target="_blank" > - McGill ECE + McGill ECE + +