From d1abc2c171b0e33c85f3484577ef73354995a760 Mon Sep 17 00:00:00 2001
From: DecafDev <40307803+decaf-dev@users.noreply.github.com>
Date: Mon, 9 Sep 2024 21:50:33 -0600
Subject: [PATCH 01/21] feat: remove image icon placeholder
---
src/svelte/app/components/grid-card.svelte | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/src/svelte/app/components/grid-card.svelte b/src/svelte/app/components/grid-card.svelte
index 7533f67..fafc4db 100644
--- a/src/svelte/app/components/grid-card.svelte
+++ b/src/svelte/app/components/grid-card.svelte
@@ -229,12 +229,7 @@
{/if}
{/each}
{#if imageUrl === null}
-
From 329e86af30ec5200603a5170579a342f49553add Mon Sep 17 00:00:00 2001
From: DecafDev <40307803+decaf-dev@users.noreply.github.com>
Date: Mon, 9 Sep 2024 21:57:01 -0600
Subject: [PATCH 02/21] feat: remove status bar when view is open
---
src/main.ts | 17 +++++++++++++++++
src/styles.css | 3 +++
2 files changed, 20 insertions(+)
create mode 100644 src/styles.css
diff --git a/src/main.ts b/src/main.ts
index c047ce7..ddc5e5a 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -20,6 +20,7 @@ import { isVersionLessThan } from "./utils";
import License from "./svelte/shared/services/license";
import { clearSocialMediaImageCache } from "./svelte/app/services/social-media-image-cache";
import store from "./svelte/shared/services/store";
+import "./styles.css";
export default class VaultExplorerPlugin extends Plugin {
settings: VaultExplorerPluginSettings = DEFAULT_SETTINGS;
@@ -63,6 +64,22 @@ export default class VaultExplorerPlugin extends Plugin {
}
private registerEvents() {
+ this.registerEvent(
+ this.app.workspace.on("active-leaf-change", () => {
+ const explorerLeaf =
+ this.app.workspace.getActiveViewOfType(VaultExplorerView);
+ const statusBar = document.querySelector(
+ ".status-bar"
+ ) as HTMLElement | null;
+ if (!statusBar) return;
+ if (explorerLeaf) {
+ statusBar.classList.add("vault-explorer-status-bar");
+ } else {
+ statusBar.classList.remove("vault-explorer-status-bar");
+ }
+ })
+ );
+
//Callback if the file is renamed or moved
//This callback is already debounced by Obsidian
this.registerEvent(
diff --git a/src/styles.css b/src/styles.css
new file mode 100644
index 0000000..fc16996
--- /dev/null
+++ b/src/styles.css
@@ -0,0 +1,3 @@
+.vault-explorer-status-bar {
+ display: none;
+}
From 64ca177978a77c2a87e31995128bbb33c5e4a26f Mon Sep 17 00:00:00 2001
From: DecafDev <40307803+decaf-dev@users.noreply.github.com>
Date: Mon, 9 Sep 2024 21:57:38 -0600
Subject: [PATCH 03/21] refactor: rename to image fit to just cover and contain
---
src/svelte/app/services/context-menu.ts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/svelte/app/services/context-menu.ts b/src/svelte/app/services/context-menu.ts
index 7ef61cd..0635563 100644
--- a/src/svelte/app/services/context-menu.ts
+++ b/src/svelte/app/services/context-menu.ts
@@ -48,12 +48,12 @@ export const openContextMenu = (
if (coverImageFit !== undefined && onCoverImageFitChange !== undefined) {
menu.addSeparator();
menu.addItem((item) => {
- item.setTitle("Cover image fit: cover");
+ item.setTitle("Cover");
item.setChecked(coverImageFit === "cover");
item.onClick(() => onCoverImageFitChange(filePath, "cover"));
});
menu.addItem((item) => {
- item.setTitle("Cover image fit: contain");
+ item.setTitle("Contain");
item.setChecked(coverImageFit === "contain");
item.onClick(() => onCoverImageFitChange(filePath, "contain"));
});
From 525fd3e2768844d01c1d19c3aa6476fa8571dc4a Mon Sep 17 00:00:00 2001
From: DecafDev <40307803+decaf-dev@users.noreply.github.com>
Date: Mon, 9 Sep 2024 22:07:40 -0600
Subject: [PATCH 04/21] feat: remove favorites filter
---
src/constants.ts | 4 -
src/obsidian/vault-explorer-settings-tab.ts | 15 -
.../app/components/favorites-filter.svelte | 7 -
src/svelte/app/components/feed-card.svelte | 10 +-
src/svelte/app/components/feed-view.svelte | 1 -
src/svelte/app/components/grid-card.svelte | 18 +-
src/svelte/app/components/grid-view.svelte | 1 -
src/svelte/app/components/list-item.svelte | 6 +-
src/svelte/app/components/list-view.svelte | 1 -
src/svelte/app/components/table-view.svelte | 26 +-
src/svelte/app/index.svelte | 39 +-
src/svelte/app/services/context-menu.ts | 14 -
.../app/services/filters/favorite-filter.ts | 11 -
src/svelte/app/services/render-data.ts | 14 -
src/svelte/app/types.ts | 1 -
src/types/index.guard.ts | 9 +-
src/types/index.ts | 5 -
src/types/types-1.41.1.ts | 332 ++++++++++++++++++
.../plugins/vault-explorer/data.json | 2 +-
19 files changed, 344 insertions(+), 172 deletions(-)
delete mode 100644 src/svelte/app/components/favorites-filter.svelte
delete mode 100644 src/svelte/app/services/filters/favorite-filter.ts
create mode 100644 src/types/types-1.41.1.ts
diff --git a/src/constants.ts b/src/constants.ts
index 218f30a..2968377 100644
--- a/src/constants.ts
+++ b/src/constants.ts
@@ -22,10 +22,6 @@ export const DEFAULT_SETTINGS: VaultExplorerPluginSettings = {
isEnabled: true,
value: "",
},
- favorites: {
- isEnabled: true,
- value: false,
- },
timestamp: {
isEnabled: true,
value: "all",
diff --git a/src/obsidian/vault-explorer-settings-tab.ts b/src/obsidian/vault-explorer-settings-tab.ts
index a2024d3..218a203 100644
--- a/src/obsidian/vault-explorer-settings-tab.ts
+++ b/src/obsidian/vault-explorer-settings-tab.ts
@@ -136,21 +136,6 @@ export default class VaultExplorerSettingsTab extends PluginSettingTab {
})
);
- new Setting(containerEl)
- .setName("Favorites filter")
- .addToggle((toggle) =>
- toggle
- .setValue(this.plugin.settings.filters.favorites.isEnabled)
- .onChange(async (value) => {
- this.plugin.settings.filters.favorites.isEnabled =
- value;
- await this.plugin.saveSettings();
- EventManager.getInstance().emit(
- PluginEvent.FILTER_TOGGLE_SETTING_CHANGE
- );
- })
- );
-
new Setting(containerEl)
.setName("Timestamp filter")
.addToggle((toggle) =>
diff --git a/src/svelte/app/components/favorites-filter.svelte b/src/svelte/app/components/favorites-filter.svelte
deleted file mode 100644
index 48fa017..0000000
--- a/src/svelte/app/components/favorites-filter.svelte
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
diff --git a/src/svelte/app/components/feed-card.svelte b/src/svelte/app/components/feed-card.svelte
index aa56dfd..ccfc82d 100644
--- a/src/svelte/app/components/feed-card.svelte
+++ b/src/svelte/app/components/feed-card.svelte
@@ -35,7 +35,6 @@
export let path: string;
export let createdMillis: number;
export let content: string | null;
- export let isFavorite: boolean | null;
let ref: HTMLElement | null = null;
let enableFileIcons = false;
@@ -146,16 +145,9 @@
openInCurrentTab(plugin, path);
}
- function handleFavoriteChange(filePath: string, value: boolean) {
- dispatch("favoritePropertyChange", { filePath, value });
- }
-
function handleCardContextMenu(e: Event) {
const nativeEvent = e as MouseEvent;
- openContextMenu(plugin, path, nativeEvent, {
- isFavorite,
- onFavoriteChange: handleFavoriteChange,
- });
+ openContextMenu(plugin, path, nativeEvent, {});
}
function handleCardMouseOver(e: MouseEvent) {
diff --git a/src/svelte/app/components/feed-view.svelte b/src/svelte/app/components/feed-view.svelte
index 7c01b14..2bb67af 100644
--- a/src/svelte/app/components/feed-view.svelte
+++ b/src/svelte/app/components/feed-view.svelte
@@ -46,7 +46,6 @@
path={fileRenderData.path}
content={fileRenderData.content}
createdMillis={fileRenderData.createdMillis}
- isFavorite={fileRenderData.isFavorite}
on:favoritePropertyChange
/>
{/each}
diff --git a/src/svelte/app/components/grid-card.svelte b/src/svelte/app/components/grid-card.svelte
index fafc4db..0918e86 100644
--- a/src/svelte/app/components/grid-card.svelte
+++ b/src/svelte/app/components/grid-card.svelte
@@ -35,7 +35,6 @@
export let custom1: string | null;
export let custom2: string | null;
export let custom3: string | null;
- export let isFavorite: boolean | null;
export let coverImageFit: CoverImageFit;
let plugin: VaultExplorerPlugin;
@@ -147,9 +146,7 @@
const showCoverImageOptions = path.endsWith(".md");
openContextMenu(plugin, path, nativeEvent, {
- isFavorite,
coverImageFit: showCoverImageOptions ? coverImageFit : undefined,
- onFavoriteChange: handleFavoriteChange,
onCoverImageFitChange: showCoverImageOptions
? handleCoverImageFitChange
: undefined,
@@ -231,7 +228,7 @@
{#if imageUrl === null}
{/if}
- {#if isFavorite === true}
+
diff --git a/src/svelte/app/components/list-item.svelte b/src/svelte/app/components/list-item.svelte
index a41d9a3..2a8ede5 100644
--- a/src/svelte/app/components/list-item.svelte
+++ b/src/svelte/app/components/list-item.svelte
@@ -18,7 +18,6 @@
export let extension: string;
export let path: string;
export let tags: string[] | null;
- export let isFavorite: boolean | null;
export let showTags: boolean;
export let isSmallScreenSize: boolean;
@@ -82,10 +81,7 @@
function handleItemContextMenu(e: Event) {
const nativeEvent = e as MouseEvent;
- openContextMenu(plugin, path, nativeEvent, {
- isFavorite,
- onFavoriteChange: handleFavoriteChange,
- });
+ openContextMenu(plugin, path, nativeEvent, {});
}
function handleItemMouseOver(e: MouseEvent) {
diff --git a/src/svelte/app/components/list-view.svelte b/src/svelte/app/components/list-view.svelte
index bed9ee5..27a0e4d 100644
--- a/src/svelte/app/components/list-view.svelte
+++ b/src/svelte/app/components/list-view.svelte
@@ -33,7 +33,6 @@
{isSmallScreenSize}
path={fileRenderData.path}
tags={fileRenderData.tags}
- isFavorite={fileRenderData.isFavorite}
on:favoritePropertyChange
/>
{/each}
diff --git a/src/svelte/app/components/table-view.svelte b/src/svelte/app/components/table-view.svelte
index 739063a..ea698cc 100644
--- a/src/svelte/app/components/table-view.svelte
+++ b/src/svelte/app/components/table-view.svelte
@@ -42,11 +42,6 @@
key: "tags",
label: "Tags",
},
- {
- key: "isFavorite",
- label: "Favorite",
- format: (value: unknown) => (value === true ? "Yes" : "No"),
- },
{
key: "createdMillis",
label: "Created",
@@ -85,10 +80,6 @@
};
});
- function handleFavoriteChange(filePath: string, value: boolean) {
- dispatch("favoritePropertyChange", { filePath, value });
- }
-
function handleRowClick(path: string) {
if (plugin === null) return;
@@ -108,18 +99,11 @@
});
}
- function handleRowContextMenu(
- e: Event,
- path: string,
- isFavorite: boolean | null,
- ) {
+ function handleRowContextMenu(e: Event, path: string) {
if (plugin === null) return;
const nativeEvent = e as MouseEvent;
- openContextMenu(plugin, path, nativeEvent, {
- isFavorite,
- onFavoriteChange: handleFavoriteChange,
- });
+ openContextMenu(plugin, path, nativeEvent, {});
}
function getValue(item: FileRenderData, column: TColumn): unknown {
@@ -171,11 +155,7 @@
}}
on:focus={() => {}}
on:contextmenu={(e) =>
- handleRowContextMenu(
- e,
- filteredItem.path,
- filteredItem.isFavorite,
- )}
+ handleRowContextMenu(e, filteredItem.path)}
on:mouseover={(e) =>
handleRowMouseOver(e, filteredItem.path)}
>
diff --git a/src/svelte/app/index.svelte b/src/svelte/app/index.svelte
index 36a8bfe..1f31c75 100644
--- a/src/svelte/app/index.svelte
+++ b/src/svelte/app/index.svelte
@@ -4,13 +4,11 @@
// ============================================
import Stack from "../shared/components/stack.svelte";
import Flex from "../shared/components/flex.svelte";
- import FavoritesFilter from "./components/favorites-filter.svelte";
import TabList from "../shared/components/tab-list.svelte";
import Tab from "../shared/components/tab.svelte";
import { Notice, TFile } from "obsidian";
import {
TCustomFilter,
- TFavoritesFilter,
TSearchFilter,
TSortFilter,
TTimestampFilter,
@@ -21,7 +19,6 @@
import VaultExplorerPlugin from "src/main";
import GridView from "./components/grid-view.svelte";
import ListView from "./components/list-view.svelte";
- import { filterByFavorites } from "./services/filters/favorite-filter";
import { filterBySearch } from "./services/filters/search-filter";
import { filterByTimestamp } from "./services/filters/timestamp-filter";
import { filterByGroups } from "./services/filters/custom/filter-by-groups";
@@ -82,10 +79,6 @@
isEnabled: true,
value: "",
};
- let favoritesFilter: TFavoritesFilter = {
- isEnabled: false,
- value: false,
- };
let timestampFilter: TTimestampFilter = {
isEnabled: true,
value: "all",
@@ -146,7 +139,6 @@
shouldCollapseFilters = settings.shouldCollapseFilters;
pageSize = settings.pageSize;
searchFilter = settings.filters.search;
- favoritesFilter = settings.filters.favorites;
sortFilter = settings.filters.sort;
timestampFilter = settings.filters.timestamp;
currentView = settings.currentView;
@@ -171,7 +163,6 @@
});
searchFilter = plugin.settings.filters.search;
- favoritesFilter = plugin.settings.filters.favorites;
sortFilter = plugin.settings.filters.sort;
timestampFilter = plugin.settings.filters.timestamp;
customFilter = plugin.settings.filters.custom;
@@ -579,10 +570,6 @@
searchFilter.value = e.target.value;
}, DEBOUNCE_INPUT_TIME);
- const debounceFavoriteFilterChange = _.debounce((value) => {
- favoritesFilter.value = value;
- }, DEBOUNCE_INPUT_TIME);
-
function handleReshuffleClick() {
randomFileSortStore.load(plugin.app);
}
@@ -620,7 +607,6 @@
plugin.settings.filters.search = searchFilter;
plugin.settings.filters.sort = sortFilter;
plugin.settings.filters.timestamp = timestampFilter;
- plugin.settings.filters.favorites = favoritesFilter;
plugin.settings.currentView = currentView;
plugin.settings.filters.custom = customFilter;
plugin.settings.viewOrder = viewOrder;
@@ -778,12 +764,6 @@
sortFilter.value = value;
}
- function handleFavoritesChange(e: CustomEvent) {
- const nativeEvent = e.detail.nativeEvent;
- const value = (nativeEvent.target as HTMLInputElement).checked;
- debounceFavoriteFilterChange(value);
- }
-
function handleCoverImageFitChange(e: CustomEvent) {
const { filePath, value } = e.detail as {
filePath: string;
@@ -895,7 +875,6 @@
) {
formatted = filteredCustom.map((loadedFile) => {
const { id, file } = loadedFile;
- const isFavorite = favoritesCache.get(file.path) ?? null;
const content = contentCache.get(file.path) ?? null;
return formatFileDataForRender({
@@ -904,7 +883,6 @@
fileId: id,
file,
fileContent: content,
- fileFavorite: isFavorite,
});
});
}
@@ -917,15 +895,7 @@
return true;
});
- $: filteredFavorites = filteredSearch.filter((file) => {
- const { isEnabled, value } = favoritesFilter;
- if (isEnabled) {
- return filterByFavorites(file, value);
- }
- return true;
- });
-
- $: filteredTimestamp = filteredFavorites.filter((file) => {
+ $: filteredTimestamp = filteredSearch.filter((file) => {
const { modifiedMillis, createdMillis } = file;
return filterByTimestamp({
value: timestampFilter.value,
@@ -967,7 +937,6 @@
$: searchFilter,
sortFilter,
timestampFilter,
- favoritesFilter,
currentView,
customFilter,
viewOrder,
@@ -1003,12 +972,6 @@
- {#if favoritesFilter.isEnabled}
-
- {/if}
{#if timestampFilter.isEnabled}
void;
onCoverImageFitChange?: (
filePath: string,
value: CoverImageFit
@@ -35,16 +31,6 @@ export const openContextMenu = (
item.setTitle("Open in new window");
item.onClick(() => openInNewWindow(plugin, filePath));
});
- menu.addSeparator();
- menu.addItem((item) => {
- item.setTitle(
- isFavorite ? "Remove from favorites" : "Add to favorites"
- );
- item.onClick(() => {
- const newValue = isFavorite !== null ? !isFavorite : true;
- onFavoriteChange(filePath, newValue);
- });
- });
if (coverImageFit !== undefined && onCoverImageFitChange !== undefined) {
menu.addSeparator();
menu.addItem((item) => {
diff --git a/src/svelte/app/services/filters/favorite-filter.ts b/src/svelte/app/services/filters/favorite-filter.ts
deleted file mode 100644
index 4b4673c..0000000
--- a/src/svelte/app/services/filters/favorite-filter.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import { FileRenderData } from "../../types";
-
-export const filterByFavorites = (
- file: FileRenderData,
- onlyFavorites: boolean
-) => {
- if (onlyFavorites) {
- return file.isFavorite;
- }
- return true;
-};
diff --git a/src/svelte/app/services/render-data.ts b/src/svelte/app/services/render-data.ts
index f468d08..5833755 100644
--- a/src/svelte/app/services/render-data.ts
+++ b/src/svelte/app/services/render-data.ts
@@ -46,14 +46,12 @@ export const formatFileDataForRender = ({
file,
fileId,
fileContent,
- fileFavorite,
}: {
app: App;
settings: VaultExplorerPluginSettings;
file: TFile;
fileId: string;
fileContent: string | null;
- fileFavorite: boolean | null;
}): FileRenderData => {
const { name, basename, extension, path } = file;
@@ -96,17 +94,6 @@ export const formatFileDataForRender = ({
PropertyType.TEXT
);
- let isFavorite: boolean | null;
- if (fileFavorite === null) {
- isFavorite = loadPropertyValue(
- fileFrontmatter,
- favoriteProp,
- PropertyType.CHECKBOX
- );
- } else {
- isFavorite = fileFavorite;
- }
-
let coverImageFit: CoverImageFit | null = loadPropertyValue(
fileFrontmatter,
coverImageFitProp,
@@ -250,7 +237,6 @@ export const formatFileDataForRender = ({
content: fileContent,
tags,
imageUrl,
- isFavorite,
createdMillis,
modifiedMillis,
custom1,
diff --git a/src/svelte/app/types.ts b/src/svelte/app/types.ts
index b0b16cb..282a464 100644
--- a/src/svelte/app/types.ts
+++ b/src/svelte/app/types.ts
@@ -12,7 +12,6 @@ export interface FileRenderData {
url: string | null;
imageUrl: string | null;
tags: string[] | null;
- isFavorite: boolean | null;
createdMillis: number;
modifiedMillis: number;
custom1: string | null;
diff --git a/src/types/index.guard.ts b/src/types/index.guard.ts
index bb54582..655b2cc 100644
--- a/src/types/index.guard.ts
+++ b/src/types/index.guard.ts
@@ -30,11 +30,6 @@ export function isVaultExplorerPluginSettings(obj: unknown): obj is VaultExplore
typeof typedObj["filters"]["search"] === "function") &&
typeof typedObj["filters"]["search"]["isEnabled"] === "boolean" &&
typeof typedObj["filters"]["search"]["value"] === "string" &&
- (typedObj["filters"]["favorites"] !== null &&
- typeof typedObj["filters"]["favorites"] === "object" ||
- typeof typedObj["filters"]["favorites"] === "function") &&
- typeof typedObj["filters"]["favorites"]["isEnabled"] === "boolean" &&
- typeof typedObj["filters"]["favorites"]["value"] === "boolean" &&
(typedObj["filters"]["sort"] !== null &&
typeof typedObj["filters"]["sort"] === "object" ||
typeof typedObj["filters"]["sort"] === "function") &&
@@ -608,9 +603,7 @@ export function isVaultExplorerPluginSettings(obj: unknown): obj is VaultExplore
typeof e["isEnabled"] === "boolean"
) &&
(typedObj["views"]["grid"]["coverImageFit"] === "cover" ||
- typedObj["views"]["grid"]["coverImageFit"] === "contain" ||
- typedObj["views"]["grid"]["coverImageFit"] === "scale-down" ||
- typedObj["views"]["grid"]["coverImageFit"] === "none") &&
+ typedObj["views"]["grid"]["coverImageFit"] === "contain") &&
typeof typedObj["views"]["grid"]["loadSocialMediaImage"] === "boolean" &&
(typedObj["views"]["list"] !== null &&
typeof typedObj["views"]["list"] === "object" ||
diff --git a/src/types/index.ts b/src/types/index.ts
index 2e0ca16..c55c033 100644
--- a/src/types/index.ts
+++ b/src/types/index.ts
@@ -13,7 +13,6 @@ export interface VaultExplorerPluginSettings {
};
filters: {
search: TSearchFilter;
- favorites: TFavoritesFilter;
sort: TSortFilter;
timestamp: TTimestampFilter;
custom: TCustomFilter;
@@ -97,10 +96,6 @@ export interface TSearchFilter extends BaseFilter {
value: string;
}
-export interface TFavoritesFilter extends BaseFilter {
- value: boolean;
-}
-
export interface TSortFilter extends BaseFilter {
value: SortFilterOption;
}
diff --git a/src/types/types-1.41.1.ts b/src/types/types-1.41.1.ts
new file mode 100644
index 0000000..83b10ac
--- /dev/null
+++ b/src/types/types-1.41.1.ts
@@ -0,0 +1,332 @@
+export interface VaultExplorerPluginSettings_1_41_1 {
+ properties: {
+ favorite: string;
+ url: string;
+ image: string;
+ coverImageFit: string;
+ createdDate: string;
+ modifiedDate: string;
+ custom1: string;
+ custom2: string;
+ custom3: string;
+ };
+ filters: {
+ search: TSearchFilter;
+ favorites: TFavoritesFilter;
+ sort: TSortFilter;
+ timestamp: TTimestampFilter;
+ custom: TCustomFilter;
+ };
+ views: {
+ dashboard: TDashboardView;
+ grid: TGridView;
+ list: TListView;
+ table: TTableView;
+ feed: TFeedView;
+ recommended: TRecommendedView;
+ related: TRelatedView;
+ };
+ titleWrapping: WordBreak;
+ enableClockUpdates: boolean;
+ enableFileIcons: boolean;
+ loadBodyTags: boolean;
+ currentView: TExplorerView | null;
+ pageSize: number;
+ filterGroupsWidth: string;
+ shouldWrapFilterGroups: boolean;
+ shouldCollapseFilters: boolean;
+ viewOrder: TExplorerView[];
+ configDir: string;
+ pluginVersion: string | null;
+ logLevel: string;
+}
+
+type FileInteractionStyle = "title" | "content";
+
+interface BaseView {
+ isEnabled: boolean;
+}
+
+interface TTableView extends BaseView {}
+
+interface TListView extends BaseView {
+ showTags: boolean;
+}
+
+interface TGridView extends BaseView {
+ coverImageSources: CoverImageSource[];
+ coverImageFit: CoverImageFit;
+ loadSocialMediaImage: boolean;
+}
+
+interface CoverImageSource {
+ type: CoverImageSourceType;
+ isEnabled: boolean;
+}
+
+type CoverImageFit = "cover" | "contain";
+
+type CoverImageSourceType =
+ | "image-property"
+ | "url-property"
+ | "frontmatter"
+ | "body";
+
+interface TDashboardView extends BaseView {}
+
+type CollapseStyle = "no-new-lines" | "no-extra-new-lines";
+
+interface TFeedView extends BaseView {
+ collapseStyle: CollapseStyle;
+ removeH1: boolean;
+ lineClampSmall: number;
+ lineClampMedium: number;
+ lineClampLarge: number;
+}
+
+interface TRecommendedView extends BaseView {}
+
+interface TRelatedView extends BaseView {}
+
+interface BaseFilter {
+ isEnabled: boolean;
+}
+
+interface TSearchFilter extends BaseFilter {
+ value: string;
+}
+
+interface TFavoritesFilter extends BaseFilter {
+ value: boolean;
+}
+
+interface TSortFilter extends BaseFilter {
+ value: SortFilterOption;
+}
+
+interface TTimestampFilter extends BaseFilter {
+ value: TimestampFilterOption;
+}
+
+interface TCustomFilter extends BaseFilter {
+ selectedGroupId: string;
+ groups: TFilterGroup[];
+}
+
+type TimestampFilterOption =
+ | "created-today"
+ | "modified-today"
+ | "created-this-week"
+ | "modified-this-week"
+ | "created-2-weeks"
+ | "modified-2-weeks"
+ | "all";
+
+type SortFilterOption =
+ | "file-name-asc"
+ | "file-name-desc"
+ | "modified-asc"
+ | "modified-desc"
+ | "random";
+
+type WordBreak = "normal" | "break-word";
+
+enum TExplorerView {
+ DASHBOARD = "dashboard",
+ GRID = "grid",
+ LIST = "list",
+ FEED = "feed",
+ TABLE = "table",
+ RECOMMENDED = "recommended",
+ RELATED = "related",
+}
+
+type FilterOperator = "and" | "or";
+
+enum TextFilterCondition {
+ IS = "is",
+ IS_NOT = "is-not",
+ CONTAINS = "contains",
+ DOES_NOT_CONTAIN = "does-not-contain",
+ STARTS_WITH = "starts-with",
+ ENDS_WITH = "ends-with",
+ EXISTS = "exists",
+ DOES_NOT_EXIST = "does-not-exist",
+}
+
+enum ListFilterCondition {
+ CONTAINS = "contains",
+ DOES_NOT_CONTAIN = "does-not-contain",
+ EXISTS = "exists",
+ DOES_NOT_EXIST = "does-not-exist",
+}
+
+enum NumberFilterCondition {
+ IS_EQUAL = "is-equal",
+ IS_NOT_EQUAL = "is-not-equal",
+ IS_GREATER = "is-greater",
+ IS_LESS = "is-less",
+ IS_GREATER_OR_EQUAL = "is-greater-or-equal",
+ IS_LESS_OR_EQUAL = "is-less-or-equal",
+ EXISTS = "exists",
+ DOES_NOT_EXIST = "does-not-exist",
+}
+
+enum CheckboxFilterCondition {
+ IS = "is",
+ IS_NOT = "is-not",
+ EXISTS = "exists",
+ DOES_NOT_EXIST = "does-not-exist",
+}
+
+enum DateFilterCondition {
+ IS = "is",
+ IS_BEFORE = "is-before",
+ IS_AFTER = "is-after",
+ IS_ON_OR_BEFORE = "is-on-or-before",
+ IS_ON_OR_AFTER = "is-on-or-after",
+ EXISTS = "exists",
+ DOES_NOT_EXIST = "does-not-exist",
+}
+
+enum ContentFilterCondition {
+ CONTAINS = "contains",
+ DOES_NOT_CONTAIN = "does-not-contain",
+ IS_EMPTY = "is-empty",
+ IS_NOT_EMPTY = "is-not-empty",
+}
+
+enum FolderFilterCondition {
+ IS = "is",
+ IS_NOT = "is-not",
+}
+
+enum FileNameFilterCondition {
+ IS = "is",
+ IS_NOT = "is-not",
+ CONTAINS = "contains",
+ DOES_NOT_CONTAIN = "does-not-contain",
+ STARTS_WITH = "starts-with",
+ ENDS_WITH = "ends-with",
+}
+
+type FilterCondition =
+ | TextFilterCondition
+ | NumberFilterCondition
+ | DateFilterCondition
+ | CheckboxFilterCondition
+ | ListFilterCondition
+ | ContentFilterCondition
+ | FolderFilterCondition
+ | FileNameFilterCondition;
+
+//This matches the Obsidian property types
+enum PropertyType {
+ TEXT = "text",
+ NUMBER = "number",
+ LIST = "list",
+ CHECKBOX = "checkbox",
+ DATE = "date",
+ DATETIME = "datetime",
+}
+
+enum FilterRuleType {
+ PROPERTY = "property",
+ FOLDER = "folder",
+ FILE_NAME = "file-name",
+ CONTENT = "content",
+}
+
+enum DatePropertyFilterValue {
+ TODAY = "today",
+ TOMORROW = "tomorrow",
+ YESTERDAY = "yesterday",
+ ONE_WEEK_FROM_NOW = "one-week-from-now",
+ ONE_WEEK_AGO = "one-week-ago",
+ ONE_MONTH_FROM_NOW = "one-month-from-now",
+ ONE_MONTH_AGO = "one-month-ago",
+ CUSTOM = "custom",
+}
+
+interface BaseFilterRule {
+ id: string;
+ operator: FilterOperator;
+ type: FilterRuleType;
+ condition: FilterCondition;
+ isEnabled: boolean;
+ value: string;
+ matchWhenPropertyDNE: boolean;
+}
+
+interface TextPropertyFilterRule extends BaseFilterRule {
+ type: FilterRuleType.PROPERTY;
+ propertyType: PropertyType.TEXT;
+ propertyName: string;
+ condition: TextFilterCondition;
+}
+
+interface NumberPropertyFilterRule extends BaseFilterRule {
+ type: FilterRuleType.PROPERTY;
+ propertyType: PropertyType.NUMBER;
+ propertyName: string;
+ condition: NumberFilterCondition;
+}
+
+interface ListPropertyFilterRule extends BaseFilterRule {
+ type: FilterRuleType.PROPERTY;
+ propertyType: PropertyType.LIST;
+ propertyName: string;
+ condition: ListFilterCondition;
+}
+
+interface CheckboxPropertyFilterRule extends BaseFilterRule {
+ type: FilterRuleType.PROPERTY;
+ propertyType: PropertyType.CHECKBOX;
+ propertyName: string;
+ condition: CheckboxFilterCondition;
+}
+
+interface DatePropertyFilterRule extends BaseFilterRule {
+ type: FilterRuleType.PROPERTY;
+ propertyType: PropertyType.DATE | PropertyType.DATETIME;
+ propertyName: string;
+ condition: DateFilterCondition;
+ valueData: string;
+}
+
+interface FolderFilterRule extends BaseFilterRule {
+ type: FilterRuleType.FOLDER;
+ condition: FolderFilterCondition;
+ includeSubfolders: boolean;
+}
+
+interface FileNameFilterRule extends BaseFilterRule {
+ type: FilterRuleType.FILE_NAME;
+ condition: FileNameFilterCondition;
+}
+
+interface ContentFilterRule extends BaseFilterRule {
+ type: FilterRuleType.CONTENT;
+ condition: ContentFilterCondition;
+}
+
+type TFilterRule =
+ | PropertyFilterRule
+ | FolderFilterRule
+ | FileNameFilterRule
+ | ContentFilterRule;
+
+type PropertyFilterRule =
+ | TextPropertyFilterRule
+ | NumberPropertyFilterRule
+ | ListPropertyFilterRule
+ | CheckboxPropertyFilterRule
+ | DatePropertyFilterRule;
+
+interface TFilterGroup {
+ id: string;
+ name: string;
+ rules: TFilterRule[];
+ isEnabled: boolean;
+ isSticky: boolean;
+}
diff --git a/test-vault/.obsidian/plugins/vault-explorer/data.json b/test-vault/.obsidian/plugins/vault-explorer/data.json
index 4be5278..0bc1b96 100644
--- a/test-vault/.obsidian/plugins/vault-explorer/data.json
+++ b/test-vault/.obsidian/plugins/vault-explorer/data.json
@@ -105,6 +105,6 @@
"feed"
],
"configDir": ".vaultexplorer",
- "pluginVersion": "1.41.0",
+ "pluginVersion": "1.41.1",
"logLevel": "trace"
}
\ No newline at end of file
From 63772acbdbdd53bc69bd0e8ae7c495033c515e31 Mon Sep 17 00:00:00 2001
From: DecafDev <40307803+decaf-dev@users.noreply.github.com>
Date: Mon, 9 Sep 2024 22:26:39 -0600
Subject: [PATCH 05/21] feat: set pagination indicator as status bar
---
.../components/pagination-indicator.svelte | 93 ++++++++++-------
src/svelte/app/index.svelte | 99 ++++++++-----------
2 files changed, 97 insertions(+), 95 deletions(-)
diff --git a/src/svelte/app/components/pagination-indicator.svelte b/src/svelte/app/components/pagination-indicator.svelte
index 04a007b..99cd7b2 100644
--- a/src/svelte/app/components/pagination-indicator.svelte
+++ b/src/svelte/app/components/pagination-indicator.svelte
@@ -53,50 +53,67 @@
diff --git a/src/svelte/app/index.svelte b/src/svelte/app/index.svelte
index 1f31c75..a064109 100644
--- a/src/svelte/app/index.svelte
+++ b/src/svelte/app/index.svelte
@@ -658,10 +658,6 @@
customFilter.groups = newGroups;
}
- function handleListViewTagsToggle() {
- showListViewTags = !showListViewTags;
- }
-
function handleViewDragOver(e: CustomEvent) {
const { nativeEvent } = e.detail;
nativeEvent.preventDefault();
@@ -962,44 +958,7 @@
{#if shouldCollapseFilters === false}
- {#if searchFilter.isEnabled}
- (searchFilter.value = "")}
- />
- {/if}
-
-
-
- {#if timestampFilter.isEnabled}
-
- {/if}
- {#if sortFilter.isEnabled}
-
- {/if}
- {#if sortFilter.value == "random"}
-
- {/if}
-
-
-
-
{#if customFilter.isEnabled}
{/if}
+
+
+
+
@@ -1044,25 +1011,35 @@
/> -->
-
- {#if currentView === "list"}
-
+ {#if timestampFilter.isEnabled}
+
-
{/if}
-
-
+ {#if sortFilter.isEnabled}
+
+ {/if}
+ {#if sortFilter.value == "random"}
+
+ {/if}
+
+ {#if searchFilter.isEnabled}
+ (searchFilter.value = "")}
+ />
+ {/if}
{#if currentView === "grid"}
{/if}
+
diff --git a/src/svelte/app/index.svelte b/src/svelte/app/index.svelte
index 53356f9..2f6d566 100644
--- a/src/svelte/app/index.svelte
+++ b/src/svelte/app/index.svelte
@@ -929,29 +929,25 @@
{#if shouldCollapseFilters === false}
-
-
-
- {#if customFilter.isEnabled}
-
- {/if}
-
-
-
+
+ {#if customFilter.isEnabled}
+
-
-
-
+ {/if}
+
+
+
+
@@ -1058,4 +1054,14 @@
.vault-explorer-view-select {
flex: 1;
}
+
+ .vault-explorer-button {
+ background: none;
+ text-decoration: underline;
+ color: var(--text-faint);
+ font-size: var(--font-small);
+ border: none;
+ box-shadow: none;
+ padding: 0;
+ }
From dd50decea65e4b17cebd2e3d825731d982cb2732 Mon Sep 17 00:00:00 2001
From: DecafDev <40307803+decaf-dev@users.noreply.github.com>
Date: Mon, 9 Sep 2024 23:29:23 -0600
Subject: [PATCH 11/21] chore: bump version
---
manifest.json | 2 +-
package.json | 2 +-
versions.json | 3 ++-
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/manifest.json b/manifest.json
index 673281e..9c76180 100644
--- a/manifest.json
+++ b/manifest.json
@@ -1,7 +1,7 @@
{
"id": "vault-explorer",
"name": "Vault Explorer",
- "version": "1.41.1",
+ "version": "1.42.0",
"minAppVersion": "1.4.13",
"description": "Explore your vault in visual format",
"author": "DecafDev",
diff --git a/package.json b/package.json
index e730b76..cd5a4f1 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "obsidian-vault-explorer",
- "version": "1.41.1",
+ "version": "1.42.0",
"description": "Explore your vault in visual format",
"main": "main.js",
"scripts": {
diff --git a/versions.json b/versions.json
index 4566abc..e7d5c8e 100644
--- a/versions.json
+++ b/versions.json
@@ -136,5 +136,6 @@
"1.40.1": "1.4.13",
"1.40.2": "1.4.13",
"1.41.0": "1.4.13",
- "1.41.1": "1.4.13"
+ "1.41.1": "1.4.13",
+ "1.42.0": "1.4.13"
}
From 9f0d71431f7e44d4fc0c7214ec06df121a1a94a6 Mon Sep 17 00:00:00 2001
From: DecafDev <40307803+decaf-dev@users.noreply.github.com>
Date: Mon, 9 Sep 2024 23:32:40 -0600
Subject: [PATCH 12/21] fix: remove extra padding on buttons
---
src/svelte/shared/components/icon-button.svelte | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/svelte/shared/components/icon-button.svelte b/src/svelte/shared/components/icon-button.svelte
index ab7cabc..28595a9 100644
--- a/src/svelte/shared/components/icon-button.svelte
+++ b/src/svelte/shared/components/icon-button.svelte
@@ -26,6 +26,7 @@
}
$: className = getClassName(noPadding);
+ $: hasSlotContent = !!$$slots.default;
+
+ {#if hasSlotContent}
+
+
+
+ {/if}
+