refactor(deps): integrate force-graph into webpack

This commit is contained in:
Elian Doran 2025-01-17 20:21:31 +02:00
parent 8d026c8134
commit e7eb385b8f
No known key found for this signature in database
4 changed files with 1 additions and 10 deletions

View File

@ -76,7 +76,6 @@ const copy = async () => {
"node_modules/@excalidraw/excalidraw/dist/",
"node_modules/katex/dist/",
"node_modules/dayjs/",
"node_modules/force-graph/dist/",
"node_modules/boxicons/css/",
"node_modules/boxicons/fonts/",
"node_modules/mermaid/dist/",

View File

@ -68,10 +68,6 @@ const WHEEL_ZOOM: Library = {
js: ["node_modules/vanilla-js-wheel-zoom/dist/wheel-zoom.min.js"]
};
const FORCE_GRAPH: Library = {
js: ["node_modules/force-graph/dist/force-graph.min.js"]
};
const MERMAID: Library = {
js: ["node_modules/mermaid/dist/mermaid.min.js"]
};
@ -201,7 +197,6 @@ export default {
CALENDAR_WIDGET,
KATEX,
WHEEL_ZOOM,
FORCE_GRAPH,
MERMAID,
EXCALIDRAW,
MARKJS,

View File

@ -1,4 +1,3 @@
import libraryLoader from "../services/library_loader.js";
import server from "../services/server.js";
import attributeService from "../services/attributes.js";
import hoistedNoteService from "../services/hoisted_note.js";
@ -149,14 +148,13 @@ export default class NoteMapWidget extends NoteContextAwareWidget {
this.mapType = this.note.getLabelValue("mapType") === "tree" ? "tree" : "link";
await libraryLoader.requireLibrary(libraryLoader.FORCE_GRAPH);
//variables for the hover effekt. We have to save the neighbours of a hovered node in a set. Also we need to save the links as well as the hovered node itself
let hoverNode = null;
const highlightLinks = new Set();
const neighbours = new Set();
const ForceGraph = (await import("force-graph")).default;
this.graph = ForceGraph()(this.$container[0])
.width(this.$container.width())
.height(this.$container.height())

View File

@ -63,7 +63,6 @@ async function register(app: express.Application) {
app.use(`/${assetPath}/node_modules/katex/dist/`, persistentCacheStatic(path.join(srcRoot, "..", "node_modules/katex/dist/")));
app.use(`/${assetPath}/node_modules/dayjs/`, persistentCacheStatic(path.join(srcRoot, "..", "node_modules/dayjs/")));
app.use(`/${assetPath}/node_modules/force-graph/dist/`, persistentCacheStatic(path.join(srcRoot, "..", "node_modules/force-graph/dist/")));
app.use(`/${assetPath}/node_modules/boxicons/css/`, persistentCacheStatic(path.join(srcRoot, "..", "node_modules/boxicons/css/")));
app.use(`/${assetPath}/node_modules/boxicons/fonts/`, persistentCacheStatic(path.join(srcRoot, "..", "node_modules/boxicons/fonts/")));