import * as _angular_core from '@angular/core'; import { Provider, WritableSignal, Signal, TemplateRef, Type, Injector, ViewContainerRef, ValueProvider, ApplicationRef } from '@angular/core'; import { Middleware } from '@floating-ui/dom'; import { FocusOrigin } from '@angular/cdk/a11y'; import { Subject } from 'rxjs'; import * as ng_primitives_state from 'ng-primitives/state'; import * as ng_primitives_portal from 'ng-primitives/portal'; import { ViewportRuler } from '@angular/cdk/scrolling'; /** * Provide a null `ControlContainer` at the element level of an overlay-content root directive * (e.g. `NgpPopover`, `NgpTooltip`, `NgpMenu`). * * Overlay content is portaled but its template is often declared inside a form, so its * element-injector chain can reach that outer form's `ControlContainer` and leak it into the * overlay (ngp#677 / angular#57390). This backstop resolves `ControlContainer` to `null` at the * content root: a form declared *inside* the content sits closer in the injector chain and still * wins, while a control with no inner form resolves to `null` here instead of escaping to the * outer form. * * Pairs with the `EmbeddedViewInjector` in `overlay.ts`, which returns `notFoundValue` for the * `Host`/`SkipSelf` `ControlContainer` lookup so the element-injector walk runs and reaches this. */ declare function provideControlContainerIsolation(): Provider; /** * The positioning vocabulary the overlay primitives speak, written out in full so the public * API (and the generated docs) read as `Ngp*` types rather than re-exported Floating UI ones. * `positioning.test-d.ts` fails if a copy drifts from the Floating UI type it mirrors. */ /** Where a floating element is placed relative to its trigger, e.g. `bottom-start`. */ type NgpPlacement = 'top' | 'top-start' | 'top-end' | 'right' | 'right-start' | 'right-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end'; /** A rectangle in viewport coordinates. */ interface NgpRect { x: number; y: number; width: number; height: number; } /** * The clipping area a floating element is kept within. Pass an element (or elements) to * constrain it to a container rather than to its clipping ancestors, or an `NgpRect` to * constrain it to an arbitrary region. */ type NgpBoundary = 'clippingAncestors' | Element | Element[] | NgpRect; /** The root clipping area a floating element is kept within. */ type NgpRootBoundary = 'viewport' | 'document' | NgpRect; /** * How a floating element is positioned in the document. Named for positioning to keep it * distinct from `ScrollStrategy`, which governs what happens when the page scrolls. */ type NgpPositioningStrategy = 'absolute' | 'fixed'; /** * A positioning middleware that can be appended to the overlay's own pipeline. Still an alias - * inlining it would mean copying Floating UI's whole middleware state surface. */ type NgpMiddleware = Middleware; /** * Options for configuring flip behavior to keep the floating element in view. * The flip middleware ensures the floating element flips to the opposite side * when it would otherwise overflow the viewport. */ interface NgpFlipOptions { /** * The minimum padding between the floating element and the viewport edges. * Prevents the floating element from touching the edges of the viewport. * @default 0 */ padding?: number; /** * Placements to try sequentially if the preferred placement does not fit. * @default [oppositePlacement] (computed) */ fallbackPlacements?: NgpPlacement[]; /** * The clipping area the floating element is kept within. Pass an element (or elements) * to constrain the overlay to a container rather than its clipping ancestors. * @default 'clippingAncestors' */ boundary?: NgpBoundary; /** * The root clipping area the floating element is kept within. * @default 'viewport' */ rootBoundary?: NgpRootBoundary; /** * Whether to measure overflow against the trigger's clipping ancestors rather than the * panel's. The panel is portalled to the body, so its own clipping ancestors are * effectively the viewport - set this when the trigger sits in a scroll container. * * Applies only while `boundary` is left at its default; an explicit boundary always wins. * @default false */ altBoundary?: boolean; /** * Whether overflow along the alignment axis is checked when deciding to flip. * `'alignment'` checks it for alignment flipping only. * @default true */ crossAxis?: boolean | 'alignment'; } /** * Type representing all valid flip values. * Can be a boolean (enable/disable), undefined, or an object with detailed options. */ type NgpFlip = boolean | NgpFlipOptions | undefined; /** * Input type for flip that also accepts string representations of booleans */ type NgpFlipInput = NgpFlip | string; /** * Transform function to coerce flip input values to the correct type * @param value The input value to coerce * @returns The coerced flip value */ declare function coerceFlip(value: NgpFlipInput | null | undefined): NgpFlip; /** * Options for configuring offset between a floating element and its reference element. * Can be a single number for uniform offset or an object for axis-specific control. */ interface NgpOffsetOptions { /** * The offset along the main axis (the axis that runs along the side of the floating element). * Represents the distance between the floating element and the reference element. * @default 0 */ mainAxis?: number; /** * The offset along the cross axis (the axis that runs along the alignment of the floating element). * Represents the skidding between the floating element and the reference element. * @default 0 */ crossAxis?: number; /** * Same axis as crossAxis but applies only to aligned placements and inverts the end alignment. * When set to a number, it overrides the crossAxis value. * @default null */ alignmentAxis?: number | null; } /** * Type representing all valid offset values. * Can be a number (applies to mainAxis) or an object with axis-specific offsets. */ type NgpOffset = number | NgpOffsetOptions; /** * Input type for offset that also accepts string representations of numbers */ type NgpOffsetInput = NgpOffset | string; /** * Transform function to coerce offset input values to the correct type * @param value The input value to coerce * @returns The coerced offset value */ declare function coerceOffset(value: NgpOffsetInput | null | undefined): NgpOffset; /** Interface for overlays that can be closed immediately */ interface CooldownOverlay { /** The registry id, which is how ancestry between overlays is resolved. */ id(): string; hideImmediate(options?: { skipExitAnimation?: boolean; }): void; /** Optional signal to mark the transition as instant due to cooldown */ instantTransition?: WritableSignal; } /** * Singleton service that tracks close timestamps and active overlays per overlay type. * This enables the cooldown feature where quickly moving between triggers * of the same overlay type (e.g., tooltip to tooltip) shows the second * overlay immediately without the showDelay, and closes the first immediately. * @internal */ declare class NgpOverlayCooldownManager { private readonly registry; private readonly lastCloseTimestamps; /** * Active overlays per type, stored as a stack ordered oldest-first / topmost-last. * Most types only ever hold a single overlay, but when an overlay is nested inside * another of the same type (e.g. a popover whose trigger lives inside another * popover) the child is pushed on top of its ancestor instead of evicting it. * Closing the child then restores the ancestor as the active overlay. */ private readonly activeOverlays; /** * Record the close timestamp for an overlay type. * @param overlayType The type identifier for the overlay group */ recordClose(overlayType: string): void; /** * Check if the overlay type is within its cooldown period. * @param overlayType The type identifier for the overlay group * @param duration The cooldown duration in milliseconds * @returns true if within cooldown period, false otherwise */ isWithinCooldown(overlayType: string, duration: number): boolean; /** * Register an overlay as active for its type. * * Any existing overlay of the same type is closed immediately so that only one * overlay of each type is open at a time - *unless* it is an ancestor of the * overlay being registered. A nested overlay (its trigger rendered inside an * ancestor overlay's content) is stacked on top of its ancestor instead of * evicting it, allowing legitimate nesting to coexist while sibling overlays * still replace one another. Ancestry comes from NgpOverlayRegistry. * * @param overlayType The type identifier for the overlay group * @param overlay The overlay instance * @param cooldown The cooldown duration - if > 0, enables instant transitions */ registerActive(overlayType: string, overlay: CooldownOverlay, cooldown: number): void; /** * Unregister an overlay when it closes. * @param overlayType The type identifier for the overlay group * @param overlay The overlay instance to remove */ unregisterActive(overlayType: string, overlay: CooldownOverlay): void; /** Whether `overlay` sits inside `ancestor`, according to the registry. */ private isDescendant; /** * Check if there's an active overlay of the given type. * @param overlayType The type identifier for the overlay group * @returns true if there's an active overlay, false otherwise */ hasActiveOverlay(overlayType: string): boolean; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } /** * A dismiss guard can be a boolean or a callback that returns a boolean (sync or async). * - `true` → always dismiss * - `false` → never dismiss * - `(target) => boolean | Promise` → custom logic per interaction */ type NgpDismissGuard = boolean | ((target: T) => boolean | Promise); /** * Input type for dismiss guard inputs, accepting booleans, string booleans, or guard functions. */ type NgpDismissGuardInput = NgpDismissGuard | string; /** * Transform function for dismiss guard inputs. * Coerces string boolean values ('', 'true', 'false') while passing through * actual booleans and guard functions unchanged. */ declare function dismissGuardAttribute(value: NgpDismissGuardInput): NgpDismissGuard; /** * Dismiss policy for an overlay entry. * Determines how the overlay responds to outside clicks and escape key presses. * @internal */ interface NgpDismissPolicy { /** Whether clicking outside should close this overlay, or a guard function */ outsidePress: NgpDismissGuard; /** Whether pressing Escape should close this overlay, or a guard function */ escapeKey: NgpDismissGuard; } /** * An entry in the overlay registry representing a single visible overlay. * @internal */ interface NgpOverlayEntry { /** Unique overlay ID */ id: string; /** Parent overlay ID, null for root overlays */ parentId: string | null; /** Reference to the overlay instance for calling hide()/hideImmediate() */ overlay: NgpOverlayRef; /** Function that returns the portal DOM elements */ getElements: () => HTMLElement[]; /** The trigger element */ triggerElement: HTMLElement; /** * Optional anchor element. Pass a signal when the anchor can change while the overlay * is open - an entry is registered once per open and is not re-registered on a change. */ anchorElement?: HTMLElement | null | Signal; /** Per-instance dismiss configuration */ dismissPolicy: NgpDismissPolicy; /** If true, clicks on the trigger element are treated as outside clicks */ treatTriggerClickAsOutside?: boolean; /** Optional subject that receives pointer events that occur outside the overlay */ outsidePointerEvents$?: Subject; /** * Whether closing the parent overlay also closes this one. Defaults to true. * Set it false for an overlay that does not depend on its parent for position - a * dialog is positioned against the viewport, an anchored overlay loses its anchor. */ cascadeClose?: boolean; } /** * Minimal overlay reference needed by the registry. * This avoids a circular dependency with NgpOverlay. * @internal */ interface NgpOverlayRef { hide(options?: { immediate?: boolean; origin?: FocusOrigin; }): void; hideImmediate(): void; } /** * Singleton registry that tracks all visible overlays in open order and * provides centralized dismiss routing (outside-click and escape-key). * * Document listeners are attached when the first overlay registers and * detached when the last deregisters, avoiding permanent global listeners. * @internal */ declare class NgpOverlayRegistry { private readonly document; private readonly ngZone; private readonly escapeKeyClaims; /** Ordered list of visible overlay entries (oldest first, newest/topmost last) */ private readonly entries; /** Set of overlay IDs currently evaluating an async dismiss guard */ private readonly pendingGuardIds; /** Cleanup functions for the centralized document listeners */ private removeOutsideClickListener?; private removeEscapeKeyListener?; private removeOutsidePointerListeners?; /** Tracks the pointerdown target for CDK-compatible outside pointer event dispatch */ private pointerDownTarget; /** Composed path of the last pointerdown, so a press that starts inside an overlay keeps it open */ private pressPath; /** Open order of each entry, parallel to `entries`, which stays sorted by it. */ private readonly orders; /** The order the next freshly opened entry receives. */ private nextOrder; /** * Register an overlay as visible. Attaches document listeners if this is the first entry. * @param order The value a previous `register()` returned, to put the entry back where it * was in the stack. Omit it to register the entry as the topmost overlay. * @returns The entry's open order. */ register(entry: NgpOverlayEntry, order?: number): number; /** * Remove an overlay from the registry. * Detaches document listeners if no entries remain. */ deregister(id: string): void; /** * Close all descendants of the given overlay. * Called by NgpOverlay when it hides to cascade the close to children. */ closeDescendants(id: string): void; /** * Descendants of `id` that close along with it. The walk stops at an entry that opted * out, leaving its own subtree open too. */ private getCascadingDescendants; /** * Breadth-first walk of `id`'s subtree, so the result is parent-before-child whatever * order `entries` is in. `include` prunes an entry and its subtree. */ private collectDescendants; /** * Get all registered entries. */ getEntries(): readonly NgpOverlayEntry[]; /** * Get the topmost (most recently opened) overlay entry, or null if none. */ getTopmost(): NgpOverlayEntry | null; /** * Find the overlay whose elements contain the given DOM element. * Returns the ID of the most recently opened (topmost) containing overlay, or null. */ findContainingOverlay(element: HTMLElement): string | null; /** * Check whether overlay `ancestorId` is an ancestor of overlay `descendantId` * by walking the parentId chain. */ isAncestorOf(ancestorId: string, descendantId: string): boolean; /** * Get all descendants of the given overlay (children, grandchildren, etc.) * by walking parentId chains of all entries. */ getDescendants(id: string): NgpOverlayEntry[]; /** * Attach centralized document listeners for outside-click and escape-key. * Runs outside Angular zone to avoid unnecessary change detection on every * mouse/keyboard event. */ private attachListeners; /** * Detach centralized document listeners. */ private detachListeners; /** * Outside-click dismiss: checks all overlays (not just the topmost) and * dismisses every overlay tree where the click landed outside. * * This handles the case where a non-dismissable overlay (e.g. a tooltip) is * topmost but other overlays (e.g. a popover) should still be dismissed. */ private handleOutsideClick; /** * Check if a click (represented by its composedPath) is outside an entry's * elements, trigger, and anchor. */ private isClickOutsideEntry; /** * Escape-key dismiss: only the topmost overlay responds. */ private handleEscapeKey; /** * CDK-compatible outside pointer event dispatch. * Iterates overlays from topmost to oldest (like CDK's OverlayOutsideClickDispatcher). * For each overlay with an outsidePointerEvents$ subject, emits the event if the * click was outside its elements. Stops iterating when an overlay contains the click. */ private handleOutsidePointerEvent; /** * Get the composed event target, piercing shadow DOM boundaries. */ private getComposedTarget; /** * Check whether any of the given elements contain the target, piercing shadow DOM. */ private containsElement; /** * Evaluate a dismiss guard and call the dismiss function if allowed. * Supports boolean values and sync/async guard functions. */ private evaluateGuardAndDismiss; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } /** * A position for programmatic overlay positioning. * When provided to an overlay, it will be positioned at these coordinates * instead of being anchored to a trigger element. */ interface NgpPosition { /** Client X coordinate */ x: number; /** Client Y coordinate */ y: number; } /** * Options for configuring shift behavior to keep the floating element in view. * The shift middleware ensures the floating element stays visible by shifting it * within the viewport when it would otherwise overflow. */ interface NgpShiftOptions { /** * The minimum padding between the floating element and the viewport edges. * Prevents the floating element from touching the edges of the viewport. * @default 0 */ padding?: number; /** * The limiter function that determines how much the floating element can shift. * Common limiters from @floating-ui/dom include: * - limitShift: Limits shifting to prevent the reference element from being obscured * @default undefined */ limiter?: { fn: (state: unknown) => { x: number; y: number; }; options?: unknown; }; /** * The clipping area the floating element is kept within. Pass an element (or elements) * to constrain the overlay to a container rather than its clipping ancestors. * @default 'clippingAncestors' */ boundary?: NgpBoundary; /** * The root clipping area the floating element is kept within. * @default 'viewport' */ rootBoundary?: NgpRootBoundary; /** * Whether to measure overflow against the trigger's clipping ancestors rather than the * panel's. The panel is portalled to the body, so its own clipping ancestors are * effectively the viewport - set this when the trigger sits in a scroll container. * * Applies only while `boundary` is left at its default; an explicit boundary always wins. * @default false */ altBoundary?: boolean; /** * Whether overflow along the side axis - the one the placement points along - is also * checked when shifting. `mainAxis` covers the alignment axis and is on by default. * @default false */ crossAxis?: boolean; } /** * Type representing all valid shift values. * Can be a boolean (enable/disable), undefined, or an object with detailed options. */ type NgpShift = boolean | NgpShiftOptions | undefined; /** * Input type for shift that also accepts string representations of booleans */ type NgpShiftInput = NgpShift | string; /** * Transform function to coerce shift input values to the correct type * @param value The input value to coerce * @returns The coerced shift value */ declare function coerceShift(value: NgpShiftInput | null | undefined): NgpShift; /** * Configuration options for creating an overlay * @internal */ interface NgpOverlayConfig { /** * Content to display in the overlay (component or template). Read whenever the * overlay opens, and while it is open a change swaps the rendered content, so a * trigger can hand over an input signal and let it change. * * Clearing it closes the overlay immediately - there is nothing left to render, so * neither the hide delay nor the exit animation applies - and an overlay with no * content will not open. */ content: Signal | null | undefined>; /** The element that triggers the overlay */ triggerElement: HTMLElement; /** * The element to use for positioning the overlay (if different from trigger). * * Pass a signal to re-anchor an overlay that is already open - a plain element is * read once, when the overlay is created, and never revisited. */ anchorElement?: HTMLElement | null | Signal; /** The injector to use for creating the portal */ injector: Injector; /** ViewContainerRef to use for creating the portal */ viewContainerRef: ViewContainerRef; /** Context data to pass to the overlay content */ context?: Signal; /** * Container element or selector to attach the overlay to (defaults to document.body). * A signal is re-resolved each time the overlay opens; an open overlay is not moved. */ container?: HTMLElement | string | null | Signal; /** Preferred placement of the overlay relative to the trigger. */ placement?: Signal; /** Offset distance between the overlay and trigger. Can be a number or an object with axis-specific offsets */ offset?: NgpOffset; /** Shift configuration to keep the overlay in view. Can be a boolean, an object with options, or undefined */ shift?: NgpShift; /** Whether to enable flip behavior when space is limited, or an object with flip options */ flip?: NgpFlip; /** Delay before showing the overlay in milliseconds */ showDelay?: number; /** Delay before hiding the overlay in milliseconds */ hideDelay?: number; /** Whether the overlay should be positioned with fixed or absolute strategy */ strategy?: NgpPositioningStrategy; /** The scroll strategy to use for the overlay */ scrollBehaviour?: 'reposition' | 'block' | 'close'; /** Whether to close the overlay when clicking outside, or a guard function */ closeOnOutsideClick?: NgpDismissGuard; /** Whether to close the overlay when pressing escape, or a guard function */ closeOnEscape?: NgpDismissGuard; /** * Whether to restore focus to the trigger element when hiding the overlay. * Can be a boolean or a signal that returns a boolean. */ restoreFocus?: boolean | Signal; /** * Optional callback to update an external close origin signal. * Called when the overlay is hidden with the focus origin. * @internal */ onClose?: (origin: FocusOrigin) => void; /** Additional middleware for floating UI positioning */ additionalMiddleware?: NgpMiddleware[]; /** Additional providers */ providers?: Provider[]; /** Whether to track the trigger element position on every animation frame. Useful for moving elements like slider thumbs. */ trackPosition?: boolean; /** * Programmatic position for the overlay. When provided, the overlay will be positioned * at these coordinates instead of anchoring to the trigger element. * Use with trackPosition for smooth cursor following. */ position?: Signal; /** * If true, clicks on the trigger element count as outside clicks for dismiss purposes. * Useful for context menus where the trigger area is large and clicks on it should dismiss the menu. */ treatTriggerClickAsOutside?: boolean; /** * Overlay type identifier for cooldown grouping. * When set, overlays of the same type share a cooldown period. * For example, 'tooltip' ensures quickly moving between tooltips shows * the second one immediately without the showDelay. */ overlayType?: string; /** * When true, hiding the overlay removes its content from the DOM but keeps the * underlying component/view instance alive in memory instead of destroying it - * a later `show()` re-inserts the same instance rather than creating a new one, so * the content is not re-instantiated and any one-time setup is not repeated. * The kept-alive view stays attached to change detection while it is hidden. * * Read on each hide, so a trigger can hand over an input signal and let it change. * @default false */ keepMounted?: Signal; /** * Cooldown duration in milliseconds. * When moving from one overlay of the same type to another within this duration, * the showDelay is skipped for the new overlay. * @default 300 */ cooldown?: number; } /** Type for overlay content which can be either a template or component */ type NgpOverlayContent = TemplateRef> | Type; /** Context for template-based overlays */ type NgpOverlayTemplateContext = { $implicit: T; }; /** * NgpOverlay manages the lifecycle and positioning of overlay UI elements. * It abstracts the common behavior shared by tooltips, popovers, menus, etc. * @internal */ declare class NgpOverlay implements CooldownOverlay { private config; private readonly disposables; private readonly document; private readonly viewportRuler; private readonly destroyRef; private readonly viewContainerRef; private readonly focusMonitor; private readonly cooldownManager; private readonly registry; /** Access any parent overlays */ private readonly parentOverlay; /** Signal tracking the portal instance */ private readonly portal; /** The dedicated outlet element registered by the overlay directive (e.g. NgpMenu) */ private registeredOutletElement; /** The content the current portal was built from, to tell a real change from a repeat */ private renderedContent; /** Signal tracking the overlay position */ readonly position: _angular_core.WritableSignal<{ x: number | undefined; y: number | undefined; }>; /** * Determine if the overlay has been positioned * @internal */ readonly isPositioned: Signal; /** Signal tracking the trigger element width */ readonly triggerWidth: _angular_core.WritableSignal; /** The transform origin for the overlay */ readonly transformOrigin: _angular_core.WritableSignal; /** Signal tracking the available width before the overlay overflows the viewport */ readonly availableWidth: _angular_core.WritableSignal; /** Signal tracking the available height before the overlay overflows the viewport */ readonly availableHeight: _angular_core.WritableSignal; private availableSizePrefix; /** Signal tracking the final placement of the overlay */ readonly finalPlacement: _angular_core.WritableSignal; /** Function to dispose the positioning auto-update */ private disposePositioning?; /** Timeout handle for showing the overlay */ private openTimeout?; /** * Resolvers for every caller awaiting a scheduled open - the one that started it and * any that joined while it was pending. Without these, a `show()` returned a promise * that never settled, so anything chained onto it - e.g. moving focus into a menu once * it has opened - never ran. */ private pendingShowResolvers; /** Timeout handle for hiding the overlay */ private closeTimeout?; /** Portal currently being destroyed (for cancel support during exit animations) */ private destroyingPortal; /** * Portal kept alive (detached from the DOM but not destroyed) after a keepMounted hide, * with the content it was built from so a later show can check it is still reusable. * The registered outlet is kept too: the reused view does not construct its directive * again, so nothing would re-register it. */ private keptMounted; /** * The container the current open attached into. A content swap while open re-attaches * here rather than re-resolving `config.container`, so a container change never moves * an open overlay - it takes effect on the next open. */ private openContainer; /** This overlay's place in the registry stack, restored when a close is interrupted. */ private registryOrder?; /** * Whether the overlay itself has been torn down. A hide already in flight when that happens * finishes on its own clock, so it checks this before keeping its view mounted for reuse. */ private forceDestroyed; /** Signal tracking whether the overlay is open */ readonly isOpen: _angular_core.WritableSignal; /** A unique id for the overlay */ readonly id: _angular_core.WritableSignal; /** * Signal tracking the focus origin used to close the overlay. * Updated when hide() is called. * @internal */ readonly closeOrigin: _angular_core.WritableSignal; /** The aria-describedby attribute for accessibility */ readonly ariaDescribedBy: Signal; /** The scroll strategy */ private scrollStrategy; /** An observable that emits when the overlay is closing */ readonly closing: Subject; /** * Signal tracking whether the current transition is instant due to cooldown. * When true, CSS can skip animations using the data-instant attribute. */ readonly instantTransition: _angular_core.WritableSignal; /** * The configured anchor as given, kept in a signal of its own so `updateConfig()` * can replace it wholesale - including swapping between an element and a signal. */ private readonly anchorSource; /** * The anchor resolved to an element, so a caller passing an element, a caller passing * a signal, and a later `updateConfig()` are all handled the same way downstream. */ private readonly anchorElement; /** * Resize monitoring for the current reference element. Held so it can be moved to a * new element when the anchor changes. */ private resizeSubscription?; /** The element resizeSubscription is currently watching. */ private monitoredElement?; /** * The reference the anchor-bound bindings were last built against. Kept apart from * `monitoredElement` so that whether the anchor has moved is not answered by where the * resize observer happens to be pointed - they agree today, and a second reason to move * the observer would silently stop anchor changes being noticed at all. */ private boundReference?; /** Store the arrow element */ private arrowElement; /** Store the arrow padding signal */ private arrowPadding; /** @internal The position of the arrow */ readonly arrowPosition: _angular_core.WritableSignal<{ x: number | undefined; y: number | undefined; }>; /** * Creates a new overlay instance * @param config Initial configuration for the overlay * @param destroyRef Reference for automatic cleanup */ constructor(config: NgpOverlayConfig); /** * Watch the reference element for resizes, replacing any previous subscription so a * changed anchor is measured instead of the element it replaced. */ private monitorReferenceResize; /** * Move everything bound to the previous anchor across to the new one. The resize * observer, the close-scroll strategy's overflow ancestors and floating-ui's * `autoUpdate` reference all capture the element when they are created, so a changed * anchor has to rebuild them rather than just recompute the position. */ private handleAnchorChange; /** * The element the overlay is positioned and tracked against - the anchor when one is * configured, otherwise the trigger. */ private get referenceElement(); /** * Show the overlay with the specified delay * @param options Optional options for showing the overlay */ show(options?: { skipCooldown?: boolean; }): Promise; /** * Settle everyone who awaited a show that was already scheduled. Called both when the * open completes and when it is cancelled - the promise means "the show attempt has * finished", so callers should check `isOpen()` rather than assume success. */ private settlePendingShows; /** * Stop any pending close operation. This is useful for example, if we move the mouse from the tooltip trigger to the tooltip itself. * This will prevent the tooltip from closing immediately when the mouse leaves the trigger. * @internal */ cancelPendingClose(): void; /** * Cancel an in-progress overlay destruction. This cancels exit animations, * restores the portal, and re-enables positioning and scroll strategy. * Used when show() or cancelPendingClose() is called during exit animation. */ private cancelDestruction; /** * Hide the overlay with the specified delay * @param options Optional options for hiding the overlay */ hide(options?: OverlayTriggerOptions): void; /** * Render the current content. The portal captures its content when it is created, so * content that changes while the overlay is on screen has to rebuild it; a closed * overlay needs nothing, as opening reads the content afresh. */ private replaceContent; /** * Update the configuration of this overlay * @param config New configuration (partial) */ updateConfig(config: Partial>): void; /** * Immediately hide the overlay without any delay. * When called during cooldown transitions, this destroys the overlay * immediately without exit animations. * @param options Optional hide configuration */ hideImmediate(options?: OverlayHideImmediateOptions): void; /** * Toggle the overlay open/closed state */ toggle(): void; /** * Force update the position of the overlay */ updatePosition(): void; /** * Completely destroy this overlay instance */ destroy(): void; /** * Get the elements of the overlay */ getElements(): HTMLElement[]; /** * Register the dedicated outlet element for positioning. * Called by overlay directives (e.g. NgpMenu) during construction to ensure * the correct element is used for floating-ui positioning, even when the * directive is on a nested child component rather than the portal root. * @internal */ registerOutletElement(element: HTMLElement): void; /** * Register the custom property prefix (e.g. `--ngp-popover`) the `size` middleware writes * `-available-width` and `-available-height` under. * @internal */ registerAvailableSizePrefix(prefix: string): void; /** * Find the dedicated outlet element within the portal. * Uses the registered outlet element if available, otherwise looks for an element * with `data-overlay` attribute on the portal root elements. * Falls back to the first portal element if no dedicated outlet is found. */ private findOutletElement; /** Add this overlay to the registry. Idempotent, so an interrupted close can re-run it. */ private registerWithRegistry; /** * The overlay this one was opened from: the nearest registered overlay containing the * trigger in the DOM, else the injected one. The injector chain alone would skip a dialog, * whose injector descends from its trigger's. */ private resolveParentId; /** * Internal method to create the overlay * @param skipCooldown If true, skip registering with the cooldown manager */ private createOverlay; /** * Create the portal for the current content, attach it to the container and start * positioning it. Shared by the initial open and by content swaps. * @param content The content to render * @param immediate If true, skip the enter animation * @param container The container to attach into; resolved from the config when omitted */ private attachPortal; /** * Create the appropriate scroll strategy based on the configuration. */ private createScrollStrategy; /** * Internal method to setup positioning of the overlay */ private setupPositioning; /** * Determine the positioning strategy from the overlay element's computed CSS. * * Resolved per pass so every caller agrees: `updatePosition()` used to reach * `computePosition()` without one and take the `absolute` default, which offsets a * `fixed` panel by the page scroll. */ private resolveStrategy; /** * Compute the overlay position using floating-ui */ private computePosition; /** * Get the reference element for positioning. When a programmatic position is provided, * creates a virtual element at that position. Otherwise returns the anchor or trigger element. */ private getPositionReference; /** * Internal method to destroy the overlay portal * @param options Optional destroy configuration */ private destroyOverlay; /** * Drop `data-instant` as the element goes into its exit state, so a normal * close still animates out. * * The timing is the whole point. Consumers opt out of instant transitions with * `[data-instant][data-enter] { animation: none }`, so an element left in its * enter state without the attribute matches its entrance rule again and * replays that animation from its opening frame - the panel blinks out and * back before it exits. Removing it here keeps that window closed: the exit * state is applied synchronously by the `detach()` that follows. */ private clearInstantAttribute; /** * Destroy the view of a portal kept alive by `keepMounted`, if there is one. Used when it * can no longer be reused (the content changed) or when the overlay itself is torn down. */ private discardKeptMounted; /** * Get the transform origin for the overlay */ private getTransformOrigin; /** * Register the arrow element for positioning * @param arrowElement The arrow element * @param padding Optional padding signal between the arrow and the edges of the floating element * @internal */ registerArrow(arrowElement: HTMLElement | null, padding?: Signal): void; /** * Remove the registered arrow element * @internal */ unregisterArrow(): void; /** * Resolve the container element from the configuration * @internal */ private resolveContainer; } /** * Helper function to create an overlay in a single call * @internal */ declare function createOverlay(config: NgpOverlayConfig): NgpOverlay; /** * Helper function to inject the NgpOverlay instance * @internal */ declare function injectOverlay(): NgpOverlay; interface OverlayHideImmediateOptions { /** * When true, bypass `keepMounted` and fully destroy any kept-alive portal - used when the * overlay itself is being torn down (see `destroy()`), not just hidden. */ forceDestroy?: boolean; /** * When true, end an exit animation that is already running instead of letting it play out. * Used when another overlay of the same type is replacing this one during its cooldown, so * the swap reads as one movement rather than a cross-fade. */ skipExitAnimation?: boolean; } interface OverlayTriggerOptions { /** * Whether the visibility change should be immediate. */ immediate?: boolean; /** * The origin of the focus event that triggered the visibility change. */ origin?: FocusOrigin; } /** * The state interface for the overlay arrow. */ interface NgpOverlayArrowState { /** * The x position of the arrow. */ readonly x: Signal; /** * The y position of the arrow. */ readonly y: Signal; /** * The final placement of the overlay. */ readonly placement: Signal; /** * The padding between the arrow and the edges of the floating element. */ readonly padding: WritableSignal; /** * Set the padding between the arrow and the edges of the floating element. * @param value The padding value in pixels */ setPadding(value: number | undefined): void; } /** * The props interface for the overlay arrow. */ interface NgpOverlayArrowProps { /** * Padding between the arrow and the edges of the floating element. * This prevents the arrow from overflowing the rounded corners. */ readonly padding?: Signal; } declare const NgpOverlayArrowStateToken: _angular_core.InjectionToken; y: Signal; placement: Signal; padding: WritableSignal; setPadding: (value: number | undefined) => void; }>>; declare const ngpOverlayArrow: ({ padding: _padding }: NgpOverlayArrowProps) => { x: Signal; y: Signal; placement: Signal; padding: WritableSignal; setPadding: (value: number | undefined) => void; }; declare const injectOverlayArrowState: { (): Signal<{ x: Signal; y: Signal; placement: Signal; padding: WritableSignal; setPadding: (value: number | undefined) => void; }>; (options: ng_primitives_state.StateInjectionOptions): Signal<{ x: Signal; y: Signal; placement: Signal; padding: WritableSignal; setPadding: (value: number | undefined) => void; } | null>; (options?: ng_primitives_state.StateInjectionOptions): Signal<{ x: Signal; y: Signal; placement: Signal; padding: WritableSignal; setPadding: (value: number | undefined) => void; }> | Signal<{ x: Signal; y: Signal; placement: Signal; padding: WritableSignal; setPadding: (value: number | undefined) => void; } | null>; }; declare const provideOverlayArrowState: (opts?: { inherit?: boolean; }) => _angular_core.FactoryProvider; /** * Injects the context for the overlay. * @internal */ declare function injectOverlayContext(): Signal; /** * Provides the context for the overlay. * @param value The value to provide as the context. * @internal */ declare function provideOverlayContext(value: Signal | undefined): ValueProvider; interface NgpPortalAttachOptions { /** If true, skip enter animation delay and set enter state immediately. */ immediate?: boolean; } interface NgpPortalDetachOptions { /** If true, skip exit animations and remove immediately. */ immediate?: boolean; /** * If true, remove the root nodes from the DOM but keep the underlying view/component * instance alive instead of destroying it, so `reattach()` can cheaply re-insert it * later without the content being re-created. */ keepMounted?: boolean; } declare abstract class NgpPortal { protected readonly viewContainerRef: ViewContainerRef | null; protected readonly injector: Injector; constructor(viewContainerRef: ViewContainerRef | null, injector: Injector); /** * Get the elements of the portal. */ abstract getElements(): HTMLElement[]; /** * Detect changes in the portal. */ abstract detectChanges(): void; /** * Whether the portal is attached to a DOM element. */ abstract getAttached(): boolean; /** * Attach the portal to a DOM element. * @param container The DOM element to attach the portal to. * @param options Optional attach configuration */ abstract attach(container: HTMLElement, options?: NgpPortalAttachOptions): this; /** * Detach the portal from the DOM. * @param options Optional detach configuration */ abstract detach(options?: NgpPortalDetachOptions): Promise; /** * Cancel an in-progress detach operation. If exit animations are running, * they are cancelled and the portal transitions back to the enter state. */ abstract cancelDetach(): void; /** * End an in-progress detach now, skipping the rest of any exit animation, so * the pending `detach()` resolves and tears the view down. * * Concrete rather than abstract: `NgpPortal` is exported, so an abstract * member added here would stop any subclass outside this repo compiling. * Doing nothing is the honest default for a portal that doesn't animate. */ finishDetach(): void; /** * Re-insert a previously detached-but-kept-mounted portal's root nodes into a container. * Only valid after a `detach({ keepMounted: true })` call that left the underlying view alive. * @param container The DOM element to reattach the portal to. * @param options Optional attach configuration */ abstract reattach(container: HTMLElement, options?: NgpPortalAttachOptions): void; /** * Destroy the underlying view, releasing the content instance. Safe to call more than * once, and the only way to release a portal left alive by `detach({ keepMounted: true })`. */ abstract destroyView(): void; /** * Angular v20 removes `_unusedComponentFactoryResolver` and `_document` from DomPortalOutlet's * constructor signature as they have been deprecated since v18, and replaced with optional * `_appRef` and `_defaultInjector` params. * This temporary change ensures consistent behaviour for consumers using ng v20+. * @see {@link https://github.com/angular/components/pull/24504 The implementing PR} for the new implementation. * @see {@link https://github.com/angular/components/blob/732a0d7ab69ec25925cc06a0fb17b0fb16a4b0ae/src/cdk/portal/dom-portal-outlet.ts#L27 The latest v20 version comments} * describe the importance of passing the `_appRef` and `_defaultInjector` when it comes to component portals */ protected _getDomPortalOutletCtorParamsCompat(): (ApplicationRef | Injector | undefined | any)[]; } declare class NgpComponentPortal extends NgpPortal { private readonly componentPortal; private viewRef; private isDestroying; private detachCancelled; private exitAnimationRef; constructor(component: Type, viewContainerRef: ViewContainerRef | null, injector: Injector); /** * Attach the portal to a DOM element. * @param container The DOM element to attach the portal to. * @param options Optional attach configuration */ attach(container: HTMLElement, options?: NgpPortalAttachOptions): this; /** * Get the root elements of the portal. */ getElements(): HTMLElement[]; /** * Detect changes in the portal. */ detectChanges(): void; /** * Whether the portal is attached to a DOM element. */ getAttached(): boolean; /** * Cancel an in-progress detach operation. */ cancelDetach(): void; /** * End an in-progress detach now, skipping the rest of any exit animation. */ finishDetach(): void; /** * Detach the portal from the DOM. * @param options Optional detach configuration */ detach({ immediate, keepMounted }?: NgpPortalDetachOptions): Promise; /** * Re-insert a previously detached-but-kept-mounted component's root element into a container. */ reattach(container: HTMLElement, options?: NgpPortalAttachOptions): void; /** * Destroy the underlying view. Safe to call more than once. */ destroyView(): void; } declare class NgpTemplatePortal extends NgpPortal { private readonly templatePortal; private viewRef; private exitAnimationRefs; private isDestroying; private detachCancelled; constructor(template: TemplateRef, viewContainerRef: ViewContainerRef, injector: Injector, context?: T); /** * Attach the portal to a DOM element. * @param container The DOM element to attach the portal to. * @param options Optional attach configuration */ attach(container: HTMLElement, options?: NgpPortalAttachOptions): this; /** * Get the root elements of the portal. */ getElements(): HTMLElement[]; /** * Detect changes in the portal. */ detectChanges(): void; /** * Whether the portal is attached to a DOM element. */ getAttached(): boolean; /** * Cancel an in-progress detach operation. */ cancelDetach(): void; /** * End an in-progress detach now, skipping the rest of any exit animation. */ finishDetach(): void; /** * Detach the portal from the DOM. * @param options Optional detach configuration */ detach({ immediate, keepMounted }?: NgpPortalDetachOptions): Promise; /** * Re-insert a previously detached-but-kept-mounted embedded view's root nodes into a container. */ reattach(container: HTMLElement, options?: NgpPortalAttachOptions): void; /** * Destroy the underlying view. Safe to call more than once. */ destroyView(): void; } declare function createPortal(componentOrTemplate: Type | TemplateRef, viewContainerRef: ViewContainerRef | null, injector: Injector, context?: T): NgpPortal; interface ScrollStrategy { enable(): void; disable(): void; } declare class BlockScrollStrategy implements ScrollStrategy { private readonly viewportRuler; private readonly document; private readonly previousHTMLStyles; private previousScrollPosition; private isEnabled; constructor(viewportRuler: ViewportRuler, document: Document); /** Blocks page-level scroll while the attached overlay is open. */ enable(): void; /** Unblocks page-level scroll while the attached overlay is open. */ disable(): void; private canBeEnabled; } declare class CloseScrollStrategy implements ScrollStrategy { private readonly triggerElement; private readonly onClose; private readonly overlayElements; private cleanups; constructor(triggerElement: HTMLElement, onClose: () => void, overlayElements: () => HTMLElement[]); enable(): void; disable(): void; } declare class NoopScrollStrategy implements ScrollStrategy { enable(): void; disable(): void; } export { BlockScrollStrategy, CloseScrollStrategy, NgpComponentPortal, NgpOverlay, NgpOverlayArrowStateToken, NgpOverlayCooldownManager, NgpOverlayRegistry, NgpPortal, NgpTemplatePortal, NoopScrollStrategy, coerceFlip, coerceOffset, coerceShift, createOverlay, createPortal, dismissGuardAttribute, injectOverlay, injectOverlayArrowState, injectOverlayContext, ngpOverlayArrow, provideControlContainerIsolation, provideOverlayArrowState, provideOverlayContext }; export type { NgpBoundary, NgpDismissGuard, NgpDismissGuardInput, NgpDismissPolicy, NgpFlip, NgpFlipInput, NgpFlipOptions, NgpMiddleware, NgpOffset, NgpOffsetInput, NgpOffsetOptions, NgpOverlayArrowProps, NgpOverlayArrowState, NgpOverlayConfig, NgpOverlayContent, NgpOverlayEntry, NgpOverlayRef, NgpOverlayTemplateContext, NgpPlacement, NgpPortalAttachOptions, NgpPortalDetachOptions, NgpPosition, NgpPositioningStrategy, NgpRect, NgpRootBoundary, NgpShift, NgpShiftInput, NgpShiftOptions, OverlayHideImmediateOptions, ScrollStrategy };