import type { ComponentType } from 'react' export type SlotName = | 'settings-community' | 'settings-global' | 'post-content' | 'admin-dashboard' | 'topic-sidebar' | 'user-profile' export interface PluginRegistration { pluginName: string component: ComponentType> } const registry = new Map() export function registerPluginComponent( slot: SlotName, pluginName: string, component: ComponentType> ): void { const existing = registry.get(slot) ?? [] // Prevent duplicate registration if (existing.some((r) => r.pluginName === pluginName)) return registry.set(slot, [...existing, { pluginName, component }]) } export function getPluginComponents(slot: SlotName): PluginRegistration[] { return registry.get(slot) ?? [] } export function clearPluginRegistry(): void { registry.clear() }