import { MenuItem } from "./MenuItem"; export declare enum CloseBehavior { /** Immediately fade out. */ Immediate = 0, /** Fade out after a small delay. */ Delayed = 1, /** Disappear instantly. */ NoAnimation = 2 } export interface MenuInstanceOptions { document?: Document; className?: string; isDarkMode?: boolean; maxItemsPerMenu?: number; enableTranslate?: boolean; /** * Callback to be notified about the user's selection. * * This callback is guaranteed to be [triggered by user activation][1], so * use it for any code that requires it. * * [1]: https://html.spec.whatwg.org/multipage/interaction.html#triggered-by-user-activation */ onSelection?: (selection: Selection) => void; } export interface PositionOptions { location: { x: number; y: number; }; within?: Area; expandRight?: boolean; } export interface Selection { path: number[]; action?: string; altKey: boolean; ctrlKey: boolean; metaKey: boolean; shiftKey: boolean; } interface Area { bottom: number; left: number; right: number; top: number; } export declare class MenuInstance implements EventListenerObject { readonly items: MenuItem[]; document: Document; blocker: HTMLDivElement; menu: HTMLUListElement; private readonly originalItems; constructor(items: MenuItem[], { className, document, isDarkMode, maxItemsPerMenu, enableTranslate }: MenuInstanceOptions); close(behavior: CloseBehavior, selection?: Selection): Promise; handleEvent(event: Event): void; handleKeyDown: (event: KeyboardEvent) => void; isOpenWith(items: MenuItem[]): boolean; position({ location: { x, y }, within: maybeWithin, expandRight }: PositionOptions): void; private activePromise; private onSelection?; show(options: PositionOptions, onSelection?: (selection: Selection) => void): Promise; wait(): Promise; private activeLI; private mouseDownTime; private reject?; private resolve?; private showTime; private state; private fadeOut; private pick; private setActiveLI; } /** * Cleans up an array of menu items by hiding separators at the start and end, as well as duplicate separators. * * The separators are hidden and not removed because the length of the items array and the order of the items is * relevant to trigger the correct actions * * @param items An array of menu items to be cleaned. */ export declare function cleanUpSeparators(items: MenuItem[]): MenuItem[]; export {};