import type { JSX } from "@solidjs/web"; /** * `createNavigationMenu` — headless primitive for the NavigationMenu compound. * * Owns: * - `value` — currently active item value (consumer-owned signal). * - `open` — derived as `value() != null`. * - `activationDirection` — animation hint for content panels. * - `viewportInert` — whether the viewport is inert (pointer-events guard). * - `setValue` — pure event-emitter via `runWithOwner(null, ...)`. * * DOM concerns (FloatingTree, floating-root context, refs, transition, * focus return, popupElement, positionerElement) stay in * ``. */ import { type Accessor, type Setter } from "solid-js"; import { type MaybeAccessor } from "../internals/maybe-accessor.js"; import type { NavigationMenuActivationDirection, NavigationMenuRootChangeEventDetails, NavigationMenuRootChangeEventReason } from "./root/navigation-menu-root-context.js"; export type NavigationMenuChangeReason = NavigationMenuRootChangeEventReason; export interface CreateNavigationMenuOptions { /** * Currently active item value. Consumer-owned signal — `null` means closed. * The primitive reads through the accessor and does NOT keep an internal * copy. Writes happen via `onValueChange`. */ value: MaybeAccessor; /** * Called via `runWithOwner(null, ...)` so consumer signal writes don't * trigger SIGNAL_WRITE_IN_OWNED_SCOPE. */ onValueChange?: (value: Value | null, details: NavigationMenuRootChangeEventDetails) => void; /** * Hover open delay in ms. * @default 50 */ delay?: MaybeAccessor; /** * Hover close delay in ms. * @default 50 */ closeDelay?: MaybeAccessor; /** * Orientation of the navigation menu. * @default "horizontal" */ orientation?: MaybeAccessor<"horizontal" | "vertical">; } export interface NavigationMenuApi { /** Currently active item value (or null). */ value: Accessor; /** Whether any item is currently active. */ open: Accessor; /** Hover open delay. */ delay: Accessor; /** Hover close delay. */ closeDelay: Accessor; /** Orientation. */ orientation: Accessor<"horizontal" | "vertical">; /** Direction of the most recent activation transition. */ activationDirection: Accessor; /** Whether the viewport is inert (pointer-events guard during transitions). */ viewportInert: Accessor; /** * Pure event-emitter — fires `onValueChange` via `runWithOwner(null, ...)`. * The consumer owns the signal write. */ setValue: (next: Value | null, details?: NavigationMenuRootChangeEventDetails) => void; /** Update the activation direction. Internal coordination for animations. */ setActivationDirection: Setter; /** Toggle the viewport inert state. Internal coordination. */ setViewportInert: Setter; /** Context provider — expose the api via `useNavigationMenu()`. */ Provider: (props: { children: JSX.Element; }) => JSX.Element; } /** * Read the nearest {@link NavigationMenuApi}. Throws unless `optional` is true. */ export declare function useNavigationMenu(): NavigationMenuApi; export declare function useNavigationMenu(optional: true): NavigationMenuApi | null; /** * Headless primitive for the NavigationMenu compound. Owns the value / * derived-open state, activation direction, and viewport-inert flag. DOM * concerns (FloatingTree, refs, transition, focus return, positioner) live * in ``. */ export declare function createNavigationMenu(options: CreateNavigationMenuOptions): NavigationMenuApi; //# sourceMappingURL=create-navigation-menu.d.ts.map