From 51372534b7d51b491053f968a561c5762598d8ec Mon Sep 17 00:00:00 2001 From: Ross Keenan Date: Sat, 15 Jan 2022 14:55:22 +0200 Subject: [PATCH] refactor: Move Views under correct folder --- main.js | 106 ++++++++++++++++++--------------- src/BreadcrumbsSettingTab.ts | 2 +- src/Components/Ducks.svelte | 2 +- src/Components/Lists.svelte | 2 +- src/Components/Matrix.svelte | 2 +- src/Components/SideTree.svelte | 2 +- src/{ => Views}/DucksView.ts | 6 +- src/{ => Views}/MatrixView.ts | 16 ++--- src/{ => Views}/StatsView.ts | 6 +- src/{ => Views}/TreeView.ts | 6 +- src/constants.ts | 8 +++ src/interfaces.ts | 9 +-- src/main.ts | 12 ++-- 13 files changed, 98 insertions(+), 81 deletions(-) rename src/{ => Views}/DucksView.ts (86%) rename src/{ => Views}/MatrixView.ts (96%) rename src/{ => Views}/StatsView.ts (88%) rename src/{ => Views}/TreeView.ts (87%) diff --git a/main.js b/main.js index 22c063f4..c2a9efe3 100644 --- a/main.js +++ b/main.js @@ -3629,6 +3629,14 @@ const DEFAULT_SETTINGS = { visClosed: "Real", visAll: "All", wikilinkIndex: true, + impliedRelations: { + siblingIdentity: false, + sameParentIsSibling: false, + siblingsSiblingIsSibling: false, + parentsSiblingsIsParents: false, + parentsParentsIsParent: false, + cousinsIsSibling: false, + }, }; var graphology_umd_min = createCommonjsModule(function (module, exports) { @@ -29888,6 +29896,54 @@ async function writeBCsToAllFiles(plugin) { } } +class FieldSuggestor extends obsidian.EditorSuggest { + constructor(plugin) { + super(plugin.app); + this.getSuggestions = (context) => { + const { query } = context; + return BC_FIELDS_INFO.map((sug) => sug.field).filter((sug) => sug.includes(query)); + }; + this.plugin = plugin; + } + onTrigger(cursor, editor, _) { + var _a; + if (this.plugin.settings.fieldSuggestor) { + const sub = editor.getLine(cursor.line).substring(0, cursor.ch); + const match = (_a = sub.match(/^BC-(.*)$/)) === null || _a === void 0 ? void 0 : _a[1]; + if (match !== undefined) { + return { + end: cursor, + start: { + ch: sub.lastIndexOf(match), + line: cursor.line, + }, + query: match, + }; + } + } + return null; + } + renderSuggestion(suggestion, el) { + var _a; + el.createDiv({ + text: suggestion.replace("BC-", ""), + cls: "BC-suggester-container", + attr: { + "aria-label": (_a = BC_FIELDS_INFO.find((f) => f.field === suggestion)) === null || _a === void 0 ? void 0 : _a.desc, + "aria-label-position": "right", + }, + }); + } + selectSuggestion(suggestion) { + var _a; + const { context } = this; + if (context) { + const replacement = `${suggestion}${(_a = BC_FIELDS_INFO.find((f) => f.field === suggestion)) === null || _a === void 0 ? void 0 : _a.after}`; + context.editor.replaceRange(replacement, { ch: 0, line: context.start.line }, context.end); + } + } +} + /* node_modules\svelte-icons\fa\FaInfo.svelte generated by Svelte v3.35.0 */ function create_default_slot$2(ctx) { @@ -30276,54 +30332,6 @@ class DucksView extends obsidian.ItemView { } } -class FieldSuggestor extends obsidian.EditorSuggest { - constructor(plugin) { - super(plugin.app); - this.getSuggestions = (context) => { - const { query } = context; - return BC_FIELDS_INFO.map((sug) => sug.field).filter((sug) => sug.includes(query)); - }; - this.plugin = plugin; - } - onTrigger(cursor, editor, _) { - var _a; - if (this.plugin.settings.fieldSuggestor) { - const sub = editor.getLine(cursor.line).substring(0, cursor.ch); - const match = (_a = sub.match(/^BC-(.*)$/)) === null || _a === void 0 ? void 0 : _a[1]; - if (match !== undefined) { - return { - end: cursor, - start: { - ch: sub.lastIndexOf(match), - line: cursor.line, - }, - query: match, - }; - } - } - return null; - } - renderSuggestion(suggestion, el) { - var _a; - el.createDiv({ - text: suggestion.replace("BC-", ""), - cls: "BC-suggester-container", - attr: { - "aria-label": (_a = BC_FIELDS_INFO.find((f) => f.field === suggestion)) === null || _a === void 0 ? void 0 : _a.desc, - "aria-label-position": "right", - }, - }); - } - selectSuggestion(suggestion) { - var _a; - const { context } = this; - if (context) { - const replacement = `${suggestion}${(_a = BC_FIELDS_INFO.find((f) => f.field === suggestion)) === null || _a === void 0 ? void 0 : _a.after}`; - context.editor.replaceRange(replacement, { ch: 0, line: context.start.line }, context.end); - } - } -} - /* src\Components\Stats.svelte generated by Svelte v3.35.0 */ function add_css$1() { @@ -54243,11 +54251,11 @@ class BCPlugin extends obsidian.Plugin { await this.loadSettings(); const { settings } = this; this.addSettingTab(new BCSettingTab(this.app, this)); + // Prevent breaking change if (typeof settings.debugMode === "boolean") { settings.debugMode = settings.debugMode ? "DEBUG" : "WARN"; await this.saveSettings(); } - // Prevent breaking change //@ts-ignore const { userHierarchies } = settings; if (userHierarchies !== undefined && userHierarchies.length > 0) { diff --git a/src/BreadcrumbsSettingTab.ts b/src/BreadcrumbsSettingTab.ts index 7c56d31d..db0746b3 100644 --- a/src/BreadcrumbsSettingTab.ts +++ b/src/BreadcrumbsSettingTab.ts @@ -23,7 +23,7 @@ import { } from "./constants"; import type { DebugLevel, Relations, visTypes } from "./interfaces"; import type BCPlugin from "./main"; -import MatrixView from "./MatrixView"; +import MatrixView from "./Views/MatrixView"; import { getFields, splitAndTrim, strToRegex } from "./sharedFunctions"; import { drawTrail } from "./Views/TrailView"; diff --git a/src/Components/Ducks.svelte b/src/Components/Ducks.svelte index 7a48b03c..c9e75bcf 100644 --- a/src/Components/Ducks.svelte +++ b/src/Components/Ducks.svelte @@ -1,7 +1,7 @@