/** * DOM builder for row context-menu items. * * Kept separate from the selection engine that owns the menu so the item model * — kinds, icons, nesting, dynamic values, activation — is one small, testable * unit with no knowledge of clipboard ranges or charting. * * Items render with the same class names as the menu's built-in entries, so * custom actions inherit the menu's theming, hover behaviour, submenu fly-outs * and viewport-edge flipping without a single new positioning rule. * * @packageDocumentation */ import type { IconRenderer } from '../icons/icon-renderer'; import type { RowMenuInteractiveItem, RowMenuItem, RowMenuItemContext, RowMenuItemPredicate, RowMenuValue } from '../types/row-menu.types'; /** * Called when an item is activated. * * The builder resolves *which* item and *where*; the owner decides what * activation means — confirmation, async lifecycle, closing, events. * * @param item - The activated item. * @param ctx - The context it was resolved against. * @param el - The item's element, so the owner can flag it busy. */ export type RowMenuActivateHandler = (item: RowMenuInteractiveItem, ctx: RowMenuItemContext, el: HTMLElement) => void; /** * Resolves a value that may be a literal or a function of the clicked row. * * @param value - The literal or function, or `undefined`. * @param ctx - Context describing the row the menu was opened on. * @returns The resolved value, or `undefined` when nothing was supplied. */ export declare function resolveValue(value: RowMenuValue | undefined, ctx: RowMenuItemContext): T | undefined; /** * Resolves a predicate, treating an omitted value as `false`. * * @param value - The literal or predicate, or `undefined`. * @param ctx - Context describing the row the menu was opened on. */ export declare function resolvePredicate(value: RowMenuItemPredicate | undefined, ctx: RowMenuItemContext): boolean; /** * Builds the elements for a list of row-menu items. * * Resolution order per item: `hidden` → children → kind. An item with visible * children becomes a submenu parent (which is what draws the trailing chevron * and reveals the fly-out on hover); everything else becomes a leaf whose * indicator depends on its `type`. * * Separators are normalised rather than trusted: leading, trailing and * consecutive rules are dropped, so a separator adjacent to a hidden item never * leaves a stray line. The deprecated `separatorBefore` flag is folded into the * same pass, so the two styles can be mixed freely. * * @param items - Items to render, in order. * @param ctx - Context for dynamic values and handlers. * @param iconRenderer - Resolves registry icon names. * @param onActivate - Invoked when an enabled item is clicked. * @returns The rendered elements, ready to append to a menu container. */ export declare function buildRowMenuItems(items: ReadonlyArray, ctx: RowMenuItemContext, iconRenderer: IconRenderer, onActivate: RowMenuActivateHandler): HTMLElement[]; //# sourceMappingURL=row-menu-builder.d.ts.map