{"version":3,"names":["createItemHoverEmitter","menu","nodeId","event","payload","target","currentTarget","floatingTreeRoot","events","emit"],"sources":["item-hover.ts"],"sourcesContent":["import type { MenuRootContextValue } from \"../root/menu-root-context\";\n\n/** Payload of the floating tree's `itemhover` event. */\nexport interface MenuItemHoverEvent {\n\t/** Floating node of the menu the hovered item belongs to. */\n\tnodeId: string;\n\t/** The hovered item element. */\n\ttarget: EventTarget | null;\n}\n\n/**\n * Returns an `onMouseMove` handler that announces an item hover on the\n * floating tree, so an open submenu of the same menu can close when a\n * different item is hovered (see `<Menu.Positioner>`). Mirrors React's\n * `useMenuItemCommonProps` `onMouseMove`.\n *\n * `nodeId` is the floating node of the menu the item renders in, which is what\n * a child submenu sees as its `floatingParentNodeId`.\n */\nexport function createItemHoverEmitter(\n\tmenu: Pick<MenuRootContextValue, \"floatingTreeRoot\">,\n\tnodeId: string | null | undefined,\n): (event: MouseEvent) => void {\n\treturn (event) => {\n\t\tif (!nodeId) return;\n\t\tconst payload: MenuItemHoverEvent = {\n\t\t\tnodeId,\n\t\t\ttarget: event.currentTarget,\n\t\t};\n\t\tmenu.floatingTreeRoot()?.events.emit(\"itemhover\", payload);\n\t};\n}\n"],"mappings":"AAEA;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,sBAAsBA,CACrCC,IAAoD,EACpDC,MAAiC,EACH;EAC9B,OAAQC,KAAK,IAAK;IACjB,IAAI,CAACD,MAAM,EAAE;IACb,MAAME,OAA2B,GAAG;MACnCF,MAAM;MACNG,MAAM,EAAEF,KAAK,CAACG;IACf,CAAC;IACDL,IAAI,CAACM,gBAAgB,CAAC,CAAC,EAAEC,MAAM,CAACC,IAAI,CAAC,WAAW,EAAEL,OAAO,CAAC;EAC3D,CAAC;AACF","ignoreList":[]}