Refactoring

This commit is contained in:
2025-10-15 01:41:52 +02:00
parent e492c03f15
commit 8e6b07797c
11 changed files with 180 additions and 173 deletions

View File

@ -1,8 +1,10 @@
import { getContext, setContext } from 'svelte';
import { ProjectManager } from '../project-system/project-manager';
import { ProjectDatabase } from '../project-system/db';
import { createCsoundStore } from '../csound/store';
import { createEditorSettingsStore } from '../stores/editorSettings';
import { ProjectEditor } from '../stores/projectEditor.svelte';
import { UIState } from '../stores/uiState.svelte';
import type { CsoundStore } from '../csound/store';
import type { EditorSettingsStore } from '../stores/editorSettings';
@ -11,17 +13,20 @@ export interface AppContext {
csound: CsoundStore;
editorSettings: EditorSettingsStore;
projectEditor: ProjectEditor;
uiState: UIState;
}
const APP_CONTEXT_KEY = Symbol('app-context');
export function createAppContext(): AppContext {
const projectManager = new ProjectManager();
const db = new ProjectDatabase();
const projectManager = new ProjectManager(db);
return {
projectManager,
csound: createCsoundStore(),
editorSettings: createEditorSettingsStore(),
projectEditor: new ProjectEditor(projectManager)
projectEditor: new ProjectEditor(projectManager),
uiState: new UIState()
};
}