import { BindingEventService } from '@slickgrid-universal/binding';
import type { BasePubSubService } from '@slickgrid-universal/event-pub-sub';
import { SlickEventHandler, type SlickEventData, type SlickGrid } from '../core/index.js';
import type { ExtensionUtility } from '../extensions/extensionUtility.js';
import type { CellMenu, Column, ContextMenu, DOMMouseOrTouchEvent, GridMenu, GridMenuItem, GridOption, HeaderButton, HeaderButtonItem, HeaderMenu, MenuCommandItem, MenuOptionItem } from '../interfaces/index.js';
import type { SharedService } from '../services/shared.service.js';
export type ExtractMenuType<A, T> = T extends 'command' ? A : T extends 'option' ? A : A extends 'divider' ? A : never;
export type MenuType = 'command' | 'option';
export type MenuCommandOptionItem = MenuCommandItem | MenuOptionItem;
export type ExtendableItemTypes = HeaderButtonItem | MenuCommandItem | MenuOptionItem | 'divider';
export type MenuPlugin = CellMenu | ContextMenu | GridMenu | HeaderMenu;
export type itemEventCallback = (e: DOMMouseOrTouchEvent<HTMLDivElement>, type: MenuType, item: ExtractMenuType<ExtendableItemTypes, MenuType>, level: number, columnDef?: Column) => void;
export interface KeyboardNavigationOption {
    onActivate?: (focusedItem: HTMLElement) => void;
    onEscape?: () => void;
    onTab?: (evt: KeyboardEvent, focusedItem: HTMLElement) => void;
    eventServiceKey?: string;
    allItemsSelector?: string;
    focusedItemSelector?: string;
}
export declare class MenuBaseClass<M extends MenuPlugin | HeaderButton> {
    protected readonly extensionUtility: ExtensionUtility;
    protected readonly pubSubService: BasePubSubService;
    protected readonly sharedService: SharedService;
    protected _addonOptions: M;
    protected _bindEventService: BindingEventService;
    protected _camelPluginName: string;
    protected _commandTitleElm?: HTMLSpanElement;
    protected _eventHandler: SlickEventHandler;
    protected _gridUid: string;
    protected _menuElm?: HTMLDivElement | null;
    protected _menuCssPrefix: string;
    protected _menuPluginCssPrefix: string;
    protected _optionTitleElm?: HTMLSpanElement;
    protected _menuTriggerElement?: HTMLElement;
    protected _timer?: any;
    pluginName: string;
    /** Constructor of the SlickGrid 3rd party plugin, it can optionally receive options */
    constructor(extensionUtility: ExtensionUtility, pubSubService: BasePubSubService, sharedService: SharedService);
    get addonOptions(): M;
    set addonOptions(newOptions: M);
    get eventHandler(): SlickEventHandler;
    get grid(): SlickGrid;
    get gridOptions(): GridOption;
    /** Getter for the grid uid */
    get gridUid(): string;
    get gridUidSelector(): string;
    get menuCssClass(): string;
    get menuElement(): HTMLDivElement | null;
    /** Dispose (destroy) of the plugin */
    dispose(): void;
    /** Remove/dispose all parent menus and any sub-menu(s) */
    disposeAllMenus(): void;
    /**
     * Remove/dispose all previously opened sub-menu(s),
     * it will first remove all sub-menu listeners then remove sub-menus from the DOM
     */
    disposeSubMenus(): void;
    setOptions(newOptions: M): void;
    /**
     * add Menu Item Command when not found and also make sure that we have an `action` callback
     * (could be missing when provided by user) if not use built-in `action` callback when missing
     * @param originalMenuItems
     * @param builtInMenuItem
     * @param showCommand - is command hidden from menu option (deprecated)
     * @returns - returns true when added to the commands array
     */
    protected addMissingCommandOrAction<T extends MenuCommandItem | GridMenuItem>(builtInMenuItem: T | 'divider', hideCommands: string[] | undefined, targetMenuItems: Array<T | 'divider'>, originalMenuItems?: Array<T | 'divider'>): void;
    /** Focus the first focusable menu item after menu is opened */
    protected focusFirstMenuItem(menuElm: HTMLElement): void;
    /** Set the menu trigger element for focus restoration when menu closes */
    protected setMenuTriggerElement(triggerElement: HTMLElement): void;
    /**
     * Render slot content using a renderer callback.
     * The renderer receives the menu item and args for full context access.
     * @param parentElm - The parent element (LI) to insert the slot content into
     * @param slotRenderer - A callback function that receives (item, args) and returns string or HTMLElement
     * @param item - The menu item object (passed to callback)
     * @param args - The callback args providing access to grid, column, dataContext, etc.
     */
    protected renderSlotRenderer(parentElm: HTMLElement, slotRenderer: (item: any, args: any) => string | HTMLElement, item: any, args: any): void;
    protected addSubMenuTitleWhenExists(item: ExtractMenuType<ExtendableItemTypes, MenuType>, commandOrOptionMenu: HTMLDivElement): void;
    /** Construct the Command/Options Items section. */
    protected populateCommandOrOptionItems(itemType: MenuType, menuOptions: M, commandOrOptionMenuElm: HTMLElement, commandOrOptionItems: Array<ExtractMenuType<ExtendableItemTypes, MenuType>>, args: unknown, triggeredByElm: HTMLElement, itemClickCallback: itemEventCallback, itemMouseoverCallback?: itemEventCallback, keyboardNavOptions?: KeyboardNavigationOption): void;
    /** Add the Command/Options Title when necessary. */
    protected populateCommandOrOptionTitle(itemType: MenuType, menuOptions: M, commandOrOptionMenuElm: HTMLElement, level: number): void;
    /** Construct the Command/Options Items section. */
    protected populateSingleCommandOrOptionItem(itemType: MenuType, menuOptions: M, commandOrOptionMenuElm: HTMLElement | null, item: ExtractMenuType<ExtendableItemTypes, MenuType>, args: any, triggeredByElm: HTMLElement, itemClickCallback: itemEventCallback, itemMouseoverCallback?: itemEventCallback): HTMLLIElement | null;
    /**
     * Wire up keyboard navigation for the menu container using shared utility.
     * Should be called after menu DOM is created for all non-GridMenu plugins.
     * Handles sub-menu open/close and focus transfer for a11y.
     */
    protected wireMenuKeyboardNavigation(menuElm: HTMLElement, options?: KeyboardNavigationOption): void;
    /**
     * Reposition any of the menu plugins (CellMenu, ContextMenu, GridMenu, HeaderMenu) to where the user clicked,
     * it will calculate the best position depending on available space in the viewport and the menu type.
     */
    repositionMenu(e: DOMMouseOrTouchEvent<HTMLElement> | SlickEventData, menuElm: HTMLElement, buttonElm?: HTMLButtonElement, addonOptions?: GridMenu | CellMenu | ContextMenu | HeaderMenu): void;
}
//# sourceMappingURL=menuBaseClass.d.ts.map