{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "model-control-vue",
  "title": "Model Control (Vue)",
  "description": "A button showing the model and its effort, opening a settings menu with Model and Effort submenus.",
  "dependencies": [
    "@kind-ui/agent-ui@0.9.0",
    "@ui-sdk/core@0.1.0-beta.17",
    "@ui-sdk/vue@0.1.0-beta.17"
  ],
  "registryDependencies": [
    "@kind-ui/agent-ui-setup",
    "@kind-ui/settings-menu-vue",
    "@kind-ui/internal-menu-vue"
  ],
  "files": [
    {
      "path": "packages/agent-ui/src/vue/model-control.ts",
      "content": "import {\n  type MenuPartState,\n  type ModelControlOptions,\n  type ModelControlTriggerState,\n  modelControlPrimitive,\n  type SettingsMenuContentState,\n} from \"@kind-ui/agent-ui/core\";\nimport { MenuTrigger } from \"@ui-sdk/vue/menu\";\nimport { createParts } from \"@ui-sdk/vue/primitive\";\nimport { defineComponent, h, type SlotsType, type VNode } from \"vue\";\nimport { KindMenu, KindMenuContent, KindMenuItemIcon, menuProps, menuTriggerProps } from \"./internal/menu\";\nimport { SettingsMenuRows } from \"./settings-menu\";\n\n// `@ui-sdk/vue`'s `createParts` hands the primitive an emitter for every callback, whether or not anything listens, so\n// `onAction`, whose presence offers the `actions` and `run`, is declared a function prop instead, which `@action` binds.\nconst primitive = Object.defineProperty(\n  Object.assign((options: never) => modelControlPrimitive(options), modelControlPrimitive, {\n    options: { ...modelControlPrimitive.options, onAction: \"action\" },\n  }),\n  \"name\",\n  { value: modelControlPrimitive.name },\n) as typeof modelControlPrimitive;\n\nconst parts = createParts(primitive, { root: \"div\", trigger: \"span\", content: \"div\" });\n\ntype Icon = string | VNode;\n\n/** A model, whose `icon` is an image URL or a node such as an inline `svg`. */\nexport type ModelControlModel = Omit<NonNullable<ModelControlOptions[\"models\"]>[number], \"icon\"> & {\n  icon?: Icon;\n};\n\n/** An item after the models, like \"More models\", whose `icon` is an image URL or a node. */\nexport type ModelControlAction = Omit<NonNullable<ModelControlOptions[\"actions\"]>[number], \"icon\"> & {\n  icon?: Icon;\n};\n\nconst triggerContent = ({ model, effort }: Pick<ModelControlTriggerState, \"model\" | \"effort\">) => [\n  model.icon !== undefined\n    ? h(KindMenuItemIcon, null, () =>\n        typeof model.icon === \"string\" ? h(\"img\", { src: model.icon, alt: \"\" }) : (model.icon as VNode),\n      )\n    : null,\n  h(\"span\", { \"data-model-control-model\": \"\" }, model.label),\n  ...(effort\n    ? [\n        // Spaces around the \"·\", so the accessible name reads \"GPT-5 · High\"; the trigger's gap spaces it on screen.\n        \" \",\n        h(\"span\", { \"data-model-control-separator\": \"\" }, \"·\"),\n        \" \",\n        // Every level's label shares one cell and only the chosen one shows, so the trigger keeps its width.\n        h(\n          \"span\",\n          { \"data-model-control-effort\": \"\" },\n          effort.options.map((option) =>\n            h(\n              \"span\",\n              { key: option.value, \"data-current\": option.value === effort.value ? \"\" : undefined },\n              option.label,\n            ),\n          ),\n        ),\n      ]\n    : []),\n  h(\"span\", { \"data-menu-chevron\": \"\" }),\n];\n\n/**\n * Opens the menu: UI SDK's `MenuTrigger`, named by the `label`, the model and the effort. A default slot, which gets\n * its `{ state }` (the model, the effort and the trigger's props), replaces what it shows.\n */\nexport const ModelControlTrigger = defineComponent({\n  name: \"ModelControlTrigger\",\n  inheritAttrs: false,\n  slots: Object as SlotsType<{\n    default?: { state: ModelControlTriggerState };\n    render?: Record<string, unknown>;\n  }>,\n  setup(_, { attrs, slots }) {\n    return () =>\n      h(parts.Trigger, null, {\n        default: ({ state }: { state: ModelControlTriggerState }) => {\n          const trigger = menuTriggerProps(state);\n          const shown: ModelControlTriggerState = { ...trigger, model: state.model, effort: state.effort };\n          // Hidden from agents, which use the Model Control's own actions.\n          return h(\n            MenuTrigger,\n            { ...trigger, \"data-agent-hidden\": \"\", ...attrs },\n            {\n              render: slots.render,\n              default: () => (slots.default ? slots.default({ state: shown }) : triggerContent(shown)),\n            },\n          );\n        },\n      });\n  },\n});\n\n/** The menu: UI SDK's `MenuContent` holding the rows unless you pass a slot, which gets the content's `{ state }`. Attributes go to it. */\nexport const ModelControlContent = defineComponent({\n  name: \"ModelControlContent\",\n  inheritAttrs: false,\n  slots: Object as SlotsType<{\n    default?: { state: SettingsMenuContentState };\n    render?: Record<string, unknown>;\n  }>,\n  setup(_, { attrs, slots }) {\n    return () =>\n      h(parts.Content, null, {\n        default: ({ state }: { state: SettingsMenuContentState }) =>\n          h(\n            KindMenuContent,\n            { align: \"start\", sideOffset: 6, ...attrs },\n            {\n              render: slots.render,\n              default: () =>\n                slots.default ? slots.default({ state }) : h(SettingsMenuRows, { rows: state.rows }),\n            },\n          ),\n      });\n  },\n});\n\nconst defaultParts = () => [h(ModelControlTrigger), h(ModelControlContent)];\n\n/**\n * One button for the model and its effort, reading \"GPT-5 · High\", that opens one menu: the models, grouped with\n * their icons, then the effort levels the model supports, then your own choices and toggles. A default slot replaces\n * the trigger and the content, inside UI SDK Menu.\n */\nexport const ModelControl = defineComponent({\n  name: \"ModelControl\",\n  inheritAttrs: false,\n  setup(_, { attrs, slots }) {\n    return () =>\n      h(parts.Root, attrs, {\n        ...slots,\n        default: ({ state }: { state: MenuPartState }) =>\n          h(KindMenu, menuProps(state), { default: slots.default ?? defaultParts }),\n      });\n  },\n}) as unknown as typeof parts.Root;\n",
      "type": "registry:ui",
      "target": "@ui/vue/model-control.ts"
    }
  ],
  "meta": {
    "layer": "vue"
  },
  "type": "registry:ui"
}
