diff --git a/manifest.json b/manifest.json index c3ea5f4..8ebac22 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "excalibrain", "name": "ExcaliBrain", - "version": "0.2.14", + "version": "0.2.15", "minAppVersion": "1.1.6", "description": "A clean, intuitive and editable graph view for Obsidian", "author": "Zsolt Viczian", diff --git a/package.json b/package.json index fa2bca0..bd6c243 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "author": "", "license": "MIT", "dependencies": { - "obsidian-dataview": "^0.5.56", + "obsidian-dataview": "^0.5.65", "@popperjs/core": "^2.11.6" }, "devDependencies": { diff --git a/src/Components/PowerFilter.ts b/src/Components/PowerFilter.ts new file mode 100644 index 0000000..1690139 --- /dev/null +++ b/src/Components/PowerFilter.ts @@ -0,0 +1,16 @@ +import ExcaliBrain from "src/excalibrain-main"; +import { Neighbour } from "src/types"; + +export class PowerFilter { + + constructor( + private plugin: ExcaliBrain, + ) { + this.plugin = plugin; + } + + isNeighbourHidden(neighbor: Neighbour):boolean { + if(!this.plugin.settings.applyPowerFilter) return false; + return false; + } +} \ No newline at end of file diff --git a/src/Components/ToolsPanel.ts b/src/Components/ToolsPanel.ts index f82463d..fd20336 100644 --- a/src/Components/ToolsPanel.ts +++ b/src/Components/ToolsPanel.ts @@ -425,6 +425,27 @@ export class ToolsPanel { }) ); + // ------------ + // Power Filter + // ------------ + /*this.buttons.push( + new ToggleButton({ + plugin: this.plugin, + getVal: () => this.plugin.settings.applyPowerFilter, + setVal: (val: boolean) => { + this.plugin.settings.applyPowerFilter = val; + return true; + }, + wrapper: buttonsWrapperDiv, + options: { + display: "V", + icon: getIcon("lucide-filter").outerHTML, + tooltip: t("SHOW_HIDE_POWERFILTER"), + }, + updateIndex: false, + }) + );*/ + // ------------ // Central node as interactive frame // ------------ diff --git a/src/Scene.ts b/src/Scene.ts index 0f64675..3f41670 100644 --- a/src/Scene.ts +++ b/src/Scene.ts @@ -410,6 +410,7 @@ export class Scene { .filter(x => (x.page.path !== centralPage.path) && !settings.excludeFilepaths.some(p => x.page.path.startsWith(p)) && + //tha node either has no primary tag or the tag is not filtered out (!x.page.primaryStyleTag || !this.toolsPanel.linkTagFilter.selectedTags.has(x.page.primaryStyleTag))) .slice(0,settings.maxItemCount); const parentPaths = parents.map(x=>x.page.path); diff --git a/src/Settings.ts b/src/Settings.ts index 5facd16..0a94b06 100644 --- a/src/Settings.ts +++ b/src/Settings.ts @@ -47,6 +47,7 @@ export interface ExcaliBrainSettings { showFullTagName: boolean; maxItemCount: number; renderSiblings: boolean; + applyPowerFilter: boolean; baseNodeStyle: NodeStyle; centralNodeStyle: NodeStyle; inferredNodeStyle: NodeStyle; @@ -112,7 +113,8 @@ export const DEFAULT_SETTINGS: ExcaliBrainSettings = { showNeighborCount: true, showFullTagName: false, maxItemCount: 30, - renderSiblings: true, + renderSiblings: false, + applyPowerFilter: false, baseNodeStyle: DEFAULT_NODE_STYLE, centralNodeStyle: { fontSize: 30, diff --git a/src/excalibrain-main.ts b/src/excalibrain-main.ts index 4adb773..5b8ba89 100644 --- a/src/excalibrain-main.ts +++ b/src/excalibrain-main.ts @@ -5,7 +5,6 @@ import { errorlog, keepOnTop } from './utils/utils'; import { getAPI } from "obsidian-dataview" import { t } from './lang/helpers'; import { DEFAULT_HIERARCHY_DEFINITION, DEFAULT_LINK_STYLE, DEFAULT_NODE_STYLE, MINEXCALIDRAWVERSION, PLUGIN_NAME, PREDEFINED_LINK_STYLES } from './constants/constants'; -import { DvAPIInterface } from 'obsidian-dataview/lib/typings/api'; import { Pages } from './graph/Pages'; import { getEA } from "obsidian-excalidraw-plugin"; import { ExcalidrawAutomate, search } from 'obsidian-excalidraw-plugin/lib/ExcalidrawAutomate'; @@ -55,7 +54,7 @@ export default class ExcaliBrain extends Plugin { } = {hidden: [], parents: [], children: [], leftFriends: [], rightFriends: [], previous: [], next: []}; public hierarchyLinkStylesExtended: {[key: string]: LinkStyle}; //including datafields lowercase and "-" instead of " " public pages: Pages; - public DVAPI: DvAPIInterface; + public DVAPI: any; public EA: ExcalidrawAutomate; public scene: Scene = null; private disregardLeafChangeTimer: NodeJS.Timeout; @@ -103,7 +102,7 @@ export default class ExcaliBrain extends Plugin { }); return; } - if(!this.DVAPI.version.compare('>=', '0.5.31')) { + /*if(!this.DVAPI.version.compare('>=', '0.5.31')) { (new WarningPrompt( this.app, "⚠ ExcaliBrain Disabled: Dataview upgrade requried", @@ -114,7 +113,7 @@ export default class ExcaliBrain extends Plugin { this.app.plugins.disablePlugin(PLUGIN_NAME) }); return; - } + }*/ this.EA = getEA(); if(!this.EA) { diff --git a/src/graph/Page.ts b/src/graph/Page.ts index 0b7904a..5ba2a71 100644 --- a/src/graph/Page.ts +++ b/src/graph/Page.ts @@ -92,7 +92,7 @@ export class Page { if(!invMap) { return; } - invMap.forEach(path=>{ + invMap.forEach((path: any)=>{ const child = this.pages.get(path); if(!child) { return; diff --git a/src/lang/locale/en.ts b/src/lang/locale/en.ts index 29a8f17..ffc229f 100644 --- a/src/lang/locale/en.ts +++ b/src/lang/locale/en.ts @@ -210,6 +210,7 @@ export default { SHOW_HIDE_INFERRED: "Show/Hide inferred relationships", SHOW_HIDE_ALIAS: "Show/Hide document alias", SHOW_HIDE_SIBLINGS: "Show/Hide siblings", + SHOW_HIDE_POWERFILTER: "Enable/Disable Power Filter", SHOW_HIDE_EMBEDDEDCENTRAL: "Display central node as embedded frame", SHOW_HIDE_URLS: "Show/Hide URLs in central notes as graph nodes", SHOW_HIDE_FOLDER: "Show/Hide folder nodes",