type MenuDropOpener = HTMLButtonElement; type MenuDropList = HTMLUListElement; type MenuDropOption = HTMLLIElement | HTMLAnchorElement; type MenuDropSubList = HTMLDivElement; type MenuDropSection = MenuDropElement | MenuDropSubList; declare class MenuDropElement extends HTMLElement { #private; readonly shadowRoot: ShadowRoot & { alternateTimeout?: number; pointerType?: string; }; /** * The internal wrapper for all of the element's Shadow DOM content. */ readonly container: HTMLDivElement; /** * The internal stylesheet for the element's default styles. */ readonly styles: HTMLLinkElement; /** * The top-level opener button for accessing the menu. */ readonly opener: MenuDropOpener; /** * The internal wrapper for the element's menu lists. */ readonly body: HTMLDivElement; /** * The top-level list within the menu. */ readonly main: MenuDropList; constructor(); connectedCallback(): void; /** * Opens the top-level list within the menu. * * @param section This is used internally to open specific lists within the menu. */ open(section?: MenuDropSection): void; /** * Closes the top-level list within the menu. * * @param section This is used internally to close specific lists within the menu. */ close(section?: MenuDropSection, recursive?: boolean): void; /** * Toggles the top-level list within the menu. * * @param section This is used internally to toggle specific lists within the menu. */ toggle(section?: MenuDropSection): void; /** * Selects a given option from the top-level menu, when 'select' mode is enabled. * * I never fully finished this functionality, so there's not much of a great API to work with this unfortunately. * Same with the 'shortcuts' feature. It works great for what this legacy version needed to do, but it really could * use a fresh start in the next update. * * For these two features, if you really need to use them (I'm probably talking to myself here, lol), the most * I can say is to look into the source for this legacy build, and how STE used it also. It's not even using it much * there, so that's probably why I didn't smoothen it out yet. I think the technical debt for this component got * pretty high for me with the last few updates too, so that didn't help with being able to add new things safely. * Hence, why this whole rework is happening. * * This text should probably be in the commit message for these docs, too. * * Second edit: Realized there are a few other features that I haven't mentioned anywhere in any documentation either, * that being the Divider element (`
`), and alternate menus for right-click and long-pressing on touch devices. * * ```html * * * * * * ``` */ select(option: number | string | MenuDropOption): MenuDropOption | undefined; /** * Returns the child options for a given list within the menu. */ getOptions(container?: MenuDropList): MenuDropOption[]; /** * Calculates if a given element within the menu is not obstructed by the viewport. * * This is used internally for the list auto-wrapping behavior. */ getVisibility(element?: HTMLElement): boolean; /** * Returns the text nodes for a given element within the menu, only if they contain more than whitespace. */ getTextNodes(element: HTMLElement): ChildNode[]; focus(options?: FocusOptions): void; blur(): void; get defined(): boolean; } interface HTMLElementTagNameMap { "menu-drop": MenuDropElement; }