import type { ComponentManifest } from "../config"; import type { Service } from "../services"; /** * A key to uniquely identify a component. */ export interface ComponentKey { /** * The component's XML namespace. */ namespace: string; /** * The name of the component, i.e. the XML tag name in a layout. */ name: string; } /** * A registry of available components. */ export interface ComponentRegistry extends Map, Service { /** * Determines whether the registry has a given component. * * @param key The unique key for the component. */ has(key: ComponentKey): boolean; /** * Determines whether the registry has a given component. * * @param namespace The component's XML namespace. * @param name The name of the component. */ has(namespace: string, name: string): boolean; /** * Gets a given component by its unique key. * * @param key The unique key for the component. */ get(key: ComponentKey): ComponentManifest; /** * Gets a given component by namespace and name. * * @param namespace The component's XML namespace. * @param name The name of the component. */ get(namespace: string, name: string): ComponentManifest; /** * Adds or replaces a component. * * @param key The unique key for the component. */ set(key: ComponentKey, component: ComponentManifest): this; /** * Adds or replaces a component. * * @param namespace The component's XML namespace. * @param name The name of the component. */ set(namespace: string, name: string, component: ComponentManifest): this; /** * Deletes a component. * * @param key The unique key for the component. */ delete(key: ComponentKey): boolean; /** * Deletes a component. * * @param namespace The component's XML namespace. * @param name The name of the component. */ delete(namespace: string, name: string): boolean; }