import * as i0 from '@angular/core';
import { TemplateRef } from '@angular/core';
/**
* Container for the rows shown when a {@link WrContextMenu} opens.
* The component itself doesn't render; the directive portals the inner
* template into an overlay positioned at the pointer.
*
* @example
* ```html
*
Right-click me
*
* Copy
* Delete
*
* ```
*/
declare class WrContextMenuPanel {
/** The internal template the directive portals into the overlay. @internal */
readonly contentTpl: i0.Signal>;
static ɵfac: i0.ɵɵFactoryDeclaration;
static ɵcmp: i0.ɵɵComponentDeclaration;
}
/**
* Attach to any element to show a `` at the pointer
* position when the user right-clicks or otherwise sends a `contextmenu`
* event (Shift+F10, etc.). The native browser menu is suppressed for the
* host element.
*
* @example
* ```html
* Right-click me
*
* Copy
* Delete
*
* ```
*
* @see https://ngwr.dev/components/context-menu
*/
declare class WrContextMenu {
/** Menu to open. Pass a `` template reference. */
readonly menu: i0.InputSignal;
private readonly host;
private readonly overlay;
private readonly vcr;
private readonly scrollStrategies;
private readonly destroyRef;
private overlayRef;
private closingTimer;
private leaveTimer;
/**
* Single open root menu at a time. Submenu items use this to signal
* chain-level hover state: when the cursor enters ANY pane in the
* chain (root or submenu) `keepChainAlive()` cancels the close timer;
* when the cursor leaves ALL panes `scheduleChainClose()` starts it.
* The whole chain (root → submenus) tears down through the root's
* close (submenus react to their owner-item destroyRef + the static
* registry in `WrContextMenuItem`).
*/
private static activeRoot;
/** Called from a submenu pane's mouseenter — keep the whole chain alive. */
static keepChainAlive(): void;
/** Called from a submenu pane's mouseleave when the cursor left ALL menus. */
static scheduleChainClose(): void;
/**
* Called from a `` click — selecting an item
* dismisses the whole chain (root + any open submenus). Items live in
* a detached overlay portal, so they reach their owning root through
* this static handle rather than DI.
*/
static closeActive(): void;
/**
* Open/close animation duration in ms. Matches the longest SCSS
* transition on `.wr-context-menu-overlay` (the spring-scale curve).
* The directive holds the overlay alive for this long during close
* so the exit animation can play before the pane is removed from
* the DOM.
*/
private static readonly TRANSITION_MS;
/**
* Grace window after the cursor leaves the root pane. Long enough
* for the user to dip momentarily into the gap between the root and
* a submenu (or back from a submenu), short enough to feel snappy
* on a deliberate hover-out.
*/
private static readonly LEAVE_DELAY;
constructor();
/** @internal Right-click handler — opens at the pointer (or re-positions if already open). */
protected onContextMenu(event: MouseEvent): void;
/** Close the menu. */
close(): void;
private openOverlay;
private closeOverlay;
private cancelLeaveTimer;
private scheduleLeave;
static ɵfac: i0.ɵɵFactoryDeclaration;
static ɵdir: i0.ɵɵDirectiveDeclaration;
}
/**
* Single row inside a ``. Mirrors `` —
* rendered as a menu item with an optional leading icon and an optional
* nested `[submenu]` that opens to the right on hover.
*
* @example
* ```html
*
* Copy
* More…
*
*
*
* Duplicate
* Archive
*
* ```
*/
declare class WrContextMenuItem {
/** Optional leading icon name. @default null */
readonly icon: i0.InputSignal;
/** Disable interaction (suppresses pointer + keyboard). @default false */
readonly disabled: i0.InputSignalWithTransform;
/**
* Optional nested ``. When set, hovering the item
* (or pressing →) opens it to the right with a chevron indicator.
*/
readonly submenu: i0.InputSignal;
protected readonly classes: i0.Signal;
private readonly host;
private readonly overlay;
private readonly vcr;
private readonly scrollStrategies;
private readonly destroyRef;
private submenuRef;
private openTimer;
private closeTimer;
protected submenuOpen: boolean;
/**
* Global registry of open submenus keyed by the host element of the
* item that owns them. Used to cascade-close descendants when a
* parent submenu is disposed — Angular's onDestroy on detached
* portals doesn't always tear down the deepest grand-children's
* overlays in the right order, leaving orphaned floating panes.
*/
private static readonly openSubmenus;
/**
* Dispose every open submenu pane on the page. Called by the root
* `WrContextMenu` when its own overlay closes — destroyRef cascade
* isn't reliable across separate overlay panes (each pane lives in
* the CDK overlay container, not inside the parent pane's view).
*/
static disposeAll(immediate: boolean): void;
constructor();
/**
* @internal Pointer activation — selecting a leaf item dismisses the
* whole menu chain. The consumer's own `(click)` binding on the host
* runs in the same event; we defer the close to a microtask so that
* handler (the actual "select") always completes before the overlay
* tears down, regardless of listener registration order. Items that
* own a submenu (or are disabled) don't dismiss — clicking them just
* drills into / ignores the row.
*/
protected onClick(): void;
/** @internal Keyboard activation — Enter / Space. */
protected activate(event: Event): void;
/** @internal Right-arrow opens the submenu. */
protected onArrowRight(event: Event): void;
/** @internal Left-arrow closes the submenu (if open). */
protected onArrowLeft(event: Event): void;
/** @internal Hover schedules a submenu open after a small delay. */
protected onMouseEnter(): void;
/** @internal Hover-out schedules a close with a grace window. */
protected onMouseLeave(event: MouseEvent): void;
private scheduleOpen;
private scheduleClose;
private cancelOpen;
private cancelClose;
private openSubmenu;
/** Bound handlers (= preserves identity for removeEventListener). */
private readonly onSubmenuEnter;
private readonly onSubmenuLeave;
private relatedTargetIsInsideAnyMenu;
/**
* `true` when the cursor moved from this item directly into the pane
* of its own (just-opening) submenu — drilling down. Sibling items
* and ancestor menus do NOT count.
*/
private relatedTargetIsInsideOwnSubmenu;
/**
* `true` when the cursor moved from our submenu pane into another
* submenu pane whose owner-item lives INSIDE ours — the user is
* drilling further down the chain (e.g., from the Share submenu into
* the Export-as submenu). Moving back up the chain returns false so
* we close.
*/
private relatedTargetIsInsideDescendantSubmenu;
private disposeSubmenu;
static ɵfac: i0.ɵɵFactoryDeclaration;
static ɵcmp: i0.ɵɵComponentDeclaration;
}
/**
* Thin horizontal separator inside a ``. Use it to
* group related items (e.g., a destructive action below a divider, or
* a "More" section below the primary items).
*
* @example
* ```html
*
* Copy
* Paste
*
* Delete
*
* ```
*/
declare class WrContextMenuDivider {
static ɵfac: i0.ɵɵFactoryDeclaration;
static ɵcmp: i0.ɵɵComponentDeclaration;
}
export { WrContextMenu, WrContextMenuDivider, WrContextMenuItem, WrContextMenuPanel };