refactor: organise source files by ownership

Separate host-independent helpers under common/core and colocate feature
support code with its owners. Update imports, tests, and source-layout
guidance while preserving runtime behaviour.
This commit is contained in:
vorotamoroz committed 2026-11-13 10:58:24 +00:00
1 parent 9a0941647b
commit 73adfe3a74
115 files changed
+115 -103

No files matched your search

@@ -0,0 +1,27 @@
import type { App } from "@/deps.ts";
function getSettingsManager(app: App): Record<string, unknown> {
const manager: unknown = Reflect.get(app, "setting");
if (typeof manager !== "object" || manager === null) {
throw new TypeError("Obsidian does not expose the settings manager");
}
return manager as Record<string, unknown>;
}
function invokeSettingsMethod(app: App, methodName: string, args: unknown[] = []): void {
const manager = getSettingsManager(app);
const method = manager[methodName];
if (typeof method !== "function") {
throw new TypeError(`Obsidian does not expose settings.${methodName}`);
}
Reflect.apply(method, manager, args);
}
export function openObsidianSettings(app: App, tabId: string): void {
invokeSettingsMethod(app, "open");
invokeSettingsMethod(app, "openTabById", [tabId]);
}
export function closeObsidianSettings(app: App): void {
invokeSettingsMethod(app, "close");
}