import { IMenuItem } from '../../components/widgets/MenuBar'; /** * A menu entry as held in the registry. Extends the presentational * {@link IMenuItem} with `commandId`, which `ConnectedMenuBar` resolves against * the {@link commandRegistry} when the item is chosen. */ export interface IMenuItemConfig extends IMenuItem { /** Command to execute when the item is selected. */ commandId?: string; /** Nested entries, which may themselves carry a `commandId`. */ submenu?: IMenuItemConfig[]; } /** Options for {@link MenuRegistry.contribute}. */ export interface MenuContributionOptions { /** * Where the items go. `'end'` (default) appends; `'start'` prepends; a * number inserts at that index. */ position?: 'start' | 'end' | number; } type Listener = () => void; /** * Holds the application's menu structure, keyed by top-level menu name. * * This is a shell-level convenience so plugins can contribute menu entries * without prop-drilling. The presentational `MenuBar` does not read it. */ export declare class MenuRegistry { private menus; private listeners; private version; registerMenu(menuId: string, item: IMenuItemConfig): void; /** * Add items to a menu, creating it if needed, without disturbing what other * code put there. An item whose id is already in the menu replaces it in * place. * * @returns A disposer that removes exactly these items. */ contribute(menuId: string, items: IMenuItemConfig[], options?: MenuContributionOptions): () => void; /** Replace the whole menu structure. */ setMenus(menuConfig: Record): void; getMenu(menuId: string): IMenuItemConfig[]; getAllMenus(): Record; /** Run `listener` whenever the menus change. */ subscribe(listener: Listener): () => void; /** Changes on every update; for `useSyncExternalStore`. */ getVersion(): number; private notify; } export declare const menuRegistry: MenuRegistry; /** * Merge menus, the first argument's taking priority. * * For each menu in `primary`, its items come first, followed by `secondary`'s * items for the same menu that are not already present by id or by command. * Menus only in `secondary` are appended after `primary`'s, so the app's own * menu order wins. */ export declare const mergeMenus: (primary: Record, secondary: Record) => Record; export type { IMenuItem };