{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "internal-menu-solid",
  "title": "Internal Menu (Solid)",
  "description": "Internal primitive used by Agent UI components; add a component instead.",
  "dependencies": [
    "@ui-sdk/core@0.1.0-beta.17",
    "@ui-sdk/solid@0.1.0-beta.17"
  ],
  "registryDependencies": [],
  "files": [
    {
      "path": "packages/agent-ui/src/solid/internal/menu.tsx",
      "content": "import type { JSX } from \"@solidjs/web\";\nimport {\n  Menu,\n  MenuCheckboxItem,\n  MenuContent,\n  MenuGroup,\n  MenuGroupLabel,\n  MenuItem,\n  MenuItemIcon,\n  MenuItemIndicator,\n  MenuRadioGroup,\n  MenuRadioItem,\n  MenuSeparator,\n  MenuSub,\n  MenuSubContent,\n  MenuSubTrigger,\n  MenuTrigger,\n} from \"@ui-sdk/solid/menu\";\nimport { createMemo, Show } from \"solid-js\";\nimport { iconElement, withKindClass } from \"./kind-class\";\n\nconst content =\n  \"z-50 min-w-50 rounded-[var(--kind-popup-radius)] bg-[var(--kind-color-raised)] p-[var(--kind-popup-padding)] text-[length:var(--kind-text-md)]/5 text-[var(--kind-color-fg)] shadow-[var(--kind-shadow-popover)] outline-hidden data-[presentation=sheet]:w-full data-[presentation=sheet]:max-w-none data-[presentation=sheet]:rounded-b-none data-[presentation=sheet]:pb-[max(0.5rem,env(safe-area-inset-bottom))] data-[presentation=sheet]:[&_:is([data-slot=menu-item],[data-slot=menu-checkbox-item],[data-slot=menu-radio-item],[data-slot=menu-trigger])]:py-2.5\";\nconst item =\n  \"flex cursor-default select-none items-center gap-2 rounded-[var(--kind-radius-md)] px-2.5 py-1.5 outline-hidden focus-visible:bg-[var(--kind-color-selected)] data-highlighted:bg-[var(--kind-color-selected)] data-disabled:opacity-[var(--kind-disabled-opacity)] has-[[data-menu-description]]:items-start data-destructive:text-[var(--kind-color-danger)] [&_[data-menu-text]]:flex [&_[data-menu-text]]:min-w-0 [&_[data-menu-text]]:flex-col [&_[data-menu-description]]:text-[length:var(--kind-text-xs)]/4 [&_[data-menu-description]]:text-[var(--kind-color-muted)]\";\n\nexport const KindMenu = Menu;\nexport const KindMenuTrigger = withKindClass(\n  MenuTrigger,\n  \"inline-flex h-[var(--kind-trigger-height)] items-center justify-center gap-1.5 rounded-[var(--kind-radius-full)] px-3 text-[length:var(--kind-text-md)]/5 font-medium text-[var(--kind-color-fg)] hover:bg-[var(--kind-color-hover)] data-open:bg-[var(--kind-color-selected)] focus-visible:[outline:var(--kind-focus-ring)] focus-visible:[outline-offset:var(--kind-focus-offset)] data-disabled:cursor-not-allowed data-disabled:opacity-[var(--kind-disabled-opacity)] data-pending:cursor-wait\",\n);\nexport const KindMenuContent = withKindClass(MenuContent, content);\nexport const KindMenuItem = withKindClass(MenuItem, item);\nexport const KindMenuCheckboxItem = withKindClass(MenuCheckboxItem, item);\nexport const KindMenuRadioGroup = MenuRadioGroup;\nexport const KindMenuRadioItem = withKindClass(MenuRadioItem, item);\nexport const KindMenuItemIndicator = withKindClass(\n  MenuItemIndicator,\n  \"inline-flex h-5 w-4 shrink-0 items-center justify-center text-[var(--kind-color-accent)] data-unchecked:invisible\",\n);\nexport const KindMenuItemIcon = withKindClass(\n  MenuItemIcon,\n  \"inline-flex h-5 w-4 shrink-0 items-center justify-center text-[var(--kind-color-muted)] [&_svg]:size-4\",\n);\nexport const KindMenuSub = MenuSub;\nexport const KindMenuSubTrigger = withKindClass(\n  MenuSubTrigger,\n  `${item} data-open:bg-[var(--kind-color-selected)]`,\n);\nexport const KindMenuSubContent = withKindClass(MenuSubContent, content);\nexport const KindMenuGroup = withKindClass(MenuGroup, \"py-0.5\");\nexport const KindMenuGroupLabel = withKindClass(\n  MenuGroupLabel,\n  \"px-2.5 pt-1.5 pb-1 text-[length:var(--kind-text-xs)]/4 font-medium text-[var(--kind-color-muted)]\",\n);\nexport const KindMenuSeparator = withKindClass(\n  MenuSeparator,\n  \"mx-2.5 my-1 h-px bg-[var(--kind-color-border)]\",\n);\n\nexport type KindMenuItemContentProps = {\n  /** An image URL, an element such as an inline `svg`, or a function returning one. */\n  icon?: unknown;\n  label: string;\n  description?: string | undefined;\n  /** Trailing text, like a model's cost. */\n  meta?: string | undefined;\n  /** What screen readers hear in place of `meta`. */\n  metaLabel?: string | undefined;\n};\n\n/**\n * A data row's icon and text, the label over an optional description, then its trailing `meta`, as menus built on\n * `menuBase` draw them.\n */\nexport function KindMenuItemContent(props: KindMenuItemContentProps) {\n  const icon = createMemo(() => props.icon);\n  return (\n    <>\n      <Show when={icon() !== undefined}>\n        <KindMenuItemIcon>\n          {typeof icon() === \"string\" ? <img src={icon() as string} alt=\"\" /> : iconElement(icon())}\n        </KindMenuItemIcon>\n      </Show>\n      <span data-menu-text=\"\">\n        <span>{props.label}</span>\n        <Show when={props.description}>\n          <span data-menu-description=\"\">{props.description}</span>\n        </Show>\n      </span>\n      <Show when={props.meta}>\n        <span data-menu-meta=\"\" aria-hidden={props.metaLabel ? \"true\" : undefined}>\n          {props.meta}\n        </span>\n        <Show when={props.metaLabel}>\n          <span data-menu-meta-label=\"\">{props.metaLabel}</span>\n        </Show>\n      </Show>\n    </>\n  );\n}\n\n// A part's state reaches a function child as a proxy that reads each key on its own, which a spread can't list. These\n// name the keys, so each prop keeps following its own key.\nconst readKeys = <State extends object, Key extends keyof State>(state: State, keys: readonly Key[]) =>\n  Object.defineProperties(\n    {},\n    Object.fromEntries(keys.map((key) => [key, { enumerable: true, get: () => state[key] }])),\n  ) as Pick<State, Key>;\n\nconst MENU_KEYS = [\n  \"controller\",\n  \"presentation\",\n  \"open\",\n  \"onOpenChange\",\n  \"onAction\",\n  \"onCheckedChange\",\n  \"onValueChange\",\n] as const;\nconst TRIGGER_KEYS = [\"aria-label\", \"disabled\", \"data-kind-trigger\", \"data-kind-icon-button\"] as const;\n\n/** What a `menuBase` root hands UI SDK Menu: `<KindMenu {...menuProps(menu)}>`. */\nexport const menuProps = <State extends Record<(typeof MENU_KEYS)[number], unknown>>(menu: State) =>\n  readKeys(menu, MENU_KEYS);\n\n/** What a `menuBase` trigger slot hands UI SDK's `MenuTrigger`: `<MenuTrigger {...menuTriggerProps(trigger)}>`. */\nexport const menuTriggerProps = <State extends Partial<Record<(typeof TRIGGER_KEYS)[number], unknown>>>(\n  trigger: State,\n) => readKeys(trigger, TRIGGER_KEYS);\n\n/**\n * A part's children, read once: a function of its state, or elements, else `fallback`. Solid builds element children\n * each time their getter is read, so a second read would build them twice.\n */\nexport function childrenOr<State>(\n  children: JSX.Element | ((state: State) => JSX.Element) | undefined,\n  state: State,\n  fallback: () => JSX.Element,\n): JSX.Element {\n  return typeof children === \"function\"\n    ? (children as (state: State) => JSX.Element)(state)\n    : (children ?? fallback());\n}\n",
      "type": "registry:ui",
      "target": "@ui/solid/internal/menu.tsx"
    },
    {
      "path": "packages/agent-ui/src/solid/internal/kind-class.ts",
      "content": "import type { JSX } from \"@solidjs/web\";\nimport { type Component, createComponent, merge, untrack } from \"solid-js\";\n\ntype ClassValue = string | ((state: never) => string | undefined) | undefined;\ntype Render = (props: Record<string, unknown>, state: unknown) => JSX.Element;\ntype KindProps = { class?: ClassValue; render?: Render; \"data-slot\"?: unknown };\n\nfunction mergeClass(base: string, value: ClassValue): ClassValue {\n  if (typeof value === \"function\") {\n    return (state: never) => {\n      const extra = value(state);\n      return extra ? `${base} ${extra}` : base;\n    };\n  }\n  return value ? `${base} ${value}` : base;\n}\n\n// The `data-slot` of the part whose `render` is running. The first Kind part it creates with that part's props is\n// the render target and renders its bare UI SDK part, so the element gets the outer base classes once instead of\n// both lists, as React's `withKindClass` does for `render={<KindMenuTrigger />}`.\nlet rendering: unknown;\nconst bareRenders = new WeakMap<Render, Render>();\n\nfunction bareRender(render: Render | undefined): Render | undefined {\n  if (typeof render !== \"function\") return render;\n  let bare = bareRenders.get(render);\n  if (!bare) {\n    bare = (props, state) => {\n      rendering = untrack(() => props[\"data-slot\"]);\n      try {\n        return render(props, state);\n      } finally {\n        rendering = undefined;\n      }\n    };\n    bareRenders.set(render, bare);\n  }\n  return bare;\n}\n\nexport function withKindClass<C extends (props: never) => JSX.Element>(component: C, base: string): C {\n  // UI SDK parts are generic over their props; the wrapper keeps the caller's component type.\n  const Inner = component as unknown as Component<KindProps>;\n  const Kind: Component<KindProps> = (props) => {\n    const target = rendering != null && untrack(() => props[\"data-slot\"]) === rendering;\n    if (target) rendering = undefined;\n    return createComponent(\n      Inner,\n      merge(props, {\n        get class() {\n          return target ? props.class : mergeClass(base, props.class);\n        },\n        get render() {\n          return bareRender(props.render);\n        },\n      }),\n    );\n  };\n  return Kind as unknown as C;\n}\n\n/**\n * An icon that isn't an image URL, ready to insert: a function is called untracked, so it draws a new copy in each\n * place the icon shows, and an element is cloned, since one DOM node can sit in only one place.\n */\nexport function iconElement(icon: unknown): JSX.Element {\n  if (typeof icon === \"function\") return untrack(icon as () => JSX.Element);\n  if (typeof Node !== \"undefined\" && icon instanceof Node) return icon.cloneNode(true) as JSX.Element;\n  return icon as JSX.Element;\n}\n",
      "type": "registry:ui",
      "target": "@ui/solid/internal/kind-class.ts"
    }
  ],
  "meta": {
    "layer": "solid",
    "hidden": true
  },
  "categories": [
    "internal"
  ],
  "type": "registry:ui"
}
