import { ID } from "../../types/index.mjs"; import { AtomProps } from "../Atom/Atom.vue.mjs"; import "../Atom/index.mjs"; import { RegistryContext, RegistryTicket } from "../../composables/createRegistry/index.mjs"; import { RovingFocusReturn } from "../../composables/useRovingFocus/index.mjs"; import { MaybeRefOrGetter, Ref, ShallowRef } from "vue"; //#region src/components/Menu/MenuRoot.vue.d.ts type MenuSource = 'keyboard' | 'click' | 'context' | 'pointer' | 'hover'; type MenuKind = 'item' | 'submenu' | 'checkbox' | 'radio'; type MenuEdge = 'first' | 'last' | 'content'; interface MenuItemInput { id?: ID; layerId: ID; kind: MenuKind; label: () => string; disabled?: MaybeRefOrGetter; el?: MaybeRefOrGetter; submenuId?: ID; onActivate?: () => void; } interface MenuItemTicket extends RegistryTicket, MenuItemInput { id: ID; layerId: ID; kind: MenuKind; label: () => string; } interface MenuActivatorInput { id?: ID; layerId: ID; disabled?: MaybeRefOrGetter; el?: MaybeRefOrGetter; } interface MenuActivatorTicket extends RegistryTicket, MenuActivatorInput { id: ID; layerId: ID; } interface MenuContentInput { id?: ID; /** Parent layer. `null` is a top menu. Absent means the content is not mounted. */ parentId?: ID | null; /** Element the layer positions against. */ anchor?: MaybeRefOrGetter; /** Focus target on dismiss when it differs from the positioning anchor. */ returnTo?: MaybeRefOrGetter; } interface MenuContentTicket extends RegistryTicket, MenuContentInput { id: ID; } interface MenuRootContext { id: string; defaultLayer: ID; disabled: Readonly>; openOnHover: Readonly>; path: Readonly>; pendingFocus: Readonly>; pendingEdge: Readonly>; register: (input: MenuItemInput) => MenuItemTicket; unregister: (id: ID) => void; items: (layerId: ID) => MenuItemTicket[]; activators: RegistryContext; content: RegistryContext; parentOf: (id: ID) => ID | null; isTop: (id: ID) => boolean; anchor: (id: ID) => Element | null; anchorName: (id: ID) => string; contentId: (id: ID) => string; triggerId: (id: ID) => string; hasActivator: (id: ID) => boolean; reveal: (id: ID, source: MenuSource, edge?: MenuEdge) => void; pop: () => void; /** Close every layer. Restores focus unless `restore` is false or focus left the menu. */ dismiss: (restore?: boolean) => void; poke: () => void; /** Drop a scheduled open. Does not start the close timer. */ cancel: () => void; /** Drop a scheduled open, and start the close timer when this menu was opened by hover. */ leave: () => void; schedule: (id: ID, source: 'hover' | 'pointer') => void; activate: (ticket: MenuItemTicket) => void; collapseTo: (layerId: ID) => void; shift: (direction: 1 | -1) => void; canShift: () => boolean; /** Match `key` against the layer's labels, searching after `from` and wrapping. */ typeahead: (layerId: ID, key: string, from?: ID) => ID | undefined; claimFocus: (layerId: ID) => ID | null | undefined; onKeydown: (layerId: ID, event: KeyboardEvent, roving: RovingFocusReturn) => void; } interface MenuRootProps extends AtomProps { /** DOM id prefix for the menu and the controls that open it */ id?: string; /** Layer id used when an activator or content omits `value` */ value?: ID; /** Disables every activator and item in this menu */ disabled?: boolean; /** Delay before a hover or pointer open. Keyboard, click, and right-click skip it. */ openDelay?: number; /** Delay before a hover-opened menu closes after the pointer leaves */ closeDelay?: number; /** Open the top menu when the pointer rests on its activator */ openOnHover?: boolean; /** Injection key. @default 'v0:menu' */ namespace?: string; } interface MenuRootSlotProps { /** Whether any layer of this menu is open */ isOpen: boolean; /** Top layer id while open */ layer: ID | null; /** Close every layer. Restores focus unless `restore` is false or focus left the menu. */ dismiss: (restore?: boolean) => void; } declare const useMenuRoot: (key: string, defaultValue?: MenuRootContext | undefined) => MenuRootContext, provideMenuRoot: (key: string, context: MenuRootContext, app?: import("vue").App) => MenuRootContext; declare const _default: typeof __VLS_export; declare const __VLS_export: __VLS_WithSlots any; }, string, import("vue").PublicProps, Readonly & Readonly<{ "onUpdate:modelValue"?: ((...args: unknown[]) => any) | undefined; }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, { default: (props: MenuRootSlotProps) => any; }>; type __VLS_WithSlots = T & { new (): { $slots: S; }; }; //#endregion export { MenuActivatorInput, MenuActivatorTicket, MenuContentInput, MenuContentTicket, MenuEdge, MenuItemInput, MenuItemTicket, MenuKind, MenuRootContext, MenuRootProps, MenuRootSlotProps, MenuSource, _default as default, provideMenuRoot, useMenuRoot };