mirror of
https://github.com/andy-stack/vaultkeeper-ai.git
synced 2026-07-22 06:42:03 +00:00
- Change function arguments type from `Record<string, object>` to `Record<string, unknown>` - Add Zod schemas for all AI function arguments validation - Improve TypeScript types across modals and services - Add ESLint disable comments for intentional exceptions - Fix async/await handling in modal and view lifecycle methods - Update dependencies (@typescript-eslint 8.46.4, rollup 4.53.2, zod 4.1.12)
48 lines
No EOL
1.3 KiB
TypeScript
48 lines
No EOL
1.3 KiB
TypeScript
import type VaultkeeperAIPlugin from "main";
|
|
import { Modal } from "obsidian";
|
|
import { Resolve } from "Services/DependencyService";
|
|
import { Services } from "Services/Services";
|
|
import HelpModalSvelte from './HelpModalSvelte.svelte';
|
|
import { mount, unmount } from 'svelte';
|
|
import { Selector } from 'Enums/Selector';
|
|
|
|
export class HelpModal extends Modal {
|
|
|
|
private component: ReturnType<typeof mount> | null = null;
|
|
private initialTopic?: number;
|
|
|
|
public constructor() {
|
|
const plugin = Resolve<VaultkeeperAIPlugin>(Services.VaultkeeperAIPlugin);
|
|
super(plugin.app);
|
|
}
|
|
|
|
onOpen() {
|
|
const { contentEl, modalEl, containerEl } = this;
|
|
|
|
containerEl.addClass(Selector.HelpModal);
|
|
modalEl.addClass(Selector.HelpModal);
|
|
|
|
this.component = mount(HelpModalSvelte, {
|
|
target: contentEl,
|
|
props: {
|
|
onClose: () => this.close(),
|
|
initialTopic: this.initialTopic
|
|
}
|
|
});
|
|
}
|
|
|
|
public open(initialTopic?: number): void {
|
|
this.initialTopic = initialTopic;
|
|
super.open();
|
|
}
|
|
|
|
onClose() {
|
|
if (this.component) {
|
|
void unmount(this.component);
|
|
this.component = null;
|
|
}
|
|
|
|
const { contentEl } = this;
|
|
contentEl.empty();
|
|
}
|
|
} |