@difizen/mana-core
Version:
37 lines • 1.65 kB
TypeScript
import { Emitter } from '@difizen/mana-common';
import type { Contribution } from '@difizen/mana-syringe';
import { Syringe } from '@difizen/mana-syringe';
import { ApplicationContribution } from '../application';
import type { ToolbarNode } from './toolbar-protocol';
import { ToolbarItem, ToolbarItemFactory } from './toolbar-protocol';
/**
* Clients should implement this interface if they want to contribute to the toolbar.
*/
export declare const ToolbarContribution: Syringe.DefinedToken;
export type ToolbarContribution = {
/**
* Registers toolbar items.
* @param registry the toolbar registry.
*/
registerToolbarItems: (registry: ToolbarRegistry) => void;
};
/**
* Main, shared registry for tab-bar toolbar items.
*/
export declare class ToolbarRegistry implements ApplicationContribution {
items: Map<string, ToolbarItem>;
protected readonly toolbarItemFactory: ToolbarItemFactory;
protected readonly contributionProvider: Contribution.Provider<ToolbarContribution>;
constructor(toolbarItemFactory: ToolbarItemFactory, contributionProvider: Contribution.Provider<ToolbarContribution>);
protected readonly onDidChangeEmitter: Emitter<void>;
onStart(): void;
/**
* Registers the given item. Throws an error, if the corresponding command cannot be found or an item has been already registered for the desired command.
*
* @param item the item to register.
*/
registerItem(def: ToolbarNode): ToolbarItem;
getToolbarItem(id: string): ToolbarItem | undefined;
unregisterItem(itemOrId: ToolbarNode | string): void;
}
//# sourceMappingURL=toolbar-registry.d.ts.map