feat: remove file interaction style

This commit is contained in:
DecafDev 2024-07-26 17:04:05 -06:00
parent 01ab79a208
commit d21358784a
21 changed files with 547 additions and 523 deletions

View file

@ -1,7 +1,7 @@
{
"id": "vault-explorer",
"name": "Vault Explorer",
"version": "1.32.2",
"version": "1.33.0",
"minAppVersion": "1.4.13",
"description": "Explore your vault in visual format",
"author": "DecafDev",

View file

@ -1,6 +1,6 @@
{
"name": "obsidian-vault-explorer",
"version": "1.32.2",
"version": "1.33.0",
"description": "Explore your vault in visual format",
"main": "main.js",
"scripts": {

View file

@ -75,7 +75,6 @@ export const DEFAULT_SETTINGS: VaultExplorerPluginSettings = {
enableClockUpdates: true,
enableFileIcons: false,
enableScrollButtons: true,
fileInteractionStyle: "content",
filterGroupsWidth: "300px",
shouldWrapFilterGroups: false,
pageSize: 25,

View file

@ -10,7 +10,6 @@ export enum PluginEvent {
FOLDER_CREATE = "folder-create",
PAGE_SIZE_SETTING_CHANGE = "page-size-setting-change",
TITLE_WRAPPING_SETTING_CHANGE = "title-wrapping-setting-change",
FILE_INTERACTION_STYLE = "file-interaction-style-setting-change",
FEED_CONTENT_SETTING_CHANGE = "feed-content-setting-change",
COVER_IMAGE_SOURCE_SETTING_CHANGE = "cover-image-source-setting-change",
PROPERTY_SETTING_CHANGE = "property-setting-change",

View file

@ -25,6 +25,7 @@ import Migrate_1_27_0 from "./migrate_1_27_0";
import Migrate_1_29_0 from "./migrate_1_29_0";
import Migrate_1_30_0 from "./migrate_1_30_5";
import Migrate_1_31_0 from "./migrate_1_31_0";
import Migrate_1_33_0 from "./migrate_1_33_0";
const migrations: TMigration[] = [
{
@ -147,6 +148,11 @@ const migrations: TMigration[] = [
to: "1.31.0",
migrate: Migrate_1_31_0,
},
{
from: "1.32.2",
to: "1.33.0",
migrate: Migrate_1_33_0,
},
];
export const preformMigrations = (

View file

@ -0,0 +1,15 @@
import { VaultExplorerPluginSettings } from "src/types";
import MigrationInterface from "./migration_interface";
import { VaultExplorerPluginSettings_1_32_2 } from "src/types/types-1.32.2";
export default class Migrate_1_33_0 implements MigrationInterface {
migrate(data: Record<string, unknown>) {
const typedData = data as unknown as VaultExplorerPluginSettings_1_32_2;
const newData: VaultExplorerPluginSettings = {
...typedData,
};
delete (newData as any).fileInteractionStyle;
return newData as unknown as Record<string, unknown>;
}
}

View file

@ -53,26 +53,6 @@ export default class VaultExplorerSettingsTab extends PluginSettingTab {
new Setting(containerEl).setName("General").setHeading();
new Setting(containerEl)
.setName("File interaction")
.setDesc("Set how a file should be interacted with.")
.addDropdown((cb) => {
cb.addOptions({
content: "Click on content",
title: "Click on title",
});
cb.setValue(this.plugin.settings.fileInteractionStyle).onChange(
async (value) => {
this.plugin.settings.fileInteractionStyle =
value as FileInteractionStyle;
await this.plugin.saveSettings();
EventManager.getInstance().emit(
PluginEvent.FILE_INTERACTION_STYLE
);
}
);
});
// new Setting(containerEl)
// .setName("Title wrapping")
// .setDesc("Set the wrapping style for the title.")

View file

@ -1,61 +0,0 @@
<script lang="ts">
import { FileInteractionStyle } from "src/types";
import { createEventDispatcher } from "svelte";
export let fileInteractionStyle: FileInteractionStyle;
const dispatch = createEventDispatcher();
export let ref: HTMLElement | null = null;
function handleClick() {
dispatch("click");
}
function handleContextMenu(e: MouseEvent) {
dispatch("contextmenu", { nativeEvent: e });
}
</script>
{#if fileInteractionStyle === "content"}
<div
bind:this={ref}
tabindex="0"
role="button"
class="vault-explorer-feed-card vault-explorer-feed-card--interactive"
on:click={handleClick}
on:keydown={(e) => {
if (e.key === "Enter" || e.key === " ") {
handleClick();
}
}}
on:contextmenu={(e) => {
e.preventDefault();
handleContextMenu(e);
}}
on:focus={() => {}}
on:mouseover
>
<slot />
</div>
{/if}
{#if fileInteractionStyle === "title"}
<div bind:this={ref} class="vault-explorer-feed-card">
<slot />
</div>
{/if}
<style>
.vault-explorer-feed-card {
padding: 8px;
border-bottom: 1px solid var(--background-modifier-border);
}
.vault-explorer-feed-card--interactive:hover {
background-color: var(--background-modifier-hover);
}
.vault-explorer-feed-card--interactive:focus-visible {
box-shadow: 0 0 0 3px var(--background-modifier-border-focus);
}
</style>

View file

@ -21,7 +21,7 @@
<div
tabindex="0"
role="link"
class={className}
class="vault-explorer-feed-card__title"
on:focus={() => {}}
on:click={(e) => {
e.preventDefault();

View file

@ -1,6 +1,6 @@
<script lang="ts">
import { createEventDispatcher, onMount } from "svelte";
import { CollapseStyle, FileInteractionStyle, WordBreak } from "src/types";
import { CollapseStyle, WordBreak } from "src/types";
import EventManager from "src/event/event-manager";
import VaultExplorerPlugin from "src/main";
import store from "src/svelte/shared/services/store";
@ -26,9 +26,7 @@
import { PluginEvent } from "src/event/types";
import Wrap from "src/svelte/shared/components/wrap.svelte";
import { openInCurrentTab } from "../services/open-file";
import FeedCardContainer from "./feed-card-container.svelte";
import { openContextMenu } from "../services/context-menu";
import FeedCardTitle from "./feed-card-title.svelte";
import { HOVER_LINK_SOURCE_ID } from "src/constants";
import { SCREEN_SIZE_LG, SCREEN_SIZE_MD } from "../constants";
@ -50,7 +48,6 @@
let lineClampLarge: number = 5;
let collapseStyle: CollapseStyle = "no-new-lines";
let currentLineClamp: number = lineClampLarge;
let fileInteractionStyle: FileInteractionStyle = "content";
const dispatch = createEventDispatcher();
@ -64,7 +61,6 @@
lineClampLarge = plugin.settings.views.feed.lineClampLarge;
lineClampMedium = plugin.settings.views.feed.lineClampMedium;
lineClampSmall = plugin.settings.views.feed.lineClampSmall;
fileInteractionStyle = plugin.settings.fileInteractionStyle;
});
onMount(() => {
@ -84,23 +80,6 @@
};
});
onMount(() => {
function handleFileInteractionStyleChange() {
fileInteractionStyle = plugin.settings.fileInteractionStyle;
}
EventManager.getInstance().on(
PluginEvent.FILE_INTERACTION_STYLE,
handleFileInteractionStyleChange,
);
return () => {
EventManager.getInstance().off(
PluginEvent.FILE_INTERACTION_STYLE,
handleFileInteractionStyleChange,
);
};
});
onMount(() => {
function handleTitleWrappingSettingChange() {
wordBreak = plugin.settings.titleWrapping;
@ -192,15 +171,15 @@
dispatch("favoritePropertyChange", { filePath, value });
}
function handleCardContextMenu(e: CustomEvent) {
const { nativeEvent } = e.detail;
function handleCardContextMenu(e: Event) {
const nativeEvent = e as MouseEvent;
openContextMenu(plugin, path, nativeEvent, {
isFavorite,
onFavoriteChange: handleFavoriteChange,
});
}
function handleTitleContextMenu(e: CustomEvent) {
function handleTitleContextMenu(e: Event) {
handleCardContextMenu(e);
}
@ -256,18 +235,44 @@
$: displayContent = getDisplayContent(content, removeH1, collapseStyle);
</script>
<FeedCardContainer
{fileInteractionStyle}
bind:ref
<div
bind:this={ref}
tabindex="0"
role="button"
class="vault-explorer-feed-card"
on:click={handleCardClick}
on:contextmenu={handleCardContextMenu}
on:mouseover={handleCardMouseOver}
on:keydown={(e) => {
if (e.key === "Enter" || e.key === " ") {
handleCardClick();
}
}}
on:contextmenu={(e) => {
e.preventDefault();
handleCardContextMenu(e);
}}
on:focus={() => {}}
on:mouseover
>
<Stack spacing="sm" direction="column">
<FeedCardTitle
{fileInteractionStyle}
on:click={handleTitleClick}
on:contextmenu={handleTitleContextMenu}
<div
tabindex="0"
role="link"
class="vault-explorer-feed-card__title"
on:focus={() => {}}
on:click={(e) => {
e.preventDefault();
handleTitleClick();
}}
on:contextmenu={(e) => {
e.preventDefault();
handleTitleContextMenu(e);
}}
on:keydown={(e) => {
if (e.key === "Enter" || e.key === " ") {
e.preventDefault();
handleTitleClick();
}
}}
on:mouseover={handleTitleMouseOver}
>
<Stack spacing="xs">
@ -278,7 +283,7 @@
{displayName}
</div>
</Stack>
</FeedCardTitle>
</div>
{#if displayContent != null && displayContent.length > 0}
<div
class="vault-explorer-feed-card__content"
@ -300,9 +305,32 @@
{creationString}
</div>
</Stack>
</FeedCardContainer>
</div>
<style>
.vault-explorer-feed-card {
padding: 8px;
border-bottom: 1px solid var(--background-modifier-border);
}
.vault-explorer-feed-card:hover {
background-color: var(--background-modifier-hover);
}
.vault-explorer-feed-card:focus-visible {
box-shadow: 0 0 0 3px var(--background-modifier-border-focus);
}
.vault-explorer-feed-card__title {
width: 100%;
cursor: pointer;
color: var(--text-accent);
}
.vault-explorer-feed-card__title:focus-visible {
box-shadow: 0 0 0 3px var(--background-modifier-border-focus);
}
.vault-explorer-feed-card__content {
/* these settings support unicode characters as well */
display: -webkit-box;

View file

@ -1,62 +0,0 @@
<script lang="ts">
import { FileInteractionStyle } from "src/types";
import { createEventDispatcher } from "svelte";
export let fileInteractionStyle: FileInteractionStyle;
const dispatch = createEventDispatcher();
function handleClick() {
dispatch("click");
}
function handleContextMenu(e: MouseEvent) {
dispatch("contextmenu", { nativeEvent: e });
}
</script>
{#if fileInteractionStyle === "content"}
<div
tabindex="0"
role="button"
class="vault-explorer-grid-card vault-explorer-grid-card--interactive"
on:click={handleClick}
on:keydown={(e) => {
if (e.key === "Enter" || e.key === " ") {
handleClick();
}
}}
on:contextmenu={(e) => {
e.preventDefault();
handleContextMenu(e);
}}
on:focus={() => {}}
on:mouseover
>
<slot />
</div>
{/if}
{#if fileInteractionStyle === "title"}
<div class="vault-explorer-grid-card">
<slot />
</div>
{/if}
<style>
.vault-explorer-grid-card {
width: 100%;
max-width: 425px;
/* height: max-content; */
box-shadow: var(--shadow-s);
border-radius: var(--radius-m);
}
.vault-explorer-grid-card--interactive:hover {
background-color: var(--background-modifier-hover);
}
.vault-explorer-grid-card--interactive:focus-visible {
box-shadow: 0 0 0 3px var(--background-modifier-border-focus);
}
</style>

View file

@ -1,66 +0,0 @@
<script lang="ts">
import { FileInteractionStyle } from "src/types";
import { createEventDispatcher } from "svelte";
export let fileInteractionStyle: FileInteractionStyle;
const dispatch = createEventDispatcher();
function handleClick() {
dispatch("click");
}
function handleContextMenu(e: MouseEvent) {
dispatch("contextmenu", { nativeEvent: e });
}
$: className = `vault-explorer-grid-card__title ${fileInteractionStyle === "content" ? "" : "vault-explorer-grid-card__title--interactive"}`;
</script>
{#if fileInteractionStyle === "title"}
<div
tabindex="0"
role="link"
class={className}
on:focus={() => {}}
on:click={(e) => {
e.preventDefault();
handleClick();
}}
on:contextmenu={(e) => {
e.preventDefault();
handleContextMenu(e);
}}
on:keydown={(e) => {
if (e.key === "Enter" || e.key === " ") {
e.preventDefault();
handleClick();
}
}}
on:mouseover
>
<slot />
</div>
{/if}
{#if fileInteractionStyle === "content"}
<div class={className}>
<slot />
</div>
{/if}
<style>
.vault-explorer-grid-card__title {
flex-grow: 1;
min-width: 0;
}
.vault-explorer-grid-card__title--interactive {
cursor: pointer;
color: var(--text-accent);
}
.vault-explorer-grid-card__title--interactive:focus-visible {
box-shadow: 0 0 0 3px var(--background-modifier-border-focus);
}
</style>

View file

@ -7,15 +7,13 @@
import Wrap from "src/svelte/shared/components/wrap.svelte";
import Stack from "src/svelte/shared/components/stack.svelte";
import { createEventDispatcher, onMount } from "svelte";
import { FileInteractionStyle, WordBreak } from "src/types";
import { WordBreak } from "src/types";
import { HOVER_LINK_SOURCE_ID } from "src/constants";
import EventManager from "src/event/event-manager";
import Icon from "src/svelte/shared/components/icon.svelte";
import { getIconIdForFile } from "../services/file-icon";
import { fetchSocialImage } from "../services/social-media-image";
import { PluginEvent } from "src/event/types";
import GridCardContainer from "./grid-card-container.svelte";
import GridCardTitle from "./grid-card-title.svelte";
import { openContextMenu } from "../services/context-menu";
import { openInCurrentTab } from "../services/open-file";
import Flex from "src/svelte/shared/components/flex.svelte";
@ -39,13 +37,11 @@
let wordBreak: WordBreak = "normal";
let enableFileIcons: boolean = false;
let loadSocialMediaImage: boolean = true;
let fileInteractionStyle: FileInteractionStyle = "content";
let imgSrc: string | null = null;
store.plugin.subscribe((p) => {
plugin = p;
wordBreak = plugin.settings.titleWrapping;
fileInteractionStyle = plugin.settings.fileInteractionStyle;
enableFileIcons = plugin.settings.enableFileIcons;
loadSocialMediaImage = plugin.settings.views.grid.loadSocialMediaImage;
});
@ -64,23 +60,6 @@
}
});
onMount(() => {
function handleFileInteractionStyleChange() {
fileInteractionStyle = plugin.settings.fileInteractionStyle;
}
EventManager.getInstance().on(
PluginEvent.FILE_INTERACTION_STYLE,
handleFileInteractionStyleChange,
);
return () => {
EventManager.getInstance().off(
PluginEvent.FILE_INTERACTION_STYLE,
handleFileInteractionStyleChange,
);
};
});
onMount(() => {
function handleLoadSocialMediaImageChange() {
const newValue = plugin.settings.views.grid.loadSocialMediaImage;
@ -173,8 +152,8 @@
dispatch("favoritePropertyChange", { filePath, value });
}
function handleCardContextMenu(e: CustomEvent) {
const { nativeEvent } = e.detail;
function handleCardContextMenu(e: Event) {
const nativeEvent = e as MouseEvent;
openContextMenu(plugin, path, nativeEvent, {
isFavorite,
onFavoriteChange: handleFavoriteChange,
@ -196,7 +175,7 @@
handleCardClick();
}
function handleTitleContextMenu(e: CustomEvent) {
function handleTitleContextMenu(e: Event) {
handleCardContextMenu(e);
}
@ -208,11 +187,22 @@
tags != null || custom1 != null || custom2 != null || custom3 != null;
</script>
<GridCardContainer
{fileInteractionStyle}
<div
tabindex="0"
role="button"
class="vault-explorer-grid-card vault-explorer-grid-card--interactive"
on:click={handleCardClick}
on:contextmenu={handleCardContextMenu}
on:mouseover={handleCardMouseOver}
on:keydown={(e) => {
if (e.key === "Enter" || e.key === " ") {
handleCardClick();
}
}}
on:contextmenu={(e) => {
e.preventDefault();
handleCardContextMenu(e);
}}
on:focus={() => {}}
on:mouseover
>
<div class="vault-explorer-grid-card__cover">
{#if imgSrc !== null}
@ -234,10 +224,25 @@
</div>
<div class="vault-explorer-grid-card__content">
<div class="vault-explorer-grid-card__head">
<GridCardTitle
{fileInteractionStyle}
on:click={handleTitleClick}
on:contextmenu={handleTitleContextMenu}
<div
tabindex="0"
role="link"
class="vault-explorer-grid-card__title"
on:focus={() => {}}
on:click={(e) => {
e.preventDefault();
handleTitleClick();
}}
on:contextmenu={(e) => {
e.preventDefault();
handleTitleContextMenu(e);
}}
on:keydown={(e) => {
if (e.key === "Enter" || e.key === " ") {
e.preventDefault();
handleTitleClick();
}
}}
on:mouseover={handleTitleMouseOver}
>
<Stack spacing="xs">
@ -248,7 +253,7 @@
{displayName}
</div>
</Stack>
</GridCardTitle>
</div>
{#if url !== null}
<IconButton
iconId="external-link"
@ -288,9 +293,24 @@
</div>
{/if}
</div>
</GridCardContainer>
</div>
<style>
.vault-explorer-grid-card {
width: 100%;
max-width: 425px;
box-shadow: var(--shadow-s);
border-radius: var(--radius-m);
}
.vault-explorer-grid-card:hover {
background-color: var(--background-modifier-hover);
}
.vault-explorer-grid-card:focus-visible {
box-shadow: 0 0 0 3px var(--background-modifier-border-focus);
}
.vault-explorer-grid-card__cover {
width: 100%;
height: 150px;
@ -334,4 +354,15 @@
text-overflow: ellipsis;
white-space: nowrap;
}
.vault-explorer-grid-card__title {
flex-grow: 1;
min-width: 0;
cursor: pointer;
color: var(--text-accent);
}
.vault-explorer-grid-card__title:focus-visible {
box-shadow: 0 0 0 3px var(--background-modifier-border-focus);
}
</style>

View file

@ -1,61 +0,0 @@
<script lang="ts">
import { FileInteractionStyle } from "src/types";
import { createEventDispatcher } from "svelte";
export let fileInteractionStyle: FileInteractionStyle;
export let ref: HTMLElement | null = null;
const dispatch = createEventDispatcher();
function handleClick() {
dispatch("click");
}
function handleContextMenu(e: MouseEvent) {
dispatch("contextmenu", { nativeEvent: e });
}
</script>
{#if fileInteractionStyle === "content"}
<div
bind:this={ref}
tabindex="0"
role="button"
class="vault-explorer-list-item vault-explorer-list-item--interactive"
on:click={handleClick}
on:keydown={(e) => {
if (e.key === "Enter" || e.key === " ") {
handleClick();
}
}}
on:contextmenu={(e) => {
e.preventDefault();
handleContextMenu(e);
}}
on:focus={() => {}}
on:mouseover
>
<slot />
</div>
{/if}
{#if fileInteractionStyle === "title"}
<div bind:this={ref} class="vault-explorer-list-item">
<slot />
</div>
{/if}
<style>
.vault-explorer-list-item {
padding: 8px;
border-bottom: 1px solid var(--background-modifier-border);
}
.vault-explorer-list-item--interactive:focus-visible {
box-shadow: 0 0 0 3px var(--background-modifier-border-focus);
}
.vault-explorer-list-item--interactive:hover {
background-color: var(--background-modifier-hover);
}
</style>

View file

@ -1,70 +0,0 @@
<script lang="ts">
import { FileInteractionStyle } from "src/types";
import { createEventDispatcher } from "svelte";
export let fileInteractionStyle: FileInteractionStyle;
export let isSmallScreenSize: boolean;
const dispatch = createEventDispatcher();
function handleClick() {
dispatch("click");
}
function handleContextMenu(e: MouseEvent) {
dispatch("contextmenu", { nativeEvent: e });
}
$: className = `vault-explorer-list-item__title ${fileInteractionStyle === "content" ? "" : "vault-explorer-list-item__title--interactive"} ${isSmallScreenSize ? "vault-explorer-list-item__title--screen-size-sm" : ""}`;
</script>
{#if fileInteractionStyle === "title"}
<div
tabindex="0"
role="link"
class={className}
on:focus={() => {}}
on:click={(e) => {
e.preventDefault();
handleClick();
}}
on:contextmenu={(e) => {
e.preventDefault();
handleContextMenu(e);
}}
on:keydown={(e) => {
if (e.key === "Enter" || e.key === " ") {
e.preventDefault();
handleClick();
}
}}
on:mouseover
>
<slot />
</div>
{/if}
{#if fileInteractionStyle === "content"}
<div class={className}>
<slot />
</div>
{/if}
<style>
.vault-explorer-list-item__title {
width: 50%;
}
.vault-explorer-list-item__title--screen-size-sm {
width: 100%;
}
.vault-explorer-list-item__title--interactive {
cursor: pointer;
color: var(--text-accent);
}
.vault-explorer-list-item__title--interactive:focus-visible {
box-shadow: 0 0 0 3px var(--background-modifier-border-focus);
}
</style>

View file

@ -9,11 +9,8 @@
import { createEventDispatcher, onMount } from "svelte";
import EventManager from "src/event/event-manager";
import { PluginEvent } from "src/event/types";
import ListItemContainer from "./list-item-container.svelte";
import { FileInteractionStyle } from "src/types";
import { openContextMenu } from "../services/context-menu";
import { openInCurrentTab } from "../services/open-file";
import ListItemTitle from "./list-item-title.svelte";
import { HOVER_LINK_SOURCE_ID } from "src/constants";
import { SCREEN_SIZE_MD } from "../constants";
@ -25,7 +22,6 @@
export let isFavorite: boolean | null;
let enableFileIcons: boolean = false;
let fileInteractionStyle: FileInteractionStyle = "content";
let isSmallScreenSize: boolean = false;
let ref: HTMLElement | null = null;
let showTags: boolean = true;
@ -36,7 +32,6 @@
store.plugin.subscribe((p) => {
plugin = p;
enableFileIcons = plugin.settings.enableFileIcons;
fileInteractionStyle = plugin.settings.fileInteractionStyle;
showTags = plugin.settings.views.list.showTags;
});
@ -74,23 +69,6 @@
};
});
onMount(() => {
function handleFileInteractionStyleChange() {
fileInteractionStyle = plugin.settings.fileInteractionStyle;
}
EventManager.getInstance().on(
PluginEvent.FILE_INTERACTION_STYLE,
handleFileInteractionStyleChange,
);
return () => {
EventManager.getInstance().off(
PluginEvent.FILE_INTERACTION_STYLE,
handleFileInteractionStyleChange,
);
};
});
onMount(() => {
let resizeObserver: ResizeObserver;
@ -128,7 +106,7 @@
openInCurrentTab(plugin, path);
}
function handleTitleContextMenu(e: CustomEvent) {
function handleTitleContextMenu(e: Event) {
handleItemContextMenu(e);
}
@ -136,8 +114,8 @@
dispatch("favoritePropertyChange", { filePath, value });
}
function handleItemContextMenu(e: CustomEvent) {
const { nativeEvent } = e.detail;
function handleItemContextMenu(e: Event) {
const nativeEvent = e as MouseEvent;
openContextMenu(plugin, path, nativeEvent, {
isFavorite,
onFavoriteChange: handleFavoriteChange,
@ -160,14 +138,26 @@
}
$: tagsClassName = `vault-explorer-list-item__tags ${isSmallScreenSize ? "vault-explorer-list-item__tags--screen-size-sm" : ""}`;
$: titleClassName = `vault-explorer-list-item__title ${isSmallScreenSize ? "vault-explorer-list-item__title--screen-size-sm" : ""}`;
</script>
<ListItemContainer
{fileInteractionStyle}
bind:ref
<div
bind:this={ref}
tabindex="0"
role="button"
class="vault-explorer-list-item"
on:click={handleItemClick}
on:contextmenu={handleItemContextMenu}
on:mouseover={handleItemMouseOver}
on:keydown={(e) => {
if (e.key === "Enter" || e.key === " ") {
handleItemClick();
}
}}
on:contextmenu={(e) => {
e.preventDefault();
handleItemContextMenu(e);
}}
on:focus={() => {}}
on:mouseover
>
<Wrap
spacingX="lg"
@ -175,11 +165,25 @@
align="center"
wrap={isSmallScreenSize ? "wrap" : "nowrap"}
>
<ListItemTitle
{isSmallScreenSize}
{fileInteractionStyle}
on:click={handleTitleClick}
on:contextmenu={handleTitleContextMenu}
<div
tabindex="0"
role="link"
class={titleClassName}
on:focus={() => {}}
on:click={(e) => {
e.preventDefault();
handleTitleClick();
}}
on:contextmenu={(e) => {
e.preventDefault();
handleTitleContextMenu(e);
}}
on:keydown={(e) => {
if (e.key === "Enter" || e.key === " ") {
e.preventDefault();
handleTitleClick();
}
}}
on:mouseover={handleTitleMouseOver}
>
<Stack spacing="xs">
@ -190,7 +194,7 @@
{displayName}
</div>
</Stack>
</ListItemTitle>
</div>
{#if showTags}
<div class={tagsClassName}>
{#if tags !== null}
@ -207,9 +211,36 @@
</div>
{/if}
</Wrap>
</ListItemContainer>
</div>
<style>
.vault-explorer-list-item {
padding: 8px;
border-bottom: 1px solid var(--background-modifier-border);
}
.vault-explorer-list-item:hover {
background-color: var(--background-modifier-hover);
}
.vault-explorer-list-item:focus-visible {
box-shadow: 0 0 0 3px var(--background-modifier-border-focus);
}
.vault-explorer-list-item__title {
width: 50%;
cursor: pointer;
color: var(--text-accent);
}
.vault-explorer-list-item__title:focus-visible {
box-shadow: 0 0 0 3px var(--background-modifier-border-focus);
}
.vault-explorer-list-item__title--screen-size-sm {
width: 100%;
}
.vault-explorer-list-item__title-text {
overflow: hidden;
text-overflow: ellipsis;

View file

@ -630,8 +630,6 @@ export function isVaultExplorerPluginSettings(obj: unknown): obj is VaultExplore
typedObj["titleWrapping"] === "break-word") &&
typeof typedObj["enableClockUpdates"] === "boolean" &&
typeof typedObj["enableFileIcons"] === "boolean" &&
(typedObj["fileInteractionStyle"] === "title" ||
typedObj["fileInteractionStyle"] === "content") &&
(typedObj["currentView"] === null ||
typedObj["currentView"] === TExplorerView.DASHBOARD ||
typedObj["currentView"] === TExplorerView.GRID ||

View file

@ -29,7 +29,6 @@ export interface VaultExplorerPluginSettings {
titleWrapping: WordBreak;
enableClockUpdates: boolean;
enableFileIcons: boolean;
fileInteractionStyle: FileInteractionStyle;
currentView: TExplorerView | null;
enableScrollButtons: boolean;
pageSize: number;

319
src/types/types-1.32.2.ts Normal file
View file

@ -0,0 +1,319 @@
export interface VaultExplorerPluginSettings_1_32_2 {
properties: {
favorite: string;
url: string;
imageUrl: 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;
fileInteractionStyle: FileInteractionStyle;
currentView: TExplorerView | null;
enableScrollButtons: boolean;
pageSize: number;
filterGroupsWidth: string;
shouldWrapFilterGroups: 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 {
coverImageSource: CoverImageSource;
loadSocialMediaImage: boolean;
}
type CoverImageSource = "frontmatter-only" | "frontmatter-and-body" | "off";
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;
}

View file

@ -25,69 +25,8 @@
},
"custom": {
"isEnabled": true,
"selectedGroupId": "Hnx82uGqi5vmVMVn",
"groups": [
{
"id": "C9gqoDMHJiYMNHYK",
"name": "Group 1",
"rules": [
{
"id": "FtNA5HnfPLZwktPE",
"type": "property",
"propertyType": "text",
"propertyName": "",
"operator": "and",
"isEnabled": true,
"condition": "is",
"value": "",
"matchWhenPropertyDNE": false
}
],
"isEnabled": false,
"isSticky": false
},
{
"id": "Hnx82uGqi5vmVMVn",
"name": "Group 2",
"rules": [
{
"id": "v7B5S39pTa6hWM4H",
"type": "property",
"propertyType": "text",
"propertyName": "",
"operator": "and",
"isEnabled": true,
"condition": "is",
"value": "",
"matchWhenPropertyDNE": false
},
{
"id": "1hVY6aEmZ6mVgRyW",
"type": "property",
"propertyType": "text",
"propertyName": "",
"operator": "and",
"isEnabled": true,
"condition": "is",
"value": "",
"matchWhenPropertyDNE": false
},
{
"id": "qBnvqUTVvULRL8y6",
"type": "property",
"propertyType": "text",
"propertyName": "",
"operator": "and",
"isEnabled": true,
"condition": "is",
"value": "",
"matchWhenPropertyDNE": false
}
],
"isEnabled": false,
"isSticky": false
}
]
"selectedGroupId": "",
"groups": []
},
"favorites": {
"isEnabled": true,
@ -136,8 +75,7 @@
"enableClockUpdates": true,
"enableFileIcons": true,
"enableScrollButtons": true,
"fileInteractionStyle": "content",
"filterGroupsWidth": "305px",
"filterGroupsWidth": "149px",
"shouldWrapFilterGroups": false,
"pageSize": 25,
"viewOrder": [
@ -146,6 +84,6 @@
"feed"
],
"configDir": ".vaultexplorer",
"pluginVersion": "1.32.1",
"pluginVersion": "1.33.0",
"logLevel": "trace"
}

View file

@ -114,5 +114,6 @@
"1.31.1": "1.4.13",
"1.32.0": "1.4.13",
"1.32.1": "1.4.13",
"1.32.2": "1.4.13"
"1.32.2": "1.4.13",
"1.33.0": "1.4.13"
}