{"version":3,"names":["createContext","useContext","MenubarContext","useMenubarContext","optional","ctx","Error"],"sources":["menubar-context.ts"],"sourcesContent":["/**\n * Context plumbing for `<Menubar>` → contained `<Menu.Root>`s. Mirrors\n * `packages/react/src/menubar/MenubarContext.ts` but threads reactive\n * accessors instead of React mutable objects.\n *\n * `createContext<T | null>(null)` + `== null` sentinel — a\n * `<Menu.Root>` may be used standalone (no menubar above), in which case\n * parent-from-context detection returns `null`.\n */\nimport { type Accessor, createContext, useContext } from \"solid-js\";\nimport type { MutableRef } from \"../internals/floating-ui/types\";\nimport type { MenuRootOrientation } from \"../menu/root/menu-root-context\";\n\nexport interface MenubarContextValue {\n\t/** Whether the menubar is modal. */\n\tmodal: Accessor<boolean>;\n\t/** Whether the menubar is disabled. */\n\tdisabled: Accessor<boolean>;\n\t/** The root `role=\"menubar\"` element (for outside-press containment). */\n\tcontentElement: Accessor<HTMLElement | null>;\n\tsetContentElement: (el: HTMLElement | null) => void;\n\t/** Whether any child menu is currently open. */\n\thasSubmenuOpen: Accessor<boolean>;\n\tsetHasSubmenuOpen: (open: boolean) => void;\n\t/** Visual/keyboard orientation of the menubar. */\n\torientation: Accessor<MenuRootOrientation>;\n\t/** Whether mouseup on a menu item should commit (used by child menus). */\n\tallowMouseUpTriggerRef: MutableRef<boolean>;\n\t/** DOM id of the `<Menubar>` element, useful for `aria-controls`. */\n\trootId: Accessor<string | undefined>;\n\n\t/**\n\t * Called by contained `<Menu.Root>`s when their open state changes. Used to\n\t * coordinate sibling auto-close (only one menu open at a time) and to keep\n\t * `hasSubmenuOpen` in sync.\n\t *\n\t * The `closer` callback is invoked on the previously-open menu to request\n\t * its closure when another sibling opens. Returns a cleanup function the\n\t * child should call on unmount or when its open state flips back.\n\t */\n\tregisterOpenMenu: (closer: () => void) => () => void;\n}\n\nexport const MenubarContext = createContext<MenubarContextValue | null>(null);\n\nexport function useMenubarContext(): MenubarContextValue;\nexport function useMenubarContext(optional: true): MenubarContextValue | null;\nexport function useMenubarContext(\n\toptional?: boolean,\n): MenubarContextValue | null {\n\tconst ctx = useContext(MenubarContext);\n\tif (ctx == null && !optional) {\n\t\tthrow new Error(\n\t\t\t\"Base UI: MenubarContext is missing. Menubar parts must be placed within <Menubar>.\",\n\t\t);\n\t}\n\treturn ctx;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAwBA,aAAa,EAAEC,UAAU,QAAQ,UAAU;AAkCnE,OAAO,MAAMC,cAAc,GAAGF,aAAa,CAA6B,IAAI,CAAC;AAI7E,OAAO,SAASG,iBAAiBA,CAChCC,QAAkB,EACW;EAC7B,MAAMC,GAAG,GAAGJ,UAAU,CAACC,cAAc,CAAC;EACtC,IAAIG,GAAG,IAAI,IAAI,IAAI,CAACD,QAAQ,EAAE;IAC7B,MAAM,IAAIE,KAAK,CACd,oFACD,CAAC;EACF;EACA,OAAOD,GAAG;AACX","ignoreList":[]}