Creates a ContextMenu. Styles are injected once.
Element to append the menu into. Must establish a stacking context so CSS variables are inherited.
Optional class-name overrides.
Protected ReadonlyhostProtectedmenuProtected ReadonlyconfigReturns true when the menu is currently visible.
Appends a labelled menu item that calls the given handler and closes the menu on click.
Display text for the item.
Callback invoked when the item is clicked.
Optional icon element, active toggle state, and disabled flag.
The created menu item element.
Appends a visual separator line.
ProtectedshowPositions and displays the menu at the given viewport coordinates. Any previously open menu is closed first. Call this from open after populating items.
Horizontal position in viewport pixels.
Vertical position in viewport pixels.
Opens the context menu in response to a pointer event. Override in subclasses to populate items and call show. The base implementation does nothing.
The pointer event that triggered the context menu.
Hides and removes the menu from the DOM.
Permanently removes the menu and cleans up listeners.
Lightweight context menu that renders at fixed viewport coordinates.