/**
 * Context plumbing for `<Menu.Root>` → descendants. Mirrors
 * `packages/react/src/menu/root/MenuRootContext.ts` but threads reactive
 * accessors (Solid-native) instead of the React source's store + selector pair.
 *
 * `createContext<T | null>(null)` + `== null` sentinel — menu
 * nests recursively via `<Menu.SubmenuRoot>` so parents must tolerate reads
 * from above a provider.
 */
import { createContext, useContext } from "solid-js";

/**
 * Change-reason union for `Menu.Root`. Mirrors React 1:1.
 */

/** Wraps a payload child-render function. */

export const MenuRootContext = createContext(null);
export function useMenuRootContext(optional) {
  const ctx = useContext(MenuRootContext);
  if (ctx == null && !optional) {
    throw new Error("Base UI: MenuRootContext is missing. Menu parts must be placed within <Menu.Root>.");
  }
  return ctx;
}
//# sourceMappingURL=menu-root-context.jsx.map
