sprotty
Version:
A next-gen framework for graphical views
45 lines • 1.95 kB
TypeScript
import { ILogger } from "../../utils/logging";
import { SModelRootImpl } from "../model/smodel";
import { ViewerOptions } from "../views/viewer-options";
/**
* A UI extension displaying additional UI elements on top of a sprotty diagram.
*/
export interface IUIExtension {
id(): string;
show(root: Readonly<SModelRootImpl>, ...contextElementIds: string[]): void;
hide(): void;
enableOnStartup?: boolean;
}
export declare function isUIExtension(object: unknown): object is IUIExtension;
/**
* Abstract base class for UI extensions.
*/
export declare abstract class AbstractUIExtension implements IUIExtension {
protected options: ViewerOptions;
protected logger: ILogger;
protected containerElement: HTMLElement;
protected activeElement: Element | null;
abstract id(): string;
abstract containerClass(): string;
show(root: Readonly<SModelRootImpl>, ...contextElementIds: string[]): void;
hide(): void;
protected restoreFocus(): void;
protected initialize(): boolean;
protected getOrCreateContainer(baseDivId: string): HTMLElement;
protected setContainerVisible(visible: boolean): void;
/**
* Updates the `containerElement` under the given `context` before it becomes visible.
*
* Subclasses may override this method to, for instance, modifying the position of the
* `containerElement`, add or remove elements, etc. depending on the specified `root`
* or `contextElementIds`.
*/
protected onBeforeShow(containerElement: HTMLElement, root: Readonly<SModelRootImpl>, ...contextElementIds: string[]): void;
/**
* Initializes the contents of this UI extension.
*
* Subclasses must implement this method to initialize the UI elements of this UI extension inside the specified `containerElement`.
*/
protected abstract initializeContents(containerElement: HTMLElement): void;
}
//# sourceMappingURL=ui-extension.d.ts.map