{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "context-menu",
  "title": "Context menu",
  "description": "Menu opened on an object (right-click, long-press, Menu key): Menu's rows and submenus; marks the object while open.",
  "dependencies": [
    "@base-ui/react@1.9.0"
  ],
  "registryDependencies": [
    "@keyline-ui/keyline",
    "utils",
    "@keyline-ui/keyline-scope",
    "@keyline-ui/menu",
    "@keyline-ui/keyline-render"
  ],
  "files": [
    {
      "path": "src/registry/keyline/ui/context-menu.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { ContextMenu as ContextMenuPrimitive } from \"@base-ui/react/context-menu\";\n\nimport { cn } from \"@/lib/utils\";\nimport { scopeProps, useKeylineScope } from \"../lib/keyline-scope\";\nimport { resolveClassName } from \"../lib/keyline-render\";\nimport { MenuSurface } from \"./menu\";\n\n/**\n * A menu opened on an object (right-click, long-press, the Menu key or Shift+F10 on a focused target).\n * Rows are Menu's rows: build the content from MenuItem, MenuSeparator, MenuGroup / MenuGroupLabel and\n * MenuSubmenuRoot from `./menu` (re-exported here under ContextMenu names), so a context menu and a menu button\n * read the same. Parts are named as Base UI names them.\n *\n * - The area (`ContextMenuTrigger`) marks the object the menu acts on while it is open: an inset ink\n *   keyline on its own edge (the object, not the page, is the subject). Nothing else changes.\n * - The surface opens at the pointer (Base UI's offsets put the pointer 2px inside its top-start corner, so a\n *   release right after opening does not land on the first row); control weight on all sides and no cut, and unfolds away\n *   from the pointer (from the side Base UI placed it on); it carries the configuration of the place\n *   it is written (theme, cut, density, motion, dir).\n * - A context menu is a shortcut, never the only path: put every action somewhere visible too (APG).\n *\n * Opening, positioning at the pointer, long-press on touch, keyboard, typeahead and focus return are\n * Base UI Context Menu's.\n */\nconst ContextMenuRoot = ContextMenuPrimitive.Root;\nconst ContextMenu = ContextMenuRoot;\n\n/* the object the open menu acts on: an inset ink keyline on its own edge (no fill: its content stays readable, and\n   a selected row keeps its yellow) */\nconst marked = cn(\n  \"data-popup-open:outline-(length:--kl-k2) data-popup-open:outline-offset-[calc(-1*var(--kl-k2))]\",\n  \"data-popup-open:outline-kl-inverse data-popup-open:outline-solid forced-colors:data-popup-open:outline-[Highlight]\",\n);\n\n/** The area the menu opens on. Rendered as another part (`render={<Item />}`), the element is that part's and\n * carries its data-slot; the mark while open is added to it. */\nfunction ContextMenuTrigger({ className, ...props }: ContextMenuPrimitive.Trigger.Props): React.ReactElement {\n  return (\n    <ContextMenuPrimitive.Trigger\n      className={resolveClassName(marked, className)}\n      {...props}\n      data-slot=\"context-menu-trigger\"\n    />\n  );\n}\n\ntype PositionerProps = ContextMenuPrimitive.Positioner.Props;\n\ntype ContextMenuPopupProps = React.ComponentProps<typeof MenuSurface> &\n  Pick<PositionerProps, \"anchor\" | \"side\" | \"align\" | \"sideOffset\" | \"alignOffset\" | \"collisionPadding\"> & {\n    /** Where the portal renders (defaults to <body>). */\n    container?: ContextMenuPrimitive.Portal.Props[\"container\"];\n    /** Props for Base UI's ContextMenu.Portal. */\n    portalProps?: Omit<ContextMenuPrimitive.Portal.Props, \"container\" | \"children\">;\n  };\n\n/**\n * The menu: Base UI's Portal, Positioner and Popup in one part, with the positioner's placement props lifted (Base\n * UI places it at the pointer). Not docked to an owner: control weight on every side and a minimum width of its own.\n * The surface is Menu's (MenuSurface), so it carries `data-slot=\"menu-popup\"`.\n */\nfunction ContextMenuPopup({\n  anchor,\n  side,\n  align,\n  sideOffset,\n  alignOffset,\n  collisionPadding = 8,\n  container,\n  portalProps,\n  className,\n  ...props\n}: ContextMenuPopupProps): React.ReactElement {\n  const [marker, scope, probe] = useKeylineScope(false, container);\n  return (\n    <>\n      {marker}\n      <ContextMenuPrimitive.Portal container={container} {...portalProps}>\n        {probe}\n        <ContextMenuPrimitive.Positioner\n          anchor={anchor}\n          side={side}\n          align={align}\n          sideOffset={sideOffset}\n          alignOffset={alignOffset}\n          collisionPadding={collisionPadding}\n          {...scopeProps(scope, { className: \"kl-positioner\" })}\n        >\n          <MenuSurface className={resolveClassName(\"min-w-[220px]\", className)} {...props} />\n        </ContextMenuPrimitive.Positioner>\n      </ContextMenuPrimitive.Portal>\n    </>\n  );\n}\n\nexport { ContextMenu, ContextMenuRoot, ContextMenuTrigger, ContextMenuPopup };\n\n/* The rows are Menu's (Base UI's ContextMenu items are its Menu items). Re-exported under ContextMenu\n   names so a context menu imports from one place; importing them from ./menu is equivalent. A submenu's popup is\n   Menu's MenuPopup, which docks beside its row. */\nexport {\n  MenuItem as ContextMenuItem,\n  MenuCheckboxItem as ContextMenuCheckboxItem,\n  MenuRadioGroup as ContextMenuRadioGroup,\n  MenuRadioItem as ContextMenuRadioItem,\n  MenuSeparator as ContextMenuSeparator,\n  MenuGroup as ContextMenuGroup,\n  MenuGroupLabel as ContextMenuGroupLabel,\n  MenuSubmenuRoot as ContextMenuSubmenuRoot,\n  MenuSubmenuTrigger as ContextMenuSubmenuTrigger,\n  MenuPopup as ContextMenuSubmenuPopup,\n} from \"./menu\";\n",
      "type": "registry:ui",
      "target": "components/keyline/ui/context-menu.tsx"
    }
  ],
  "type": "registry:ui"
}