diff --git a/main.ts b/main.ts index 8cc379c..020b82f 100644 --- a/main.ts +++ b/main.ts @@ -1,5 +1,6 @@ import { Plugin, ItemView, WorkspaceLeaf, debounce, Notice } from 'obsidian'; import * as d3 from "d3"; +import _ from 'lodash'; const DEFAULT_NETWORK_SETTINGS : any = { relevanceScoreThreshold: 0.5, @@ -1322,7 +1323,7 @@ class ScGraphItemView extends ItemView { watchForNoteChanges() { this.app.workspace.on('file-open', (file) => { - if (file && (this.currentNoteKey !== file.path) && !this.isHovering) { + if (file && (this.currentNoteKey !== file.path) && !this.isHovering && this.containerEl.children[1].checkVisibility()) { this.currentNoteKey = file.path; this.currentNoteChanging = true; this.render(); @@ -1458,6 +1459,10 @@ class ScGraphItemView extends ItemView { this.maxScore = 0; if (!this.currentNoteKey) return; this.centralNote = this.smartNotes[this.currentNoteKey]; + console.log('central note: ', this.centralNote); + + // console.log('central note connections: ', parse(stringify(this.centralNote.find_connections()))); + const noteConnections = this.centralNote.find_connections().filter( (connection: any) => connection.score >= this.relevanceScoreThreshold); this.addCentralNode(); diff --git a/package-lock.json b/package-lock.json index c76c3c3..53079b7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,19 +1,22 @@ { "name": "smart-connections-visualizer", - "version": "1.0.2", + "version": "1.0.12", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "smart-connections-visualizer", - "version": "1.0.2", + "version": "1.0.12", "license": "MIT", "dependencies": { "bootstrap": "^5.3.3", - "d3": "^7.9.0" + "d3": "^7.9.0", + "flatted": "^3.3.1", + "lodash": "^4.17.21" }, "devDependencies": { "@types/d3": "^7.4.3", + "@types/lodash": "^4.17.7", "@types/node": "^16.11.6", "@typescript-eslint/eslint-plugin": "5.29.0", "@typescript-eslint/parser": "5.29.0", @@ -817,6 +820,12 @@ "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", "dev": true }, + "node_modules/@types/lodash": { + "version": "4.17.7", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.7.tgz", + "integrity": "sha512-8wTvZawATi/lsmNu10/j2hk1KEP0IvjubqPE3cu1Xz7xfXXt5oCq3SNUz4fMIP4XGF9Ky+Ue2tBA3hcS7LSBlA==", + "dev": true + }, "node_modules/@types/node": { "version": "16.18.97", "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.97.tgz", @@ -2065,9 +2074,7 @@ "node_modules/flatted": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.1.tgz", - "integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==", - "dev": true, - "peer": true + "integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==" }, "node_modules/fs.realpath": { "version": "1.0.0", @@ -2363,6 +2370,11 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, "node_modules/lodash.merge": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", diff --git a/package.json b/package.json index 497333b..04236d7 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "license": "MIT", "devDependencies": { "@types/d3": "^7.4.3", + "@types/lodash": "^4.17.7", "@types/node": "^16.11.6", "@typescript-eslint/eslint-plugin": "5.29.0", "@typescript-eslint/parser": "5.29.0", @@ -32,6 +33,8 @@ }, "dependencies": { "bootstrap": "^5.3.3", - "d3": "^7.9.0" + "d3": "^7.9.0", + "flatted": "^3.3.1", + "lodash": "^4.17.21" } } diff --git a/tsconfig.json b/tsconfig.json index 2d6fbdf..61f6621 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,6 +10,8 @@ "moduleResolution": "node", "importHelpers": true, "isolatedModules": true, + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, // This is often recommended alongside "strictNullChecks": true, "lib": [ "DOM",