UNPKG

@launchmenu/core

Version:

An environment for visual keyboard controlled applets

46 lines 2.14 kB
import { DataCacher, IDataHook, IDataRetriever } from "model-react"; import { IIOContext } from "../../context/_types/IIOContext"; import { TRequired } from "../../_types/TRequired"; import { IMenuItem } from "../items/_types/IMenuItem"; import { AbstractMenu } from "./AbstractMenu"; import { IMenuCategoryConfig } from "./_types/IMenuCategoryConfig"; import { IMenuCategoryData } from "./_types/IMenuCategoryData"; /** * A menu that wraps around an item source retriever, automatically updating its contents when the source updates. * Note that every single update will require O(n^2) time (n being the number of items in the menu), and is thus rather intensive. */ export declare class ProxiedMenu extends AbstractMenu { protected categoryConfig: TRequired<IMenuCategoryConfig>; protected itemSource: IDataRetriever<IMenuItem[]>; /** * Creates a new proxied menu * @param context The context to be used by menu items * @param itemSource The menu items source * @param config The configuration for category options */ constructor(context: IIOContext, itemSource: IDataRetriever<IMenuItem[]>, config?: IMenuCategoryConfig); /** A data cacher that computes the categories from an item list */ protected categories: DataCacher<{ categories: IMenuCategoryData[]; rawItems: IMenuItem[]; }>; /** A data cacher that computes the items list with categories from the category data */ protected itemsList: DataCacher<IMenuItem[]>; /** * Checks whether the cursor item is still present, and deselects it if not */ protected deselectRemovedItems(): void; /** * Retrieves the items of the menu * @param hook The hook to subscribe to changes * @returns The menu items */ getItems(hook?: IDataHook): IMenuItem[]; /** * Retrieves the item categories of the menu * @param hook The hook to subscribe to changes * @returns The categories and their items */ getCategories(hook?: IDataHook): IMenuCategoryData[]; } //# sourceMappingURL=ProxiedMenu.d.ts.map