import Language from '~/interfaces/Language'; /** * Abstract base class for modal dialogs. * * Subclasses must override {@link render} to provide the modal's HTML content. * The base class handles DOM insertion, visibility toggling, and automatic * binding of `[data-element]` nodes to instance properties. */ export default class Modal { /** The root DOM node of the modal dialog. */ protected readonly modalNode: HTMLDivElement; /** Locale resource for localized labels and messages (optional). */ protected language: Language | undefined; /** * Creates a new modal and appends its rendered HTML to the given context element. * * After insertion, all descendant elements with a `data-element` attribute * are automatically bound as properties on this instance using the attribute value as the key. * * @param context - The parent DOM element to append the modal into. * @param language - Optional locale resource for localized content. */ constructor(context: HTMLElement, language?: Language); /** * Returns the HTML string for the modal content. * Subclasses must override this method to provide their own markup. * * @returns The modal HTML string. */ protected render(): string; /** * Shows the modal by adding the visibility CSS class. * * @returns This modal instance for chaining, or a `Promise` in subclasses that wait for user interaction. */ show(): Modal | Promise; /** * Hides the modal by removing the visibility CSS class. * * @returns This modal instance for chaining. */ hide(): Modal; /** * Removes the modal DOM node from the document, freeing associated resources. */ destroy(): void; }