import { ComponentTreeDrawer } from '../components/component-tree-drawer'; import type { ComponentTreeDrawerTabApi, ComponentTreeDrawerTabId } from '../components/component-tree-drawer/types'; import { BaseManager } from '../core/base-manager'; import { ManagerRegistry } from '../core/manager-registry'; export class ComponentTreeDrawerManager extends BaseManager { private drawer: ComponentTreeDrawer | null = null; constructor(registry: ManagerRegistry) { super(registry); this.init(); } public init(): void { if (this.drawer || !this.registry.wrapper) { return; } this.drawer = new ComponentTreeDrawer({ container: this.registry.wrapper, registry: this.registry }); this.drawer.init(); } public open(tabId?: ComponentTreeDrawerTabId): void { this.drawer?.openDrawer(tabId); } public close(): void { this.drawer?.close(); } public toggle(tabId?: ComponentTreeDrawerTabId): void { this.drawer?.toggle(tabId); } public switchTab(tabId: ComponentTreeDrawerTabId): void { this.drawer?.switchTab(tabId); } public isOpen(): boolean { return this.drawer?.isOpen() ?? false; } public getActiveTab(): ComponentTreeDrawerTabId { return this.drawer?.getActiveTab() ?? 'construct-tree'; } public getViewTabApi(): ComponentTreeDrawerTabApi | null { return this.drawer?.getViewTabApi() ?? null; } public getPinTabApi(): ComponentTreeDrawerTabApi | null { return this.drawer?.getPinTabApi() ?? null; } public getConstructTreeTabApi(): ComponentTreeDrawerTabApi | null { return this.drawer?.getConstructTreeTabApi() ?? null; } public destroy(): void { this.drawer?.destroy(); this.drawer = null; super.destroy(); } }