UNPKG

@launchmenu/core

Version:

An environment for visual keyboard controlled applets

101 lines 4.37 kB
import { DataCacher, Field, IDataHook } from "model-react"; import { IIOContext } from "../context/_types/IIOContext"; import { IKeyEventListener } from "../keyHandler/_types/IKeyEventListener"; import { IUILayerPathNode } from "./_types/IUILayerPathNode"; import { IUILayer } from "./_types/IUILayer"; import { IUILayerContentData } from "./_types/IUILayerContentData"; import { IUILayerFieldData } from "./_types/IUILayerFieldData"; import { IUILayerMenuData } from "./_types/IUILayerMenuData"; import { IUILayerBaseConfig } from "./_types/IUILayerBaseConfig"; import { IMenu } from "../menus/menu/_types/IMenu"; /** * An abstract class that can be used as a foundation for a UILayer */ export declare abstract class AbstractUILayer implements IUILayer { protected layerConfig: Required<IUILayerBaseConfig>; protected UIMissingData: { ID: string; contentView: import("./_types/IViewStackItem").IViewStackItem; menuView: import("./_types/IViewStackItem").IViewStackItem; fieldView: import("./_types/IViewStackItem").IViewStackItem; overlayGroup: symbol; }; protected closers: (() => void)[]; protected context: Field<IIOContext | null>; /** * Creates a new abstract UI layer * @param config The layer config */ constructor(config?: IUILayerBaseConfig); /** * Initializes the layer with the given context * @param context The context that the layer will be opened in * @returns Whether to allow for multiple initializations (defaults to false) */ protected abstract initialize(context: IIOContext, close: () => void): void | (() => void) | Promise<void | (() => void)>; /** * A callback for when the UI layer is opened * @param context The context that this layer was opened in * @param close A method to close this layer from the given context * @returns A callback for when this layer is closed (both when invoked by our close call, or closed external) */ onOpen(context: IIOContext, close: () => void): Promise<() => void>; /** * Closes this UILayer from all contexts it's opened in */ protected closeAll(): void; /** * Retrieves the path to show to the user representing this layer * @param hook The data hook to subscribe to changes * @returns The path */ getPath(hook?: IDataHook): IUILayerPathNode[]; /** * A cached getter for the absolute path */ protected absolutePath: DataCacher<IUILayerPathNode[]>; /** * Retrieves the menu data * @param hook The data hook to subscribe to changes * @param extendData The data to add to * @returns The menu data of this layer */ getMenuData(hook?: IDataHook, extendData?: IUILayerMenuData[]): IUILayerMenuData[]; /** * Retrieves the field data * @param hook The data hook to subscribe to changes * @param extendData The data to add to * @returns The field data of this layer */ getFieldData(hook?: IDataHook, extendData?: IUILayerFieldData[]): IUILayerFieldData[]; /** * Retrieves the menus to obtain the menu item content for * @param hook The hook to subscribe to changes * @returns The menus to get the content for */ protected getContentMenus(hook?: IDataHook): IMenu[]; /** * Contents that are visible from the currently selected menu items */ protected menuItemContents: DataCacher<IUILayerContentData[]>; /** * Retrieves the content data * @param hook The data hook to subscribe to changes * @param extendData The data to add to * @returns The content data of this layer */ getContentData(hook?: IDataHook, extendData?: IUILayerContentData[]): IUILayerContentData[]; /** * Retrieves the key listener data * @param hook The data hook to subscribe to changes * @returns The key listener data of this layer */ getKeyHandlers(hook?: IDataHook): IKeyEventListener[]; /** * Checks whether this layer is on the top of the stack * @param hook The hook to subscribe to changes * @returns Whether this layer is on top */ protected isOnTop(hook?: IDataHook): boolean; } //# sourceMappingURL=AbstractUILayer.d.ts.map